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. + getAutoShots().updateAutoShots(this);
50. + }
51. rechargeShots(true, true);
52. }
53. }
54. @@ -10258,8 +10666,18 @@
55. {
56. item = getInventory().getItemByItemId(itemId);
57.
58. - if (item != null)
59. + if (getAutoShots() != null)
60. {
61. + L2ItemInstance shot = new L2ItemInstance(0, ItemTable.getInstance().getTemplate(itemId));
62. + handler = ItemHandler.getInstance().getHandler(shot.getEtcItem());
63. +
64. + if (handler != null)
65. + {
66. + handler.useItem(this, item, false);
67. + }
68. + }
69. + else if (item != null)
70. + {
71. if (magic)
72. {
73. if (item.getItem().getDefaultAction() == L2ActionType.spiritshot)
74. Index: java/com/custom/AutoShots.java
75. ===================================================================
76. --- java/com/custom/AutoShots.java (revision 0)
77. +++ java/com/custom/AutoShots.java (revision 0)
78. @@ -0,0 +1,76 @@
79. +/*
80. + * Copyright (C) 2004-2013 L2J Server
81. + *
82. + * This file is part of L2J Server.
83. + *
84. + * L2J Server is free software: you can redistribute it and/or modify
85. + * it under the terms of the GNU General Public License as published by
86. + * the Free Software Foundation, either version 3 of the License, or
87. + * (at your option) any later version.
88. + *
89. + * L2J Server is distributed in the hope that it will be useful,
90. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
91. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
92. + * General Public License for more details.
93. + *
94. + * You should have received a copy of the GNU General Public License
95. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
96. + */
97. +package com.custom;
98. +
99. +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
100. +
101. +/**
102. + * @author Wyatt
103. + */
104. +
105. +public class AutoShots
106. +{
107. + public AutoShots(L2PcInstance activeChar)
108. + {
109. + updateAutoShots(activeChar);
110. + activeChar.setAutoShots(this);
111. + activeChar.rechargeShots(true, true);
112. + }
113. +
114. + public void updateAutoShots(L2PcInstance activeChar)
115. + {
116. + if (activeChar.getActiveWeaponItem() != null)
117. + {
118. + ItemGrade itemgrade = ItemGrade.values()[activeChar.getActiveWeaponItem().getItemGrade()];
119. + activeChar.addAutoSoulShot(itemgrade.getSoulshot());
120. + activeChar.addAutoSoulShot(itemgrade.getBlessedSpiritshot());
121. + }
122. + }
123. +
124. + public enum ItemGrade
125. + {
126. + NOGRADE(1835, 2509),
127. + D(1463, 2510),
128. + C(1464, 2511),
129. + B(1465, 2512),
130. + A(1466, 2513),
131. + S(1467, 2514),
132. + S80(1467, 2514),
133. + S84(1467, 2514);
134. +
135. + private int soulshot;
136. + private int blessedspiritshot;
137. +
138. + private ItemGrade(int soulshot_id, int blessedspirit_id)
139. + {
140. + soulshot = soulshot_id;
141. + blessedspiritshot = blessedspirit_id;
142. + }
143. +
144. + public int getSoulshot()
145. + {
146. + return soulshot;
147. + }
148. +
149. + public int getBlessedSpiritshot()
150. + {
151. + return blessedspiritshot;
152. + }
153. + }
154. +}
155. \ No newline at end of file
156. Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
157. ===================================================================
158. --- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 6193)
159. +++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy)
160. @@ -18,10 +18,12 @@
161. */
162. package com.l2jserver.gameserver.network.clientpackets;
163.
164. import javolution.util.FastList;
165.
166. +import com.custom.AutoShots;
167.
168. @@ -579,6 +581,23 @@
169. + new AutoShots(activeChar);
170. +
171. if (Config.WELCOME_MESSAGE_ENABLED)
172. {
173. activeChar.sendPacket(new ExShowScreenMessage(Config.WELCOME_MESSAGE_TEXT, Config.WELCOME_MESSAGE_TIME));
174. Index: dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java
175. ===================================================================
176. --- dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java (revision 9937)
177. +++ dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java (working copy)
178. @@ -20,6 +20,7 @@
179.
180. import java.util.logging.Level;
181.
182. +import com.custom.AutoShots.ItemGrade;
183. import com.l2jserver.gameserver.handler.IItemHandler;
184. import com.l2jserver.gameserver.model.ShotType;
185. import com.l2jserver.gameserver.model.actor.L2Playable;
186. @@ -45,6 +46,20 @@
187.
188. final L2PcInstance activeChar = (L2PcInstance) playable;
189. final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
190. +
191. + if ((activeChar.getAutoShots() != null))
192. + {
193. + if (weaponInst != null)
194. + {
195. + ItemGrade grade = ItemGrade.values()[weaponInst.getItem().getItemGrade()];
196. + item = new L2ItemInstance(0, grade.getSoulshot());
197. + }
198. + else if (item == null)
199. + {
200. + return false;
201. + }
202. + }
203. +
204. final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
205. final SkillHolder[] skills = item.getItem().getSkills();
206.
207. @@ -56,6 +71,14 @@
208. return false;
209. }
210.
211. + if ((activeChar.getAutoShots() != null) && (weaponInst != null))
212. + {
213. + activeChar.setChargedShot(ShotType.SPIRITSHOTS, true);
214. + activeChar.sendPacket(SystemMessageId.ENABLED_SPIRITSHOT);
215. + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
216. + return true;
217. + }
218. +
219. // Check if Spirit shot can be used
220. if ((weaponInst == null) || (weaponItem.getSpiritShotCount() == 0))
221. {
222. Index: dist/game/data/scripts/handlers/itemhandlers/SoulShots.java
223. ===================================================================
224. --- dist/game/data/scripts/handlers/itemhandlers/SoulShots.java (revision 9937)
225. +++ dist/game/data/scripts/handlers/itemhandlers/SoulShots.java (working copy)
226. @@ -20,6 +20,7 @@
227.
228. import java.util.logging.Level;
229.
230. +import com.custom.AutoShots.ItemGrade;
231. import com.l2jserver.gameserver.handler.IItemHandler;
232. import com.l2jserver.gameserver.model.ShotType;
233. import com.l2jserver.gameserver.model.actor.L2Playable;
234. @@ -46,6 +47,20 @@
235.
236. final L2PcInstance activeChar = playable.getActingPlayer();
237. final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
238. +
239. + if (activeChar.getAutoShots() != null)
240. + {
241. + if (weaponInst != null)
242. + {
243. + ItemGrade grade = ItemGrade.values()[weaponInst.getItem().getItemGrade()];
244. + item = new L2ItemInstance(0, grade.getSoulshot());
245. + }
246. + else if (item == null)
247. + {
248. + return false;
249. + }
250. + }
251. +
252. final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
253. final SkillHolder[] skills = item.getItem().getSkills();
254.
255. @@ -57,6 +72,14 @@
256. return false;
257. }
258.
259. + if ((activeChar.getAutoShots() != null) && (weaponInst != null))
260. + {
261. + weaponInst.setChargedShot(ShotType.SOULSHOTS, true);
262. + activeChar.sendPacket(SystemMessageId.ENABLED_SOULSHOT);
263. + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
264. + return true;
265. + }
266. +
267. // Check if Soul shot can be used
268. if ((weaponInst == null) || (weaponItem.getSoulShotCount() == 0))
269. {
here's the code of wyatt>. It has be done for l2jserver.. Now a curious guys like me :P want to addapted in other l2jproject for example aCis or l2jfrozen nvm. Which are the proper steps in order to do it right?