分享BOSS查詢系統
此系統可在 NPC對話按鈕
以及 道具執行對話當按鈕設置
或者/who下設置
if (s.equalsIgnoreCase("cxboss"))
{
Connection localConnection;
PreparedStatement localPreparedStatement;
ResultSet localResultSet1;
String arrayOfStringcxbs[];
int i;
localConnection = null;
localPreparedStatement = null;
localResultSet1 = null;
arrayOfStringcxbs = new String[160];
i = 0;
try
{
localConnection = DatabaseFactory.get().getConnection();
localPreparedStatement = localConnection.prepareStatement("SELECT location ,next_spawn_time FROM spawnlist_boss where count=1 order by id limit 80");
for (localResultSet1 = localPreparedStatement.executeQuery(); localResultSet1.next()
{
arrayOfStringcxbs[i] = localResultSet1.getString(1);
arrayOfStringcxbs[i + 80] = localResultSet1.getString(2);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH
ss");
Date now = new Date(i);
String nowstr = sdf.format(now);
if (sdf.parse(nowstr).getTime() > sdf.parse(arrayOfStringcxbs[i + 80]).getTime())
arrayOfStringcxbs[i + 80] = "已刷新";
i++;
}
for (; i < 80; i++)
arrayOfStringcxbs[i] = "無";
}
catch (SQLException sqlexception2)
{
SQLUtil.close(localResultSet1);
SQLUtil.close(localPreparedStatement);
SQLUtil.close(localConnection);
}
pc.sendPackets(new S_NPCTalkReturn(0x15f97, "serverboss", arrayOfStringcxbs));
String arrayOfStringczcz[];
}
以上代碼 要對應一個 對話當哦切記!!