Big update.

This commit is contained in:
UltraNix
2022-03-12 22:28:00 +01:00
parent 6006eeeb01
commit 12d41d1314
2064 changed files with 427245 additions and 268481 deletions

View File

@@ -39,7 +39,7 @@ Bag::~Bag()
{
if (item->IsInWorld())
{
LOG_FATAL("entities.item", "Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.",
LOG_FATAL("entities.item", "Item {} (slot {}, bag slot {}) in bag {} (slot {}, bag slot {}, m_bagslot {}) is to be deleted but is still in world.",
item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(),
GetEntry(), (uint32)GetSlot(), (uint32)GetBagSlot(), (uint32)i);
item->RemoveFromWorld();

View File

@@ -19,6 +19,7 @@
#include "Common.h"
#include "ConditionMgr.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "ItemEnchantmentMgr.h"
#include "ObjectMgr.h"
#include "Player.h"
@@ -27,6 +28,8 @@
#include "SpellMgr.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Tokenize.h"
#include "StringConvert.h"
void AddItemsSetItem(Player* player, Item* item)
{
@@ -37,7 +40,7 @@ void AddItemsSetItem(Player* player, Item* item)
if (!set)
{
LOG_ERROR("sql.sql", "Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId);
LOG_ERROR("sql.sql", "Item set {} for item (id {}) not found, mods not applied.", setid, proto->ItemId);
return;
}
@@ -97,7 +100,7 @@ void AddItemsSetItem(Player* player, Item* item)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(set->spells[x]);
if (!spellInfo)
{
LOG_ERROR("entities.item", "WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid);
LOG_ERROR("entities.item", "WORLD: unknown spell id {} in items set {} effects", set->spells[x], setid);
break;
}
@@ -122,7 +125,7 @@ void RemoveItemsSetItem(Player* player, ItemTemplate const* proto)
if (!set)
{
LOG_ERROR("sql.sql", "Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId);
LOG_ERROR("sql.sql", "Item set #{} for item #{} not found, mods not removed.", setid, proto->ItemId);
return;
}
@@ -251,7 +254,7 @@ Item::Item()
m_container = nullptr;
m_lootGenerated = false;
mb_in_trade = false;
m_lastPlayedTimeUpdate = time(nullptr);
m_lastPlayedTimeUpdate = GameTime::GetGameTime().count();
m_refundRecipient = 0;
m_paidMoney = 0;
@@ -299,7 +302,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff)
if (!GetUInt32Value(ITEM_FIELD_DURATION))
return;
LOG_DEBUG("entities.player.items", "Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff);
LOG_DEBUG("entities.player.items", "Item::UpdateDuration Item (Entry: {} Duration {} Diff {})", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff);
if (GetUInt32Value(ITEM_FIELD_DURATION) <= diff)
{
@@ -326,19 +329,19 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans)
{
uint8 index = 0;
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_REP_ITEM_INSTANCE : CHAR_UPD_ITEM_INSTANCE);
stmt->setUInt32( index, GetEntry());
stmt->setUInt32(++index, GetOwnerGUID().GetCounter());
stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter());
stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter());
stmt->setUInt32(++index, GetCount());
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURATION));
stmt->SetData( index, GetEntry());
stmt->SetData(++index, GetOwnerGUID().GetCounter());
stmt->SetData(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter());
stmt->SetData(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter());
stmt->SetData(++index, GetCount());
stmt->SetData(++index, GetUInt32Value(ITEM_FIELD_DURATION));
std::ostringstream ssSpells;
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
ssSpells << GetSpellCharges(i) << ' ';
stmt->setString(++index, ssSpells.str());
stmt->SetData(++index, ssSpells.str());
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_FLAGS));
stmt->SetData(++index, GetUInt32Value(ITEM_FIELD_FLAGS));
std::ostringstream ssEnchants;
for (uint8 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i)
@@ -347,21 +350,21 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans)
ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << ' ';
ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << ' ';
}
stmt->setString(++index, ssEnchants.str());
stmt->SetData(++index, ssEnchants.str());
stmt->setInt16 (++index, GetItemRandomPropertyId());
stmt->setUInt16(++index, GetUInt32Value(ITEM_FIELD_DURABILITY));
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME));
stmt->setString(++index, m_text);
stmt->setUInt32(++index, guid);
stmt->SetData (++index, GetItemRandomPropertyId());
stmt->SetData(++index, GetUInt32Value(ITEM_FIELD_DURABILITY));
stmt->SetData(++index, GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME));
stmt->SetData(++index, m_text);
stmt->SetData(++index, guid);
trans->Append(stmt);
if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER);
stmt->setUInt32(0, GetOwnerGUID().GetCounter());
stmt->setUInt32(1, guid);
stmt->SetData(0, GetOwnerGUID().GetCounter());
stmt->SetData(1, guid);
trans->Append(stmt);
}
break;
@@ -369,13 +372,13 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans)
case ITEM_REMOVED:
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
stmt->setUInt32(0, guid);
stmt->SetData(0, guid);
trans->Append(stmt);
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
stmt->setUInt32(0, guid);
stmt->SetData(0, guid);
trans->Append(stmt);
}
@@ -398,7 +401,7 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans)
bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fields, uint32 entry)
{
// 0 1 2 3 4 5 6 7 8 9 10
//result = CharacterDatabase.PQuery("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '%u'", guid);
//result = CharacterDatabase.Query("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '{}'", guid);
// create item before any checks for store correct guid
// and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
@@ -410,18 +413,21 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
ItemTemplate const* proto = GetTemplate();
if (!proto)
{
LOG_ERROR("entities.item", "Invalid entry {} for item {}. Refusing to load.", GetEntry(), GetGUID().ToString());
return false;
}
// set owner (not if item is only loaded for gbank/auction/mail
if (owner_guid)
SetOwnerGUID(owner_guid);
bool need_save = false; // need explicit save data at load fixes
SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32()));
SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt32()));
SetCount(fields[2].GetUInt32());
SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid::Create<HighGuid::Player>(fields[0].Get<uint32>()));
SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid::Create<HighGuid::Player>(fields[1].Get<uint32>()));
SetCount(fields[2].Get<uint32>());
uint32 duration = fields[3].GetUInt32();
uint32 duration = fields[3].Get<uint32>();
SetUInt32Value(ITEM_FIELD_DURATION, duration);
// update duration if need, and remove if not need
if ((proto->Duration == 0) != (duration == 0))
@@ -430,12 +436,19 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
need_save = true;
}
Tokenizer tokens(fields[4].GetString(), ' ', MAX_ITEM_PROTO_SPELLS);
std::vector<std::string_view> tokens = Acore::Tokenize(fields[4].Get<std::string_view>(), ' ', false);
if (tokens.size() == MAX_ITEM_PROTO_SPELLS)
{
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
SetSpellCharges(i, atoi(tokens[i]));
{
if (Optional<int32> charges = Acore::StringTo<int32>(tokens[i]))
SetSpellCharges(i, *charges);
else
LOG_ERROR("entities.item", "Invalid charge info '{}' for item {}, charge data not loaded.", tokens.at(i), GetGUID().ToString());
}
}
SetUInt32Value(ITEM_FIELD_FLAGS, fields[5].GetUInt32());
SetUInt32Value(ITEM_FIELD_FLAGS, fields[5].Get<uint32>());
// Remove bind flag for items vs NO_BIND set
if (IsSoulBound() && proto->Bonding == NO_BIND && sScriptMgr->CanApplySoulboundFlag(this, proto))
{
@@ -443,14 +456,19 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
need_save = true;
}
std::string enchants = fields[6].GetString();
_LoadIntoDataField(enchants.c_str(), ITEM_FIELD_ENCHANTMENT_1_1, MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET);
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, fields[7].GetInt16());
std::string enchants = fields[6].Get<std::string>();
if (!_LoadIntoDataField(fields[6].Get<std::string>(), ITEM_FIELD_ENCHANTMENT_1_1, MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET))
{
LOG_WARN("entities.item", "Invalid enchantment data '{}' for item {}. Forcing partial load.", fields[6].Get<std::string>(), GetGUID().ToString());
}
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, fields[7].Get<int16>());
// recalculate suffix factor
if (GetItemRandomPropertyId() < 0)
UpdateItemSuffixFactor();
uint32 durability = fields[8].GetUInt16();
uint32 durability = fields[8].Get<uint16>();
SetUInt32Value(ITEM_FIELD_DURABILITY, durability);
// update max durability (and durability) if need
@@ -462,16 +480,16 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
need_save = true;
}
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, fields[9].GetUInt32());
SetText(fields[10].GetString());
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, fields[9].Get<uint32>());
SetText(fields[10].Get<std::string>());
if (need_save) // normal item changed state set not work at loading
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_INSTANCE_ON_LOAD);
stmt->setUInt32(0, GetUInt32Value(ITEM_FIELD_DURATION));
stmt->setUInt32(1, GetUInt32Value(ITEM_FIELD_FLAGS));
stmt->setUInt32(2, GetUInt32Value(ITEM_FIELD_DURABILITY));
stmt->setUInt32(3, guid);
stmt->SetData(0, GetUInt32Value(ITEM_FIELD_DURATION));
stmt->SetData(1, GetUInt32Value(ITEM_FIELD_FLAGS));
stmt->SetData(2, GetUInt32Value(ITEM_FIELD_DURABILITY));
stmt->SetData(3, guid);
CharacterDatabase.Execute(stmt);
}
@@ -483,7 +501,7 @@ void Item::DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType
{
sScriptMgr->OnGlobalItemDelFromDB(trans, itemGuid);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
stmt->setUInt32(0, itemGuid);
stmt->SetData(0, itemGuid);
trans->Append(stmt);
}
@@ -496,7 +514,7 @@ void Item::DeleteFromDB(CharacterDatabaseTransaction trans)
void Item::DeleteFromInventoryDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM);
stmt->setUInt32(0, itemGuid);
stmt->SetData(0, itemGuid);
trans->Append(stmt);
}
@@ -597,7 +615,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
// item can have not null only one from field values
if ((itemProto->RandomProperty) && (itemProto->RandomSuffix))
{
LOG_ERROR("sql.sql", "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix);
LOG_ERROR("sql.sql", "Item template {} have RandomProperty == {} and RandomSuffix == {}, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix);
return 0;
}
@@ -608,7 +626,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId);
if (!random_id)
{
LOG_ERROR("sql.sql", "Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId);
LOG_ERROR("sql.sql", "Enchantment id #{} used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId);
return 0;
}
@@ -621,7 +639,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId);
if (!random_id)
{
LOG_ERROR("sql.sql", "Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId);
LOG_ERROR("sql.sql", "Enchantment id #{} used but it doesn't have records in sItemRandomSuffixStore.", randomPropId);
return 0;
}
@@ -714,7 +732,7 @@ void Item::AddToUpdateQueueOf(Player* player)
if (player->GetGUID() != GetOwnerGUID())
{
LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!", GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid ({}) and player's guid ({}) don't match!", GetOwnerGUID().ToString(), player->GetGUID().ToString());
return;
}
@@ -734,7 +752,7 @@ void Item::RemoveFromUpdateQueueOf(Player* player)
if (player->GetGUID() != GetOwnerGUID())
{
LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!", GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid ({}) and player's guid ({}) don't match!", GetOwnerGUID().ToString(), player->GetGUID().ToString());
return;
}
@@ -782,7 +800,7 @@ bool Item::CanBeTraded(bool mail, bool trade) const
return true;
}
bool Item::HasEnchantRequiredSkill(const Player* player) const
bool Item::HasEnchantRequiredSkill(Player const* player) const
{
// Check all enchants for required skill
for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
@@ -1038,11 +1056,6 @@ void Item::SendUpdateSockets()
// time.
void Item::SendTimeUpdate(Player* owner)
{
#ifdef PLAYERBOTS
if (!owner || !owner->IsInWorld() || owner->GetPlayerbotAI())
return;
#endif
uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION);
if (!duration)
return;
@@ -1143,14 +1156,14 @@ void Item::SaveRefundDataToDB()
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
stmt->setUInt32(0, GetGUID().GetCounter());
stmt->SetData(0, GetGUID().GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_REFUND_INSTANCE);
stmt->setUInt32(0, GetGUID().GetCounter());
stmt->setUInt32(1, GetRefundRecipient());
stmt->setUInt32(2, GetPaidMoney());
stmt->setUInt16(3, uint16(GetPaidExtendedCost()));
stmt->SetData(0, GetGUID().GetCounter());
stmt->SetData(1, GetRefundRecipient());
stmt->SetData(2, GetPaidMoney());
stmt->SetData(3, uint16(GetPaidExtendedCost()));
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
@@ -1161,7 +1174,7 @@ void Item::DeleteRefundDataFromDB(CharacterDatabaseTransaction* trans)
if (trans)
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
stmt->setUInt32(0, GetGUID().GetCounter());
stmt->SetData(0, GetGUID().GetCounter());
(*trans)->Append(stmt);
}
}
@@ -1193,7 +1206,7 @@ void Item::UpdatePlayedTime(Player* owner)
// Get current played time
uint32 current_playtime = GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME);
// Calculate time elapsed since last played time update
time_t curtime = time(nullptr);
time_t curtime = GameTime::GetGameTime().count();
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
uint32 new_playtime = current_playtime + elapsed;
// Check if the refund timer has expired yet
@@ -1214,7 +1227,7 @@ void Item::UpdatePlayedTime(Player* owner)
uint32 Item::GetPlayedTime()
{
time_t curtime = time(nullptr);
time_t curtime = GameTime::GetGameTime().count();
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
return GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + elapsed;
}
@@ -1239,7 +1252,7 @@ void Item::ClearSoulboundTradeable(Player* currentOwner)
allowedGUIDs.clear();
SetState(ITEM_CHANGED, currentOwner);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_BOP_TRADE);
stmt->setUInt32(0, GetGUID().GetCounter());
stmt->SetData(0, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
}

