From bbdd2ee2737b3abf8e4eef795f53c4be90b71d9b Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 22 Jan 2012 03:41:34 +0000 Subject: Update SMSG_DURABILITY_DAMAGE_DEATH to 4.x. Auras can change durability damage (Reinforce guild perk) and need to send the updated value to the client. --- src/server/game/Entities/Player/Player.cpp | 12 +++++++----- src/server/game/Entities/Player/Player.h | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/server/game/Entities/Player') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index cdb9ddbcd9b..404557a4d96 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1279,10 +1279,12 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) { if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage { - sLog->outStaticDebug("We are fall to death, loosing 10 percents durability"); - DurabilityLossAll(0.10f, false); + float percent = 0.10f; + DurabilityLossAll(percent, false); + sLog->outStaticDebug("We are fall to death, loosing %f percents durability", percent); // durability lost message - WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 0); + WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 4); + data2 << uint32(percent*100); GetSession()->SendPacket(&data2); } @@ -5391,7 +5393,7 @@ Corpse* Player::GetCorpse() const return sObjectAccessor->GetCorpseForPlayerGUID(GetGUID()); } -void Player::DurabilityLossAll(double percent, bool inventory) +void Player::DurabilityLossAll(double &percent, bool inventory) { for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) @@ -5417,7 +5419,7 @@ void Player::DurabilityLossAll(double percent, bool inventory) } } -void Player::DurabilityLoss(Item* item, double percent) +void Player::DurabilityLoss(Item* item, double &percent) { if (!item) return; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index a594f2c02ef..a9ad919cd04 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1994,8 +1994,8 @@ class Player : public Unit, public GridObject void BuildPlayerRepop(); void RepopAtGraveyard(); - void DurabilityLossAll(double percent, bool inventory); - void DurabilityLoss(Item* item, double percent); + void DurabilityLossAll(double &percent, bool inventory); + void DurabilityLoss(Item* item, double &percent); void DurabilityPointsLossAll(int32 points, bool inventory); void DurabilityPointsLoss(Item* item, int32 points); void DurabilityPointLossForEquipSlot(EquipmentSlots slot); -- cgit v1.2.3