Sync with L2JServer Jan 24th 2015.

This commit is contained in:
mobius
2015-01-24 20:02:32 +00:00
parent d349bd3924
commit 1c6301c46d
1012 changed files with 23069 additions and 6307 deletions

View File

@ -18,11 +18,14 @@
*/
package handlers.itemhandlers;
import java.util.List;
import java.util.logging.Level;
import java.util.stream.Collectors;
import com.l2jserver.gameserver.enums.ShotType;
import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@ -52,16 +55,40 @@ public class BeastSoulShot implements IItemHandler
return false;
}
if (activeOwner.getSummon().isDead())
final L2Summon pet = playable.getPet();
if ((pet != null) && pet.isDead())
{
activeOwner.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET_OR_SERVITOR_SAD_ISN_T_IT);
return false;
}
final List<L2Summon> aliveServitor = playable.getServitors().values().stream().filter(s -> !s.isDead()).collect(Collectors.toList());
if (aliveServitor.isEmpty())
{
activeOwner.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET_OR_SERVITOR_SAD_ISN_T_IT);
return false;
}
final int itemId = item.getId();
final short shotConsumption = activeOwner.getSummon().getSoulShotsPerHit();
final long shotCount = item.getCount();
final SkillHolder[] skills = item.getItem().getSkills();
short shotConsumption = 0;
if (pet != null)
{
if (!pet.isChargedShot(ShotType.SOULSHOTS))
{
shotConsumption += pet.getSoulShotsPerHit();
}
}
for (L2Summon servitors : aliveServitor)
{
if (!servitors.isChargedShot(ShotType.SOULSHOTS))
{
shotConsumption += servitors.getSoulShotsPerHit();
}
}
if (skills == null)
{
@ -79,12 +106,6 @@ public class BeastSoulShot implements IItemHandler
return false;
}
if (activeOwner.getSummon().isChargedShot(ShotType.SOULSHOTS))
{
// SoulShots are already active.
return false;
}
// If the player doesn't have enough beast soulshot remaining, remove any auto soulshot task.
if (!activeOwner.destroyItemWithoutTrace("Consume", item.getObjectId(), shotConsumption, null, false))
{
@ -97,9 +118,23 @@ public class BeastSoulShot implements IItemHandler
// Pet uses the power of spirit.
activeOwner.sendPacket(SystemMessageId.YOUR_PET_USES_SPIRITSHOT);
activeOwner.getSummon().setChargedShot(ShotType.SOULSHOTS, true);
if (pet != null)
{
if (!pet.isChargedShot(ShotType.SOULSHOTS))
{
pet.setChargedShot(ShotType.SOULSHOTS, true);
Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(pet, pet, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
}
}
Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(activeOwner.getSummon(), activeOwner.getSummon(), skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
aliveServitor.forEach(s ->
{
if (!s.isChargedShot(ShotType.SOULSHOTS))
{
s.setChargedShot(ShotType.SOULSHOTS, true);
Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(s, s, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
}
});
return true;
}
}

View File

@ -18,11 +18,14 @@
*/
package handlers.itemhandlers;
import java.util.List;
import java.util.logging.Level;
import java.util.stream.Collectors;
import com.l2jserver.gameserver.enums.ShotType;
import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@ -52,7 +55,15 @@ public class BeastSpiritShot implements IItemHandler
return false;
}
if (activeOwner.getSummon().isDead())
final L2Summon pet = playable.getPet();
if ((pet != null) && pet.isDead())
{
activeOwner.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET_OR_SERVITOR_SAD_ISN_T_IT);
return false;
}
final List<L2Summon> aliveServitor = playable.getServitors().values().stream().filter(s -> !s.isDead()).collect(Collectors.toList());
if (aliveServitor.isEmpty())
{
activeOwner.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET_OR_SERVITOR_SAD_ISN_T_IT);
return false;
@ -60,9 +71,27 @@ public class BeastSpiritShot implements IItemHandler
final int itemId = item.getId();
final boolean isBlessed = ((itemId == 6647) || (itemId == 20334)); // TODO: Unhardcode these!
final short shotConsumption = activeOwner.getSummon().getSpiritShotsPerHit();
final SkillHolder[] skills = item.getItem().getSkills();
final ShotType shotType = isBlessed ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS;
short shotConsumption = 0;
if (pet != null)
{
if (!pet.isChargedShot(shotType))
{
shotConsumption += pet.getSpiritShotsPerHit();
}
}
for (L2Summon servitors : aliveServitor)
{
if (!servitors.isChargedShot(shotType))
{
shotConsumption += servitors.getSpiritShotsPerHit();
}
}
if (skills == null)
{
_log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!");
@ -80,12 +109,6 @@ public class BeastSpiritShot implements IItemHandler
return false;
}
if (activeOwner.getSummon().isChargedShot(isBlessed ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS))
{
// shots are already active.
return false;
}
if (!activeOwner.destroyItemWithoutTrace("Consume", item.getObjectId(), shotConsumption, null, false))
{
if (!activeOwner.disableAutoShot(itemId))
@ -97,9 +120,23 @@ public class BeastSpiritShot implements IItemHandler
// Pet uses the power of spirit.
activeOwner.sendPacket(SystemMessageId.YOUR_PET_USES_SPIRITSHOT);
activeOwner.getSummon().setChargedShot(isBlessed ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, true);
if (pet != null)
{
if (!pet.isChargedShot(shotType))
{
pet.setChargedShot(shotType, true);
Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(pet, pet, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
}
}
Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(activeOwner.getSummon(), activeOwner.getSummon(), skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
aliveServitor.forEach(s ->
{
if (!s.isChargedShot(shotType))
{
s.setChargedShot(shotType, true);
Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(s, s, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600);
}
});
return true;
}
}

View File

@ -21,7 +21,7 @@ package handlers.itemhandlers;
import java.util.List;
import com.l2jserver.Config;
import com.l2jserver.gameserver.datatables.PetDataTable;
import com.l2jserver.gameserver.data.xml.impl.PetDataTable;
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.actor.L2Playable;

View File

@ -18,7 +18,7 @@
*/
package handlers.itemhandlers;
import com.l2jserver.gameserver.datatables.RecipeData;
import com.l2jserver.gameserver.data.xml.impl.RecipeData;
import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.L2RecipeList;
import com.l2jserver.gameserver.model.actor.L2Playable;

View File

@ -18,7 +18,7 @@
*/
package handlers.itemhandlers;
import com.l2jserver.gameserver.datatables.PetDataTable;
import com.l2jserver.gameserver.data.xml.impl.PetDataTable;
import com.l2jserver.gameserver.model.L2PetData;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@ -58,7 +58,7 @@ public class SummonItems extends ItemSkillsTemplate
return false;
}
if (activeChar.hasSummon() || activeChar.isMounted())
if (activeChar.hasPet() || activeChar.isMounted())
{
activeChar.sendPacket(SystemMessageId.YOU_ALREADY_HAVE_A_PET);
return false;