View File

@@ -253,7 +253,7 @@ public:
void SetInTrade(bool b = true) { mb_in_trade = b; }
[[nodiscard]] bool IsInTrade() const { return mb_in_trade; }
bool HasEnchantRequiredSkill(const Player* player) const;
bool HasEnchantRequiredSkill(Player const* player) const;
[[nodiscard]] uint32 GetEnchantRequiredLevel() const;
bool IsFitToSpellRequirements(SpellInfo const* spellInfo) const;

View File

@@ -22,7 +22,6 @@
#include "ObjectMgr.h"
#include "Util.h"
#include <functional>
#include <stdlib.h>
#include <vector>
struct EnchStoreItem
@@ -59,9 +58,9 @@ void LoadRandomEnchantmentsTable()
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
uint32 ench = fields[1].GetUInt32();
float chance = fields[2].GetFloat();
uint32 entry = fields[0].Get<uint32>();
uint32 ench = fields[1].Get<uint32>();
float chance = fields[2].Get<float>();
if (chance > 0.000001f && chance <= 100.0f)
RandomItemEnch[entry].push_back(EnchStoreItem(ench, chance));
@@ -69,7 +68,7 @@ void LoadRandomEnchantmentsTable()
++count;
} while (result->NextRow());
LOG_INFO("server.loading", ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server.loading", ">> Loaded {} Item Enchantment definitions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server.loading", " ");
}
else
@@ -90,7 +89,7 @@ uint32 GetItemEnchantMod(int32 entry)
EnchantmentStore::const_iterator tab = RandomItemEnch.find(entry);
if (tab == RandomItemEnch.end())
{
LOG_ERROR("sql.sql", "Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry);
LOG_ERROR("sql.sql", "Item RandomProperty / RandomSuffix id #{} used in `item_template` but it does not have records in `item_enchantment_template` table.", entry);
return 0;
}

View File

@@ -827,6 +827,8 @@ struct ItemTemplate
[[nodiscard]] bool IsWeaponVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT; }
[[nodiscard]] bool IsArmorVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT; }
[[nodiscard]] bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_FLAG_CONJURED); }
[[nodiscard]] bool IsWeapon() const { return Class == ITEM_CLASS_WEAPON; }
[[nodiscard]] bool IsRangedWeapon() const { return IsWeapon() && (InventoryType == INVTYPE_RANGED || InventoryType == INVTYPE_THROWN || InventoryType == INVTYPE_RANGEDRIGHT); }
[[nodiscard]] bool HasStat(ItemModType stat) const;
[[nodiscard]] bool HasSpellPowerStat() const;