Guest User

Untitled

a guest
Oct 24th, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.98 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P GameServer_Acis
  3. Index: java/net/sf/l2j/gameserver/handler/itemhandlers/SpiritShot.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/handler/itemhandlers/SpiritShot.java (revision 26)
  6. +++ java/net/sf/l2j/gameserver/handler/itemhandlers/SpiritShot.java (working copy)
  7. @@ -14,11 +14,15 @@
  8. */
  9. package net.sf.l2j.gameserver.handler.itemhandlers;
  10.  
  11. +import java.util.logging.Level;
  12. +
  13. +import net.sf.l2j.customs.AutoShots.ItemGrade;
  14. import net.sf.l2j.gameserver.handler.IItemHandler;
  15. import net.sf.l2j.gameserver.model.L2ItemInstance;
  16. import net.sf.l2j.gameserver.model.ShotType;
  17. import net.sf.l2j.gameserver.model.actor.L2Playable;
  18. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  19. +import net.sf.l2j.gameserver.model.holder.SkillHolder;
  20. import net.sf.l2j.gameserver.network.SystemMessageId;
  21. import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
  22. import net.sf.l2j.gameserver.templates.item.L2Weapon;
  23. @@ -44,9 +48,38 @@
  24.  
  25. final L2PcInstance activeChar = (L2PcInstance) playable;
  26. final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
  27. +
  28. + if ((activeChar.getAutoShots() != null))
  29. + {
  30. + if (weaponInst != null)
  31. + {
  32. + ItemGrade grade = ItemGrade.values()[weaponInst.getItem().getItemGrade()];
  33. + item = new L2ItemInstance(0, grade.getBlessedSpiritshot());
  34. + }
  35. + else if (item == null)
  36. + {
  37. + return;
  38. + }
  39. + }
  40. +
  41. final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
  42. + final SkillHolder[] skills = item.getItem().getSkills();
  43. final int itemId = item.getItemId();
  44.  
  45. + if (skills == null)
  46. + {
  47. + _log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!");
  48. + return;
  49. + }
  50. +
  51. + if ((activeChar.getAutoShots() != null) && (weaponInst != null))
  52. + {
  53. + activeChar.setChargedShot(ShotType.SPIRITSHOT, true);
  54. + activeChar.sendPacket(SystemMessageId.ENABLED_SPIRITSHOT);
  55. + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
  56. + return;
  57. + }
  58. +
  59. // Check if sps can be used
  60. if (weaponInst == null || weaponItem.getSpiritShotCount() == 0)
  61. {
  62. Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  63. ===================================================================
  64. --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 26)
  65. +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
  66. @@ -18,6 +18,7 @@
  67. import java.util.Date;
  68.  
  69. import net.sf.l2j.Config;
  70. +import net.sf.l2j.customs.AutoShots;
  71. import net.sf.l2j.gameserver.Announcements;
  72. import net.sf.l2j.gameserver.GameTimeController;
  73. import net.sf.l2j.gameserver.SevenSigns;
  74. @@ -172,7 +173,9 @@
  75. // engage and notify Partner
  76. if (Config.ALLOW_WEDDING)
  77. engage(activeChar);
  78. -
  79. +
  80. + new AutoShots(activeChar);
  81. +
  82. final ipCatcher ipc = new ipCatcher();
  83. if(ipc.isCatched(activeChar))
  84. activeChar.logout();
  85. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  86. ===================================================================
  87. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 26)
  88. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  89. @@ -40,6 +40,7 @@
  90.  
  91. import net.sf.l2j.Config;
  92. import net.sf.l2j.L2DatabaseFactory;
  93. +import net.sf.l2j.customs.AutoShots;
  94. import net.sf.l2j.gameserver.Announcements;
  95. import net.sf.l2j.gameserver.GameTimeController;
  96. import net.sf.l2j.gameserver.GeoData;
  97. @@ -1891,6 +1892,11 @@
  98.  
  99. int slot = getInventory().getSlotFromItem(item);
  100. items = getInventory().unEquipItemInBodySlotAndRecord(slot);
  101. +
  102. + if (getAutoShots() != null)
  103. + {
  104. + _activeSoulShots.clear();
  105. + }
  106. }
  107. else
  108. {
  109. @@ -1906,7 +1912,15 @@
  110. sendPacket(sm);
  111.  
  112. if ((item.getItem().getBodyPart() & L2Item.SLOT_ALLWEAPON) != 0)
  113. + {
  114. + if (getAutoShots() != null)
  115. + {
  116. + _activeSoulShots.clear();
  117. + getAutoShots().updateAutoShots(this);
  118. + }
  119. +
  120. rechargeShots(true, true);
  121. + }
  122. }
  123. else
  124. sendPacket(SystemMessageId.CANNOT_EQUIP_ITEM_DUE_TO_BAD_CONDITION);
  125. @@ -7991,8 +8005,18 @@
  126. for (int itemId : _activeSoulShots)
  127. {
  128. L2ItemInstance item = getInventory().getItemByItemId(itemId);
  129. - if (item != null)
  130. + if (getAutoShots() != null)
  131. + {
  132. + L2ItemInstance shot = new L2ItemInstance(0, ItemTable.getInstance().getTemplate(itemId));
  133. + IItemHandler handler= ItemHandler.getInstance().getItemHandler(shot.getEtcItem());
  134. +
  135. + if (handler != null)
  136. + {
  137. + handler.useItem(this, item, false);
  138. + }
  139. + }
  140. + else if (item != null)
  141. + {
  142. if (magic && item.getItem().getDefaultAction() == L2ActionType.spiritshot)
  143. {
  144. IItemHandler handler = ItemHandler.getInstance().getItemHandler(item.getEtcItem());
  145. @@ -11347,7 +11371,19 @@
  146. player.sendPacket(new Relationchanged(getPet(), getRelation(player), isAutoAttackable(player)));
  147. }
  148. }
  149. -
  150. +
  151. + private AutoShots _autoshotss;
  152. +
  153. + public AutoShots getAutoShots()
  154. + {
  155. + return _autoshotss;
  156. + }
  157. +
  158. + public void setAutoShots(AutoShots _shot)
  159. + {
  160. + _autoshotss = _shot;
  161. + }
  162. +
  163. @Override
  164. public void sendInfo(L2PcInstance activeChar)
  165. {
  166. Index: java/net/sf/l2j/gameserver/templates/item/L2Item.java
  167. ===================================================================
  168. --- java/net/sf/l2j/gameserver/templates/item/L2Item.java (revision 26)
  169. +++ java/net/sf/l2j/gameserver/templates/item/L2Item.java (working copy)
  170. @@ -690,6 +690,17 @@
  171. }
  172.  
  173. /**
  174. + * Returns the grade of the item.<BR><BR>
  175. + * <U><I>Concept :</I></U><BR>
  176. + * In fact, this fucntion returns the type of crystal of the item.
  177. + * @return int
  178. + */
  179. + public final int getItemGrade()
  180. + {
  181. + return getCrystalType();
  182. + }
  183. +
  184. + /**
  185. * Returns the name of the item
  186. * @return String
  187. */
  188. Index: java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java
  189. ===================================================================
  190. --- java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java (revision 26)
  191. +++ java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java (working copy)
  192. @@ -14,11 +14,15 @@
  193. */
  194. package net.sf.l2j.gameserver.handler.itemhandlers;
  195.  
  196. +import java.util.logging.Level;
  197. +
  198. +import net.sf.l2j.customs.AutoShots.ItemGrade;
  199. import net.sf.l2j.gameserver.handler.IItemHandler;
  200. import net.sf.l2j.gameserver.model.L2ItemInstance;
  201. import net.sf.l2j.gameserver.model.ShotType;
  202. import net.sf.l2j.gameserver.model.actor.L2Playable;
  203. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  204. +import net.sf.l2j.gameserver.model.holder.SkillHolder;
  205. import net.sf.l2j.gameserver.network.SystemMessageId;
  206. import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
  207. import net.sf.l2j.gameserver.templates.item.L2Weapon;
  208. @@ -45,9 +49,38 @@
  209.  
  210. final L2PcInstance activeChar = (L2PcInstance) playable;
  211. final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
  212. +
  213. + if (activeChar.getAutoShots() != null)
  214. + {
  215. + if (weaponInst != null)
  216. + {
  217. + ItemGrade grade = ItemGrade.values()[weaponInst.getItem().getItemGrade()];
  218. + item = new L2ItemInstance(0, grade.getSoulshot());
  219. + }
  220. + else if (item == null)
  221. + {
  222. + return;
  223. + }
  224. + }
  225. +
  226. final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
  227. final int itemId = item.getItemId();
  228. + final SkillHolder[] skills = item.getItem().getSkills();
  229.  
  230. + if (skills == null)
  231. + {
  232. + _log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!");
  233. + return;
  234. + }
  235. +
  236. + if ((activeChar.getAutoShots() != null) && (weaponInst != null))
  237. + {
  238. + weaponInst.setChargedShot(ShotType.SOULSHOT, true);
  239. + activeChar.sendPacket(SystemMessageId.ENABLED_SOULSHOT);
  240. + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
  241. + return;
  242. + }
  243. +
  244. // Check if soulshot can be used
  245. if (weaponInst == null || weaponItem.getSoulShotCount() == 0)
  246. {
  247. Index: java/net/sf/l2j/customs/AutoShots.java
  248. ===================================================================
  249. --- java/net/sf/l2j/customs/AutoShots.java (revision 0)
  250. +++ java/net/sf/l2j/customs/AutoShots.java (working copy)
  251. @@ -0,0 +1,64 @@
  252. +package net.sf.l2j.customs;
  253. +
  254. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  255. +
  256. +/**
  257. + * @author Wyatt
  258. + * @Adapted for Interlude BossForever
  259. + */
  260. +
  261. +public class AutoShots
  262. +{
  263. + public AutoShots(L2PcInstance activeChar)
  264. + {
  265. + updateAutoShots(activeChar);
  266. + activeChar.setAutoShots(this);
  267. + activeChar.rechargeShots(true, true);
  268. + }
  269. +
  270. + public void updateAutoShots(L2PcInstance activeChar)
  271. + {
  272. + if (getItem(activeChar) != null)
  273. + {
  274. + activeChar.addAutoSoulShot(getItem(activeChar).getSoulshot());
  275. + activeChar.addAutoSoulShot(getItem(activeChar).getBlessedSpiritshot());
  276. + }
  277. + }
  278. +
  279. + public static ItemGrade getItem(L2PcInstance activeChar)
  280. + {
  281. + if (activeChar.getActiveWeaponItem() != null)
  282. + {
  283. + return ItemGrade.values()[activeChar.getActiveWeaponItem().getItemGrade()];
  284. + }
  285. + return ItemGrade.values()[0];
  286. + }
  287. +
  288. + public enum ItemGrade
  289. + {
  290. + NOGRADE(1835, 2509),
  291. + D(1463, 2510),
  292. + C(1464, 2511),
  293. + B(1465, 2512),
  294. + A(1466, 2513),
  295. + S(1467, 2514);
  296. +
  297. + private int soulshot;
  298. + private int blessedspiritshot;
  299. +
  300. + private ItemGrade(int soulshot_id, int blessedspirit_id)
  301. + {
  302. + soulshot = soulshot_id;
  303. + blessedspiritshot = blessedspirit_id;
  304. + }
  305. +
  306. + public int getSoulshot()
  307. + {
  308. + return soulshot;
  309. + }
  310. +
  311. + public int getBlessedSpiritshot()
  312. + {
  313. + return blessedspiritshot;
  314. + }
  315. + }
  316. +}
  317. \ No newline at end of file
  318. Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
  319. ===================================================================
  320. --- java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 26)
  321. +++ java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)
  322. @@ -656,7 +656,7 @@
  323. if (this instanceof L2PcInstance)
  324. {
  325. // Equip arrows needed in left hand and send ItemList to the L2PcINstance then return True
  326. - if (!checkAndEquipArrows())
  327. + if ((((L2PcInstance) this).getAutoShots() == null) && !checkAndEquipArrows())
  328. {
  329. // Cancel the action because the L2PcInstance have no arrow
  330. getAI().setIntention(CtrlIntention.IDLE);
Advertisement
Add Comment
Please, Sign In to add comment