34 sLog.outErrorDb(
"Item set %u for item (id %u) not found, mods not applied.", setid, proto->
ItemId);
38 if (set->required_skill_id && player->
GetSkillValue(set->required_skill_id) <
set->required_skill_value)
43 for (
size_t x = 0; x < player->
ItemSetEff.size(); ++x)
63 if (x < player->ItemSetEff.size())
71 for (
uint32 x = 0; x < 8; x++)
76 if (set->items_to_triggerspell[x] > eff->
item_count)
88 for (
uint32 y = 0; y < 8; y++)
95 sLog.outError(
"WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid);
101 eff->
spells[y] = spellInfo;
116 sLog.outErrorDb(
"Item set #%u for item #%u not found, mods not removed.", setid, proto->
ItemId);
122 for (; setindex < player->
ItemSetEff.size(); setindex++)
137 for (
uint32 x = 0; x < 8; x++)
143 if (set->items_to_triggerspell[x] <= eff->
item_count)
146 for (
uint32 z = 0; z < 8; z++)
168 if (!pProto || !pBagProto)
171 switch (pBagProto->
Class)
293 std::ostringstream ss;
294 ss <<
"REPLACE INTO item_instance (guid,owner_guid,itemEntry,creatorGuid,giftCreatorGuid,count,duration,charges,flags,enchantments,randomPropertyId,durability,itemTextId) VALUES (";
322 std::ostringstream ss;
324 ss <<
", itemEntry = " <<
GetEntry();
329 ss <<
", charges = '";
334 ss <<
", enchantments = '";
345 ss <<
" WHERE guid = " << guid;
390 bool need_save =
false;
395 uint32 duration = fields[4].GetUInt32();
398 if ((proto->
Duration == 0) != (duration == 0))
424 uint32 durability = fields[9].GetUInt16();
438 std::ostringstream ss;
442 <<
" WHERE guid = " << guid;
488 switch (proto->
Class)
494 return item_weapon_skills[proto->
SubClass];
500 return item_armor_skills[proto->
SubClass];
511 switch (proto->
Class)
583 sLog.outErrorDb(
"Item template %u has RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->
ItemId, itemProto->
RandomProperty, itemProto->
RandomSuffix);
594 sLog.outErrorDb(
"Enchantment id #%u used but it doesn't have a record in 'ItemRandomProperties.dbc'", randomPropId);
598 return random_id->
ID;
607 sLog.outErrorDb(
"Enchantment id #%u used but it doesn't have a record in sItemRandomSuffixStore.", randomPropId);
620 if (randomPropId > 0)
753 if (owner->GetLootGUID() ==
GetGUID())
852 for (
uint8 x = 0; x < 3; ++x)
867 if (SocketColor) fits &=
false;
874 if (SocketColor) fits &=
false;
888 GemColor = gemProperty->
color;
910 if (GemID == enchantEntry->
GemID)
919 return proto && ((proto->
Map && proto->
Map != cur_mapId) || (proto->
Area && proto->
Area != cur_zoneId));
947 ASSERT(count != 0 &&
"pProto->Stackable == 0 but checked at loading already");
uint32 GetItemEnchantMod(uint32 entry)
bool IsBindedNotWith(Player const *player) const
ItemTemplate const * GetProto() const
void SetState(ItemUpdateState state, Player *forplayer=NULL)
const uint32 & GetUInt32Value(uint16 index) const
int32 GetSpellCharges(uint8 index=0) const
void ClearUpdateMask(bool remove)
DBCStorage< ItemSetEntry > sItemSetStore(ItemSetEntryfmt)
std::vector< std::string > Tokens
uint32 GetItemSuffixFactor() const
virtual void DeleteFromDB()
Item * CloneItem(uint32 count, Player const *player=NULL) const
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
void SetInt32Value(uint16 index, int32 value)
void SetObjectScale(float scale)
bool Execute(const char *sql)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
const uint64 & GetUInt64Value(uint16 index) const
void AddToUpdateQueueOf(Player *player)
#define MAX_ITEM_SUBCLASS_ARMOR
void _LoadIntoDataField(const char *data, uint32 startOffset, uint32 count)
bool IsFitToSpellRequirements(SpellEntry const *spellInfo) const
#define sLog
Log class singleton.
Tokens StrSplit(const std::string &src, const std::string &sep)
void SetUInt32Value(uint16 index, uint32 value)
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
void UpdateDuration(Player *owner, uint32 diff)
bool GemsFitSockets() const
void SetCount(uint32 value)
uint32 GetGUIDLow() const
void SetEntry(uint32 entry)
void SetOwnerGUID(uint64 guid)
void SetItemRandomProperties(int32 randomPropId)
int32 GetItemRandomPropertyId() const
void SendPacket(WorldPacket const *packet)
void RemoveItemsSetItem(Player *player, ItemTemplate const *proto)
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges)
void UpdateItemSuffixFactor()
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
void DestroyItem(uint8 bag, uint8 slot, bool update)
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const
int32 EquippedItemSubClassMask
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
DBCStorage< ItemRandomPropertiesEntry > sItemRandomPropertiesStore(ItemRandomPropertiesfmt)
SpellEntry const * spells[8]
void SendTimeUpdate(Player *owner)
Item * NewItemOrBag(ItemTemplate const *proto)
static int32 GenerateItemRandomPropertyId(uint32 item_id)
virtual bool Create(uint32 guidlow, uint32 itemid, Player const *owner)
Player * GetOwner() const
uint8 GetGemCountWithID(uint32 GemID) const
void BuildUpdate(UpdateDataMapType &) override
#define MAKE_NEW_GUID(l, e, h)
#define MAX_ENCHANTMENT_OFFSET
static Item * CreateItem(uint32 item, uint32 count, Player const *player=NULL)
void ClearEnchantment(EnchantmentSlot slot)
uint16 GetSkillValue(uint32 skill) const
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
void RemoveFromUpdateQueueOf(Player *player)
void AddItemsSetItem(Player *player, Item *item)
UNORDERED_MAP< Player *, UpdateData > UpdateDataMapType
bool PExecute(const char *format,...) ATTR_PRINTF(2
uint8 CanBeMergedPartlyWith(ItemTemplate const *proto) const
std::vector< Item * > m_itemUpdateQueue
#define MAX_ITEM_PROTO_SPELLS
void SetUInt64Value(uint16 index, const uint64 &value)
bool IsBoundByEnchant() const
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, Field *fields)
void SetSpellCharges(uint8 index, int32 value)
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
T const * LookupEntry(uint32 id) const
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
int32 EquippedItemInventoryTypeMask
DBCStorage< GemPropertiesEntry > sGemPropertiesStore(GemPropertiesEntryfmt)
const int32 & GetInt32Value(uint16 index) const
WorldSession * GetSession() const
void ApplyEquipSpell(SpellEntry const *spellInfo, Item *item, bool apply, bool form_change=false)
DatabaseType CharacterDatabase
Accessor to the character database.
uint32 GenerateEnchSuffixFactor(uint32 item_id)
bool HasFlag(uint16 index, uint32 flag) const
bool IsInUpdateQueue() const
static bool IsBagPos(uint16 pos)
void DeleteFromInventoryDB()
bool ItemCanGoIntoBag(ItemTemplate const *pProto, ItemTemplate const *pBagProto)
uint64 const & GetOwnerGUID() const
std::vector< ItemSetEffect * > ItemSetEff
bool m_itemUpdateQueueBlocked
#define MAX_ITEM_SUBCLASS_WEAPON
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player *owner)
uint32 GetEnchantmentId(EnchantmentSlot slot) const