JVBarbosa

PvP Custom Zone

Jun 5th, 2016
411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 13.06 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jFrozen_GameServer
  3. Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java
  4. ===================================================================
  5. --- head-src/com/l2jfrozen/gameserver/model/L2Character.java    (revision 1118)
  6. +++ head-src/com/l2jfrozen/gameserver/model/L2Character.java    (working copy)
  7. @@ -355,6 +355,9 @@
  8.     /** The Constant ZONE_NOSTORE. */
  9.     public static final int ZONE_NOSTORE = 32768;
  10.    
  11. +   /** The Constant ZONE_PVP_CUSTOM. */
  12. +   public static final int ZONE_PVP_CUSTOM = 65536;
  13. +  
  14.     /** The _current zones. */
  15.     private int _currentZones = 0;
  16.    
  17. Index: head-src/com/l2jfrozen/Config.java
  18. ===================================================================
  19. --- head-src/com/l2jfrozen/Config.java  (revision 1118)
  20. +++ head-src/com/l2jfrozen/Config.java  (working copy)
  21. @@ -35,10 +35,12 @@
  22.  import java.net.UnknownHostException;
  23.  import java.util.ArrayList;
  24.  import java.util.HashMap;
  25. +import java.util.HashSet;
  26.  import java.util.List;
  27.  import java.util.Map;
  28.  import java.util.Properties;
  29.  import java.util.Random;
  30. +import java.util.Set;
  31.  
  32.  import javolution.text.TypeFormat;
  33.  import javolution.util.FastList;
  34. @@ -2428,6 +2430,21 @@
  35.     public static String PVP1_CUSTOM_MESSAGE;
  36.     public static String PVP2_CUSTOM_MESSAGE;
  37.    
  38. +   /** Respawn PvP Custom */
  39. +   public static boolean RESPAWN_PVP_CUSTOM_ENABLE;
  40. +   public static int RESPAWN_PVP_CUSTOM_1_X;
  41. +   public static int RESPAWN_PVP_CUSTOM_1_Y;
  42. +   public static int RESPAWN_PVP_CUSTOM_1_Z;
  43. +   public static int RESPAWN_PVP_CUSTOM_2_X;
  44. +   public static int RESPAWN_PVP_CUSTOM_2_Y;
  45. +   public static int RESPAWN_PVP_CUSTOM_2_Z;
  46. +   public static int RESPAWN_PVP_CUSTOM_3_X;
  47. +   public static int RESPAWN_PVP_CUSTOM_3_Y;
  48. +   public static int RESPAWN_PVP_CUSTOM_3_Z;
  49. +   public static int DELAY_RESPAWN_PVP_CUSTOM;
  50. +   public static String BLOCK_SKILLS_PVP_CUSTOM;
  51. +   public static Set<Integer> BLOCK_SKILLS_PVP_CUSTOM_SKILL_ID;
  52. +  
  53.     // ============================================================
  54.     public static void loadL2JFrozenConfig()
  55.     {
  56. @@ -2546,6 +2563,24 @@
  57.             FARM2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!");
  58.             PVP1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!");
  59.             PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");
  60. +          
  61. +           /** Respawn PvP Custom */
  62. +           RESPAWN_PVP_CUSTOM_ENABLE = Boolean.parseBoolean(L2JFrozenSettings.getProperty("RespawnPvPCustomEnable", "False"));
  63. +           RESPAWN_PVP_CUSTOM_1_X = Integer.parseInt(L2JFrozenSettings.getProperty("RespawnPvPCustomX1", ""));
  64. +           RESPAWN_PVP_CUSTOM_1_Y = Integer.parseInt(L2JFrozenSettings.getProperty("RespawnPvPCustomY1", ""));
  65. +           RESPAWN_PVP_CUSTOM_1_Z = Integer.parseInt(L2JFrozenSettings.getProperty("RespawnPvPCustomZ1", ""));
  66. +           RESPAWN_PVP_CUSTOM_2_X = Integer.parseInt(L2JFrozenSettings.getProperty("RespawnPvPCustomX2", ""));
  67. +           RESPAWN_PVP_CUSTOM_2_Y = Integer.parseInt(L2JFrozenSettings.getProperty("RespawnPvPCustomY2", ""));
  68. +           RESPAWN_PVP_CUSTOM_2_Z = Integer.parseInt(L2JFrozenSettings.getProperty("RespawnPvPCustomZ2", ""));
  69. +           RESPAWN_PVP_CUSTOM_3_X = Integer.parseInt(L2JFrozenSettings.getProperty("RespawnPvPCustomX3", ""));
  70. +           RESPAWN_PVP_CUSTOM_3_Y = Integer.parseInt(L2JFrozenSettings.getProperty("RespawnPvPCustomY3", ""));
  71. +           RESPAWN_PVP_CUSTOM_3_Z = Integer.parseInt(L2JFrozenSettings.getProperty("RespawnPvPCustomZ3", ""));
  72. +           DELAY_RESPAWN_PVP_CUSTOM = Integer.parseInt(L2JFrozenSettings.getProperty("DelayRespawnPvpCustom", "3"));
  73. +           BLOCK_SKILLS_PVP_CUSTOM = L2JFrozenSettings.getProperty("PvpBlockSkillsId", "");
  74. +           BLOCK_SKILLS_PVP_CUSTOM_SKILL_ID = new HashSet<>();
  75. +           for(String skillId : BLOCK_SKILLS_PVP_CUSTOM.split(",")) {
  76. +               BLOCK_SKILLS_PVP_CUSTOM_SKILL_ID.add(Integer.parseInt(skillId));
  77. +           }
  78.         }
  79.         catch (final Exception e)
  80.         {
  81. Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java
  82. ===================================================================
  83. --- head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (revision 1118)
  84. +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (working copy)
  85. @@ -334,6 +334,11 @@
  86.        
  87.         activeChar.onPlayerEnter();
  88.        
  89. +       if(activeChar.isDead() && activeChar.isInsideZone(L2Character.ZONE_PVP_CUSTOM)) {
  90. +           activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
  91. +           activeChar.doRevive();
  92. +       }
  93. +      
  94.         if (Config.PCB_ENABLE)
  95.             activeChar.showPcBangWindow();
  96.        
  97. Index: head-src/com/l2jfrozen/gameserver/model/zone/type/L2PvpCustomZone.java
  98. ===================================================================
  99. --- head-src/com/l2jfrozen/gameserver/model/zone/type/L2PvpCustomZone.java  (revision 0)
  100. +++ head-src/com/l2jfrozen/gameserver/model/zone/type/L2PvpCustomZone.java  (working copy)
  101. @@ -0,0 +1,93 @@
  102. +package com.l2jfrozen.gameserver.model.zone.type;
  103. +
  104. +import java.util.Random;
  105. +
  106. +import com.l2jfrozen.Config;
  107. +import com.l2jfrozen.gameserver.model.L2Character;
  108. +import com.l2jfrozen.gameserver.model.L2Skill;
  109. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  110. +import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
  111. +import com.l2jfrozen.gameserver.network.SystemMessageId;
  112. +import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
  113. +import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  114. +
  115. +/**
  116. + * @author João Vitor Barbosa
  117. + */
  118. +public class L2PvpCustomZone extends L2ZoneType
  119. +{
  120. +   public L2PvpCustomZone(int id) {
  121. +       super(id);
  122. +   }
  123. +  
  124. +   @Override
  125. +   public void setParameter(final String name, final String value) {
  126. +       super.setParameter(name, value);
  127. +   }
  128. +  
  129. +   @Override
  130. +   protected void onEnter(final L2Character character) {
  131. +       if(character instanceof L2PcInstance) {
  132. +           character.setInsideZone(L2Character.ZONE_PVP_CUSTOM, true);
  133. +           ((L2PcInstance) character).sendPacket(new SystemMessage(SystemMessageId.ENTERED_COMBAT_ZONE));
  134. +           disableSkillPvpCustom(character);
  135. +           character.stopPvpRegTask();
  136. +           character.updatePvPFlag(1);
  137. +          
  138. +           if(character.isFlying() || ((L2PcInstance) character).isMounted()) {
  139. +               ((L2PcInstance) character).dismount();
  140. +           }
  141. +       }
  142. +      
  143. +   }
  144. +  
  145. +   @Override
  146. +   protected void onExit(final L2Character character) {
  147. +       if (character instanceof L2PcInstance) {
  148. +           character.setInsideZone(L2Character.ZONE_PVP_CUSTOM, false);
  149. +           ((L2PcInstance) character).sendPacket(new SystemMessage(SystemMessageId.LEFT_COMBAT_ZONE));
  150. +           enableSkillPvpCustom(character);
  151. +           character.updatePvPFlag(0);
  152. +       }
  153. +   }
  154. +  
  155. +   @Override
  156. +   protected void onDieInside(final L2Character character) {
  157. +       if(character instanceof L2PcInstance && Config.RESPAWN_PVP_CUSTOM_ENABLE) {
  158. +           ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() {
  159. +               @Override
  160. +               public void run() {
  161. +                   int random = new Random().nextInt(3);
  162. +                   if(random == 0) {
  163. +                       character.teleToLocation(Config.RESPAWN_PVP_CUSTOM_1_X, Config.RESPAWN_PVP_CUSTOM_1_Y, Config.RESPAWN_PVP_CUSTOM_1_Z);
  164. +                   } else if(random == 1) {
  165. +                       character.teleToLocation(Config.RESPAWN_PVP_CUSTOM_2_X, Config.RESPAWN_PVP_CUSTOM_2_Y, Config.RESPAWN_PVP_CUSTOM_2_Z);
  166. +                   } else {
  167. +                       character.teleToLocation(Config.RESPAWN_PVP_CUSTOM_3_X, Config.RESPAWN_PVP_CUSTOM_3_Y, Config.RESPAWN_PVP_CUSTOM_3_Z);
  168. +                   }
  169. +                   character.doRevive();
  170. +               }
  171. +           }, Config.DELAY_RESPAWN_PVP_CUSTOM * 1000);
  172. +       }
  173. +   }
  174. +  
  175. +   @Override
  176. +   protected void onReviveInside(final L2Character character) {
  177. +   }
  178. +      
  179. +    public static void disableSkillPvpCustom(L2Character player) {
  180. +        for (L2Skill skill : player.getAllSkills()) {
  181. +            if (Config.BLOCK_SKILLS_PVP_CUSTOM_SKILL_ID.contains(skill.getId())) {
  182. +                player.disableSkill(skill);
  183. +            }
  184. +        }
  185. +    }
  186. +  
  187. +    public static void enableSkillPvpCustom(L2Character player) {
  188. +        for (L2Skill skill : player.getAllSkills()) {
  189. +            if (Config.BLOCK_SKILLS_PVP_CUSTOM_SKILL_ID.contains(skill.getId())) {
  190. +                player.enableSkill(skill);
  191. +            }
  192. +        }
  193. +    }
  194. +}
  195. Index: head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java
  196. ===================================================================
  197. --- head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java  (revision 1118)
  198. +++ head-src/com/l2jfrozen/gameserver/datatables/xml/ZoneData.java  (working copy)
  199. @@ -56,6 +56,7 @@
  200.  import com.l2jfrozen.gameserver.model.zone.type.L2DerbyTrackZone;
  201.  import com.l2jfrozen.gameserver.model.zone.type.L2EffectZone;
  202.  import com.l2jfrozen.gameserver.model.zone.type.L2FishingZone;
  203.  import com.l2jfrozen.gameserver.model.zone.type.L2FortZone;
  204.  import com.l2jfrozen.gameserver.model.zone.type.L2JailZone;
  205.  import com.l2jfrozen.gameserver.model.zone.type.L2MotherTreeZone;
  206. @@ -65,6 +66,7 @@
  207.  import com.l2jfrozen.gameserver.model.zone.type.L2OlympiadStadiumZone;
  208.  import com.l2jfrozen.gameserver.model.zone.type.L2PeaceZone;
  209.  import com.l2jfrozen.gameserver.model.zone.type.L2PoisonZone;
  210. +import com.l2jfrozen.gameserver.model.zone.type.L2PvpCustomZone;
  211.  import com.l2jfrozen.gameserver.model.zone.type.L2SwampZone;
  212.  import com.l2jfrozen.gameserver.model.zone.type.L2TownZone;
  213.  import com.l2jfrozen.gameserver.model.zone.type.L2WaterZone;
  214. @@ -268,6 +270,12 @@
  215.                                     case "SwampZone":
  216.                                         temp = new L2SwampZone(zoneId);
  217.                                         break;
  218. +                                   case "PvpCustom":
  219. +                                       temp = new L2PvpCustomZone(zoneId);
  220. +                                       break;
  221.                                 }
  222.                                
  223.                                 // Check for unknown type
  224. Index: head-src/com/l2jfrozen/gameserver/network/serverpackets/Die.java
  225. ===================================================================
  226. --- head-src/com/l2jfrozen/gameserver/network/serverpackets/Die.java    (revision 1118)
  227. +++ head-src/com/l2jfrozen/gameserver/network/serverpackets/Die.java    (working copy)
  228. @@ -20,6 +20,7 @@
  229.   */
  230.  package com.l2jfrozen.gameserver.network.serverpackets;
  231.  
  232. +import com.l2jfrozen.Config;
  233.  import com.l2jfrozen.gameserver.datatables.AccessLevel;
  234.  import com.l2jfrozen.gameserver.datatables.sql.AccessLevels;
  235.  import com.l2jfrozen.gameserver.managers.CastleManager;
  236. @@ -60,7 +61,7 @@
  237.             final L2PcInstance player = (L2PcInstance) cha;
  238.             _access = player.getAccessLevel();
  239.             _clan = player.getClan();
  240. -           _canTeleport = !((TvT.is_started() && player._inEventTvT) || (DM.is_started() && player._inEventDM) || (CTF.is_started() && player._inEventCTF) || player.isInFunEvent() || player.isPendingRevive());
  241. +           _canTeleport = !((TvT.is_started() && player._inEventTvT) || (DM.is_started() && player._inEventDM) || (CTF.is_started() && player._inEventCTF) || player.isInFunEvent() || (player.isInsideZone(L2Character.ZONE_PVP_CUSTOM) && Config.RESPAWN_PVP_CUSTOM_ENABLE) || player.isPendingRevive());
  242.         }
  243.         _charObjId = cha.getObjectId();
  244.         _fake = !cha.isDead();
  245. Index: config/functions/l2jfrozen.properties
  246. ===================================================================
  247. --- config/functions/l2jfrozen.properties   (revision 1118)
  248. +++ config/functions/l2jfrozen.properties   (working copy)
  249. @@ -281,4 +281,28 @@
  250.  ProtectorSkillLevel = 13
  251.  ProtectorSkillTime = 600
  252.  # Npc Protector Message
  253. -ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
  254. \ No newline at end of file
  255. +ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
  256. +
  257. +#=============================================================
  258. +#          Zone PvP Custom - By João Vitor Barbosa             #
  259. +#=============================================================
  260. +RespawnPvPCustomEnable = True
  261. +#Delay Revive
  262. +DelayRespawnPvpCustom = 4
  263. +
  264. +#LOCS TO Antharas Lair
  265. +#Loc1
  266. +RespawnPvPCustomX1 = 130392
  267. +RespawnPvPCustomY1 = 114413
  268. +RespawnPvPCustomZ1 = -3727
  269. +#Loc2
  270. +RespawnPvPCustomX2 = 128295
  271. +RespawnPvPCustomY2 = 113304
  272. +RespawnPvPCustomZ2 = -3752
  273. +#Loc3
  274. +RespawnPvPCustomX3 = 127142
  275. +RespawnPvPCustomY3 = 115169
  276. +RespawnPvPCustomZ3 = -3752
  277. +
  278. +#Add Skill Id
  279. +PvpBlockSkillsId = 1417,1015
  280. \ No newline at end of file
  281.  
  282.  
  283. Data Pack:
  284.  
  285. Index: L2JFrozen_DataPack/data/zones/zone.xml
  286. ===================================================================
  287. --- L2JFrozen_DataPack/data/zones/zone.xml
  288. +++ L2JFrozen_DataPack/data/zones/zone.xml      
  289. @@ -293,3 +293,4 @@
  290.         <spawn X='9692' Y='-22160' Z='-3721'/>
  291.     </zone>
  292. +   <zone id='112081' type='PvpCustom' shape="NPoly" minZ="-4900" maxZ="-2500">
  293. +       <stat name='name' val='Pvp Custom - Antharas Lair'/>
  294. +   </zone>
  295. <!-- Mother trees -->
  296.     <zone id='11050' type='MotherTree' shape='Cuboid' minZ='-3500' maxZ='-3400'>
  297.         <stat name='affectedRace' val='1'/>
  298.        
  299.        
  300. SQL:
  301. INSERT INTO `zone_vertices` VALUES ('112081', '0', '148947', '118182');
  302. INSERT INTO `zone_vertices` VALUES ('112081', '1', '140505', '107592');
  303. INSERT INTO `zone_vertices` VALUES ('112081', '2', '125241', '98878');
  304. INSERT INTO `zone_vertices` VALUES ('112081', '3', '101336', '115202');
  305. INSERT INTO `zone_vertices` VALUES ('112081', '4', '109190', '126453');
  306. INSERT INTO `zone_vertices` VALUES ('112081', '5', '125233', '128885');
  307. INSERT INTO `zone_vertices` VALUES ('112081', '6', '144707', '121661');
Advertisement
Add Comment
Please, Sign In to add comment