Fixed talisman display on login.

This commit is contained in:
MobiusDevelopment
2024-02-06 03:14:02 +02:00
parent 57b6fd06a5
commit f7972af1d0
52 changed files with 854 additions and 352 deletions

View File

@ -373,6 +373,11 @@ public class PlayerStat extends PlayableStat
*/
public int getTalismanSlots()
{
if (!getActiveChar().hasEnteredWorld())
{
return 6;
}
return _talismanSlots.get();
}

View File

@ -1362,6 +1362,7 @@ public abstract class Inventory extends ItemContainer
*/
public synchronized Item setPaperdollItem(int slot, Item item)
{
final Creature owner = getOwner();
final Item old = _paperdoll[slot];
if (old != item)
{
@ -1424,21 +1425,33 @@ public abstract class Inventory extends ItemContainer
}
_paperdollCache.clearCachedStats();
getOwner().getStat().recalculateStats(!getOwner().isPlayer());
owner.getStat().recalculateStats(!owner.isPlayer());
if (getOwner().isPlayer())
if (owner.isPlayer())
{
getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer()));
owner.sendPacket(new ExUserInfoEquipSlot(owner.getActingPlayer()));
}
}
// Notify to scripts
if (old != null)
{
final Creature owner = getOwner();
if ((owner != null) && owner.isPlayer() && EventDispatcher.getInstance().hasListener(EventType.ON_PLAYER_ITEM_UNEQUIP, old.getTemplate()))
if ((owner != null) && owner.isPlayer())
{
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getTemplate());
// Proper talisman display on login.
final Player player = owner.getActingPlayer();
if ((slot == PAPERDOLL_RBRACELET) && !player.hasEnteredWorld())
{
for (ItemSkillHolder skill : old.getTemplate().getAllSkills())
{
player.addSkill(skill.getSkill(), false);
}
}
// Notify to scripts.
if (EventDispatcher.getInstance().hasListener(EventType.ON_PLAYER_ITEM_UNEQUIP, old.getTemplate()))
{
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(player, old), old.getTemplate());
}
}
}