chr2trance

MultiFunctionZone for aCis

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