diff options
Diffstat (limited to 'src/game/Item.cpp')
-rw-r--r-- | src/game/Item.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp index bc1c1eeeaab..484fa766da0 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -25,6 +25,7 @@ #include "Database/DatabaseEnv.h" #include "ItemEnchantmentMgr.h" #include "SpellMgr.h" +#include "ScriptCalls.h" void AddItemsSetItem(Player*player,Item *item) { @@ -285,6 +286,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff) if (GetUInt32Value(ITEM_FIELD_DURATION)<=diff) { owner->DestroyItem(GetBagSlot(), GetSlot(), true); + Script->ItemExpire(owner, GetProto()); return; } @@ -380,6 +382,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) { |