Advertisement
Guest User

Untitled

a guest
Oct 6th, 2013
1,761
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 11.36 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2J_Server
  3. Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  4. ===================================================================
  5. --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java        (revision 6193)
  6. +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java        (working copy)
  7. @@ -44,6 +44,12 @@
  8.  import javolution.util.FastMap;
  9.  import javolution.util.FastSet;
  10.  
  11. +import com.custom.AutoShots;
  12. @@ -881,6 +894,18 @@
  13.                 }
  14.         }
  15.        
  16. +       private AutoShots _autoshotss;
  17. +      
  18. +       public AutoShots getAutoShots()
  19. +       {
  20. +               return _autoshotss;
  21. +       }
  22. +      
  23. +       public void setAutoShots(AutoShots _shot)
  24. +       {
  25. +               _autoshotss = _shot;
  26. +       }
  27. +      
  28.         public void stopPvpRegTask()
  29.         {
  30.                 if (_PvPRegTask != null)
  31. @@ -2592,6 +2894,11 @@
  32.                         else
  33.                         {
  34.                                 items = getInventory().unEquipItemInBodySlotAndRecord(slot);
  35. +                              
  36. +                               if (getAutoShots() != null)
  37. +                               {
  38. +                                       _activeSoulShots.clear();
  39. +                               }
  40.                         }
  41.                 }
  42.                 else
  43. @@ -2618,6 +2925,10 @@
  44.                                
  45.                                 if ((item.getItem().getBodyPart() & L2Item.SLOT_MULTI_ALLWEAPON) != 0)
  46.                                 {
  47. +                                       if (getAutoShots() != null)
  48. +                                       {
  49. +                                               _activeSoulShots.clear();
  50. +                                               getAutoShots().updateAutoShots(this);
  51. +                                       }
  52.                                         rechargeShots(true, true);
  53.                                 }
  54.                         }
  55. @@ -10258,8 +10666,18 @@
  56.                 {
  57.                         item = getInventory().getItemByItemId(itemId);
  58.                        
  59. -                       if (item != null)
  60. +                       if (getAutoShots() != null)
  61. +                       {
  62. +                               L2ItemInstance shot = new L2ItemInstance(0, ItemTable.getInstance().getTemplate(itemId));
  63. +                               handler = ItemHandler.getInstance().getHandler(shot.getEtcItem());
  64. +                              
  65. +                               if (handler != null)
  66. +                               {
  67. +                                       handler.useItem(this, item, false);
  68. +                               }
  69. +                       }
  70. +                       else if (item != null)
  71. +                       {
  72.                                 if (magic)
  73.                                 {
  74.                                         if (item.getItem().getDefaultAction() == L2ActionType.spiritshot)
  75. Index: java/com/custom/AutoShots.java
  76. ===================================================================
  77. --- java/com/custom/AutoShots.java      (revision 0)
  78. +++ java/com/custom/AutoShots.java      (revision 0)
  79. @@ -0,0 +1,76 @@
  80. +/*
  81. + * Copyright (C) 2004-2013 L2J Server
  82. + *
  83. + * This file is part of L2J Server.
  84. + *
  85. + * L2J Server is free software: you can redistribute it and/or modify
  86. + * it under the terms of the GNU General Public License as published by
  87. + * the Free Software Foundation, either version 3 of the License, or
  88. + * (at your option) any later version.
  89. + *
  90. + * L2J Server is distributed in the hope that it will be useful,
  91. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  92. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  93. + * General Public License for more details.
  94. + *
  95. + * You should have received a copy of the GNU General Public License
  96. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  97. + */
  98. +package com.custom;
  99. +
  100. +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  101. +
  102. +/**
  103. + * @author Wyatt
  104. + */
  105. +
  106. +public class AutoShots
  107. +{
  108. +       public AutoShots(L2PcInstance activeChar)
  109. +       {
  110. +               updateAutoShots(activeChar);
  111. +               activeChar.setAutoShots(this);
  112. +               activeChar.rechargeShots(true, true);
  113. +       }
  114. +      
  115. +      public void updateAutoShots(L2PcInstance activeChar)
  116. +   {
  117. +       if (getItem(activeChar) != null)
  118. +       {
  119. +           activeChar.addAutoSoulShot(getItem(activeChar).getSoulshot());
  120. +           activeChar.addAutoSoulShot(getItem(activeChar).getBlessedSpiritshot());
  121. +       }
  122. +   }
  123. +  
  124. +   public static ItemGrade getItem(L2PcInstance activeChar)
  125. +   {
  126. +       if (activeChar.getActiveWeaponItem() != null)
  127. +       {
  128. +           return ItemGrade.values()[activeChar.getActiveWeaponItem().getItemGrade()];
  129. +       }
  130. +       return ItemGrade.values()[0];
  131. +   }
  132. +      
  133. +       public enum ItemGrade
  134. +   {
  135. +       NOGRADE(1835, 2509),
  136. +       D(1463, 2510),
  137. +       C(1464, 2511),
  138. +       B(1465, 2512),
  139. +       A(1466, 2513),
  140. +       S(1467, 2514),
  141. +       S80(1467, 2514),
  142. +       S84(1467, 2514);
  143. +      
  144. +       private int soulshot;
  145. +       private int blessedspiritshot;
  146. +      
  147. +       private ItemGrade(int soulshot_id, int blessedspirit_id)
  148. +       {
  149. +           soulshot = soulshot_id;
  150. +           blessedspiritshot = blessedspirit_id;
  151. +       }  
  152. +      
  153. +       public int getSoulshot()
  154. +       {
  155. +           return soulshot;
  156. +       }
  157. +      
  158. +       public int getBlessedSpiritshot()
  159. +       {
  160. +           return blessedspiritshot;
  161. +       }
  162. +   }
  163. +}
  164. \ No newline at end of file
  165. Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
  166. ===================================================================
  167. --- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 6193)
  168. +++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy)
  169. @@ -18,10 +18,12 @@
  170.   */
  171.  package com.l2jserver.gameserver.network.clientpackets;
  172.  
  173.  import javolution.util.FastList;
  174.  
  175. +import com.custom.AutoShots;
  176.  
  177. @@ -579,6 +581,23 @@
  178. +               new AutoShots(activeChar);
  179. +              
  180.                 if (Config.WELCOME_MESSAGE_ENABLED)
  181.                 {
  182.                         activeChar.sendPacket(new ExShowScreenMessage(Config.WELCOME_MESSAGE_TEXT, Config.WELCOME_MESSAGE_TIME));
  183. Index: dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java
  184. ===================================================================
  185. --- dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java        (revision 9937)
  186. +++ dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java        (working copy)
  187. @@ -20,6 +20,7 @@
  188.  
  189.  import java.util.logging.Level;
  190.  
  191. +import com.custom.AutoShots.ItemGrade;
  192.  import com.l2jserver.gameserver.handler.IItemHandler;
  193.  import com.l2jserver.gameserver.model.ShotType;
  194.  import com.l2jserver.gameserver.model.actor.L2Playable;
  195. @@ -45,6 +46,20 @@
  196.                
  197.                 final L2PcInstance activeChar = (L2PcInstance) playable;
  198.                 final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
  199. +              
  200. +               if ((activeChar.getAutoShots() != null))
  201. +               {
  202. +                       if (weaponInst != null)
  203. +                       {
  204. +                               ItemGrade grade = ItemGrade.values()[weaponInst.getItem().getItemGrade()];
  205. +                               item = new L2ItemInstance(0, grade.getBlessedSpiritshot());
  206. +                       }
  207. +                       else if (item == null)
  208. +                       {
  209. +                               return false;
  210. +                       }
  211. +               }
  212. +              
  213.                 final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
  214.                 final SkillHolder[] skills = item.getItem().getSkills();
  215.                
  216. @@ -56,6 +71,14 @@
  217.                         return false;
  218.                 }
  219.                
  220. +               if ((activeChar.getAutoShots() != null) && (weaponInst != null))
  221. +               {
  222. +                       activeChar.setChargedShot(ShotType.SPIRITSHOTS, true);
  223. +                       activeChar.sendPacket(SystemMessageId.ENABLED_SPIRITSHOT);
  224. +                       Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
  225. +                       return true;
  226. +               }
  227. +              
  228.                 // Check if Spirit shot can be used
  229.                 if ((weaponInst == null) || (weaponItem.getSpiritShotCount() == 0))
  230.                 {
  231. Index: dist/game/data/scripts/handlers/itemhandlers/SoulShots.java
  232. ===================================================================
  233. --- dist/game/data/scripts/handlers/itemhandlers/SoulShots.java (revision 9937)
  234. +++ dist/game/data/scripts/handlers/itemhandlers/SoulShots.java (working copy)
  235. @@ -20,6 +20,7 @@
  236.  
  237.  import java.util.logging.Level;
  238.  
  239. +import com.custom.AutoShots.ItemGrade;
  240.  import com.l2jserver.gameserver.handler.IItemHandler;
  241.  import com.l2jserver.gameserver.model.ShotType;
  242.  import com.l2jserver.gameserver.model.actor.L2Playable;
  243. @@ -46,6 +47,20 @@
  244.                
  245.                 final L2PcInstance activeChar = playable.getActingPlayer();
  246.                 final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
  247. +              
  248. +               if (activeChar.getAutoShots() != null)
  249. +               {
  250. +                       if (weaponInst != null)
  251. +                       {
  252. +                               ItemGrade grade = ItemGrade.values()[weaponInst.getItem().getItemGrade()];
  253. +                               item = new L2ItemInstance(0, grade.getSoulshot());
  254. +                       }
  255. +                       else if (item == null)
  256. +                       {
  257. +                               return false;
  258. +                       }
  259. +               }
  260. +              
  261.                 final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
  262.                 final SkillHolder[] skills = item.getItem().getSkills();
  263.                
  264. @@ -57,6 +72,14 @@
  265.                         return false;
  266.                 }
  267.                
  268. +               if ((activeChar.getAutoShots() != null) && (weaponInst != null))
  269. +               {
  270. +                       weaponInst.setChargedShot(ShotType.SOULSHOTS, true);
  271. +                       activeChar.sendPacket(SystemMessageId.ENABLED_SOULSHOT);
  272. +                       Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
  273. +                       return true;
  274. +               }
  275. +              
  276.                 // Check if Soul shot can be used
  277.                 if ((weaponInst == null) || (weaponItem.getSoulShotCount() == 0))
  278.                 {
  279. Index: java/com/l2jserver/gameserver/model/actor/L2Character.java
  280. ===================================================================
  281. --- java/com/l2jserver/gameserver/model/actor/L2Character.java  (revision 6193)
  282. +++ java/com/l2jserver/gameserver/model/actor/L2Character.java  (working copy)
  283. @@ -900,7 +921,7 @@
  284.                     }
  285.                    
  286.                     // Equip arrows needed in left hand and send a Server->Client packet ItemList to the L2PcInstance then return True
  287. -                   if (!checkAndEquipArrows())
  288. +                   else if ((((L2PcInstance) this).getAutoShots() == null) && !checkAndEquipArrows())
  289.                     {
  290.                         // Cancel the action because the L2PcInstance have no arrow
  291.                         getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  292. @@ -1018,6 +1039,16 @@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement