Cleaned up item flags: separated item proto flags and item field flags
Implemented use of: ITEM_PROTO_FLAG_PROSPECTABLE and ITEM_PROTO_FLAG_MILLABLE now checked instead of bag family mask ITEM_PROTO_FLAG_SMART_LOOT for profession recipes, player has to have skillline and not know the recipe ITEM_PROTO_FLAG_OPENABLE item has to have it set to use item_loot_template ITEM_PROTO_FLAG_NOT_USEABLE_IN_ARENA if this is set item can never be used in arena ITEM_FLAG_UNLOCKED marks unlocked items Simplified BoA check for mail sending Stackable items are no longer refundable Removed useless code that always set ITEM_FIELD_FLAGS equal to proto flags Unlocking items (lockpicking) is now blizzlike --HG-- branch : trunk
This commit is contained in:
@@ -87,7 +87,6 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability);
|
||||
SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability);
|
||||
SetUInt32Value(ITEM_FIELD_FLAGS, itemProto->Flags & 0xFFFFFFF7); // TEMP HACK, DONT REMOVE - Shauren
|
||||
SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1);
|
||||
|
||||
// Setting the number of Slots the Container has
|
||||
|
||||
@@ -278,11 +278,8 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
SetSpellCharges(i,itemProto->Spells[i].SpellCharges);
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_FLAGS, itemProto->Flags & 0xFFFFFFF7); // TEMP HACK, DONT REMOVE - Shauren
|
||||
SetUInt32Value(ITEM_FIELD_DURATION, abs(itemProto->Duration));
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -369,13 +366,13 @@ void Item::SaveToDB()
|
||||
|
||||
CharacterDatabase.Execute(ss.str().c_str());
|
||||
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED))
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
|
||||
CharacterDatabase.PExecute("UPDATE character_gifts SET guid = '%u' WHERE item_guid = '%u'", GUID_LOPART(GetOwnerGUID()),GetGUIDLow());
|
||||
}break;
|
||||
case ITEM_REMOVED:
|
||||
{
|
||||
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", guid);
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED))
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
|
||||
CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", GetGUIDLow());
|
||||
delete this;
|
||||
return;
|
||||
@@ -437,7 +434,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result
|
||||
// Remove bind flag for items vs NO_BIND set
|
||||
if (IsSoulBound() && proto->Bonding == NO_BIND)
|
||||
{
|
||||
ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_BINDED, false);
|
||||
ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, false);
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
@@ -1120,10 +1117,10 @@ void Item::DeleteRefundDataFromDB()
|
||||
|
||||
void Item::SetNotRefundable(Player *owner, bool changestate)
|
||||
{
|
||||
if (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE))
|
||||
if (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
|
||||
return;
|
||||
|
||||
RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
|
||||
RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE);
|
||||
// Following is not applicable in the trading procedure
|
||||
if (changestate)
|
||||
SetState(ITEM_CHANGED, owner);
|
||||
|
||||
@@ -234,9 +234,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_FLAGS_BINDED,val); }
|
||||
bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_BINDED); }
|
||||
bool IsBoundAccountWide() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_BOA); }
|
||||
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 (GetProto()->Flags & ITEM_PROTO_FLAG_BIND_TO_ACCOUNT) != 0; }
|
||||
bool IsBindedNotWith(Player const* player) const;
|
||||
bool IsBoundByEnchant() const;
|
||||
virtual void SaveToDB();
|
||||
@@ -246,6 +246,7 @@ class Item : public Object
|
||||
void SaveRefundDataToDB();
|
||||
void DeleteRefundDataFromDB();
|
||||
|
||||
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED); }
|
||||
bool IsBag() const { return GetProto()->InventoryType == INVTYPE_BAG; }
|
||||
bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
|
||||
bool CanBeTraded(bool mail = false) const;
|
||||
|
||||
@@ -103,33 +103,86 @@ enum ItemBondingType
|
||||
|
||||
#define MAX_BIND_TYPE 6
|
||||
|
||||
// masks for ITEM_FIELD_FLAGS field
|
||||
enum ITEM_FLAGS
|
||||
/* 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
|
||||
{
|
||||
ITEM_FLAGS_BINDED = 0x00000001, // set in game at binding, not set in template
|
||||
ITEM_FLAGS_CONJURED = 0x00000002,
|
||||
ITEM_FLAGS_OPENABLE = 0x00000004,
|
||||
ITEM_FLAGS_WRAPPED = 0x00000008,
|
||||
ITEM_FLAGS_BROKEN = 0x00000010, // appears red icon (like when item durability == 0)
|
||||
ITEM_FLAGS_INDESTRUCTIBLE = 0x00000020, // Item can not be destroyed, except by using spell (item can be reagent for spell and then allowed)
|
||||
ITEM_FLAGS_USABLE = 0x00000040, // ?
|
||||
ITEM_FLAGS_NO_EQUIP_COOLDOWN = 0x00000080, // ?
|
||||
ITEM_FLAGS_WRAPPER = 0x00000200, // used or not used wrapper
|
||||
ITEM_FLAGS_PARTY_LOOT = 0x00000800, // determines if item is party loot or not
|
||||
ITEM_FLAGS_REFUNDABLE = 0x00001000, // item cost can be refunded within 2 hours after purchase
|
||||
ITEM_FLAGS_CHARTER = 0x00002000, // arena/guild charter
|
||||
ITEM_FLAGS_REFUNDABLE_2 = 0x00008000,
|
||||
ITEM_FLAGS_UNK1 = 0x00010000,
|
||||
ITEM_FLAGS_PROSPECTABLE = 0x00040000,
|
||||
ITEM_FLAGS_UNIQUE_EQUIPPED = 0x00080000,
|
||||
ITEM_FLAGS_USEABLE_IN_ARENA = 0x00200000,
|
||||
ITEM_FLAGS_THROWABLE = 0x00400000, // not used in game for check trow possibility, only for item in game tooltip
|
||||
ITEM_FLAGS_SPECIALUSE = 0x00800000, // last used flag in 2.3.0
|
||||
ITEM_FLAGS_BOA = 0x08000000, // bind on account (set in template for items that can binded in like way)
|
||||
ITEM_FLAGS_TRIGGERED_CAST = 0x10000000, // used by enchanting scrolls made with vellum
|
||||
ITEM_FLAGS_ENCHANT_SCROLL = 0x10000000, // for enchant scrolls
|
||||
ITEM_FLAGS_MILLABLE = 0x20000000,
|
||||
ITEM_FLAGS_BOP_TRADEABLE = 0x80000000
|
||||
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 // ?
|
||||
};
|
||||
|
||||
/* TODO
|
||||
*/
|
||||
|
||||
enum ItemFieldFlags
|
||||
{
|
||||
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_UNK3 = 0x00000010, // ?
|
||||
ITEM_FLAG_UNK4 = 0x00000020, // ?
|
||||
ITEM_FLAG_UNK5 = 0x00000040, // ?
|
||||
ITEM_FLAG_UNK6 = 0x00000080, // ?
|
||||
ITEM_FLAG_UNK7 = 0x00000100, // ?
|
||||
ITEM_FLAG_READABLE = 0x00000200, // Opens text page when right clicked
|
||||
ITEM_FLAG_UNK9 = 0x00000400, // ?
|
||||
ITEM_FLAG_UNK10 = 0x00000800, // ?
|
||||
ITEM_FLAG_REFUNDABLE = 0x00001000, // Item can be returned to vendor for its original cost (extended cost)
|
||||
ITEM_FLAG_UNK11 = 0x00002000, // ?
|
||||
ITEM_FLAG_UNK12 = 0x00004000, // ?
|
||||
ITEM_FLAG_UNK13 = 0x00008000, // ?
|
||||
ITEM_FLAG_UNK14 = 0x00010000, // ?
|
||||
ITEM_FLAG_UNK15 = 0x00020000, // ?
|
||||
ITEM_FLAG_UNK16 = 0x00040000, // ?
|
||||
ITEM_FLAG_UNK17 = 0x00080000, // ?
|
||||
ITEM_FLAG_UNK18 = 0x00100000, // ?
|
||||
ITEM_FLAG_UNK19 = 0x00200000, // ?
|
||||
ITEM_FLAG_UNK20 = 0x00400000, // ?
|
||||
ITEM_FLAG_UNK21 = 0x00800000, // ?
|
||||
ITEM_FLAG_UNK22 = 0x01000000, // ?
|
||||
ITEM_FLAG_UNK23 = 0x02000000, // ?
|
||||
ITEM_FLAG_UNK24 = 0x04000000, // ?
|
||||
ITEM_FLAG_UNK25 = 0x08000000, // ?
|
||||
ITEM_FLAG_UNK26 = 0x10000000, // ?
|
||||
ITEM_FLAG_UNK27 = 0x20000000, // ?
|
||||
ITEM_FLAG_UNK28 = 0x40000000, // ?
|
||||
ITEM_FLAG_BOP_TRADEABLE = 0x80000000, // ?
|
||||
|
||||
ITEM_FLAG_MAIL_TEXT_MASK = ITEM_FLAG_READABLE | ITEM_FLAG_UNK13 | ITEM_FLAG_UNK14
|
||||
};
|
||||
|
||||
enum ItemFlagsExtra
|
||||
@@ -653,7 +706,7 @@ struct ItemPrototype
|
||||
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_FLAGS_CONJURED); }
|
||||
bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_PROTO_FLAG_CONJURED); }
|
||||
};
|
||||
|
||||
struct ItemLocale
|
||||
|
||||
Reference in New Issue
Block a user