Created a method to send pet item infos.
This commit is contained in:
@@ -195,8 +195,9 @@ public class ExPetEquipItem implements IClientIncomingPacket
|
|||||||
// Create and Bind the next action to the AI
|
// Create and Bind the next action to the AI
|
||||||
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
@@ -204,19 +205,24 @@ public class ExPetEquipItem implements IClientIncomingPacket
|
|||||||
// Equip or unEquip.
|
// Equip or unEquip.
|
||||||
ThreadPool.schedule(() ->
|
ThreadPool.schedule(() ->
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendInfos(Pet pet, Player player)
|
||||||
|
{
|
||||||
pet.getStat().recalculateStats(true);
|
pet.getStat().recalculateStats(true);
|
||||||
player.sendPacket(new PetInfo(pet, 1));
|
player.sendPacket(new PetInfo(pet, 1));
|
||||||
player.sendPacket(new ExPetSkillList(false, pet));
|
player.sendPacket(new ExPetSkillList(false, pet));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -156,27 +156,34 @@ public class ExPetUnequipItem implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isCastingNow())
|
if (player.isCastingNow())
|
||||||
{
|
{
|
||||||
// Create and Bind the next action to the AI
|
// Create and Bind the next action to the AI
|
||||||
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
||||||
{
|
{
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
// Equip or unEquip.
|
// Equip or unEquip.
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendInfos(Pet pet, Player player)
|
||||||
|
{
|
||||||
pet.getStat().recalculateStats(true);
|
pet.getStat().recalculateStats(true);
|
||||||
player.sendPacket(new PetInfo(pet, 1));
|
player.sendPacket(new PetInfo(pet, 1));
|
||||||
player.sendPacket(new ExPetSkillList(false, pet));
|
player.sendPacket(new ExPetSkillList(false, pet));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -195,8 +195,9 @@ public class ExPetEquipItem implements IClientIncomingPacket
|
|||||||
// Create and Bind the next action to the AI
|
// Create and Bind the next action to the AI
|
||||||
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
@@ -204,19 +205,24 @@ public class ExPetEquipItem implements IClientIncomingPacket
|
|||||||
// Equip or unEquip.
|
// Equip or unEquip.
|
||||||
ThreadPool.schedule(() ->
|
ThreadPool.schedule(() ->
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendInfos(Pet pet, Player player)
|
||||||
|
{
|
||||||
pet.getStat().recalculateStats(true);
|
pet.getStat().recalculateStats(true);
|
||||||
player.sendPacket(new PetInfo(pet, 1));
|
player.sendPacket(new PetInfo(pet, 1));
|
||||||
player.sendPacket(new ExPetSkillList(false, pet));
|
player.sendPacket(new ExPetSkillList(false, pet));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -156,27 +156,34 @@ public class ExPetUnequipItem implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isCastingNow())
|
if (player.isCastingNow())
|
||||||
{
|
{
|
||||||
// Create and Bind the next action to the AI
|
// Create and Bind the next action to the AI
|
||||||
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
||||||
{
|
{
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
// Equip or unEquip.
|
// Equip or unEquip.
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendInfos(Pet pet, Player player)
|
||||||
|
{
|
||||||
pet.getStat().recalculateStats(true);
|
pet.getStat().recalculateStats(true);
|
||||||
player.sendPacket(new PetInfo(pet, 1));
|
player.sendPacket(new PetInfo(pet, 1));
|
||||||
player.sendPacket(new ExPetSkillList(false, pet));
|
player.sendPacket(new ExPetSkillList(false, pet));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -195,8 +195,9 @@ public class ExPetEquipItem implements IClientIncomingPacket
|
|||||||
// Create and Bind the next action to the AI
|
// Create and Bind the next action to the AI
|
||||||
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
@@ -204,19 +205,24 @@ public class ExPetEquipItem implements IClientIncomingPacket
|
|||||||
// Equip or unEquip.
|
// Equip or unEquip.
|
||||||
ThreadPool.schedule(() ->
|
ThreadPool.schedule(() ->
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendInfos(Pet pet, Player player)
|
||||||
|
{
|
||||||
pet.getStat().recalculateStats(true);
|
pet.getStat().recalculateStats(true);
|
||||||
player.sendPacket(new PetInfo(pet, 1));
|
player.sendPacket(new PetInfo(pet, 1));
|
||||||
player.sendPacket(new ExPetSkillList(false, pet));
|
player.sendPacket(new ExPetSkillList(false, pet));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -156,27 +156,34 @@ public class ExPetUnequipItem implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isCastingNow())
|
if (player.isCastingNow())
|
||||||
{
|
{
|
||||||
// Create and Bind the next action to the AI
|
// Create and Bind the next action to the AI
|
||||||
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
||||||
{
|
{
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
// Equip or unEquip.
|
// Equip or unEquip.
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendInfos(Pet pet, Player player)
|
||||||
|
{
|
||||||
pet.getStat().recalculateStats(true);
|
pet.getStat().recalculateStats(true);
|
||||||
player.sendPacket(new PetInfo(pet, 1));
|
player.sendPacket(new PetInfo(pet, 1));
|
||||||
player.sendPacket(new ExPetSkillList(false, pet));
|
player.sendPacket(new ExPetSkillList(false, pet));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -195,8 +195,9 @@ public class ExPetEquipItem implements IClientIncomingPacket
|
|||||||
// Create and Bind the next action to the AI
|
// Create and Bind the next action to the AI
|
||||||
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
@@ -204,19 +205,24 @@ public class ExPetEquipItem implements IClientIncomingPacket
|
|||||||
// Equip or unEquip.
|
// Equip or unEquip.
|
||||||
ThreadPool.schedule(() ->
|
ThreadPool.schedule(() ->
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
final Item transferedItem = player.transferItem("UnequipFromPet", item.getObjectId(), 1, pet.getInventory(), null);
|
||||||
pet.useEquippableItem(transferedItem, false);
|
pet.useEquippableItem(transferedItem, false);
|
||||||
|
sendInfos(pet, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendInfos(Pet pet, Player player)
|
||||||
|
{
|
||||||
pet.getStat().recalculateStats(true);
|
pet.getStat().recalculateStats(true);
|
||||||
player.sendPacket(new PetInfo(pet, 1));
|
player.sendPacket(new PetInfo(pet, 1));
|
||||||
player.sendPacket(new ExPetSkillList(false, pet));
|
player.sendPacket(new ExPetSkillList(false, pet));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -156,27 +156,34 @@ public class ExPetUnequipItem implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isCastingNow())
|
if (player.isCastingNow())
|
||||||
{
|
{
|
||||||
// Create and Bind the next action to the AI
|
// Create and Bind the next action to the AI
|
||||||
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
player.getAI().setNextAction(new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () ->
|
||||||
{
|
{
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
// Equip or unEquip.
|
// Equip or unEquip.
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
pet.transferItem("UnequipFromPet", item.getObjectId(), 1, player.getInventory(), player, null);
|
||||||
|
sendInfos(pet, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendInfos(Pet pet, Player player)
|
||||||
|
{
|
||||||
pet.getStat().recalculateStats(true);
|
pet.getStat().recalculateStats(true);
|
||||||
player.sendPacket(new PetInfo(pet, 1));
|
player.sendPacket(new PetInfo(pet, 1));
|
||||||
player.sendPacket(new ExPetSkillList(false, pet));
|
player.sendPacket(new ExPetSkillList(false, pet));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user