diff options
Diffstat (limited to 'src/game/Item.h')
-rw-r--r-- | src/game/Item.h | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/src/game/Item.h b/src/game/Item.h index 3417f2fcc6d..30cf1a595cb 100644 --- a/src/game/Item.h +++ b/src/game/Item.h @@ -1,7 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * - * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,8 +118,11 @@ enum InventoryChangeFailure EQUIP_ERR_TOO_MUCH_GOLD = 77, EQUIP_ERR_NOT_DURING_ARENA_MATCH = 78, EQUIP_ERR_CANNOT_TRADE_THAT = 79, - EQUIP_ERR_PERSONAL_ARENA_RATING_TOO_LOW = 80 - // probably exist more + EQUIP_ERR_PERSONAL_ARENA_RATING_TOO_LOW = 80, + // no output = 81, + EQUIP_ERR_ARTEFACTS_ONLY_FOR_OWN_CHARACTERS = 82, + // no output = 83, + // crash client = 84, }; enum BuyFailure @@ -148,29 +151,32 @@ enum SellFailure // -1 from client enchantment slot number enum EnchantmentSlot { - PERM_ENCHANTMENT_SLOT = 0, - TEMP_ENCHANTMENT_SLOT = 1, - SOCK_ENCHANTMENT_SLOT = 2, - SOCK_ENCHANTMENT_SLOT_2 = 3, - SOCK_ENCHANTMENT_SLOT_3 = 4, - BONUS_ENCHANTMENT_SLOT = 5, - MAX_INSPECTED_ENCHANTMENT_SLOT = 6, - - PROP_ENCHANTMENT_SLOT_0 = 6, // used with RandomSuffix - PROP_ENCHANTMENT_SLOT_1 = 7, // used with RandomSuffix - PROP_ENCHANTMENT_SLOT_2 = 8, // used with RandomSuffix and RandomProperty - PROP_ENCHANTMENT_SLOT_3 = 9, // used with RandomProperty - PROP_ENCHANTMENT_SLOT_4 = 10, // used with RandomProperty - MAX_ENCHANTMENT_SLOT = 11 + PERM_ENCHANTMENT_SLOT = 0, + TEMP_ENCHANTMENT_SLOT = 1, + SOCK_ENCHANTMENT_SLOT = 2, + SOCK_ENCHANTMENT_SLOT_2 = 3, + SOCK_ENCHANTMENT_SLOT_3 = 4, + BONUS_ENCHANTMENT_SLOT = 5, + PRISMATIC_ENCHANTMENT_SLOT = 6, // added at apply special permanent enchantment + MAX_INSPECTED_ENCHANTMENT_SLOT = 7, + + PROP_ENCHANTMENT_SLOT_0 = 7, // used with RandomSuffix + PROP_ENCHANTMENT_SLOT_1 = 8, // used with RandomSuffix + PROP_ENCHANTMENT_SLOT_2 = 9, // used with RandomSuffix and RandomProperty + PROP_ENCHANTMENT_SLOT_3 = 10, // used with RandomProperty + PROP_ENCHANTMENT_SLOT_4 = 11, // used with RandomProperty + MAX_ENCHANTMENT_SLOT = 12 }; -#define MAX_VISIBLE_ITEM_OFFSET 16 // 16 fields per visible item (creator(2) + enchantments(12) + properties(1) + pad(1)) +#define MAX_VISIBLE_ITEM_OFFSET 18 // 18 fields per visible item (creator(2) + enchantments(13) + properties(1) + seed(1) + pad(1)) + +#define MAX_GEM_SOCKETS MAX_ITEM_PROTO_SOCKETS// (BONUS_ENCHANTMENT_SLOT-SOCK_ENCHANTMENT_SLOT) and item proto size, equal value expected enum EnchantmentOffset { ENCHANTMENT_ID_OFFSET = 0, ENCHANTMENT_DURATION_OFFSET = 1, - ENCHANTMENT_CHARGES_OFFSET = 2 + ENCHANTMENT_CHARGES_OFFSET = 2 // now here not only charges, but something new in wotlk }; #define MAX_ENCHANTMENT_OFFSET 3 @@ -211,7 +217,8 @@ class TRINITY_DLL_SPEC Item : public Object void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS,ITEM_FLAGS_BINDED,val); } bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_BINDED); } - bool IsBindedNotWith(uint64 guid) const { return IsSoulBound() && GetOwnerGUID()!= guid; } + bool IsBoundAccountWide() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_BOA); } + bool IsBindedNotWith(Player const* player) const; bool IsBoundByEnchant() const; virtual void SaveToDB(); virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result = NULL); @@ -220,7 +227,7 @@ class TRINITY_DLL_SPEC Item : public Object bool IsBag() const { return GetProto()->InventoryType == INVTYPE_BAG; } bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; } - bool CanBeTraded() const; + bool CanBeTraded(bool mail = false) const; void SetInTrade(bool b = true) { mb_in_trade = b; } bool IsInTrade() const { return mb_in_trade; } @@ -230,8 +237,9 @@ class TRINITY_DLL_SPEC Item : public Object uint32 GetCount() const { return GetUInt32Value (ITEM_FIELD_STACK_COUNT); } void SetCount(uint32 value) { SetUInt32Value (ITEM_FIELD_STACK_COUNT, value); } - uint32 GetMaxStackCount() const { return GetProto()->Stackable; } + uint32 GetMaxStackCount() const { return GetProto()->GetMaxStackSize(); } uint8 GetGemCountWithID(uint32 GemID) const; + uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const; uint8 GetSlot() const {return m_slot;} Bag *GetContainer() { return m_container; } @@ -256,9 +264,9 @@ class TRINITY_DLL_SPEC Item : public Object void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration); void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges); void ClearEnchantment(EnchantmentSlot slot); - uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);} - uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);} - uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);} + uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);} + uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);} + uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);} void SendTimeUpdate(Player* owner); void UpdateDuration(Player* owner, uint32 diff); @@ -282,13 +290,12 @@ class TRINITY_DLL_SPEC Item : public Object uState = state; } - bool hasQuest(uint32 quest_id) const - { - ItemPrototype const *itemProto = GetProto(); - return itemProto && itemProto->StartQuest == quest_id; - } + bool hasQuest(uint32 quest_id) const { return GetProto()->StartQuest == quest_id; } bool hasInvolvedQuest(uint32 /*quest_id*/) const { return false; } - + bool IsPotion() const { return GetProto()->IsPotion(); } + bool IsWeaponVellum() const { return GetProto()->IsWeaponVellum(); } + bool IsArmorVellum() const { return GetProto()->IsArmorVellum(); } + bool IsConjuredConsumable() const { return GetProto()->IsConjuredConsumable(); } private: uint8 m_slot; Bag *m_container; |