Advertisement
brounlimited

aCis Patch No1

Jan 2nd, 2014
2,792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 116.63 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_datapack
  3. Index: tools/database_installer.sh
  4. ===================================================================
  5. --- tools/database_installer.sh (revision 6)
  6. +++ tools/database_installer.sh (working copy)
  7. @@ -88,6 +88,8 @@
  8.  $MYG < ../sql/character_hennas.sql &> /dev/null
  9.  $MYG < ../sql/character_macroses.sql &> /dev/null
  10.  $MYG < ../sql/character_mail.sql &> /dev/null
  11. +$MYG < ../sql/character_offline_trade_items.sql &> /dev/null
  12. +$MYG < ../sql/character_offline_trade.sql &> /dev/null
  13.  $MYG < ../sql/character_quests.sql &> /dev/null
  14.  $MYG < ../sql/character_raid_points.sql &> /dev/null
  15.  $MYG < ../sql/character_recipebook.sql &> /dev/null
  16. Index: sql/characters.sql
  17. ===================================================================
  18. --- sql/characters.sql  (revision 9)
  19. +++ sql/characters.sql  (working copy)
  20. @@ -56,6 +56,8 @@
  21.    `death_penalty_level` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
  22.    `pvpzone_kills` SMALLINT UNSIGNED DEFAULT NULL,
  23.    `topkiller` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  24. +  `aio` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  25. +  `vip` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  26.    PRIMARY KEY (obj_Id),
  27.    KEY `clanid` (`clanid`)
  28.  );
  29. \ No newline at end of file
  30. Index: tools/database_installer.bat
  31. ===================================================================
  32. --- tools/database_installer.bat    (revision 6)
  33. +++ tools/database_installer.bat    (working copy)
  34. @@ -67,6 +67,8 @@
  35.  %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/character_hennas.sql
  36.  %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/character_macroses.sql
  37.  %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/character_mail.sql
  38. +%mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/character_offline_trade_items.sql
  39. +%mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/character_offline_trade.sql
  40.  %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/character_quests.sql
  41.  %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/character_raid_points.sql
  42.  %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/character_recipebook.sql
  43. Index: sql/character_offline_trade.sql
  44. ===================================================================
  45. --- sql/character_offline_trade.sql (revision 0)
  46. +++ sql/character_offline_trade.sql (revision 0)
  47. @@ -0,0 +1,7 @@
  48. +CREATE TABLE IF NOT EXISTS `character_offline_trade` (
  49. +  `charId` int(10) unsigned NOT NULL,
  50. +  `time` bigint(13) unsigned NOT NULL DEFAULT '0',
  51. +  `type` tinyint(4) NOT NULL DEFAULT '0',
  52. +  `title` varchar(50) DEFAULT NULL,
  53. +  PRIMARY KEY (`charId`)
  54. +);
  55. \ No newline at end of file
  56. Index: sql/character_offline_trade_items.sql
  57. ===================================================================
  58. --- sql/character_offline_trade_items.sql   (revision 0)
  59. +++ sql/character_offline_trade_items.sql   (revision 0)
  60. @@ -0,0 +1,6 @@
  61. +CREATE TABLE IF NOT EXISTS `character_offline_trade_items` (
  62. +  `charId` int(10) unsigned NOT NULL,
  63. +  `item` int(10) unsigned NOT NULL DEFAULT '0', -- itemId(for buy) & ObjectId(for sell)
  64. +  `count` bigint(20) unsigned NOT NULL DEFAULT '0',
  65. +  `price` bigint(20) unsigned NOT NULL DEFAULT '0'
  66. +);
  67. \ No newline at end of file
  68. Index: tools/full_install.sql
  69. ===================================================================
  70. --- tools/full_install.sql  (revision 6)
  71. +++ tools/full_install.sql  (working copy)
  72. @@ -11,6 +11,8 @@
  73.  DROP TABLE IF EXISTS character_hennas;
  74.  DROP TABLE IF EXISTS character_macroses;
  75.  DROP TABLE IF EXISTS character_mail;
  76. +DROP TABLE IF EXISTS character_offline_trade_items;
  77. +DROP TABLE IF EXISTS character_offline_trade;
  78.  DROP TABLE IF EXISTS character_quests;
  79.  DROP TABLE IF EXISTS character_raid_points;
  80.  DROP TABLE IF EXISTS character_recipebook;
  81. #P aCis_gameserver
  82. Index: java/net/sf/l2j/gameserver/model/actor/L2Attackable.java
  83. ===================================================================
  84. --- java/net/sf/l2j/gameserver/model/actor/L2Attackable.java    (revision 3)
  85. +++ java/net/sf/l2j/gameserver/model/actor/L2Attackable.java    (working copy)
  86. @@ -660,6 +660,17 @@
  87.                                 sp *= Config.CHAMPION_REWARDS;
  88.                             }
  89.                            
  90. +                           if (attacker instanceof L2PcInstance)
  91. +                           {
  92. +                               L2PcInstance a = (L2PcInstance)attacker;
  93. +                              
  94. +                               if (a.isVip())
  95. +                               {
  96. +                                   exp *= Config.VIP_XP_SP_RATE;
  97. +                                   sp *= Config.VIP_XP_SP_RATE;
  98. +                               }
  99. +                           }
  100. +                          
  101.                             // Check for an over-hit enabled strike
  102.                             if (attacker instanceof L2PcInstance)
  103.                             {
  104. @@ -770,6 +781,17 @@
  105.                         exp = tmp[0];
  106.                         sp = tmp[1];
  107.                        
  108. +                       if (attacker instanceof L2PcInstance)
  109. +                       {
  110. +                           L2PcInstance a = (L2PcInstance)attacker;
  111. +                          
  112. +                           if (a.isVip())
  113. +                           {
  114. +                               exp *= Config.VIP_XP_SP_RATE;
  115. +                               sp *= Config.VIP_XP_SP_RATE;
  116. +                           }
  117. +                       }
  118. +                      
  119.                         if (Config.CHAMPION_ENABLE && isChampion())
  120.                         {
  121.                             exp *= Config.CHAMPION_REWARDS;
  122. @@ -1084,11 +1106,29 @@
  123.        
  124.         // Applies Drop rates
  125.         if (drop.getItemId() == 57)
  126. +       {
  127.             dropChance *= Config.RATE_DROP_ADENA;
  128. +           if (lastAttacker.isVip())
  129. +           {
  130. +               dropChance *= Config.VIP_ADENA_RATE;
  131. +           }
  132. +       }
  133.         else if (isSweep)
  134. +       {
  135.             dropChance *= Config.RATE_DROP_SPOIL;
  136. +           if (lastAttacker.isVip())
  137. +           {
  138. +               dropChance *= Config.VIP_SPOIL_RATE;
  139. +           }
  140. +       }
  141.         else
  142. +       {
  143.             dropChance *= isRaid() && !isRaidMinion() ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;
  144. +           if (lastAttacker.isVip())
  145. +           {
  146. +               dropChance *= Config.VIP_DROP_RATE;
  147. +           }
  148. +       }
  149.        
  150.         if (Config.CHAMPION_ENABLE && isChampion())
  151.             dropChance *= Config.CHAMPION_REWARDS;
  152. @@ -1202,9 +1242,21 @@
  153.            
  154.             int dropChance = drop.getChance();
  155.             if (drop.getItemId() == 57)
  156. +           {
  157.                 dropChance *= Config.RATE_DROP_ADENA;
  158. +               if (lastAttacker.isVip())
  159. +               {
  160. +                   dropChance *= Config.VIP_ADENA_RATE;
  161. +               }
  162. +           }
  163.             else
  164. +           {
  165.                 dropChance *= isRaid() && !isRaidMinion() ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;
  166. +               if (lastAttacker.isVip())
  167. +               {
  168. +                   dropChance *= Config.VIP_DROP_RATE;
  169. +               }
  170. +           }
  171.            
  172.             if (Config.CHAMPION_ENABLE && isChampion())
  173.                 dropChance *= Config.CHAMPION_REWARDS;
  174. Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
  175. ===================================================================
  176. --- java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 8)
  177. +++ java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)
  178. @@ -40,6 +40,7 @@
  179.  import net.sf.l2j.gameserver.datatables.DoorTable;
  180.  import net.sf.l2j.gameserver.datatables.MapRegionTable;
  181.  import net.sf.l2j.gameserver.datatables.MapRegionTable.TeleportWhereType;
  182. +import net.sf.l2j.gameserver.datatables.SkillTable;
  183.  import net.sf.l2j.gameserver.datatables.SkillTable.FrequentSkill;
  184.  import net.sf.l2j.gameserver.handler.ISkillHandler;
  185.  import net.sf.l2j.gameserver.handler.SkillHandler;
  186. @@ -64,6 +65,7 @@
  187.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  188.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.SkillDat;
  189.  import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
  190. +import net.sf.l2j.gameserver.model.actor.instance.L2RaidBossInstance;
  191.  import net.sf.l2j.gameserver.model.actor.instance.L2RiftInvaderInstance;
  192.  import net.sf.l2j.gameserver.model.actor.knownlist.CharKnownList;
  193.  import net.sf.l2j.gameserver.model.actor.position.CharPosition;
  194. @@ -721,6 +723,17 @@
  195.             }
  196.         }
  197.        
  198. +       if (this instanceof L2PcInstance && target instanceof L2RaidBossInstance && Config.ALLOW_BOSS_PETRIFY)
  199. +       {
  200. +           if (target.getLevel() < getLevel())
  201. +           {
  202. +               if (getLevel()-target.getLevel() >= 8)
  203. +               {
  204. +                   SkillTable.getInstance().getInfo(1170, 1).getEffects(target, this);
  205. +               }
  206. +           }
  207. +       }
  208. +      
  209.         // Add the L2PcInstance to _knownObjects and _knownPlayer of the target
  210.         target.getKnownList().addKnownObject(this);
  211.        
  212. @@ -1202,6 +1215,22 @@
  213.            
  214.             return;
  215.         }
  216. +      
  217. +       if (this instanceof L2PcInstance)
  218. +       {
  219. +           L2PcInstance ths = (L2PcInstance)this;
  220. +          
  221. +           if (ths.isAio())
  222. +           {
  223. +               if (!ths.isInsideZone(ZONE_PEACE))
  224. +               {
  225. +                   ths.sendMessage("AIO characters can only use skills inside peace zones.");
  226. +                   sendPacket(ActionFailed.STATIC_PACKET);
  227. +                   return;
  228. +               }
  229. +           }
  230. +       }
  231. +      
  232.         // Override casting type
  233.         if (skill.isSimultaneousCast() && !simultaneously)
  234.             simultaneously = true;
  235. @@ -2241,10 +2270,28 @@
  236.    
  237.     /**
  238.      * Set the Title of the L2Character. Concatens it if length > 16.
  239. +    * Used for the custom mod pvp and pk kills on title.
  240. +    * @param value The String to test.
  241. +    */
  242. +   public final void customEditTitle(String value)
  243. +   {
  244. +       if (value == null)
  245. +           _title = "";
  246. +       else
  247. +           _title = value.length() > 16 ? value.substring(0, 15) : value;
  248. +   }
  249. +  
  250. +   /**
  251. +    * Set the Title of the L2Character. Concatens it if length > 16.
  252.      * @param value The String to test.
  253.      */
  254.     public final void setTitle(String value)
  255.     {
  256. +       if (this instanceof L2PcInstance && Config.PVP_PK_TITLE)
  257. +       {
  258. +           return;
  259. +       }
  260. +      
  261.         if (value == null)
  262.             _title = "";
  263.         else
  264. Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSpawn.java
  265. ===================================================================
  266. --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSpawn.java (revision 3)
  267. +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSpawn.java (working copy)
  268. @@ -21,6 +21,8 @@
  269.  import java.util.regex.Matcher;
  270.  import java.util.regex.Pattern;
  271.  
  272. +import net.sf.l2j.Config;
  273. +import net.sf.l2j.gameserver.Announcements;
  274.  import net.sf.l2j.gameserver.SevenSigns;
  275.  import net.sf.l2j.gameserver.datatables.GmListTable;
  276.  import net.sf.l2j.gameserver.datatables.NpcTable;
  277. @@ -234,6 +236,10 @@
  278.                 spawn.setRespawnMinDelay(43200);
  279.                 spawn.setRespawnMaxDelay(129600);
  280.                 RaidBossSpawnManager.getInstance().addNewSpawn(spawn, 0, template.getBaseHpMax(), template.getBaseMpMax(), permanent);
  281. +               if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
  282. +               {
  283. +                   Announcements.announceToAll("Raid boss "+spawn.getTemplate().getName()+" has been spawned.");
  284. +               }
  285.             }
  286.             else
  287.             {
  288. Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  289. ===================================================================
  290. --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java    (revision 3)
  291. +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java    (working copy)
  292. @@ -22,6 +22,7 @@
  293.  import net.sf.l2j.gameserver.datatables.GmListTable;
  294.  import net.sf.l2j.gameserver.datatables.MapRegionTable;
  295.  import net.sf.l2j.gameserver.datatables.SkillTable.FrequentSkill;
  296. +import net.sf.l2j.gameserver.instancemanager.CastleManager;
  297.  import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
  298.  import net.sf.l2j.gameserver.instancemanager.CoupleManager;
  299.  import net.sf.l2j.gameserver.instancemanager.DimensionalRiftManager;
  300. @@ -232,6 +233,60 @@
  301.         // Attacker or spectator logging into a siege zone will be ported at town.
  302.         if (!activeChar.isGM() && (!activeChar.isInSiege() || activeChar.getSiegeState() < 2) && activeChar.isInsideZone(L2Character.ZONE_SIEGE))
  303.             activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
  304. +      
  305. +       if (Config.ANNOUNCE_HERO_ON_ENTER && activeChar.isHero() && !activeChar.isGM())
  306. +       {
  307. +           Announcements.announceToAll("Hero "+activeChar.getName()+" has logged in!");
  308. +       }
  309. +      
  310. +       if (Config.ANNOUNCE_CASTLE_LORDS)
  311. +       {
  312. +           if (activeChar.getClan() != null)
  313. +           {
  314. +               if (activeChar.getClan().getLeaderName().equals(activeChar.getName()))
  315. +               {
  316. +                   if (CastleManager.getInstance().getCastleByOwner(activeChar.getClan()) != null)
  317. +                   {
  318. +                       Announcements.announceToAll(activeChar.getName()+" leader of "+CastleManager.getInstance().getCastleByOwner(activeChar.getClan()).getName()+" has logged in!");
  319. +                   }
  320. +               }
  321. +           }
  322. +       }
  323. +      
  324. +       if (Config.ALLOW_PVP_NAME_COLOR_SYSTEM || Config.ALLOW_PK_TITLE_COLOR_SYSTEM)
  325. +       {
  326. +           activeChar.colorsCheck();
  327. +       }
  328. +      
  329. +       if (activeChar.isAio() || activeChar.isVip())
  330. +       {
  331. +           activeChar.checkAioVipColors();
  332. +       }
  333. +      
  334. +       if (Config.PVP_PK_TITLE && Config.ALLOW_NEW_CHAR_TITLE)
  335. +       {
  336. +           if (Config.ALLOW_TITLE_PANEL)
  337. +           {
  338. +               StringBuilder debian = new StringBuilder();
  339. +               NpcHtmlMessage d = new NpcHtmlMessage(1);
  340. +                          
  341. +               debian.append("<html><head></head>" +
  342. +                       "<body>" +
  343. +                       "<center>" +
  344. +                       "This panel, allows you to change your title.<br>" +
  345. +                       "<br>" +
  346. +                       "Option 1:<br>" +
  347. +                       "<button value=\"Normal Title\" action=\"bypass -h title1\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\">" +
  348. +                       "<br>" +
  349. +                       "Option 2:<br>" +
  350. +                       "<button value=\"PvP/PK Title\" action=\"bypass -h title2\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\">" +
  351. +                       "<br>" +
  352. +                       "</center></body></html>");
  353. +                          
  354. +               d.setHtml(debian.toString());
  355. +               activeChar.sendPacket(d);
  356. +           }
  357. +       }
  358.     }
  359.    
  360.     private static void engage(L2PcInstance cha)
  361. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2TeleporterInstance.java
  362. ===================================================================
  363. --- java/net/sf/l2j/gameserver/model/actor/instance/L2TeleporterInstance.java   (revision 3)
  364. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2TeleporterInstance.java   (working copy)
  365. @@ -50,6 +50,12 @@
  366.     {
  367.         player.sendPacket(ActionFailed.STATIC_PACKET);
  368.        
  369. +       if (player.isAio() && !Config.ALLOW_AIO_USE_GK)
  370. +       {
  371. +           player.sendMessage("AIO players are not allowed to use Gatekeepers.");
  372. +           return;
  373. +       }
  374. +      
  375.         int condition = validateCondition(player);
  376.        
  377.         StringTokenizer st = new StringTokenizer(command, " ");
  378. Index: java/net/sf/l2j/gameserver/GameServer.java
  379. ===================================================================
  380. --- java/net/sf/l2j/gameserver/GameServer.java  (revision 14)
  381. +++ java/net/sf/l2j/gameserver/GameServer.java  (working copy)
  382. @@ -49,6 +49,7 @@
  383.  import net.sf.l2j.gameserver.datatables.MapRegionTable;
  384.  import net.sf.l2j.gameserver.datatables.NpcTable;
  385.  import net.sf.l2j.gameserver.datatables.NpcWalkerRoutesTable;
  386. +import net.sf.l2j.gameserver.datatables.OfflineTradersTable;
  387.  import net.sf.l2j.gameserver.datatables.PetDataTable;
  388.  import net.sf.l2j.gameserver.datatables.SkillTable;
  389.  import net.sf.l2j.gameserver.datatables.SkillTreeTable;
  390. @@ -94,6 +95,8 @@
  391.  import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
  392.  import net.sf.l2j.gameserver.model.entity.Castle;
  393.  import net.sf.l2j.gameserver.model.entity.Hero;
  394. +import net.sf.l2j.gameserver.model.entity.HzVoteReward;
  395. +import net.sf.l2j.gameserver.model.entity.TzVoteReward;
  396.  import net.sf.l2j.gameserver.model.entity.l2seresin.events.Kino;
  397.  import net.sf.l2j.gameserver.model.entity.tasks.TaskLoader;
  398.  import net.sf.l2j.gameserver.model.olympiad.Olympiad;
  399. @@ -281,6 +284,26 @@
  400.         if (Config.ALLOW_WEDDING)
  401.             CoupleManager.getInstance();
  402.        
  403. +       if (Config.ALLOW_HOPZONE_VOTE_REWARD)
  404. +       {
  405. +           _log.config("Hopzone vote reward is enabled");
  406. +           HzVoteReward.getInstance();
  407. +       }
  408. +       else
  409. +       {
  410. +           _log.config("Hopzone vote reward is disabled");
  411. +       }
  412. +      
  413. +       if (Config.ALLOW_TOPZONE_VOTE_REWARD)
  414. +       {
  415. +           _log.config("Topzone vote reward is enabled");
  416. +           TzVoteReward.getInstance();
  417. +       }
  418. +       else
  419. +       {
  420. +           _log.config("Topzone vote reward is disabled");
  421. +       }
  422. +      
  423.         Util.printSection("Custom");
  424.         TaskLoader.getInstance();
  425.         if (Config.ALLOW_KINO)
  426. @@ -302,6 +325,9 @@
  427.         KnownListUpdateTaskManager.getInstance();
  428.         MovieMakerManager.getInstance();
  429.        
  430. +       if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
  431. +           OfflineTradersTable.restoreOfflineTraders();
  432. +      
  433.         if (Config.DEADLOCK_DETECTOR)
  434.         {
  435.             _log.info("Deadlock detector is enabled. Timer: " + Config.DEADLOCK_CHECK_INTERVAL + "s.");
  436. Index: java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java
  437. ===================================================================
  438. --- java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java  (revision 3)
  439. +++ java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java  (working copy)
  440. @@ -201,7 +201,7 @@
  441.            
  442.         writeD(_activeChar.getClanCrestLargeId());
  443.         writeC(_activeChar.isNoble() ? 1 : 0); // Symbol on char menu ctrl+I
  444. -       writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA)) ? 1 : 0); // Hero Aura
  445. +       writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) || (Config.WAR_LEGEND_AURA && _activeChar.killingSpreePvps >= Config.KILLS_TO_GET_WAR_LEGEND_AURA)) ? 1 : 0); // Hero Aura
  446.        
  447.         writeC(_activeChar.isFishing() ? 1 : 0); // 0x01: Fishing Mode (Cant be undone by setting back to 0)
  448.        
  449. Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java
  450. ===================================================================
  451. --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java   (revision 0)
  452. +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java   (revision 0)
  453. @@ -0,0 +1,72 @@
  454. +/*
  455. + * This program is free software: you can redistribute it and/or modify it under
  456. + * the terms of the GNU General Public License as published by the Free Software
  457. + * Foundation, either version 3 of the License, or (at your option) any later
  458. + * version.
  459. + *
  460. + * This program is distributed in the hope that it will be useful, but WITHOUT
  461. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  462. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  463. + * details.
  464. + *
  465. + * You should have received a copy of the GNU General Public License along with
  466. + * this program. If not, see <http://www.gnu.org/licenses/>.
  467. + */
  468. +package net.sf.l2j.gameserver.handler.admincommandhandlers;
  469. +
  470. +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  471. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  472. +
  473. +/**
  474. + * @author Anarchy
  475. + *
  476. + */
  477. +public class AdminVip implements IAdminCommandHandler
  478. +{
  479. +   private static final String[] ADMIN_COMMANDS = { "setvip" };
  480. +  
  481. +   @Override
  482. +   public boolean useAdminCommand(String command, L2PcInstance activeChar)
  483. +   {
  484. +       if (command.equals("setvip"))
  485. +       {
  486. +           Object target = activeChar.getTarget();
  487. +          
  488. +           if (target == null)
  489. +           {
  490. +               activeChar.sendMessage("Invalid target.");
  491. +               return false;
  492. +           }
  493. +          
  494. +           if (!(target instanceof L2PcInstance))
  495. +           {
  496. +               activeChar.sendMessage("Invalid target.");
  497. +               return false;
  498. +           }
  499. +          
  500. +           L2PcInstance trg = (L2PcInstance)target;
  501. +          
  502. +           if (trg.isVip())
  503. +           {
  504. +               trg.setVip(false);
  505. +               activeChar.sendMessage("You have removed the VIP status from "+trg.getName()+".");
  506. +           }
  507. +           else
  508. +           {
  509. +               trg.setVip(true);
  510. +               activeChar.sendMessage("You have given VIP status to "+trg.getName()+".");
  511. +           }
  512. +          
  513. +           return true;
  514. +       }
  515. +      
  516. +       return true;
  517. +   }
  518. +
  519. +   @Override
  520. +   public String[] getAdminCommandList()
  521. +   {
  522. +       return ADMIN_COMMANDS;
  523. +   }
  524. +  
  525. +}
  526. Index: config/custom.properties
  527. ===================================================================
  528. --- config/custom.properties    (revision 0)
  529. +++ config/custom.properties    (revision 0)
  530. @@ -0,0 +1,210 @@
  531. +=================================================================================================
  532. +#################################################################################################
  533. +=================================================================================================
  534. +# Oly Grade Restriction #
  535. +=================================================================================================
  536. +#################################################################################################
  537. +=================================================================================================
  538. +# Oly Grade Restriction #
  539. +AllowOlyGradeRestr= True
  540. +ArmorGradeRestr= B
  541. +WeaponGradeRestr= A
  542. +MaxEnchantRestr = 8
  543. +
  544. +# Killing spree.
  545. +AllowKillingSpree = True
  546. +# Killing spree values (pvp,message;pvp,message;).
  547. +KillingSpreeReward = 3,is on a killing spree!;6,is on a rampage!;
  548. +
  549. +# Pvp & pk kills on title.
  550. +PvpPkTitle = False
  551. +#Title Prefixes. If commented - "0 | 0" else "PvpTitlePrefix0PkTitlePrefix0"
  552. +PvPTitlePrefix =
  553. +PkTitlePrefix =
  554. +
  555. +# Announce hero character on enter.
  556. +AnnounceHeroOnEnter = True
  557. +
  558. +# Announce castle lord on enter.
  559. +AnnounceCastleLords = True
  560. +
  561. +# War Legend Configs
  562. +WarLegendAura = True
  563. +KillsToGetWarLegendAura = 10
  564. +
  565. +# ================================================================
  566. +#                       Offline trade & craft
  567. +# ================================================================
  568. +
  569. +# Enable or disable offline trade mode
  570. +# Default: False
  571. +OfflineTradeEnable = True
  572. +
  573. +# Enable or disable offline craft mode
  574. +# Default: False
  575. +OfflineCraftEnable = True
  576. +
  577. +# Offline name color
  578. +OfflineSetNameColor = True
  579. +OfflineNameColor = 808080
  580. +
  581. +# Allow fame for characters in offline mode
  582. +# Default: False
  583. +OfflineFame = True
  584. +
  585. +# Restore offline traders/crafters after restart/shutdown.
  586. +# Default: false.
  587. +RestoreOffliners = True
  588. +
  589. +# Restore offline characters for X days
  590. +#Default: 10
  591. +OfflineMaxDays = 10
  592. +
  593. +#Disconnect shop after finished selling, buying.
  594. +#Default: True
  595. +OfflineDisconnectFinished = True
  596. +
  597. +# PvP name color system.
  598. +AllowPvpNameColorSystem = False
  599. +# PvP name colors, works like: pvps,color;pvps,color;
  600. +PvpColors = 100,FFFF00;200,FF00FF
  601. +
  602. +# PvP title color system.
  603. +AllowPkTitleColorSystem = False
  604. +# Pk title colors, works like: pks,color;pks,color;
  605. +PkColors = 100,FFFF00;200,FF00FF
  606. +
  607. +# Custom starting spawn location.
  608. +AllowCustomSpawnLocation = True
  609. +CustomSpawnLocation = 113852,-108766,-851
  610. +
  611. +# Social actions for words: lol, hi, haha, yes, no
  612. +# To add new words go to java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java
  613. +AllowSocialActions = True
  614. +
  615. +# Allow boss attack petrify if 8 lvls lower than char.
  616. +AllowBossPetrify = True
  617. +
  618. +# Custom title on new chars.
  619. +# TO EXW VALEI FALSE GT EINAI TO ALO TRUE POU SOU ELEGA KAI MPOREI NA EXEI ERROR
  620. +AllowNewCharTitle = False
  621. +NewCharTitle = L2 Mendrion
  622. +
  623. +# Hopzone vote reward.
  624. +AllowHopzoneVoteReward = False
  625. +# Vote reward server link.
  626. +HopzoneServerLink = http://l2.hopzone.net/lineage2/details/74078/L2World-Servers/
  627. +# First page of servers list link.
  628. +HopzoneFirstPageLink = http://l2.hopzone.net/lineage2/
  629. +# Votes for next reward needed.
  630. +HopzoneVotesDifference = 5
  631. +# Rank needed for server to be on first page.
  632. +HopzoneFirstPageRankNeeded = 15
  633. +# Minutes between rewards.
  634. +# Eg. You put 5 it checks every 5 minutes for reward.
  635. +HopzoneRewardCheckTime = 5
  636. +# Small reward(s).
  637. +HopzoneSmallReward = 57,100000000;
  638. +# Big reward(s).
  639. +HopzoneBigReward = 3470,1;
  640. +# Dualboxes allowed.
  641. +HopzoneDuaboxesAllowed = 1
  642. +
  643. +# Topzone vote reward.
  644. +AllowTopzoneVoteReward = False
  645. +# Vote reward server link.
  646. +TopzoneServerLink = http://l2topzone.com/lineage2/server-info/6296/L2ToxiccomProMMORPG.html/
  647. +# First page of servers list link.
  648. +TopzoneFirstPageLink = http://l2topzone.com/lineage2/server-list/top.html/
  649. +# Votes for next reward needed.
  650. +TopzoneVotesDifference = 5
  651. +# Rank needed for server to be on first page.
  652. +TopzoneFirstPageRankNeeded = 15
  653. +# Minutes between rewards.
  654. +# Eg. You put 5 it checks every 5 minutes for reward.
  655. +TopzoneRewardCheckTime = 5
  656. +# Small reward(s).
  657. +TopzoneSmallReward = 57,100000000;
  658. +# Big reward(s).
  659. +TopzoneBigReward = 3470,1;
  660. +# Dualboxes allowed.
  661. +TopzoneDuaboxesAllowed = 1
  662. +
  663. +# -----------------------------------------
  664. +#  Aio System                             -
  665. +# -----------------------------------------
  666. +# Enable / Disable Aio System (//setaio)
  667. +EnableAioSystem = True
  668. +# Enable / Disable Name Color
  669. +AllowAioNameColor = True
  670. +AioNameColor = 88AA88
  671. +# Enable / Disable Title Color
  672. +AllowAioTitleColor = True
  673. +AioTitleColor = 88AA88
  674. +# List of Aio Skills
  675. +# Format : skillid,skilllvl;skillid2,skilllvl2;....skillidn,skilllvln
  676. +AioSkills = 1085,3;1304,3;1087,3;1354,1;1062,2;1005,3;1243,6;1045,6;1048,6;\
  677. +1311,6;168,3;213,8;1007,3;1309,3;1552,3;1006,3;1229,15;1308,3;1253,3;1284,3;\
  678. +1009,3;1310,4;1363,1;1362,1;1397,3;1292,6;1078,6;307,1;276,1;309,1;274,1;275,1;\
  679. +272,1;277,1;273,1;311,1;366,1;365,1;310,1;271,1;1242,3;1257,3;1353,3;1391,3;\
  680. +1352,1;229,7;228,3;1077,3;1218,33;1059,3;1219,33;1217,33;1388,3;1389,3;1240,3;\
  681. +1086,2;1032,3;1073,2;1036,2;1035,4;1068,3;1003,3;1282,2;1356,1;1355,1;1357,33;\
  682. +1044,3;1182,3;1191,3;1033,3;1189,3;1259,4;1306,6;234,23;1040,3;364,1;264,1;306,1;\
  683. +269,1;270,1;265,1;363,1;349,1;308,1;305,1;304,1;267,1;266,1;268,1;1390,3;1303,2;\
  684. +1204,2;1268,4;1413,1;4699,8;4700,8;4703,8
  685. +# Aio Buffers can use GK?
  686. +AllowAioUseGk = False
  687. +# Aio Buffers can speak to Class Master?
  688. +AllowAioUseClassMaster = False
  689. +
  690. +# ---------------------------
  691. +#  - VIP Config -
  692. +# ---------------------------
  693. +# Command in game: //setvip
  694. +# If it is true then VIPs will have their name and title colored.
  695. +VIPColorEnabled = False
  696. +# VIP Name's Color.
  697. +VIPColorName = FF33AA
  698. +# VIP Title's Color.
  699. +VIPTitleColor = FFAA33
  700. +# VIP Xp/Sp Rate
  701. +VIPXpSpRate = 1.5
  702. +# VIP Adena rate
  703. +VIPAdenaRate = 1.5
  704. +# VIP drop rate
  705. +VIPDropRate = 1.5
  706. +# VIP spoil rate
  707. +VIPSpoilRate = 1.5
  708. +
  709. +#====================================
  710. +# Anti Farm System
  711. +#====================================
  712. +# You must put True to active the AntiFarm mod.
  713. +AntiFarmEnabled = True
  714. +# You must active AntiFarmEnabled = True to enable this mod.
  715. +# AntiFarm for Party, IP, Clan and Ally.
  716. +AntiFarmParty = True
  717. +AntiFarmIP = True
  718. +AntiFarmClanAlly = True
  719. +# You must active AntiFarmEnabled = True to enable this mod.
  720. +# AntiFarm if player has level < AntiFarmMaxLvlDiff.
  721. +AntiFarmLvlDiff = False
  722. +AntiFarmMaxLvlDiff = 30
  723. +# You must active AntiFarmEnabled = True to enable this mod.
  724. +# AntiFarm if player has Pdef < AntiFarmMaxPdefDiff.
  725. +AntiFarmPdefDiff = False
  726. +AntiFarmMaxPdefDiff = 300
  727. +# You must active AntiFarmEnabled = True to enable this mod.
  728. +# AntiFarm if player has Patk < AntiFarmMaxPatkDiff.
  729. +AntiFarmPatkDiff = False
  730. +AntiFarmMaxPatkDiff = 300
  731. +# If true summons don't give any reward (avoid pvp/pk farm)
  732. +AntiFarmSummon = False
  733. +
  734. +# Whether or not the announcement to all players about the appearance in the world raidboss (spawn)
  735. +AnnounceToAllSpawnRb = True
  736. +
  737. +# Title panel.
  738. +# It gives you 2 options to choose about your title.
  739. +# In order this to work correct, you need to have both pvp/pk on title enabled and custom title.
  740. +AllowTitlePanel = True
  741. \ No newline at end of file
  742. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2OlympiadManagerInstance.java
  743. ===================================================================
  744. --- java/net/sf/l2j/gameserver/model/actor/instance/L2OlympiadManagerInstance.java  (revision 3)
  745. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2OlympiadManagerInstance.java  (working copy)
  746. @@ -14,9 +14,11 @@
  747.  */
  748. package net.sf.l2j.gameserver.model.actor.instance;
  749.  
  750. +import net.sf.l2j.Config;
  751. import net.sf.l2j.gameserver.model.L2ItemInstance;
  752. import net.sf.l2j.gameserver.model.L2Multisell;
  753. import net.sf.l2j.gameserver.model.entity.Hero;
  754. +import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
  755. import net.sf.l2j.gameserver.model.olympiad.CompetitionType;
  756. import net.sf.l2j.gameserver.model.olympiad.Olympiad;
  757. import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager;
  758. @@ -160,11 +162,17 @@
  759.                     break;
  760.                
  761.                 case 4: // register non classed based
  762. -                   OlympiadManager.getInstance().registerNoble(player, CompetitionType.NON_CLASSED);
  763. +                   if (meetsRequirements(player))
  764. +                   {
  765. +                       OlympiadManager.getInstance().registerNoble(player, CompetitionType.NON_CLASSED);
  766. +                   }
  767.                     break;
  768.                
  769.                 case 5: // register classed based
  770. -                   OlympiadManager.getInstance().registerNoble(player, CompetitionType.CLASSED);
  771. +                   if (meetsRequirements(player))
  772. +                   {
  773. +                       OlympiadManager.getInstance().registerNoble(player, CompetitionType.CLASSED);
  774. +                   }
  775.                     break;
  776.                
  777.                 case 6: // request tokens reward
  778. @@ -321,4 +329,106 @@
  779.         else
  780.             super.onBypassFeedback(player, command);
  781.     }
  782. +  
  783. +   public boolean meetsRequirements(L2PcInstance p)
  784. +   {
  785. +       if (Config.ALLOW_OLY_GRADE_RESTR)
  786. +       {
  787. +           // Grade checks.
  788. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND).getItem().getCrystalType() > Config.WEAPON_GRADE_RESTR)
  789. +           {
  790. +               p.sendMessage("You may not register for the Olympiad, as your weapon's grade is not the appropriate.");
  791. +               return false;
  792. +           }
  793. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getCrystalType() > Config.ARMOR_GRADE_RESTR)
  794. +           {
  795. +               p.sendMessage("You may not register for the Olympiad, as your armor's grade is not the appropriate.");
  796. +               return false;
  797. +           }
  798. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD).getItem().getCrystalType() > Config.ARMOR_GRADE_RESTR)
  799. +           {
  800. +               p.sendMessage("You may not register for the Olympiad, as your armor's grade is not the appropriate.");
  801. +               return false;
  802. +           }
  803. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET).getItem().getCrystalType() > Config.ARMOR_GRADE_RESTR)
  804. +           {
  805. +               p.sendMessage("You may not register for the Olympiad, as your armor's grade is not the appropriate.");
  806. +               return false;
  807. +           }
  808. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES).getItem().getCrystalType() > Config.ARMOR_GRADE_RESTR)
  809. +           {
  810. +               p.sendMessage("You may not register for the Olympiad, as your armor's grade is not the appropriate.");
  811. +               return false;
  812. +           }
  813. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS).getItem().getCrystalType() > Config.ARMOR_GRADE_RESTR)
  814. +           {
  815. +               p.sendMessage("You may not register for the Olympiad, as your armor's grade is not the appropriate.");
  816. +               return false;
  817. +           }
  818. +          
  819. +           // Enchant checks.
  820. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  821. +           {
  822. +               p.sendMessage("You may not register for the Olympiad, as your weapon's enchant level is not the appropriate.");
  823. +               return false;
  824. +           }
  825. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  826. +           {
  827. +               p.sendMessage("You may not register for the Olympiad, as your armor's enchant level is not the appropriate.");
  828. +               return false;
  829. +           }
  830. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  831. +           {
  832. +               p.sendMessage("You may not register for the Olympiad, as your armor's enchant level is not the appropriate.");
  833. +               return false;
  834. +           }
  835. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  836. +           {
  837. +               p.sendMessage("You may not register for the Olympiad, as your armor's enchant level is not the appropriate.");
  838. +               return false;
  839. +           }
  840. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  841. +           {
  842. +               p.sendMessage("You may not register for the Olympiad, as your armor's enchant level is not the appropriate.");
  843. +               return false;
  844. +           }
  845. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  846. +           {
  847. +               p.sendMessage("You may not register for the Olympiad, as your armor's enchant level is not the appropriate.");
  848. +               return false;
  849. +           }
  850. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_UNDER).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  851. +           {
  852. +               p.sendMessage("You may not register for the Olympiad, as your tattoo's enchant level is not the appropriate.");
  853. +               return false;
  854. +           }
  855. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  856. +           {
  857. +               p.sendMessage("You may not register for the Olympiad, as your necklace's enchant level is not the appropriate.");
  858. +               return false;
  859. +           }
  860. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEAR).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  861. +           {
  862. +               p.sendMessage("You may not register for the Olympiad, as your earring's enchant level is not the appropriate.");
  863. +               return false;
  864. +           }
  865. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_REAR).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  866. +           {
  867. +               p.sendMessage("You may not register for the Olympiad, as your earring's enchant level is not the appropriate.");
  868. +               return false;
  869. +           }
  870. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  871. +           {
  872. +               p.sendMessage("You may not register for the Olympiad, as your ring's enchant level is not the appropriate.");
  873. +               return false;
  874. +           }
  875. +           if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
  876. +           {
  877. +               p.sendMessage("You may not register for the Olympiad, as your ring's enchant level is not the appropriate.");
  878. +               return false;
  879. +           }
  880. +       }
  881. +      
  882. +       return true;
  883. +   }
  884. }
  885. \ No newline at end of file
  886. Index: java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java
  887. ===================================================================
  888. --- java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java  (revision 3)
  889. +++ java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java  (working copy)
  890. @@ -256,7 +256,7 @@
  891.            
  892.         writeD(_activeChar.getClanCrestLargeId());
  893.         writeC(_activeChar.isNoble() ? 1 : 0); // 0x01: symbol on char menu ctrl+I
  894. -       writeC(_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) ? 1 : 0); // 0x01: Hero Aura
  895. +       writeC(_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) || (Config.WAR_LEGEND_AURA && _activeChar.killingSpreePvps >= Config.KILLS_TO_GET_WAR_LEGEND_AURA) ? 1 : 0); // 0x01: Hero Aura
  896.        
  897.         writeC(_activeChar.isFishing() ? 1 : 0); // Fishing Mode
  898.        
  899. Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
  900. ===================================================================
  901. --- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 3)
  902. +++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
  903. @@ -20,6 +20,7 @@
  904.  
  905. import net.sf.l2j.Config;
  906. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAdmin;
  907. +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAio;
  908. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAnnouncements;
  909. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBan;
  910. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBookmark;
  911. @@ -67,6 +68,7 @@
  912. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTarget;
  913. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTeleport;
  914. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminUnblockIp;
  915. +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminVip;
  916. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminZone;
  917.  
  918. public class AdminCommandHandler
  919. @@ -131,6 +133,11 @@
  920.         registerAdminCommandHandler(new AdminTeleport());
  921.         registerAdminCommandHandler(new AdminUnblockIp());
  922.         registerAdminCommandHandler(new AdminZone());
  923. +       if (Config.ENABLE_AIO_SYSTEM)
  924. +       {
  925. +           registerAdminCommandHandler(new AdminAio());
  926. +       }
  927. +       registerAdminCommandHandler(new AdminVip());
  928.     }
  929.    
  930.     public void registerAdminCommandHandler(IAdminCommandHandler handler)
  931. Index: java/net/sf/l2j/gameserver/network/L2GameClient.java
  932. ===================================================================
  933. --- java/net/sf/l2j/gameserver/network/L2GameClient.java    (revision 3)
  934. +++ java/net/sf/l2j/gameserver/network/L2GameClient.java    (working copy)
  935. @@ -25,6 +25,7 @@
  936. import java.util.concurrent.ScheduledFuture;
  937. import java.util.concurrent.locks.ReentrantLock;
  938. import java.util.logging.Level;
  939. +import java.util.logging.LogRecord;
  940. import java.util.logging.Logger;
  941.  
  942. import net.sf.l2j.Config;
  943. @@ -450,9 +451,19 @@
  944.    
  945.     public void close(L2GameServerPacket gsp)
  946.     {
  947. +       if (getConnection() == null)
  948. +           return; // offline shop
  949. +      
  950.         getConnection().close(gsp);
  951.     }
  952.    
  953. +   public void close(L2GameServerPacket[] gspArray)
  954. +   {
  955. +       if (getConnection() == null)
  956. +           return; // offline shop
  957. +       getConnection().close(gspArray);
  958. +   }
  959. +  
  960.     /**
  961.      * @param charslot
  962.      * @return
  963. @@ -548,6 +559,23 @@
  964.                     setDetached(true);
  965.                     fast = !getActiveChar().isInCombat() && !getActiveChar().isLocked();
  966.                 }
  967. +               L2PcInstance player = L2GameClient.this.getActiveChar();
  968. +               if ((player.isInStoreMode() && Config.OFFLINE_TRADE_ENABLE) || (player.isInCraftMode() && Config.OFFLINE_CRAFT_ENABLE))
  969. +               {
  970. +                   player.leaveParty();
  971. +                   if (Config.OFFLINE_SET_NAME_COLOR)
  972. +                   {
  973. +                       player.getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR);
  974. +                       player.broadcastUserInfo();
  975. +                   }
  976. +                   if (player.getOfflineStartTime() == 0)
  977. +                       player.setOfflineStartTime(System.currentTimeMillis());
  978. +                                  
  979. +                   LogRecord record = new LogRecord(Level.INFO, "Entering offline mode");
  980. +                   record.setParameters(new Object[]{L2GameClient.this});
  981. +                   _log.log(record);
  982. +                   return;
  983. +               }
  984.                 cleanMe(fast);
  985.             }
  986.             catch (Exception e1)
  987. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
  988. ===================================================================
  989. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 4)
  990. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
  991. @@ -201,6 +201,15 @@
  992.                
  993.                 bh.handleBypass(_command, activeChar);
  994.             }
  995. +           else if(_command.startsWith("title1"))
  996. +           {
  997. +               activeChar.customEditTitle(Config.NEW_CHAR_TITLE);
  998. +               activeChar.choseNormalTitle = true;
  999. +           }
  1000. +           else if(_command.startsWith("title2"))
  1001. +           {
  1002. +               activeChar.customEditTitle(Config.PVP_TITLE_PREFIX+" "+activeChar.getPvpKills()+" | "+Config.PK_TITLE_PREFIX+" "+activeChar.getPkKills());
  1003. +           }
  1004.         }
  1005.         catch (Exception e)
  1006.         {
  1007. Index: java/net/sf/l2j/gameserver/model/entity/TzVoteReward.java
  1008. ===================================================================
  1009. --- java/net/sf/l2j/gameserver/model/entity/TzVoteReward.java   (revision 0)
  1010. +++ java/net/sf/l2j/gameserver/model/entity/TzVoteReward.java   (revision 0)
  1011. @@ -0,0 +1,303 @@
  1012. +/*
  1013. + * This program is free software: you can redistribute it and/or modify it under
  1014. + * the terms of the GNU General Public License as published by the Free Software
  1015. + * Foundation, either version 3 of the License, or (at your option) any later
  1016. + * version.
  1017. + *
  1018. + * This program is distributed in the hope that it will be useful, but WITHOUT
  1019. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1020. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1021. + * details.
  1022. + *
  1023. + * You should have received a copy of the GNU General Public License along with
  1024. + * this program. If not, see <http://www.gnu.org/licenses/>.
  1025. + */
  1026. +package net.sf.l2j.gameserver.model.entity;
  1027. +
  1028. +import java.io.BufferedReader;
  1029. +import java.io.InputStreamReader;
  1030. +import java.net.URL;
  1031. +import java.net.URLConnection;
  1032. +import java.util.Collection;
  1033. +import java.util.HashMap;
  1034. +
  1035. +import net.sf.l2j.Config;
  1036. +import net.sf.l2j.gameserver.Announcements;
  1037. +import net.sf.l2j.gameserver.ThreadPoolManager;
  1038. +import net.sf.l2j.gameserver.model.L2World;
  1039. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1040. +/**
  1041. + * @author Anarchy
  1042. + *
  1043. + */
  1044. +public class TzVoteReward
  1045. +{
  1046. +        // Configurations.
  1047. +        private static String topzoneUrl = Config.TOPZONE_SERVER_LINK;
  1048. +        private static String page1Url = Config.TOPZONE_FIRST_PAGE_LINK;
  1049. +        private static int voteRewardVotesDifference = Config.TOPZONE_VOTES_DIFFERENCE;
  1050. +        private static int firstPageRankNeeded = Config.TOPZONE_FIRST_PAGE_RANK_NEEDED;
  1051. +        private static int checkTime = 60*1000*Config.TOPZONE_REWARD_CHECK_TIME;
  1052. +      
  1053. +        // Don't-touch variables.
  1054. +        private static int lastVotes = 0;
  1055. +        @SuppressWarnings("unused")
  1056. +       private static HashMap<String, Integer> playerIps = new HashMap<String, Integer>();
  1057. +      
  1058. +        public static void updateConfigurations()
  1059. +        {
  1060. +                topzoneUrl = Config.TOPZONE_SERVER_LINK;
  1061. +                page1Url = Config.TOPZONE_FIRST_PAGE_LINK;
  1062. +                voteRewardVotesDifference = Config.TOPZONE_VOTES_DIFFERENCE;
  1063. +                firstPageRankNeeded = Config.TOPZONE_FIRST_PAGE_RANK_NEEDED;
  1064. +                checkTime = 60*1000*Config.TOPZONE_REWARD_CHECK_TIME;
  1065. +        }
  1066. +      
  1067. +        public static void getInstance()
  1068. +        {
  1069. +                System.out.println("Vote reward system initialized.");
  1070. +                ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
  1071. +                {
  1072. +                        @SuppressWarnings("synthetic-access")
  1073. +                       @Override
  1074. +                        public void run()
  1075. +                        {
  1076. +                                if (Config.ALLOW_TOPZONE_VOTE_REWARD)
  1077. +                                {
  1078. +                                        reward();
  1079. +                                }
  1080. +                                else
  1081. +                                {
  1082. +                                        return;
  1083. +                                }
  1084. +                        }
  1085. +                }, checkTime/2, checkTime);
  1086. +        }
  1087. +      
  1088. +        private static void reward()
  1089. +        {
  1090. +                int firstPageVotes = getFirstPageRankVotes();
  1091. +                int currentVotes = getVotes();
  1092. +              
  1093. +                if (firstPageVotes == -1 || currentVotes == -1)
  1094. +                {
  1095. +                        if (firstPageVotes == -1)
  1096. +                        {
  1097. +                                System.out.println("There was a problem on getting votes from server with rank "+firstPageRankNeeded+".");
  1098. +                        }
  1099. +                        if (currentVotes == -1)
  1100. +                        {
  1101. +                                System.out.println("There was a problem on getting server votes.");
  1102. +                        }
  1103. +                      
  1104. +                        return;
  1105. +                }
  1106. +              
  1107. +                if (lastVotes == 0)
  1108. +                {
  1109. +                        lastVotes = currentVotes;
  1110. +                        Announcements.getInstance();
  1111. +                       Announcements.announceToAll("Topzone's vote count is "+currentVotes+".");
  1112. +                        Announcements.getInstance();
  1113. +                       Announcements.announceToAll("We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for reward.");
  1114. +                        if (firstPageVotes-lastVotes <= 0)
  1115. +                        {
  1116. +                                Announcements.getInstance();
  1117. +                               Announcements.announceToAll("We are in the first page of topzone, reward will be big.");
  1118. +                        }
  1119. +                        else
  1120. +                        {
  1121. +                                Announcements.getInstance();
  1122. +                               Announcements.announceToAll("We need "+(firstPageVotes-lastVotes)+" vote(s) for big reward.");
  1123. +                        }
  1124. +                        return;
  1125. +                }
  1126. +              
  1127. +                if (currentVotes >= lastVotes+voteRewardVotesDifference)
  1128. +                {
  1129. +                        Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
  1130. +                        if (firstPageVotes-currentVotes <= 0)
  1131. +                        {
  1132. +                                Announcements.getInstance();
  1133. +                               Announcements.announceToAll("Everyone has been rewarded with big reward.");
  1134. +                                Announcements.getInstance();
  1135. +                               Announcements.announceToAll("Topzone's vote count is "+currentVotes+".");
  1136. +                                for (L2PcInstance p : pls)
  1137. +                                {
  1138. +                                        boolean canReward = false;
  1139. +                                        String pIp = p.getClient().getConnection().getInetAddress().getHostAddress();
  1140. +                                        if (playerIps.containsKey(pIp))
  1141. +                                        {
  1142. +                                                int count = playerIps.get(pIp);
  1143. +                                                if (count < Config.TOPZONE_DUALBOXES_ALLOWED)
  1144. +                                                {
  1145. +                                                        playerIps.remove(pIp);
  1146. +                                                        playerIps.put(pIp, count+1);
  1147. +                                                        canReward = true;
  1148. +                                                }
  1149. +                                        }
  1150. +                                        else
  1151. +                                        {
  1152. +                                                canReward = true;
  1153. +                                                playerIps.put(pIp, 1);
  1154. +                                        }
  1155. +                                        if (canReward)
  1156. +                                        {
  1157. +                                                for (int i : Config.TOPZONE_BIG_REWARD.keySet())
  1158. +                                                {
  1159. +                                                        p.addItem("Vote reward.", i, Config.TOPZONE_BIG_REWARD.get(i), p, true);
  1160. +                                                }
  1161. +                                        }
  1162. +                                        else
  1163. +                                        {
  1164. +                                                p.sendMessage("Already "+Config.TOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded.");
  1165. +                                        }
  1166. +                                }
  1167. +                                playerIps.clear();
  1168. +                        }
  1169. +                        else
  1170. +                        {
  1171. +                                Announcements.getInstance();
  1172. +                               Announcements.announceToAll("Everyone has been rewarded with small reward.");
  1173. +                                Announcements.getInstance();
  1174. +                               Announcements.announceToAll("Topzone's vote count is "+currentVotes+".");
  1175. +                                Announcements.getInstance();
  1176. +                               Announcements.announceToAll("We need "+(firstPageVotes-currentVotes)+" vote(s) for big reward.");
  1177. +                                for (L2PcInstance p : pls)
  1178. +                                {
  1179. +                                        boolean canReward = false;
  1180. +                                        String pIp = p.getClient().getConnection().getInetAddress().getHostAddress();
  1181. +                                        if (playerIps.containsKey(pIp))
  1182. +                                        {
  1183. +                                                int count = playerIps.get(pIp);
  1184. +                                                if (count < Config.TOPZONE_DUALBOXES_ALLOWED)
  1185. +                                                {
  1186. +                                                        playerIps.remove(pIp);
  1187. +                                                        playerIps.put(pIp, count+1);
  1188. +                                                        canReward = true;
  1189. +                                                }
  1190. +                                        }
  1191. +                                        else
  1192. +                                        {
  1193. +                                                canReward = true;
  1194. +                                                playerIps.put(pIp, 1);
  1195. +                                        }
  1196. +                                        if (canReward)
  1197. +                                        {
  1198. +                                                for (int i : Config.TOPZONE_SMALL_REWARD.keySet())
  1199. +                                                {
  1200. +                                                        p.addItem("Vote reward.", i, Config.TOPZONE_SMALL_REWARD.get(i), p, true);
  1201. +                                                }
  1202. +                                        }
  1203. +                                        else
  1204. +                                        {
  1205. +                                                p.sendMessage("Already "+Config.TOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded.");
  1206. +                                        }
  1207. +                                }
  1208. +                                playerIps.clear();
  1209. +                        }
  1210. +                      
  1211. +                        lastVotes = currentVotes;
  1212. +                }
  1213. +                else
  1214. +                {
  1215. +                        if (firstPageVotes-currentVotes <= 0)
  1216. +                        {
  1217. +                                Announcements.getInstance();
  1218. +                               Announcements.announceToAll("Topzone's vote count is "+currentVotes+".");
  1219. +                                Announcements.getInstance();
  1220. +                               Announcements.announceToAll("We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for big reward.");
  1221. +                        }
  1222. +                        else
  1223. +                        {
  1224. +                                Announcements.getInstance();
  1225. +                               Announcements.announceToAll("Topzone's vote count is "+currentVotes+".");
  1226. +                                Announcements.getInstance();
  1227. +                               Announcements.announceToAll("We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for small reward.");
  1228. +                                Announcements.getInstance();
  1229. +                               Announcements.announceToAll("We need "+(firstPageVotes-currentVotes)+" vote(s) for big reward.");
  1230. +                        }
  1231. +                }
  1232. +        }
  1233. +      
  1234. +        private static int getFirstPageRankVotes()
  1235. +        {
  1236. +                InputStreamReader isr = null;
  1237. +                BufferedReader br = null;
  1238. +              
  1239. +                try
  1240. +                {
  1241. +                        URLConnection con = new URL(page1Url).openConnection();
  1242. +                        con.addRequestProperty("User-Agent", "Mozilla/4.76");
  1243. +                        isr = new InputStreamReader(con.getInputStream());
  1244. +                        br = new BufferedReader(isr);
  1245. +                      
  1246. +                        String line;
  1247. +                        int i = 0;
  1248. +                        while ((line = br.readLine()) != null)
  1249. +                        {
  1250. +                                if (line.contains("<td><div align=\"center\">"+firstPageRankNeeded+"</div></td>"))
  1251. +                                {
  1252. +                                        i++;
  1253. +                                }
  1254. +                                if (line.contains("<td><div align=\"center\">") && i == 1)
  1255. +                                {
  1256. +                                        i++;
  1257. +                                }
  1258. +                                if (line.contains("<td><div align=\"center\">") && i == 2)
  1259. +                                {
  1260. +                                        i = 0;
  1261. +                                        int votes = Integer.valueOf(line.split(">")[2].replace("</div", ""));
  1262. +                                        return votes;
  1263. +                                }
  1264. +                        }
  1265. +                      
  1266. +                        br.close();
  1267. +                        isr.close();
  1268. +                }
  1269. +                catch (Exception e)
  1270. +                {
  1271. +                        System.out.println(e);
  1272. +                        System.out.println("Error while getting server vote count.");
  1273. +                }
  1274. +              
  1275. +                return -1;
  1276. +        }
  1277. +      
  1278. +        private static int getVotes()
  1279. +        {
  1280. +                InputStreamReader isr = null;
  1281. +                BufferedReader br = null;
  1282. +              
  1283. +                try
  1284. +                {
  1285. +                        URLConnection con = new URL(topzoneUrl).openConnection();
  1286. +                        con.addRequestProperty("User-Agent", "Mozilla/4.76");
  1287. +                        isr = new InputStreamReader(con.getInputStream());
  1288. +                        br = new BufferedReader(isr);
  1289. +                      
  1290. +                        boolean got = false;
  1291. +                      
  1292. +                        String line;
  1293. +                        while ((line = br.readLine()) != null)
  1294. +                        {
  1295. +                                if (line.contains("<tr><td><div align=\"center\"><b><font style=\"font-size:14px;color:#018BC1;\"") && !got)
  1296. +                                {
  1297. +                                        got = true;
  1298. +                                        int votes = Integer.valueOf(line.split("=\"font-size:14px;color:#018BC1;\">")[1].replace("</font></b></div></td></tr>", ""));
  1299. +                                        return votes;
  1300. +                                }
  1301. +                        }
  1302. +                      
  1303. +                        br.close();
  1304. +                        isr.close();
  1305. +                }
  1306. +                catch (Exception e)
  1307. +                {
  1308. +                        System.out.println(e);
  1309. +                        System.out.println("Error while getting server vote count.");
  1310. +                }
  1311. +              
  1312. +                return -1;
  1313. +        }
  1314. +}
  1315. \ No newline at end of file
  1316. Index: java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java
  1317. ===================================================================
  1318. --- java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java    (revision 4)
  1319. +++ java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java    (working copy)
  1320. @@ -23,6 +23,7 @@
  1321.  import net.sf.l2j.gameserver.model.BlockList;
  1322.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1323.  import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
  1324. +import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
  1325.  
  1326.  /**
  1327.   * A chat handler
  1328. @@ -87,6 +88,34 @@
  1329.             }
  1330.            
  1331.             activeChar.sendPacket(cs);
  1332. +          
  1333. +           if (Config.ALLOW_SOCIAL_ACTIONS)
  1334. +           {
  1335. +               if (text.equalsIgnoreCase("lol") && !activeChar.isAttackingNow() && !activeChar.isRunning() && !activeChar.isCastingNow())
  1336. +               {
  1337. +                   activeChar.broadcastPacket(new SocialAction(activeChar, 10));
  1338. +               }
  1339. +              
  1340. +               if (text.equalsIgnoreCase("hi") && !activeChar.isAttackingNow() && !activeChar.isRunning() && !activeChar.isCastingNow())
  1341. +               {
  1342. +                   activeChar.broadcastPacket(new SocialAction(activeChar, 2));
  1343. +               }
  1344. +              
  1345. +               if (text.equalsIgnoreCase("haha") && !activeChar.isAttackingNow() && !activeChar.isRunning() && !activeChar.isCastingNow())
  1346. +               {
  1347. +                   activeChar.broadcastPacket(new SocialAction(activeChar, 10));
  1348. +               }
  1349. +              
  1350. +               if (text.equalsIgnoreCase("yes") && !activeChar.isAttackingNow() && !activeChar.isRunning() && !activeChar.isCastingNow())
  1351. +               {
  1352. +                   activeChar.broadcastPacket(new SocialAction(activeChar, 6));
  1353. +               }
  1354. +              
  1355. +               if (text.equalsIgnoreCase("no") && !activeChar.isAttackingNow() && !activeChar.isRunning() && !activeChar.isCastingNow())
  1356. +               {
  1357. +                   activeChar.broadcastPacket(new SocialAction(activeChar, 5));
  1358. +               }
  1359. +           }
  1360.         }
  1361.     }
  1362.    
  1363. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
  1364. ===================================================================
  1365. --- java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java    (revision 3)
  1366. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java    (working copy)
  1367. @@ -70,6 +70,12 @@
  1368.     @Override
  1369.     public void onBypassFeedback(L2PcInstance player, String command)
  1370.     {
  1371. +       if (player.isAio() && !Config.ALLOW_AIO_USE_CLASS_MASTER)
  1372. +       {
  1373. +           player.sendMessage("AIO players are not allowed to use the class masters.");
  1374. +           return;
  1375. +       }
  1376. +      
  1377.         String[] commandStr = command.split(" ");
  1378.         String actualCommand = commandStr[0];
  1379.        
  1380. Index: java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java
  1381. ===================================================================
  1382. --- java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java   (revision 12)
  1383. +++ java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java   (working copy)
  1384. @@ -172,8 +172,29 @@
  1385.         L2PcTemplate template = newChar.getTemplate();
  1386.        
  1387.         newChar.addAdena("Init", Config.STARTING_ADENA, null, false);
  1388. -       newChar.setXYZInvisible(template.spawnX, template.spawnY, template.spawnZ);
  1389. -       newChar.setTitle("");
  1390. +       if (!Config.ALLOW_CUSTOM_SPAWN_LOCATION)
  1391. +       {
  1392. +           newChar.setXYZInvisible(template.spawnX, template.spawnY, template.spawnZ);
  1393. +       }
  1394. +       else
  1395. +       {
  1396. +           newChar.setXYZInvisible(Config.CUSTOM_SPAWN_LOCATION[0], Config.CUSTOM_SPAWN_LOCATION[1], Config.CUSTOM_SPAWN_LOCATION[2]);
  1397. +       }
  1398. +       if (!Config.PVP_PK_TITLE)
  1399. +       {
  1400. +           if (!Config.ALLOW_NEW_CHAR_TITLE)
  1401. +           {
  1402. +               newChar.setTitle("");
  1403. +           }
  1404. +           else
  1405. +           {
  1406. +               newChar.setTitle(Config.NEW_CHAR_TITLE);
  1407. +           }
  1408. +       }
  1409. +       else
  1410. +       {
  1411. +           newChar.customEditTitle(Config.PVP_TITLE_PREFIX+" "+newChar.getPvpKills()+" | "+Config.PK_TITLE_PREFIX+" "+newChar.getPkKills());
  1412. +       }
  1413.        
  1414.         newChar.registerShortCut(new L2ShortCut(0, 0, 3, 2, -1, 1)); // attack shortcut
  1415.         newChar.registerShortCut(new L2ShortCut(3, 0, 3, 5, -1, 1)); // take shortcut
  1416. Index: java/net/sf/l2j/gameserver/Shutdown.java
  1417. ===================================================================
  1418. --- java/net/sf/l2j/gameserver/Shutdown.java    (revision 3)
  1419. +++ java/net/sf/l2j/gameserver/Shutdown.java    (working copy)
  1420. @@ -20,6 +20,7 @@
  1421.  
  1422.  import net.sf.l2j.Config;
  1423.  import net.sf.l2j.L2DatabaseFactory;
  1424. +import net.sf.l2j.gameserver.datatables.OfflineTradersTable;
  1425.  import net.sf.l2j.gameserver.instancemanager.CastleManorManager;
  1426.  import net.sf.l2j.gameserver.instancemanager.FourSepulchersManager;
  1427.  import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
  1428. @@ -113,6 +114,16 @@
  1429.     {
  1430.         if (this == SingletonHolder._instance)
  1431.         {
  1432. +           try
  1433. +           {
  1434. +               if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
  1435. +                   OfflineTradersTable.storeOffliners();
  1436. +           }
  1437. +           catch (Throwable t)
  1438. +           {
  1439. +               _log.log(Level.WARNING, "Error saving offline shops.",t);
  1440. +           }
  1441. +          
  1442.             Util.printSection("Under " + MODE_TEXT[_shutdownMode] + " process");
  1443.            
  1444.             // disconnect players
  1445. Index: java/net/sf/l2j/Config.java
  1446. ===================================================================
  1447. --- java/net/sf/l2j/Config.java (revision 20)
  1448. +++ java/net/sf/l2j/Config.java (working copy)
  1449. @@ -33,6 +33,7 @@
  1450.  import java.util.Vector;
  1451.  import java.util.logging.Logger;
  1452.  
  1453. +import net.sf.l2j.gameserver.templates.item.L2Item;
  1454.  import net.sf.l2j.gameserver.util.FloodProtectorConfig;
  1455.  import net.sf.l2j.util.StringUtil;
  1456.  
  1457. @@ -60,6 +61,7 @@
  1458.     public static final String SERVER_FILE = "./config/server.properties";
  1459.     public static final String SIEGE_FILE = "./config/siege.properties";
  1460.     public static final String L2SERESIN_FILE = "./config/l2seresin.properties";
  1461. +   public static final String CUSTOM_FILE = "./config/custom.properties";
  1462.    
  1463.     /**
  1464.      * -------------------------------------------------- // Variable Definitions //-------------------------------------------------
  1465. @@ -721,6 +723,87 @@
  1466.     public static int CLIENT_PACKET_QUEUE_MAX_UNKNOWN_PER_MIN = 5; // default 5
  1467.    
  1468.     // --------------------------------------------------
  1469. +   // Custom settings
  1470. +   // --------------------------------------------------
  1471. +   public static boolean ALLOW_OLY_GRADE_RESTR;
  1472. +   public static int ARMOR_GRADE_RESTR;
  1473. +   public static int WEAPON_GRADE_RESTR;
  1474. +   public static int MAX_ENCHANT_RESTR;
  1475. +    public static boolean ALLOW_KILLING_SPREE;
  1476. +    public static Map<Integer, String> KILLING_SPREE_REWARD = new HashMap<>();
  1477. +    public static boolean PVP_PK_TITLE;
  1478. +    public static String PVP_TITLE_PREFIX;
  1479. +    public static String PK_TITLE_PREFIX;
  1480. +    public static boolean ANNOUNCE_HERO_ON_ENTER;
  1481. +    public static boolean ANNOUNCE_CASTLE_LORDS;
  1482. +    public static boolean WAR_LEGEND_AURA;
  1483. +   public static int KILLS_TO_GET_WAR_LEGEND_AURA;
  1484. +   public static boolean OFFLINE_TRADE_ENABLE;
  1485. +   public static boolean OFFLINE_CRAFT_ENABLE;
  1486. +   public static boolean RESTORE_OFFLINERS;
  1487. +   public static int OFFLINE_MAX_DAYS;
  1488. +   public static boolean OFFLINE_DISCONNECT_FINISHED;
  1489. +   public static boolean OFFLINE_SET_NAME_COLOR;
  1490. +   public static int OFFLINE_NAME_COLOR;
  1491. +   public static boolean OFFLINE_FAME;
  1492. +   public static boolean ALLOW_PVP_NAME_COLOR_SYSTEM;
  1493. +   public static Map<Integer, Integer> PVP_COLORS = new HashMap<>();
  1494. +   public static boolean ALLOW_PK_TITLE_COLOR_SYSTEM;
  1495. +   public static Map<Integer, Integer> PK_COLORS = new HashMap<>();
  1496. +   public static boolean ALLOW_CUSTOM_SPAWN_LOCATION;
  1497. +   public static int[] CUSTOM_SPAWN_LOCATION = new int[3];
  1498. +   public static boolean ALLOW_SOCIAL_ACTIONS;
  1499. +   public static boolean ALLOW_BOSS_PETRIFY;
  1500. +   public static boolean ALLOW_NEW_CHAR_TITLE;
  1501. +   public static String NEW_CHAR_TITLE;
  1502. +    public static boolean ALLOW_HOPZONE_VOTE_REWARD;
  1503. +    public static String HOPZONE_SERVER_LINK;
  1504. +    public static String HOPZONE_FIRST_PAGE_LINK;
  1505. +    public static int HOPZONE_VOTES_DIFFERENCE;
  1506. +    public static int HOPZONE_FIRST_PAGE_RANK_NEEDED;
  1507. +    public static int HOPZONE_REWARD_CHECK_TIME;
  1508. +   public static Map<Integer, Integer> HOPZONE_SMALL_REWARD = new HashMap<>();
  1509. +   public static Map<Integer, Integer> HOPZONE_BIG_REWARD = new HashMap<>();
  1510. +   public static int HOPZONE_DUALBOXES_ALLOWED;
  1511. +    public static boolean ALLOW_TOPZONE_VOTE_REWARD;
  1512. +    public static String TOPZONE_SERVER_LINK;
  1513. +    public static String TOPZONE_FIRST_PAGE_LINK;
  1514. +    public static int TOPZONE_VOTES_DIFFERENCE;
  1515. +    public static int TOPZONE_FIRST_PAGE_RANK_NEEDED;
  1516. +    public static int TOPZONE_REWARD_CHECK_TIME;
  1517. +   public static Map<Integer, Integer> TOPZONE_SMALL_REWARD = new HashMap<>();
  1518. +   public static Map<Integer, Integer> TOPZONE_BIG_REWARD = new HashMap<>();
  1519. +   public static int TOPZONE_DUALBOXES_ALLOWED;
  1520. +    public static boolean ENABLE_AIO_SYSTEM;
  1521. +    public static boolean ALLOW_AIO_NAME_COLOR;
  1522. +   public static int AIO_NAME_COLOR;
  1523. +    public static boolean ALLOW_AIO_TITLE_COLOR;
  1524. +   public static int AIO_TITLE_COLOR;
  1525. +   public static Map<Integer, Integer> AIO_SKILLS = new HashMap<>();
  1526. +    public static boolean ALLOW_AIO_USE_GK;
  1527. +    public static boolean ALLOW_AIO_USE_CLASS_MASTER;
  1528. +    public static boolean VIP_COLOR_ENABLED;
  1529. +   public static int VIP_COLOR_NAME;
  1530. +   public static int VIP_COLOR_TITLE;
  1531. +   public static float VIP_XP_SP_RATE;
  1532. +   public static float VIP_ADENA_RATE;
  1533. +   public static float VIP_DROP_RATE;
  1534. +   public static float VIP_SPOIL_RATE;
  1535. +   public static boolean ANTI_FARM_ENALBED;
  1536. +   public static boolean ANTI_FARM_PARTY;
  1537. +   public static boolean ANTI_FARM_IP;
  1538. +   public static boolean ANTI_FARM_CLAN_ALLY;
  1539. +   public static boolean ANTI_FARM_LVL_DIFF;
  1540. +   public static int ANTI_FARM_MAX_LVL_DIFF;
  1541. +   public static boolean ANTI_FARM_PDEF_DIFF;
  1542. +   public static int ANTI_FARM_MAX_PDEF_DIFF;
  1543. +   public static boolean ANTI_FARM_PATK_DIFF;
  1544. +   public static int ANTI_FARM_MAX_PATK_DIFF;
  1545. +    public static boolean ANTI_FARM_SUMMON;
  1546. +    public static boolean ANNOUNCE_TO_ALL_SPAWN_RB;
  1547. +    public static boolean ALLOW_TITLE_PANEL;
  1548. +  
  1549. +   // --------------------------------------------------
  1550.    
  1551.     /**
  1552.      * This class initializes all global variables for configuration.<br>
  1553. @@ -747,6 +830,216 @@
  1554.             // L2Seresin settings
  1555.             try
  1556.             {
  1557. +               Properties custom = new Properties();
  1558. +               InputStream is = new FileInputStream(new File(CUSTOM_FILE));
  1559. +               custom.load(is);
  1560. +               is.close();
  1561. +              
  1562. +               ALLOW_OLY_GRADE_RESTR = Boolean.parseBoolean(custom.getProperty("AllowOlyGradeRestr", "false"));
  1563. +               String temp = custom.getProperty("ArmorGradeRestr", "S");
  1564. +               switch (temp)
  1565. +               {
  1566. +                   case "D":
  1567. +                   {
  1568. +                       ARMOR_GRADE_RESTR = L2Item.CRYSTAL_D;
  1569. +                       break;
  1570. +                   }
  1571. +                   case "C":
  1572. +                   {
  1573. +                       ARMOR_GRADE_RESTR = L2Item.CRYSTAL_C;
  1574. +                       break;
  1575. +                   }
  1576. +                   case "B":
  1577. +                   {
  1578. +                       ARMOR_GRADE_RESTR = L2Item.CRYSTAL_B;
  1579. +                       break;
  1580. +                   }
  1581. +                   case "A":
  1582. +                   {
  1583. +                       ARMOR_GRADE_RESTR = L2Item.CRYSTAL_A;
  1584. +                       break;
  1585. +                   }
  1586. +                   case "S":
  1587. +                   {
  1588. +                       ARMOR_GRADE_RESTR = L2Item.CRYSTAL_S;
  1589. +                       break;
  1590. +                   }
  1591. +                   default:
  1592. +                   {
  1593. +                       ARMOR_GRADE_RESTR = L2Item.CRYSTAL_S;
  1594. +                       break;
  1595. +                   }
  1596. +               }
  1597. +               temp = custom.getProperty("WeaponGradeRestr", "S");
  1598. +               switch (temp)
  1599. +               {
  1600. +                   case "D":
  1601. +                   {
  1602. +                       WEAPON_GRADE_RESTR = L2Item.CRYSTAL_D;
  1603. +                       break;
  1604. +                   }
  1605. +                   case "C":
  1606. +                   {
  1607. +                       WEAPON_GRADE_RESTR = L2Item.CRYSTAL_C;
  1608. +                       break;
  1609. +                   }
  1610. +                   case "B":
  1611. +                   {
  1612. +                       WEAPON_GRADE_RESTR = L2Item.CRYSTAL_B;
  1613. +                       break;
  1614. +                   }
  1615. +                   case "A":
  1616. +                   {
  1617. +                       WEAPON_GRADE_RESTR = L2Item.CRYSTAL_A;
  1618. +                       break;
  1619. +                   }
  1620. +                   case "S":
  1621. +                   {
  1622. +                       WEAPON_GRADE_RESTR = L2Item.CRYSTAL_S;
  1623. +                       break;
  1624. +                   }
  1625. +                   default:
  1626. +                   {
  1627. +                       WEAPON_GRADE_RESTR = L2Item.CRYSTAL_S;
  1628. +                       break;
  1629. +                   }
  1630. +               }
  1631. +               MAX_ENCHANT_RESTR = Integer.parseInt(custom.getProperty("MaxEnchantRestr", "65535"));
  1632. +               ALLOW_KILLING_SPREE = Boolean.parseBoolean(custom.getProperty("AllowKillingSpree", "false"));
  1633. +               String killing_spree_reward = custom.getProperty("KillingSpreeReward", "3,is on a killing spree!;6,is on a rampage!;9,is on a monster kill!;");
  1634. +               String killing_spree_reward_splitted_1[] = killing_spree_reward.split(";");
  1635. +               for (String s : killing_spree_reward_splitted_1)
  1636. +               {
  1637. +                   String killing_spree_reward_splitted_2[] = s.split(",");
  1638. +                   KILLING_SPREE_REWARD.put(Integer.parseInt(killing_spree_reward_splitted_2[0]), killing_spree_reward_splitted_2[1]);
  1639. +               }
  1640. +               PVP_PK_TITLE = Boolean.parseBoolean(custom.getProperty("PvpPkTitle", "false"));
  1641. +               PVP_TITLE_PREFIX = custom.getProperty("PvPTitlePrefix", "");
  1642. +               PK_TITLE_PREFIX = custom.getProperty("PkTitlePrefix", "");
  1643. +               ANNOUNCE_HERO_ON_ENTER = Boolean.parseBoolean(custom.getProperty("AnnounceHeroOnEnter", "false"));
  1644. +               ANNOUNCE_CASTLE_LORDS = Boolean.parseBoolean(custom.getProperty("AnnounceCastleLords", "false"));
  1645. +               WAR_LEGEND_AURA = Boolean.parseBoolean(custom.getProperty("WarLegendAura", "false"));
  1646. +               KILLS_TO_GET_WAR_LEGEND_AURA = Integer.parseInt(custom.getProperty("KillsToGetWarLegendAura", "10"));
  1647. +               OFFLINE_TRADE_ENABLE = Boolean.parseBoolean(custom.getProperty("OfflineTradeEnable", "false"));
  1648. +               OFFLINE_CRAFT_ENABLE = Boolean.parseBoolean(custom.getProperty("OfflineCraftEnable", "false"));
  1649. +               OFFLINE_SET_NAME_COLOR = Boolean.parseBoolean(custom.getProperty("OfflineSetNameColor", "false"));
  1650. +               OFFLINE_NAME_COLOR = Integer.decode("0x" + custom.getProperty("OfflineNameColor", "808080"));
  1651. +               OFFLINE_FAME = Boolean.parseBoolean(custom.getProperty("OfflineFame", "true"));
  1652. +               RESTORE_OFFLINERS = Boolean.parseBoolean(custom.getProperty("RestoreOffliners", "false"));
  1653. +               OFFLINE_MAX_DAYS = Integer.parseInt(custom.getProperty("OfflineMaxDays", "10"));
  1654. +               OFFLINE_DISCONNECT_FINISHED = Boolean.parseBoolean(custom.getProperty("OfflineDisconnectFinished", "true"));
  1655. +               ALLOW_PVP_NAME_COLOR_SYSTEM = Boolean.parseBoolean(custom.getProperty("AllowPvpNameColorSystem", "false"));
  1656. +               String pvp_colors = custom.getProperty("PvpColors", "100,FFFF00");
  1657. +               String pvp_colors_splitted_1[] = pvp_colors.split(";");
  1658. +               for (String s : pvp_colors_splitted_1)
  1659. +               {
  1660. +                   String pvp_colors_splitted_2[] = s.split(",");
  1661. +                   PVP_COLORS.put(Integer.parseInt(pvp_colors_splitted_2[0]), Integer.decode("0x"+pvp_colors_splitted_2[1]));
  1662. +               }
  1663. +               ALLOW_PK_TITLE_COLOR_SYSTEM = Boolean.parseBoolean(custom.getProperty("AllowPkTitleColorSystem", "false"));
  1664. +               String pk_colors = custom.getProperty("PkColors", "100,FFFF00");
  1665. +               String pk_colors_splitted_1[] = pk_colors.split(";");
  1666. +               for (String s : pk_colors_splitted_1)
  1667. +               {
  1668. +                   String pk_colors_splitted_2[] = s.split(",");
  1669. +                   PK_COLORS.put(Integer.parseInt(pk_colors_splitted_2[0]), Integer.decode("0x"+pk_colors_splitted_2[1]));
  1670. +               }
  1671. +               ALLOW_CUSTOM_SPAWN_LOCATION = Boolean.parseBoolean(custom.getProperty("AllowCustomSpawnLocation", "false"));
  1672. +               String custom_spawn_location = custom.getProperty("CustomSpawnLocation", "113852,-108766,-851");
  1673. +               String custom_spawn_location_splitted[] = custom_spawn_location.split(",");
  1674. +               CUSTOM_SPAWN_LOCATION[0] = Integer.parseInt(custom_spawn_location_splitted[0]);
  1675. +               CUSTOM_SPAWN_LOCATION[1] = Integer.parseInt(custom_spawn_location_splitted[1]);
  1676. +               CUSTOM_SPAWN_LOCATION[2] = Integer.parseInt(custom_spawn_location_splitted[2]);
  1677. +               ALLOW_SOCIAL_ACTIONS = Boolean.parseBoolean(custom.getProperty("AllowSocialActions", "false"));
  1678. +               ALLOW_BOSS_PETRIFY = Boolean.parseBoolean(custom.getProperty("AllowBossPetrify", "false"));
  1679. +               ALLOW_NEW_CHAR_TITLE = Boolean.parseBoolean(custom.getProperty("AllowNewCharTitle", "false"));
  1680. +               NEW_CHAR_TITLE = custom.getProperty("NewCharTitle", "L2 Mendrion");
  1681. +                ALLOW_HOPZONE_VOTE_REWARD = Boolean.parseBoolean(custom.getProperty("AllowHopzoneVoteReward", "false"));
  1682. +                HOPZONE_SERVER_LINK = custom.getProperty("HopzoneServerLink", "http://l2.hopzone.net/lineage2/details/74078/L2World-Servers/");
  1683. +                HOPZONE_FIRST_PAGE_LINK = custom.getProperty("HopzoneFirstPageLink", "http://l2.hopzone.net/lineage2/");
  1684. +                HOPZONE_VOTES_DIFFERENCE = Integer.parseInt(custom.getProperty("HopzoneVotesDifference", "5"));
  1685. +                   HOPZONE_FIRST_PAGE_RANK_NEEDED = Integer.parseInt(custom.getProperty("HopzoneFirstPageRankNeeded", "15"));
  1686. +                   HOPZONE_REWARD_CHECK_TIME = Integer.parseInt(custom.getProperty("HopzoneRewardCheckTime", "5"));
  1687. +                String HOPZONE_SMALL_REWARD_VALUE = custom.getProperty("HopzoneSmallReward", "57,100000000;");
  1688. +                String[] hopzone_small_reward_splitted_1 = HOPZONE_SMALL_REWARD_VALUE.split(";");
  1689. +                for (String i : hopzone_small_reward_splitted_1)
  1690. +                {
  1691. +                   String[] hopzone_small_reward_splitted_2 = i.split(",");
  1692. +                   HOPZONE_SMALL_REWARD.put(Integer.parseInt(hopzone_small_reward_splitted_2[0]), Integer.parseInt(hopzone_small_reward_splitted_2[1]));
  1693. +                }
  1694. +                String HOPZONE_BIG_REWARD_VALUE = custom.getProperty("HopzoneBigReward", "3470,1;");
  1695. +                String[] hopzone_big_reward_splitted_1 = HOPZONE_BIG_REWARD_VALUE.split(";");
  1696. +                for (String i : hopzone_big_reward_splitted_1)
  1697. +                {
  1698. +                   String[] hopzone_big_reward_splitted_2 = i.split(",");
  1699. +                   HOPZONE_BIG_REWARD.put(Integer.parseInt(hopzone_big_reward_splitted_2[0]), Integer.parseInt(hopzone_big_reward_splitted_2[1]));
  1700. +                }
  1701. +                HOPZONE_DUALBOXES_ALLOWED = Integer.parseInt(custom.getProperty("HopzoneDualboxesAllowed", "1"));
  1702. +                ALLOW_TOPZONE_VOTE_REWARD = Boolean.parseBoolean(custom.getProperty("AllowTopzoneVoteReward", "false"));
  1703. +                TOPZONE_SERVER_LINK = custom.getProperty("TopzoneServerLink", "http://l2.topzone.net/lineage2/details/74078/L2World-Servers/");
  1704. +                TOPZONE_FIRST_PAGE_LINK = custom.getProperty("TopzoneFirstPageLink", "http://l2.topzone.net/lineage2/");
  1705. +                TOPZONE_VOTES_DIFFERENCE = Integer.parseInt(custom.getProperty("TopzoneVotesDifference", "5"));
  1706. +                   TOPZONE_FIRST_PAGE_RANK_NEEDED = Integer.parseInt(custom.getProperty("TopzoneFirstPageRankNeeded", "15"));
  1707. +                   TOPZONE_REWARD_CHECK_TIME = Integer.parseInt(custom.getProperty("TopzoneRewardCheckTime", "5"));
  1708. +                String TOPZONE_SMALL_REWARD_VALUE = custom.getProperty("TopzoneSmallReward", "57,100000000;");
  1709. +                String[] topzone_small_reward_splitted_1 = TOPZONE_SMALL_REWARD_VALUE.split(";");
  1710. +                for (String i : topzone_small_reward_splitted_1)
  1711. +                {
  1712. +                   String[] topzone_small_reward_splitted_2 = i.split(",");
  1713. +                   TOPZONE_SMALL_REWARD.put(Integer.parseInt(topzone_small_reward_splitted_2[0]), Integer.parseInt(topzone_small_reward_splitted_2[1]));
  1714. +                }
  1715. +                String TOPZONE_BIG_REWARD_VALUE = custom.getProperty("TopzoneBigReward", "3470,1;");
  1716. +                String[] topzone_big_reward_splitted_1 = TOPZONE_BIG_REWARD_VALUE.split(";");
  1717. +                for (String i : topzone_big_reward_splitted_1)
  1718. +                {
  1719. +                   String[] topzone_big_reward_splitted_2 = i.split(",");
  1720. +                   TOPZONE_BIG_REWARD.put(Integer.parseInt(topzone_big_reward_splitted_2[0]), Integer.parseInt(topzone_big_reward_splitted_2[1]));
  1721. +                }
  1722. +                TOPZONE_DUALBOXES_ALLOWED = Integer.parseInt(custom.getProperty("TopzoneDualboxesAllowed", "1"));
  1723. +                ENABLE_AIO_SYSTEM = Boolean.parseBoolean(custom.getProperty("EnableAioSystem", "false"));
  1724. +                ALLOW_AIO_NAME_COLOR = Boolean.parseBoolean(custom.getProperty("AllowAioNameColor", "false"));
  1725. +               AIO_NAME_COLOR = Integer.decode("0x"+custom.getProperty("AioNameColor", "88AA88"));
  1726. +                ALLOW_AIO_TITLE_COLOR = Boolean.parseBoolean(custom.getProperty("AllowAioTitleColor", "false"));
  1727. +               AIO_TITLE_COLOR = Integer.decode("0x"+custom.getProperty("AioTitleColor", "88AA88"));
  1728. +               String aio_skills = custom.getProperty("AioSkills", "");
  1729. +               String[] aio_skills_splitted_1 = aio_skills.split(";");
  1730. +               for (String s : aio_skills_splitted_1)
  1731. +               {
  1732. +                   String[] aio_skills_splitted_2 = s.split(",");
  1733. +                   AIO_SKILLS.put(Integer.parseInt(aio_skills_splitted_2[0]), Integer.parseInt(aio_skills_splitted_2[1]));
  1734. +               }
  1735. +                ALLOW_AIO_USE_GK = Boolean.parseBoolean(custom.getProperty("AllowAioUseGk", "false"));
  1736. +                ALLOW_AIO_USE_CLASS_MASTER = Boolean.parseBoolean(custom.getProperty("AllowAioUseClassMaster", "false"));
  1737. +                VIP_COLOR_ENABLED = Boolean.parseBoolean(custom.getProperty("VIPColorEnabled", "false"));
  1738. +               VIP_COLOR_NAME = Integer.decode("0x"+custom.getProperty("VIPColorName", "FF33AA"));
  1739. +               VIP_COLOR_TITLE = Integer.decode("0x"+custom.getProperty("VIPColorTitle", "FFAA33"));
  1740. +               VIP_XP_SP_RATE = Float.parseFloat(custom.getProperty("VIPXpSpRate", "1.5"));
  1741. +               VIP_ADENA_RATE = Float.parseFloat(custom.getProperty("VIPAdenaRate", "1.5"));
  1742. +               VIP_DROP_RATE = Float.parseFloat(custom.getProperty("VIPDropRate", "1.5"));
  1743. +               VIP_SPOIL_RATE = Float.parseFloat(custom.getProperty("VIPSpoilRate", "1.5"));
  1744. +               ANTI_FARM_ENALBED = Boolean.parseBoolean(custom.getProperty("AntiFarmEnabled", "false"));
  1745. +               ANTI_FARM_PARTY = Boolean.parseBoolean(custom.getProperty("AntiFarmParty", "false"));
  1746. +               ANTI_FARM_IP = Boolean.parseBoolean(custom.getProperty("AntiFarmIP", "false"));
  1747. +               ANTI_FARM_CLAN_ALLY = Boolean.parseBoolean(custom.getProperty("AntiFarmClanAlly", "false"));
  1748. +               ANTI_FARM_LVL_DIFF = Boolean.parseBoolean(custom.getProperty("AntiFarmLvlDiff", "false"));
  1749. +               ANTI_FARM_MAX_LVL_DIFF = Integer.parseInt(custom.getProperty("AntiFarmMaxLvlDiff", "30"));
  1750. +               ANTI_FARM_PDEF_DIFF = Boolean.parseBoolean(custom.getProperty("AntiFarmPdefDiff", "false"));
  1751. +               ANTI_FARM_MAX_PDEF_DIFF = Integer.parseInt(custom.getProperty("AntiFarmMaxPdefDiff", "300"));
  1752. +               ANTI_FARM_PATK_DIFF = Boolean.parseBoolean(custom.getProperty("AntiFarmPatkDiff", "false"));
  1753. +               ANTI_FARM_MAX_PATK_DIFF = Integer.parseInt(custom.getProperty("AntiFarmMaxPatkDiff", "300"));
  1754. +                ANTI_FARM_SUMMON = Boolean.parseBoolean(custom.getProperty("AntiFarmSummon", "false"));
  1755. +                ANNOUNCE_TO_ALL_SPAWN_RB = Boolean.parseBoolean(custom.getProperty("AnnounceToAllSpawnRb", "false"));
  1756. +                ALLOW_TITLE_PANEL = Boolean.parseBoolean(custom.getProperty("AnnounceToAllSpawnRb", "false"));
  1757. +           }
  1758. +           catch (Exception e)
  1759. +           {
  1760. +               e.printStackTrace();
  1761. +               throw new Error("Server failed to load " + CUSTOM_FILE + " file.");
  1762. +           }
  1763. +          
  1764. +           // L2Seresin settings
  1765. +           try
  1766. +           {
  1767.                 Properties l2seresin = new Properties();
  1768.                 InputStream is = new FileInputStream(new File(L2SERESIN_FILE));
  1769.                 l2seresin.load(is);
  1770. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  1771. ===================================================================
  1772. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (revision 20)
  1773. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
  1774. @@ -37,6 +37,7 @@
  1775.  
  1776.  import net.sf.l2j.Config;
  1777.  import net.sf.l2j.L2DatabaseFactory;
  1778. +import net.sf.l2j.gameserver.Announcements;
  1779.  import net.sf.l2j.gameserver.GameTimeController;
  1780.  import net.sf.l2j.gameserver.GeoData;
  1781.  import net.sf.l2j.gameserver.ItemsAutoDestroy;
  1782. @@ -234,6 +235,162 @@
  1783.   */
  1784.  public final class L2PcInstance extends L2Playable
  1785.  {
  1786. +   public boolean choseNormalTitle = false;
  1787. +  
  1788. +   public void checkAioVipColors()
  1789. +   {
  1790. +       if (isVip())
  1791. +       {
  1792. +           if (Config.VIP_COLOR_ENABLED)
  1793. +           {
  1794. +               getAppearance().setNameColor(Config.VIP_COLOR_NAME);
  1795. +               getAppearance().setTitleColor(Config.VIP_COLOR_TITLE);
  1796. +               broadcastUserInfo();
  1797. +           }
  1798. +       }
  1799. +       else
  1800. +       {
  1801. +           if (Config.VIP_COLOR_ENABLED)
  1802. +           {
  1803. +               getAppearance().setNameColor(0xFFFFFF);
  1804. +               getAppearance().setTitleColor(0xFFFFFF);
  1805. +               broadcastUserInfo();
  1806. +           }
  1807. +       }
  1808. +      
  1809. +       if (isAio())
  1810. +       {
  1811. +           if (Config.ALLOW_AIO_NAME_COLOR)
  1812. +           {
  1813. +               getAppearance().setNameColor(Config.AIO_NAME_COLOR);
  1814. +               broadcastUserInfo();
  1815. +           }
  1816. +          
  1817. +           if (Config.ALLOW_AIO_TITLE_COLOR)
  1818. +           {
  1819. +               getAppearance().setTitleColor(Config.AIO_TITLE_COLOR);
  1820. +               broadcastUserInfo();
  1821. +           }
  1822. +       }
  1823. +       else
  1824. +       {
  1825. +           if (Config.ALLOW_AIO_NAME_COLOR)
  1826. +           {
  1827. +               getAppearance().setNameColor(0xFFFFFF);
  1828. +               broadcastUserInfo();
  1829. +           }
  1830. +          
  1831. +           if (Config.ALLOW_AIO_TITLE_COLOR)
  1832. +           {
  1833. +               getAppearance().setTitleColor(0xFFFFFF);
  1834. +               broadcastUserInfo();
  1835. +           }
  1836. +       }
  1837. +   }
  1838. +  
  1839. +   private boolean _vip = false;
  1840. +  
  1841. +   public void setVip(boolean val)
  1842. +   {
  1843. +       if (val)
  1844. +       {
  1845. +           if (Config.VIP_COLOR_ENABLED)
  1846. +           {
  1847. +               getAppearance().setNameColor(Config.VIP_COLOR_NAME);
  1848. +               getAppearance().setTitleColor(Config.VIP_COLOR_TITLE);
  1849. +               broadcastUserInfo();
  1850. +           }
  1851. +          
  1852. +           sendMessage("You are now a VIP.");
  1853. +       }
  1854. +       else
  1855. +       {
  1856. +           if (Config.VIP_COLOR_ENABLED)
  1857. +           {
  1858. +               getAppearance().setNameColor(0xFFFFFF);
  1859. +               getAppearance().setTitleColor(0xFFFFFF);
  1860. +               broadcastUserInfo();
  1861. +           }
  1862. +          
  1863. +           sendMessage("You are no longer a VIP.");
  1864. +       }
  1865. +      
  1866. +       _vip = val;
  1867. +   }
  1868. +  
  1869. +   public boolean isVip()
  1870. +   {
  1871. +       return _vip;
  1872. +   }
  1873. +  
  1874. +   private boolean _aio = false;
  1875. +  
  1876. +   public void setAio(boolean val)
  1877. +   {
  1878. +       if (val)
  1879. +       {
  1880. +           if (Config.ALLOW_AIO_NAME_COLOR)
  1881. +           {
  1882. +               getAppearance().setNameColor(Config.AIO_NAME_COLOR);
  1883. +               broadcastUserInfo();
  1884. +           }
  1885. +          
  1886. +           if (Config.ALLOW_AIO_TITLE_COLOR)
  1887. +           {
  1888. +               getAppearance().setTitleColor(Config.AIO_TITLE_COLOR);
  1889. +               broadcastUserInfo();
  1890. +           }
  1891. +          
  1892. +           for (int i : Config.AIO_SKILLS.keySet())
  1893. +           {
  1894. +               addSkill(SkillTable.getInstance().getInfo(i, Config.AIO_SKILLS.get(i)), true);
  1895. +           }
  1896. +          
  1897. +           sendMessage("You are now an AIO.");
  1898. +       }
  1899. +       else
  1900. +       {
  1901. +           if (Config.ALLOW_AIO_NAME_COLOR)
  1902. +           {
  1903. +               getAppearance().setNameColor(0xFFFFFF);
  1904. +               broadcastUserInfo();
  1905. +           }
  1906. +          
  1907. +           if (Config.ALLOW_AIO_TITLE_COLOR)
  1908. +           {
  1909. +               getAppearance().setTitleColor(0xFFFFFF);
  1910. +               broadcastUserInfo();
  1911. +           }
  1912. +          
  1913. +           for (int i : Config.AIO_SKILLS.keySet())
  1914. +           {
  1915. +               removeSkill(SkillTable.getInstance().getInfo(i, Config.AIO_SKILLS.get(i)), true);
  1916. +           }
  1917. +          
  1918. +           sendMessage("You are no longer an AIO.");
  1919. +       }
  1920. +      
  1921. +       _aio = val;
  1922. +   }
  1923. +  
  1924. +   public boolean isAio()
  1925. +   {
  1926. +       return _aio;
  1927. +   }
  1928. +  
  1929. +   private long _offlineShopStart = 0;
  1930. +  
  1931. +   public long getOfflineStartTime()
  1932. +   {
  1933. +       return _offlineShopStart;
  1934. +   }
  1935. +   public void setOfflineStartTime(long time)
  1936. +   {
  1937. +       _offlineShopStart = time;
  1938. +   }
  1939. +  
  1940. +   public int killingSpreePvps = 0;
  1941. +  
  1942.     private boolean _isTopKiller = false;
  1943.    
  1944.     public boolean isTopKiller()
  1945. @@ -284,8 +441,8 @@
  1946.    
  1947.     // Character SQL String Definitions:
  1948.     private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,nobless,power_grade,last_recom_date) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  1949. -   private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,pvpzone_kills=?,topkiller=? WHERE obj_id=?";
  1950. -   private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,pvpzone_kills,topkiller FROM characters WHERE obj_id=?";
  1951. +   private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,pvpzone_kills=?,topkiller=?,aio=?,vip=? WHERE obj_id=?";
  1952. +   private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,pvpzone_kills,topkiller,aio,vip FROM characters WHERE obj_id=?";
  1953.    
  1954.     // Character Subclass SQL String Definitions:
  1955.     private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
  1956. @@ -910,9 +1067,17 @@
  1957.    
  1958.     public String getAccountName()
  1959.     {
  1960. +       if (getClient() == null)
  1961. +           return getAccountNamePlayer();
  1962. +      
  1963.         return getClient().getAccountName();
  1964.     }
  1965.    
  1966. +   public String getAccountNamePlayer()
  1967. +   {
  1968. +       return _accountName;
  1969. +   }
  1970. +  
  1971.     public Map<Integer, String> getAccountChars()
  1972.     {
  1973.         return _chars;
  1974. @@ -4277,6 +4442,8 @@
  1975.         // Icons update in order to get retained buffs list
  1976.         updateEffectIcons();
  1977.        
  1978. +       killingSpreePvps = 0;
  1979. +      
  1980.         return true;
  1981.     }
  1982.    
  1983. @@ -4403,7 +4570,12 @@
  1984.        
  1985.         // Check if it's pvp
  1986.         if ((checkIfPvP(target) && targetPlayer.getPvpFlag() != 0) || (isInsideZone(ZONE_PVP) && targetPlayer.isInsideZone(ZONE_PVP)))
  1987. -           increasePvpKills(targetPlayer);
  1988. +       {
  1989. +           if (addPvp((L2Playable)target))
  1990. +           {
  1991. +               increasePvpKills(targetPlayer);
  1992. +           }
  1993. +       }
  1994.         // Target player doesn't have pvp flag set
  1995.         else
  1996.         {
  1997. @@ -4411,7 +4583,10 @@
  1998.             if (targetPlayer.getClan() != null && getClan() != null && getClan().isAtWarWith(targetPlayer.getClanId()) && targetPlayer.getClan().isAtWarWith(getClanId()) && targetPlayer.getPledgeType() != L2Clan.SUBUNIT_ACADEMY && getPledgeType() != L2Clan.SUBUNIT_ACADEMY)
  1999.             {
  2000.                 // 'Both way war' -> 'PvP Kill'
  2001. -               increasePvpKills(targetPlayer);
  2002. +               if (addPvp((L2Playable)target))
  2003. +               {
  2004. +                   increasePvpKills(targetPlayer);
  2005. +               }
  2006.                 return;
  2007.             }
  2008.            
  2009. @@ -4419,13 +4594,65 @@
  2010.             if (targetPlayer.getKarma() > 0)
  2011.             {
  2012.                 if (Config.KARMA_AWARD_PK_KILL)
  2013. -                   increasePvpKills(targetPlayer);
  2014. +               {
  2015. +                   if (addPvp((L2Playable)target))
  2016. +                   {
  2017. +                       increasePvpKills(targetPlayer);
  2018. +                   }
  2019. +               }
  2020.             }
  2021.             else if (targetPlayer.getPvpFlag() == 0)
  2022.                 increasePkKillsAndKarma(targetPlayer.getLevel());
  2023.         }
  2024.     }
  2025.    
  2026. +   private boolean addPvp(L2Playable vp)
  2027. +   {
  2028. +       if (!Config.ANTI_FARM_ENALBED)
  2029. +       {
  2030. +           return true;
  2031. +       }
  2032. +      
  2033. +       if (Config.ANTI_FARM_SUMMON && vp instanceof L2Summon)
  2034. +       {
  2035. +           return false;
  2036. +       }
  2037. +      
  2038. +       L2PcInstance v = (L2PcInstance)vp;
  2039. +      
  2040. +       if (Config.ANTI_FARM_PARTY && v.getParty() == getParty())
  2041. +       {
  2042. +           return false;
  2043. +       }
  2044. +      
  2045. +       if (Config.ANTI_FARM_CLAN_ALLY && (v.getClan() == getClan() || v.getAllyId() == getAllyId()))
  2046. +       {
  2047. +           return false;
  2048. +       }
  2049. +      
  2050. +       if (Config.ANTI_FARM_IP && v.getClient().getConnection().getInetAddress().getHostAddress() == getClient().getConnection().getInetAddress().getHostAddress())
  2051. +       {
  2052. +           return false;
  2053. +       }
  2054. +      
  2055. +       if (Config.ANTI_FARM_LVL_DIFF && (v.getLevel()-getLevel() >= Config.ANTI_FARM_MAX_LVL_DIFF || getLevel()-v.getLevel() >= Config.ANTI_FARM_MAX_LVL_DIFF))
  2056. +       {
  2057. +           return false;
  2058. +       }
  2059. +      
  2060. +       if (Config.ANTI_FARM_PATK_DIFF && (v.getStat().getPAtk(null)-getStat().getPAtk(null) >= Config.ANTI_FARM_MAX_PATK_DIFF || getStat().getPAtk(null)-v.getStat().getPAtk(null) >= Config.ANTI_FARM_MAX_PATK_DIFF))
  2061. +       {
  2062. +           return false;
  2063. +       }
  2064. +      
  2065. +       if (Config.ANTI_FARM_PDEF_DIFF && (v.getStat().getPDef(null)-getStat().getPDef(null) >= Config.ANTI_FARM_MAX_PDEF_DIFF || getStat().getPDef(null)-v.getStat().getPDef(null) >= Config.ANTI_FARM_MAX_PDEF_DIFF))
  2066. +       {
  2067. +           return false;
  2068. +       }
  2069. +      
  2070. +       return true;
  2071. +   }
  2072. +  
  2073.     public void increaseCustomPvpKills(L2PcInstance killer)
  2074.     {
  2075.         setPvpZoneKills(getPvpZoneKills()+1);
  2076. @@ -4436,6 +4663,45 @@
  2077.         }
  2078.     }
  2079.    
  2080. +   private void killingSpreePvp()
  2081. +   {
  2082. +       killingSpreePvps++;
  2083. +       for (int i : Config.KILLING_SPREE_REWARD.keySet())
  2084. +       {
  2085. +           if (killingSpreePvps == i)
  2086. +           {
  2087. +               Announcements.announceToAll(getName()+" "+Config.KILLING_SPREE_REWARD.get(i));
  2088. +           }
  2089. +       }
  2090. +   }
  2091. +  
  2092. +   public void colorsCheck()
  2093. +   {
  2094. +       if (Config.ALLOW_PVP_NAME_COLOR_SYSTEM)
  2095. +       {
  2096. +           for (int i : Config.PVP_COLORS.keySet())
  2097. +           {
  2098. +               if (getPvpKills() >= i)
  2099. +               {
  2100. +                   getAppearance().setNameColor(Config.PVP_COLORS.get(i));
  2101. +                   broadcastUserInfo();
  2102. +               }
  2103. +           }
  2104. +       }
  2105. +      
  2106. +       if (Config.ALLOW_PK_TITLE_COLOR_SYSTEM)
  2107. +       {
  2108. +           for (int i : Config.PK_COLORS.keySet())
  2109. +           {
  2110. +               if (getPkKills() >= i)
  2111. +               {
  2112. +                   getAppearance().setTitleColor(Config.PK_COLORS.get(i));
  2113. +                   broadcastUserInfo();
  2114. +               }
  2115. +           }
  2116. +       }
  2117. +   }
  2118. +  
  2119.     /**
  2120.      * Increase the pvp kills count and send the info to the player
  2121.      * @param kl
  2122. @@ -4445,6 +4711,29 @@
  2123.         // Add karma to attacker and increase its PK counter
  2124.         setPvpKills(getPvpKills() + 1);
  2125.        
  2126. +       if (Config.ALLOW_PVP_NAME_COLOR_SYSTEM || Config.ALLOW_PK_TITLE_COLOR_SYSTEM)
  2127. +       {
  2128. +           colorsCheck();
  2129. +       }
  2130. +      
  2131. +       if (Config.PVP_PK_TITLE && !choseNormalTitle)
  2132. +       {
  2133. +           customEditTitle(Config.PVP_TITLE_PREFIX+" "+getPvpKills()+" | "+Config.PK_TITLE_PREFIX+" "+getPkKills());
  2134. +       }
  2135. +      
  2136. +       if (Config.ALLOW_KILLING_SPREE)
  2137. +       {
  2138. +           killingSpreePvp();
  2139. +       }
  2140. +      
  2141. +       if (Config.WAR_LEGEND_AURA)
  2142. +       {
  2143. +           if (killingSpreePvps == Config.KILLS_TO_GET_WAR_LEGEND_AURA)
  2144. +           {
  2145. +               broadcastUserInfo();
  2146. +           }
  2147. +       }
  2148. +      
  2149.         addItem("pvp reward", Config.PVP_REWARD[0], Config.PVP_REWARD[1], null, true);
  2150.        
  2151.         // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
  2152. @@ -4944,6 +5233,11 @@
  2153.     public void setPrivateStoreType(int type)
  2154.     {
  2155.         _privatestore = type;
  2156. +      
  2157. +       if (Config.OFFLINE_DISCONNECT_FINISHED && _privatestore == STORE_PRIVATE_NONE && (getClient() == null || getClient().isDetached()))
  2158. +       {
  2159. +           deleteMe();
  2160. +       }
  2161.     }
  2162.    
  2163.     /**
  2164. @@ -4978,7 +5272,10 @@
  2165.     public void setClan(L2Clan clan)
  2166.     {
  2167.         _clan = clan;
  2168. -       setTitle("");
  2169. +       if (!Config.PVP_PK_TITLE)
  2170. +       {
  2171. +           setTitle("");
  2172. +       }
  2173.        
  2174.         if (clan == null)
  2175.         {
  2176. @@ -5815,6 +6112,9 @@
  2177.                 player.setPvpZoneKills(rset.getInt("pvpzone_kills"));
  2178.                 player.setIsTopKiller(rset.getInt("topkiller") == 1);
  2179.                
  2180. +               player.setAio(rset.getInt("aio") == 1);
  2181. +               player.setVip(rset.getInt("vip") == 1);
  2182. +              
  2183.                 player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
  2184.                 if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
  2185.                     player.setClanJoinExpiryTime(0);
  2186. @@ -6254,7 +6554,9 @@
  2187.             statement.setLong(49, getDeathPenaltyBuffLevel());
  2188.             statement.setInt(50, getPvpZoneKills());
  2189.             statement.setInt(51, isTopKiller() ? 1 : 0);
  2190. -           statement.setInt(52, getObjectId());
  2191. +           statement.setInt(52, isAio() ? 1 : 0);
  2192. +           statement.setInt(53, isVip() ? 1 : 0);
  2193. +           statement.setInt(54, getObjectId());
  2194.            
  2195.             statement.execute();
  2196.             statement.close();
  2197. Index: java/net/sf/l2j/gameserver/model/entity/HzVoteReward.java
  2198. ===================================================================
  2199. --- java/net/sf/l2j/gameserver/model/entity/HzVoteReward.java   (revision 0)
  2200. +++ java/net/sf/l2j/gameserver/model/entity/HzVoteReward.java   (revision 0)
  2201. @@ -0,0 +1,293 @@
  2202. +/*
  2203. + * This program is free software: you can redistribute it and/or modify it under
  2204. + * the terms of the GNU General Public License as published by the Free Software
  2205. + * Foundation, either version 3 of the License, or (at your option) any later
  2206. + * version.
  2207. + *
  2208. + * This program is distributed in the hope that it will be useful, but WITHOUT
  2209. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  2210. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  2211. + * details.
  2212. + *
  2213. + * You should have received a copy of the GNU General Public License along with
  2214. + * this program. If not, see <http://www.gnu.org/licenses/>.
  2215. + */
  2216. +package net.sf.l2j.gameserver.model.entity;
  2217. +
  2218. +import java.io.BufferedReader;
  2219. +import java.io.InputStreamReader;
  2220. +import java.net.URL;
  2221. +import java.net.URLConnection;
  2222. +import java.util.Collection;
  2223. +import java.util.HashMap;
  2224. +
  2225. +import net.sf.l2j.Config;
  2226. +import net.sf.l2j.gameserver.Announcements;
  2227. +import net.sf.l2j.gameserver.ThreadPoolManager;
  2228. +import net.sf.l2j.gameserver.model.L2World;
  2229. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  2230. +
  2231. +public class HzVoteReward
  2232. +{
  2233. +        // Configurations.
  2234. +        private static String hopzoneUrl = Config.HOPZONE_SERVER_LINK;
  2235. +        private static String page1Url = Config.HOPZONE_FIRST_PAGE_LINK;
  2236. +        private static int voteRewardVotesDifference = Config.HOPZONE_VOTES_DIFFERENCE;
  2237. +        private static int firstPageRankNeeded = Config.HOPZONE_FIRST_PAGE_RANK_NEEDED;
  2238. +        private static int checkTime = 60*1000*Config.HOPZONE_REWARD_CHECK_TIME;
  2239. +      
  2240. +        // Don't-touch variables.
  2241. +        private static int lastVotes = 0;
  2242. +        @SuppressWarnings("unused")
  2243. +       private static HashMap<String, Integer> playerIps = new HashMap<String, Integer>();
  2244. +      
  2245. +        public static void updateConfigurations()
  2246. +        {
  2247. +                hopzoneUrl = Config.HOPZONE_SERVER_LINK;
  2248. +                page1Url = Config.HOPZONE_FIRST_PAGE_LINK;
  2249. +                voteRewardVotesDifference = Config.HOPZONE_VOTES_DIFFERENCE;
  2250. +                firstPageRankNeeded = Config.HOPZONE_FIRST_PAGE_RANK_NEEDED;
  2251. +                checkTime = 60*1000*Config.HOPZONE_REWARD_CHECK_TIME;
  2252. +        }
  2253. +      
  2254. +        public static void getInstance()
  2255. +        {
  2256. +                System.out.println("Vote reward system initialized.");
  2257. +                ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
  2258. +                {
  2259. +                        @SuppressWarnings("synthetic-access")
  2260. +                       @Override
  2261. +                        public void run()
  2262. +                        {
  2263. +                                if (Config.ALLOW_HOPZONE_VOTE_REWARD)
  2264. +                                {
  2265. +                                        reward();
  2266. +                                }
  2267. +                                else
  2268. +                                {
  2269. +                                        return;
  2270. +                                }
  2271. +                        }
  2272. +                }, checkTime/2, checkTime);
  2273. +        }
  2274. +      
  2275. +        private static void reward()
  2276. +        {
  2277. +                int firstPageVotes = getFirstPageRankVotes();
  2278. +                int currentVotes = getVotes();
  2279. +              
  2280. +                if (firstPageVotes == -1 || currentVotes == -1)
  2281. +                {
  2282. +                        if (firstPageVotes == -1)
  2283. +                        {
  2284. +                                System.out.println("There was a problem on getting votes from server with rank "+firstPageRankNeeded+".");
  2285. +                        }
  2286. +                        if (currentVotes == -1)
  2287. +                        {
  2288. +                                System.out.println("There was a problem on getting server votes.");
  2289. +                        }
  2290. +                      
  2291. +                        return;
  2292. +                }
  2293. +              
  2294. +                if (lastVotes == 0)
  2295. +                {
  2296. +                        lastVotes = currentVotes;
  2297. +                        Announcements.getInstance();
  2298. +                       Announcements.announceToAll("Hopzone's vote count is "+currentVotes+".");
  2299. +                        Announcements.getInstance();
  2300. +                       Announcements.announceToAll("We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for reward.");
  2301. +                        if (firstPageVotes-lastVotes <= 0)
  2302. +                        {
  2303. +                                Announcements.getInstance();
  2304. +                               Announcements.announceToAll("We are in the first page of hopzone, reward will be big.");
  2305. +                        }
  2306. +                        else
  2307. +                        {
  2308. +                                Announcements.getInstance();
  2309. +                               Announcements.announceToAll("We need "+(firstPageVotes-lastVotes)+" vote(s) for big reward.");
  2310. +                        }
  2311. +                        return;
  2312. +                }
  2313. +              
  2314. +                if (currentVotes >= lastVotes+voteRewardVotesDifference)
  2315. +                {
  2316. +                        Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
  2317. +                        if (firstPageVotes-currentVotes <= 0)
  2318. +                        {
  2319. +                                Announcements.getInstance();
  2320. +                               Announcements.announceToAll("Everyone has been rewarded with big reward.");
  2321. +                                Announcements.getInstance();
  2322. +                               Announcements.announceToAll("Hopzone's vote count is "+currentVotes+".");
  2323. +                                for (L2PcInstance p : pls)
  2324. +                                {
  2325. +                                        boolean canReward = false;
  2326. +                                        String pIp = p.getClient().getConnection().getInetAddress().getHostAddress();
  2327. +                                        if (playerIps.containsKey(pIp))
  2328. +                                        {
  2329. +                                                int count = playerIps.get(pIp);
  2330. +                                                if (count < Config.HOPZONE_DUALBOXES_ALLOWED)
  2331. +                                                {
  2332. +                                                        playerIps.remove(pIp);
  2333. +                                                        playerIps.put(pIp, count+1);
  2334. +                                                        canReward = true;
  2335. +                                                }
  2336. +                                        }
  2337. +                                        else
  2338. +                                        {
  2339. +                                                canReward = true;
  2340. +                                                playerIps.put(pIp, 1);
  2341. +                                        }
  2342. +                                        if (canReward)
  2343. +                                        {
  2344. +                                                for (int i : Config.HOPZONE_BIG_REWARD.keySet())
  2345. +                                                {
  2346. +                                                        p.addItem("Vote reward.", i, Config.HOPZONE_BIG_REWARD.get(i), p, true);
  2347. +                                                }
  2348. +                                        }
  2349. +                                        else
  2350. +                                        {
  2351. +                                                p.sendMessage("Already "+Config.HOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded.");
  2352. +                                        }
  2353. +                                }
  2354. +                                playerIps.clear();
  2355. +                        }
  2356. +                        else
  2357. +                        {
  2358. +                                Announcements.getInstance();
  2359. +                               Announcements.announceToAll("Everyone has been rewarded with small reward.");
  2360. +                                Announcements.getInstance();
  2361. +                               Announcements.announceToAll("Hopzone's vote count is "+currentVotes+".");
  2362. +                                Announcements.getInstance();
  2363. +                               Announcements.announceToAll("We need "+(firstPageVotes-currentVotes)+" vote(s) for big reward.");
  2364. +                                for (L2PcInstance p : pls)
  2365. +                                {
  2366. +                                        boolean canReward = false;
  2367. +                                        String pIp = p.getClient().getConnection().getInetAddress().getHostAddress();
  2368. +                                        if (playerIps.containsKey(pIp))
  2369. +                                        {
  2370. +                                                int count = playerIps.get(pIp);
  2371. +                                                if (count < Config.HOPZONE_DUALBOXES_ALLOWED)
  2372. +                                                {
  2373. +                                                        playerIps.remove(pIp);
  2374. +                                                        playerIps.put(pIp, count+1);
  2375. +                                                        canReward = true;
  2376. +                                                }
  2377. +                                        }
  2378. +                                        else
  2379. +                                        {
  2380. +                                                canReward = true;
  2381. +                                                playerIps.put(pIp, 1);
  2382. +                                        }
  2383. +                                        if (canReward)
  2384. +                                        {
  2385. +                                                for (int i : Config.HOPZONE_SMALL_REWARD.keySet())
  2386. +                                                {
  2387. +                                                        p.addItem("Vote reward.", i, Config.HOPZONE_SMALL_REWARD.get(i), p, true);
  2388. +                                                }
  2389. +                                        }
  2390. +                                        else
  2391. +                                        {
  2392. +                                                p.sendMessage("Already "+Config.HOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded.");
  2393. +                                        }
  2394. +                                }
  2395. +                                playerIps.clear();
  2396. +                        }
  2397. +                      
  2398. +                        lastVotes = currentVotes;
  2399. +                }
  2400. +                else
  2401. +                {
  2402. +                        if (firstPageVotes-currentVotes <= 0)
  2403. +                        {
  2404. +                                Announcements.getInstance();
  2405. +                               Announcements.announceToAll("Hopzone's vote count is "+currentVotes+".");
  2406. +                                Announcements.getInstance();
  2407. +                               Announcements.announceToAll("We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for big reward.");
  2408. +                        }
  2409. +                        else
  2410. +                        {
  2411. +                                Announcements.getInstance();
  2412. +                               Announcements.announceToAll("Hopzone's vote count is "+currentVotes+".");
  2413. +                                Announcements.getInstance();
  2414. +                               Announcements.announceToAll("We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for small reward.");
  2415. +                                Announcements.getInstance();
  2416. +                               Announcements.announceToAll("We need "+(firstPageVotes-currentVotes)+" vote(s) for big reward.");
  2417. +                        }
  2418. +                }
  2419. +        }
  2420. +      
  2421. +        private static int getFirstPageRankVotes()
  2422. +        {
  2423. +                InputStreamReader isr = null;
  2424. +                BufferedReader br = null;
  2425. +              
  2426. +                try
  2427. +                {
  2428. +                        URLConnection con = new URL(page1Url).openConnection();
  2429. +                        con.addRequestProperty("User-Agent", "Mozilla/4.76");
  2430. +                        isr = new InputStreamReader(con.getInputStream());
  2431. +                        br = new BufferedReader(isr);
  2432. +                      
  2433. +                        String line;
  2434. +                        int i = 0;
  2435. +                        while ((line = br.readLine()) != null)
  2436. +                        {
  2437. +                                if (line.contains("<span class=\"no\">"+firstPageRankNeeded+"</span>"))
  2438. +                                {
  2439. +                                        i++;
  2440. +                                }
  2441. +                                if (line.contains("Anonymous Votes") && i == 1)
  2442. +                                {
  2443. +                                        i = 0;
  2444. +                                        int votes = Integer.valueOf(line.split(">")[1].replace("</span", ""));
  2445. +                                        return votes;
  2446. +                                }
  2447. +                        }
  2448. +                      
  2449. +                        br.close();
  2450. +                        isr.close();
  2451. +                }
  2452. +                catch (Exception e)
  2453. +                {
  2454. +                        System.out.println(e);
  2455. +                        System.out.println("Error while getting server vote count.");
  2456. +                }
  2457. +              
  2458. +                return -1;
  2459. +        }
  2460. +      
  2461. +        private static int getVotes()
  2462. +        {
  2463. +                InputStreamReader isr = null;
  2464. +                BufferedReader br = null;
  2465. +              
  2466. +                try
  2467. +                {
  2468. +                        URLConnection con = new URL(hopzoneUrl).openConnection();
  2469. +                        con.addRequestProperty("User-Agent", "Mozilla/4.76");
  2470. +                        isr = new InputStreamReader(con.getInputStream());
  2471. +                        br = new BufferedReader(isr);
  2472. +                      
  2473. +                        String line;
  2474. +                        while ((line = br.readLine()) != null)
  2475. +                        {
  2476. +                                if (line.contains("Anonymous User Votes"))
  2477. +                                {
  2478. +                                        int votes = Integer.valueOf(line.split(">")[2].replace("</span", ""));
  2479. +                                        return votes;
  2480. +                                }
  2481. +                        }
  2482. +                      
  2483. +                        br.close();
  2484. +                        isr.close();
  2485. +                }
  2486. +                catch (Exception e)
  2487. +                {
  2488. +                        System.out.println(e);
  2489. +                        System.out.println("Error while getting server vote count.");
  2490. +                }
  2491. +              
  2492. +                return -1;
  2493. +        }
  2494. +}
  2495. \ No newline at end of file
  2496. Index: java/net/sf/l2j/gameserver/datatables/OfflineTradersTable.java
  2497. ===================================================================
  2498. --- java/net/sf/l2j/gameserver/datatables/OfflineTradersTable.java  (revision 0)
  2499. +++ java/net/sf/l2j/gameserver/datatables/OfflineTradersTable.java  (revision 0)
  2500. @@ -0,0 +1,274 @@
  2501. +/*
  2502. + * This program is free software: you can redistribute it and/or modify it under
  2503. + * the terms of the GNU General Public License as published by the Free Software
  2504. + * Foundation, either version 3 of the License, or (at your option) any later
  2505. + * version.
  2506. + *
  2507. + * This program is distributed in the hope that it will be useful, but WITHOUT
  2508. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  2509. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  2510. + * details.
  2511. + *
  2512. + * You should have received a copy of the GNU General Public License along with
  2513. + * this program. If not, see <http://www.gnu.org/licenses/>.
  2514. + */
  2515. +package net.sf.l2j.gameserver.datatables;
  2516. +
  2517. +import java.sql.Connection;
  2518. +import java.sql.PreparedStatement;
  2519. +import java.sql.ResultSet;
  2520. +import java.sql.SQLException;
  2521. +import java.util.Calendar;
  2522. +import java.util.logging.Level;
  2523. +import java.util.logging.Logger;
  2524. +
  2525. +import net.sf.l2j.Config;
  2526. +import net.sf.l2j.L2DatabaseFactory;
  2527. +import net.sf.l2j.gameserver.LoginServerThread;
  2528. +import net.sf.l2j.gameserver.model.L2ManufactureItem;
  2529. +import net.sf.l2j.gameserver.model.L2ManufactureList;
  2530. +import net.sf.l2j.gameserver.model.L2World;
  2531. +import net.sf.l2j.gameserver.model.TradeList.TradeItem;
  2532. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  2533. +import net.sf.l2j.gameserver.network.L2GameClient;
  2534. +import net.sf.l2j.gameserver.network.L2GameClient.GameClientState;
  2535. +
  2536. +public class OfflineTradersTable
  2537. +{
  2538. +   private static Logger _log = Logger.getLogger(OfflineTradersTable.class.getName());
  2539. +  
  2540. +   //SQL DEFINITIONS
  2541. +   private static final String SAVE_OFFLINE_STATUS = "INSERT INTO character_offline_trade (`charId`,`time`,`type`,`title`) VALUES (?,?,?,?)";
  2542. +   private static final String SAVE_ITEMS = "INSERT INTO character_offline_trade_items (`charId`,`item`,`count`,`price`) VALUES (?,?,?,?)";
  2543. +   private static final String CLEAR_OFFLINE_TABLE = "DELETE FROM character_offline_trade";
  2544. +   private static final String CLEAR_OFFLINE_TABLE_ITEMS = "DELETE FROM character_offline_trade_items";
  2545. +   private static final String LOAD_OFFLINE_STATUS = "SELECT * FROM character_offline_trade";
  2546. +   private static final String LOAD_OFFLINE_ITEMS = "SELECT * FROM character_offline_trade_items WHERE charId = ?";
  2547. +  
  2548. +   public static void storeOffliners()
  2549. +   {
  2550. +       Connection con = null;
  2551. +       try
  2552. +       {
  2553. +           con = L2DatabaseFactory.getInstance().getConnection();
  2554. +           PreparedStatement stm = con.prepareStatement(CLEAR_OFFLINE_TABLE);
  2555. +           stm.execute();
  2556. +           stm.close();
  2557. +           stm = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
  2558. +           stm.execute();
  2559. +           stm.close();
  2560. +          
  2561. +           con.setAutoCommit(false); // avoid halfway done
  2562. +           stm = con.prepareStatement(SAVE_OFFLINE_STATUS);
  2563. +           PreparedStatement stm_items = con.prepareStatement(SAVE_ITEMS);
  2564. +          
  2565. +           //TextBuilder items = TextBuilder.newInstance();
  2566. +           for (L2PcInstance pc : L2World.getInstance().getAllPlayers().values())
  2567. +           {
  2568. +               try
  2569. +               {
  2570. +                   if ((pc.getPrivateStoreType() != L2PcInstance.STORE_PRIVATE_NONE) && (pc.getClient() == null || pc.getClient().isDetached()))
  2571. +                   {
  2572. +                       stm.setInt(1, pc.getObjectId()); //Char Id
  2573. +                       stm.setLong(2, pc.getOfflineStartTime());
  2574. +                       stm.setInt(3, pc.getPrivateStoreType()); //store type
  2575. +                       String title = null;
  2576. +                      
  2577. +                       switch (pc.getPrivateStoreType())
  2578. +                       {
  2579. +                           case L2PcInstance.STORE_PRIVATE_BUY:
  2580. +                               if (!Config.OFFLINE_TRADE_ENABLE)
  2581. +                                   continue;
  2582. +                               title = pc.getBuyList().getTitle();
  2583. +                               for (TradeItem i : pc.getBuyList().getItems())
  2584. +                               {
  2585. +                                   stm_items.setInt(1, pc.getObjectId());
  2586. +                                   stm_items.setInt(2, i.getItem().getItemId());
  2587. +                                   stm_items.setInt(3, i.getCount());
  2588. +                                   stm_items.setInt(4, i.getPrice());
  2589. +                                   stm_items.executeUpdate();
  2590. +                                   stm_items.clearParameters();
  2591. +                               }
  2592. +                               break;
  2593. +                           case L2PcInstance.STORE_PRIVATE_SELL:
  2594. +                           case L2PcInstance.STORE_PRIVATE_PACKAGE_SELL:
  2595. +                               if (!Config.OFFLINE_TRADE_ENABLE)
  2596. +                                   continue;
  2597. +                               title = pc.getSellList().getTitle();
  2598. +                               for (TradeItem i : pc.getSellList().getItems())
  2599. +                               {
  2600. +                                   stm_items.setInt(1, pc.getObjectId());
  2601. +                                   stm_items.setInt(2, i.getObjectId());
  2602. +                                   stm_items.setInt(3, i.getCount());
  2603. +                                   stm_items.setInt(4, i.getPrice());
  2604. +                                   stm_items.executeUpdate();
  2605. +                                   stm_items.clearParameters();
  2606. +                               }
  2607. +                               break;
  2608. +                           case L2PcInstance.STORE_PRIVATE_MANUFACTURE:
  2609. +                               if (!Config.OFFLINE_CRAFT_ENABLE)
  2610. +                                   continue;
  2611. +                               title = pc.getCreateList().getStoreName();
  2612. +                               for (L2ManufactureItem i : pc.getCreateList().getList())
  2613. +                               {
  2614. +                                   stm_items.setInt(1, pc.getObjectId());
  2615. +                                   stm_items.setInt(2, i.getRecipeId());
  2616. +                                   stm_items.setLong(3, 0);
  2617. +                                   stm_items.setLong(4, i.getCost());
  2618. +                                   stm_items.executeUpdate();
  2619. +                                   stm_items.clearParameters();
  2620. +                               }
  2621. +                       }
  2622. +                       stm.setString(4, title);
  2623. +                       stm.executeUpdate();
  2624. +                       stm.clearParameters();
  2625. +                       con.commit(); // flush
  2626. +                   }
  2627. +               }
  2628. +               catch (Exception e)
  2629. +               {
  2630. +                   _log.log(Level.WARNING, "OfflineTradersTable[storeTradeItems()]: Error while saving offline trader: " + pc.getObjectId() + " " + e, e);
  2631. +               }
  2632. +           }
  2633. +           stm.close();
  2634. +           stm_items.close();
  2635. +           _log.info("Offline traders stored.");
  2636. +       }
  2637. +       catch (Exception e)
  2638. +       {
  2639. +           _log.log(Level.WARNING,"OfflineTradersTable[storeTradeItems()]: Error while saving offline traders: " + e,e);
  2640. +       }
  2641. +       finally
  2642. +       {
  2643. +           try
  2644. +           {
  2645. +               con.close();
  2646. +           } catch (Exception e)
  2647. +           {
  2648. +           }
  2649. +           con = null;
  2650. +       }
  2651. +   }
  2652. +  
  2653. +   public static void restoreOfflineTraders()
  2654. +   {
  2655. +       _log.info("Loading offline traders...");
  2656. +       Connection con = null;
  2657. +       int nTraders = 0;
  2658. +       try
  2659. +       {
  2660. +           con = L2DatabaseFactory.getInstance().getConnection();
  2661. +           PreparedStatement stm = con.prepareStatement(LOAD_OFFLINE_STATUS);
  2662. +           ResultSet rs = stm.executeQuery();
  2663. +           while (rs.next())
  2664. +           {
  2665. +               long time = rs.getLong("time");
  2666. +               if (Config.OFFLINE_MAX_DAYS > 0)
  2667. +               {
  2668. +                   Calendar cal = Calendar.getInstance();
  2669. +                   cal.setTimeInMillis(time);
  2670. +                   cal.add(Calendar.DAY_OF_YEAR, Config.OFFLINE_MAX_DAYS);
  2671. +                   if (cal.getTimeInMillis() <= System.currentTimeMillis())
  2672. +                       continue;
  2673. +               }
  2674. +              
  2675. +               int type = rs.getInt("type");
  2676. +               if (type == L2PcInstance.STORE_PRIVATE_NONE)
  2677. +                   continue;
  2678. +              
  2679. +               L2PcInstance player = null;
  2680. +              
  2681. +               try
  2682. +               {
  2683. +                   L2GameClient client = new L2GameClient(null);
  2684. +                   client.setDetached(true);
  2685. +                   player = L2PcInstance.load(rs.getInt("charId"));
  2686. +                   client.setActiveChar(player);
  2687. +                   player.setOnlineStatus(true, false);
  2688. +                   client.setAccountName(player.getAccountName());
  2689. +                   client.setState(GameClientState.IN_GAME);
  2690. +                   player.setClient(client);
  2691. +                   player.setOfflineStartTime(time);
  2692. +                   player.spawnMe(player.getX(), player.getY(), player.getZ());
  2693. +                   LoginServerThread.getInstance().addGameServerLogin(player.getAccountName(), client);
  2694. +                   PreparedStatement stm_items = con.prepareStatement(LOAD_OFFLINE_ITEMS);
  2695. +                   stm_items.setInt(1, player.getObjectId());
  2696. +                   ResultSet items = stm_items.executeQuery();
  2697. +                  
  2698. +                   switch (type)
  2699. +                   {
  2700. +                       case L2PcInstance.STORE_PRIVATE_BUY:
  2701. +                           while (items.next())
  2702. +                           {
  2703. +                               if (player.getBuyList().addItemByItemId(items.getInt(2), items.getInt(3), items.getInt(4)) == null)
  2704. +                                   throw new NullPointerException();
  2705. +                           }
  2706. +                           player.getBuyList().setTitle(rs.getString("title"));
  2707. +                           break;
  2708. +                       case L2PcInstance.STORE_PRIVATE_SELL:
  2709. +                       case L2PcInstance.STORE_PRIVATE_PACKAGE_SELL:
  2710. +                           while (items.next())
  2711. +                           {
  2712. +                               if (player.getSellList().addItem(items.getInt(2), items.getInt(3), items.getInt(4)) == null)
  2713. +                                   throw new NullPointerException();
  2714. +                           }
  2715. +                           player.getSellList().setTitle(rs.getString("title"));
  2716. +                           player.getSellList().setPackaged(type == L2PcInstance.STORE_PRIVATE_PACKAGE_SELL);
  2717. +                           break;
  2718. +                       case L2PcInstance.STORE_PRIVATE_MANUFACTURE:
  2719. +                           L2ManufactureList createList = new L2ManufactureList();
  2720. +                           while (items.next())
  2721. +                           {
  2722. +                               createList.add(new L2ManufactureItem(items.getInt(2), items.getInt(4)));
  2723. +                           }
  2724. +                           player.setCreateList(createList);
  2725. +                           player.getCreateList().setStoreName(rs.getString("title"));
  2726. +                           break;
  2727. +                   }
  2728. +                   items.close();
  2729. +                   stm_items.close();
  2730. +                  
  2731. +                   player.sitDown();
  2732. +                   if (Config.OFFLINE_SET_NAME_COLOR)
  2733. +                       player.getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR);
  2734. +                   player.setPrivateStoreType(type);
  2735. +                   player.setOnlineStatus(true, true);
  2736. +                   player.restoreEffects();
  2737. +                   player.broadcastUserInfo();
  2738. +                   nTraders++;
  2739. +               }
  2740. +               catch (Exception e)
  2741. +               {
  2742. +                   _log.log(Level.WARNING, "OfflineTradersTable[loadOffliners()]: Error loading trader: "+player,e);
  2743. +                   if (player != null)
  2744. +                   {
  2745. +                       player.deleteMe();
  2746. +                   }
  2747. +               }
  2748. +           }
  2749. +           rs.close();
  2750. +           stm.close();
  2751. +           _log.info("Loaded: " +nTraders+ " offline trader(s)");
  2752. +           stm = con.prepareStatement(CLEAR_OFFLINE_TABLE);
  2753. +           stm.execute();
  2754. +           stm.close();
  2755. +           stm = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
  2756. +           stm.execute();
  2757. +           stm.close();
  2758. +       }
  2759. +       catch (Exception e)
  2760. +       {
  2761. +           _log.log(Level.WARNING, "OfflineTradersTable[loadOffliners()]: Error while loading offline traders: ",e);
  2762. +       }
  2763. +       finally
  2764. +       {
  2765. +           try
  2766. +           {
  2767. +           con.close();
  2768. +           }
  2769. +           catch (Exception e)
  2770. +           { }
  2771. +           con = null;
  2772. +       }
  2773. +   }
  2774. +}
  2775. \ No newline at end of file
  2776. Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java
  2777. ===================================================================
  2778. --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java   (revision 0)
  2779. +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java   (revision 0)
  2780. @@ -0,0 +1,72 @@
  2781. +/*
  2782. + * This program is free software: you can redistribute it and/or modify it under
  2783. + * the terms of the GNU General Public License as published by the Free Software
  2784. + * Foundation, either version 3 of the License, or (at your option) any later
  2785. + * version.
  2786. + *
  2787. + * This program is distributed in the hope that it will be useful, but WITHOUT
  2788. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  2789. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  2790. + * details.
  2791. + *
  2792. + * You should have received a copy of the GNU General Public License along with
  2793. + * this program. If not, see <http://www.gnu.org/licenses/>.
  2794. + */
  2795. +package net.sf.l2j.gameserver.handler.admincommandhandlers;
  2796. +
  2797. +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  2798. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  2799. +
  2800. +/**
  2801. + * @author Anarchy
  2802. + *
  2803. + */
  2804. +public class AdminAio implements IAdminCommandHandler
  2805. +{
  2806. +   private static final String[] ADMIN_COMMANDS = { "setaio" };
  2807. +  
  2808. +   @Override
  2809. +   public boolean useAdminCommand(String command, L2PcInstance activeChar)
  2810. +   {
  2811. +       if (command.equals("setaio"))
  2812. +       {
  2813. +           Object target = activeChar.getTarget();
  2814. +          
  2815. +           if (target == null)
  2816. +           {
  2817. +               activeChar.sendMessage("Invalid target.");
  2818. +               return false;
  2819. +           }
  2820. +          
  2821. +           if (!(target instanceof L2PcInstance))
  2822. +           {
  2823. +               activeChar.sendMessage("Invalid target.");
  2824. +               return false;
  2825. +           }
  2826. +          
  2827. +           L2PcInstance trg = (L2PcInstance)target;
  2828. +          
  2829. +           if (trg.isAio())
  2830. +           {
  2831. +               trg.setAio(false);
  2832. +               activeChar.sendMessage("You have removed the AIO status from "+trg.getName()+".");
  2833. +           }
  2834. +           else
  2835. +           {
  2836. +               trg.setAio(true);
  2837. +               activeChar.sendMessage("You have given AIO status to "+trg.getName()+".");
  2838. +           }
  2839. +          
  2840. +           return true;
  2841. +       }
  2842. +      
  2843. +       return true;
  2844. +   }
  2845. +
  2846. +   @Override
  2847. +   public String[] getAdminCommandList()
  2848. +   {
  2849. +       return ADMIN_COMMANDS;
  2850. +   }
  2851. +  
  2852. +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement