aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-07-01 17:50:59 -0500
committermegamage <none@none>2009-07-01 17:50:59 -0500
commite379be034996a18d46832827df89b9e0361c4752 (patch)
tree7fce097b12fa59cab25e11c36ff43447493888b3 /src
parentbc2b02708f377bae74241b2077f17bc554da07d2 (diff)
[8094] Overwrite max durability for item at item loading from prototype. Author: VladimirMangos
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Item.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp
index bc1c1eeeaab..2277637701a 100644
--- a/src/game/Item.cpp
+++ b/src/game/Item.cpp
@@ -380,6 +380,16 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result)
if(!proto)
return false;
+ // update max durability (and durability) if need
+ if(proto->MaxDurability!= GetUInt32Value(ITEM_FIELD_MAXDURABILITY))
+ {
+ SetUInt32Value(ITEM_FIELD_MAXDURABILITY,proto->MaxDurability);
+ if(GetUInt32Value(ITEM_FIELD_DURABILITY) > proto->MaxDurability)
+ SetUInt32Value(ITEM_FIELD_DURABILITY,proto->MaxDurability);
+
+ need_save = true;
+ }
+
// recalculate suffix factor
if(GetItemRandomPropertyId() < 0)
{