Summon related adjustments.

This commit is contained in:
MobiusDevelopment
2022-01-11 01:49:43 +00:00
parent d0827d2363
commit fc50379dc1
37 changed files with 94 additions and 88 deletions
@@ -207,7 +207,7 @@ public class ExPetInfo extends AbstractMaskPacket<NpcInfoType>
OutgoingPackets.EX_PET_INFO.writeId(packet); OutgoingPackets.EX_PET_INFO.writeId(packet);
packet.writeD(_summon.getObjectId()); packet.writeD(_summon.getObjectId());
packet.writeC(_value); // 0=teleported 1=default 2=summoned packet.writeC(_value); // 0=teleported 1=default 2=summoned
packet.writeH(37); // mask_bits_37 packet.writeH(38); // 338 - mask_bits_38
packet.writeB(_masks); packet.writeB(_masks);
// Block 1 // Block 1
packet.writeC(_initSize); packet.writeC(_initSize);
@@ -355,7 +355,7 @@ public class ExPetInfo extends AbstractMaskPacket<NpcInfoType>
} }
if (containsMask(NpcInfoType.VISUAL_STATE)) if (containsMask(NpcInfoType.VISUAL_STATE))
{ {
packet.writeC(_statusMask); packet.writeD(_statusMask);
} }
if (containsMask(NpcInfoType.ABNORMALS)) if (containsMask(NpcInfoType.ABNORMALS))
{ {
@@ -431,7 +431,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
} }
if (containsMask(NpcInfoType.VISUAL_STATE)) if (containsMask(NpcInfoType.VISUAL_STATE))
{ {
packet.writeC(_statusMask); packet.writeD(_statusMask);
} }
if (containsMask(NpcInfoType.ABNORMALS)) if (containsMask(NpcInfoType.ABNORMALS))
{ {
@@ -208,7 +208,7 @@ public class SummonInfo extends AbstractMaskPacket<NpcInfoType>
OutgoingPackets.SUMMON_INFO.writeId(packet); OutgoingPackets.SUMMON_INFO.writeId(packet);
packet.writeD(_summon.getObjectId()); packet.writeD(_summon.getObjectId());
packet.writeC(_value); // 0=teleported 1=default 2=summoned packet.writeC(_value); // 0=teleported 1=default 2=summoned
packet.writeH(37); // mask_bits_37 packet.writeH(38); // 338 - mask_bits_38
packet.writeB(_masks); packet.writeB(_masks);
// Block 1 // Block 1
packet.writeC(_initSize); packet.writeC(_initSize);
@@ -356,7 +356,7 @@ public class SummonInfo extends AbstractMaskPacket<NpcInfoType>
} }
if (containsMask(NpcInfoType.VISUAL_STATE)) if (containsMask(NpcInfoType.VISUAL_STATE))
{ {
packet.writeC(_statusMask); packet.writeD(_statusMask);
} }
if (containsMask(NpcInfoType.ABNORMALS)) if (containsMask(NpcInfoType.ABNORMALS))
{ {
@@ -2671,7 +2671,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
final Summon summon = (Summon) this; final Summon summon = (Summon) this;
if (summon.getOwner() != null) if (summon.getOwner() != null)
{ {
summon.updateAndBroadcastStatus(); summon.updateAndBroadcastStatus(1);
} }
} }
else else
@@ -10426,7 +10426,7 @@ public class Player extends Playable
((SummonAI) _pet.getAI()).setStartFollowController(true); ((SummonAI) _pet.getAI()).setStartFollowController(true);
_pet.setFollowStatus(true); _pet.setFollowStatus(true);
_pet.setInstance(getInstanceWorld()); _pet.setInstance(getInstanceWorld());
_pet.updateAndBroadcastStatus(); _pet.updateAndBroadcastStatus(0);
sendPacket(new PetInfo(_pet, 0)); sendPacket(new PetInfo(_pet, 0));
} }
@@ -10437,7 +10437,7 @@ public class Player extends Playable
((SummonAI) s.getAI()).setStartFollowController(true); ((SummonAI) s.getAI()).setStartFollowController(true);
s.setFollowStatus(true); s.setFollowStatus(true);
s.setInstance(getInstanceWorld()); s.setInstance(getInstanceWorld());
s.updateAndBroadcastStatus(); s.updateAndBroadcastStatus(0);
sendPacket(new PetInfo(s, 0)); sendPacket(new PetInfo(s, 0));
}); });
@@ -123,7 +123,7 @@ public abstract class Summon extends Playable
} }
setFollowStatus(true); setFollowStatus(true);
updateAndBroadcastStatus(); updateAndBroadcastStatus(0);
if (isPet()) if (isPet())
{ {
final Pet pet = (Pet) this; final Pet pet = (Pet) this;
@@ -133,13 +133,13 @@ public abstract class Summon extends Playable
if (_owner != null) if (_owner != null)
{ {
_owner.sendPacket(new PetInfo(this, 1)); sendPacket(new PetInfo(this, 1));
_owner.sendPacket(new ExPetSkillList(true, this)); sendPacket(new ExPetSkillList(true, this));
if (getInventory() != null) if (getInventory() != null)
{ {
_owner.sendPacket(new PetItemList(getInventory().getItems())); sendPacket(new PetItemList(getInventory().getItems()));
} }
_owner.sendPacket(new RelationChanged(this, _owner.getRelation(_owner), false)); sendPacket(new RelationChanged(this, _owner.getRelation(_owner), false));
} }
World.getInstance().forEachVisibleObject(getOwner(), Player.class, player -> player.sendPacket(new RelationChanged(this, _owner.getRelation(player), isAutoAttackable(player)))); World.getInstance().forEachVisibleObject(getOwner(), Player.class, player -> player.sendPacket(new RelationChanged(this, _owner.getRelation(player), isAutoAttackable(player))));
final Party party = _owner.getParty(); final Party party = _owner.getParty();
@@ -199,14 +199,14 @@ public abstract class Summon extends Playable
public void stopAllEffects() public void stopAllEffects()
{ {
super.stopAllEffects(); super.stopAllEffects();
updateAndBroadcastStatus(); updateAndBroadcastStatus(1);
} }
@Override @Override
public void stopAllEffectsExceptThoseThatLastThroughDeath() public void stopAllEffectsExceptThoseThatLastThroughDeath()
{ {
super.stopAllEffectsExceptThoseThatLastThroughDeath(); super.stopAllEffectsExceptThoseThatLastThroughDeath();
updateAndBroadcastStatus(); updateAndBroadcastStatus(1);
} }
@Override @Override
@@ -384,7 +384,7 @@ public abstract class Summon extends Playable
public void broadcastStatusUpdate(Creature caster) public void broadcastStatusUpdate(Creature caster)
{ {
super.broadcastStatusUpdate(caster); super.broadcastStatusUpdate(caster);
updateAndBroadcastStatus(); updateAndBroadcastStatus(1);
} }
public void deleteMe(Player owner) public void deleteMe(Player owner)
@@ -836,17 +836,18 @@ public abstract class Summon extends Playable
return _owner; return _owner;
} }
public void updateAndBroadcastStatus() public void updateAndBroadcastStatus(int value)
{ {
if (_owner == null) if (_owner == null)
{ {
return; return;
} }
sendPacket(new PetInfo(this, value));
sendPacket(new PetStatusUpdate(this)); sendPacket(new PetStatusUpdate(this));
if (isSpawned()) if (isSpawned())
{ {
broadcastNpcInfo(0); broadcastNpcInfo(value);
} }
final Party party = _owner.getParty(); final Party party = _owner.getParty();
if (party != null) if (party != null)
@@ -886,9 +887,10 @@ public abstract class Summon extends Playable
@Override @Override
public void sendInfo(Player player) public void sendInfo(Player player)
{ {
// Check if the Player is the owner of the Pet
if (player == _owner) if (player == _owner)
{ {
player.sendPacket(new PetInfo(this, 1)); player.sendPacket(new PetInfo(this, isDead() ? 0 : 1));
if (isPet()) if (isPet())
{ {
player.sendPacket(new PetItemList(getInventory().getItems())); player.sendPacket(new PetItemList(getInventory().getItems()));
@@ -896,7 +898,7 @@ public abstract class Summon extends Playable
} }
else else
{ {
player.sendPacket(new ExPetInfo(this, player, isShowSummonAnimation() ? 2 : isDead() ? 0 : 1)); player.sendPacket(new ExPetInfo(this, player, 0));
} }
} }
@@ -1436,10 +1436,10 @@ public class Pet extends Summon
} }
@Override @Override
public void updateAndBroadcastStatus() public void updateAndBroadcastStatus(int value)
{ {
refreshOverloaded(); refreshOverloaded();
super.updateAndBroadcastStatus(); super.updateAndBroadcastStatus(value);
} }
@Override @Override
@@ -37,7 +37,7 @@ public class PetStat extends SummonStat
return false; return false;
} }
getActiveChar().updateAndBroadcastStatus(); getActiveChar().updateAndBroadcastStatus(1);
return true; return true;
} }
@@ -51,7 +51,7 @@ public class PetStat extends SummonStat
final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP); final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP);
sm.addLong(finalExp); sm.addLong(finalExp);
getActiveChar().updateAndBroadcastStatus(); getActiveChar().updateAndBroadcastStatus(1);
getActiveChar().sendPacket(sm); getActiveChar().sendPacket(sm);
return true; return true;
} }
@@ -71,7 +71,7 @@ public class PetStat extends SummonStat
getActiveChar().broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP)); getActiveChar().broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP));
} }
// Send a Server->Client packet PetInfo to the Player // Send a Server->Client packet PetInfo to the Player
getActiveChar().updateAndBroadcastStatus(); getActiveChar().updateAndBroadcastStatus(1);
if (getActiveChar().getControlItem() != null) if (getActiveChar().getControlItem() != null)
{ {
@@ -287,7 +287,7 @@ public class PlayerStat extends PlayableStat
pet.setCurrentHp(pet.getMaxHp()); pet.setCurrentHp(pet.getMaxHp());
pet.setCurrentMp(pet.getMaxMp()); pet.setCurrentMp(pet.getMaxMp());
pet.broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP)); pet.broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP));
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
} }
@@ -53,7 +53,7 @@ public class PetInventory extends Inventory
protected void refreshWeight() protected void refreshWeight()
{ {
super.refreshWeight(); super.refreshWeight();
_owner.updateAndBroadcastStatus(); _owner.updateAndBroadcastStatus(1);
} }
@Override @Override
@@ -640,7 +640,7 @@ public class SkillCaster implements Runnable
if (obj.isSummon()) if (obj.isSummon())
{ {
((Summon) obj).updateAndBroadcastStatus(); ((Summon) obj).updateAndBroadcastStatus(1);
} }
} }
else if (obj.isAttackable()) else if (obj.isAttackable())
@@ -85,6 +85,6 @@ public class RequestChangePetName implements IClientIncomingPacket
} }
pet.setName(_name); pet.setName(_name);
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
} }
@@ -118,7 +118,7 @@ public class RequestPetUseItem implements IClientIncomingPacket
} }
player.sendPacket(new PetItemList(pet.getInventory().getItems())); player.sendPacket(new PetItemList(pet.getInventory().getItems()));
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
else else
{ {
@@ -133,7 +133,7 @@ public class RequestPetUseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay); player.addTimeStampItem(item, reuseDelay);
} }
player.sendPacket(new PetItemList(pet.getInventory().getItems())); player.sendPacket(new PetItemList(pet.getInventory().getItems()));
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
} }
else else
@@ -155,7 +155,7 @@ public class ExPetInfo extends AbstractMaskPacket<NpcInfoType>
{ {
_statusMask |= 0x04; _statusMask |= 0x04;
} }
_statusMask |= 0x08; _statusMask |= 0x08; // Show name (current on retail is empty).
if (_statusMask != 0x00) if (_statusMask != 0x00)
{ {
addComponentType(NpcInfoType.VISUAL_STATE); addComponentType(NpcInfoType.VISUAL_STATE);
@@ -2678,7 +2678,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
final Summon summon = (Summon) this; final Summon summon = (Summon) this;
if (summon.getOwner() != null) if (summon.getOwner() != null)
{ {
summon.updateAndBroadcastStatus(); summon.updateAndBroadcastStatus(1);
} }
} }
else else
@@ -10492,7 +10492,7 @@ public class Player extends Playable
((SummonAI) _pet.getAI()).setStartFollowController(true); ((SummonAI) _pet.getAI()).setStartFollowController(true);
_pet.setFollowStatus(true); _pet.setFollowStatus(true);
_pet.setInstance(getInstanceWorld()); _pet.setInstance(getInstanceWorld());
_pet.updateAndBroadcastStatus(); _pet.updateAndBroadcastStatus(0);
sendPacket(new PetInfo(_pet, 0)); sendPacket(new PetInfo(_pet, 0));
} }
@@ -10503,7 +10503,7 @@ public class Player extends Playable
((SummonAI) s.getAI()).setStartFollowController(true); ((SummonAI) s.getAI()).setStartFollowController(true);
s.setFollowStatus(true); s.setFollowStatus(true);
s.setInstance(getInstanceWorld()); s.setInstance(getInstanceWorld());
s.updateAndBroadcastStatus(); s.updateAndBroadcastStatus(0);
sendPacket(new PetInfo(s, 0)); sendPacket(new PetInfo(s, 0));
}); });
@@ -123,7 +123,7 @@ public abstract class Summon extends Playable
} }
setFollowStatus(true); setFollowStatus(true);
updateAndBroadcastStatus(); updateAndBroadcastStatus(0);
if (isPet()) if (isPet())
{ {
final Pet pet = (Pet) this; final Pet pet = (Pet) this;
@@ -133,13 +133,13 @@ public abstract class Summon extends Playable
if (_owner != null) if (_owner != null)
{ {
_owner.sendPacket(new PetInfo(this, 1)); sendPacket(new PetInfo(this, 1));
_owner.sendPacket(new ExPetSkillList(true, this)); sendPacket(new ExPetSkillList(true, this));
if (getInventory() != null) if (getInventory() != null)
{ {
_owner.sendPacket(new PetItemList(getInventory().getItems())); sendPacket(new PetItemList(getInventory().getItems()));
} }
_owner.sendPacket(new RelationChanged(this, _owner.getRelation(_owner), false)); sendPacket(new RelationChanged(this, _owner.getRelation(_owner), false));
} }
World.getInstance().forEachVisibleObject(getOwner(), Player.class, player -> player.sendPacket(new RelationChanged(this, _owner.getRelation(player), isAutoAttackable(player)))); World.getInstance().forEachVisibleObject(getOwner(), Player.class, player -> player.sendPacket(new RelationChanged(this, _owner.getRelation(player), isAutoAttackable(player))));
final Party party = _owner.getParty(); final Party party = _owner.getParty();
@@ -199,14 +199,14 @@ public abstract class Summon extends Playable
public void stopAllEffects() public void stopAllEffects()
{ {
super.stopAllEffects(); super.stopAllEffects();
updateAndBroadcastStatus(); updateAndBroadcastStatus(1);
} }
@Override @Override
public void stopAllEffectsExceptThoseThatLastThroughDeath() public void stopAllEffectsExceptThoseThatLastThroughDeath()
{ {
super.stopAllEffectsExceptThoseThatLastThroughDeath(); super.stopAllEffectsExceptThoseThatLastThroughDeath();
updateAndBroadcastStatus(); updateAndBroadcastStatus(1);
} }
@Override @Override
@@ -384,7 +384,7 @@ public abstract class Summon extends Playable
public void broadcastStatusUpdate(Creature caster) public void broadcastStatusUpdate(Creature caster)
{ {
super.broadcastStatusUpdate(caster); super.broadcastStatusUpdate(caster);
updateAndBroadcastStatus(); updateAndBroadcastStatus(1);
} }
public void deleteMe(Player owner) public void deleteMe(Player owner)
@@ -836,17 +836,18 @@ public abstract class Summon extends Playable
return _owner; return _owner;
} }
public void updateAndBroadcastStatus() public void updateAndBroadcastStatus(int value)
{ {
if (_owner == null) if (_owner == null)
{ {
return; return;
} }
sendPacket(new PetInfo(this, value));
sendPacket(new PetStatusUpdate(this)); sendPacket(new PetStatusUpdate(this));
if (isSpawned()) if (isSpawned())
{ {
broadcastNpcInfo(0); broadcastNpcInfo(value);
} }
final Party party = _owner.getParty(); final Party party = _owner.getParty();
if (party != null) if (party != null)
@@ -886,9 +887,10 @@ public abstract class Summon extends Playable
@Override @Override
public void sendInfo(Player player) public void sendInfo(Player player)
{ {
// Check if the Player is the owner of the Pet
if (player == _owner) if (player == _owner)
{ {
player.sendPacket(new PetInfo(this, 1)); player.sendPacket(new PetInfo(this, isDead() ? 0 : 1));
if (isPet()) if (isPet())
{ {
player.sendPacket(new PetItemList(getInventory().getItems())); player.sendPacket(new PetItemList(getInventory().getItems()));
@@ -896,7 +898,7 @@ public abstract class Summon extends Playable
} }
else else
{ {
player.sendPacket(new ExPetInfo(this, player, isShowSummonAnimation() ? 2 : isDead() ? 0 : 1)); player.sendPacket(new ExPetInfo(this, player, 0));
} }
} }
@@ -1436,10 +1436,10 @@ public class Pet extends Summon
} }
@Override @Override
public void updateAndBroadcastStatus() public void updateAndBroadcastStatus(int value)
{ {
refreshOverloaded(); refreshOverloaded();
super.updateAndBroadcastStatus(); super.updateAndBroadcastStatus(value);
} }
@Override @Override
@@ -37,7 +37,7 @@ public class PetStat extends SummonStat
return false; return false;
} }
getActiveChar().updateAndBroadcastStatus(); getActiveChar().updateAndBroadcastStatus(1);
return true; return true;
} }
@@ -51,7 +51,7 @@ public class PetStat extends SummonStat
final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP); final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP);
sm.addLong(finalExp); sm.addLong(finalExp);
getActiveChar().updateAndBroadcastStatus(); getActiveChar().updateAndBroadcastStatus(1);
getActiveChar().sendPacket(sm); getActiveChar().sendPacket(sm);
return true; return true;
} }
@@ -71,7 +71,7 @@ public class PetStat extends SummonStat
getActiveChar().broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP)); getActiveChar().broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP));
} }
// Send a Server->Client packet PetInfo to the Player // Send a Server->Client packet PetInfo to the Player
getActiveChar().updateAndBroadcastStatus(); getActiveChar().updateAndBroadcastStatus(1);
if (getActiveChar().getControlItem() != null) if (getActiveChar().getControlItem() != null)
{ {
@@ -287,7 +287,7 @@ public class PlayerStat extends PlayableStat
pet.setCurrentHp(pet.getMaxHp()); pet.setCurrentHp(pet.getMaxHp());
pet.setCurrentMp(pet.getMaxMp()); pet.setCurrentMp(pet.getMaxMp());
pet.broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP)); pet.broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP));
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
} }
@@ -53,7 +53,7 @@ public class PetInventory extends Inventory
protected void refreshWeight() protected void refreshWeight()
{ {
super.refreshWeight(); super.refreshWeight();
_owner.updateAndBroadcastStatus(); _owner.updateAndBroadcastStatus(1);
} }
@Override @Override
@@ -640,7 +640,7 @@ public class SkillCaster implements Runnable
if (obj.isSummon()) if (obj.isSummon())
{ {
((Summon) obj).updateAndBroadcastStatus(); ((Summon) obj).updateAndBroadcastStatus(1);
} }
} }
else if (obj.isAttackable()) else if (obj.isAttackable())
@@ -85,6 +85,6 @@ public class RequestChangePetName implements IClientIncomingPacket
} }
pet.setName(_name); pet.setName(_name);
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
} }
@@ -118,7 +118,7 @@ public class RequestPetUseItem implements IClientIncomingPacket
} }
player.sendPacket(new PetItemList(pet.getInventory().getItems())); player.sendPacket(new PetItemList(pet.getInventory().getItems()));
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
else else
{ {
@@ -133,7 +133,7 @@ public class RequestPetUseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay); player.addTimeStampItem(item, reuseDelay);
} }
player.sendPacket(new PetItemList(pet.getInventory().getItems())); player.sendPacket(new PetItemList(pet.getInventory().getItems()));
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
} }
else else
@@ -155,7 +155,7 @@ public class ExPetInfo extends AbstractMaskPacket<NpcInfoType>
{ {
_statusMask |= 0x04; _statusMask |= 0x04;
} }
_statusMask |= 0x08; _statusMask |= 0x08; // Show name (current on retail is empty).
if (_statusMask != 0x00) if (_statusMask != 0x00)
{ {
addComponentType(NpcInfoType.VISUAL_STATE); addComponentType(NpcInfoType.VISUAL_STATE);
@@ -2678,7 +2678,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
final Summon summon = (Summon) this; final Summon summon = (Summon) this;
if (summon.getOwner() != null) if (summon.getOwner() != null)
{ {
summon.updateAndBroadcastStatus(); summon.updateAndBroadcastStatus(1);
} }
} }
else else
@@ -10492,7 +10492,7 @@ public class Player extends Playable
((SummonAI) _pet.getAI()).setStartFollowController(true); ((SummonAI) _pet.getAI()).setStartFollowController(true);
_pet.setFollowStatus(true); _pet.setFollowStatus(true);
_pet.setInstance(getInstanceWorld()); _pet.setInstance(getInstanceWorld());
_pet.updateAndBroadcastStatus(); _pet.updateAndBroadcastStatus(0);
sendPacket(new PetInfo(_pet, 0)); sendPacket(new PetInfo(_pet, 0));
} }
@@ -10503,7 +10503,7 @@ public class Player extends Playable
((SummonAI) s.getAI()).setStartFollowController(true); ((SummonAI) s.getAI()).setStartFollowController(true);
s.setFollowStatus(true); s.setFollowStatus(true);
s.setInstance(getInstanceWorld()); s.setInstance(getInstanceWorld());
s.updateAndBroadcastStatus(); s.updateAndBroadcastStatus(0);
sendPacket(new PetInfo(s, 0)); sendPacket(new PetInfo(s, 0));
}); });
@@ -123,7 +123,7 @@ public abstract class Summon extends Playable
} }
setFollowStatus(true); setFollowStatus(true);
updateAndBroadcastStatus(); updateAndBroadcastStatus(0);
if (isPet()) if (isPet())
{ {
final Pet pet = (Pet) this; final Pet pet = (Pet) this;
@@ -133,13 +133,13 @@ public abstract class Summon extends Playable
if (_owner != null) if (_owner != null)
{ {
_owner.sendPacket(new PetInfo(this, 1)); sendPacket(new PetInfo(this, 1));
_owner.sendPacket(new ExPetSkillList(true, this)); sendPacket(new ExPetSkillList(true, this));
if (getInventory() != null) if (getInventory() != null)
{ {
_owner.sendPacket(new PetItemList(getInventory().getItems())); sendPacket(new PetItemList(getInventory().getItems()));
} }
_owner.sendPacket(new RelationChanged(this, _owner.getRelation(_owner), false)); sendPacket(new RelationChanged(this, _owner.getRelation(_owner), false));
} }
World.getInstance().forEachVisibleObject(getOwner(), Player.class, player -> player.sendPacket(new RelationChanged(this, _owner.getRelation(player), isAutoAttackable(player)))); World.getInstance().forEachVisibleObject(getOwner(), Player.class, player -> player.sendPacket(new RelationChanged(this, _owner.getRelation(player), isAutoAttackable(player))));
final Party party = _owner.getParty(); final Party party = _owner.getParty();
@@ -199,14 +199,14 @@ public abstract class Summon extends Playable
public void stopAllEffects() public void stopAllEffects()
{ {
super.stopAllEffects(); super.stopAllEffects();
updateAndBroadcastStatus(); updateAndBroadcastStatus(1);
} }
@Override @Override
public void stopAllEffectsExceptThoseThatLastThroughDeath() public void stopAllEffectsExceptThoseThatLastThroughDeath()
{ {
super.stopAllEffectsExceptThoseThatLastThroughDeath(); super.stopAllEffectsExceptThoseThatLastThroughDeath();
updateAndBroadcastStatus(); updateAndBroadcastStatus(1);
} }
@Override @Override
@@ -384,7 +384,7 @@ public abstract class Summon extends Playable
public void broadcastStatusUpdate(Creature caster) public void broadcastStatusUpdate(Creature caster)
{ {
super.broadcastStatusUpdate(caster); super.broadcastStatusUpdate(caster);
updateAndBroadcastStatus(); updateAndBroadcastStatus(1);
} }
public void deleteMe(Player owner) public void deleteMe(Player owner)
@@ -836,17 +836,18 @@ public abstract class Summon extends Playable
return _owner; return _owner;
} }
public void updateAndBroadcastStatus() public void updateAndBroadcastStatus(int value)
{ {
if (_owner == null) if (_owner == null)
{ {
return; return;
} }
sendPacket(new PetInfo(this, value));
sendPacket(new PetStatusUpdate(this)); sendPacket(new PetStatusUpdate(this));
if (isSpawned()) if (isSpawned())
{ {
broadcastNpcInfo(0); broadcastNpcInfo(value);
} }
final Party party = _owner.getParty(); final Party party = _owner.getParty();
if (party != null) if (party != null)
@@ -886,9 +887,10 @@ public abstract class Summon extends Playable
@Override @Override
public void sendInfo(Player player) public void sendInfo(Player player)
{ {
// Check if the Player is the owner of the Pet
if (player == _owner) if (player == _owner)
{ {
player.sendPacket(new PetInfo(this, 1)); player.sendPacket(new PetInfo(this, isDead() ? 0 : 1));
if (isPet()) if (isPet())
{ {
player.sendPacket(new PetItemList(getInventory().getItems())); player.sendPacket(new PetItemList(getInventory().getItems()));
@@ -896,7 +898,7 @@ public abstract class Summon extends Playable
} }
else else
{ {
player.sendPacket(new ExPetInfo(this, player, isShowSummonAnimation() ? 2 : isDead() ? 0 : 1)); player.sendPacket(new ExPetInfo(this, player, 0));
} }
} }
@@ -1436,10 +1436,10 @@ public class Pet extends Summon
} }
@Override @Override
public void updateAndBroadcastStatus() public void updateAndBroadcastStatus(int value)
{ {
refreshOverloaded(); refreshOverloaded();
super.updateAndBroadcastStatus(); super.updateAndBroadcastStatus(value);
} }
@Override @Override
@@ -37,7 +37,7 @@ public class PetStat extends SummonStat
return false; return false;
} }
getActiveChar().updateAndBroadcastStatus(); getActiveChar().updateAndBroadcastStatus(1);
return true; return true;
} }
@@ -51,7 +51,7 @@ public class PetStat extends SummonStat
final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP); final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP);
sm.addLong(finalExp); sm.addLong(finalExp);
getActiveChar().updateAndBroadcastStatus(); getActiveChar().updateAndBroadcastStatus(1);
getActiveChar().sendPacket(sm); getActiveChar().sendPacket(sm);
return true; return true;
} }
@@ -71,7 +71,7 @@ public class PetStat extends SummonStat
getActiveChar().broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP)); getActiveChar().broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP));
} }
// Send a Server->Client packet PetInfo to the Player // Send a Server->Client packet PetInfo to the Player
getActiveChar().updateAndBroadcastStatus(); getActiveChar().updateAndBroadcastStatus(1);
if (getActiveChar().getControlItem() != null) if (getActiveChar().getControlItem() != null)
{ {
@@ -287,7 +287,7 @@ public class PlayerStat extends PlayableStat
pet.setCurrentHp(pet.getMaxHp()); pet.setCurrentHp(pet.getMaxHp());
pet.setCurrentMp(pet.getMaxMp()); pet.setCurrentMp(pet.getMaxMp());
pet.broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP)); pet.broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP));
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
} }
@@ -53,7 +53,7 @@ public class PetInventory extends Inventory
protected void refreshWeight() protected void refreshWeight()
{ {
super.refreshWeight(); super.refreshWeight();
_owner.updateAndBroadcastStatus(); _owner.updateAndBroadcastStatus(1);
} }
@Override @Override
@@ -640,7 +640,7 @@ public class SkillCaster implements Runnable
if (obj.isSummon()) if (obj.isSummon())
{ {
((Summon) obj).updateAndBroadcastStatus(); ((Summon) obj).updateAndBroadcastStatus(1);
} }
} }
else if (obj.isAttackable()) else if (obj.isAttackable())
@@ -85,6 +85,6 @@ public class RequestChangePetName implements IClientIncomingPacket
} }
pet.setName(_name); pet.setName(_name);
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
} }
@@ -118,7 +118,7 @@ public class RequestPetUseItem implements IClientIncomingPacket
} }
player.sendPacket(new PetItemList(pet.getInventory().getItems())); player.sendPacket(new PetItemList(pet.getInventory().getItems()));
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
else else
{ {
@@ -133,7 +133,7 @@ public class RequestPetUseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay); player.addTimeStampItem(item, reuseDelay);
} }
player.sendPacket(new PetItemList(pet.getInventory().getItems())); player.sendPacket(new PetItemList(pet.getInventory().getItems()));
pet.updateAndBroadcastStatus(); pet.updateAndBroadcastStatus(1);
} }
} }
else else
@@ -208,7 +208,7 @@ public class SummonInfo extends AbstractMaskPacket<NpcInfoType>
OutgoingPackets.SUMMON_INFO.writeId(packet); OutgoingPackets.SUMMON_INFO.writeId(packet);
packet.writeD(_summon.getObjectId()); packet.writeD(_summon.getObjectId());
packet.writeC(_value); // 0=teleported 1=default 2=summoned packet.writeC(_value); // 0=teleported 1=default 2=summoned
packet.writeH(37); // mask_bits_37 packet.writeH(38); // 338 - mask_bits_38
packet.writeB(_masks); packet.writeB(_masks);
// Block 1 // Block 1
packet.writeC(_initSize); packet.writeC(_initSize);
@@ -155,7 +155,7 @@ public class ExPetInfo extends AbstractMaskPacket<NpcInfoType>
{ {
_statusMask |= 0x04; _statusMask |= 0x04;
} }
_statusMask |= 0x08; _statusMask |= 0x08; // Show name (current on retail is empty).
if (_statusMask != 0x00) if (_statusMask != 0x00)
{ {
addComponentType(NpcInfoType.VISUAL_STATE); addComponentType(NpcInfoType.VISUAL_STATE);
@@ -208,7 +208,7 @@ public class ExPetInfo extends AbstractMaskPacket<NpcInfoType>
OutgoingPackets.EX_PET_INFO.writeId(packet); OutgoingPackets.EX_PET_INFO.writeId(packet);
packet.writeD(_summon.getObjectId()); packet.writeD(_summon.getObjectId());
packet.writeC(_value); // 0=teleported 1=default 2=summoned packet.writeC(_value); // 0=teleported 1=default 2=summoned
packet.writeH(37); // mask_bits_37 packet.writeH(38); // 338 - mask_bits_38
packet.writeB(_masks); packet.writeB(_masks);
// Block 1 // Block 1
packet.writeC(_initSize); packet.writeC(_initSize);