mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-28 16:16:27 +00:00
refactor(ItemTemplate): add missing enums + other minor improvements (#2236)
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include "Common.h"
|
||||
#include "Unit.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "ItemPrototype.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "LootMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Cell.h"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define MAX_BAG_SIZE 36 // 2.0.12
|
||||
|
||||
#include "Item.h"
|
||||
#include "ItemPrototype.h"
|
||||
#include "ItemTemplate.h"
|
||||
|
||||
class Bag : public Item
|
||||
{
|
||||
|
||||
@@ -343,7 +343,7 @@ void Item::SaveToDB(SQLTransaction& trans)
|
||||
|
||||
trans->Append(stmt);
|
||||
|
||||
if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
|
||||
if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER);
|
||||
stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));
|
||||
@@ -358,7 +358,7 @@ void Item::SaveToDB(SQLTransaction& trans)
|
||||
stmt->setUInt32(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
|
||||
stmt->setUInt32(0, guid);
|
||||
@@ -425,7 +425,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
|
||||
// Remove bind flag for items vs NO_BIND set
|
||||
if (IsSoulBound() && proto->Bonding == NO_BIND)
|
||||
{
|
||||
ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, false);
|
||||
ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_SOULBOUND, false);
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
|
||||
// update max durability (and durability) if need
|
||||
// xinef: do not overwrite durability for wrapped items!!
|
||||
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, proto->MaxDurability);
|
||||
if (durability > proto->MaxDurability && !HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
|
||||
if (durability > proto->MaxDurability && !HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
|
||||
{
|
||||
SetUInt32Value(ITEM_FIELD_DURABILITY, proto->MaxDurability);
|
||||
need_save = true;
|
||||
@@ -729,7 +729,7 @@ bool Item::CanBeTraded(bool mail, bool trade) const
|
||||
if (m_lootGenerated)
|
||||
return false;
|
||||
|
||||
if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE) || !trade)))
|
||||
if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE) || !trade)))
|
||||
return false;
|
||||
|
||||
if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()))
|
||||
@@ -1048,7 +1048,7 @@ Item* Item::CloneItem(uint32 count, Player const* player) const
|
||||
|
||||
newItem->SetUInt32Value(ITEM_FIELD_CREATOR, GetUInt32Value(ITEM_FIELD_CREATOR));
|
||||
newItem->SetUInt32Value(ITEM_FIELD_GIFTCREATOR, GetUInt32Value(ITEM_FIELD_GIFTCREATOR));
|
||||
newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS) & ~(ITEM_FLAG_REFUNDABLE | ITEM_FLAG_BOP_TRADEABLE));
|
||||
newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS) & ~(ITEM_FIELD_FLAG_REFUNDABLE | ITEM_FIELD_FLAG_BOP_TRADEABLE));
|
||||
newItem->SetUInt32Value(ITEM_FIELD_DURATION, GetUInt32Value(ITEM_FIELD_DURATION));
|
||||
// player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
|
||||
if (player)
|
||||
@@ -1066,7 +1066,7 @@ bool Item::IsBindedNotWith(Player const* player) const
|
||||
if (GetOwnerGUID() == player->GetGUID())
|
||||
return false;
|
||||
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE))
|
||||
if (allowedGUIDs.find(player->GetGUIDLow()) != allowedGUIDs.end())
|
||||
return false;
|
||||
|
||||
@@ -1115,10 +1115,10 @@ void Item::DeleteRefundDataFromDB(SQLTransaction* trans)
|
||||
|
||||
void Item::SetNotRefundable(Player* owner, bool changestate /*=true*/, SQLTransaction* trans /*=NULL*/)
|
||||
{
|
||||
if (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
|
||||
if (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE))
|
||||
return;
|
||||
|
||||
RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE);
|
||||
RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE);
|
||||
// Following is not applicable in the trading procedure
|
||||
if (changestate)
|
||||
SetState(ITEM_CHANGED, owner);
|
||||
@@ -1173,13 +1173,13 @@ bool Item::IsRefundExpired()
|
||||
|
||||
void Item::SetSoulboundTradeable(AllowedLooterSet& allowedLooters)
|
||||
{
|
||||
SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE);
|
||||
SetFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE);
|
||||
allowedGUIDs = allowedLooters;
|
||||
}
|
||||
|
||||
void Item::ClearSoulboundTradeable(Player* currentOwner)
|
||||
{
|
||||
RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE);
|
||||
RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE);
|
||||
if (allowedGUIDs.empty())
|
||||
return;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "Common.h"
|
||||
#include "Object.h"
|
||||
#include "LootMgr.h"
|
||||
#include "ItemPrototype.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
class SpellInfo;
|
||||
@@ -209,9 +209,9 @@ class Item : public Object
|
||||
void SetOwnerGUID(uint64 guid) { SetUInt64Value(ITEM_FIELD_OWNER, guid); }
|
||||
Player* GetOwner() const;
|
||||
|
||||
void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, val); }
|
||||
bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND); }
|
||||
bool IsBoundAccountWide() const { return (GetTemplate()->Flags & ITEM_PROTO_FLAG_BIND_TO_ACCOUNT) != 0; }
|
||||
void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_SOULBOUND, val); }
|
||||
bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_SOULBOUND); }
|
||||
bool IsBoundAccountWide() const { return (GetTemplate()->Flags & ITEM_FLAG_IS_BOUND_TO_ACCOUNT) != 0; }
|
||||
bool IsBindedNotWith(Player const* player) const;
|
||||
bool IsBoundByEnchant() const;
|
||||
bool IsBoundByTempEnchant() const;
|
||||
@@ -227,7 +227,7 @@ class Item : public Object
|
||||
Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return NULL; }
|
||||
const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return NULL; }
|
||||
|
||||
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED); }
|
||||
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_UNLOCKED); }
|
||||
bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
|
||||
bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
|
||||
bool IsNotEmptyBag() const;
|
||||
|
||||
@@ -90,87 +90,117 @@ enum ItemBondingType
|
||||
};
|
||||
|
||||
#define MAX_BIND_TYPE 6
|
||||
/* /// @todo: Requiring actual cases in which using (an) item isn't allowed while shapeshifted. Else, this flag would need an implementation.
|
||||
ITEM_FLAG_USE_WHEN_SHAPESHIFTED = 0x00800000, // Item can be used in shapeshift forms */
|
||||
|
||||
/* TODO
|
||||
// need to know cases when using item is not allowed in shapeshift
|
||||
ITEM_PROTO_FLAG_USABLE_WHEN_SHAPESHIFTED = 0x00800000, // Item can be used in shapeshift forms
|
||||
*/
|
||||
|
||||
enum ItemProtoFlags
|
||||
enum ItemFieldFlags : uint32
|
||||
{
|
||||
ITEM_PROTO_FLAG_UNK1 = 0x00000001, // ?
|
||||
ITEM_PROTO_FLAG_CONJURED = 0x00000002, // Conjured item
|
||||
ITEM_PROTO_FLAG_OPENABLE = 0x00000004, // Item can be right clicked to open for loot
|
||||
ITEM_PROTO_FLAG_HEROIC = 0x00000008, // Makes green "Heroic" text appear on item
|
||||
ITEM_PROTO_FLAG_DEPRECATED = 0x00000010, // Cannot equip or use
|
||||
ITEM_PROTO_FLAG_INDESTRUCTIBLE = 0x00000020, // Item can not be destroyed, except by using spell (item can be reagent for spell)
|
||||
ITEM_PROTO_FLAG_UNK2 = 0x00000040, // ?
|
||||
ITEM_PROTO_FLAG_NO_EQUIP_COOLDOWN = 0x00000080, // No default 30 seconds cooldown when equipped
|
||||
ITEM_PROTO_FLAG_UNK3 = 0x00000100, // ?
|
||||
ITEM_PROTO_FLAG_WRAPPER = 0x00000200, // Item can wrap other items
|
||||
ITEM_PROTO_FLAG_UNK4 = 0x00000400, // ?
|
||||
ITEM_PROTO_FLAG_PARTY_LOOT = 0x00000800, // Looting this item does not remove it from available loot
|
||||
ITEM_PROTO_FLAG_REFUNDABLE = 0x00001000, // Item can be returned to vendor for its original cost (extended cost)
|
||||
ITEM_PROTO_FLAG_CHARTER = 0x00002000, // Item is guild or arena charter
|
||||
ITEM_PROTO_FLAG_UNK5 = 0x00004000, // Only readable items have this (but not all)
|
||||
ITEM_PROTO_FLAG_UNK6 = 0x00008000, // ?
|
||||
ITEM_PROTO_FLAG_UNK7 = 0x00010000, // ?
|
||||
ITEM_PROTO_FLAG_UNK8 = 0x00020000, // ?
|
||||
ITEM_PROTO_FLAG_PROSPECTABLE = 0x00040000, // Item can be prospected
|
||||
ITEM_PROTO_FLAG_UNIQUE_EQUIPPED = 0x00080000, // You can only equip one of these
|
||||
ITEM_PROTO_FLAG_UNK9 = 0x00100000, // ?
|
||||
ITEM_PROTO_FLAG_USEABLE_IN_ARENA = 0x00200000, // Item can be used during arena match
|
||||
ITEM_PROTO_FLAG_THROWABLE = 0x00400000, // Some Thrown weapons have it (and only Thrown) but not all
|
||||
ITEM_PROTO_FLAG_USABLE_WHEN_SHAPESHIFTED = 0x00800000, // Item can be used in shapeshift forms
|
||||
ITEM_PROTO_FLAG_UNK10 = 0x01000000, // ?
|
||||
ITEM_PROTO_FLAG_SMART_LOOT = 0x02000000, // Profession recipes: can only be looted if you meet requirements and don't already know it
|
||||
ITEM_PROTO_FLAG_NOT_USEABLE_IN_ARENA = 0x04000000, // Item cannot be used in arena
|
||||
ITEM_PROTO_FLAG_BIND_TO_ACCOUNT = 0x08000000, // Item binds to account and can be sent only to your own characters
|
||||
ITEM_PROTO_FLAG_TRIGGERED_CAST = 0x10000000, // Spell is cast with triggered flag
|
||||
ITEM_PROTO_FLAG_MILLABLE = 0x20000000, // Item can be milled
|
||||
ITEM_PROTO_FLAG_UNK11 = 0x40000000, // ?
|
||||
ITEM_PROTO_FLAG_UNK12 = 0x80000000 // ?
|
||||
ITEM_FIELD_FLAG_SOULBOUND = 0x00000001, // Item is soulbound and cannot be traded <<--
|
||||
ITEM_FIELD_FLAG_UNK1 = 0x00000002, // ?
|
||||
ITEM_FIELD_FLAG_UNLOCKED = 0x00000004, // Item had lock but can be opened now
|
||||
ITEM_FIELD_FLAG_WRAPPED = 0x00000008, // Item is wrapped and contains another item
|
||||
ITEM_FIELD_FLAG_UNK2 = 0x00000010, // ?
|
||||
ITEM_FIELD_FLAG_UNK3 = 0x00000020, // ?
|
||||
ITEM_FIELD_FLAG_UNK4 = 0x00000040, // ?
|
||||
ITEM_FIELD_FLAG_UNK5 = 0x00000080, // ?
|
||||
ITEM_FIELD_FLAG_BOP_TRADEABLE = 0x00000100, // Allows trading soulbound items
|
||||
ITEM_FIELD_FLAG_READABLE = 0x00000200, // Opens text page when right clicked
|
||||
ITEM_FIELD_FLAG_UNK6 = 0x00000400, // ?
|
||||
ITEM_FIELD_FLAG_UNK7 = 0x00000800, // ?
|
||||
ITEM_FIELD_FLAG_REFUNDABLE = 0x00001000, // Item can be returned to vendor for its original cost (extended cost)
|
||||
ITEM_FIELD_FLAG_UNK8 = 0x00002000, // ?
|
||||
ITEM_FIELD_FLAG_UNK9 = 0x00004000, // ?
|
||||
ITEM_FIELD_FLAG_UNK10 = 0x00008000, // ?
|
||||
ITEM_FIELD_FLAG_UNK11 = 0x00010000, // ?
|
||||
ITEM_FIELD_FLAG_UNK12 = 0x00020000, // ?
|
||||
ITEM_FIELD_FLAG_UNK13 = 0x00040000, // ?
|
||||
ITEM_FIELD_FLAG_UNK14 = 0x00080000, // ?
|
||||
ITEM_FIELD_FLAG_UNK15 = 0x00100000, // ?
|
||||
ITEM_FIELD_FLAG_UNK16 = 0x00200000, // ?
|
||||
ITEM_FIELD_FLAG_UNK17 = 0x00400000, // ?
|
||||
ITEM_FIELD_FLAG_UNK18 = 0x00800000, // ?
|
||||
ITEM_FIELD_FLAG_UNK19 = 0x01000000, // ?
|
||||
ITEM_FIELD_FLAG_UNK20 = 0x02000000, // ?
|
||||
ITEM_FIELD_FLAG_UNK21 = 0x04000000, // ?
|
||||
ITEM_FIELD_FLAG_UNK22 = 0x08000000, // ?
|
||||
ITEM_FIELD_FLAG_UNK23 = 0x10000000, // ?
|
||||
ITEM_FIELD_FLAG_UNK24 = 0x20000000, // ?
|
||||
ITEM_FIELD_FLAG_UNK25 = 0x40000000, // ?
|
||||
ITEM_FIELD_FLAG_UNK26 = 0x80000000, // ?
|
||||
|
||||
ITEM_FLAG_MAIL_TEXT_MASK = ITEM_FIELD_FLAG_READABLE | ITEM_FIELD_FLAG_UNK13 | ITEM_FIELD_FLAG_UNK14
|
||||
};
|
||||
|
||||
/* TODO
|
||||
*/
|
||||
|
||||
enum ItemFieldFlags
|
||||
enum ItemFlags : uint32
|
||||
{
|
||||
ITEM_FLAG_SOULBOUND = 0x00000001, // Item is soulbound and cannot be traded <<--
|
||||
ITEM_FLAG_UNK1 = 0x00000002, // ?
|
||||
ITEM_FLAG_UNLOCKED = 0x00000004, // Item had lock but can be opened now
|
||||
ITEM_FLAG_WRAPPED = 0x00000008, // Item is wrapped and contains another item
|
||||
ITEM_FLAG_UNK2 = 0x00000010, // ?
|
||||
ITEM_FLAG_UNK3 = 0x00000020, // ?
|
||||
ITEM_FLAG_UNK4 = 0x00000040, // ?
|
||||
ITEM_FLAG_UNK5 = 0x00000080, // ?
|
||||
ITEM_FLAG_BOP_TRADEABLE = 0x00000100, // Allows trading soulbound items
|
||||
ITEM_FLAG_READABLE = 0x00000200, // Opens text page when right clicked
|
||||
ITEM_FLAG_UNK6 = 0x00000400, // ?
|
||||
ITEM_FLAG_UNK7 = 0x00000800, // ?
|
||||
ITEM_FLAG_REFUNDABLE = 0x00001000, // Item can be returned to vendor for its original cost (extended cost)
|
||||
ITEM_FLAG_UNK8 = 0x00002000, // ?
|
||||
ITEM_FLAG_UNK9 = 0x00004000, // ?
|
||||
ITEM_FLAG_UNK10 = 0x00008000, // ?
|
||||
ITEM_FLAG_UNK11 = 0x00010000, // ?
|
||||
ITEM_FLAG_NO_CREATOR = 0x00020000,
|
||||
ITEM_FLAG_UNK13 = 0x00040000, // ?
|
||||
ITEM_FLAG_UNK14 = 0x00080000, // ?
|
||||
ITEM_FLAG_UNK15 = 0x00100000, // ?
|
||||
ITEM_FLAG_UNK16 = 0x00200000, // ?
|
||||
ITEM_FLAG_UNK17 = 0x00400000, // ?
|
||||
ITEM_FLAG_UNK18 = 0x00800000, // ?
|
||||
ITEM_FLAG_UNK19 = 0x01000000, // ?
|
||||
ITEM_FLAG_UNK20 = 0x02000000, // ?
|
||||
ITEM_FLAG_UNK21 = 0x04000000, // ?
|
||||
ITEM_FLAG_UNK22 = 0x08000000, // ?
|
||||
ITEM_FLAG_UNK23 = 0x10000000, // ?
|
||||
ITEM_FLAG_UNK24 = 0x20000000, // ?
|
||||
ITEM_FLAG_UNK25 = 0x40000000, // ?
|
||||
ITEM_FLAG_UNK26 = 0x80000000, // ?
|
||||
ITEM_FLAG_NO_PICKUP = 0x00000001,
|
||||
ITEM_FLAG_CONJURED = 0x00000002, // Conjured item
|
||||
ITEM_FLAG_HAS_LOOT = 0x00000004, // Item can be right clicked to open for loot
|
||||
ITEM_FLAG_HEROIC_TOOLTIP = 0x00000008, // Makes green "Heroic" text appear on item
|
||||
ITEM_FLAG_DEPRECATED = 0x00000010, // Cannot equip or use
|
||||
ITEM_FLAG_NO_USER_DESTROY = 0x00000020, // Item can not be destroyed, except by using spell (item can be reagent for spell)
|
||||
ITEM_FLAG_PLAYERCAST = 0x00000040, // Item's spells are castable by players
|
||||
ITEM_FLAG_NO_EQUIP_COOLDOWN = 0x00000080, // No default 30 seconds cooldown when equipped
|
||||
ITEM_FLAG_MULTI_LOOT_QUEST = 0x00000100,
|
||||
ITEM_FLAG_IS_WRAPPER = 0x00000200, // Item can wrap other items
|
||||
ITEM_FLAG_USES_RESOURCES = 0x00000400,
|
||||
ITEM_FLAG_MULTI_DROP = 0x00000800, // Looting this item does not remove it from available loot
|
||||
ITEM_FLAG_ITEM_PURCHASE_RECORD = 0x00001000, // Item can be returned to vendor for its original cost (extended cost)
|
||||
ITEM_FLAG_PETITION = 0x00002000, // Item is guild or arena charter
|
||||
ITEM_FLAG_HAS_TEXT = 0x00004000, // Only readable items have this (but not all)
|
||||
ITEM_FLAG_NO_DISENCHANT = 0x00008000,
|
||||
ITEM_FLAG_REAL_DURATION = 0x00010000,
|
||||
ITEM_FLAG_NO_CREATOR = 0x00020000,
|
||||
ITEM_FLAG_IS_PROSPECTABLE = 0x00040000, // Item can be prospected
|
||||
ITEM_FLAG_UNIQUE_EQUIPPABLE = 0x00080000, // You can only equip one of these
|
||||
ITEM_FLAG_IGNORE_FOR_AURAS = 0x00100000,
|
||||
ITEM_FLAG_IGNORE_DEFAULT_ARENA_RESTRICTIONS = 0x00200000, // Item can be used during arena match
|
||||
ITEM_FLAG_NO_DURABILITY_LOSS = 0x00400000, // Some Thrown weapons have it (and only Thrown) but not all
|
||||
ITEM_FLAG_USE_WHEN_SHAPESHIFTED = 0x00800000, // Item can be used in shapeshift forms
|
||||
ITEM_FLAG_HAS_QUEST_GLOW = 0x01000000,
|
||||
ITEM_FLAG_HIDE_UNUSABLE_RECIPE = 0x02000000, // Profession recipes: can only be looted if you meet requirements and don't already know it
|
||||
ITEM_FLAG_NOT_USEABLE_IN_ARENA = 0x04000000, // Item cannot be used in arena
|
||||
ITEM_FLAG_IS_BOUND_TO_ACCOUNT = 0x08000000, // Item binds to account and can be sent only to your own characters
|
||||
ITEM_FLAG_NO_REAGENT_COST = 0x10000000, // Spell is cast ignoring reagents
|
||||
ITEM_FLAG_IS_MILLABLE = 0x20000000, // Item can be milled
|
||||
ITEM_FLAG_REPORT_TO_GUILD_CHAT = 0x40000000,
|
||||
ITEM_FLAG_NO_PROGRESSIVE_LOOT = 0x80000000
|
||||
};
|
||||
|
||||
ITEM_FLAG_MAIL_TEXT_MASK = ITEM_FLAG_READABLE | ITEM_FLAG_UNK13 | ITEM_FLAG_UNK14,
|
||||
enum ItemFlags2 : uint32
|
||||
{
|
||||
ITEM_FLAG2_FACTION_HORDE = 0x00000001,
|
||||
ITEM_FLAG2_FACTION_ALLIANCE = 0x00000002,
|
||||
ITEM_FLAG2_DONT_IGNORE_BUY_PRICE = 0x00000004, // when item uses extended cost, gold is also required
|
||||
ITEM_FLAG2_CLASSIFY_AS_CASTER = 0x00000008,
|
||||
ITEM_FLAG2_CLASSIFY_AS_PHYSICAL = 0x00000010,
|
||||
ITEM_FLAG2_EVERYONE_CAN_ROLL_NEED = 0x00000020,
|
||||
ITEM_FLAG2_NO_TRADE_BIND_ON_ACQUIRE = 0x00000040,
|
||||
ITEM_FLAG2_CAN_TRADE_BIND_ON_ACQUIRE = 0x00000080,
|
||||
ITEM_FLAG2_CAN_ONLY_ROLL_GREED = 0x00000100,
|
||||
ITEM_FLAG2_CASTER_WEAPON = 0x00000200,
|
||||
ITEM_FLAG2_DELETE_ON_LOGIN = 0x00000400,
|
||||
ITEM_FLAG2_INTERNAL_ITEM = 0x00000800,
|
||||
ITEM_FLAG2_NO_VENDOR_VALUE = 0x00001000,
|
||||
ITEM_FLAG2_SHOW_BEFORE_DISCOVERED = 0x00002000,
|
||||
ITEM_FLAG2_OVERRIDE_GOLD_COST = 0x00004000,
|
||||
ITEM_FLAG2_IGNORE_DEFAULT_RATED_BG_RESTRICTIONS = 0x00008000,
|
||||
ITEM_FLAG2_NOT_USABLE_IN_RATED_BG = 0x00010000,
|
||||
ITEM_FLAG2_BNET_ACCOUNT_TRADE_OK = 0x00020000,
|
||||
ITEM_FLAG2_CONFIRM_BEFORE_USE = 0x00040000,
|
||||
ITEM_FLAG2_REEVALUATE_BONDING_ON_TRANSFORM = 0x00080000,
|
||||
ITEM_FLAG2_NO_TRANSFORM_ON_CHARGE_DEPLETION = 0x00100000,
|
||||
ITEM_FLAG2_NO_ALTER_ITEM_VISUAL = 0x00200000,
|
||||
ITEM_FLAG2_NO_SOURCE_FOR_ITEM_VISUAL = 0x00400000,
|
||||
ITEM_FLAG2_IGNORE_QUALITY_FOR_ITEM_VISUAL_SOURCE = 0x00800000,
|
||||
ITEM_FLAG2_NO_DURABILITY = 0x01000000,
|
||||
ITEM_FLAG2_ROLE_TANK = 0x02000000,
|
||||
ITEM_FLAG2_ROLE_HEALER = 0x04000000,
|
||||
ITEM_FLAG2_ROLE_DAMAGE = 0x08000000,
|
||||
ITEM_FLAG2_CAN_DROP_IN_CHALLENGE_MODE = 0x10000000,
|
||||
ITEM_FLAG2_NEVER_STACK_IN_LOOT_UI = 0x20000000,
|
||||
ITEM_FLAG2_DISENCHANT_TO_LOOT_TABLE = 0x40000000,
|
||||
ITEM_FLAG2_USED_IN_A_TRADESKILL = 0x80000000
|
||||
};
|
||||
|
||||
enum ItemFlagsExtra
|
||||
@@ -527,8 +557,8 @@ inline uint8 ItemSubClassToDurabilityMultiplierId(uint32 ItemClass, uint32 ItemS
|
||||
{
|
||||
case ITEM_CLASS_WEAPON: return ItemSubClass;
|
||||
case ITEM_CLASS_ARMOR: return ItemSubClass + 21;
|
||||
default: return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform
|
||||
@@ -700,8 +730,8 @@ struct ItemTemplate
|
||||
if (Delay == 0)
|
||||
return 0;
|
||||
float temp = 0;
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
|
||||
temp+=Damage[i].DamageMin + Damage[i].DamageMax;
|
||||
for (auto i : Damage)
|
||||
temp+=i.DamageMin + i.DamageMax;
|
||||
return temp*500/Delay;
|
||||
}
|
||||
|
||||
@@ -720,7 +750,7 @@ struct ItemTemplate
|
||||
|
||||
float GetItemLevelIncludingQuality(uint8 pLevel) const
|
||||
{
|
||||
float itemLevel = (float)ItemLevel;
|
||||
auto itemLevel = (float)ItemLevel;
|
||||
switch (Quality)
|
||||
{
|
||||
case ITEM_QUALITY_POOR:
|
||||
@@ -781,7 +811,7 @@ struct ItemTemplate
|
||||
bool IsPotion() const { return Class == ITEM_CLASS_CONSUMABLE && SubClass == ITEM_SUBCLASS_POTION; }
|
||||
bool IsWeaponVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT; }
|
||||
bool IsArmorVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT; }
|
||||
bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_PROTO_FLAG_CONJURED); }
|
||||
bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_FLAG_CONJURED); }
|
||||
|
||||
void InitializeQueryData();
|
||||
};
|
||||
@@ -13018,7 +13018,7 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool
|
||||
// in case trade we already have item in other player inventory
|
||||
pLastItem->SetState(in_characterInventoryDB ? ITEM_CHANGED : ITEM_NEW, this);
|
||||
|
||||
if (pLastItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
|
||||
if (pLastItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE))
|
||||
AddTradeableItem(pLastItem);
|
||||
}
|
||||
}
|
||||
@@ -13037,7 +13037,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
|
||||
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
|
||||
DestroyItem(slot, i, update);
|
||||
|
||||
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
|
||||
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
|
||||
|
||||
@@ -13109,7 +13109,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
|
||||
pBag->RemoveItem(slot, update);
|
||||
|
||||
// Xinef: item is removed, remove loot from storage if any
|
||||
if (proto->Flags & ITEM_PROTO_FLAG_OPENABLE)
|
||||
if (proto->Flags & ITEM_FLAG_HAS_LOOT)
|
||||
sLootItemStorage->RemoveStoredLoot(pItem->GetGUIDLow());
|
||||
|
||||
if (IsInWorld() && update)
|
||||
@@ -18772,7 +18772,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
||||
remove = true;
|
||||
}
|
||||
// "Conjured items disappear if you are logged out for more than 15 minutes"
|
||||
else if (timeDiff > 15 * MINUTE && proto->Flags & ITEM_PROTO_FLAG_CONJURED)
|
||||
else if (timeDiff > 15 * MINUTE && proto->Flags & ITEM_FLAG_CONJURED)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s', diff: %u) has conjured item (GUID: %u, entry: %u) with expired lifetime (15 minutes). Deleting item.",
|
||||
@@ -18780,7 +18780,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
||||
#endif
|
||||
remove = true;
|
||||
}
|
||||
else if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
|
||||
else if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE))
|
||||
{
|
||||
if (item->GetPlayedTime() > (2 * HOUR))
|
||||
{
|
||||
@@ -18792,7 +18792,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
||||
stmt->setUInt32(0, item->GetGUIDLow());
|
||||
trans->Append(stmt);
|
||||
|
||||
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE);
|
||||
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -18813,11 +18813,11 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with refundable flags, but without data in item_refund_instance. Removing flag.",
|
||||
GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry());
|
||||
#endif
|
||||
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE);
|
||||
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
|
||||
else if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE))
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE);
|
||||
stmt->setUInt32(0, item->GetGUIDLow());
|
||||
@@ -18840,10 +18840,10 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with ITEM_FLAG_BOP_TRADEABLE flag, but without data in item_soulbound_trade_data. Removing flag.",
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with ITEM_FIELD_FLAG_BOP_TRADEABLE flag, but without data in item_soulbound_trade_data. Removing flag.",
|
||||
GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry());
|
||||
#endif
|
||||
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE);
|
||||
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE);
|
||||
}
|
||||
}
|
||||
else if (proto->HolidayId)
|
||||
@@ -19868,7 +19868,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
|
||||
if (item->GetState() == ITEM_NEW)
|
||||
{
|
||||
// Xinef: item is removed, remove loot from storage if any
|
||||
if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_OPENABLE)
|
||||
if (item->GetTemplate()->Flags & ITEM_FLAG_HAS_LOOT)
|
||||
sLootItemStorage->RemoveStoredLoot(item->GetGUIDLow());
|
||||
continue;
|
||||
}
|
||||
@@ -19883,7 +19883,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
|
||||
m_items[i]->FSetState(ITEM_NEW);
|
||||
|
||||
// Xinef: item is removed, remove loot from storage if any
|
||||
if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_OPENABLE)
|
||||
if (item->GetTemplate()->Flags & ITEM_FLAG_HAS_LOOT)
|
||||
sLootItemStorage->RemoveStoredLoot(item->GetGUIDLow());
|
||||
}
|
||||
|
||||
@@ -22004,9 +22004,9 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
|
||||
if (!bStore)
|
||||
AutoUnequipOffhandIfNeed();
|
||||
|
||||
if (pProto->Flags & ITEM_PROTO_FLAG_REFUNDABLE && crItem->ExtendedCost && pProto->GetMaxStackSize() == 1)
|
||||
if (pProto->Flags & ITEM_FLAG_ITEM_PURCHASE_RECORD && crItem->ExtendedCost && pProto->GetMaxStackSize() == 1)
|
||||
{
|
||||
it->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE);
|
||||
it->SetFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE);
|
||||
it->SetRefundRecipient(GetGUIDLow());
|
||||
it->SetPaidMoney(price);
|
||||
it->SetPaidExtendedCost(crItem->ExtendedCost);
|
||||
@@ -23328,7 +23328,7 @@ void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint3
|
||||
|
||||
void Player::ApplyEquipCooldown(Item* pItem)
|
||||
{
|
||||
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_PROTO_FLAG_NO_EQUIP_COOLDOWN))
|
||||
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_NO_EQUIP_COOLDOWN))
|
||||
return;
|
||||
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
@@ -25457,7 +25457,7 @@ InventoryResult Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limi
|
||||
InventoryResult Player::CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot, uint32 limit_count) const
|
||||
{
|
||||
// check unique-equipped on item
|
||||
if (itemProto->Flags & ITEM_PROTO_FLAG_UNIQUE_EQUIPPED)
|
||||
if (itemProto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE)
|
||||
{
|
||||
// there is an equip limit on this item
|
||||
if (HasItemOrGemWithIdEquipped(itemProto->ItemId, 1, except_slot))
|
||||
@@ -27116,7 +27116,7 @@ void Player::SendRefundInfo(Item* item)
|
||||
// This function call unsets ITEM_FLAGS_REFUNDABLE if played time is over 2 hours.
|
||||
item->UpdatePlayedTime(this);
|
||||
|
||||
if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
|
||||
if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item refund: item not refundable!");
|
||||
@@ -27182,7 +27182,7 @@ bool Player::AddItem(uint32 itemId, uint32 count)
|
||||
|
||||
void Player::RefundItem(Item* item)
|
||||
{
|
||||
if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
|
||||
if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item refund: item not refundable!");
|
||||
|
||||
Reference in New Issue
Block a user