Display percentual hitpoints in PacketObjectStatus (0x11) (#1573)

This commit is contained in:
David Kindl 2026-05-19 22:42:49 +02:00
parent 06de4e2bdc
commit f265ee74bb
No known key found for this signature in database
GPG key ID: AF8B556A96DF4C32

View file

@ -180,8 +180,8 @@ PacketObjectStatus::PacketObjectStatus(const CClient* target, CObjBase* object)
if ( objectChar )
{
fCanRename = objectChar->IsOwnedBy(character);
iHitsCurrent = (word)objectChar->Stat_GetVal(STAT_STR);
iHitsMax = (word)objectChar->Stat_GetMaxAdjusted(STAT_STR);
const ushort tmpMaxHits = objectChar->Stat_GetMaxAdjusted(STAT_STR);
iHitsCurrent = static_cast<word>((objectChar->Stat_GetVal(STAT_STR) * 100) / maximum(tmpMaxHits, 1));
}
else
{
@ -191,8 +191,8 @@ PacketObjectStatus::PacketObjectStatus(const CClient* target, CObjBase* object)
CCItemDamageable *pItem = static_cast<CCItemDamageable*>(object->GetComponent(COMP_ITEMDAMAGEABLE));
if (pItem)
{
iHitsCurrent = pItem->GetCurHits();
iHitsMax = pItem->GetMaxHits();
const ushort tmpMaxHits = pItem->GetMaxHits();
iHitsCurrent = static_cast<word>((pItem->GetCurHits() * 100) / maximum(tmpMaxHits, 1));
}
else
{