11op三国群英传SF
标题:
天堂2 假人系统更新教程方法
[打印本页]
作者:
admin
时间:
2018-9-22 23:04
标题:
天堂2 假人系统更新教程方法
假人系统更新。使用IdTemplate 做标识,将NPCCHARDATA变更为模型,可多次引用。
//NPC表中IdTemplate指向假人模型ID,NPC外观将为假人的外观。同使用客户端外观ID一个用法。
//add by banyue<
public void loadNpcsChar(int id)
{
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = null;
ResultSet rset = null;
int cont = 0;
for(int _Key : _npcs.keys())
{
id = getTemplate(_Key).getIdTemplate();
statement = con.prepareStatement("SELECT * FROM npcchardata WHERE npcId = ?");
statement.setInt(1, id);
rset = statement.executeQuery();
L2NpcCharData npcCharDat = null;
L2NpcTemplate npcDat = null;
while (rset.next())
{
npcDat = _npcs.get(_Key);
if (npcDat == null)
{
_log.severe(getClass().getSimpleName() + ": CharData Error with id : " + _Key);
continue;
}
npcCharDat = new L2NpcCharData();
npcCharDat.setIsChar(rset.getInt("ischar"));
npcCharDat.setCharRace(rset.getInt("charrace"));
npcCharDat.setCharClass(rset.getInt("charclass"));
npcCharDat.setCharFace(rset.getInt("charface"));
npcCharDat.setCharHair(rset.getInt("charhair"));
npcCharDat.setCharColor(rset.getString("charcolor"));
npcCharDat.setCharHairColor(rset.getInt("charhaircolor"));
npcCharDat.setCharSex(rset.getInt("charsex"));
npcCharDat.setCharHero(rset.getInt("charhero"));
npcCharDat.setCharRhand(rset.getInt("charrhand"));
npcCharDat.setCharLhand(rset.getInt("charlhand"));
npcCharDat.setCharEnchLvl(rset.getInt("charenchlvl"));
npcCharDat.setCharChest(rset.getInt("charchest"));
npcCharDat.setCharLegs(rset.getInt("charlegs"));
npcCharDat.setCharGlove(rset.getInt("charglove"));
npcCharDat.setCharFeet(rset.getInt("charfeet"));
npcCharDat.setCharClock(rset.getInt("charclock"));
npcCharDat.setCharUnder(rset.getInt("charunder"));
npcCharDat.setCharHair1(rset.getInt("charhair1"));
npcCharDat.setCharHair2(rset.getInt("charhair2"));
npcCharDat.setCharTeam(rset.getInt("charteam"));
npcDat.setCharData(npcCharDat);
cont++;
}
}
rset.close();
statement.close();
_log.info(getClass().getSimpleName() + ": Loaded " + cont + " Char Data.");
}
catch (Exception e)
{
_log.log(Level.SEVERE, getClass().getSimpleName() + ": Error reading NPC CHAR Data: " + e.getMessage(), e);
}
finally
{
L2DatabaseFactory.close(con);
}
}
//add by banyue>
欢迎光临 11op三国群英传SF (http://11op.com/)
Powered by Discuz! X3.1