### Eclipse Workspace Patch 1.0
#P L2J_Server
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 6193)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -44,6 +44,12 @@
import javolution.util.FastMap;
import javolution.util.FastSet;
+import com.custom.AutoShots;
@@ -881,6 +894,18 @@
}
}
+ private AutoShots _autoshotss;
+
+ public AutoShots getAutoShots()
+ {
+ return _autoshotss;
+ }
+
+ public void setAutoShots(AutoShots _shot)
+ {
+ _autoshotss = _shot;
+ }
+
public void stopPvpRegTask()
{
if (_PvPRegTask != null)
@@ -2592,6 +2894,11 @@
else
{
items = getInventory().unEquipItemInBodySlotAndRecord(slot);
+
+ if (getAutoShots() != null)
+ {
+ _activeSoulShots.clear();
+ }
}
}
else
@@ -2618,6 +2925,10 @@
if ((item.getItem().getBodyPart() & L2Item.SLOT_MULTI_ALLWEAPON) != 0)
{
+ if (getAutoShots() != null)
+ {
+ _activeSoulShots.clear();
+ getAutoShots().updateAutoShots(this);
+ }
rechargeShots(true, true);
}
}
@@ -10258,8 +10666,18 @@
{
item = getInventory().getItemByItemId(itemId);
- if (item != null)
+ if (getAutoShots() != null)
+ {
+ L2ItemInstance shot = new L2ItemInstance(0, ItemTable.getInstance().getTemplate(itemId));
+ handler = ItemHandler.getInstance().getHandler(shot.getEtcItem());
+
+ if (handler != null)
+ {
+ handler.useItem(this, item, false);
+ }
+ }
+ else if (item != null)
+ {
if (magic)
{
if (item.getItem().getDefaultAction() == L2ActionType.spiritshot)
Index: java/com/custom/AutoShots.java
===================================================================
--- java/com/custom/AutoShots.java (revision 0)
+++ java/com/custom/AutoShots.java (revision 0)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ *
+ * This file is part of L2J Server.
+ *
+ * L2J Server is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.custom;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * @author Wyatt
+ */
+
+public class AutoShots
+{
+ public AutoShots(L2PcInstance activeChar)
+ {
+ updateAutoShots(activeChar);
+ activeChar.setAutoShots(this);
+ activeChar.rechargeShots(true, true);
+ }
+
+ public void updateAutoShots(L2PcInstance activeChar)
+ {
+ if (getItem(activeChar) != null)
+ {
+ activeChar.addAutoSoulShot(getItem(activeChar).getSoulshot());
+ activeChar.addAutoSoulShot(getItem(activeChar).getBlessedSpiritshot());
+ }
+ }
+
+ public static ItemGrade getItem(L2PcInstance activeChar)
+ {
+ if (activeChar.getActiveWeaponItem() != null)
+ {
+ return ItemGrade.values()[activeChar.getActiveWeaponItem().getItemGrade()];
+ }
+ return ItemGrade.values()[0];
+ }
+
+ public enum ItemGrade
+ {
+ NOGRADE(1835, 2509),
+ D(1463, 2510),
+ C(1464, 2511),
+ B(1465, 2512),
+ A(1466, 2513),
+ S(1467, 2514),
+ S80(1467, 2514),
+ S84(1467, 2514);
+
+ private int soulshot;
+ private int blessedspiritshot;
+
+ private ItemGrade(int soulshot_id, int blessedspirit_id)
+ {
+ soulshot = soulshot_id;
+ blessedspiritshot = blessedspirit_id;
+ }
+
+ public int getSoulshot()
+ {
+ return soulshot;
+ }
+
+ public int getBlessedSpiritshot()
+ {
+ return blessedspiritshot;
+ }
+ }
+}
\ No newline at end of file
Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 6193)
+++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -18,10 +18,12 @@
*/
package com.l2jserver.gameserver.network.clientpackets;
import javolution.util.FastList;
+import com.custom.AutoShots;
@@ -579,6 +581,23 @@
+ new AutoShots(activeChar);
+
if (Config.WELCOME_MESSAGE_ENABLED)
{
activeChar.sendPacket(new ExShowScreenMessage(Config.WELCOME_MESSAGE_TEXT, Config.WELCOME_MESSAGE_TIME));
Index: dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java
===================================================================
--- dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java (revision 9937)
+++ dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java (working copy)
@@ -20,6 +20,7 @@
import java.util.logging.Level;
+import com.custom.AutoShots.ItemGrade;
import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.ShotType;
import com.l2jserver.gameserver.model.actor.L2Playable;
@@ -45,6 +46,20 @@
final L2PcInstance activeChar = (L2PcInstance) playable;
final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
+
+ if ((activeChar.getAutoShots() != null))
+ {
+ if (weaponInst != null)
+ {
+ ItemGrade grade = ItemGrade.values()[weaponInst.getItem().getItemGrade()];
+ item = new L2ItemInstance(0, grade.getBlessedSpiritshot());
+ }
+ else if (item == null)
+ {
+ return false;
+ }
+ }
+
final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
final SkillHolder[] skills = item.getItem().getSkills();
@@ -56,6 +71,14 @@
return false;
}
+ if ((activeChar.getAutoShots() != null) && (weaponInst != null))
+ {
+ activeChar.setChargedShot(ShotType.SPIRITSHOTS, true);
+ activeChar.sendPacket(SystemMessageId.ENABLED_SPIRITSHOT);
+ Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
+ return true;
+ }
+
// Check if Spirit shot can be used
if ((weaponInst == null) || (weaponItem.getSpiritShotCount() == 0))
{
Index: dist/game/data/scripts/handlers/itemhandlers/SoulShots.java
===================================================================
--- dist/game/data/scripts/handlers/itemhandlers/SoulShots.java (revision 9937)
+++ dist/game/data/scripts/handlers/itemhandlers/SoulShots.java (working copy)
@@ -20,6 +20,7 @@
import java.util.logging.Level;
+import com.custom.AutoShots.ItemGrade;
import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.ShotType;
import com.l2jserver.gameserver.model.actor.L2Playable;
@@ -46,6 +47,20 @@
final L2PcInstance activeChar = playable.getActingPlayer();
final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
+
+ if (activeChar.getAutoShots() != null)
+ {
+ if (weaponInst != null)
+ {
+ ItemGrade grade = ItemGrade.values()[weaponInst.getItem().getItemGrade()];
+ item = new L2ItemInstance(0, grade.getSoulshot());
+ }
+ else if (item == null)
+ {
+ return false;
+ }
+ }
+
final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
final SkillHolder[] skills = item.getItem().getSkills();
@@ -57,6 +72,14 @@
return false;
}
+ if ((activeChar.getAutoShots() != null) && (weaponInst != null))
+ {
+ weaponInst.setChargedShot(ShotType.SOULSHOTS, true);
+ activeChar.sendPacket(SystemMessageId.ENABLED_SOULSHOT);
+ Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
+ return true;
+ }
+
// Check if Soul shot can be used
if ((weaponInst == null) || (weaponItem.getSoulShotCount() == 0))
{
Index: java/com/l2jserver/gameserver/model/actor/L2Character.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/L2Character.java (revision 6193)
+++ java/com/l2jserver/gameserver/model/actor/L2Character.java (working copy)
@@ -900,7 +921,7 @@
}
// Equip arrows needed in left hand and send a Server->Client packet ItemList to the L2PcInstance then return True
- if (!checkAndEquipArrows())
+ else if ((((L2PcInstance) this).getAutoShots() == null) && !checkAndEquipArrows())
{
// Cancel the action because the L2PcInstance have no arrow
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
@@ -1018,6 +1039,16 @@