Advertisement
debiaan

Addaption of MultiFuctionZone for aCis.

Apr 29th, 2013
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 26.96 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestRecipeShopListSet.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestRecipeShopListSet.java  (revision 37)
  6. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestRecipeShopListSet.java  (working copy)
  7. @@ -19,6 +19,7 @@
  8.  import net.sf.l2j.gameserver.model.L2ManufactureList;
  9.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  10.  import net.sf.l2j.gameserver.model.zone.ZoneId;
  11. +import net.sf.l2j.gameserver.model.zone.type.L2MultiFunctionZone;
  12.  import net.sf.l2j.gameserver.network.SystemMessageId;
  13.  import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  14.  import net.sf.l2j.gameserver.network.serverpackets.RecipeShopMsg;
  15. @@ -61,6 +62,12 @@
  16.             return;
  17.         }
  18.        
  19. +       if (player.isInsideZone(ZoneId.MULTIFUNCTION) && !L2MultiFunctionZone.store_zone)
  20. +       {
  21. +           player.sendMessage("You cannot craft while inside Multifunction zone.");
  22. +           return;
  23. +       }
  24. +      
  25.         if (player.isInsideZone(ZoneId.NO_STORE))
  26.         {
  27.             player.sendPacket(SystemMessageId.NO_PRIVATE_WORKSHOP_HERE);
  28. Index: java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
  29. ===================================================================
  30. --- java/net/sf/l2j/gameserver/network/clientpackets/Logout.java    (revision 37)
  31. +++ java/net/sf/l2j/gameserver/network/clientpackets/Logout.java    (working copy)
  32. @@ -21,6 +21,7 @@
  33.  import net.sf.l2j.gameserver.model.entity.debian.LMS;
  34.  import net.sf.l2j.gameserver.model.entity.debian.LuckyChests;
  35.  import net.sf.l2j.gameserver.model.zone.ZoneId;
  36. +import net.sf.l2j.gameserver.model.zone.type.L2MultiFunctionZone;
  37.  import net.sf.l2j.gameserver.network.SystemMessageId;
  38.  import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  39.  import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  40. @@ -68,6 +69,13 @@
  41.             return;
  42.         }
  43.        
  44. +       if(player.isInsideZone(ZoneId.MULTIFUNCTION) && !L2MultiFunctionZone.logout_zone)
  45. +       {
  46. +           player.sendMessage("You cannot Logout while inside a Multifunction zone.");
  47. +           player.sendPacket(ActionFailed.STATIC_PACKET);
  48. +           return;
  49. +       }
  50. +      
  51.         if (player.isLocked())
  52.         {
  53.             if (Config.DEBUG)
  54. Index: java/net/sf/l2j/gameserver/model/zone/ZoneId.java
  55. ===================================================================
  56. --- java/net/sf/l2j/gameserver/model/zone/ZoneId.java   (revision 38)
  57. +++ java/net/sf/l2j/gameserver/model/zone/ZoneId.java   (working copy)
  58. @@ -38,7 +38,8 @@
  59.     DANGER_AREA(15),
  60.     CAST_ON_ARTIFACT(16),
  61.     NO_RESTART(17),
  62. -   SCRIPT(18);
  63. +   SCRIPT(18),
  64. +   MULTIFUNCTION(19);
  65.    
  66.     private final int _id;
  67.    
  68. Index: java/net/sf/l2j/gameserver/network/clientpackets/SetPrivateStoreListBuy.java
  69. ===================================================================
  70. --- java/net/sf/l2j/gameserver/network/clientpackets/SetPrivateStoreListBuy.java    (revision 37)
  71. +++ java/net/sf/l2j/gameserver/network/clientpackets/SetPrivateStoreListBuy.java    (working copy)
  72. @@ -18,6 +18,7 @@
  73.  import net.sf.l2j.gameserver.model.TradeList;
  74.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  75.  import net.sf.l2j.gameserver.model.zone.ZoneId;
  76. +import net.sf.l2j.gameserver.model.zone.type.L2MultiFunctionZone;
  77.  import net.sf.l2j.gameserver.network.SystemMessageId;
  78.  import net.sf.l2j.gameserver.network.serverpackets.PrivateStoreManageListBuy;
  79.  import net.sf.l2j.gameserver.network.serverpackets.PrivateStoreMsgBuy;
  80. @@ -82,6 +83,13 @@
  81.             return;
  82.         }
  83.        
  84. +       if (player.isInsideZone(ZoneId.MULTIFUNCTION) && !L2MultiFunctionZone.store_zone)
  85. +       {
  86. +           player.sendPacket(new PrivateStoreManageListBuy(player));
  87. +           player.sendMessage("You cannot start store while inside Multifunction zone.");
  88. +           return;
  89. +       }
  90. +      
  91.         if (player.isInsideZone(ZoneId.NO_STORE))
  92.         {
  93.             player.sendPacket(SystemMessageId.NO_PRIVATE_STORE_HERE);
  94. Index: java/net/sf/l2j/gameserver/network/clientpackets/SetPrivateStoreListSell.java
  95. ===================================================================
  96. --- java/net/sf/l2j/gameserver/network/clientpackets/SetPrivateStoreListSell.java   (revision 37)
  97. +++ java/net/sf/l2j/gameserver/network/clientpackets/SetPrivateStoreListSell.java   (working copy)
  98. @@ -18,6 +18,7 @@
  99.  import net.sf.l2j.gameserver.model.TradeList;
  100.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  101.  import net.sf.l2j.gameserver.model.zone.ZoneId;
  102. +import net.sf.l2j.gameserver.model.zone.type.L2MultiFunctionZone;
  103.  import net.sf.l2j.gameserver.network.SystemMessageId;
  104.  import net.sf.l2j.gameserver.network.serverpackets.PrivateStoreManageListSell;
  105.  import net.sf.l2j.gameserver.network.serverpackets.PrivateStoreMsgSell;
  106. @@ -98,6 +99,13 @@
  107.             return;
  108.         }
  109.        
  110. +       if (player.isInsideZone(ZoneId.MULTIFUNCTION) && !L2MultiFunctionZone.store_zone)
  111. +       {
  112. +           player.sendPacket(new PrivateStoreManageListSell(player, _packageSale));
  113. +           player.sendMessage("You cannot start store while inside Multifunction zone.");
  114. +           return;
  115. +       }
  116. +      
  117.         TradeList tradeList = player.getSellList();
  118.         tradeList.clear();
  119.         tradeList.setPackaged(_packageSale);
  120. Index: java/net/sf/l2j/gameserver/network/serverpackets/Die.java
  121. ===================================================================
  122. --- java/net/sf/l2j/gameserver/network/serverpackets/Die.java   (revision 37)
  123. +++ java/net/sf/l2j/gameserver/network/serverpackets/Die.java   (working copy)
  124. @@ -24,6 +24,8 @@
  125.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  126.  import net.sf.l2j.gameserver.model.entity.Castle;
  127.  import net.sf.l2j.gameserver.model.entity.debian.LuckyChests;
  128. +import net.sf.l2j.gameserver.model.zone.ZoneId;
  129. +import net.sf.l2j.gameserver.model.zone.type.L2MultiFunctionZone;
  130.  
  131.  public class Die extends L2GameServerPacket
  132.  {
  133. @@ -33,6 +35,8 @@
  134.     private L2AccessLevel _access = AccessLevels._userAccessLevel;
  135.     private L2Clan _clan;
  136.     L2Character _activeChar;
  137. +   @SuppressWarnings("unused")
  138. +   private boolean _canTeleport;
  139.     private boolean inLCEvent = false;
  140.    
  141.     public Die(L2Character cha)
  142. @@ -43,6 +47,7 @@
  143.             L2PcInstance player = (L2PcInstance) cha;
  144.             _access = player.getAccessLevel();
  145.             _clan = player.getClan();
  146. +           _canTeleport = !(player.isInsideZone(ZoneId.MULTIFUNCTION) && L2MultiFunctionZone.revive);
  147.            
  148.             if (LuckyChests._players.keySet().contains(player))
  149.             {
  150. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  151. ===================================================================
  152. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (revision 38)
  153. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
  154. @@ -145,6 +145,7 @@
  155.  import net.sf.l2j.gameserver.model.quest.QuestState;
  156.  import net.sf.l2j.gameserver.model.zone.ZoneId;
  157.  import net.sf.l2j.gameserver.model.zone.type.L2BossZone;
  158. +import net.sf.l2j.gameserver.model.zone.type.L2MultiFunctionZone;
  159.  import net.sf.l2j.gameserver.network.L2GameClient;
  160.  import net.sf.l2j.gameserver.network.SystemMessageId;
  161.  import net.sf.l2j.gameserver.network.serverpackets.AbstractNpcInfo;
  162. @@ -282,6 +283,8 @@
  163.         lastVoteTime = val;
  164.     }
  165.    
  166. +   public int counter = 0;
  167. +  
  168.     // Character Skill SQL String Definitions:
  169.     private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
  170.     private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
  171. @@ -4539,6 +4542,8 @@
  172.         // Add karma to attacker and increase its PK counter
  173.         setPvpKills(getPvpKills() + 1);
  174.        
  175. +       L2MultiFunctionZone.givereward(this);
  176. +      
  177.         ColorSystem.getInstance().checkForPvpColors(this);
  178.        
  179.         if (Config.ALLOW_KILLING_SPREE)
  180. Index: java/net/sf/l2j/gameserver/model/itemcontainer/ItemContainer.java
  181. ===================================================================
  182. --- java/net/sf/l2j/gameserver/model/itemcontainer/ItemContainer.java   (revision 37)
  183. +++ java/net/sf/l2j/gameserver/model/itemcontainer/ItemContainer.java   (working copy)
  184. @@ -42,7 +42,7 @@
  185.  {
  186.     protected static final Logger _log = Logger.getLogger(ItemContainer.class.getName());
  187.    
  188. -   protected final List<L2ItemInstance> _items;
  189. +   public final List<L2ItemInstance> _items;
  190.    
  191.     protected ItemContainer()
  192.     {
  193. Index: java/net/sf/l2j/gameserver/model/zone/type/L2MultiFunctionZone.java
  194. ===================================================================
  195. --- java/net/sf/l2j/gameserver/model/zone/type/L2MultiFunctionZone.java (revision 0)
  196. +++ java/net/sf/l2j/gameserver/model/zone/type/L2MultiFunctionZone.java (working copy)
  197. @@ -0,0 +1,317 @@
  198. +package net.sf.l2j.gameserver.model.zone.type;
  199. +
  200. +import java.io.File;
  201. +import java.io.FileInputStream;
  202. +import java.util.ArrayList;
  203. +import java.util.List;
  204. +import java.util.Properties;
  205. +
  206. +import net.sf.l2j.gameserver.ThreadPoolManager;
  207. +import net.sf.l2j.gameserver.datatables.SkillTable;
  208. +import net.sf.l2j.gameserver.model.L2ItemInstance;
  209. +import net.sf.l2j.gameserver.model.L2Skill;
  210. +import net.sf.l2j.gameserver.model.actor.L2Character;
  211. +import net.sf.l2j.gameserver.model.actor.L2Summon;
  212. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  213. +import net.sf.l2j.gameserver.model.itemcontainer.PcInventory;
  214. +import net.sf.l2j.gameserver.model.zone.L2ZoneType;
  215. +import net.sf.l2j.gameserver.model.zone.ZoneId;
  216. +import net.sf.l2j.util.Rnd;
  217. +
  218. +/**
  219. + *
  220. + * @author Wyatt
  221. + * @version 1.3
  222. + *
  223. + */
  224. +
  225. +public class L2MultiFunctionZone extends L2ZoneType
  226. +{
  227. +      
  228. +       public L2MultiFunctionZone(int id)
  229. +       {
  230. +               super(id);
  231. +               loadConfigs();
  232. +       }
  233. +      
  234. +       public static boolean pvp_enabled, restart_zone, store_zone, logout_zone, revive_noblesse, revive_heal, revive, remove_buffs, remove_pets, give_noblesse;
  235. +       static int radius, enchant, revive_delay;
  236. +       static int[][] spawn_loc;
  237. +       L2Skill noblesse = SkillTable.getInstance().getInfo(1323, 1);
  238. +       @SuppressWarnings("unused")
  239. +   private static List<String> items = new ArrayList<String>();
  240. +       @SuppressWarnings("unused")
  241. +   private static List<String> classes = new ArrayList<String>(), grades = new ArrayList<String>();
  242. +       @SuppressWarnings("unused")
  243. +   public static List<int[]> rewards = new ArrayList<int[]>();
  244. +       static String[] gradeNames = {"","D","C","B","A","S","S80","S84"};
  245. +      
  246. +      
  247. +       @Override
  248. +       protected void onEnter(L2Character character)
  249. +       {
  250. +               character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true);
  251. +               character.setInsideZone(ZoneId.MULTIFUNCTION, true);
  252. +              
  253. +               if (character instanceof L2PcInstance)
  254. +               {
  255. +                       L2PcInstance activeChar = ((L2PcInstance) character);
  256. +                       if(classes != null && classes.contains(""+activeChar.getClassId().getId()))
  257. +                       {
  258. +                               activeChar.teleToLocation(83597,147888,-3405, 0);
  259. +                               activeChar.sendMessage("Your class is not allowed in the MultiFunction zone.");
  260. +                               return;
  261. +                       }
  262. +                      
  263. +                       for(L2ItemInstance o : activeChar.getInventory()._items)
  264. +                       {
  265. +                               if(o.isEquipable() && o.isEquipped() && !checkItem(o))
  266. +                               {
  267. +                                       int slot = activeChar.getInventory().getSlotFromItem(o);
  268. +                                       activeChar.getInventory().unEquipItemInBodySlotAndRecord(slot);
  269. +                                       activeChar.sendMessage(o.getItemName()+" unequiped because is not allowed inside this zone.");
  270. +                               }
  271. +                       }
  272. +                       activeChar.sendMessage("You entered in a MultiFunction zone.");
  273. +                       clear(activeChar);
  274. +                       if(give_noblesse)
  275. +                       noblesse.getEffects(activeChar, activeChar);  
  276. +                       if(pvp_enabled && activeChar.getPvpFlag() == 0)
  277. +                               activeChar.updatePvPFlag(1);                  
  278. +               }
  279. +       }
  280. +      
  281. +       @Override
  282. +       protected void onExit(L2Character character)
  283. +       {
  284. +               character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false);
  285. +               character.setInsideZone(ZoneId.MULTIFUNCTION, false);
  286. +              
  287. +               if (character instanceof L2PcInstance)
  288. +               {
  289. +                       L2PcInstance activeChar = ((L2PcInstance) character);
  290. +                       activeChar.sendMessage("You left from a MultiFunction zone.");
  291. +                      
  292. +                       if(pvp_enabled)
  293. +                               activeChar.setPvpFlag(0);  
  294. +               }
  295. +       }
  296. +      
  297. +       @Override
  298. +       public void onDieInside(final L2Character character)
  299. +       {
  300. +               if (character instanceof L2PcInstance)
  301. +           {
  302. +                       final L2PcInstance activeChar = ((L2PcInstance) character);
  303. +                       if(revive)
  304. +                       {
  305. +                               ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
  306. +                               {
  307. +                               @Override
  308. +                                       public void run()
  309. +                                       {
  310. +                                       activeChar.doRevive();
  311. +                                       heal(activeChar);
  312. +                                       int[] loc = spawn_loc[Rnd.get(spawn_loc.length)];
  313. +                                       activeChar.teleToLocation(loc[0]+Rnd.get(-radius,radius), loc[1]+Rnd.get(-radius,radius), loc[2], 0);
  314. +                                       }
  315. +                               },revive_delay*1000);  
  316. +                       }
  317. +           }
  318. +       }
  319. +
  320. +       @Override
  321. +       public void onReviveInside(L2Character character)
  322. +       {      
  323. +               if (character instanceof L2PcInstance)
  324. +           {
  325. +                       L2PcInstance activeChar = ((L2PcInstance) character);
  326. +                       if(revive_noblesse)
  327. +                               noblesse.getEffects(activeChar, activeChar);  
  328. +                       if(revive_heal)
  329. +                               heal(activeChar);
  330. +           }
  331. +       }
  332. +      
  333. +       static void heal(L2PcInstance activeChar)
  334. +       {
  335. +               activeChar.setCurrentHp(activeChar.getMaxHp());
  336. +               activeChar.setCurrentCp(activeChar.getMaxCp());
  337. +               activeChar.setCurrentMp(activeChar.getMaxMp());
  338. +       }
  339. +      
  340. +       private static void clear (L2PcInstance player)
  341. +       {
  342. +               if(remove_buffs)
  343. +               {
  344. +                       player.stopAllEffects();
  345. +                       if(remove_pets)
  346. +                       {
  347. +                               L2Summon pet = player.getPet();
  348. +                               if(pet!= null)
  349. +                               {
  350. +                                       pet.stopAllEffects();
  351. +                                       pet.unSummon(player);  
  352. +                               }      
  353. +                       }
  354. +               }
  355. +               else
  356. +               {
  357. +                       if(remove_pets)
  358. +                       {
  359. +                               L2Summon pet = player.getPet();
  360. +                               if(pet!= null)
  361. +                               {
  362. +                                       pet.unSummon(player);  
  363. +                               }      
  364. +                       }
  365. +               }
  366. +       }
  367. +      
  368. +       public static void givereward(L2PcInstance player)
  369. +       {
  370. +               if(player.isInsideZone(ZoneId.MULTIFUNCTION))
  371. +               {
  372. +                       for (int[] reward : rewards)
  373. +                       {
  374. +                               PcInventory inv = player.getInventory();
  375. +                               inv.addItem("Custom Reward", reward[0], reward[1], player,  player);  
  376. +                       }
  377. +               }
  378. +       }
  379. +      
  380. +       public static boolean checkItem (L2ItemInstance item)
  381. +       {
  382. +               int o = item.getItem().getCrystalType();
  383. +               int e = item.getEnchantLevel();
  384. +              
  385. +               if(enchant != 0 && e >= enchant)
  386. +               {
  387. +                       return false;
  388. +               }
  389. +              
  390. +               if(grades.contains(gradeNames[o]))
  391. +                       return false;
  392. +
  393. +               if(items != null && items.contains(""+item.getItemId()))
  394. +                       return false;
  395. +               return true;
  396. +       }
  397. +      
  398. +       private static void loadConfigs()
  399. +       {
  400. +               try
  401. +               {
  402. +                       Properties prop = new Properties();
  403. +                       prop.load(new FileInputStream(new File("./config/MultiFunctionZone.properties")));
  404. +                       pvp_enabled = Boolean.parseBoolean(prop.getProperty("EnablePvP", "False"));
  405. +                       spawn_loc = parseItemsList(prop.getProperty("SpawnLoc", "150111,144740,-12248"));
  406. +                       revive_delay = Integer.parseInt(prop.getProperty("ReviveDelay", "10"));
  407. +                       if(revive_delay != 0)
  408. +                       {
  409. +                               revive = true;
  410. +                       }
  411. +                       give_noblesse = Boolean.parseBoolean(prop.getProperty("GiveNoblesse", "False"));
  412. +                       String[] propertySplit = prop.getProperty("Items", "").split(",");
  413. +                       if (propertySplit.length != 0)
  414. +                       {
  415. +                               for(String i : propertySplit)
  416. +                               {
  417. +                                       items.add(i);
  418. +                               }
  419. +                       }
  420. +                       propertySplit = prop.getProperty("Grades", "").split(",");
  421. +                       if (propertySplit.length != 0)
  422. +                       {
  423. +                               for(String i : propertySplit)
  424. +                               {
  425. +                                       if(i.equals("D") || i.equals("C") || i.equals("B") || i.equals("A") || i.equals("S") || i.equals("S80") || i.equals("S84"))
  426. +                                               grades.add(i);
  427. +                               }
  428. +                       }
  429. +                       propertySplit = prop.getProperty("Classes", "").split(",");
  430. +                       if (propertySplit.length != 0)
  431. +                       {
  432. +                               for(String i : propertySplit)
  433. +                               {
  434. +                                       classes.add(i);
  435. +                               }
  436. +                       }
  437. +                       radius =  Integer.parseInt(prop.getProperty("RespawnRadius", "500"));
  438. +                       enchant =  Integer.parseInt(prop.getProperty("Enchant", "0"));
  439. +                       remove_buffs = Boolean.parseBoolean(prop.getProperty("RemoveBuffs", "False"));
  440. +                       remove_pets = Boolean.parseBoolean(prop.getProperty("RemovePets", "False"));
  441. +                       restart_zone = Boolean.parseBoolean(prop.getProperty("NoRestartZone", "False"));
  442. +                       store_zone = Boolean.parseBoolean(prop.getProperty("NoStoreZone", "False"));
  443. +                       logout_zone = Boolean.parseBoolean(prop.getProperty("NoLogoutZone", "False"));
  444. +                       revive_noblesse = Boolean.parseBoolean(prop.getProperty("ReviveNoblesse", "False"));
  445. +                       revive_heal = Boolean.parseBoolean(prop.getProperty("ReviveHeal", "False"));  
  446. +                       propertySplit = prop.getProperty("Rewards", "57,100000").split(";");
  447. +                       for (String reward : propertySplit)
  448. +                       {
  449. +                               String[] rewardSplit = reward.split(",");
  450. +                               if (rewardSplit.length == 2)
  451. +                               {
  452. +                                       try
  453. +                                       {
  454. +                                               rewards.add(new int[]{Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1])});
  455. +                                       }
  456. +                                       catch (NumberFormatException nfe)
  457. +                                       {
  458. +                                       }
  459. +                               }
  460. +                       }
  461. +               }
  462. +               catch(Exception e)
  463. +               {
  464. +                       e.printStackTrace();
  465. +               }
  466. +       }      
  467. +      
  468. +       private static int[][] parseItemsList(String line)
  469. +       {
  470. +               final String[] propertySplit = line.split(";");
  471. +               if (propertySplit.length == 0)
  472. +                       return null;
  473. +
  474. +               int i = 0;
  475. +               String[] valueSplit;
  476. +               final int[][] result = new int[propertySplit.length][];
  477. +               for (String value : propertySplit)
  478. +               {
  479. +                       valueSplit = value.split(",");
  480. +                       if (valueSplit.length != 3)
  481. +                       {
  482. +                               return null;
  483. +                       }
  484. +
  485. +                       result[i] = new int[3];
  486. +                       try
  487. +                       {
  488. +                               result[i][0] = Integer.parseInt(valueSplit[0]);
  489. +                       }
  490. +                       catch (NumberFormatException e)
  491. +                       {
  492. +                               return null;
  493. +                       }
  494. +                       try
  495. +                       {
  496. +                               result[i][1] = Integer.parseInt(valueSplit[1]);
  497. +                       }
  498. +                       catch (NumberFormatException e)
  499. +                       {
  500. +                               return null;
  501. +                       }
  502. +                       try
  503. +                       {
  504. +                               result[i][2] = Integer.parseInt(valueSplit[2]);
  505. +                       }
  506. +                       catch (NumberFormatException e)
  507. +                       {
  508. +                               return null;
  509. +                       }
  510. +                       i++;
  511. +               }
  512. +               return result;
  513. +       }
  514. +}
  515. \ No newline at end of file
  516. Index: java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java
  517. ===================================================================
  518. --- java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java   (revision 37)
  519. +++ java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java   (working copy)
  520. @@ -25,6 +25,8 @@
  521.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  522.  import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
  523.  import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
  524. +import net.sf.l2j.gameserver.model.zone.ZoneId;
  525. +import net.sf.l2j.gameserver.model.zone.type.L2MultiFunctionZone;
  526.  import net.sf.l2j.gameserver.network.SystemMessageId;
  527.  import net.sf.l2j.gameserver.network.serverpackets.ItemList;
  528.  import net.sf.l2j.gameserver.network.serverpackets.PetItemList;
  529. @@ -96,6 +98,12 @@
  530.         if (item == null)
  531.             return;
  532.        
  533. +       if(getClient().getActiveChar().isInsideZone(ZoneId.MULTIFUNCTION) && !L2MultiFunctionZone.checkItem(item))
  534. +       {
  535. +           getClient().getActiveChar().sendMessage("You cannot use "+item.getName()+" inside this zone.");
  536. +           return;
  537. +       }
  538. +      
  539.         if (item.getItem().getType2() == L2Item.TYPE2_QUEST)
  540.         {
  541.             activeChar.sendPacket(SystemMessageId.CANNOT_USE_QUEST_ITEMS);
  542. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
  543. ===================================================================
  544. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java    (revision 37)
  545. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java    (working copy)
  546. @@ -21,6 +21,7 @@
  547.  import net.sf.l2j.gameserver.model.entity.debian.LMS;
  548.  import net.sf.l2j.gameserver.model.entity.debian.LuckyChests;
  549.  import net.sf.l2j.gameserver.model.zone.ZoneId;
  550. +import net.sf.l2j.gameserver.model.zone.type.L2MultiFunctionZone;
  551.  import net.sf.l2j.gameserver.network.L2GameClient;
  552.  import net.sf.l2j.gameserver.network.L2GameClient.GameClientState;
  553.  import net.sf.l2j.gameserver.network.SystemMessageId;
  554. @@ -71,6 +72,13 @@
  555.             return;
  556.         }
  557.        
  558. +       if(player.isInsideZone(ZoneId.MULTIFUNCTION) && !L2MultiFunctionZone.restart_zone)
  559. +       {
  560. +           player.sendMessage("You cannot restart while inside a Multifunction zone.");
  561. +           sendPacket(RestartResponse.valueOf(false));
  562. +           return;
  563. +       }
  564. +      
  565.         if (player.isLocked())
  566.         {
  567.             sendPacket(RestartResponse.valueOf(false));
  568. Index: config/MultiFunctionZone.properties
  569. ===================================================================
  570. --- config/MultiFunctionZone.properties (revision 0)
  571. +++ config/MultiFunctionZone.properties (working copy)
  572. @@ -0,0 +1,60 @@
  573. +# ---------------------------------------------------------------------------
  574. +# MultiFunctionZone - custom addon for your server
  575. +# ---------------------------------------------------------------------------
  576. +# This option will turn on PvP flag to all people when entering to the zone
  577. +EnablePvP = True
  578. +
  579. +# If set to false, zone will be no-restart zone
  580. +NoRestartZone = False
  581. +
  582. +# If set to false, zone will be no-logout zone
  583. +NoLogoutZone = False
  584. +
  585. +# If set to false, zone will be no-store zone
  586. +NoStoreZone = False
  587. +
  588. +# Give noblesse after revive?
  589. +ReviveNoblesse = False
  590. +
  591. +# Heal after revive?
  592. +ReviveHeal = False
  593. +
  594. +# Delay, in seconds, to wait before revive
  595. +# 0 to disable
  596. +ReviveDelay = 10
  597. +
  598. +# Set the spawn points where players will be teleported on revive, if enabled
  599. +# example:150111,144740,-12248;143665,144418,-12022;144443,147685,-12139
  600. +SpawnLoc = 150111,144740,-12248;143665,144418,-12022;144443,147685,-12139
  601. +
  602. +# Random respawn radius
  603. +RespawnRadius = 500
  604. +
  605. +# If set to true, players will take noblesse blessing when entering
  606. +GiveNoblesse = True
  607. +
  608. +# Remove buffs when entering to the zone
  609. +RemoveBuffs = False
  610. +
  611. +# Remove pets when entering to the zone
  612. +RemovePets = False
  613. +
  614. +# Special rewards when hunting inside this zone
  615. +# example: 57,100000;14720,1
  616. +Rewards = 57,100000;14720,1
  617. +
  618. +# List of Items(id's) that won't be usable inside this area and also will be unequiped when entering
  619. +# (armor, weapons, scrolls, potions, etc), example: 728,7575, 6383, 1538
  620. +Items = 728,7575,6383,1538
  621. +
  622. +# List of Grades that won't be usable inside this area and also will be unequiped when entering
  623. +# example: D,C,B,A,S,S80,S84
  624. +Grades = C,B,A
  625. +
  626. +# Items with this enchant or more won't be usable inside this area and also will be unequiped when entering
  627. +# 0 to disable
  628. +Enchant = 0
  629. +
  630. +# Players with one of that classes won't be able to enter to the zone
  631. +# example: 93,85,12
  632. +Classes = 92
  633. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement