SpiritShot recharge fix and related cleanups.
This commit is contained in:
@@ -1082,7 +1082,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
|
|
||||||
// Verify if soulshots are charged.
|
// Verify if soulshots are charged.
|
||||||
boolean wasSSCharged;
|
boolean wasSSCharged;
|
||||||
|
|
||||||
if ((this instanceof Summon) && !(this instanceof PetInstance))
|
if ((this instanceof Summon) && !(this instanceof PetInstance))
|
||||||
{
|
{
|
||||||
wasSSCharged = ((Summon) this).getChargedSoulShot() != ItemInstance.CHARGED_NONE;
|
wasSSCharged = ((Summon) this).getChargedSoulShot() != ItemInstance.CHARGED_NONE;
|
||||||
@@ -1101,7 +1100,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
_attackEndTime -= 1;
|
_attackEndTime -= 1;
|
||||||
|
|
||||||
int ssGrade = 0;
|
int ssGrade = 0;
|
||||||
|
|
||||||
if (weaponItem != null)
|
if (weaponItem != null)
|
||||||
{
|
{
|
||||||
ssGrade = weaponItem.getCrystalType();
|
ssGrade = weaponItem.getCrystalType();
|
||||||
@@ -1651,6 +1649,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
((Summon) creature).getOwner().rechargeAutoSoulShot(true, false, true);
|
((Summon) creature).getOwner().rechargeAutoSoulShot(true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (skill.useSpiritShot())
|
||||||
|
{
|
||||||
|
if (creature instanceof PlayerInstance)
|
||||||
|
{
|
||||||
|
((PlayerInstance) creature).rechargeAutoSoulShot(false, true, false);
|
||||||
|
}
|
||||||
|
else if (this instanceof Summon)
|
||||||
|
{
|
||||||
|
((Summon) creature).getOwner().rechargeAutoSoulShot(false, true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get all possible targets of the skill in a table in function of the skill target type
|
// Get all possible targets of the skill in a table in function of the skill target type
|
||||||
final WorldObject[] targets = skill.getTargetList(creature);
|
final WorldObject[] targets = skill.getTargetList(creature);
|
||||||
@@ -10082,9 +10091,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
public boolean checkBss()
|
public boolean checkBss()
|
||||||
{
|
{
|
||||||
boolean bss = false;
|
boolean bss = false;
|
||||||
|
|
||||||
final ItemInstance weaponInst = getActiveWeaponInstance();
|
final ItemInstance weaponInst = getActiveWeaponInstance();
|
||||||
|
|
||||||
if (weaponInst != null)
|
if (weaponInst != null)
|
||||||
{
|
{
|
||||||
if (weaponInst.getChargedSpiritshot() == ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
|
if (weaponInst.getChargedSpiritshot() == ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
|
||||||
@@ -10102,7 +10109,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
bss = true;
|
bss = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bss;
|
return bss;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10112,7 +10118,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
public synchronized void removeBss()
|
public synchronized void removeBss()
|
||||||
{
|
{
|
||||||
final ItemInstance weaponInst = getActiveWeaponInstance();
|
final ItemInstance weaponInst = getActiveWeaponInstance();
|
||||||
|
|
||||||
if (weaponInst != null)
|
if (weaponInst != null)
|
||||||
{
|
{
|
||||||
if (weaponInst.getChargedSpiritshot() == ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
|
if (weaponInst.getChargedSpiritshot() == ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
|
||||||
@@ -10124,13 +10129,11 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
else if (this instanceof Summon)
|
else if (this instanceof Summon)
|
||||||
{
|
{
|
||||||
final Summon activeSummon = (Summon) this;
|
final Summon activeSummon = (Summon) this;
|
||||||
|
|
||||||
if (activeSummon.getChargedSpiritShot() == ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
|
if (activeSummon.getChargedSpiritShot() == ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
|
||||||
{
|
{
|
||||||
activeSummon.setChargedSpiritShot(ItemInstance.CHARGED_NONE);
|
activeSummon.setChargedSpiritShot(ItemInstance.CHARGED_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadShots(true);
|
reloadShots(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10141,9 +10144,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
public boolean checkSps()
|
public boolean checkSps()
|
||||||
{
|
{
|
||||||
boolean ss = false;
|
boolean ss = false;
|
||||||
|
|
||||||
final ItemInstance weaponInst = getActiveWeaponInstance();
|
final ItemInstance weaponInst = getActiveWeaponInstance();
|
||||||
|
|
||||||
if (weaponInst != null)
|
if (weaponInst != null)
|
||||||
{
|
{
|
||||||
if (weaponInst.getChargedSpiritshot() == ItemInstance.CHARGED_SPIRITSHOT)
|
if (weaponInst.getChargedSpiritshot() == ItemInstance.CHARGED_SPIRITSHOT)
|
||||||
@@ -10161,7 +10162,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
ss = true;
|
ss = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ss;
|
return ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10171,7 +10171,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
public synchronized void removeSps()
|
public synchronized void removeSps()
|
||||||
{
|
{
|
||||||
final ItemInstance weaponInst = getActiveWeaponInstance();
|
final ItemInstance weaponInst = getActiveWeaponInstance();
|
||||||
|
|
||||||
if (weaponInst != null)
|
if (weaponInst != null)
|
||||||
{
|
{
|
||||||
if (weaponInst.getChargedSpiritshot() == ItemInstance.CHARGED_SPIRITSHOT)
|
if (weaponInst.getChargedSpiritshot() == ItemInstance.CHARGED_SPIRITSHOT)
|
||||||
@@ -10183,13 +10182,11 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
else if (this instanceof Summon)
|
else if (this instanceof Summon)
|
||||||
{
|
{
|
||||||
final Summon activeSummon = (Summon) this;
|
final Summon activeSummon = (Summon) this;
|
||||||
|
|
||||||
if (activeSummon.getChargedSpiritShot() == ItemInstance.CHARGED_SPIRITSHOT)
|
if (activeSummon.getChargedSpiritShot() == ItemInstance.CHARGED_SPIRITSHOT)
|
||||||
{
|
{
|
||||||
activeSummon.setChargedSpiritShot(ItemInstance.CHARGED_NONE);
|
activeSummon.setChargedSpiritShot(ItemInstance.CHARGED_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadShots(true);
|
reloadShots(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10200,9 +10197,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
public boolean checkSs()
|
public boolean checkSs()
|
||||||
{
|
{
|
||||||
boolean ss = false;
|
boolean ss = false;
|
||||||
|
|
||||||
final ItemInstance weaponInst = getActiveWeaponInstance();
|
final ItemInstance weaponInst = getActiveWeaponInstance();
|
||||||
|
|
||||||
if (weaponInst != null)
|
if (weaponInst != null)
|
||||||
{
|
{
|
||||||
if (weaponInst.getChargedSoulshot() == ItemInstance.CHARGED_SOULSHOT)
|
if (weaponInst.getChargedSoulshot() == ItemInstance.CHARGED_SOULSHOT)
|
||||||
@@ -10220,7 +10215,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
ss = true;
|
ss = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ss;
|
return ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10230,7 +10224,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
public void removeSs()
|
public void removeSs()
|
||||||
{
|
{
|
||||||
final ItemInstance weaponInst = getActiveWeaponInstance();
|
final ItemInstance weaponInst = getActiveWeaponInstance();
|
||||||
|
|
||||||
if (weaponInst != null)
|
if (weaponInst != null)
|
||||||
{
|
{
|
||||||
if (weaponInst.getChargedSoulshot() == ItemInstance.CHARGED_SOULSHOT)
|
if (weaponInst.getChargedSoulshot() == ItemInstance.CHARGED_SOULSHOT)
|
||||||
|
@@ -2940,12 +2940,10 @@ public final class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
for (ItemInstance ss : getInventory().getItems())
|
for (ItemInstance ss : getInventory().getItems())
|
||||||
{
|
{
|
||||||
final int _itemId = ss.getItemId();
|
final int itemId = ss.getItemId();
|
||||||
|
if ((((itemId >= 2509) && (itemId <= 2514)) || ((itemId >= 3947) && (itemId <= 3952)) || ((itemId <= 1804) && (itemId >= 1808)) || (itemId == 5789) || (itemId == 5790) || (itemId == 1835)) && (ss.getItem().getCrystalType() == unequipped.getItem().getCrystalType()))
|
||||||
if ((((_itemId >= 2509) && (_itemId <= 2514)) || ((_itemId >= 3947) && (_itemId <= 3952)) || ((_itemId <= 1804) && (_itemId >= 1808)) || (_itemId == 5789) || (_itemId == 5790) || (_itemId == 1835)) && (ss.getItem().getCrystalType() == unequipped.getItem().getCrystalType()))
|
|
||||||
{
|
{
|
||||||
sendPacket(new ExAutoSoulShot(_itemId, 0));
|
sendPacket(new ExAutoSoulShot(itemId, 0));
|
||||||
|
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
|
||||||
sm.addString(ss.getItemName());
|
sm.addString(ss.getItemName());
|
||||||
sendPacket(sm);
|
sendPacket(sm);
|
||||||
@@ -12129,7 +12127,6 @@ public final class PlayerInstance extends Playable
|
|||||||
for (int itemId : _activeSoulShots.values())
|
for (int itemId : _activeSoulShots.values())
|
||||||
{
|
{
|
||||||
item = getInventory().getItemByItemId(itemId);
|
item = getInventory().getItemByItemId(itemId);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
if (magic)
|
if (magic)
|
||||||
@@ -12139,7 +12136,6 @@ public final class PlayerInstance extends Playable
|
|||||||
if ((itemId == 2509) || (itemId == 2510) || (itemId == 2511) || (itemId == 2512) || (itemId == 2513) || (itemId == 2514) || (itemId == 3947) || (itemId == 3948) || (itemId == 3949) || (itemId == 3950) || (itemId == 3951) || (itemId == 3952) || (itemId == 5790))
|
if ((itemId == 2509) || (itemId == 2510) || (itemId == 2511) || (itemId == 2512) || (itemId == 2513) || (itemId == 2514) || (itemId == 3947) || (itemId == 3948) || (itemId == 3949) || (itemId == 3950) || (itemId == 3951) || (itemId == 3952) || (itemId == 5790))
|
||||||
{
|
{
|
||||||
handler = ItemHandler.getInstance().getItemHandler(itemId);
|
handler = ItemHandler.getInstance().getItemHandler(itemId);
|
||||||
|
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
handler.useItem(this, item);
|
handler.useItem(this, item);
|
||||||
@@ -12149,7 +12145,6 @@ public final class PlayerInstance extends Playable
|
|||||||
else if ((itemId == 6646) || (itemId == 6647))
|
else if ((itemId == 6646) || (itemId == 6647))
|
||||||
{
|
{
|
||||||
handler = ItemHandler.getInstance().getItemHandler(itemId);
|
handler = ItemHandler.getInstance().getItemHandler(itemId);
|
||||||
|
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
handler.useItem(this, item);
|
handler.useItem(this, item);
|
||||||
@@ -12164,7 +12159,6 @@ public final class PlayerInstance extends Playable
|
|||||||
if ((itemId == 1463) || (itemId == 1464) || (itemId == 1465) || (itemId == 1466) || (itemId == 1467) || (itemId == 1835) || (itemId == 5789))
|
if ((itemId == 1463) || (itemId == 1464) || (itemId == 1465) || (itemId == 1466) || (itemId == 1467) || (itemId == 1835) || (itemId == 5789))
|
||||||
{
|
{
|
||||||
handler = ItemHandler.getInstance().getItemHandler(itemId);
|
handler = ItemHandler.getInstance().getItemHandler(itemId);
|
||||||
|
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
handler.useItem(this, item);
|
handler.useItem(this, item);
|
||||||
@@ -12174,7 +12168,6 @@ public final class PlayerInstance extends Playable
|
|||||||
else if (itemId == 6645)
|
else if (itemId == 6645)
|
||||||
{
|
{
|
||||||
handler = ItemHandler.getInstance().getItemHandler(itemId);
|
handler = ItemHandler.getInstance().getItemHandler(itemId);
|
||||||
|
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
handler.useItem(this, item);
|
handler.useItem(this, item);
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.ItemInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.ItemInstance;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
@@ -30,6 +31,31 @@ public final class RequestAutoSoulShot extends GameClientPacket
|
|||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _type; // 1 = on : 0 = off;
|
private int _type; // 1 = on : 0 = off;
|
||||||
|
|
||||||
|
private static final List<Integer> SHOT_IDS = new ArrayList<>();
|
||||||
|
static
|
||||||
|
{
|
||||||
|
SHOT_IDS.add(5789);
|
||||||
|
SHOT_IDS.add(1835);
|
||||||
|
SHOT_IDS.add(1463);
|
||||||
|
SHOT_IDS.add(1464);
|
||||||
|
SHOT_IDS.add(1465);
|
||||||
|
SHOT_IDS.add(1466);
|
||||||
|
SHOT_IDS.add(1467);
|
||||||
|
SHOT_IDS.add(5790);
|
||||||
|
SHOT_IDS.add(2509);
|
||||||
|
SHOT_IDS.add(2510);
|
||||||
|
SHOT_IDS.add(2511);
|
||||||
|
SHOT_IDS.add(2512);
|
||||||
|
SHOT_IDS.add(2513);
|
||||||
|
SHOT_IDS.add(2514);
|
||||||
|
SHOT_IDS.add(3947);
|
||||||
|
SHOT_IDS.add(3948);
|
||||||
|
SHOT_IDS.add(3949);
|
||||||
|
SHOT_IDS.add(3950);
|
||||||
|
SHOT_IDS.add(3951);
|
||||||
|
SHOT_IDS.add(3952);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readImpl()
|
protected void readImpl()
|
||||||
{
|
{
|
||||||
@@ -48,30 +74,7 @@ public final class RequestAutoSoulShot extends GameClientPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Like L2OFF you can't use soulshots while sitting
|
// Like L2OFF you can't use soulshots while sitting
|
||||||
final int[] shots_ids =
|
if (player.isSitting() && SHOT_IDS.contains(_itemId))
|
||||||
{
|
|
||||||
5789,
|
|
||||||
1835,
|
|
||||||
1463,
|
|
||||||
1464,
|
|
||||||
1465,
|
|
||||||
1466,
|
|
||||||
1467,
|
|
||||||
5790,
|
|
||||||
2509,
|
|
||||||
2510,
|
|
||||||
2511,
|
|
||||||
2512,
|
|
||||||
2513,
|
|
||||||
2514,
|
|
||||||
3947,
|
|
||||||
3948,
|
|
||||||
3949,
|
|
||||||
3950,
|
|
||||||
3951,
|
|
||||||
3952
|
|
||||||
};
|
|
||||||
if (player.isSitting() && Arrays.toString(shots_ids).contains(String.valueOf(_itemId)))
|
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_AUTO_USE_LACK_OF_S1);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_AUTO_USE_LACK_OF_S1);
|
||||||
sm.addItemName(_itemId);
|
sm.addItemName(_itemId);
|
||||||
|
@@ -16,7 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||||
@@ -47,6 +49,31 @@ public final class UseItem extends GameClientPacket
|
|||||||
{
|
{
|
||||||
private int _objectId;
|
private int _objectId;
|
||||||
|
|
||||||
|
private static final List<Integer> SHOT_IDS = new ArrayList<>();
|
||||||
|
static
|
||||||
|
{
|
||||||
|
SHOT_IDS.add(5789);
|
||||||
|
SHOT_IDS.add(1835);
|
||||||
|
SHOT_IDS.add(1463);
|
||||||
|
SHOT_IDS.add(1464);
|
||||||
|
SHOT_IDS.add(1465);
|
||||||
|
SHOT_IDS.add(1466);
|
||||||
|
SHOT_IDS.add(1467);
|
||||||
|
SHOT_IDS.add(5790);
|
||||||
|
SHOT_IDS.add(2509);
|
||||||
|
SHOT_IDS.add(2510);
|
||||||
|
SHOT_IDS.add(2511);
|
||||||
|
SHOT_IDS.add(2512);
|
||||||
|
SHOT_IDS.add(2513);
|
||||||
|
SHOT_IDS.add(2514);
|
||||||
|
SHOT_IDS.add(3947);
|
||||||
|
SHOT_IDS.add(3948);
|
||||||
|
SHOT_IDS.add(3949);
|
||||||
|
SHOT_IDS.add(3950);
|
||||||
|
SHOT_IDS.add(3951);
|
||||||
|
SHOT_IDS.add(3952);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readImpl()
|
protected void readImpl()
|
||||||
{
|
{
|
||||||
@@ -68,31 +95,8 @@ public final class UseItem extends GameClientPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like L2OFF you can't use soulshots while sitting
|
// Like L2OFF you can't use soulshots while sitting.
|
||||||
final int[] shots_ids =
|
if (player.isSitting() && SHOT_IDS.contains(item.getItemId()))
|
||||||
{
|
|
||||||
5789,
|
|
||||||
1835,
|
|
||||||
1463,
|
|
||||||
1464,
|
|
||||||
1465,
|
|
||||||
1466,
|
|
||||||
1467,
|
|
||||||
5790,
|
|
||||||
2509,
|
|
||||||
2510,
|
|
||||||
2511,
|
|
||||||
2512,
|
|
||||||
2513,
|
|
||||||
2514,
|
|
||||||
3947,
|
|
||||||
3948,
|
|
||||||
3949,
|
|
||||||
3950,
|
|
||||||
3951,
|
|
||||||
3952
|
|
||||||
};
|
|
||||||
if (player.isSitting() && Arrays.toString(shots_ids).contains(String.valueOf(item.getItemId())))
|
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_AUTO_USE_LACK_OF_S1);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_AUTO_USE_LACK_OF_S1);
|
||||||
sm.addItemName(item.getItemId());
|
sm.addItemName(item.getItemId());
|
||||||
@@ -114,7 +118,7 @@ public final class UseItem extends GameClientPacket
|
|||||||
}
|
}
|
||||||
if (player.isStunned() || player.isConfused() || player.isAway() || player.isParalyzed() || player.isSleeping())
|
if (player.isStunned() || player.isConfused() || player.isAway() || player.isParalyzed() || player.isSleeping())
|
||||||
{
|
{
|
||||||
player.sendMessage("You Cannot Use Items Right Now.");
|
player.sendMessage("You cannot use items right now.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,8 +429,8 @@ public final class UseItem extends GameClientPacket
|
|||||||
SystemMessage sm = null;
|
SystemMessage sm = null;
|
||||||
|
|
||||||
if (item.getItem().getType2() == Item.TYPE2_WEAPON)
|
if (item.getItem().getType2() == Item.TYPE2_WEAPON)
|
||||||
{ // if used item is a weapon
|
{
|
||||||
|
// if used item is a weapon
|
||||||
ItemInstance wep = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
|
ItemInstance wep = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
|
||||||
if (wep == null)
|
if (wep == null)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user