From e379be034996a18d46832827df89b9e0361c4752 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 1 Jul 2009 17:50:59 -0500 Subject: [PATCH] [8094] Overwrite max durability for item at item loading from prototype. Author: VladimirMangos --HG-- branch : trunk --- src/game/Item.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/game/Item.cpp b/src/game/Item.cpp index bc1c1eeeaa..2277637701 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) {