Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P GameServer_Acis
- Index: java/net/sf/l2j/gameserver/handler/itemhandlers/SpiritShot.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/itemhandlers/SpiritShot.java (revision 26)
- +++ java/net/sf/l2j/gameserver/handler/itemhandlers/SpiritShot.java (working copy)
- @@ -14,11 +14,15 @@
- */
- package net.sf.l2j.gameserver.handler.itemhandlers;
- +import java.util.logging.Level;
- +
- +import net.sf.l2j.customs.AutoShots.ItemGrade;
- import net.sf.l2j.gameserver.handler.IItemHandler;
- import net.sf.l2j.gameserver.model.L2ItemInstance;
- import net.sf.l2j.gameserver.model.ShotType;
- import net.sf.l2j.gameserver.model.actor.L2Playable;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.holder.SkillHolder;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
- import net.sf.l2j.gameserver.templates.item.L2Weapon;
- @@ -44,9 +48,38 @@
- 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;
- + }
- + }
- +
- final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
- + final SkillHolder[] skills = item.getItem().getSkills();
- final int itemId = item.getItemId();
- + if (skills == null)
- + {
- + _log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!");
- + return;
- + }
- +
- + if ((activeChar.getAutoShots() != null) && (weaponInst != null))
- + {
- + activeChar.setChargedShot(ShotType.SPIRITSHOT, true);
- + activeChar.sendPacket(SystemMessageId.ENABLED_SPIRITSHOT);
- + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
- + return;
- + }
- +
- // Check if sps can be used
- if (weaponInst == null || weaponItem.getSpiritShotCount() == 0)
- {
- Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 26)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -18,6 +18,7 @@
- import java.util.Date;
- import net.sf.l2j.Config;
- +import net.sf.l2j.customs.AutoShots;
- import net.sf.l2j.gameserver.Announcements;
- import net.sf.l2j.gameserver.GameTimeController;
- import net.sf.l2j.gameserver.SevenSigns;
- @@ -172,7 +173,9 @@
- // engage and notify Partner
- if (Config.ALLOW_WEDDING)
- engage(activeChar);
- -
- +
- + new AutoShots(activeChar);
- +
- final ipCatcher ipc = new ipCatcher();
- if(ipc.isCatched(activeChar))
- activeChar.logout();
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 26)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -40,6 +40,7 @@
- import net.sf.l2j.Config;
- import net.sf.l2j.L2DatabaseFactory;
- +import net.sf.l2j.customs.AutoShots;
- import net.sf.l2j.gameserver.Announcements;
- import net.sf.l2j.gameserver.GameTimeController;
- import net.sf.l2j.gameserver.GeoData;
- @@ -1891,6 +1892,11 @@
- int slot = getInventory().getSlotFromItem(item);
- items = getInventory().unEquipItemInBodySlotAndRecord(slot);
- +
- + if (getAutoShots() != null)
- + {
- + _activeSoulShots.clear();
- + }
- }
- else
- {
- @@ -1906,7 +1912,15 @@
- sendPacket(sm);
- if ((item.getItem().getBodyPart() & L2Item.SLOT_ALLWEAPON) != 0)
- + {
- + if (getAutoShots() != null)
- + {
- + _activeSoulShots.clear();
- + getAutoShots().updateAutoShots(this);
- + }
- +
- rechargeShots(true, true);
- + }
- }
- else
- sendPacket(SystemMessageId.CANNOT_EQUIP_ITEM_DUE_TO_BAD_CONDITION);
- @@ -7991,8 +8005,18 @@
- for (int itemId : _activeSoulShots)
- {
- L2ItemInstance item = getInventory().getItemByItemId(itemId);
- - if (item != null)
- + if (getAutoShots() != null)
- + {
- + L2ItemInstance shot = new L2ItemInstance(0, ItemTable.getInstance().getTemplate(itemId));
- + IItemHandler handler= ItemHandler.getInstance().getItemHandler(shot.getEtcItem());
- +
- + if (handler != null)
- + {
- + handler.useItem(this, item, false);
- + }
- + }
- + else if (item != null)
- + {
- if (magic && item.getItem().getDefaultAction() == L2ActionType.spiritshot)
- {
- IItemHandler handler = ItemHandler.getInstance().getItemHandler(item.getEtcItem());
- @@ -11347,7 +11371,19 @@
- player.sendPacket(new Relationchanged(getPet(), getRelation(player), isAutoAttackable(player)));
- }
- }
- -
- +
- + private AutoShots _autoshotss;
- +
- + public AutoShots getAutoShots()
- + {
- + return _autoshotss;
- + }
- +
- + public void setAutoShots(AutoShots _shot)
- + {
- + _autoshotss = _shot;
- + }
- +
- @Override
- public void sendInfo(L2PcInstance activeChar)
- {
- Index: java/net/sf/l2j/gameserver/templates/item/L2Item.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/templates/item/L2Item.java (revision 26)
- +++ java/net/sf/l2j/gameserver/templates/item/L2Item.java (working copy)
- @@ -690,6 +690,17 @@
- }
- /**
- + * Returns the grade of the item.<BR><BR>
- + * <U><I>Concept :</I></U><BR>
- + * In fact, this fucntion returns the type of crystal of the item.
- + * @return int
- + */
- + public final int getItemGrade()
- + {
- + return getCrystalType();
- + }
- +
- + /**
- * Returns the name of the item
- * @return String
- */
- Index: java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java (revision 26)
- +++ java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java (working copy)
- @@ -14,11 +14,15 @@
- */
- package net.sf.l2j.gameserver.handler.itemhandlers;
- +import java.util.logging.Level;
- +
- +import net.sf.l2j.customs.AutoShots.ItemGrade;
- import net.sf.l2j.gameserver.handler.IItemHandler;
- import net.sf.l2j.gameserver.model.L2ItemInstance;
- import net.sf.l2j.gameserver.model.ShotType;
- import net.sf.l2j.gameserver.model.actor.L2Playable;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.holder.SkillHolder;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
- import net.sf.l2j.gameserver.templates.item.L2Weapon;
- @@ -45,9 +49,38 @@
- 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.getSoulshot());
- + }
- + else if (item == null)
- + {
- + return;
- + }
- + }
- +
- final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
- final int itemId = item.getItemId();
- + final SkillHolder[] skills = item.getItem().getSkills();
- + if (skills == null)
- + {
- + _log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!");
- + return;
- + }
- +
- + if ((activeChar.getAutoShots() != null) && (weaponInst != null))
- + {
- + weaponInst.setChargedShot(ShotType.SOULSHOT, true);
- + activeChar.sendPacket(SystemMessageId.ENABLED_SOULSHOT);
- + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
- + return;
- + }
- +
- // Check if soulshot can be used
- if (weaponInst == null || weaponItem.getSoulShotCount() == 0)
- {
- Index: java/net/sf/l2j/customs/AutoShots.java
- ===================================================================
- --- java/net/sf/l2j/customs/AutoShots.java (revision 0)
- +++ java/net/sf/l2j/customs/AutoShots.java (working copy)
- @@ -0,0 +1,64 @@
- +package net.sf.l2j.customs;
- +
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +
- +/**
- + * @author Wyatt
- + * @Adapted for Interlude BossForever
- + */
- +
- +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);
- +
- + 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/net/sf/l2j/gameserver/model/actor/L2Character.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 26)
- +++ java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)
- @@ -656,7 +656,7 @@
- if (this instanceof L2PcInstance)
- {
- // Equip arrows needed in left hand and send ItemList to the L2PcINstance then return True
- - if (!checkAndEquipArrows())
- + if ((((L2PcInstance) this).getAutoShots() == null) && !checkAndEquipArrows())
- {
- // Cancel the action because the L2PcInstance have no arrow
- getAI().setIntention(CtrlIntention.IDLE);
Advertisement
Add Comment
Please, Sign In to add comment