|
|
|
@ -23,6 +23,7 @@ import java.sql.PreparedStatement;
@@ -23,6 +23,7 @@ import java.sql.PreparedStatement;
|
|
|
|
|
import java.sql.ResultSet; |
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
|
|
public class dbNPCHandler extends dbHandlerBase { |
|
|
|
|
|
|
|
|
@ -31,6 +32,45 @@ public class dbNPCHandler extends dbHandlerBase {
@@ -31,6 +32,45 @@ public class dbNPCHandler extends dbHandlerBase {
|
|
|
|
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() { |
|
|
|
|
|
|
|
|
|
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>(); |
|
|
|
|
int runeSetID; |
|
|
|
|
int runeBaseID; |
|
|
|
|
int recordsRead = 0; |
|
|
|
|
|
|
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_runeSet")) { |
|
|
|
|
|
|
|
|
|
ResultSet rs = preparedStatement.executeQuery(); |
|
|
|
|
|
|
|
|
|
while (rs.next()) { |
|
|
|
|
|
|
|
|
|
recordsRead++; |
|
|
|
|
|
|
|
|
|
runeSetID = rs.getInt("runeSet"); |
|
|
|
|
runeBaseID = rs.getInt("runeBase"); |
|
|
|
|
|
|
|
|
|
if (runeSets.get(runeSetID) == null) { |
|
|
|
|
ArrayList<Integer> runeList = new ArrayList<>(); |
|
|
|
|
runeList.add(runeBaseID); |
|
|
|
|
runeSets.put(runeSetID, runeList); |
|
|
|
|
} else { |
|
|
|
|
ArrayList<Integer> runeList = runeSets.get(runeSetID); |
|
|
|
|
runeList.add(runeSetID); |
|
|
|
|
runeSets.put(runeSetID, runeList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
|
Logger.error(e); |
|
|
|
|
return runeSets; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Logger.info("read: " + recordsRead + " cached: " + runeSets.size()); |
|
|
|
|
return runeSets; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public NPC PERSIST(NPC toAdd) { |
|
|
|
|
|
|
|
|
|
NPC npc = null; |
|
|
|
|