29 SF_LOG_ERROR(
"sql.sql",
"Item set %u for item (id %u) not found, mods not applied.", setid, proto->
ItemId);
38 for (
size_t x = 0; x < player->
ItemSetEff.size(); ++x)
57 if (x < player->ItemSetEff.size())
89 SF_LOG_ERROR(
"entities.player.items",
"WORLD: unknown spell id %u in items set %u effects", set->
spells[x], setid);
95 eff->
spells[y] = spellInfo;
110 SF_LOG_ERROR(
"sql.sql",
"Item set #%u for item #%u not found, mods not removed.", setid, proto->
ItemId);
116 for (; setindex < player->
ItemSetEff.size(); setindex++)
162 if (!pProto || !pBagProto)
165 switch (pBagProto->
Class)
283 return !bag->IsEmpty();
307 bool isInTransaction = !(trans.
null());
308 if (!isInTransaction)
326 std::ostringstream ssSpells;
329 stmt->
setString(++index, ssSpells.str());
333 std::ostringstream ssEnchants;
340 stmt->
setString(++index, ssEnchants.str());
385 if (!isInTransaction)
389 if (!
loot.isLooted())
401 if (!isInTransaction)
426 bool need_save =
false;
434 if ((proto->
Duration == 0) != (duration == 0))
453 std::string enchants = fields[6].
GetString();
460 if (
uint32 reforgeEntry = fields[8].GetInt32())
466 if (
uint32 transmogId = fields[9].GetInt32())
483 SetText(fields[12].GetString());
511 if (!
loot.isLooted())
551 0,
SKILL_CLOTH,
SKILL_LEATHER,
SKILL_MAIL,
SKILL_PLATE_MAIL, 0,
SKILL_SHIELD, 0, 0, 0, 0
556 switch (proto->
Class)
562 return item_weapon_skills[proto->
SubClass];
568 return item_armor_skills[proto->
SubClass];
600 SF_LOG_ERROR(
"sql.sql",
"Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId);
604 return random_id->
ID;
613 SF_LOG_ERROR(
"sql.sql",
"Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId);
626 if (randomPropId > 0)
759 if (owner->GetLootGUID() ==
GetGUID())
779 if (enchantEntry->requiredSkill && player->
GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue)
934 GemColor = gemProperty->
color;
957 if (GemID == enchantEntry->
GemID)
989 return proto && ((proto->
Map && proto->
Map != cur_mapId) || (proto->
Area && proto->
Area != cur_zoneId));
1007 data <<
uint32(duration);
1023 ASSERT(count != 0 &&
"pProto->Stackable == 0 but checked at loading already");
1089 trans->Append(stmt);
1096 trans->Append(stmt);
1103 if (trans && !trans->
null())
1107 (*trans)->Append(stmt);
1138 time_t curtime = time(NULL);
1140 uint32 new_playtime = current_playtime + elapsed;
1142 if (new_playtime <= 2 *
HOUR)
1159 time_t curtime = time(NULL);
1257 if (!transmogrifier || !transmogrified)
1308 normalSellPrice =
true;
1319 if (!qualityPrice || !basePrice)
1322 float qualityFactor = qualityPrice->
Factor;
1323 float baseFactor = 0.0f;
1341 float typeFactor = 0.0f;
1344 switch (inventoryType)
1387 typeFactor = shieldPrice->
Factor;
1417 typeFactor = weaponPrice->
Factor;
1420 normalSellPrice =
false;
1453 if (cost < minimumPrice)
1454 cost = minimumPrice;
1470 if (randomPropId < 0)
1480 for (
int k = 0; k < 5; ++k)
1481 if (randomSuffix->
enchant_id[k] == enchant->ID)
1495 if (randomProp->
enchant_id[k] == enchant->ID)
1496 return int32(enchant->amount[k]);
1505 if (
loot.isLooted())
1511 loot.containerID = container_id;
1518 trans->Append(stmt_money);
1523 trans->Append(stmt_money);
1527 if (!
loot.isLooted())
1531 trans->Append(stmt_items);
1534 for (LootItemList::const_iterator _li =
loot.items.begin(); _li !=
loot.items.end(); ++_li)
1547 stmt_items->
setBool(3, _li->follow_loot_rules);
1548 stmt_items->
setBool(4, _li->freeforall);
1549 stmt_items->
setBool(5, _li->is_blocked);
1550 stmt_items->
setBool(6, _li->is_counted);
1551 stmt_items->
setBool(7, _li->is_underthreshold);
1552 stmt_items->
setBool(8, _li->needs_quest);
1553 stmt_items->
setInt32(9, _li->randomPropertyId);
1554 stmt_items->
setUInt32(10, _li->randomSuffix);
1555 trans->Append(stmt_items);
1571 loot.containerID = container_id;
1580 Field* fields = money_result->Fetch();
1602 Field* fields = item_result->Fetch();
1625 loot.items.push_back(loot_item);
1628 loot.unlootedCount++;
1629 }
while (item_result->NextRow());
1646 trans->Append(stmt);
1658 trans->Append(stmt);
1669 trans->Append(stmt);
Item * NewItemOrBag(ItemTemplate const *proto)
@ CHAR_UPD_ITEM_INSTANCE_ON_LOAD
@ CHAR_DEL_ITEM_INSTANCE_TRANSMOG
@ CHAR_DEL_ITEMCONTAINER_MONEY
@ CHAR_DEL_CHAR_INVENTORY_BY_ITEM
@ CHAR_DEL_ITEMCONTAINER_ITEM
@ CHAR_DEL_ITEMCONTAINER_ITEMS
@ CHAR_SEL_ITEMCONTAINER_ITEMS
@ CHAR_DEL_ITEM_BOP_TRADE
@ CHAR_DEL_ITEM_REFUND_INSTANCE
@ CHAR_INS_ITEMCONTAINER_ITEMS
@ CHAR_INS_ITEMCONTAINER_MONEY
@ CHAR_INS_ITEM_INSTANCE_TRANSMOG
@ CHAR_SEL_ITEMCONTAINER_MONEY
@ CHAR_INS_ITEM_REFUND_INSTANCE
@ ITEM_ENCHANTMENT_TYPE_STAT
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
DBCStorage< ItemSetEntry > sItemSetStore(ItemSetEntryfmt)
DBCStorage< ImportPriceShieldEntry > sImportPriceShieldStore(ImportPriceShieldfmt)
DBCStorage< ItemClassEntry > sItemClassStore(ItemClassfmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
DBCStorage< ImportPriceArmorEntry > sImportPriceArmorStore(ImportPriceArmorfmt)
DBCStorage< ItemPriceBaseEntry > sItemPriceBaseStore(ItemPriceBasefmt)
DBCStorage< GemPropertiesEntry > sGemPropertiesStore(GemPropertiesEntryfmt)
DBCStorage< ItemRandomPropertiesEntry > sItemRandomPropertiesStore(ItemRandomPropertiesfmt)
DBCStorage< ImportPriceQualityEntry > sImportPriceQualityStore(ImportPriceQualityfmt)
DBCStorage< ImportPriceWeaponEntry > sImportPriceWeaponStore(ImportPriceWeaponfmt)
#define MAX_ITEM_SET_SPELLS
#define MAX_ITEM_ENCHANTMENT_EFFECTS
void AddItemsSetItem(Player *player, Item *item)
bool ItemCanGoIntoBag(ItemTemplate const *pProto, ItemTemplate const *pBagProto)
void RemoveItemsSetItem(Player *player, ItemTemplate const *proto)
#define MAX_ENCHANTMENT_OFFSET
@ PROP_ENCHANTMENT_SLOT_0
@ PRISMATIC_ENCHANTMENT_SLOT
@ PROP_ENCHANTMENT_SLOT_1
@ MAX_INSPECTED_ENCHANTMENT_SLOT
@ PROP_ENCHANTMENT_SLOT_4
@ ENCHANTMENT_CAN_SOULBOUND
@ ENCHANTMENT_CHARGES_OFFSET
@ ENCHANTMENT_DURATION_OFFSET
uint32 GenerateEnchSuffixFactor(uint32 item_id)
uint32 GetItemEnchantMod(int32 entry)
@ ITEM_SUBCLASS_WEAPON_FISHING_POLE
@ 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_COOKING_SUPP
@ BAG_FAMILY_MASK_FISHING_SUPP
@ BAG_FAMILY_MASK_LEATHERWORKING_SUPP
@ ITEM_SUBCLASS_CONTAINER
@ ITEM_SUBCLASS_COOKING_CONTAINER
@ ITEM_SUBCLASS_INSCRIPTION_CONTAINER
@ ITEM_SUBCLASS_LEATHERWORKING_CONTAINER
@ ITEM_SUBCLASS_TACKLE_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_PLATE
@ ITEM_SUBCLASS_ARMOR_MISCELLANEOUS
#define MAX_ITEM_SUBCLASS_ARMOR
@ ITEM_FLAGS_EXTRA_CANNOT_TRANSMOG
@ ITEM_FLAGS_EXTRA_HAS_NORMAL_PRICE
@ ITEM_FLAGS_EXTRA_CAN_TRANSMOG
@ ITEM_FLAGS_EXTRA_CANNOT_BE_TRANSMOG
#define MAX_ITEM_PROTO_SPELLS
@ ITEM_FLAG_BOP_TRADEABLE
#define MAX_ITEM_SUBCLASS_WEAPON
#define MAX_ITEM_PROTO_STATS
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_ERROR(filterType__,...)
LootStore LootTemplates_Item("item_loot_template", "item entry", true)
std::set< uint32 > AllowedLooterSet
UNORDERED_MAP< Player *, UpdateData > UpdateDataMapType
uint32 GUID_LOPART(uint64 x)
uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
#define INVENTORY_SLOT_BAG_0
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Skyfire::AutoPtr< Transaction, Skyfire::Mutex > SQLTransaction
@ ITEM_FIELD_CONTAINED_IN
@ ITEM_FIELD_MAX_DURABILITY
@ ITEM_FIELD_RANDOM_PROPERTIES_ID
@ ITEM_FIELD_MODIFIERS_MASK
@ ITEM_FIELD_PROPERTY_SEED
@ ITEM_FIELD_GIFT_CREATOR
@ ITEM_FIELD_DYNAMIC_FLAGS
@ ITEM_FIELD_CREATE_PLAYED_TIME
void WriteGuidBytes(const ObjectGuid &guid, Offsets... offsets)
void WriteGuidMask(const ObjectGuid &guid, Offsets... offsets)
std::string GetString() const
uint32 GetPaidExtendedCost() const
void BuildUpdate(UpdateDataMapType &)
int32 GetReforgableStat(ItemModType statType) const
void UpdateItemSuffixFactor()
void SetNotRefundable(Player *owner, bool changestate=true, SQLTransaction *trans=NULL)
void SetSpellCharges(uint8 index, int32 value)
void SetText(std::string const &text)
void UpdateDuration(Player *owner, uint32 diff)
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster=0)
bool HasEnchantRequiredSkill(const Player *player) const
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const
void SetState(ItemUpdateState state, Player *forplayer=NULL)
void AddToUpdateQueueOf(Player *player)
uint32 GetEnchantmentId(EnchantmentSlot slot) const
void ItemContainerSaveLootToDB()
int32 GetSpellCharges(uint8 index=0) const
void SetOwnerGUID(uint64 guid)
void RemoveFromUpdateQueueOf(Player *player)
void SetSoulboundTradeable(AllowedLooterSet const &allowedLooters)
void SetItemRandomProperties(int32 randomPropId)
void SetPaidMoney(uint32 money)
uint8 GetGemCountWithID(uint32 GemID) const
bool IsBoundAccountWide() const
Item * CloneItem(uint32 count, Player const *player=NULL) const
bool CanBeTraded(bool mail=false, bool trade=false) const
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
void ItemContainerDeleteLootMoneyAndLootItemsFromDB()
virtual void SaveToDB(SQLTransaction &trans)
void SetCount(uint32 value)
int32 GetItemRandomPropertyId() const
ItemTemplate const * GetTemplate() const
void SaveRefundDataToDB()
void SetRefundRecipient(uint32 pGuidLow)
uint32 GetItemSuffixFactor() const
bool IsBindedNotWith(Player const *player) const
static uint32 GetSpecialPrice(ItemTemplate const *proto, uint32 minimumPrice=10000)
bool CanBeTransmogrified() const
void SendTimeUpdate(Player *owner)
void UpdatePlayedTime(Player *owner)
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, Field *fields, uint32 entry)
static bool CanTransmogrifyItemWithItem(Item const *transmogrified, Item const *transmogrifier)
Player * GetOwner() const
time_t m_lastPlayedTimeUpdate
static Item * CreateItem(uint32 itemEntry, uint32 count, Player const *player=NULL)
static uint32 GetSellPrice(ItemTemplate const *proto, bool &success)
bool GemsFitSockets() const
bool ItemContainerLoadLootFromDB()
bool IsBoundByEnchant() const
void DeleteRefundDataFromDB(SQLTransaction *trans)
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
uint32 m_paidExtendedCost
void ClearEnchantment(EnchantmentSlot slot)
static void DeleteFromInventoryDB(SQLTransaction &trans, uint32 itemGuid)
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player *owner)
InventoryResult CanBeMergedPartlyWith(ItemTemplate const *proto) const
void SetPaidExtendedCost(uint32 iece)
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
bool CanTransmogrify() const
uint64 GetOwnerGUID() const
void ItemContainerDeleteLootItemFromDB(uint32 itemID)
uint32 GetPaidMoney() const
uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const
void ClearSoulboundTradeable(Player *currentOwner)
bool IsNotEmptyBag() const
bool CheckSoulboundTradeExpire()
void ItemContainerDeleteLootMoneyFromDB()
uint32 GetRefundRecipient() const
static int32 GenerateItemRandomPropertyId(uint32 item_id)
virtual bool Create(uint32 guidlow, uint32 itemid, Player const *owner)
bool IsInUpdateQueue() const
void ItemContainerDeleteLootItemsFromDB()
bool IsFitToSpellRequirements(SpellInfo const *spellInfo) const
AllowedLooterSet allowedGUIDs
static void DeleteFromDB(SQLTransaction &trans, uint32 itemGuid)
void CopyConditions(const ConditionList &conditions)
static Player * FindPlayer(uint64)
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
int32 GetInt32Value(uint16 index) const
void SetInt32Value(uint16 index, int32 value)
uint32 GetUInt32Value(uint16 index) const
void _LoadIntoDataField(std::string const &data, uint32 startOffset, uint32 count)
uint32 GetGUIDLow() const
std::vector< uint32 * > m_dynamicTab
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
void SetFlag(uint16 index, uint32 newFlag)
void RemoveFlag(uint16 index, uint32 oldFlag)
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
void ClearUpdateMask(bool remove)
uint32 GetDynamicUInt32Value(uint32 tab, uint16 index) const
uint64 GetUInt64Value(uint16 index) const
void SetDynamicUInt32Value(uint32 tab, uint16 index, uint32 value)
std::vector< bool * > m_dynamicChange
bool HasFlag(uint16 index, uint32 flag) const
void SetEntry(uint32 entry)
virtual void SetObjectScale(float scale)
void SetUInt32Value(uint16 index, uint32 value)
void SetUInt64Value(uint16 index, uint64 value)
std::vector< Item * > m_itemUpdateQueue
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(uint32 it)
bool m_itemUpdateQueueBlocked
void setBool(const uint8 index, const bool value)
void setString(const uint8 index, const std::string &value)
void setUInt16(const uint8 index, const uint16 value)
void setUInt32(const uint8 index, const uint32 value)
void setInt16(const uint8 index, const int16 value)
void setInt32(const uint8 index, const int32 value)
bool IsAbilityOfSkillType(uint32 skillType) const
int32 EquippedItemSubClassMask
int32 EquippedItemInventoryTypeMask
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
void SendEnchantmentLog(uint64 target, uint64 caster, uint64 itemGuid, uint32 itemId, uint32 enchantId, uint32 enchantmentSlot)
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
uint32 enchant_id[MAX_ITEM_ENCHANTMENT_EFFECTS]
SpellInfo const * spells[8]
uint32 required_skill_value
uint32 items_to_triggerspell[MAX_ITEM_SET_SPELLS]
uint32 spells[MAX_ITEM_SET_SPELLS]
uint32 GetMaxStackSize() const
bool IsRangedWeapon() const
_Spell Spells[MAX_ITEM_PROTO_SPELLS]
uint32 ScalingStatDistribution
_ItemStat ItemStat[MAX_ITEM_PROTO_STATS]
_Socket Socket[MAX_ITEM_PROTO_SOCKETS]
AllowedLooterSet allowedGUIDs