Implemented Auto Shots with Config.
This commit is contained in:
4
trunk/dist/game/config/Character.ini
vendored
4
trunk/dist/game/config/Character.ini
vendored
@@ -757,6 +757,10 @@ ExpertisePenalty = True
|
||||
# Default: True
|
||||
StoreCharUiSettings = True
|
||||
|
||||
# Enable automatic Shot usage on player login or weapon equipped.
|
||||
# Default: True
|
||||
EnableAutoShots = True
|
||||
|
||||
# Character name restriction
|
||||
# Disallow characters to have a name which contains the words.
|
||||
# Split them with ",". Example: announcements,announce...
|
||||
|
@@ -113,6 +113,6 @@ public final class Summon extends AbstractEffect
|
||||
summon.setRunning();
|
||||
summon.spawnMe();
|
||||
|
||||
player.handleAutoShots();
|
||||
player.handleAutoShots(false);
|
||||
}
|
||||
}
|
||||
|
@@ -104,6 +104,6 @@ public final class SummonMulti extends AbstractEffect
|
||||
summon.setRunning();
|
||||
summon.spawnMe();
|
||||
|
||||
player.handleAutoShots();
|
||||
player.handleAutoShots(false);
|
||||
}
|
||||
}
|
||||
|
@@ -42,21 +42,20 @@ public class BlessedSpiritShot implements IItemHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance activeChar = (L2PcInstance) playable;
|
||||
final L2PcInstance activeChar = playable.getActingPlayer();
|
||||
final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
|
||||
final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
|
||||
final List<ItemSkillHolder> skills = item.getItem().getSkills(ItemSkillType.NORMAL);
|
||||
|
||||
final int itemId = item.getId();
|
||||
|
||||
if (skills == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": is missing skills!");
|
||||
return false;
|
||||
}
|
||||
|
||||
final int itemId = item.getId();
|
||||
|
||||
// Check if Blessed SpiritShot can be used
|
||||
if ((weaponInst == null) || (weaponItem == null) || (weaponItem.getSpiritShotCount() == 0))
|
||||
if ((weaponInst == null) || (weaponItem.getSpiritShotCount() == 0))
|
||||
{
|
||||
if (!activeChar.getAutoSoulShot().contains(itemId))
|
||||
{
|
||||
@@ -94,10 +93,14 @@ public class BlessedSpiritShot implements IItemHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
// Send message to client
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_SPIRITSHOT_HAS_BEEN_ENABLED);
|
||||
activeChar.setChargedShot(ShotType.BLESSED_SPIRITSHOTS, true);
|
||||
// Charge Spirit shot
|
||||
activeChar.setChargedShot(ShotType.SPIRITSHOTS, true);
|
||||
|
||||
// Send message to client
|
||||
if (!activeChar.getAutoSoulShot().contains(item.getId()))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_SPIRITSHOT_HAS_BEEN_ENABLED);
|
||||
}
|
||||
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, holder.getSkillId(), holder.getSkillLvl(), 0, 0), 600));
|
||||
return true;
|
||||
}
|
||||
|
@@ -109,7 +109,10 @@ public class SoulShots implements IItemHandler
|
||||
}
|
||||
|
||||
// Send message to client
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_SOULSHOTS_ARE_ENABLED);
|
||||
if (!activeChar.getAutoSoulShot().contains(item.getId()))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_SOULSHOTS_ARE_ENABLED);
|
||||
}
|
||||
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, holder.getSkillId(), holder.getSkillLvl(), 0, 0), 600));
|
||||
return true;
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ public class SpiritShot implements IItemHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance activeChar = (L2PcInstance) playable;
|
||||
final L2PcInstance activeChar = playable.getActingPlayer();
|
||||
final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
|
||||
final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
|
||||
final List<ItemSkillHolder> skills = item.getItem().getSkills(ItemSkillType.NORMAL);
|
||||
@@ -54,7 +54,7 @@ public class SpiritShot implements IItemHandler
|
||||
|
||||
final int itemId = item.getId();
|
||||
|
||||
// Check if Spirit shot can be used
|
||||
// Check if SpiritShot can be used
|
||||
if ((weaponInst == null) || (weaponItem.getSpiritShotCount() == 0))
|
||||
{
|
||||
if (!activeChar.getAutoSoulShot().contains(itemId))
|
||||
@@ -64,12 +64,13 @@ public class SpiritShot implements IItemHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if Spirit shot is already active
|
||||
// Check if SpiritShot is already active
|
||||
if (activeChar.isChargedShot(ShotType.SPIRITSHOTS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for correct grade
|
||||
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.SPIRITSHOT) && (weaponInst.getItem().getCrystalTypePlus() == item.getItem().getCrystalTypePlus());
|
||||
|
||||
if (!gradeCheck)
|
||||
@@ -82,7 +83,7 @@ public class SpiritShot implements IItemHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
// Consume Spirit shot if player has enough of them
|
||||
// Consume SpiritShot if player has enough of them
|
||||
if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false))
|
||||
{
|
||||
if (!activeChar.disableAutoShot(itemId))
|
||||
@@ -96,7 +97,10 @@ public class SpiritShot implements IItemHandler
|
||||
activeChar.setChargedShot(ShotType.SPIRITSHOTS, true);
|
||||
|
||||
// Send message to client
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_SPIRITSHOT_HAS_BEEN_ENABLED);
|
||||
if (!activeChar.getAutoSoulShot().contains(item.getId()))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_SPIRITSHOT_HAS_BEEN_ENABLED);
|
||||
}
|
||||
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, holder.getSkillId(), holder.getSkillLvl(), 0, 0), 600));
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user