dymek84

Smart CB Freya

Aug 3rd, 2012
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 54.72 KB | None | 0 0
  1. Index: java/com/l2jserver/gameserver/communitybbs/HeroeList.java
  2. ===================================================================
  3. --- java/com/l2jserver/gameserver/communitybbs/HeroeList.java   (revision 0)
  4. +++ java/com/l2jserver/gameserver/communitybbs/HeroeList.java   (revision 0)
  5. @@ -0,0 +1,197 @@
  6. +package com.l2jserver.gameserver.communitybbs;
  7. +
  8. +import java.sql.PreparedStatement;
  9. +import java.sql.ResultSet;
  10. +import java.util.Map;
  11. +
  12. +import com.l2jserver.L2DatabaseFactory;
  13. +
  14. +import javolution.text.TextBuilder;
  15. +import javolution.util.FastMap;
  16. +
  17. +public class HeroeList
  18. +{
  19. +       private int _posId;
  20. +       private TextBuilder _heroeList = new TextBuilder();
  21. +      
  22. +       public HeroeList()
  23. +       {
  24. +               loadFromDB();
  25. +       }
  26. +      
  27. +       @SuppressWarnings("null")
  28. +       private void loadFromDB()
  29. +       {
  30. +               java.sql.Connection con = null;
  31. +               try
  32. +               {
  33. +                       _posId = 0;
  34. +                       con = L2DatabaseFactory.getInstance().getConnection();
  35. +                       PreparedStatement statement = con.prepareStatement("SELECT h.count, h.played, ch.char_name, ch.base_class, ch.online, cl.clan_name, cl.ally_name FROM heroes h LEFT JOIN characters ch ON ch.charId=h.charId LEFT OUTER JOIN clan_data cl ON cl.clan_id=ch.clanid ORDER BY h.count DESC, ch.char_name ASC LIMIT 20");
  36. +                      
  37. +                       ResultSet result = statement.executeQuery();
  38. +                      
  39. +                       while (result.next())
  40. +                       {
  41. +                               boolean status = false;
  42. +                               _posId = _posId + 1;
  43. +                              
  44. +                               if (result.getInt("online") == 1)
  45. +                                       status = true;
  46. +                              
  47. +                               addPlayerToList(_posId, result.getInt("count"), result.getInt("played"), result.getString("char_name"), result.getInt("base_class"), result.getString("clan_name"), result.getString("ally_name"), status);
  48. +                       }
  49. +                       result.close();
  50. +                       statement.close();
  51. +               }
  52. +               catch (Exception e)
  53. +               {
  54. +                       e.printStackTrace();
  55. +               }
  56. +               finally
  57. +               {
  58. +                       try
  59. +                       {
  60. +                               con.close();
  61. +                       }
  62. +                       catch (Exception e)
  63. +                       {
  64. +                       }
  65. +               }
  66. +       }
  67. +      
  68. +       public String loadHeroeList()
  69. +       {
  70. +               return _heroeList.toString();
  71. +       }
  72. +      
  73. +       private void addPlayerToList(int objId, int count, int played, String name, int ChrClass, String clan, String ally, boolean isOnline)
  74. +       {
  75. +               _heroeList.append("<table border=0 cellspacing=0 cellpadding=2 width=750>");
  76. +               _heroeList.append("<tr>");
  77. +               _heroeList.append("<td FIXWIDTH=10></td>");
  78. +               _heroeList.append("<td FIXWIDTH=40>" + objId + ".</td>");
  79. +               _heroeList.append("<td FIXWIDTH=150>" + name + "</td>");
  80. +               _heroeList.append("<td FIXWIDTH=160>" + className(ChrClass) + "</td>");
  81. +               _heroeList.append("<td FIXWIDTH=80>" + count + "</td>");
  82. +               _heroeList.append("<td FIXWIDTH=80>" + played + "</td>");
  83. +               _heroeList.append("<td FIXWIDTH=160>" + clan + "</td>");
  84. +               _heroeList.append("<td FIXWIDTH=160>" + ally + "</td>");
  85. +               _heroeList.append("<td FIXWIDTH=70>" + ((isOnline) ? "<font color=99FF00>Online</font>" : "<font color=CC0000>Offline</font>") + "</td>");
  86. +               _heroeList.append("<td FIXWIDTH=5></td>");
  87. +               _heroeList.append("</tr>");
  88. +               _heroeList.append("</table>");
  89. +               _heroeList.append("<img src=\"L2UI.Squaregray\" width=\"740\" height=\"1\">");
  90. +       }
  91. +      
  92. +       public final static String className(int classId)
  93. +       {
  94. +               Map<Integer, String> classList;
  95. +               classList = new FastMap<Integer, String>();
  96. +               classList.put(0, "Fighter");
  97. +               classList.put(1, "Warrior");
  98. +               classList.put(2, "Gladiator");
  99. +               classList.put(3, "Warlord");
  100. +               classList.put(4, "Knight");
  101. +               classList.put(5, "Paladin");
  102. +               classList.put(6, "Dark Avenger");
  103. +               classList.put(7, "Rogue");
  104. +               classList.put(8, "Treasure Hunter");
  105. +               classList.put(9, "Hawkeye");
  106. +               classList.put(10, "Mage");
  107. +               classList.put(11, "Wizard");
  108. +               classList.put(12, "Sorcerer");
  109. +               classList.put(13, "Necromancer");
  110. +               classList.put(14, "Warlock");
  111. +               classList.put(15, "Cleric");
  112. +               classList.put(16, "Bishop");
  113. +               classList.put(17, "Prophet");
  114. +               classList.put(18, "Elven Fighter");
  115. +               classList.put(19, "Elven Knight");
  116. +               classList.put(20, "Temple Knight");
  117. +               classList.put(21, "Swordsinger");
  118. +               classList.put(22, "Elven Scout");
  119. +               classList.put(23, "Plains Walker");
  120. +               classList.put(24, "Silver Ranger");
  121. +               classList.put(25, "Elven Mage");
  122. +               classList.put(26, "Elven Wizard");
  123. +               classList.put(27, "Spellsinger");
  124. +               classList.put(28, "Elemental Summoner");
  125. +               classList.put(29, "Oracle");
  126. +               classList.put(30, "Elder");
  127. +               classList.put(31, "Dark Fighter");
  128. +               classList.put(32, "Palus Knightr");
  129. +               classList.put(33, "Shillien Knight");
  130. +               classList.put(34, "Bladedancer");
  131. +               classList.put(35, "Assasin");
  132. +               classList.put(36, "Abyss Walker");
  133. +               classList.put(37, "Phantom Ranger");
  134. +               classList.put(38, "Dark Mage");
  135. +               classList.put(39, "Dark Wizard");
  136. +               classList.put(40, "Spellhowler");
  137. +               classList.put(41, "Phantom Summoner");
  138. +               classList.put(42, "Shillien Oracle");
  139. +               classList.put(43, "Shilien Elder");
  140. +               classList.put(44, "Orc Fighter");
  141. +               classList.put(45, "Orc Raider");
  142. +               classList.put(46, "Destroyer");
  143. +               classList.put(47, "Orc Monk");
  144. +               classList.put(48, "Tyrant");
  145. +               classList.put(49, "Orc Mage");
  146. +               classList.put(50, "Orc Shaman");
  147. +               classList.put(51, "Overlord");
  148. +               classList.put(52, "Warcryer");
  149. +               classList.put(53, "Dwarven Fighter");
  150. +               classList.put(54, "Scavenger");
  151. +               classList.put(55, "Bounty Hunter");
  152. +               classList.put(56, "Artisan");
  153. +               classList.put(57, "Warsmith");
  154. +               classList.put(88, "Duelist");
  155. +               classList.put(89, "Dreadnought");
  156. +               classList.put(90, "Phoenix Knight");
  157. +               classList.put(91, "Hell Knight");
  158. +               classList.put(92, "Sagittarius");
  159. +               classList.put(93, "Adventurer");
  160. +               classList.put(94, "Archmage");
  161. +               classList.put(95, "Soultaker");
  162. +               classList.put(96, "Arcana Lord");
  163. +               classList.put(97, "Cardinal");
  164. +               classList.put(98, "Hierophant");
  165. +               classList.put(99, "Evas Templar");
  166. +               classList.put(100, "Sword Muse");
  167. +               classList.put(101, "Wind Rider");
  168. +               classList.put(102, "Moonlight Sentinel");
  169. +               classList.put(103, "Mystic Muse");
  170. +               classList.put(104, "Elemental Master");
  171. +               classList.put(105, "Evas Saint");
  172. +               classList.put(106, "Shillien Templar");
  173. +               classList.put(107, "Spectral Dancer");
  174. +               classList.put(108, "Ghost Hunter");
  175. +               classList.put(109, "Ghost Sentinel");
  176. +               classList.put(110, "Storm Screamer");
  177. +               classList.put(111, "Spectral Master");
  178. +               classList.put(112, "Shillien Saint");
  179. +               classList.put(113, "Titan");
  180. +               classList.put(114, "Grand Khavatari");
  181. +               classList.put(115, "Dominator");
  182. +               classList.put(116, "Doomcryer");
  183. +               classList.put(117, "Fortune Seeker");
  184. +               classList.put(118, "Maestro");
  185. +               classList.put(123, "Male Soldier");
  186. +               classList.put(124, "Female Soldier");
  187. +               classList.put(125, "Trooper");
  188. +               classList.put(126, "Warder");
  189. +               classList.put(127, "Berserker");
  190. +               classList.put(128, "Male Soulbreaker");
  191. +               classList.put(129, "Female Soulbreaker");
  192. +               classList.put(130, "Arbalester");
  193. +               classList.put(131, "Doombringer");
  194. +               classList.put(132, "Male Soulhound");
  195. +               classList.put(133, "Female Soulhound");
  196. +               classList.put(134, "Trickster");
  197. +               classList.put(135, "Inspector");
  198. +               classList.put(136, "Judicator");
  199. +              
  200. +               return classList.get(classId);
  201. +       }
  202. +}
  203. \ No newline at end of file
  204. Index: java/com/l2jserver/gameserver/communitybbs/ClanList.java
  205. ===================================================================
  206. --- java/com/l2jserver/gameserver/communitybbs/ClanList.java    (revision 0)
  207. +++ java/com/l2jserver/gameserver/communitybbs/ClanList.java    (revision 0)
  208. @@ -0,0 +1,116 @@
  209. +package com.l2jserver.gameserver.communitybbs;
  210. +
  211. +import com.l2jserver.L2DatabaseFactory;
  212. +import java.sql.Connection;
  213. +import java.sql.PreparedStatement;
  214. +import java.sql.ResultSet;
  215. +import javolution.text.TextBuilder;
  216. +
  217. +public class ClanList
  218. +{
  219. +       private TextBuilder _clanList = new TextBuilder();
  220. +      
  221. +       public ClanList(int type)
  222. +       {
  223. +               loadFromDB(type);
  224. +       }
  225. +      
  226. +       private void loadFromDB(int type)
  227. +       {
  228. +               Connection con = null;
  229. +               int stpoint = 0;
  230. +               int results = 20;
  231. +               String castlename = "";
  232. +               String allystatus = "";
  233. +               String leadername = "";
  234. +               for (int count = 1; count != type; count++)
  235. +               {
  236. +                       stpoint += 20;
  237. +               }
  238. +              
  239. +               try
  240. +               {
  241. +                       con = L2DatabaseFactory.getInstance().getConnection();
  242. +                       PreparedStatement statement = con.prepareStatement("SELECT clan_id, clan_name, ally_name, leader_id, clan_level, reputation_score, hasCastle, ally_id FROM clan_data ORDER BY `clan_level` desc Limit " + stpoint + ", " + results);
  243. +                       ResultSet result = statement.executeQuery();
  244. +                       int pos = 0;
  245. +                      
  246. +                       while (result.next())
  247. +                       {
  248. +                               int clanid = result.getInt("leader_id");
  249. +                               String clan = result.getString("clan_name");
  250. +                               String ally = result.getString("ally_name");
  251. +                               int clanleader = result.getInt("leader_id");
  252. +                               int clanlevel = result.getInt("clan_level");
  253. +                               int reputation = result.getInt("reputation_score");
  254. +                               int hascastle = result.getInt("hasCastle");
  255. +                               int allyid = result.getInt("ally_id");
  256. +                               if (allyid != 0)
  257. +                               {
  258. +                                       if (allyid == clanid)
  259. +                                               allystatus = "Alliance Leader";
  260. +                                       allystatus = "Affiliated Clan";
  261. +                               }
  262. +                               else
  263. +                               {
  264. +                                       allystatus = "-";
  265. +                                       ally = "[no-ally]";
  266. +                               }
  267. +                               if (hascastle != 0)
  268. +                               {
  269. +                                       PreparedStatement statement2 = con.prepareStatement("SELECT name FROM castle WHERE id=" + hascastle);
  270. +                                       ResultSet result2 = statement2.executeQuery();
  271. +                                       if (result2.next())
  272. +                                               castlename = result2.getString("name");
  273. +                                       result2.close();
  274. +                                       statement2.close();
  275. +                               }
  276. +                               else
  277. +                                       castlename = "[none]";
  278. +                               PreparedStatement statement3 = con.prepareStatement("SELECT char_name FROM characters WHERE charId=" + clanleader);
  279. +                               ResultSet result3 = statement3.executeQuery();
  280. +                              
  281. +                               if (result3.next())
  282. +                                       leadername = result3.getString("char_name");
  283. +                               result3.close();
  284. +                               statement3.close();
  285. +                               pos++;
  286. +                               addClanToList(pos, clan, ally, leadername, clanlevel, reputation, castlename, allystatus);
  287. +                       }
  288. +                       result.close();
  289. +                       statement.close();
  290. +               }
  291. +               catch (Exception e)
  292. +               {
  293. +                       e.printStackTrace();
  294. +               }
  295. +               finally
  296. +               {
  297. +                       L2DatabaseFactory.close(con);
  298. +               }
  299. +       }
  300. +      
  301. +       private void addClanToList(int pos, String clan, String ally, String leadername, int clanlevel, int reputation, String castlename, String allystatus)
  302. +       {
  303. +               _clanList.append("<table border=0 cellspacing=0 cellpadding=2 width=760>");
  304. +               _clanList.append("<tr>");
  305. +               _clanList.append("<td FIXWIDTH=5></td>");
  306. +               _clanList.append("<td FIXWIDTH=20>" + pos + "</td>");
  307. +               _clanList.append("<td FIXWIDTH=90>" + clan + "</td>");
  308. +               _clanList.append("<td FIXWIDTH=90>" + ally + "</td>");
  309. +               _clanList.append("<td FIXWIDTH=85>" + leadername + "</td>");
  310. +               _clanList.append("<td FIXWIDTH=45 align=center>" + clanlevel + "</td>");
  311. +               _clanList.append("<td FIXWIDTH=70 align=center>" + reputation + "</td>");
  312. +               _clanList.append("<td FIXWIDTH=50 align=center>" + castlename + "</td>");
  313. +               _clanList.append("<td FIXWIDTH=70 align=center>" + allystatus + "</td>");
  314. +               _clanList.append("<td FIXWIDTH=5></td>");
  315. +               _clanList.append("</tr>");
  316. +               _clanList.append("</table>");
  317. +               _clanList.append("<img src=\"L2UI.Squaregray\" width=\"740\" height=\"1\">");
  318. +       }
  319. +      
  320. +       public String loadClanList()
  321. +       {
  322. +               return _clanList.toString();
  323. +       }
  324. +}
  325. \ No newline at end of file
  326. Index: java/com/l2jserver/gameserver/communitybbs/CastleStatus.java
  327. ===================================================================
  328. --- java/com/l2jserver/gameserver/communitybbs/CastleStatus.java    (revision 0)
  329. +++ java/com/l2jserver/gameserver/communitybbs/CastleStatus.java    (revision 0)
  330. @@ -0,0 +1,102 @@
  331. +package com.l2jserver.gameserver.communitybbs;
  332. +
  333. +import java.sql.Connection;
  334. +import java.sql.PreparedStatement;
  335. +import java.sql.ResultSet;
  336. +import java.text.SimpleDateFormat;
  337. +import java.util.Date;
  338. +
  339. +import com.l2jserver.L2DatabaseFactory;
  340. +
  341. +import javolution.text.TextBuilder;
  342. +
  343. +public class CastleStatus
  344. +{
  345. +       private TextBuilder _playerList = new TextBuilder();
  346. +      
  347. +       public CastleStatus()
  348. +       {
  349. +               loadFromDB();
  350. +       }
  351. +      
  352. +       @SuppressWarnings("null")
  353. +       private void loadFromDB()
  354. +       {
  355. +               Connection con = null;
  356. +              
  357. +               try
  358. +               {
  359. +                       con = L2DatabaseFactory.getInstance().getConnection();
  360. +                      
  361. +                       for (int i = 1; i < 9; i++)
  362. +                       {
  363. +                               PreparedStatement statement = con.prepareStatement("SELECT clan_name, clan_level FROM clan_data WHERE hasCastle=" + i + ";");
  364. +                               ResultSet result = statement.executeQuery();
  365. +                              
  366. +                               PreparedStatement statement2 = con.prepareStatement("SELECT name, siegeDate, taxPercent FROM castle WHERE id=" + i + ";");
  367. +                               ResultSet result2 = statement2.executeQuery();
  368. +                              
  369. +                               while (result.next())
  370. +                               {
  371. +                                       String owner = result.getString("clan_name");
  372. +                                       int level = result.getInt("clan_level");
  373. +                                      
  374. +                                       while (result2.next())
  375. +                                       {
  376. +                                               String name = result2.getString("name");
  377. +                                               long someLong = result2.getLong("siegeDate");
  378. +                                               int tax = result2.getInt("taxPercent");
  379. +                                               Date anotherDate = new Date(someLong);
  380. +                                               String DATE_FORMAT = "dd-MMM-yyyy HH:mm";
  381. +                                               SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
  382. +                                              
  383. +                                               addCastleToList(name, owner, level, tax, sdf.format(anotherDate));
  384. +                                       }
  385. +                                      
  386. +                                       result2.close();
  387. +                                       statement2.close();
  388. +                               }
  389. +                              
  390. +                               result.close();
  391. +                               statement.close();
  392. +                       }
  393. +               }
  394. +              
  395. +               catch (Exception e)
  396. +               {
  397. +                       e.printStackTrace();
  398. +               }
  399. +              
  400. +               finally
  401. +               {
  402. +                       try
  403. +                       {
  404. +                               con.close();
  405. +                       }
  406. +                       catch (Exception e)
  407. +                       {
  408. +                       }
  409. +               }
  410. +       }
  411. +      
  412. +       private void addCastleToList(String name, String owner, int level, int tax, String siegeDate)
  413. +       {
  414. +               _playerList.append("<table border=0 cellspacing=0 cellpadding=2 width=750>");
  415. +               _playerList.append("<tr>");
  416. +               _playerList.append("<td FIXWIDTH=10></td>");
  417. +               _playerList.append("<td FIXWIDTH=100>" + name + "</td>");
  418. +               _playerList.append("<td FIXWIDTH=100>" + owner + "</td>");
  419. +               _playerList.append("<td FIXWIDTH=80>" + level + "</td>");
  420. +               _playerList.append("<td FIXWIDTH=40>" + tax + "</td>");
  421. +               _playerList.append("<td FIXWIDTH=180>" + siegeDate + "</td>");
  422. +               _playerList.append("<td FIXWIDTH=5></td>");
  423. +               _playerList.append("</tr>");
  424. +               _playerList.append("</table>");
  425. +               _playerList.append("<img src=\"L2UI.Squaregray\" width=\"740\" height=\"1\">");
  426. +       }
  427. +      
  428. +       public String loadCastleList()
  429. +       {
  430. +               return _playerList.toString();
  431. +       }
  432. +}
  433. \ No newline at end of file
  434. Index: java/com/l2jserver/gameserver/communitybbs/Manager/TopBBSManager.java
  435. ===================================================================
  436. --- java/com/l2jserver/gameserver/communitybbs/Manager/TopBBSManager.java   (revision 5547)
  437. +++ java/com/l2jserver/gameserver/communitybbs/Manager/TopBBSManager.java   (working copy)
  438. @@ -14,9 +14,19 @@
  439.   */
  440.  package com.l2jserver.gameserver.communitybbs.Manager;
  441.  
  442. +import java.io.File;
  443.  import java.util.StringTokenizer;
  444.  
  445. +import com.l2jserver.Config;
  446. +import com.l2jserver.gameserver.GameTimeController;
  447.  import com.l2jserver.gameserver.cache.HtmCache;
  448. +import com.l2jserver.gameserver.communitybbs.CastleStatus;
  449. +import com.l2jserver.gameserver.communitybbs.ClanList;
  450. +import com.l2jserver.gameserver.communitybbs.GrandBossList;
  451. +import com.l2jserver.gameserver.communitybbs.HeroeList;
  452. +import com.l2jserver.gameserver.communitybbs.RaidList;
  453. +import com.l2jserver.gameserver.communitybbs.TopPlayers;
  454. +import com.l2jserver.gameserver.model.L2World;
  455.  import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  456.  import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
  457.  
  458. @@ -30,41 +40,104 @@
  459.     @Override
  460.     public void parsecmd(String command, L2PcInstance activeChar)
  461.     {
  462. -       if (command.equals("_bbstop"))
  463. +               String path = "data/html/CommunityBoard/";
  464. +               String filepath = "";
  465. +               String content = "";
  466. +              
  467. +               if (command.equals("_bbstop") | command.equals("_bbshome"))
  468.         {
  469. -           String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/index.htm");
  470. -           if (content == null)
  471. -           {
  472. -               content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/index.htm' </center></body></html>";
  473. -           }
  474. +                          filepath = path + "index.htm";
  475. +                          content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), filepath);
  476.             separateAndSend(content, activeChar);
  477.         }
  478. -       else if (command.equals("_bbshome"))
  479. -       {
  480. -           String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/index.htm");
  481. -           if (content == null)
  482. -           {
  483. -               content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/index.htm' </center></body></html>";
  484. -           }
  485. -           separateAndSend(content, activeChar);
  486. -       }
  487. +      
  488.         else if (command.startsWith("_bbstop;"))
  489.         {
  490.             StringTokenizer st = new StringTokenizer(command, ";");
  491.             st.nextToken();
  492. -           int idp = Integer.parseInt(st.nextToken());
  493. -           String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + idp + ".htm");
  494. -           if (content == null)
  495. +           String file = st.nextToken();
  496. +                       filepath = path + file + ".htm";
  497. +                       File filecom = new File(filepath);
  498. +                      
  499. +                       if (!(filecom.exists()))
  500.             {
  501. -               content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/" + idp
  502. -               + ".htm' </center></body></html>";
  503. +                                content = "<html><body><br><br><center>The command " + command + " points to file(" + filepath + ") that NOT exists.</center></body></html>";
  504. +                                separateAndSend(content, activeChar);
  505. +                                return;
  506.             }
  507. +                        content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), filepath);
  508. +                      
  509. +                       if (content.isEmpty())
  510. +                               content = "<html><body><br><br><center>Content Empty: The command " + command + " points to an invalid or empty html file(" + filepath + ").</center></body></html>";
  511. +                      
  512. +                                           switch (file)
  513. +                                              {
  514. +                                                      case "toppvp":
  515. +                                                              TopPlayers pvp = new TopPlayers(file);
  516. +                                                              content = content.replaceAll("%toppvp%", pvp.loadTopList());
  517. +                                                              break;
  518. +                                                      case "toppk":
  519. +                                                              TopPlayers pk = new TopPlayers(file);
  520. +                                                              content = content.replaceAll("%toppk%", pk.loadTopList());
  521. +                                                              break;
  522. +                                                      case "toprbrank":
  523. +                                                              TopPlayers raid = new TopPlayers(file);
  524. +                                                              content = content.replaceAll("%toprbrank%", raid.loadTopList());
  525. +                                                              break;
  526. +                                                      case "topadena":
  527. +                                                              TopPlayers adena = new TopPlayers(file);
  528. +                                                              content = content.replaceAll("%topadena%", adena.loadTopList());
  529. +                                                              break;
  530. +                                                      case "toponline":
  531. +                                                              TopPlayers online = new TopPlayers(file);
  532. +                                                              content = content.replaceAll("%toponline%", online.loadTopList());
  533. +                                                              break;
  534. +                                                      case "heroes":
  535. +                                                              HeroeList hr = new HeroeList();
  536. +                                                              content = content.replaceAll("%heroelist%", hr.loadHeroeList());
  537. +                                                              break;
  538. +                                                      case "castle":
  539. +                                                              CastleStatus status = new CastleStatus();
  540. +                                                              content = content.replaceAll("%castle%", status.loadCastleList());
  541. +                                                              break;
  542. +                                                      case "boss":
  543. +                                                              GrandBossList gb = new GrandBossList();
  544. +                                                              content = content.replaceAll("%gboss%", gb.loadGrandBossList());
  545. +                                                              break;
  546. +                                                      case "stats":
  547. +                                                              content = content.replace("%online%", Integer.toString(L2World.getInstance().getAllPlayersCount()));
  548. +                                                              content = content.replace("%servercapacity%", Integer.toString(Config.MAXIMUM_ONLINE_USERS));
  549. +                                                              content = content.replace("%serverruntime%", getServerRunTime());
  550. +                                                              if (Config.ALLOW_REAL_ONLINE_STATS)
  551. +                                                                      content = content.replace("%serveronline%", getRealOnline());
  552. +                                                              else
  553. +                                                                      content = content.replace("%serveronline%", "");
  554. +                                                              break;
  555. +                                                      default:
  556. +                                                              break;
  557. +                                            
  558. +                                              }
  559. +                                              if (file.startsWith("clan"))
  560. +                                              {
  561. +                                                      int cid = Integer.parseInt(file.substring(4));
  562. +                                                      ClanList cl = new ClanList(cid);
  563. +                                                      content = content.replaceAll("%clanlist%", cl.loadClanList());
  564. +                                              }
  565. +                                              if (file.startsWith("raid"))
  566. +                                              {
  567. +                                                      String rfid = file.substring(4);
  568. +                                                      RaidList rd = new RaidList(rfid);
  569. +                                                      content = content.replaceAll("%raidlist%", rd.loadRaidList());
  570. +                                              }
  571. +                                              if (content.isEmpty())
  572. +                                              {
  573. +                                                      content = "<html><body><br><br><center>404 :File not found or empty: " + filepath + " your command is " + command + "</center></body></html>";
  574. +                                              }
  575.             separateAndSend(content, activeChar);
  576.         }
  577.         else
  578.         {
  579. -           ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
  580. -                   + " is not implemented yet</center><br><br></body></html>", "101");
  581. +           ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command + " is not implemented yet</center><br><br></body></html>", "101");
  582.             activeChar.sendPacket(sb);
  583.             activeChar.sendPacket(new ShowBoard(null, "102"));
  584.             activeChar.sendPacket(new ShowBoard(null, "103"));
  585. @@ -86,4 +159,29 @@
  586.     {
  587.         protected static final TopBBSManager _instance = new TopBBSManager();
  588.     }
  589. -}
  590. \ No newline at end of file
  591. +        
  592. +          public String getServerRunTime()
  593. +          {
  594. +                  int timeSeconds = (GameTimeController.getGameTicks() - 36000) / 10;
  595. +                  String timeResult = "";
  596. +                  if (timeSeconds >= 86400)
  597. +                          timeResult = Integer.toString(timeSeconds / 86400) + " Days " + Integer.toString((timeSeconds % 86400) / 3600) + " hours";
  598. +                  else
  599. +                          timeResult = Integer.toString(timeSeconds / 3600) + " Hours " + Integer.toString((timeSeconds % 3600) / 60) + " mins";
  600. +                  return timeResult;
  601. +          }
  602. +        
  603. +          public String getRealOnline()
  604. +          {
  605. +                  int counter = 0;
  606. +                  for (L2PcInstance onlinePlayer : L2World.getInstance().getAllPlayers().values())
  607. +                  {
  608. +                          if (onlinePlayer.isOnline() && (onlinePlayer.getClient() != null && !onlinePlayer.getClient().isDetached()))
  609. +                          {
  610. +                                  counter++;
  611. +                          }
  612. +                  }
  613. +                  String realOnline = "<tr><td fixwidth=11></td><td FIXWIDTH=280>Players Active</td><td FIXWIDTH=470><font color=26e600>" + counter + "</font></td></tr>" + "<tr><td fixwidth=11></td><td FIXWIDTH=280>Players Shops</td><td FIXWIDTH=470><font color=26e600>" + (L2World.getInstance().getAllPlayersCount() - counter) + "</font></td></tr>";
  614. +                  return realOnline;
  615. +          }
  616. +    }
  617. Index: java/com/l2jserver/gameserver/communitybbs/GrandBossList.java
  618. ===================================================================
  619. --- java/com/l2jserver/gameserver/communitybbs/GrandBossList.java   (revision 0)
  620. +++ java/com/l2jserver/gameserver/communitybbs/GrandBossList.java   (revision 0)
  621. @@ -0,0 +1,84 @@
  622. +package com.l2jserver.gameserver.communitybbs;
  623. +
  624. +import com.l2jserver.L2DatabaseFactory;
  625. +import java.sql.Connection;
  626. +import java.sql.PreparedStatement;
  627. +import java.sql.ResultSet;
  628. +import javolution.text.TextBuilder;
  629. +
  630. +public class GrandBossList
  631. +{
  632. +       private TextBuilder _GrandBossList = new TextBuilder();
  633. +      
  634. +       public GrandBossList()
  635. +       {
  636. +               loadFromDB();
  637. +       }
  638. +      
  639. +       private void loadFromDB()
  640. +       {
  641. +               Connection con = null;
  642. +               int pos = 0;
  643. +              
  644. +               try
  645. +               {
  646. +                       con = L2DatabaseFactory.getInstance().getConnection();
  647. +                       PreparedStatement statement = con.prepareStatement("SELECT boss_id, status FROM grandboss_data");
  648. +                       ResultSet result = statement.executeQuery();
  649. +                      
  650. +                       nextnpc:
  651. +                       while (result.next())
  652. +                       {
  653. +                               int npcid = result.getInt("boss_id");
  654. +                               int status = result.getInt("status");
  655. +                               if (npcid == 29066 || npcid == 29067 || npcid == 29068 || npcid == 29118)
  656. +                                       continue nextnpc;
  657. +                              
  658. +                               PreparedStatement statement2 = con.prepareStatement("SELECT name FROM npc WHERE id=" + npcid);
  659. +                               ResultSet result2 = statement2.executeQuery();
  660. +                              
  661. +                               while (result2.next())
  662. +                               {
  663. +                                       pos++;
  664. +                                       boolean rstatus = false;
  665. +                                       if (status == 0)
  666. +                                               rstatus = true;
  667. +                                       String npcname = result2.getString("name");
  668. +                                       addGrandBossToList(pos, npcname, rstatus);
  669. +                               }
  670. +                               result2.close();
  671. +                               statement2.close();
  672. +                       }
  673. +                      
  674. +                       result.close();
  675. +                       statement.close();
  676. +               }
  677. +               catch (Exception e)
  678. +               {
  679. +                       e.printStackTrace();
  680. +               }
  681. +               finally
  682. +               {
  683. +                       L2DatabaseFactory.close(con);
  684. +               }
  685. +       }
  686. +      
  687. +       private void addGrandBossToList(int pos, String npcname, boolean rstatus)
  688. +       {
  689. +               _GrandBossList.append("<table border=0 cellspacing=0 cellpadding=2>");
  690. +               _GrandBossList.append("<tr>");
  691. +               _GrandBossList.append("<td FIXWIDTH=5></td>");
  692. +               _GrandBossList.append("<td FIXWIDTH=50>" + pos + "</td>");
  693. +               _GrandBossList.append("<td FIXWIDTH=130>" + npcname + "</td>");
  694. +               _GrandBossList.append("<td FIXWIDTH=60 align=center>" + ((rstatus) ? "<font color=99FF00>Alive</font>" : "<font color=CC0000>Dead</font>") + "</td>");
  695. +               _GrandBossList.append("<td FIXWIDTH=5></td>");
  696. +               _GrandBossList.append("</tr>");
  697. +               _GrandBossList.append("</table>");
  698. +               _GrandBossList.append("<img src=\"L2UI.Squaregray\" width=\"250\" height=\"1\">");
  699. +       }
  700. +      
  701. +       public String loadGrandBossList()
  702. +       {
  703. +               return _GrandBossList.toString();
  704. +       }
  705. +}
  706. \ No newline at end of file
  707. Index: java/com/l2jserver/gameserver/communitybbs/TopPlayers.java
  708. ===================================================================
  709. --- java/com/l2jserver/gameserver/communitybbs/TopPlayers.java  (revision 0)
  710. +++ java/com/l2jserver/gameserver/communitybbs/TopPlayers.java  (revision 0)
  711. @@ -0,0 +1,243 @@
  712. +package com.l2jserver.gameserver.communitybbs;
  713. +
  714. +import java.sql.Connection;
  715. +import java.sql.PreparedStatement;
  716. +import java.sql.ResultSet;
  717. +import java.util.Map;
  718. +
  719. +import javolution.text.TextBuilder;
  720. +import javolution.util.FastMap;
  721. +
  722. +import com.l2jserver.Config;
  723. +import com.l2jserver.L2DatabaseFactory;
  724. +
  725. +public class TopPlayers
  726. +{
  727. +       private int pos;
  728. +       private TextBuilder _topList = new TextBuilder();
  729. +       String sort = "";
  730. +      
  731. +       public TopPlayers(String file)
  732. +       {
  733. +               loadDB(file);
  734. +       }
  735. +      
  736. +       @SuppressWarnings("null")
  737. +       private void loadDB(String file)
  738. +       {
  739. +               Connection con = null;
  740. +              
  741. +               switch (file)
  742. +               {
  743. +                       case "toppvp":
  744. +                               sort = "pvpkills";
  745. +                               break;
  746. +                       case "toppk":
  747. +                               sort = "pkkills";
  748. +                               break;
  749. +                       case "topadena":
  750. +                               sort = "SUM(it.count)";
  751. +                               break;
  752. +                       case "toprbrank":
  753. +                               sort = "SUM(chr.points)";
  754. +                               break;
  755. +                       case "toponline":
  756. +                               sort = "onlinetime";
  757. +                               break;
  758. +                       default:
  759. +                               break;
  760. +              
  761. +               }
  762. +              
  763. +               try
  764. +               {
  765. +                       pos = 0;
  766. +                       con = L2DatabaseFactory.getInstance().getConnection();
  767. +                       PreparedStatement statement = con.prepareStatement("SELECT SUM(chr.points), SUM(it.count), ch.char_name, ch.pkkills, ch.pvpkills, ch.onlinetime, ch.base_class, ch.online FROM characters ch LEFT JOIN character_raid_points chr ON ch.charId=chr.charId LEFT OUTER JOIN items it ON ch.charId=it.owner_id WHERE item_id=57 GROUP BY ch.charId ORDER BY " + sort + " DESC LIMIT " + Config.TOP_PLAYER_RESULTS);
  768. +                      
  769. +                       ResultSet result = statement.executeQuery();
  770. +                      
  771. +                       while (result.next())
  772. +                       {
  773. +                               boolean status = false;
  774. +                               pos++;
  775. +                              
  776. +                               if (result.getInt("online") == 1)
  777. +                                       status = true;
  778. +                               String timeon = getPlayerRunTime(result.getInt("ch.onlinetime"));
  779. +                               String adenas = getAdenas(result.getInt("SUM(it.count)"));
  780. +                              
  781. +                               addChar(pos, result.getString("ch.char_name"), result.getInt("base_class"), result.getInt("ch.pvpkills"), result.getInt("ch.pkkills"), result.getInt("SUM(chr.points)"), adenas, timeon, status);
  782. +                       }
  783. +                      
  784. +                       result.close();
  785. +                       statement.close();
  786. +               }
  787. +               catch (Exception e)
  788. +               {
  789. +                       e.printStackTrace();
  790. +               }
  791. +               finally
  792. +               {
  793. +                       try
  794. +                       {
  795. +                               con.close();
  796. +                       }
  797. +                       catch (Exception e)
  798. +                       {
  799. +                              
  800. +                       }
  801. +               }
  802. +       }
  803. +      
  804. +       public String loadTopList()
  805. +       {
  806. +               return _topList.toString();
  807. +       }
  808. +      
  809. +       private void addChar(int position, String name, int classid, int pvp, int pk, int raid, String adenas, String online, boolean isOnline)
  810. +       {
  811. +               _topList.append("<table border=0 cellspacing=0 cellpadding=2 bgcolor=050505 height=" + Config.TOP_PLAYER_ROW_HEIGHT + "><tr><td FIXWIDTH=5></td>");
  812. +               _topList.append("<td FIXWIDTH=20>" + position + ".</td>");
  813. +               _topList.append("<td FIXWIDTH=180>" + name + "</td>");
  814. +               _topList.append("<td FIXWIDTH=175>" + className(classid) + "</td>");
  815. +               _topList.append("<td FIXWIDTH=60>" + pvp + "</td>");
  816. +               _topList.append("<td FIXWIDTH=60>" + pk + "</td>");
  817. +               _topList.append("<td FIXWIDTH=65>" + raid + "</td>");
  818. +               _topList.append("<td FIXWIDTH=150>" + adenas + "</td>");
  819. +               _topList.append("<td FIXWIDTH=148>" + online + "</td>");
  820. +               _topList.append("<td FIXWIDTH=65>" + ((isOnline) ? "<font color=99FF00>Online</font>" : "<font color=CC0000>Offline</font>") + "</td>");
  821. +               _topList.append("</tr></table><img src=\"L2UI.Squaregray\" width=\"758\" height=\"1\">");
  822. +              
  823. +       }
  824. +      
  825. +       public final static String className(int classid)
  826. +       {
  827. +               Map<Integer, String> classList;
  828. +               classList = new FastMap<Integer, String>();
  829. +               classList.put(0, "Fighter");
  830. +               classList.put(1, "Warrior");
  831. +               classList.put(2, "Gladiator");
  832. +               classList.put(3, "Warlord");
  833. +               classList.put(4, "Knight");
  834. +               classList.put(5, "Paladin");
  835. +               classList.put(6, "Dark Avenger");
  836. +               classList.put(7, "Rogue");
  837. +               classList.put(8, "Treasure Hunter");
  838. +               classList.put(9, "Hawkeye");
  839. +               classList.put(10, "Mage");
  840. +               classList.put(11, "Wizard");
  841. +               classList.put(12, "Sorcerer");
  842. +               classList.put(13, "Necromancer");
  843. +               classList.put(14, "Warlock");
  844. +               classList.put(15, "Cleric");
  845. +               classList.put(16, "Bishop");
  846. +               classList.put(17, "Prophet");
  847. +               classList.put(18, "Elven Fighter");
  848. +               classList.put(19, "Elven Knight");
  849. +               classList.put(20, "Temple Knight");
  850. +               classList.put(21, "Swordsinger");
  851. +               classList.put(22, "Elven Scout");
  852. +               classList.put(23, "Plains Walker");
  853. +               classList.put(24, "Silver Ranger");
  854. +               classList.put(25, "Elven Mage");
  855. +               classList.put(26, "Elven Wizard");
  856. +               classList.put(27, "Spellsinger");
  857. +               classList.put(28, "Elemental Summoner");
  858. +               classList.put(29, "Oracle");
  859. +               classList.put(30, "Elder");
  860. +               classList.put(31, "Dark Fighter");
  861. +               classList.put(32, "Palus Knightr");
  862. +               classList.put(33, "Shillien Knight");
  863. +               classList.put(34, "Bladedancer");
  864. +               classList.put(35, "Assasin");
  865. +               classList.put(36, "Abyss Walker");
  866. +               classList.put(37, "Phantom Ranger");
  867. +               classList.put(38, "Dark Mage");
  868. +               classList.put(39, "Dark Wizard");
  869. +               classList.put(40, "Spellhowler");
  870. +               classList.put(41, "Phantom Summoner");
  871. +               classList.put(42, "Shillien Oracle");
  872. +               classList.put(43, "Shilien Elder");
  873. +               classList.put(44, "Orc Fighter");
  874. +               classList.put(45, "Orc Raider");
  875. +               classList.put(46, "Destroyer");
  876. +               classList.put(47, "Orc Monk");
  877. +               classList.put(48, "Tyrant");
  878. +               classList.put(49, "Orc Mage");
  879. +               classList.put(50, "Orc Shaman");
  880. +               classList.put(51, "Overlord");
  881. +               classList.put(52, "Warcryer");
  882. +               classList.put(53, "Dwarven Fighter");
  883. +               classList.put(54, "Scavenger");
  884. +               classList.put(55, "Bounty Hunter");
  885. +               classList.put(56, "Artisan");
  886. +               classList.put(57, "Warsmith");
  887. +               classList.put(88, "Duelist");
  888. +               classList.put(89, "Dreadnought");
  889. +               classList.put(90, "Phoenix Knight");
  890. +               classList.put(91, "Hell Knight");
  891. +               classList.put(92, "Sagittarius");
  892. +               classList.put(93, "Adventurer");
  893. +               classList.put(94, "Archmage");
  894. +               classList.put(95, "Soultaker");
  895. +               classList.put(96, "Arcana Lord");
  896. +               classList.put(97, "Cardinal");
  897. +               classList.put(98, "Hierophant");
  898. +               classList.put(99, "Evas Templar");
  899. +               classList.put(100, "Sword Muse");
  900. +               classList.put(101, "Wind Rider");
  901. +               classList.put(102, "Moonlight Sentinel");
  902. +               classList.put(103, "Mystic Muse");
  903. +               classList.put(104, "Elemental Master");
  904. +               classList.put(105, "Evas Saint");
  905. +               classList.put(106, "Shillien Templar");
  906. +               classList.put(107, "Spectral Dancer");
  907. +               classList.put(108, "Ghost Hunter");
  908. +               classList.put(109, "Ghost Sentinel");
  909. +               classList.put(110, "Storm Screamer");
  910. +               classList.put(111, "Spectral Master");
  911. +               classList.put(112, "Shillien Saint");
  912. +               classList.put(113, "Titan");
  913. +               classList.put(114, "Grand Khavatari");
  914. +               classList.put(115, "Dominator");
  915. +               classList.put(116, "Doomcryer");
  916. +               classList.put(117, "Fortune Seeker");
  917. +               classList.put(118, "Maestro");
  918. +               classList.put(123, "Male Soldier");
  919. +               classList.put(124, "Female Soldier");
  920. +               classList.put(125, "Trooper");
  921. +               classList.put(126, "Warder");
  922. +               classList.put(127, "Berserker");
  923. +               classList.put(128, "Male Soulbreaker");
  924. +               classList.put(129, "Female Soulbreaker");
  925. +               classList.put(130, "Arbalester");
  926. +               classList.put(131, "Doombringer");
  927. +               classList.put(132, "Male Soulhound");
  928. +               classList.put(133, "Female Soulhound");
  929. +               classList.put(134, "Trickster");
  930. +               classList.put(135, "Inspector");
  931. +               classList.put(136, "Judicator");
  932. +              
  933. +               return classList.get(classid);
  934. +       }
  935. +      
  936. +       public String getPlayerRunTime(int secs)
  937. +       {
  938. +               String timeResult = "";
  939. +               if (secs >= 86400)
  940. +                       timeResult = Integer.toString(secs / 86400) + " Days " + Integer.toString((secs % 86400) / 3600) + " hours";
  941. +               else
  942. +                       timeResult = Integer.toString(secs / 3600) + " Hours " + Integer.toString((secs % 3600) / 60) + " mins";
  943. +               return timeResult;
  944. +       }
  945. +       public String getAdenas(int adena)
  946. +       {
  947. +               String adenas = "";
  948. +               if (adena >= 1000000000)
  949. +                       adenas = Integer.toString(adena / 1000000000) + " Billion " + Integer.toString((adena % 1000000000) / 1000000) + " million";
  950. +               else
  951. +                       adenas = Integer.toString(adena / 1000000) + " Million " + Integer.toString((adena % 1000000) / 1000) + " k";
  952. +               return adenas;
  953. +       }
  954. +}
  955. \ No newline at end of file
  956. Index: java/com/l2jserver/gameserver/communitybbs/RaidList.java
  957. ===================================================================
  958. --- java/com/l2jserver/gameserver/communitybbs/RaidList.java    (revision 0)
  959. +++ java/com/l2jserver/gameserver/communitybbs/RaidList.java    (revision 0)
  960. @@ -0,0 +1,101 @@
  961. +package com.l2jserver.gameserver.communitybbs;
  962. +
  963. +import com.l2jserver.Config;
  964. +import com.l2jserver.L2DatabaseFactory;
  965. +import java.sql.Connection;
  966. +import java.sql.PreparedStatement;
  967. +import java.sql.ResultSet;
  968. +import javolution.text.TextBuilder;
  969. +
  970. +public class RaidList
  971. +{
  972. +       private TextBuilder _raidList = new TextBuilder();
  973. +      
  974. +       public RaidList(String rfid)
  975. +       {
  976. +               loadFromDB(rfid);
  977. +       }
  978. +      
  979. +       private void loadFromDB(String rfid)
  980. +       {
  981. +               int type = Integer.parseInt(rfid);
  982. +               Connection con = null;
  983. +               int stpoint = 0;
  984. +               int pos = 0;
  985. +               String sort = "";
  986. +               if (Config.RAID_LIST_SORT_ASC)
  987. +                       sort = "ASC";
  988. +               else
  989. +                       sort = "DESC";
  990. +               for (int count = 1; count != type; count++)
  991. +               {
  992. +                       stpoint += Config.RAID_LIST_RESULTS;
  993. +               }
  994. +              
  995. +              
  996. +               try
  997. +               {
  998. +                       con = L2DatabaseFactory.getInstance().getConnection();
  999. +                       PreparedStatement statement = con.prepareStatement("SELECT id, name, level FROM npc WHERE type='L2RaidBoss' AND EXISTS (SELECT * FROM raidboss_spawnlist WHERE raidboss_spawnlist.boss_id = npc.id) ORDER BY `level` " + sort + " Limit " + stpoint + ", " + Config.RAID_LIST_RESULTS);
  1000. +                       ResultSet result = statement.executeQuery();
  1001. +                       pos = stpoint;
  1002. +                      
  1003. +                       while (result.next())
  1004. +                       {
  1005. +                               int npcid = result.getInt("id");
  1006. +                               String npcname = result.getString("name");
  1007. +                               int rlevel = result.getInt("level");
  1008. +                               PreparedStatement statement2 = con.prepareStatement("SELECT respawn_time, respawn_min_delay, respawn_max_delay FROM raidboss_spawnlist WHERE boss_id=" + npcid);
  1009. +                               ResultSet result2 = statement2.executeQuery();
  1010. +                              
  1011. +                               while (result2.next())
  1012. +                               {
  1013. +                                       pos++;
  1014. +                                       boolean rstatus = false;
  1015. +                                       long respawn = result2.getLong("respawn_time");
  1016. +                                       if (respawn == 0)
  1017. +                                               rstatus = true;
  1018. +                                       int mindelay = result2.getInt("respawn_min_delay");
  1019. +                                       int maxdelay = result2.getInt("respawn_max_delay");
  1020. +                                       mindelay = mindelay / 60 / 60;
  1021. +                                       maxdelay = maxdelay / 60 / 60;
  1022. +                                       addRaidToList(pos, npcname, rlevel, mindelay, maxdelay, rstatus);
  1023. +                               }
  1024. +                               result2.close();
  1025. +                               statement2.close();
  1026. +                       }
  1027. +                      
  1028. +                       result.close();
  1029. +                       statement.close();
  1030. +               }
  1031. +               catch (Exception e)
  1032. +               {
  1033. +                       e.printStackTrace();
  1034. +               }
  1035. +               finally
  1036. +               {
  1037. +                       L2DatabaseFactory.close(con);
  1038. +               }
  1039. +       }
  1040. +      
  1041. +       private void addRaidToList(int pos, String npcname, int rlevel, int mindelay, int maxdelay, boolean rstatus)
  1042. +       {
  1043. +               _raidList.append("<table border=0 cellspacing=0 cellpadding=2 width=750 height="+Config.RAID_LIST_ROW_HEIGHT+">");
  1044. +               _raidList.append("<tr>");
  1045. +               _raidList.append("<td FIXWIDTH=5></td>");
  1046. +               _raidList.append("<td FIXWIDTH=20>" + pos + "</td>");
  1047. +               _raidList.append("<td FIXWIDTH=270>" + npcname + "</td>");
  1048. +               _raidList.append("<td FIXWIDTH=50>" + rlevel + "</td>");
  1049. +               _raidList.append("<td FIXWIDTH=120 align=center>" + mindelay + " - " + maxdelay + "</td>");
  1050. +               _raidList.append("<td FIXWIDTH=50 align=center>" + ((rstatus) ? "<font color=99FF00>Alive</font>" : "<font color=CC0000>Dead</font>") + "</td>");
  1051. +               _raidList.append("<td FIXWIDTH=5></td>");
  1052. +               _raidList.append("</tr>");
  1053. +               _raidList.append("</table>");
  1054. +               _raidList.append("<img src=\"L2UI.Squaregray\" width=\"740\" height=\"1\">");
  1055. +       }
  1056. +      
  1057. +       public String loadRaidList()
  1058. +       {
  1059. +               return _raidList.toString();
  1060. +       }
  1061. +}
  1062. \ No newline at end of file
  1063. Index: java/com/l2jserver/Config.java
  1064. ===================================================================
  1065. --- java/com/l2jserver/Config.java  (revision 5547)
  1066. +++ java/com/l2jserver/Config.java  (working copy)
  1067. @@ -81,8 +81,19 @@
  1068.     public static final String GRANDBOSS_CONFIG_FILE = "./config/Grandboss.properties";
  1069.     public static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.properties";
  1070.     public static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
  1071. +    public static final String SMART_CB = "./config/SmartCB.properties";
  1072. +    
  1073. +    // --------------------------------------------------
  1074. +    // Smart Community Board Definitions
  1075. +    // --------------------------------------------------
  1076. +    public static int TOP_PLAYER_ROW_HEIGHT;
  1077. +    public static int TOP_PLAYER_RESULTS;
  1078. +    public static int RAID_LIST_ROW_HEIGHT;
  1079. +    public static int RAID_LIST_RESULTS;
  1080. +    public static boolean RAID_LIST_SORT_ASC;
  1081. +    public static boolean ALLOW_REAL_ONLINE_STATS;
  1082. +  
  1083.    
  1084. -  
  1085.     //--------------------------------------------------
  1086.     // L2J Variable Definitions
  1087.     //--------------------------------------------------
  1088. @@ -1197,7 +1208,25 @@
  1089.                     e.printStackTrace();
  1090.                     throw new Error("Failed to Load "+COMMUNITY_CONFIGURATION_FILE+" File.");
  1091.                 }
  1092. -              
  1093. +                       // Load Smart CB Properties file (if exists)
  1094. +                final File smartcb = new File(SMART_CB);
  1095. +                  try (InputStream is1 = new FileInputStream(smartcb))
  1096. +                {
  1097. +                         L2Properties smartCB = new L2Properties();
  1098. +                         smartCB.load(is1);
  1099. +                         TOP_PLAYER_ROW_HEIGHT = Integer.parseInt(smartCB.getProperty("TopPlayerRowHeight", "19"));                            
  1100. +                         TOP_PLAYER_RESULTS = Integer.parseInt(smartCB.getProperty("TopPlayerResults", "20"));
  1101. +                         RAID_LIST_ROW_HEIGHT = Integer.parseInt(smartCB.getProperty("RaidListRowHeight", "18"));
  1102. +                         RAID_LIST_RESULTS = Integer.parseInt(smartCB.getProperty("RaidListResults", "20"));
  1103. +                         RAID_LIST_SORT_ASC = Boolean.parseBoolean(smartCB.getProperty("RaidListSortAsc", "True"));
  1104. +                         ALLOW_REAL_ONLINE_STATS = Boolean.parseBoolean(smartCB.getProperty("AllowRealOnlineStats", "True"));
  1105. +                 }
  1106. +                catch (Exception e)
  1107. +                {
  1108. +                           _log.warning("Config: " + e.getMessage());
  1109. +                         throw new Error("Failed to Load " + SMART_CB + " File.");
  1110. +                 }
  1111. +                    
  1112.                 // Load Feature L2Properties file (if exists)
  1113.                 try
  1114.                 {
Advertisement
Add Comment
Please, Sign In to add comment