Advertisement
LIONN

Enchant Zone

Feb 13th, 2013
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.17 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jFrozen_DataPack
  3. Index: data/zones/zone.xml
  4. ===================================================================
  5. --- data/zones/zone.xml (revision 984)
  6. +++ data/zones/zone.xml (working copy)
  7. @@ -4488,5 +4488,9 @@
  8.         <node X="-85746" Y="-46374" />
  9.         <node X="-85870" Y="-46233" />
  10.         <node X="-86090" Y="-46061" />
  11. -   </zone>
  12. +   </zone>
  13. +   <zone type="EnchantZone" shape="Cuboid" minZ="-3490" maxZ="-3489">
  14. +       <node X="45500" Y="183500" />
  15. +       <node X="50400" Y="188000" />
  16. +   </zone>
  17.  </list>
  18. \ No newline at end of file
  19. #P L2jFrozen_GameServer
  20. Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java
  21. ===================================================================
  22. --- head-src/com/l2jfrozen/gameserver/model/L2Character.java    (revision 984)
  23. +++ head-src/com/l2jfrozen/gameserver/model/L2Character.java    (working copy)
  24. @@ -341,6 +341,9 @@
  25.     /** The Constant ZONE_DANGERAREA. */
  26.     public static final int ZONE_DANGERAREA = 16384;
  27.  
  28. +   /** The Constant ZONE_ENCHANT. */
  29. +   public static final int ZONE_ENCHANT = 32768;
  30. +
  31.     /** The _current zones. */
  32.     private int _currentZones = 0;
  33.  
  34. Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java
  35. ===================================================================
  36. --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (revision 984)
  37. +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (working copy)
  38. @@ -21,6 +21,7 @@
  39.  
  40.  import com.l2jfrozen.Config;
  41.  import com.l2jfrozen.gameserver.model.Inventory;
  42. +import com.l2jfrozen.gameserver.model.L2Character;
  43.  import com.l2jfrozen.gameserver.model.L2World;
  44.  import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
  45.  import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  46. @@ -90,6 +91,13 @@
  47.         if(activeChar == null || _objectId == 0)
  48.             return;
  49.  
  50. +       if (!activeChar.isInsideZone(L2Character.ZONE_ENCHANT))
  51. +       {
  52. +           activeChar.sendPacket(new SystemMessage(SystemMessageId.S1_S2).addString("You cannot enchant in this area."));
  53. +           activeChar.setActiveEnchantItem(null);
  54. +           return;
  55. +       }
  56. +
  57.         if(activeChar.getActiveTradeList() != null)
  58.         {
  59.             activeChar.cancelActiveTrade();
  60. Index: head-src/com/l2jfrozen/gameserver/model/zone/type/L2EnchantZone.java
  61. ===================================================================
  62. --- head-src/com/l2jfrozen/gameserver/model/zone/type/L2EnchantZone.java    (revision 0)
  63. +++ head-src/com/l2jfrozen/gameserver/model/zone/type/L2EnchantZone.java    (working copy)
  64. @@ -0,0 +1,53 @@
  65. +/* This program is free software; you can redistribute it and/or modify
  66. + * it under the terms of the GNU General Public License as published by
  67. + * the Free Software Foundation; either version 2, or (at your option)
  68. + * any later version.
  69. + *
  70. + * This program is distributed in the hope that it will be useful,
  71. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  72. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  73. + * GNU General Public License for more details.
  74. + *
  75. + * You should have received a copy of the GNU General Public License
  76. + * along with this program; if not, write to the Free Software
  77. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  78. + * 02111-1307, USA.
  79. + *
  80. + * http://www.gnu.org/copyleft/gpl.html
  81. + */
  82. +package com.l2jfrozen.gameserver.model.zone.type;
  83. +
  84. +import com.l2jfrozen.gameserver.model.L2Character;
  85. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  86. +import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
  87. +
  88. +public class L2EnchantZone extends L2ZoneType
  89. +{
  90. +   public L2EnchantZone(final int id)
  91. +   {
  92. +       super(id);
  93. +   }
  94. +
  95. +   @Override
  96. +   protected void onEnter(final L2Character character)
  97. +   {
  98. +       if (character instanceof L2PcInstance)
  99. +       {
  100. +           character.setInsideZone(L2Character.ZONE_ENCHANT, true);
  101. +       }
  102. +   }
  103. +
  104. +   @Override
  105. +   protected void onExit(final L2Character character)
  106. +   {
  107. +       if (character instanceof L2PcInstance)
  108. +       {
  109. +           character.setInsideZone(L2Character.ZONE_ENCHANT, false);
  110. +       }
  111. +   }
  112. +
  113. +   @Override
  114. +   public void onDieInside(final L2Character character) {}
  115. +   @Override
  116. +   public void onReviveInside(final L2Character character) {}
  117. +}
  118. Index: head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java
  119. ===================================================================
  120. --- head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java  (revision 984)
  121. +++ head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java  (working copy)
  122. @@ -58,6 +58,7 @@
  123.  import com.l2jfrozen.gameserver.model.zone.type.L2FortZone;
  124.  import com.l2jfrozen.gameserver.model.zone.type.L2JailZone;
  125.  import com.l2jfrozen.gameserver.model.zone.type.L2MotherTreeZone;
  126. +import com.l2jfrozen.gameserver.model.zone.type.L2EnchantZone;
  127.  import com.l2jfrozen.gameserver.model.zone.type.L2NoHqZone;
  128.  import com.l2jfrozen.gameserver.model.zone.type.L2NoLandingZone;
  129.  import com.l2jfrozen.gameserver.model.zone.type.L2OlympiadStadiumZone;
  130. @@ -278,6 +279,10 @@
  131.                                 {
  132.                                     temp = new L2SwampZone(zoneId);
  133.                                 }
  134. +                               else if(zoneType.equals("EnchantZone"))
  135. +                               {
  136. +                                   temp = new L2EnchantZone(zoneId);
  137. +                               }
  138.  
  139.                                 // Check for unknown type
  140.                                 if(temp == null)
  141. Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminZone.java
  142. ===================================================================
  143. --- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminZone.java   (revision 984)
  144. +++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminZone.java   (working copy)
  145. @@ -88,6 +88,15 @@
  146.                 activeChar.sendMessage("This is NOT a no landing zone.");
  147.             }
  148.  
  149. +           if(!activeChar.isInsideZone(L2Character.ZONE_ENCHANT))
  150. +           {
  151. +               activeChar.sendMessage("This is a enchant zone.");
  152. +           }
  153. +           else
  154. +           {
  155. +               activeChar.sendMessage("This is NOT a enchant zone.");
  156. +           }
  157. +
  158.             activeChar.sendMessage("MapRegion: x:" + MapRegionTable.getInstance().getMapRegionX(activeChar.getX()) + " y:" + MapRegionTable.getInstance().getMapRegionX(activeChar.getY()));
  159.  
  160.             activeChar.sendMessage("Closest Town: " + MapRegionTable.getInstance().getClosestTownName(activeChar));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement