private void fillNpcTable(ResultSet NpcData, boolean custom) throws Exception
{
while(NpcData.next())
{
StatsSet npcDat = new StatsSet();
int id = NpcData.getInt("id");
npcDat.set("npcId", id);
npcDat.set("idTemplate", NpcData.getInt("idTemplate"));
//Level: for special bosses could be different
int level = 0;
float diff = 0; //difference between setted value and retail one
boolean minion = false;
switch(id)
{
case 29002: // and minions
case 29003:
case 29004:
case 29005:
minion = true;
case 29001://queenAnt
{
if(Config.QA_LEVEL > 0)
{
diff = Config.QA_LEVEL - NpcData.getInt("level");
level = Config.QA_LEVEL;
}
else
level = NpcData.getInt("level");
}
break;
case 29022:
{ //zaken
if(Config.ZAKEN_LEVEL > 0)
{
diff = Config.ZAKEN_LEVEL - NpcData.getInt("level");
level = Config.ZAKEN_LEVEL;
}
else
level = NpcData.getInt("level");
}
break;
case 29015: //and minions
case 29016:
case 29017:
case 29018:
minion = true;
case 29014://orfen
{
if(Config.ORFEN_LEVEL > 0)
{
diff = Config.ORFEN_LEVEL - NpcData.getInt("level");
level = Config.ORFEN_LEVEL;
}
else
level = NpcData.getInt("level");
}
break;
case 29007: //and minions
case 29008:
case 290011:
minion = true;
case 29006: //core
{
if(Config.CORE_LEVEL > 0)
{
diff = Config.CORE_LEVEL - NpcData.getInt("level");
level = Config.CORE_LEVEL;
}
else
level = NpcData.getInt("level");
}
break;
default:
{
level = NpcData.getInt("level");
}
}
npcDat.set("level", level);
npcDat.set("jClass", NpcData.getString("class"));
npcDat.set("baseShldDef", 0);
npcDat.set("baseShldRate", 0);
npcDat.set("baseCritRate", 4);
npcDat.set("name", NpcData.getString("name"));
npcDat.set("serverSideName", NpcData.getBoolean("serverSideName"));
//npcDat.set("name", "");
npcDat.set("title", NpcData.getString("title"));
npcDat.set("serverSideTitle", NpcData.getBoolean("serverSideTitle"));
npcDat.set("collision_radius", NpcData.getDouble("collision_radius"));
npcDat.set("collision_height", NpcData.getDouble("collision_height"));
npcDat.set("sex", NpcData.getString("sex"));
npcDat.set("type", NpcData.getString("type"));
npcDat.set("baseAtkRange", NpcData.getInt("attackrange"));
//BOSS POWER CHANGES
double multi_value = 1;
if(diff >= 15)
{ //means that there is level customization
multi_value = multi_value * (diff / 10);
}
else if(diff > 0 && diff < 15)
{
multi_value = multi_value + (diff / 10);
}
if(minion)
{
multi_value = multi_value * Config.LEVEL_DIFF_MULTIPLIER_MINION; //allow to increase the power of a value
//that for example, at 40 diff levels is
//equal to
// value = ((40/10)*0.8) = 3,2 --> 220 % more
}
else
{
switch(id)
{
case 29001:
{//queenAnt
if(Config.QA_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.QA_POWER_MULTIPLIER;
}
}
break;
case 29022:
{ //zaken
if(Config.ZAKEN_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.ZAKEN_POWER_MULTIPLIER;
}
}
break;
case 29014:
{//orfen
if(Config.ORFEN_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.ORFEN_POWER_MULTIPLIER;
}
}
break;
case 29006:
{ //core
if(Config.CORE_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.CORE_POWER_MULTIPLIER;
}
}
break;
case 29019:
{ //antharas
if(Config.ANTHARAS_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.ANTHARAS_POWER_MULTIPLIER;
}
}
break;
case 29028:
{ //valakas
if(Config.VALAKAS_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.VALAKAS_POWER_MULTIPLIER;
}
}
break;
case 29020:
{ //baium
if(Config.BAIUM_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.BAIUM_POWER_MULTIPLIER;
}
}
break;
case 29045:
{ //frintezza
if(Config.FRINTEZZA_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.FRINTEZZA_POWER_MULTIPLIER;
}
}
break;
default:
{
}
}
}
npcDat.set("rewardExp", NpcData.getInt("exp") * multi_value);
npcDat.set("rewardSp", NpcData.getInt("sp") * multi_value);
npcDat.set("basePAtkSpd", NpcData.getInt("atkspd") * multi_value);
npcDat.set("baseMAtkSpd", NpcData.getInt("matkspd") * multi_value);
npcDat.set("baseHpMax", NpcData.getInt("hp") * multi_value);
npcDat.set("baseMpMax", NpcData.getInt("mp") * multi_value);
npcDat.set("baseHpReg", (int) NpcData.getFloat("hpreg") * multi_value > 0 ? NpcData.getFloat("hpreg") : 1.5 + (level - 1) / 10.0);
npcDat.set("baseMpReg", (int) NpcData.getFloat("mpreg") * multi_value > 0 ? NpcData.getFloat("mpreg") : 0.9 + 0.3 * (level - 1) / 10.0);
npcDat.set("basePAtk", NpcData.getInt("patk") * multi_value);
npcDat.set("basePDef", NpcData.getInt("pdef") * multi_value);
npcDat.set("baseMAtk", NpcData.getInt("matk") * multi_value);
npcDat.set("baseMDef", NpcData.getInt("mdef") * multi_value);
npcDat.set("aggroRange", NpcData.getInt("aggro"));
npcDat.set("rhand", NpcData.getInt("rhand"));
npcDat.set("lhand", NpcData.getInt("lhand"));
npcDat.set("armor", NpcData.getInt("armor"));
npcDat.set("baseWalkSpd", NpcData.getInt("walkspd"));
npcDat.set("baseRunSpd", NpcData.getInt("runspd"));
// constants, until we have stats in DB
// constants, until we have stats in DB
npcDat.safeSet("baseSTR", NpcData.getInt("str"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: "+NpcData.getInt("idTemplate"));
npcDat.safeSet("baseCON", NpcData.getInt("con"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: "+NpcData.getInt("idTemplate"));
npcDat.safeSet("baseDEX", NpcData.getInt("dex"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: "+NpcData.getInt("idTemplate"));
npcDat.safeSet("baseINT", NpcData.getInt("int"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: "+NpcData.getInt("idTemplate"));
npcDat.safeSet("baseWIT", NpcData.getInt("wit"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: "+NpcData.getInt("idTemplate"));
npcDat.safeSet("baseMEN", NpcData.getInt("men"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: "+NpcData.getInt("idTemplate"));
/*
npcDat.set("baseSTR", NpcData.getInt("str"));
npcDat.set("baseCON", NpcData.getInt("con"));
npcDat.set("baseDEX", NpcData.getInt("dex"));
npcDat.set("baseINT", NpcData.getInt("int"));
npcDat.set("baseWIT", NpcData.getInt("wit"));
npcDat.set("baseMEN", NpcData.getInt("men"));
*/
npcDat.set("baseCpMax", 0);
npcDat.set("factionId", NpcData.getString("faction_id"));
npcDat.set("factionRange", NpcData.getInt("faction_range"));
npcDat.set("isUndead", NpcData.getString("isUndead"));
npcDat.set("absorb_level", NpcData.getString("absorb_level"));
npcDat.set("absorb_type", NpcData.getString("absorb_type"));
L2NpcTemplate template = new L2NpcTemplate(npcDat, custom);
template.addVulnerability(Stats.BOW_WPN_VULN, 1);
template.addVulnerability(Stats.BLUNT_WPN_VULN, 1);
template.addVulnerability(Stats.DAGGER_WPN_VULN, 1);