}
try
{
statement = con.prepareStatement("SELECT npcid, skillid, level FROM npcskills");
rs = statement.executeQuery();
L2NpcTemplate npcDat;
L2Skill npcSkill;
GArray<Integer> unimpl = new GArray<Integer>();
int counter = 0;
while(rs.next())
{
int mobId = rs.getInt("npcid");
npcDat = _npcs[mobId];
if(npcDat == null)
{
continue;
}
short skillId = rs.getShort("skillid");
short level = rs.getShort("level");
// Для определения расы используется скилл 4416
if(skillId == 4416)
{
npcDat.setRace(level);
}
if(skillId >= 4290 && skillId <= 4302)
{
_log.info("Warning! Skill " + skillId + " not used, use 4416 instead.");
continue;
}
if(skillId == 4408)
{
if(CatacombSpawnManager._monsters.contains(mobId))
{
level = (short) (Config.ALT_CATACOMB_MODIFIER_HP + 8);
npcDat.setRateHp(hprateskill[level]);
if(Config.ALT_CATACOMB_MODIFIER_HP != 4)
{
npcDat.addSkill(SkillTable.getInstance().getInfo(4417, Config.ALT_CATACOMB_MODIFIER_HP));
}
}
else
{
npcDat.setRateHp(hprateskill[level]);
}
}
npcSkill = SkillTable.getInstance().getInfo(skillId, level);
if(npcSkill == null || npcSkill.getSkillType() == SkillType.NOTDONE)
{
unimpl.add(Integer.valueOf(skillId));
}
if(npcSkill == null)
{
continue;
}
npcDat.addSkill(npcSkill);
counter++;
}
new File("log/game/unimplemented_npc_skills.txt").delete();
for(Integer i : unimpl)
{
Log.add("[" + i + "] " + SkillTable.getInstance().getInfo(i, 1), "unimplemented_npc_skills", "");
}
_log.info("Loaded " + counter + " npc skills.");
}
catch(Exception e)
{
_log.log(Level.SEVERE, "error while reading npcskills table ", e);
}
finally
{
DatabaseUtils.closeDatabaseSR(statement, rs);
}
try
{
statement = con.prepareStatement("SELECT mobId, itemId, min, max, sweep, chance, category FROM droplist ORDER BY mobId, category, chance DESC");
rs = statement.executeQuery();
L2DropData dropDat;
L2NpcTemplate npcDat;
while(rs.next())
{
int mobId = rs.getInt("mobId");
npcDat = _npcs[mobId];
if(npcDat != null)
{
dropDat = new L2DropData();
int id = rs.getShort("itemId");
if(ItemTable.getInstance().getTemplate(id).isCommonItem())
{
if(Config.ALT_ALLOW_DROP_COMMON)
{
dropDat.setChance(rs.getInt("chance") * Config.RATE_DROP_COMMON_ITEMS);
dropDat.setItemId(id);
}
else
{
int normalid = ItemTable.getInstance().findBaseId(id);
dropDat.setChance(((double) rs.getInt("chance")) * ItemTable.getInstance().getTemplate(id).getReferencePrice() / ItemTable.getInstance().getTemplate(normalid).getReferencePrice());
dropDat.setItemId(normalid);
}
}
else
{
dropDat.setItemId(id);
dropDat.setChance(rs.getInt("chance"));
}
dropDat.setMinDrop(rs.getInt("min"));
dropDat.setMaxDrop(rs.getInt("max"));
dropDat.setSweep(rs.getInt("sweep") == 1);
if(dropDat.getItem().isArrow() || dropDat.getItemId() == 1419)
{
dropDat.setGroupId(Byte.MAX_VALUE); // группа для нерейтуемых предметов, сюда же надо всякую фигню
}
else
{
dropDat.setGroupId(rs.getInt("category"));
}
npcDat.addDropData(dropDat);
}
}
for(L2NpcTemplate temp : _npcs)
{
if(temp != null && temp.getDropData() != null)
{
if(!temp.getDropData().validate())
{
_log.warning("Problems with droplist for " + temp.toString());
}
}
}
if(Config.ALT_GAME_SHOW_DROPLIST && !Config.ALT_GAME_GEN_DROPLIST_ON_DEMAND)
{
FillDropList();
}
else
{
_log.info("Players droplist load skipped");
}
loadKillCount();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "error reading npc drops ", e);
}
finally
{
DatabaseUtils.closeDatabaseSR(statement, rs);
}
try
{
statement = con.prepareStatement("SELECT boss_id, minion_id, amount FROM minions");
rs = statement.executeQuery();
L2MinionData minionDat;
L2NpcTemplate npcDat;
int cnt = 0;
while(rs.next())
{
int raidId = rs.getInt("boss_id");
npcDat = _npcs[raidId];
minionDat = new L2MinionData();
minionDat.setMinionId(rs.getInt("minion_id"));
minionDat.setAmount(rs.getByte("amount"));
npcDat.addRaidData(minionDat);
cnt++;
}
_log.info("NpcTable: Loaded " + cnt + " Minions.");
}
catch(Exception e)
{
_log.log(Level.SEVERE, "error loading minions", e);
}
finally
{
DatabaseUtils.closeDatabaseSR(statement, rs);
}
try
{
statement = con.prepareStatement("SELECT npc_id, class_id FROM skill_learn");
rs = statement.executeQuery();
L2NpcTemplate npcDat;
int cnt = 0;
while(rs.next())
{
npcDat = _npcs[rs.getInt(1)];
npcDat.addTeachInfo(ClassId.values()[rs.getInt(2)]);
cnt++;
}
_log.info("NpcTable: Loaded " + cnt + " SkillLearn entrys.");
}
catch(Exception e)