51 TC_LOG_ERROR(
"sql.sql",
"Item set {} for item (id {}) not found, mods not applied.", setid, proto->
ItemId);
60 for (
size_t x = 0; x < player->
ItemSetEff.size(); ++x)
79 if (x < player->ItemSetEff.size())
111 TC_LOG_ERROR(
"entities.player.items",
"WORLD: unknown spell id {} in items set {} effects", set->
SetSpellID[x], setid);
117 eff->
spells[y] = spellInfo;
132 TC_LOG_ERROR(
"sql.sql",
"Item set #{} for item #{} not found, mods not removed.", setid, proto->
ItemId);
138 for (; setindex < player->
ItemSetEff.size(); setindex++)
184 if (!pProto || !pBagProto)
187 switch (pBagProto->
Class)
302 return !bag->IsEmpty();
326 bool isInTransaction = bool(trans);
327 if (!isInTransaction)
345 std::ostringstream ssSpells;
348 stmt->
setString(++index, ssSpells.str());
352 std::ostringstream ssEnchants;
359 stmt->
setString(++index, ssEnchants.str());
391 if (!isInTransaction)
407 if (!isInTransaction)
435 bool need_save =
false;
443 if ((proto->
Duration == 0) != (duration == 0))
449 std::vector<std::string_view> tokens =
Trinity::Tokenize(fields[4].GetStringView(),
' ',
false);
457 TC_LOG_ERROR(
"entities.item",
"Invalid charge info '{}' for item {}, charge data not loaded.", std::string(tokens[i]),
GetGUID().
ToString());
470 TC_LOG_WARN(
"entities.item",
"Invalid enchantment data '{}' for item {}. Forcing partial load.", fields[6].GetString(),
GetGUID().
ToString());
490 SetText(fields[10].GetString());
556 switch (proto->
Class)
597 if (randomPropId > 0)
674 ASSERT(player !=
nullptr);
678 TC_LOG_DEBUG(
"entities.player.items",
"AddItemToUpdateQueueOf - Owner's guid ({}) and player's guid ({}) don't match!",
695 ASSERT(player !=
nullptr);
699 TC_LOG_DEBUG(
"entities.player.items",
"RemoveItemFromUpdateQueueOf - Owner's guid ({}) and player's guid ({}) don't match!",
736 if (owner->GetLootGUID() ==
GetGUID())
753 ASSERT(maxDurability >= curDurability);
755 uint32 lostDurability = maxDurability - curDurability;
765 uint32 durabilityQualityEntryId = (itemTemplate->
Quality + 1) * 2;
767 if (!durabilityQualityEntry)
771 switch (itemTemplate->
Class)
784 uint32 cost =
static_cast<uint32>(std::round(lostDurability * dmultiplier *
double(durabilityQualityEntry->
Data)));
799 if (enchantEntry->RequiredSkillID && player->
GetSkillValue(enchantEntry->RequiredSkillID) < enchantEntry->RequiredSkillRank)
813 if (enchantEntry->MinLevel > level)
814 level = enchantEntry->MinLevel;
961 GemColor = gemProperty->
Type;
1016 return proto && ((proto->
Map && proto->
Map != cur_mapId) || (proto->
Area && proto->
Area != cur_zoneId));
1040 data <<
uint32(duration);
1055 ASSERT_NODEBUGINFO(count != 0 &&
"pProto->Stackable == 0 but checked at loading already");
1119 owner->GetMap()->AddUpdateObject(
this);
1129 owner->GetMap()->RemoveUpdateObject(
this);
1138 trans->Append(stmt);
1145 trans->Append(stmt);
1156 (*trans)->Append(stmt);
1190 uint32 new_playtime = current_playtime + elapsed;
1192 if (new_playtime <= 2*
HOUR)
1256 if (
TradeData* tradeData = player->GetTradeData())
1261 tradeData->SetItem(slot,
this,
true);
1268 std::stringstream sstr;
Item * NewItemOrBag(ItemTemplate const *proto)
@ CHAR_UPD_ITEM_INSTANCE_ON_LOAD
@ CHAR_DEL_CHAR_INVENTORY_BY_ITEM
@ CHAR_DEL_ITEM_BOP_TRADE
@ CHAR_DEL_ITEM_REFUND_INSTANCE
@ CHAR_INS_ITEM_REFUND_INSTANCE
@ ENCHANTMENT_CAN_SOULBOUND
DBCStorage< DurabilityQualityEntry > sDurabilityQualityStore(DurabilityQualityfmt)
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
DBCStorage< ItemSetEntry > sItemSetStore(ItemSetEntryfmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
DBCStorage< DurabilityCostsEntry > sDurabilityCostsStore(DurabilityCostsfmt)
DBCStorage< GemPropertiesEntry > sGemPropertiesStore(GemPropertiesEntryfmt)
DBCStorage< ItemRandomPropertiesEntry > sItemRandomPropertiesStore(ItemRandomPropertiesfmt)
#define MAX_ITEM_SET_SPELLS
#define MAX_ITEM_ENCHANTMENT_EFFECTS
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
#define ASSERT_NODEBUGINFO
@ PROP_ENCHANTMENT_SLOT_0
@ PROP_ENCHANTMENT_SLOT_2
@ MAX_INSPECTED_ENCHANTMENT_SLOT
uint32 GenerateEnchSuffixFactor(uint32 item_id)
@ ITEM_SUBCLASS_WEAPON_CROSSBOW
@ ITEM_SUBCLASS_WEAPON_GUN
@ ITEM_SUBCLASS_WEAPON_AXE2
@ ITEM_SUBCLASS_WEAPON_SPEAR
@ ITEM_SUBCLASS_WEAPON_STAFF
@ ITEM_SUBCLASS_WEAPON_MACE
@ ITEM_SUBCLASS_WEAPON_MACE2
@ ITEM_SUBCLASS_WEAPON_DAGGER
@ ITEM_SUBCLASS_WEAPON_BOW
@ ITEM_SUBCLASS_WEAPON_SWORD
@ ITEM_SUBCLASS_WEAPON_AXE
@ ITEM_SUBCLASS_WEAPON_WAND
@ ITEM_SUBCLASS_WEAPON_THROWN
@ ITEM_SUBCLASS_WEAPON_SWORD2
@ ITEM_SUBCLASS_WEAPON_POLEARM
@ ITEM_FIELD_FLAG_REFUNDABLE
@ ITEM_FIELD_FLAG_SOULBOUND
@ ITEM_FIELD_FLAG_BOP_TRADEABLE
@ BAG_FAMILY_MASK_MINING_SUPP
@ BAG_FAMILY_MASK_ENCHANTING_SUPP
@ BAG_FAMILY_MASK_SOUL_SHARDS
@ BAG_FAMILY_MASK_INSCRIPTION_SUPP
@ BAG_FAMILY_MASK_BULLETS
@ BAG_FAMILY_MASK_ENGINEERING_SUPP
@ BAG_FAMILY_MASK_LEATHERWORKING_SUPP
@ ITEM_SUBCLASS_CONTAINER
@ ITEM_SUBCLASS_INSCRIPTION_CONTAINER
@ ITEM_SUBCLASS_LEATHERWORKING_CONTAINER
@ ITEM_SUBCLASS_GEM_CONTAINER
@ ITEM_SUBCLASS_SOUL_CONTAINER
@ ITEM_SUBCLASS_ENCHANTING_CONTAINER
@ ITEM_SUBCLASS_MINING_CONTAINER
@ ITEM_SUBCLASS_HERB_CONTAINER
@ ITEM_SUBCLASS_ENGINEERING_CONTAINER
@ ITEM_SUBCLASS_AMMO_POUCH
@ ITEM_SUBCLASS_ARMOR_MAIL
@ ITEM_SUBCLASS_ARMOR_CLOTH
@ ITEM_SUBCLASS_ARMOR_LEATHER
@ ITEM_SUBCLASS_ARMOR_SHIELD
@ ITEM_SUBCLASS_ARMOR_PLATE
#define MAX_ITEM_PROTO_SPELLS
void AddItemsSetItem(Player *player, Item *item)
bool ItemCanGoIntoBag(ItemTemplate const *pProto, ItemTemplate const *pBagProto)
void RemoveItemsSetItem(Player *player, ItemTemplate const *proto)
void RemoveItemFromUpdateQueueOf(Item *item, Player *player)
void AddItemToUpdateQueueOf(Item *item, Player *player)
#define MAX_ENCHANTMENT_OFFSET
@ ENCHANTMENT_CHARGES_OFFSET
@ ENCHANTMENT_DURATION_OFFSET
#define TC_LOG_WARN(filterType__,...)
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
std::set< ObjectGuid > GuidSet
std::unordered_map< Player *, UpdateData > UpdateDataMapType
std::optional< T > Optional
Optional helper class to wrap optional values within.
#define INVENTORY_SLOT_BAG_0
@ SPELL_EFFECT_ENCHANT_ITEM
@ SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC
@ SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY
@ ITEM_FIELD_MAXDURABILITY
@ ITEM_FIELD_RANDOM_PROPERTIES_ID
@ ITEM_FIELD_PROPERTY_SEED
@ ITEM_FIELD_ENCHANTMENT_1_1
@ ITEM_FIELD_CREATE_PLAYED_TIME
Class used to access individual fields of database query result.
std::string GetDebugInfo() const override
uint32 GetEnchantRequiredLevel() const
static void DeleteFromInventoryDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
uint32 GetPaidExtendedCost() const
void UpdateItemSuffixFactor()
void SetSpellCharges(uint8 index, int32 value)
bool AddToObjectUpdate() override
void SetText(std::string const &text)
virtual bool LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field *fields, uint32 entry)
void UpdateDuration(Player *owner, uint32 diff)
virtual void SaveToDB(CharacterDatabaseTransaction trans)
void BuildUpdate(UpdateDataMapType &) override
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const
void DeleteRefundDataFromDB(CharacterDatabaseTransaction *trans)
uint32 GetEnchantmentId(EnchantmentSlot slot) const
int32 GetSpellCharges(uint8 index=0) const
static Item * CreateItem(uint32 itemEntry, uint32 count, Player const *player=nullptr)
Item * CloneItem(uint32 count, Player const *player=nullptr) const
void SetItemRandomProperties(int32 randomPropId)
void SetPaidMoney(uint32 money)
uint8 GetGemCountWithID(uint32 GemID) const
bool IsBoundAccountWide() const
bool CanBeTraded(bool mail=false, bool trade=false) const
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
uint32 CalculateDurabilityRepairCost(float discount) const
void SetCount(uint32 value)
int32 GetItemRandomPropertyId() const
ItemTemplate const * GetTemplate() const
bool IsBOPTradeable() const
void SaveRefundDataToDB()
void SetNotRefundable(Player *owner, bool changestate=true, CharacterDatabaseTransaction *trans=nullptr)
uint32 GetItemSuffixFactor() const
friend void RemoveItemFromUpdateQueueOf(Item *item, Player *player)
bool IsBindedNotWith(Player const *player) const
void SendTimeUpdate(Player *owner)
void SetRefundRecipient(ObjectGuid::LowType pGuidLow)
void UpdatePlayedTime(Player *owner)
Player * GetOwner() const
ObjectGuid::LowType m_refundRecipient
ObjectGuid GetOwnerGUID() const
bool HasEnchantRequiredSkill(Player const *player) const
time_t m_lastPlayedTimeUpdate
bool IsRefundable() const
bool GemsFitSockets() const
bool IsBoundByEnchant() const
void SetSoulboundTradeable(GuidSet const &allowedLooters)
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
uint32 m_paidExtendedCost
void RemoveFromObjectUpdate() override
void ClearEnchantment(EnchantmentSlot slot)
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player *owner)
InventoryResult CanBeMergedPartlyWith(ItemTemplate const *proto) const
void SetPaidExtendedCost(uint32 iece)
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
virtual bool Create(ObjectGuid::LowType guidlow, uint32 itemId, Player const *owner)
uint32 GetPaidMoney() const
uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const
void ClearSoulboundTradeable(Player *currentOwner)
bool IsNotEmptyBag() const
bool CheckSoulboundTradeExpire()
void SetOwnerGUID(ObjectGuid guid)
uint32 GetRefundRecipient() const
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster=ObjectGuid::Empty)
static void DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
friend void AddItemToUpdateQueueOf(Item *item, Player *player)
bool IsInUpdateQueue() const
bool IsFitToSpellRequirements(SpellInfo const *spellInfo) const
LowType GetCounter() const
static ObjectGuid const Empty
std::string ToString() const
void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
int32 GetInt32Value(uint16 index) const
void SetInt32Value(uint16 index, int32 value)
uint32 GetUInt32Value(uint16 index) const
void SetFlag(uint16 index, uint32 newFlag)
void RemoveFlag(uint16 index, uint32 oldFlag)
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
void ClearUpdateMask(bool remove)
void SetGuidValue(uint16 index, ObjectGuid value)
bool _LoadIntoDataField(std::string const &data, uint32 startOffset, uint32 count)
virtual std::string GetDebugInfo() const
static ObjectGuid GetGUID(Object const *o)
void SetEntry(uint32 entry)
virtual void SetObjectScale(float scale)
void SetUInt32Value(uint16 index, uint32 value)
ObjectGuid GetGUID() const
ObjectGuid GetGuidValue(uint16 index) const
std::vector< Item * > m_itemUpdateQueue
void SendDirectMessage(WorldPacket const *data) const
uint16 GetSkillValue(uint32 skill) const
WorldSession * GetSession() const
void DestroyItem(uint8 bag, uint8 slot, bool update)
std::vector< ItemSetEffect * > ItemSetEff
static bool IsBagPos(uint16 pos)
void ApplyEquipSpell(SpellInfo const *spellInfo, Item *item, bool apply, bool form_change=false)
void DeleteRefundReference(ObjectGuid it)
bool m_itemUpdateQueueBlocked
void setInt16(uint8 index, int16 value)
void setUInt16(uint8 index, uint16 value)
void setUInt32(uint8 index, uint32 value)
void setString(uint8 index, std::string const &value)
int32 EquippedItemSubClassMask
int32 EquippedItemInventoryTypeMask
bool HasEffect(SpellEffects effect) const
void SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId)
@ SMSG_SOCKET_GEMS_RESULT
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
std::string ToString(Type &&val, Params &&... params)
TC_COMMON_API std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
uint32 ArmorSubClassCost[8]
uint32 WeaponSubClassCost[21]
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
SpellInfo const * spells[8]
uint32 SetThreshold[MAX_ITEM_SET_SPELLS]
uint32 SetSpellID[MAX_ITEM_SET_SPELLS]
std::array< _Spell, MAX_ITEM_PROTO_SPELLS > Spells
uint32 GetMaxStackSize() const
std::array< _Socket, MAX_ITEM_PROTO_SOCKETS > Socket
bool IsArmorVellum() const
bool IsWeaponVellum() const