mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-19 22:49:39 -04:00
Core/Items: downgrade items part 1: removed item bonus generation, artifact weapon handling and azerite item mechanics
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
ALTER TABLE `item_instance`
|
||||
DROP COLUMN `bonusListIDs`,
|
||||
DROP COLUMN `randomBonusListId`;
|
||||
|
||||
DROP TABLE IF EXISTS `item_instance_artifact`;
|
||||
DROP TABLE IF EXISTS `item_instance_artifact_powers`;
|
||||
DROP TABLE IF EXISTS `item_instance_azerite`;
|
||||
DROP TABLE IF EXISTS `item_instance_azerite_empowered`;
|
||||
DROP TABLE IF EXISTS `item_instance_azerite_milestone_power`;
|
||||
DROP TABLE IF EXISTS `item_instance_azerite_unlocked_essence`;
|
||||
|
||||
ALTER TABLE `character_void_storage`
|
||||
DROP COLUMN `randomBonusListId`,
|
||||
DROP COLUMN `artifactKnowledgeLevel`,
|
||||
DROP COLUMN `bonusListIDs`;
|
||||
|
||||
ALTER TABLE `item_loot_items`
|
||||
DROP COLUMN `rnd_bonus`,
|
||||
DROP COLUMN `bonus_list_ids`;
|
||||
@@ -23,8 +23,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
if (!m_reconnecting)
|
||||
m_stmts.resize(MAX_CHARACTERDATABASE_STATEMENTS);
|
||||
|
||||
#define SelectItemInstanceContent "ii.guid, ii.itemEntry, ii.creatorGuid, ii.giftCreatorGuid, ii.count, ii.duration, ii.charges, ii.flags, ii.enchantments, ii.randomBonusListId, " \
|
||||
"ii.durability, ii.playedTime, ii.text, ii.battlePetSpeciesId, ii.battlePetBreedData, ii.battlePetLevel, ii.battlePetDisplayId, ii.context, ii.bonusListIDs, " \
|
||||
#define SelectItemInstanceContent "ii.guid, ii.itemEntry, ii.creatorGuid, ii.giftCreatorGuid, ii.count, ii.duration, ii.charges, ii.flags, ii.enchantments, " \
|
||||
"ii.durability, ii.playedTime, ii.text, ii.battlePetSpeciesId, ii.battlePetBreedData, ii.battlePetLevel, ii.battlePetDisplayId, ii.context, " \
|
||||
"iit.itemModifiedAppearanceAllSpecs, iit.itemModifiedAppearanceSpec1, iit.itemModifiedAppearanceSpec2, iit.itemModifiedAppearanceSpec3, iit.itemModifiedAppearanceSpec4, iit.itemModifiedAppearanceSpec5, " \
|
||||
"iit.spellItemEnchantmentAllSpecs, iit.spellItemEnchantmentSpec1, iit.spellItemEnchantmentSpec2, iit.spellItemEnchantmentSpec3, iit.spellItemEnchantmentSpec4, iit.spellItemEnchantmentSpec5, " \
|
||||
"iit.secondaryItemModifiedAppearanceAllSpecs, iit.secondaryItemModifiedAppearanceSpec1, iit.secondaryItemModifiedAppearanceSpec2, iit.secondaryItemModifiedAppearanceSpec3, iit.secondaryItemModifiedAppearanceSpec4, iit.itemModifiedAppearanceSpec5, " \
|
||||
@@ -163,16 +163,6 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_ACTIONS_SPEC, "SELECT button, action, type FROM character_action WHERE guid = ? AND spec = ? AND traitConfigId = ? ORDER BY button", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_MAILITEMS, "SELECT " SelectItemInstanceContent ", ii.owner_guid, m.id FROM mail_items mi INNER JOIN mail m ON mi.mail_id = m.id LEFT JOIN item_instance ii ON mi.item_guid = ii.guid LEFT JOIN item_instance_gems ig ON ii.guid = ig.itemGuid LEFT JOIN item_instance_transmog iit ON ii.guid = iit.itemGuid LEFT JOIN item_instance_modifiers im ON ii.guid = im.itemGuid WHERE m.receiver = ?", CONNECTION_BOTH);
|
||||
PrepareStatement(CHAR_SEL_MAILITEMS_ARTIFACT, "SELECT a.itemGuid, a.xp, a.artifactAppearanceId, a.artifactTierId, ap.artifactPowerId, ap.purchasedRank FROM item_instance_artifact_powers ap LEFT JOIN item_instance_artifact a ON ap.itemGuid = a.itemGuid INNER JOIN mail_items mi ON a.itemGuid = mi.item_guid INNER JOIN mail m ON mi.mail_id = m.id WHERE m.receiver = ?", CONNECTION_BOTH);
|
||||
PrepareStatement(CHAR_SEL_MAILITEMS_AZERITE, "SELECT iz.itemGuid, iz.xp, iz.level, iz.knowledgeLevel, "
|
||||
"iz.selectedAzeriteEssences1specId, iz.selectedAzeriteEssences1azeriteEssenceId1, iz.selectedAzeriteEssences1azeriteEssenceId2, iz.selectedAzeriteEssences1azeriteEssenceId3, iz.selectedAzeriteEssences1azeriteEssenceId4, "
|
||||
"iz.selectedAzeriteEssences2specId, iz.selectedAzeriteEssences2azeriteEssenceId1, iz.selectedAzeriteEssences2azeriteEssenceId2, iz.selectedAzeriteEssences2azeriteEssenceId3, iz.selectedAzeriteEssences2azeriteEssenceId4, "
|
||||
"iz.selectedAzeriteEssences3specId, iz.selectedAzeriteEssences3azeriteEssenceId1, iz.selectedAzeriteEssences3azeriteEssenceId2, iz.selectedAzeriteEssences3azeriteEssenceId3, iz.selectedAzeriteEssences3azeriteEssenceId4, "
|
||||
"iz.selectedAzeriteEssences4specId, iz.selectedAzeriteEssences4azeriteEssenceId1, iz.selectedAzeriteEssences4azeriteEssenceId2, iz.selectedAzeriteEssences4azeriteEssenceId3, iz.selectedAzeriteEssences4azeriteEssenceId4 "
|
||||
"FROM item_instance_azerite iz INNER JOIN mail_items mi ON iz.itemGuid = mi.item_guid INNER JOIN mail m ON mi.mail_id = m.id WHERE m.receiver = ?", CONNECTION_BOTH);
|
||||
PrepareStatement(CHAR_SEL_MAILITEMS_AZERITE_MILESTONE_POWER, "SELECT iamp.itemGuid, iamp.azeriteItemMilestonePowerId FROM item_instance_azerite_milestone_power iamp INNER JOIN mail_items mi ON iamp.itemGuid = mi.item_guid INNER JOIN mail m ON mi.mail_id = m.id WHERE m.receiver = ?", CONNECTION_BOTH);
|
||||
PrepareStatement(CHAR_SEL_MAILITEMS_AZERITE_UNLOCKED_ESSENCE, "SELECT iaue.itemGuid, iaue.azeriteEssenceId, iaue.`rank` FROM item_instance_azerite_unlocked_essence iaue INNER JOIN mail_items mi ON iaue.itemGuid = mi.item_guid INNER JOIN mail m ON mi.mail_id = m.id WHERE m.receiver = ?", CONNECTION_BOTH);
|
||||
PrepareStatement(CHAR_SEL_MAILITEMS_AZERITE_EMPOWERED, "SELECT iae.itemGuid, iae.azeritePowerId1, iae.azeritePowerId2, iae.azeritePowerId3, iae.azeritePowerId4, iae.azeritePowerId5 FROM item_instance_azerite_empowered iae INNER JOIN mail_items mi ON iae.itemGuid = mi.item_guid INNER JOIN mail m ON mi.mail_id = m.id WHERE m.receiver = ?", CONNECTION_BOTH);
|
||||
PrepareStatement(CHAR_SEL_AUCTION_ITEMS, "SELECT " SelectItemInstanceContent ", ii.owner_guid, ai.auctionId FROM auction_items ai INNER JOIN item_instance ii ON ai.itemGuid = ii.guid LEFT JOIN item_instance_gems ig ON ii.guid = ig.itemGuid LEFT JOIN item_instance_transmog iit ON ii.guid = iit.itemGuid LEFT JOIN item_instance_modifiers im ON ii.guid = im.itemGuid", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_AUCTIONS, "SELECT id, auctionHouseId, owner, bidder, minBid, buyoutOrUnitPrice, deposit, bidAmount, startTime, endTime, serverFlags FROM auctionhouse", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_INS_AUCTION_ITEMS, "INSERT INTO auction_items (auctionId, itemGuid) VALUES (?, ?)", CONNECTION_ASYNC);
|
||||
@@ -201,8 +191,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_DEL_ITEM_BOP_TRADE, "DELETE FROM item_soulbound_trade_data WHERE itemGuid = ? LIMIT 1", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEM_BOP_TRADE, "INSERT INTO item_soulbound_trade_data VALUES (?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_REP_INVENTORY_ITEM, "REPLACE INTO character_inventory (guid, bag, slot, item) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_REP_ITEM_INSTANCE, "REPLACE INTO item_instance (itemEntry, owner_guid, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomBonusListId, durability, playedTime, text, battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, bonusListIDs, guid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_ITEM_INSTANCE, "UPDATE item_instance SET itemEntry = ?, owner_guid = ?, creatorGuid = ?, giftCreatorGuid = ?, count = ?, duration = ?, charges = ?, flags = ?, enchantments = ?, randomBonusListId = ?, durability = ?, playedTime = ?, text = ?, battlePetSpeciesId = ?, battlePetBreedData = ?, battlePetLevel = ?, battlePetDisplayId = ?, context = ?, bonusListIDs = ? WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_REP_ITEM_INSTANCE, "REPLACE INTO item_instance (itemEntry, owner_guid, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, durability, playedTime, text, battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, guid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_ITEM_INSTANCE, "UPDATE item_instance SET itemEntry = ?, owner_guid = ?, creatorGuid = ?, giftCreatorGuid = ?, count = ?, duration = ?, charges = ?, flags = ?, enchantments = ?, durability = ?, playedTime = ?, text = ?, battlePetSpeciesId = ?, battlePetBreedData = ?, battlePetLevel = ?, battlePetDisplayId = ?, context = ? WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_ITEM_INSTANCE_ON_LOAD, "UPDATE item_instance SET duration = ?, flags = ?, durability = ? WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE, "DELETE FROM item_instance WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_BY_OWNER, "DELETE FROM item_instance WHERE owner_guid = ?", CONNECTION_ASYNC);
|
||||
@@ -214,42 +204,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
"secondaryItemModifiedAppearanceAllSpecs, secondaryItemModifiedAppearanceSpec1, secondaryItemModifiedAppearanceSpec2, secondaryItemModifiedAppearanceSpec3, secondaryItemModifiedAppearanceSpec4, secondaryItemModifiedAppearanceSpec5) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_TRANSMOG, "DELETE FROM item_instance_transmog WHERE itemGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_TRANSMOG_BY_OWNER, "DELETE iit FROM item_instance_transmog iit LEFT JOIN item_instance ii ON iit.itemGuid = ii.guid WHERE ii.owner_guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_ITEM_INSTANCE_ARTIFACT, "SELECT a.itemGuid, a.xp, a.artifactAppearanceId, a.artifactTierId, ap.artifactPowerId, ap.purchasedRank FROM item_instance_artifact_powers ap LEFT JOIN item_instance_artifact a ON ap.itemGuid = a.itemGuid INNER JOIN character_inventory ci ON ci.item = ap.itemGuid WHERE ci.guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEM_INSTANCE_ARTIFACT, "INSERT INTO item_instance_artifact (itemGuid, xp, artifactAppearanceId, artifactTierId) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT, "DELETE FROM item_instance_artifact WHERE itemGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_BY_OWNER, "DELETE iia FROM item_instance_artifact iia LEFT JOIN item_instance ii ON iia.itemGuid = ii.guid WHERE ii.owner_guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEM_INSTANCE_ARTIFACT_POWERS, "INSERT INTO item_instance_artifact_powers (itemGuid, artifactPowerId, purchasedRank) VALUES (?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS, "DELETE FROM item_instance_artifact_powers WHERE itemGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS_BY_OWNER, "DELETE iiap FROM item_instance_artifact_powers iiap LEFT JOIN item_instance ii ON iiap.itemGuid = ii.guid WHERE ii.owner_guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEM_INSTANCE_MODIFIERS, "INSERT INTO item_instance_modifiers (itemGuid, fixedScalingLevel, artifactKnowledgeLevel) VALUES (?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS, "DELETE FROM item_instance_modifiers WHERE itemGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS_BY_OWNER, "DELETE im FROM item_instance_modifiers im LEFT JOIN item_instance ii ON im.itemGuid = ii.guid WHERE ii.owner_guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_ITEM_INSTANCE_AZERITE, "SELECT iz.itemGuid, iz.xp, iz.level, iz.knowledgeLevel, "
|
||||
"iz.selectedAzeriteEssences1specId, iz.selectedAzeriteEssences1azeriteEssenceId1, iz.selectedAzeriteEssences1azeriteEssenceId2, iz.selectedAzeriteEssences1azeriteEssenceId3, iz.selectedAzeriteEssences1azeriteEssenceId4, "
|
||||
"iz.selectedAzeriteEssences2specId, iz.selectedAzeriteEssences2azeriteEssenceId1, iz.selectedAzeriteEssences2azeriteEssenceId2, iz.selectedAzeriteEssences2azeriteEssenceId3, iz.selectedAzeriteEssences2azeriteEssenceId4, "
|
||||
"iz.selectedAzeriteEssences3specId, iz.selectedAzeriteEssences3azeriteEssenceId1, iz.selectedAzeriteEssences3azeriteEssenceId2, iz.selectedAzeriteEssences3azeriteEssenceId3, iz.selectedAzeriteEssences3azeriteEssenceId4, "
|
||||
"iz.selectedAzeriteEssences4specId, iz.selectedAzeriteEssences4azeriteEssenceId1, iz.selectedAzeriteEssences4azeriteEssenceId2, iz.selectedAzeriteEssences4azeriteEssenceId3, iz.selectedAzeriteEssences4azeriteEssenceId4 "
|
||||
"FROM item_instance_azerite iz INNER JOIN character_inventory ci ON iz.itemGuid = ci.item WHERE ci.guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEM_INSTANCE_AZERITE, "INSERT INTO item_instance_azerite (itemGuid, xp, level, knowledgeLevel, selectedAzeriteEssences1specId, selectedAzeriteEssences1azeriteEssenceId1, selectedAzeriteEssences1azeriteEssenceId2, selectedAzeriteEssences1azeriteEssenceId3, selectedAzeriteEssences1azeriteEssenceId4, "
|
||||
"selectedAzeriteEssences2specId, selectedAzeriteEssences2azeriteEssenceId1, selectedAzeriteEssences2azeriteEssenceId2, selectedAzeriteEssences2azeriteEssenceId3, selectedAzeriteEssences2azeriteEssenceId4, "
|
||||
"selectedAzeriteEssences3specId, selectedAzeriteEssences3azeriteEssenceId1, selectedAzeriteEssences3azeriteEssenceId2, selectedAzeriteEssences3azeriteEssenceId3, selectedAzeriteEssences3azeriteEssenceId4, "
|
||||
"selectedAzeriteEssences4specId, selectedAzeriteEssences4azeriteEssenceId1, selectedAzeriteEssences4azeriteEssenceId2, selectedAzeriteEssences4azeriteEssenceId3, selectedAzeriteEssences4azeriteEssenceId4) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_ITEM_INSTANCE_AZERITE_ON_LOAD, "UPDATE item_instance_azerite SET xp = ?, knowledgeLevel = ? WHERE itemGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE, "DELETE FROM item_instance_azerite WHERE itemGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_BY_OWNER, "DELETE iz FROM item_instance_azerite iz LEFT JOIN item_instance ii ON iz.itemGuid = ii.guid WHERE ii.owner_guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER, "SELECT iamp.itemGuid, iamp.azeriteItemMilestonePowerId FROM item_instance_azerite_milestone_power iamp INNER JOIN character_inventory ci ON iamp.itemGuid = ci.item WHERE ci.guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEM_INSTANCE_AZERITE_MILESTONE_POWER, "INSERT INTO item_instance_azerite_milestone_power (itemGuid, azeriteItemMilestonePowerId) VALUES (?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER, "DELETE FROM item_instance_azerite_milestone_power WHERE itemGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER_BY_OWNER, "DELETE iamp FROM item_instance_azerite_milestone_power iamp LEFT JOIN item_instance ii ON iamp.itemGuid = ii.guid WHERE ii.owner_guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE, "SELECT iaue.itemGuid, iaue.azeriteEssenceId, iaue.`rank` FROM item_instance_azerite_unlocked_essence iaue INNER JOIN character_inventory ci ON iaue.itemGuid = ci.item WHERE ci.guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE, "INSERT INTO item_instance_azerite_unlocked_essence (itemGuid, azeriteEssenceId, `rank`) VALUES (?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE, "DELETE FROM item_instance_azerite_unlocked_essence WHERE itemGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE_BY_OWNER, "DELETE iaue FROM item_instance_azerite_unlocked_essence iaue LEFT JOIN item_instance ii ON iaue.itemGuid = ii.guid WHERE ii.owner_guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_ITEM_INSTANCE_AZERITE_EMPOWERED, "SELECT iae.itemGuid, iae.azeritePowerId1, iae.azeritePowerId2, iae.azeritePowerId3, iae.azeritePowerId4, iae.azeritePowerId5 FROM item_instance_azerite_empowered iae INNER JOIN character_inventory ci ON iae.itemGuid = ci.item WHERE ci.guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEM_INSTANCE_AZERITE_EMPOWERED, "INSERT INTO item_instance_azerite_empowered (itemGuid, azeritePowerId1, azeritePowerId2, azeritePowerId3, azeritePowerId4, azeritePowerId5) VALUES (?, ?, ?, ? ,? ,?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_ITEM_INSTANCE_AZERITE_EMPOWERED, "UPDATE item_instance_azerite_empowered SET azeritePowerId1 = ?, azeritePowerId2 = ?, azeritePowerId3 = ?, azeritePowerId4 = ?, azeritePowerId5 = ? WHERE itemGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_EMPOWERED, "DELETE FROM item_instance_azerite_empowered WHERE itemGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_EMPOWERED_BY_OWNER, "DELETE iae FROM item_instance_azerite_empowered iae LEFT JOIN item_instance ii ON iae.itemGuid = ii.guid WHERE ii.owner_guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_GIFT_OWNER, "UPDATE character_gifts SET guid = ? WHERE item_guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_GIFT, "DELETE FROM character_gifts WHERE item_guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_GIFT_BY_ITEM, "SELECT entry, flags FROM character_gifts WHERE item_guid = ?", CONNECTION_ASYNC);
|
||||
@@ -672,8 +629,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_DEL_CHAR_TRAIT_CONFIGS_BY_CHAR, "DELETE FROM character_trait_config WHERE guid = ?", CONNECTION_ASYNC);
|
||||
|
||||
// Void Storage
|
||||
PrepareStatement(CHAR_SEL_CHAR_VOID_STORAGE, "SELECT itemId, itemEntry, slot, creatorGuid, randomBonusListId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs FROM character_void_storage WHERE playerGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_REP_CHAR_VOID_STORAGE_ITEM, "REPLACE INTO character_void_storage (itemId, playerGuid, itemEntry, slot, creatorGuid, randomBonusListId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CHAR_VOID_STORAGE, "SELECT itemId, itemEntry, slot, creatorGuid, fixedScalingLevel, context FROM character_void_storage WHERE playerGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_REP_CHAR_VOID_STORAGE_ITEM, "REPLACE INTO character_void_storage (itemId, playerGuid, itemEntry, slot, creatorGuid, fixedScalingLevel, context) VALUES (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CHAR_VOID_STORAGE_ITEM_BY_CHAR_GUID, "DELETE FROM character_void_storage WHERE playerGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CHAR_VOID_STORAGE_ITEM_BY_SLOT, "DELETE FROM character_void_storage WHERE slot = ? AND playerGuid = ?", CONNECTION_ASYNC);
|
||||
|
||||
@@ -684,10 +641,10 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_DEL_CHAR_CUF_PROFILES, "DELETE FROM character_cuf_profiles WHERE guid = ?", CONNECTION_ASYNC);
|
||||
|
||||
// Items that hold loot or money
|
||||
PrepareStatement(CHAR_SEL_ITEMCONTAINER_ITEMS, "SELECT container_id, item_id, item_count, item_index, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_bonus, context, bonus_list_ids FROM item_loot_items", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_ITEMCONTAINER_ITEMS, "SELECT container_id, item_id, item_count, item_index, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, context FROM item_loot_items", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_DEL_ITEMCONTAINER_ITEMS, "DELETE FROM item_loot_items WHERE container_id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_ITEMCONTAINER_ITEM, "DELETE FROM item_loot_items WHERE container_id = ? AND item_id = ? AND item_count = ? AND item_index = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, item_index, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_bonus, context, bonus_list_ids) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, item_index, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, context) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_ITEMCONTAINER_MONEY, "SELECT container_id, money FROM item_loot_money", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_DEL_ITEMCONTAINER_MONEY, "DELETE FROM item_loot_money WHERE container_id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_ITEMCONTAINER_MONEY, "INSERT INTO item_loot_money (container_id, money) VALUES (?, ?)", CONNECTION_ASYNC);
|
||||
|
||||
@@ -119,11 +119,6 @@ enum CharacterDatabaseStatements : uint32
|
||||
CHAR_DEL_CHARACTER_FAVORITE_AUCTIONS_BY_CHAR,
|
||||
CHAR_SEL_ACCOUNT_INSTANCELOCKTIMES,
|
||||
CHAR_SEL_MAILITEMS,
|
||||
CHAR_SEL_MAILITEMS_ARTIFACT,
|
||||
CHAR_SEL_MAILITEMS_AZERITE,
|
||||
CHAR_SEL_MAILITEMS_AZERITE_MILESTONE_POWER,
|
||||
CHAR_SEL_MAILITEMS_AZERITE_UNLOCKED_ESSENCE,
|
||||
CHAR_SEL_MAILITEMS_AZERITE_EMPOWERED,
|
||||
CHAR_SEL_AUCTION_ITEMS,
|
||||
CHAR_INS_AUCTION,
|
||||
CHAR_DEL_AUCTION,
|
||||
@@ -162,34 +157,9 @@ enum CharacterDatabaseStatements : uint32
|
||||
CHAR_INS_ITEM_INSTANCE_TRANSMOG,
|
||||
CHAR_DEL_ITEM_INSTANCE_TRANSMOG,
|
||||
CHAR_DEL_ITEM_INSTANCE_TRANSMOG_BY_OWNER,
|
||||
CHAR_SEL_ITEM_INSTANCE_ARTIFACT,
|
||||
CHAR_INS_ITEM_INSTANCE_ARTIFACT,
|
||||
CHAR_DEL_ITEM_INSTANCE_ARTIFACT,
|
||||
CHAR_DEL_ITEM_INSTANCE_ARTIFACT_BY_OWNER,
|
||||
CHAR_INS_ITEM_INSTANCE_ARTIFACT_POWERS,
|
||||
CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS,
|
||||
CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS_BY_OWNER,
|
||||
CHAR_INS_ITEM_INSTANCE_MODIFIERS,
|
||||
CHAR_DEL_ITEM_INSTANCE_MODIFIERS,
|
||||
CHAR_DEL_ITEM_INSTANCE_MODIFIERS_BY_OWNER,
|
||||
CHAR_SEL_ITEM_INSTANCE_AZERITE,
|
||||
CHAR_INS_ITEM_INSTANCE_AZERITE,
|
||||
CHAR_UPD_ITEM_INSTANCE_AZERITE_ON_LOAD,
|
||||
CHAR_DEL_ITEM_INSTANCE_AZERITE,
|
||||
CHAR_DEL_ITEM_INSTANCE_AZERITE_BY_OWNER,
|
||||
CHAR_SEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER,
|
||||
CHAR_INS_ITEM_INSTANCE_AZERITE_MILESTONE_POWER,
|
||||
CHAR_DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER,
|
||||
CHAR_DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER_BY_OWNER,
|
||||
CHAR_SEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE,
|
||||
CHAR_INS_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE,
|
||||
CHAR_DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE,
|
||||
CHAR_DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE_BY_OWNER,
|
||||
CHAR_SEL_ITEM_INSTANCE_AZERITE_EMPOWERED,
|
||||
CHAR_INS_ITEM_INSTANCE_AZERITE_EMPOWERED,
|
||||
CHAR_UPD_ITEM_INSTANCE_AZERITE_EMPOWERED,
|
||||
CHAR_DEL_ITEM_INSTANCE_AZERITE_EMPOWERED,
|
||||
CHAR_DEL_ITEM_INSTANCE_AZERITE_EMPOWERED_BY_OWNER,
|
||||
CHAR_UPD_GIFT_OWNER,
|
||||
CHAR_DEL_GIFT,
|
||||
CHAR_SEL_CHARACTER_GIFT_BY_ITEM,
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Item.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "LanguageMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
@@ -3013,14 +3012,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6
|
||||
case ModifierTreeType::GarrisonTalentResearchInProgress: // 207 NYI
|
||||
return false;
|
||||
case ModifierTreeType::PlayerEquippedArtifactAppearanceSet: // 208
|
||||
{
|
||||
if (Aura const* artifactAura = referencePlayer->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE))
|
||||
if (Item* artifact = referencePlayer->GetItemByGuid(artifactAura->GetCastItemGUID()))
|
||||
if (ArtifactAppearanceEntry const* artifactAppearance = sArtifactAppearanceStore.LookupEntry(artifact->GetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID)))
|
||||
if (artifactAppearance->ArtifactAppearanceSetID == reqValue)
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
case ModifierTreeType::PlayerHasCurrencyEqual: // 209
|
||||
if (referencePlayer->GetCurrencyQuantity(reqValue) != secondaryAsset)
|
||||
return false;
|
||||
@@ -3056,14 +3048,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6
|
||||
break;
|
||||
}
|
||||
case ModifierTreeType::ArtifactTraitUnlockedCountEqualOrGreaterThan: // 217
|
||||
{
|
||||
Item const* artifact = referencePlayer->GetItemByEntry(secondaryAsset, ItemSearchLocation::Everywhere);
|
||||
if (!artifact)
|
||||
return false;
|
||||
if (artifact->GetTotalUnlockedArtifactPowers() < reqValue)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
case ModifierTreeType::ParagonReputationLevelEqualOrGreaterThan: // 218
|
||||
if (referencePlayer->GetReputationMgr().GetParagonLevel(miscValue1) < int32(reqValue))
|
||||
return false;
|
||||
@@ -3087,23 +3072,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6
|
||||
break;
|
||||
}
|
||||
case ModifierTreeType::PlayerHasItemWithBonusListFromTreeAndQuality: // 222
|
||||
{
|
||||
std::vector<int32> bonusListIDs = ItemBonusMgr::GetAllBonusListsForTree(reqValue);
|
||||
if (bonusListIDs.empty())
|
||||
return false;
|
||||
|
||||
bool bagScanReachedEnd = referencePlayer->ForEachItem(ItemSearchLocation::Everywhere, [&bonusListIDs](Item const* item)
|
||||
{
|
||||
bool hasBonus = std::any_of(item->GetBonusListIDs().begin(), item->GetBonusListIDs().end(), [&bonusListIDs](int32 bonusListID)
|
||||
{
|
||||
return std::find(bonusListIDs.begin(), bonusListIDs.end(), bonusListID) != bonusListIDs.end();
|
||||
});
|
||||
return hasBonus ? ItemSearchCallbackResult::Stop : ItemSearchCallbackResult::Continue;
|
||||
});
|
||||
if (bagScanReachedEnd)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
case ModifierTreeType::PlayerHasEmptyInventorySlotCountEqualOrGreaterThan: // 223
|
||||
if (referencePlayer->GetFreeInventorySlotCount(ItemSearchLocation::Inventory) < reqValue)
|
||||
return false;
|
||||
@@ -3111,20 +3080,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6
|
||||
case ModifierTreeType::PlayerHasItemInHistoryOfProgressiveEvent: // 224 NYI
|
||||
return false;
|
||||
case ModifierTreeType::PlayerHasArtifactPowerRankCountPurchasedEqualOrGreaterThan: // 225
|
||||
{
|
||||
Aura const* artifactAura = referencePlayer->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE);
|
||||
if (!artifactAura)
|
||||
return false;
|
||||
Item const* artifact = referencePlayer->GetItemByGuid(artifactAura->GetCastItemGUID());
|
||||
if (!artifact)
|
||||
return false;
|
||||
UF::ArtifactPower const* artifactPower = artifact->GetArtifactPower(secondaryAsset);
|
||||
if (!artifactPower)
|
||||
return false;
|
||||
if (artifactPower->PurchasedRank < reqValue)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
case ModifierTreeType::PlayerHasBoosted: // 226
|
||||
if (referencePlayer->HasLevelBoosted())
|
||||
return false;
|
||||
@@ -3563,9 +3519,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6
|
||||
case ModifierTreeType::PlayerIsInAnyChromieTime: // 301
|
||||
return false;
|
||||
case ModifierTreeType::ItemIsAzeriteArmor: // 302
|
||||
if (!sDB2Manager.GetAzeriteEmpoweredItem(miscValue1))
|
||||
return false;
|
||||
break;
|
||||
return false;
|
||||
case ModifierTreeType::PlayerHasRuneforgePower: // 303
|
||||
return false;
|
||||
case ModifierTreeType::PlayerInChromieTimeForScaling: // 304
|
||||
|
||||
@@ -73,7 +73,7 @@ AuctionsBucketKey AuctionsBucketKey::ForItem(Item const* item)
|
||||
return
|
||||
{
|
||||
item->GetEntry(),
|
||||
uint16(Item::GetItemLevel(itemTemplate, *item->GetBonus(), 0, item->GetRequiredLevel(), 0, 0, 0, false, 0)),
|
||||
uint16(Item::GetItemLevel(itemTemplate, *item->GetBonus(), 0, item->GetRequiredLevel(), 0, 0, 0, false)),
|
||||
uint16(item->GetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID)),
|
||||
uint16(item->GetBonus()->Suffix)
|
||||
};
|
||||
@@ -448,16 +448,15 @@ uint64 AuctionHouseMgr::GetItemAuctionDeposit(Player const* player, Item const*
|
||||
std::string AuctionHouseMgr::BuildItemAuctionMailSubject(AuctionMailType type, AuctionPosting const* auction)
|
||||
{
|
||||
return BuildAuctionMailSubject(auction->Items[0]->GetEntry(), type, auction->Id, auction->GetTotalItemCount(),
|
||||
auction->Items[0]->GetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID), auction->Items[0]->GetContext(), auction->Items[0]->GetBonusListIDs());
|
||||
auction->Items[0]->GetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID), auction->Items[0]->GetContext());
|
||||
}
|
||||
|
||||
std::string AuctionHouseMgr::BuildCommodityAuctionMailSubject(AuctionMailType type, uint32 itemId, uint32 itemCount)
|
||||
{
|
||||
return BuildAuctionMailSubject(itemId, type, 0, itemCount, 0, ItemContext::NONE, {});
|
||||
return BuildAuctionMailSubject(itemId, type, 0, itemCount, 0, ItemContext::NONE);
|
||||
}
|
||||
|
||||
std::string AuctionHouseMgr::BuildAuctionMailSubject(uint32 itemId, AuctionMailType type, uint32 auctionId, uint32 itemCount, uint32 battlePetSpeciesId,
|
||||
ItemContext context, std::vector<int32> const& bonusListIds)
|
||||
std::string AuctionHouseMgr::BuildAuctionMailSubject(uint32 itemId, AuctionMailType type, uint32 auctionId, uint32 itemCount, uint32 battlePetSpeciesId, ItemContext context)
|
||||
{
|
||||
std::ostringstream strm;
|
||||
strm
|
||||
@@ -471,11 +470,7 @@ std::string AuctionHouseMgr::BuildAuctionMailSubject(uint32 itemId, AuctionMailT
|
||||
<< "0:"
|
||||
<< "0:"
|
||||
<< "0:"
|
||||
<< uint32(context) << ':'
|
||||
<< bonusListIds.size();
|
||||
|
||||
for (int32 bonusListId : bonusListIds)
|
||||
strm << ':' << bonusListId;
|
||||
<< uint32(context);
|
||||
|
||||
return strm.str();
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ class TC_GAME_API AuctionHouseMgr
|
||||
static std::string BuildItemAuctionMailSubject(AuctionMailType type, AuctionPosting const* auction);
|
||||
static std::string BuildCommodityAuctionMailSubject(AuctionMailType type, uint32 itemId, uint32 itemCount);
|
||||
static std::string BuildAuctionMailSubject(uint32 itemId, AuctionMailType type, uint32 auctionId, uint32 itemCount, uint32 battlePetSpeciesId,
|
||||
ItemContext context, std::vector<int32> const& bonusListIds);
|
||||
ItemContext context);
|
||||
static std::string BuildAuctionWonMailBody(ObjectGuid guid, uint64 bid, uint64 buyout);
|
||||
static std::string BuildAuctionSoldMailBody(ObjectGuid guid, uint64 bid, uint64 buyout, uint32 deposit, uint64 consignment);
|
||||
static std::string BuildAuctionInvoiceMailBody(ObjectGuid guid, uint64 bid, uint64 buyout, uint32 deposit, uint64 consignment, uint32 moneyDelay, uint32 eta);
|
||||
|
||||
@@ -169,7 +169,7 @@ bool AuctionBotBuyer::RollBuyChance(BuyerItemInfo const* ahInfo, AuctionPosting
|
||||
Item const* item = auction->Items[0];
|
||||
float itemBuyPrice = float(auction->BuyoutOrUnitPrice);
|
||||
float itemPrice;
|
||||
if (uint32 itemSellPrice = item->GetSellPrice(item->GetTemplate(), item->GetQuality(), item->GetItemLevel(item->GetTemplate(), *item->GetBonus(), 0, 0, 0, 0, 0, false, 0)))
|
||||
if (uint32 itemSellPrice = item->GetSellPrice(item->GetTemplate(), item->GetQuality(), item->GetItemLevel(item->GetTemplate(), *item->GetBonus(), 0, 0, 0, 0, 0, false)))
|
||||
itemPrice = float(itemSellPrice);
|
||||
else
|
||||
itemPrice = float(GetVendorPrice(item->GetQuality()));
|
||||
@@ -214,7 +214,7 @@ bool AuctionBotBuyer::RollBidChance(BuyerItemInfo const* ahInfo, AuctionPosting
|
||||
Item const* item = auction->Items[0];
|
||||
float itemBidPrice = float(bidPrice);
|
||||
float itemPrice;
|
||||
if (uint32 itemSellPrice = item->GetSellPrice(item->GetTemplate(), item->GetQuality(), item->GetItemLevel(item->GetTemplate(), *item->GetBonus(), 0, 0, 0, 0, 0, false, 0)))
|
||||
if (uint32 itemSellPrice = item->GetSellPrice(item->GetTemplate(), item->GetQuality(), item->GetItemLevel(item->GetTemplate(), *item->GetBonus(), 0, 0, 0, 0, 0, false)))
|
||||
itemPrice = float(itemSellPrice);
|
||||
else
|
||||
itemPrice = float(GetVendorPrice(item->GetQuality()));
|
||||
|
||||
@@ -867,7 +867,6 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
|
||||
|
||||
// Update the just created item so that if it needs random properties it has them.
|
||||
// Ex: Notched Shortsword of Stamina will only generate as a Notched Shortsword without this.
|
||||
item->SetItemRandomBonusList(GenerateItemRandomBonusListId(itemId));
|
||||
|
||||
uint32 buyoutPrice;
|
||||
uint32 bidPrice = 0;
|
||||
|
||||
@@ -297,10 +297,6 @@ void BlackMarketMgr::SendAuctionWonMail(BlackMarketEntry* entry, CharacterDataba
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
if (templ->Item.ItemBonus)
|
||||
for (int32 bonusList : templ->Item.ItemBonus->BonusListIDs)
|
||||
item->AddBonuses(bonusList);
|
||||
|
||||
item->SetOwnerGUID(bidderGuid);
|
||||
|
||||
item->SaveToDB(trans);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "Hyperlinks.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "Item.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
@@ -106,28 +105,14 @@ bool Trinity::Hyperlinks::LinkTags::api::StoreTo(ApiLinkData& val, std::string_v
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Trinity::Hyperlinks::LinkTags::apower::StoreTo(ArtifactPowerLinkData& val, std::string_view text)
|
||||
bool Trinity::Hyperlinks::LinkTags::apower::StoreTo(ArtifactPowerLinkData& /*val*/, std::string_view /*text*/)
|
||||
{
|
||||
HyperlinkDataTokenizer t(text);
|
||||
uint32 artifactPowerId;
|
||||
if (!(t.TryConsumeTo(artifactPowerId) && t.TryConsumeTo(val.PurchasedRank) && t.TryConsumeTo(val.CurrentRankWithBonus) && t.IsEmpty()))
|
||||
return false;
|
||||
if (!sArtifactPowerStore.LookupEntry(artifactPowerId))
|
||||
return false;
|
||||
val.ArtifactPower = sDB2Manager.GetArtifactPowerRank(artifactPowerId, std::max<uint8>(val.CurrentRankWithBonus, 1));
|
||||
if (val.ArtifactPower)
|
||||
return false;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Trinity::Hyperlinks::LinkTags::azessence::StoreTo(AzeriteEssenceLinkData& val, std::string_view text)
|
||||
bool Trinity::Hyperlinks::LinkTags::azessence::StoreTo(AzeriteEssenceLinkData& /*val*/, std::string_view /*text*/)
|
||||
{
|
||||
HyperlinkDataTokenizer t(text);
|
||||
uint32 azeriteEssenceId;
|
||||
if (!t.TryConsumeTo(azeriteEssenceId))
|
||||
return false;
|
||||
return (val.Essence = sAzeriteEssenceStore.LookupEntry(azeriteEssenceId)) && t.TryConsumeTo(val.Rank)
|
||||
&& sDB2Manager.GetAzeriteEssencePower(azeriteEssenceId, val.Rank) && t.IsEmpty();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Trinity::Hyperlinks::LinkTags::battlepet::StoreTo(BattlePetLinkData& val, std::string_view text)
|
||||
@@ -286,18 +271,12 @@ bool Trinity::Hyperlinks::LinkTags::item::StoreTo(ItemLinkData& val, std::string
|
||||
{
|
||||
if (!t.TryConsumeTo(itemBonusListID))
|
||||
return false;
|
||||
|
||||
evaluatedBonus.AddBonusList(itemBonusListID);
|
||||
}
|
||||
|
||||
if (!val.ItemBonusListIDs.empty() && val.ItemBonusListIDs[0] == 3524) // default uninitialized bonus
|
||||
{
|
||||
val.ItemBonusListIDs = ItemBonusMgr::GetBonusListsForItem(itemId, ItemContext(val.Context));
|
||||
|
||||
// reset bonuses
|
||||
evaluatedBonus.Initialize(val.Item);
|
||||
for (int32 itemBonusListID : val.ItemBonusListIDs)
|
||||
evaluatedBonus.AddBonusList(itemBonusListID);
|
||||
}
|
||||
|
||||
val.Quality = evaluatedBonus.Quality;
|
||||
|
||||
@@ -426,15 +426,6 @@ namespace
|
||||
std::array<std::map<HotfixBlobKey, std::vector<DB2Manager::HotfixOptionalData>>, TOTAL_LOCALES> _hotfixOptionalData;
|
||||
|
||||
AreaGroupMemberContainer _areaGroupMembers;
|
||||
ArtifactPowersContainer _artifactPowers;
|
||||
ArtifactPowerLinksContainer _artifactPowerLinks;
|
||||
ArtifactPowerRanksContainer _artifactPowerRanks;
|
||||
std::unordered_map<uint32 /*itemId*/, AzeriteEmpoweredItemEntry const*> _azeriteEmpoweredItems;
|
||||
std::unordered_map<std::pair<uint32 /*azeriteEssenceId*/, uint32 /*rank*/>, AzeriteEssencePowerEntry const*> _azeriteEssencePowersByIdAndRank;
|
||||
std::vector<AzeriteItemMilestonePowerEntry const*> _azeriteItemMilestonePowers;
|
||||
std::array<AzeriteItemMilestonePowerEntry const*, MAX_AZERITE_ESSENCE_SLOT> _azeriteItemMilestonePowerByEssenceSlot;
|
||||
std::unordered_map<uint32 /*azeritePowerSetId*/, std::vector<AzeritePowerSetMemberEntry const*>> _azeritePowers;
|
||||
std::unordered_map<std::pair<uint32 /*azeriteUnlockSetId*/, ItemContext>, std::array<uint8, MAX_AZERITE_EMPOWERED_TIER>> _azeriteTierUnlockLevels;
|
||||
std::array<ChrClassUIDisplayEntry const*, MAX_CLASSES> _uiDisplayByClass;
|
||||
std::array<std::array<uint32, MAX_POWERS>, MAX_CLASSES> _powersByClass;
|
||||
std::unordered_map<uint32 /*chrCustomizationOptionId*/, std::vector<ChrCustomizationChoiceEntry const*>> _chrCustomizationChoicesByOption;
|
||||
@@ -970,53 +961,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
|
||||
for (AreaGroupMemberEntry const* areaGroupMember : sAreaGroupMemberStore)
|
||||
_areaGroupMembers[areaGroupMember->AreaGroupID].push_back(areaGroupMember->AreaID);
|
||||
|
||||
for (ArtifactPowerEntry const* artifactPower : sArtifactPowerStore)
|
||||
_artifactPowers[artifactPower->ArtifactID].push_back(artifactPower);
|
||||
|
||||
for (ArtifactPowerLinkEntry const* artifactPowerLink : sArtifactPowerLinkStore)
|
||||
{
|
||||
_artifactPowerLinks[artifactPowerLink->PowerA].push_back(artifactPowerLink->PowerB);
|
||||
_artifactPowerLinks[artifactPowerLink->PowerB].push_back(artifactPowerLink->PowerA);
|
||||
}
|
||||
|
||||
for (ArtifactPowerRankEntry const* artifactPowerRank : sArtifactPowerRankStore)
|
||||
_artifactPowerRanks[std::pair<uint32, uint8>{ artifactPowerRank->ArtifactPowerID, artifactPowerRank->RankIndex }] = artifactPowerRank;
|
||||
|
||||
for (AzeriteEmpoweredItemEntry const* azeriteEmpoweredItem : sAzeriteEmpoweredItemStore)
|
||||
_azeriteEmpoweredItems[azeriteEmpoweredItem->ItemID] = azeriteEmpoweredItem;
|
||||
|
||||
for (AzeriteEssencePowerEntry const* azeriteEssencePower : sAzeriteEssencePowerStore)
|
||||
_azeriteEssencePowersByIdAndRank[std::pair<uint32, uint32>{ azeriteEssencePower->AzeriteEssenceID, azeriteEssencePower->Tier }] = azeriteEssencePower;
|
||||
|
||||
for (AzeriteItemMilestonePowerEntry const* azeriteItemMilestonePower : sAzeriteItemMilestonePowerStore)
|
||||
_azeriteItemMilestonePowers.push_back(azeriteItemMilestonePower);
|
||||
|
||||
std::sort(_azeriteItemMilestonePowers.begin(), _azeriteItemMilestonePowers.end(), [](AzeriteItemMilestonePowerEntry const* a1, AzeriteItemMilestonePowerEntry const* a2)
|
||||
{
|
||||
return a1->RequiredLevel < a2->RequiredLevel;
|
||||
});
|
||||
|
||||
{
|
||||
uint32 azeriteEssenceSlot = 0;
|
||||
for (AzeriteItemMilestonePowerEntry const* azeriteItemMilestonePower : _azeriteItemMilestonePowers)
|
||||
{
|
||||
AzeriteItemMilestoneType type = AzeriteItemMilestoneType(azeriteItemMilestonePower->Type);
|
||||
if (type == AzeriteItemMilestoneType::MajorEssence || type == AzeriteItemMilestoneType::MinorEssence)
|
||||
{
|
||||
ASSERT(azeriteEssenceSlot < MAX_AZERITE_ESSENCE_SLOT);
|
||||
_azeriteItemMilestonePowerByEssenceSlot[azeriteEssenceSlot] = azeriteItemMilestonePower;
|
||||
++azeriteEssenceSlot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (AzeritePowerSetMemberEntry const* azeritePowerSetMember : sAzeritePowerSetMemberStore)
|
||||
if (sAzeritePowerStore.LookupEntry(azeritePowerSetMember->AzeritePowerID))
|
||||
_azeritePowers[azeritePowerSetMember->AzeritePowerSetID].push_back(azeritePowerSetMember);
|
||||
|
||||
for (AzeriteTierUnlockEntry const* azeriteTierUnlock : sAzeriteTierUnlockStore)
|
||||
_azeriteTierUnlockLevels[std::pair<uint32, ItemContext>{ azeriteTierUnlock->AzeriteTierUnlockSetID, ItemContext(azeriteTierUnlock->ItemCreationContext) }][azeriteTierUnlock->Tier] = azeriteTierUnlock->AzeriteLevel;
|
||||
|
||||
for (BattlemasterListEntry const* battlemaster : sBattlemasterListStore)
|
||||
{
|
||||
if (battlemaster->MaxLevel < battlemaster->MinLevel)
|
||||
@@ -1847,74 +1791,6 @@ bool DB2Manager::IsInArea(uint32 objectAreaId, uint32 areaId)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<ArtifactPowerEntry const*> DB2Manager::GetArtifactPowers(uint8 artifactId) const
|
||||
{
|
||||
auto itr = _artifactPowers.find(artifactId);
|
||||
if (itr != _artifactPowers.end())
|
||||
return itr->second;
|
||||
|
||||
return std::vector<ArtifactPowerEntry const*>{};
|
||||
}
|
||||
|
||||
std::vector<uint32> const* DB2Manager::GetArtifactPowerLinks(uint32 artifactPowerId) const
|
||||
{
|
||||
return Trinity::Containers::MapGetValuePtr(_artifactPowerLinks, artifactPowerId);
|
||||
}
|
||||
|
||||
ArtifactPowerRankEntry const* DB2Manager::GetArtifactPowerRank(uint32 artifactPowerId, uint8 rank) const
|
||||
{
|
||||
return Trinity::Containers::MapGetValuePtr(_artifactPowerRanks, { artifactPowerId, rank });
|
||||
}
|
||||
|
||||
AzeriteEmpoweredItemEntry const* DB2Manager::GetAzeriteEmpoweredItem(uint32 itemId) const
|
||||
{
|
||||
return Trinity::Containers::MapGetValuePtr(_azeriteEmpoweredItems, itemId);
|
||||
}
|
||||
|
||||
bool DB2Manager::IsAzeriteItem(uint32 itemId) const
|
||||
{
|
||||
return std::find_if(sAzeriteItemStore.begin(), sAzeriteItemStore.end(),
|
||||
[&](AzeriteItemEntry const* azeriteItem) { return azeriteItem->ItemID == int32(itemId); }) != sAzeriteItemStore.end();
|
||||
}
|
||||
|
||||
AzeriteEssencePowerEntry const* DB2Manager::GetAzeriteEssencePower(uint32 azeriteEssenceId, uint32 rank) const
|
||||
{
|
||||
return Trinity::Containers::MapGetValuePtr(_azeriteEssencePowersByIdAndRank, std::make_pair(azeriteEssenceId, rank));
|
||||
}
|
||||
|
||||
std::vector<AzeriteItemMilestonePowerEntry const*> const& DB2Manager::GetAzeriteItemMilestonePowers() const
|
||||
{
|
||||
return _azeriteItemMilestonePowers;
|
||||
}
|
||||
|
||||
AzeriteItemMilestonePowerEntry const* DB2Manager::GetAzeriteItemMilestonePower(uint8 slot) const
|
||||
{
|
||||
ASSERT(slot < MAX_AZERITE_ESSENCE_SLOT, "Slot %u must be lower than MAX_AZERITE_ESSENCE_SLOT (%u)", uint32(slot), MAX_AZERITE_ESSENCE_SLOT);
|
||||
return _azeriteItemMilestonePowerByEssenceSlot[slot];
|
||||
}
|
||||
|
||||
std::vector<AzeritePowerSetMemberEntry const*> const* DB2Manager::GetAzeritePowers(uint32 itemId) const
|
||||
{
|
||||
if (AzeriteEmpoweredItemEntry const* azeriteEmpoweredItem = GetAzeriteEmpoweredItem(itemId))
|
||||
return Trinity::Containers::MapGetValuePtr(_azeritePowers, azeriteEmpoweredItem->AzeritePowerSetID);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32 DB2Manager::GetRequiredAzeriteLevelForAzeritePowerTier(uint32 azeriteUnlockSetId, ItemContext context, uint32 tier) const
|
||||
{
|
||||
ASSERT(tier < MAX_AZERITE_EMPOWERED_TIER);
|
||||
if (std::array<uint8, MAX_AZERITE_EMPOWERED_TIER> const* levels = Trinity::Containers::MapGetValuePtr(_azeriteTierUnlockLevels, std::make_pair(azeriteUnlockSetId, context)))
|
||||
return (*levels)[tier];
|
||||
|
||||
AzeriteTierUnlockSetEntry const* azeriteTierUnlockSet = sAzeriteTierUnlockSetStore.LookupEntry(azeriteUnlockSetId);
|
||||
if (azeriteTierUnlockSet && azeriteTierUnlockSet->Flags & AZERITE_TIER_UNLOCK_SET_FLAG_DEFAULT)
|
||||
if (std::array<uint8, MAX_AZERITE_EMPOWERED_TIER> const* levels = Trinity::Containers::MapGetValuePtr(_azeriteTierUnlockLevels, std::make_pair(azeriteUnlockSetId, ItemContext::NONE)))
|
||||
return (*levels)[tier];
|
||||
|
||||
return sAzeriteLevelInfoStore.GetNumRows();
|
||||
}
|
||||
|
||||
char const* DB2Manager::GetBroadcastTextValue(BroadcastTextEntry const* broadcastText, LocaleConstant locale /*= DEFAULT_LOCALE*/, uint8 gender /*= GENDER_MALE*/, bool forceGender /*= false*/)
|
||||
{
|
||||
if ((gender == GENDER_FEMALE || gender == GENDER_NONE) && (forceGender || broadcastText->Text1[DEFAULT_LOCALE][0] != '\0'))
|
||||
|
||||
@@ -413,16 +413,6 @@ public:
|
||||
uint32 GetEmptyAnimStateID() const;
|
||||
std::vector<uint32> GetAreasForGroup(uint32 areaGroupId) const;
|
||||
static bool IsInArea(uint32 objectAreaId, uint32 areaId);
|
||||
std::vector<ArtifactPowerEntry const*> GetArtifactPowers(uint8 artifactId) const;
|
||||
std::vector<uint32> const* GetArtifactPowerLinks(uint32 artifactPowerId) const;
|
||||
ArtifactPowerRankEntry const* GetArtifactPowerRank(uint32 artifactPowerId, uint8 rank) const;
|
||||
AzeriteEmpoweredItemEntry const* GetAzeriteEmpoweredItem(uint32 itemId) const;
|
||||
bool IsAzeriteItem(uint32 itemId) const;
|
||||
AzeriteEssencePowerEntry const* GetAzeriteEssencePower(uint32 azeriteEssenceId, uint32 rank) const;
|
||||
std::vector<AzeriteItemMilestonePowerEntry const*> const& GetAzeriteItemMilestonePowers() const;
|
||||
AzeriteItemMilestonePowerEntry const* GetAzeriteItemMilestonePower(uint8 slot) const;
|
||||
std::vector<AzeritePowerSetMemberEntry const*> const* GetAzeritePowers(uint32 itemId) const;
|
||||
uint32 GetRequiredAzeriteLevelForAzeritePowerTier(uint32 azeriteUnlockSetId, ItemContext context, uint32 tier) const;
|
||||
static char const* GetBroadcastTextValue(BroadcastTextEntry const* broadcastText, LocaleConstant locale = DEFAULT_LOCALE, uint8 gender = GENDER_MALE, bool forceGender = false);
|
||||
ChrClassUIDisplayEntry const* GetUiDisplayForClass(Classes unitClass) const;
|
||||
static char const* GetClassName(uint8 class_, LocaleConstant locale = DEFAULT_LOCALE);
|
||||
|
||||
@@ -175,43 +175,6 @@ enum class AreaMountFlags : uint8
|
||||
|
||||
DEFINE_ENUM_FLAG(AreaMountFlags);
|
||||
|
||||
enum ArtifactCategory : uint32
|
||||
{
|
||||
ARTIFACT_CATEGORY_PRIMARY = 1,
|
||||
ARTIFACT_CATEGORY_FISHING = 2
|
||||
};
|
||||
|
||||
enum ArtifactPowerFlag : uint8
|
||||
{
|
||||
ARTIFACT_POWER_FLAG_GOLD = 0x01,
|
||||
ARTIFACT_POWER_FLAG_NO_LINK_REQUIRED = 0x02,
|
||||
ARTIFACT_POWER_FLAG_FINAL = 0x04,
|
||||
ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS = 0x08,
|
||||
ARTIFACT_POWER_FLAG_DONT_COUNT_FIRST_BONUS_RANK = 0x10,
|
||||
ARTIFACT_POWER_FLAG_MAX_RANK_WITH_TIER = 0x20,
|
||||
|
||||
ARTIFACT_POWER_FLAG_FIRST = ARTIFACT_POWER_FLAG_NO_LINK_REQUIRED | ARTIFACT_POWER_FLAG_DONT_COUNT_FIRST_BONUS_RANK,
|
||||
};
|
||||
|
||||
#define MAX_ARTIFACT_TIER 1
|
||||
|
||||
#define MAX_AZERITE_EMPOWERED_TIER 5
|
||||
|
||||
#define MAX_AZERITE_ESSENCE_SLOT 4
|
||||
#define MAX_AZERITE_ESSENCE_RANK 4
|
||||
|
||||
enum class AzeriteItemMilestoneType : int32
|
||||
{
|
||||
MajorEssence = 0,
|
||||
MinorEssence = 1,
|
||||
BonusStamina = 2
|
||||
};
|
||||
|
||||
enum AzeriteTierUnlockSetFlags
|
||||
{
|
||||
AZERITE_TIER_UNLOCK_SET_FLAG_DEFAULT = 0x1
|
||||
};
|
||||
|
||||
enum class BattlePetSpeciesFlags : int32
|
||||
{
|
||||
NoRename = 0x00001,
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "Item.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Loot.h"
|
||||
#include "LootMgr.h"
|
||||
@@ -1778,10 +1777,9 @@ Loot* GameObject::GetFishLoot(Player* lootOwner)
|
||||
Loot* fishLoot = new Loot(GetMap(), GetGUID(), LOOT_FISHING, nullptr);
|
||||
|
||||
uint32 areaId = GetAreaId();
|
||||
ItemContext itemContext = ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), lootOwner);
|
||||
while (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId))
|
||||
{
|
||||
fishLoot->FillLoot(areaId, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_DEFAULT, itemContext);
|
||||
fishLoot->FillLoot(areaId, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_DEFAULT);
|
||||
if (!fishLoot->isLooted())
|
||||
break;
|
||||
|
||||
@@ -1789,7 +1787,7 @@ Loot* GameObject::GetFishLoot(Player* lootOwner)
|
||||
}
|
||||
|
||||
if (fishLoot->isLooted())
|
||||
fishLoot->FillLoot(defaultzone, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_DEFAULT, itemContext);
|
||||
fishLoot->FillLoot(defaultzone, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_DEFAULT);
|
||||
|
||||
return fishLoot;
|
||||
}
|
||||
@@ -1801,10 +1799,9 @@ Loot* GameObject::GetFishLootJunk(Player* lootOwner)
|
||||
Loot* fishLoot = new Loot(GetMap(), GetGUID(), LOOT_FISHING_JUNK, nullptr);
|
||||
|
||||
uint32 areaId = GetAreaId();
|
||||
ItemContext itemContext = ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), lootOwner);
|
||||
while (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId))
|
||||
{
|
||||
fishLoot->FillLoot(areaId, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_JUNK_FISH, itemContext);
|
||||
fishLoot->FillLoot(areaId, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_JUNK_FISH);
|
||||
if (!fishLoot->isLooted())
|
||||
break;
|
||||
|
||||
@@ -1812,7 +1809,7 @@ Loot* GameObject::GetFishLootJunk(Player* lootOwner)
|
||||
}
|
||||
|
||||
if (fishLoot->isLooted())
|
||||
fishLoot->FillLoot(defaultzone, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_JUNK_FISH, itemContext);
|
||||
fishLoot->FillLoot(defaultzone, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_JUNK_FISH);
|
||||
|
||||
return fishLoot;
|
||||
}
|
||||
@@ -2570,7 +2567,7 @@ void GameObject::Use(Unit* user)
|
||||
m_loot.reset(loot);
|
||||
|
||||
loot->SetDungeonEncounterId(info->chest.DungeonEncounter);
|
||||
loot->FillLoot(info->GetLootId(), LootTemplates_Gameobject, player, !groupRules, false, GetLootMode(), ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), player));
|
||||
loot->FillLoot(info->GetLootId(), LootTemplates_Gameobject, player, !groupRules, false, GetLootMode());
|
||||
|
||||
if (GetLootMode() > 0)
|
||||
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
|
||||
@@ -2609,7 +2606,7 @@ void GameObject::Use(Unit* user)
|
||||
m_personalLoot[player->GetGUID()].reset(loot);
|
||||
|
||||
loot->SetDungeonEncounterId(info->chest.DungeonEncounter);
|
||||
loot->FillLoot(info->chest.chestPersonalLoot, LootTemplates_Gameobject, player, true, false, GetLootMode(), ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), player));
|
||||
loot->FillLoot(info->chest.chestPersonalLoot, LootTemplates_Gameobject, player, true, false, GetLootMode());
|
||||
|
||||
if (GetLootMode() > 0 && addon)
|
||||
loot->generateMoneyLoot(addon->Mingold, addon->Maxgold);
|
||||
@@ -2622,7 +2619,7 @@ void GameObject::Use(Unit* user)
|
||||
if (info->chest.chestPushLoot)
|
||||
{
|
||||
Loot pushLoot(GetMap(), GetGUID(), LOOT_CHEST, nullptr);
|
||||
pushLoot.FillLoot(info->chest.chestPushLoot, LootTemplates_Gameobject, player, true, false, GetLootMode(), ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), player));
|
||||
pushLoot.FillLoot(info->chest.chestPushLoot, LootTemplates_Gameobject, player, true, false, GetLootMode());
|
||||
pushLoot.AutoStore(player, NULL_BAG, NULL_SLOT);
|
||||
}
|
||||
|
||||
@@ -3124,7 +3121,7 @@ void GameObject::Use(Unit* user)
|
||||
Player* player = user->ToPlayer();
|
||||
|
||||
Loot* loot = new Loot(GetMap(), GetGUID(), LOOT_FISHINGHOLE, nullptr);
|
||||
loot->FillLoot(GetGOInfo()->GetLootId(), LootTemplates_Gameobject, player, true, false, LOOT_MODE_DEFAULT, ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), player));
|
||||
loot->FillLoot(GetGOInfo()->GetLootId(), LootTemplates_Gameobject, player, true, false, LOOT_MODE_DEFAULT);
|
||||
m_personalLoot[player->GetGUID()].reset(loot);
|
||||
|
||||
player->SendLoot(*loot);
|
||||
@@ -3333,7 +3330,7 @@ void GameObject::Use(Unit* user)
|
||||
Loot* loot = new Loot(GetMap(), GetGUID(), LOOT_CHEST, nullptr);
|
||||
m_personalLoot[player->GetGUID()].reset(loot);
|
||||
|
||||
loot->FillLoot(info->gatheringNode.chestLoot, LootTemplates_Gameobject, player, true, false, GetLootMode(), ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), player));
|
||||
loot->FillLoot(info->gatheringNode.chestLoot, LootTemplates_Gameobject, player, true, false, GetLootMode());
|
||||
}
|
||||
|
||||
if (info->gatheringNode.triggeredEvent)
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTables.h"
|
||||
#include "GameTime.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "ItemPackets.h"
|
||||
#include "Log.h"
|
||||
@@ -290,140 +289,6 @@ ItemModifier const SecondaryAppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS] =
|
||||
ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_2,
|
||||
};
|
||||
|
||||
void ItemAdditionalLoadInfo::Init(std::unordered_map<ObjectGuid::LowType, ItemAdditionalLoadInfo>* loadInfo,
|
||||
PreparedQueryResult artifactResult, PreparedQueryResult azeriteItemResult,
|
||||
PreparedQueryResult azeriteItemMilestonePowersResult, PreparedQueryResult azeriteItemUnlockedEssencesResult,
|
||||
PreparedQueryResult azeriteEmpoweredItemResult)
|
||||
{
|
||||
// 0 1 2 3 4 5
|
||||
// SELECT a.itemGuid, a.xp, a.artifactAppearanceId, a.artifactTierId, ap.artifactPowerId, ap.purchasedRank FROM item_instance_artifact_powers ap LEFT JOIN item_instance_artifact a ON ap.itemGuid = a.itemGuid ...
|
||||
if (artifactResult)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = artifactResult->Fetch();
|
||||
ItemAdditionalLoadInfo& info = (*loadInfo)[fields[0].GetUInt64()];
|
||||
if (!info.Artifact)
|
||||
info.Artifact.emplace();
|
||||
info.Artifact->Xp = fields[1].GetUInt64();
|
||||
info.Artifact->ArtifactAppearanceId = fields[2].GetUInt32();
|
||||
info.Artifact->ArtifactTierId = fields[3].GetUInt32();
|
||||
ArtifactPowerData artifactPowerData;
|
||||
artifactPowerData.ArtifactPowerId = fields[4].GetUInt32();
|
||||
artifactPowerData.PurchasedRank = fields[5].GetUInt8();
|
||||
if (ArtifactPowerEntry const* artifactPower = sArtifactPowerStore.LookupEntry(artifactPowerData.ArtifactPowerId))
|
||||
{
|
||||
uint32 maxRank = artifactPower->MaxPurchasableRank;
|
||||
// allow ARTIFACT_POWER_FLAG_FINAL to overflow maxrank here - needs to be handled in Item::CheckArtifactUnlock (will refund artifact power)
|
||||
if (artifactPower->Flags & ARTIFACT_POWER_FLAG_MAX_RANK_WITH_TIER && artifactPower->Tier < info.Artifact->ArtifactTierId)
|
||||
maxRank += info.Artifact->ArtifactTierId - artifactPower->Tier;
|
||||
|
||||
if (artifactPowerData.PurchasedRank > maxRank)
|
||||
artifactPowerData.PurchasedRank = maxRank;
|
||||
|
||||
artifactPowerData.CurrentRankWithBonus = (artifactPower->Flags & ARTIFACT_POWER_FLAG_FIRST) == ARTIFACT_POWER_FLAG_FIRST ? 1 : 0;
|
||||
|
||||
info.Artifact->ArtifactPowers.push_back(artifactPowerData);
|
||||
}
|
||||
|
||||
} while (artifactResult->NextRow());
|
||||
}
|
||||
|
||||
// 0 1 2 3
|
||||
// SELECT iz.itemGuid, iz.xp, iz.level, iz.knowledgeLevel,
|
||||
// 4 5 6 7 8
|
||||
// iz.selectedAzeriteEssences1specId, iz.selectedAzeriteEssences1azeriteEssenceId1, iz.selectedAzeriteEssences1azeriteEssenceId2, iz.selectedAzeriteEssences1azeriteEssenceId3, iz.selectedAzeriteEssences1azeriteEssenceId4,
|
||||
// 9 10 11 12 13
|
||||
// iz.selectedAzeriteEssences2specId, iz.selectedAzeriteEssences2azeriteEssenceId1, iz.selectedAzeriteEssences2azeriteEssenceId2, iz.selectedAzeriteEssences2azeriteEssenceId3, iz.selectedAzeriteEssences2azeriteEssenceId4,
|
||||
// 14 15 16 17 18
|
||||
// iz.selectedAzeriteEssences3specId, iz.selectedAzeriteEssences3azeriteEssenceId1, iz.selectedAzeriteEssences3azeriteEssenceId2, iz.selectedAzeriteEssences3azeriteEssenceId3, iz.selectedAzeriteEssences3azeriteEssenceId4,
|
||||
// 19 20 21 22 23
|
||||
// iz.selectedAzeriteEssences4specId, iz.selectedAzeriteEssences4azeriteEssenceId1, iz.selectedAzeriteEssences4azeriteEssenceId2, iz.selectedAzeriteEssences4azeriteEssenceId3, iz.selectedAzeriteEssences4azeriteEssenceId4
|
||||
// FROM item_instance_azerite iz INNER JOIN ...
|
||||
if (azeriteItemResult)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = azeriteItemResult->Fetch();
|
||||
ItemAdditionalLoadInfo& info = (*loadInfo)[fields[0].GetUInt64()];
|
||||
if (!info.AzeriteItem)
|
||||
info.AzeriteItem.emplace();
|
||||
info.AzeriteItem->Xp = fields[1].GetUInt64();
|
||||
info.AzeriteItem->Level = fields[2].GetUInt32();
|
||||
info.AzeriteItem->KnowledgeLevel = fields[3].GetUInt32();
|
||||
for (std::size_t i = 0; i < info.AzeriteItem->SelectedAzeriteEssences.size(); ++i)
|
||||
{
|
||||
uint32 specializationId = fields[4 + i * 4].GetUInt32();
|
||||
if (!sChrSpecializationStore.LookupEntry(specializationId))
|
||||
continue;
|
||||
|
||||
info.AzeriteItem->SelectedAzeriteEssences[i].SpecializationId = specializationId;
|
||||
for (std::size_t j = 0; j < MAX_AZERITE_ESSENCE_SLOT; ++j)
|
||||
{
|
||||
AzeriteEssenceEntry const* azeriteEssence = sAzeriteEssenceStore.LookupEntry(fields[5 + i * 5 + j].GetUInt32());
|
||||
if (!azeriteEssence || !sDB2Manager.IsSpecSetMember(azeriteEssence->SpecSetID, specializationId))
|
||||
continue;
|
||||
|
||||
info.AzeriteItem->SelectedAzeriteEssences[i].AzeriteEssenceId[j] = azeriteEssence->ID;
|
||||
}
|
||||
}
|
||||
|
||||
} while (azeriteItemResult->NextRow());
|
||||
}
|
||||
|
||||
// 0 1
|
||||
// SELECT iamp.itemGuid, iamp.azeriteItemMilestonePowerId FROM item_instance_azerite_milestone_power iamp INNER JOIN ...
|
||||
if (azeriteItemMilestonePowersResult)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = azeriteItemMilestonePowersResult->Fetch();
|
||||
ItemAdditionalLoadInfo& info = (*loadInfo)[fields[0].GetUInt64()];
|
||||
if (!info.AzeriteItem)
|
||||
info.AzeriteItem.emplace();
|
||||
info.AzeriteItem->AzeriteItemMilestonePowers.push_back(fields[1].GetUInt32());
|
||||
}
|
||||
while (azeriteItemMilestonePowersResult->NextRow());
|
||||
}
|
||||
|
||||
// 0 1 2
|
||||
// SELECT iaue.itemGuid, iaue.azeriteEssenceId, iaue.`rank` FROM item_instance_azerite_unlocked_essence iaue INNER JOIN ...
|
||||
if (azeriteItemUnlockedEssencesResult)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = azeriteItemUnlockedEssencesResult->Fetch();
|
||||
if (AzeriteEssencePowerEntry const* azeriteEssencePower = sDB2Manager.GetAzeriteEssencePower(fields[1].GetUInt32(), fields[2].GetUInt32()))
|
||||
{
|
||||
ItemAdditionalLoadInfo& info = (*loadInfo)[fields[0].GetUInt64()];
|
||||
if (!info.AzeriteItem)
|
||||
info.AzeriteItem.emplace();
|
||||
|
||||
info.AzeriteItem->UnlockedAzeriteEssences.push_back(azeriteEssencePower);
|
||||
}
|
||||
}
|
||||
while (azeriteItemUnlockedEssencesResult->NextRow());
|
||||
}
|
||||
|
||||
// 0 1 2 3 4 5
|
||||
// SELECT iae.itemGuid, iae.azeritePowerId1, iae.azeritePowerId2, iae.azeritePowerId3, iae.azeritePowerId4, iae.azeritePowerId5 FROM item_instance_azerite_empowered iae INNER JOIN ...
|
||||
if (azeriteEmpoweredItemResult)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = azeriteEmpoweredItemResult->Fetch();
|
||||
ItemAdditionalLoadInfo& info = (*loadInfo)[fields[0].GetUInt64()];
|
||||
if (!info.AzeriteEmpoweredItem)
|
||||
info.AzeriteEmpoweredItem.emplace();
|
||||
|
||||
for (uint32 i = 0; i < MAX_AZERITE_EMPOWERED_TIER; ++i)
|
||||
if (sAzeritePowerStore.LookupEntry(fields[1 + i].GetInt32()))
|
||||
info.AzeriteEmpoweredItem->SelectedAzeritePowers[i] = fields[1 + i].GetInt32();
|
||||
|
||||
} while (azeriteEmpoweredItemResult->NextRow());
|
||||
}
|
||||
}
|
||||
|
||||
Item::Item()
|
||||
{
|
||||
m_objectType |= TYPEMASK_ITEM;
|
||||
@@ -440,7 +305,6 @@ Item::Item()
|
||||
m_paidMoney = 0;
|
||||
m_paidExtendedCost = 0;
|
||||
|
||||
m_randomBonusListId = 0;
|
||||
m_gemScalingLevels = { };
|
||||
|
||||
memset(&_bonusData, 0, sizeof(_bonusData));
|
||||
@@ -478,29 +342,6 @@ bool Item::Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext contex
|
||||
SetCreatePlayedTime(0);
|
||||
SetContext(context);
|
||||
|
||||
if (itemProto->GetArtifactID())
|
||||
{
|
||||
InitArtifactPowers(itemProto->GetArtifactID(), 0);
|
||||
for (ArtifactAppearanceEntry const* artifactAppearance : sArtifactAppearanceStore)
|
||||
{
|
||||
if (ArtifactAppearanceSetEntry const* artifactAppearanceSet = sArtifactAppearanceSetStore.LookupEntry(artifactAppearance->ArtifactAppearanceSetID))
|
||||
{
|
||||
if (itemProto->GetArtifactID() != artifactAppearanceSet->ArtifactID)
|
||||
continue;
|
||||
|
||||
if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactAppearance->UnlockPlayerConditionID))
|
||||
if (!owner || !sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition))
|
||||
continue;
|
||||
|
||||
SetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID, artifactAppearance->ID);
|
||||
SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CheckArtifactRelicSlotUnlock(owner ? owner : GetOwner());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -585,7 +426,6 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans)
|
||||
}
|
||||
stmt->setString(++index, ssEnchants.str());
|
||||
|
||||
stmt->setUInt32(++index, m_randomBonusListId);
|
||||
stmt->setUInt16(++index, m_itemData->Durability);
|
||||
stmt->setUInt32(++index, m_itemData->CreatePlayedTime);
|
||||
stmt->setString(++index, m_text);
|
||||
@@ -595,11 +435,6 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans)
|
||||
stmt->setUInt32(++index, GetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID));
|
||||
stmt->setUInt8(++index, uint8(m_itemData->Context));
|
||||
|
||||
std::ostringstream bonusListIDs;
|
||||
for (int32 bonusListID : GetBonusListIDs())
|
||||
bonusListIDs << bonusListID << ' ';
|
||||
stmt->setString(++index, bonusListIDs.str());
|
||||
|
||||
stmt->setUInt64(++index, GetGUID().GetCounter());
|
||||
|
||||
trans->Append(stmt);
|
||||
@@ -707,33 +542,6 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans)
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
if (GetTemplate()->GetArtifactID())
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_ARTIFACT);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
stmt->setUInt64(1, m_itemData->ArtifactXP);
|
||||
stmt->setUInt32(2, GetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID));
|
||||
stmt->setUInt32(3, GetModifier(ITEM_MODIFIER_ARTIFACT_TIER));
|
||||
trans->Append(stmt);
|
||||
|
||||
for (UF::ArtifactPower const& artifactPower : m_itemData->ArtifactPowers)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_ARTIFACT_POWERS);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, artifactPower.ArtifactPowerID);
|
||||
stmt->setUInt8(2, artifactPower.PurchasedRank);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
static ItemModifier const modifiersTable[] =
|
||||
{
|
||||
ITEM_MODIFIER_TIMEWALKER_LEVEL,
|
||||
@@ -769,14 +577,6 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans)
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
@@ -872,7 +672,7 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fie
|
||||
|
||||
ReplaceAllItemFlags(ItemFieldFlags(itemFlags));
|
||||
|
||||
uint32 durability = fields[10].GetUInt16();
|
||||
uint32 durability = fields[9].GetUInt16();
|
||||
SetDurability(durability);
|
||||
// update max durability (and durability) if need
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::MaxDurability), proto->MaxDurability);
|
||||
@@ -884,69 +684,61 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fie
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
SetCreatePlayedTime(fields[11].GetUInt32());
|
||||
SetText(fields[12].GetString());
|
||||
SetCreatePlayedTime(fields[10].GetUInt32());
|
||||
SetText(fields[11].GetString());
|
||||
|
||||
SetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID, fields[13].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_BATTLE_PET_BREED_DATA, fields[14].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_BATTLE_PET_LEVEL, fields[15].GetUInt16());
|
||||
SetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID, fields[16].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID, fields[12].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_BATTLE_PET_BREED_DATA, fields[13].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_BATTLE_PET_LEVEL, fields[14].GetUInt16());
|
||||
SetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID, fields[15].GetUInt32());
|
||||
|
||||
SetContext(ItemContext(fields[17].GetUInt8()));
|
||||
|
||||
std::vector<std::string_view> bonusListString = Trinity::Tokenize(fields[18].GetStringView(), ' ', false);
|
||||
std::vector<int32> bonusListIDs;
|
||||
bonusListIDs.reserve(bonusListString.size());
|
||||
for (std::string_view token : bonusListString)
|
||||
if (Optional<int32> bonusListID = Trinity::StringTo<int32>(token))
|
||||
bonusListIDs.push_back(*bonusListID);
|
||||
SetBonuses(std::move(bonusListIDs));
|
||||
SetContext(ItemContext(fields[16].GetUInt8()));
|
||||
|
||||
// load charges after bonuses, they can add more item effects
|
||||
std::vector<std::string_view> tokens = Trinity::Tokenize(fields[6].GetStringView(), ' ', false);
|
||||
for (uint8 i = 0; i < m_itemData->SpellCharges.size() && i < _bonusData.EffectCount && i < tokens.size(); ++i)
|
||||
SetSpellCharges(i, Trinity::StringTo<int32>(tokens[i]).value_or(0));
|
||||
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS, fields[19].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_1, fields[20].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_2, fields[21].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_3, fields[22].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_4, fields[23].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_5, fields[24].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS, fields[17].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_1, fields[18].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_2, fields[19].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_3, fields[20].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_4, fields[21].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_5, fields[22].GetUInt32());
|
||||
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS, fields[25].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1, fields[26].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2, fields[27].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3, fields[28].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4, fields[29].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_5, fields[30].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS, fields[23].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1, fields[24].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2, fields[25].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3, fields[26].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4, fields[27].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_5, fields[28].GetUInt32());
|
||||
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_ALL_SPECS, fields[31].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_1, fields[32].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_2, fields[33].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_3, fields[34].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_4, fields[35].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_5, fields[36].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_ALL_SPECS, fields[29].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_1, fields[30].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_2, fields[31].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_3, fields[32].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_4, fields[33].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_5, fields[34].GetUInt32());
|
||||
|
||||
uint32 const gemFields = 4;
|
||||
ItemDynamicFieldGems gemData[MAX_GEM_SOCKETS];
|
||||
memset(gemData, 0, sizeof(gemData));
|
||||
for (uint32 i = 0; i < MAX_GEM_SOCKETS; ++i)
|
||||
{
|
||||
gemData[i].ItemId = fields[37 + i * gemFields].GetUInt32();
|
||||
std::vector<std::string_view> gemBonusListIDs = Trinity::Tokenize(fields[38 + i * gemFields].GetStringView(), ' ', false);
|
||||
gemData[i].ItemId = fields[35 + i * gemFields].GetUInt32();
|
||||
std::vector<std::string_view> gemBonusListIDs = Trinity::Tokenize(fields[36 + i * gemFields].GetStringView(), ' ', false);
|
||||
uint32 b = 0;
|
||||
for (std::string_view token : gemBonusListIDs)
|
||||
if (Optional<uint16> bonusListID = Trinity::StringTo<uint16>(token))
|
||||
gemData[i].BonusListIDs[b++] = *bonusListID;
|
||||
|
||||
gemData[i].Context = fields[39 + i * gemFields].GetUInt8();
|
||||
gemData[i].Context = fields[37 + i * gemFields].GetUInt8();
|
||||
if (gemData[i].ItemId)
|
||||
SetGem(i, &gemData[i], fields[40 + i * gemFields].GetUInt32());
|
||||
SetGem(i, &gemData[i], fields[38 + i * gemFields].GetUInt32());
|
||||
}
|
||||
|
||||
SetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL, fields[49].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL, fields[50].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL, fields[47].GetUInt32());
|
||||
SetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL, fields[48].GetUInt32());
|
||||
|
||||
// Enchants must be loaded after all other bonus/scaling data
|
||||
std::vector<std::string_view> enchantmentTokens = Trinity::Tokenize(fields[8].GetStringView(), ' ', false);
|
||||
@@ -960,7 +752,6 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fie
|
||||
SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Charges), Trinity::StringTo<int16>(enchantmentTokens[i * MAX_ENCHANTMENT_OFFSET + 2]).value_or(0));
|
||||
}
|
||||
}
|
||||
m_randomBonusListId = fields[9].GetUInt32();
|
||||
|
||||
// Remove bind flag for items vs BIND_NONE set
|
||||
if (IsSoulBound() && GetBonding() == BIND_NONE)
|
||||
@@ -983,90 +774,6 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fie
|
||||
return true;
|
||||
}
|
||||
|
||||
void Item::LoadArtifactData(Player const* owner, uint64 xp, uint32 artifactAppearanceId, uint32 artifactTier, std::vector<ArtifactPowerData>& powers)
|
||||
{
|
||||
for (uint8 i = 0; i <= artifactTier; ++i)
|
||||
InitArtifactPowers(GetTemplate()->GetArtifactID(), i);
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ArtifactXP), xp);
|
||||
SetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID, artifactAppearanceId);
|
||||
SetModifier(ITEM_MODIFIER_ARTIFACT_TIER, artifactTier);
|
||||
|
||||
if (ArtifactAppearanceEntry const* artifactAppearance = sArtifactAppearanceStore.LookupEntry(artifactAppearanceId))
|
||||
SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
|
||||
|
||||
uint8 totalPurchasedRanks = 0;
|
||||
for (ArtifactPowerData& power : powers)
|
||||
{
|
||||
power.CurrentRankWithBonus += power.PurchasedRank;
|
||||
totalPurchasedRanks += power.PurchasedRank;
|
||||
|
||||
ArtifactPowerEntry const* artifactPower = sArtifactPowerStore.AssertEntry(power.ArtifactPowerId);
|
||||
for (uint32 e = SOCK_ENCHANTMENT_SLOT; e <= SOCK_ENCHANTMENT_SLOT_3; ++e)
|
||||
{
|
||||
if (SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(GetEnchantmentId(EnchantmentSlot(e))))
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
|
||||
{
|
||||
switch (enchant->Effect[i])
|
||||
{
|
||||
case ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_BY_TYPE:
|
||||
if (uint32(artifactPower->Label) == enchant->EffectArg[i])
|
||||
power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
|
||||
break;
|
||||
case ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_BY_ID:
|
||||
if (artifactPower->ID == enchant->EffectArg[i])
|
||||
power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
|
||||
break;
|
||||
case ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_PICKER:
|
||||
if (_bonusData.GemRelicType[e - SOCK_ENCHANTMENT_SLOT] != -1)
|
||||
{
|
||||
if (ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i]))
|
||||
{
|
||||
PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactPowerPicker->PlayerConditionID);
|
||||
if (!playerCondition || (owner && sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition)))
|
||||
if (artifactPower->Label == _bonusData.GemRelicType[e - SOCK_ENCHANTMENT_SLOT])
|
||||
power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetArtifactPower(power.ArtifactPowerId, power.PurchasedRank, power.CurrentRankWithBonus);
|
||||
}
|
||||
|
||||
for (ArtifactPowerData& power : powers)
|
||||
{
|
||||
ArtifactPowerEntry const* scaledArtifactPowerEntry = sArtifactPowerStore.AssertEntry(power.ArtifactPowerId);
|
||||
if (!(scaledArtifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS))
|
||||
continue;
|
||||
|
||||
SetArtifactPower(power.ArtifactPowerId, power.PurchasedRank, totalPurchasedRanks + 1);
|
||||
}
|
||||
|
||||
CheckArtifactRelicSlotUnlock(owner);
|
||||
}
|
||||
|
||||
void Item::CheckArtifactRelicSlotUnlock(Player const* owner)
|
||||
{
|
||||
if (!owner)
|
||||
return;
|
||||
|
||||
uint8 artifactId = GetTemplate()->GetArtifactID();
|
||||
if (!artifactId)
|
||||
return;
|
||||
|
||||
for (ArtifactUnlockEntry const* artifactUnlock : sArtifactUnlockStore)
|
||||
if (artifactUnlock->ArtifactID == artifactId)
|
||||
if (owner->MeetPlayerCondition(artifactUnlock->PlayerConditionID))
|
||||
AddBonuses(artifactUnlock->ItemBonusListID);
|
||||
}
|
||||
|
||||
/*static*/
|
||||
void Item::DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
|
||||
{
|
||||
@@ -1082,14 +789,6 @@ void Item::DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType
|
||||
stmt->setUInt64(0, itemGuid);
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT);
|
||||
stmt->setUInt64(0, itemGuid);
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS);
|
||||
stmt->setUInt64(0, itemGuid);
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS);
|
||||
stmt->setUInt64(0, itemGuid);
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
@@ -1138,14 +837,6 @@ uint32 Item::GetSkill()
|
||||
return proto->GetSkill();
|
||||
}
|
||||
|
||||
void Item::SetItemRandomBonusList(ItemRandomBonusListId bonusListId)
|
||||
{
|
||||
if (!bonusListId)
|
||||
return;
|
||||
|
||||
AddBonuses(bonusListId);
|
||||
}
|
||||
|
||||
void Item::SetState(ItemUpdateState state, Player* forplayer)
|
||||
{
|
||||
if (uState == ITEM_NEW && state == ITEM_REMOVED)
|
||||
@@ -1419,9 +1110,6 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint
|
||||
owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetGUID(), GetEntry(), id, slot);
|
||||
}
|
||||
|
||||
ApplyArtifactPowerEnchantmentBonuses(slot, GetEnchantmentId(slot), false, owner);
|
||||
ApplyArtifactPowerEnchantmentBonuses(slot, id, true, owner);
|
||||
|
||||
auto enchantmentField = m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Enchantment, slot);
|
||||
SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::ID), id);
|
||||
SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Duration), duration);
|
||||
@@ -1479,8 +1167,6 @@ void Item::SetGem(uint16 slot, ItemDynamicFieldGems const* gem, uint32 gemScalin
|
||||
{
|
||||
BonusData gemBonus;
|
||||
gemBonus.Initialize(gemTemplate);
|
||||
for (uint16 bonusListId : gem->BonusListIDs)
|
||||
gemBonus.AddBonusList(bonusListId);
|
||||
|
||||
uint32 gemBaseItemLevel = gemTemplate->GetBaseItemLevel();
|
||||
if (gemBonus.PlayerLevelToItemLevelCurveId)
|
||||
@@ -1488,30 +1174,6 @@ void Item::SetGem(uint16 slot, ItemDynamicFieldGems const* gem, uint32 gemScalin
|
||||
gemBaseItemLevel = scaledIlvl;
|
||||
|
||||
_bonusData.GemRelicType[slot] = gemBonus.RelicType;
|
||||
|
||||
for (uint32 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
|
||||
{
|
||||
switch (gemEnchant->Effect[i])
|
||||
{
|
||||
case ITEM_ENCHANTMENT_TYPE_BONUS_LIST_ID:
|
||||
{
|
||||
for (ItemBonusEntry const* itemBonus : ItemBonusMgr::GetItemBonuses(gemEnchant->EffectArg[i]))
|
||||
if (itemBonus->Type == ITEM_BONUS_ITEM_LEVEL)
|
||||
_bonusData.GemItemLevelBonus[slot] += itemBonus->Value[0];
|
||||
break;
|
||||
}
|
||||
case ITEM_ENCHANTMENT_TYPE_BONUS_LIST_CURVE:
|
||||
{
|
||||
if (uint32 bonusListId = ItemBonusMgr::GetItemBonusListForItemLevelDelta(int16(sDB2Manager.GetCurveValueAt(CURVE_ID_ARTIFACT_RELIC_ITEM_LEVEL_BONUS, gemBaseItemLevel + gemBonus.ItemLevelBonus))))
|
||||
for (ItemBonusEntry const* itemBonus : ItemBonusMgr::GetItemBonuses(bonusListId))
|
||||
if (itemBonus->Type == ITEM_BONUS_ITEM_LEVEL)
|
||||
_bonusData.GemItemLevelBonus[slot] += itemBonus->Value[0];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1597,7 +1259,7 @@ void Item::SendTimeUpdate(Player* owner)
|
||||
owner->GetSession()->SendPacket(itemTimeUpdate.Write());
|
||||
}
|
||||
|
||||
Item* Item::CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Player const* player /*= nullptr*/, bool addDefaultBonuses /*= true*/)
|
||||
Item* Item::CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Player const* player /*= nullptr*/)
|
||||
{
|
||||
if (count < 1)
|
||||
return nullptr; //don't create item at zero count
|
||||
@@ -1614,9 +1276,6 @@ Item* Item::CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Play
|
||||
if (item->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), itemEntry, context, player))
|
||||
{
|
||||
item->SetCount(count);
|
||||
if (addDefaultBonuses)
|
||||
item->SetBonuses(ItemBonusMgr::GetBonusListsForItem(itemEntry, context));
|
||||
|
||||
return item;
|
||||
}
|
||||
else
|
||||
@@ -1629,7 +1288,7 @@ Item* Item::CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Play
|
||||
|
||||
Item* Item::CloneItem(uint32 count, Player const* player /*= nullptr*/) const
|
||||
{
|
||||
Item* newItem = CreateItem(GetEntry(), count, GetContext(), player, false);
|
||||
Item* newItem = CreateItem(GetEntry(), count, GetContext(), player);
|
||||
if (!newItem)
|
||||
return nullptr;
|
||||
|
||||
@@ -1637,10 +1296,6 @@ Item* Item::CloneItem(uint32 count, Player const* player /*= nullptr*/) const
|
||||
newItem->SetGiftCreator(GetGiftCreator());
|
||||
newItem->ReplaceAllItemFlags(ItemFieldFlags(*m_itemData->DynamicFlags) & ~(ITEM_FIELD_FLAG_REFUNDABLE | ITEM_FIELD_FLAG_BOP_TRADEABLE));
|
||||
newItem->SetExpiration(m_itemData->Expiration);
|
||||
newItem->SetBonuses(m_itemData->ItemBonusKey->BonusListIDs);
|
||||
// player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
|
||||
if (player)
|
||||
newItem->SetItemRandomBonusList(m_randomBonusListId);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
@@ -2258,21 +1913,18 @@ uint32 Item::GetItemLevel(Player const* owner) const
|
||||
uint32 minItemLevelCutoff = owner->m_unitData->MinItemLevelCutoff;
|
||||
uint32 maxItemLevel = itemTemplate->HasFlag(ITEM_FLAG3_IGNORE_ITEM_LEVEL_CAP_IN_PVP) ? 0 : owner->m_unitData->MaxItemLevel;
|
||||
bool pvpBonus = owner->IsUsingPvpItemLevels();
|
||||
uint32 azeriteLevel = 0;
|
||||
|
||||
return Item::GetItemLevel(itemTemplate, _bonusData, owner->GetLevel(), GetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL),
|
||||
minItemLevel, minItemLevelCutoff, maxItemLevel, pvpBonus, azeriteLevel);
|
||||
minItemLevel, minItemLevelCutoff, maxItemLevel, pvpBonus);
|
||||
}
|
||||
|
||||
uint32 Item::GetItemLevel(ItemTemplate const* itemTemplate, BonusData const& bonusData, uint32 level, uint32 fixedLevel,
|
||||
uint32 minItemLevel, uint32 minItemLevelCutoff, uint32 maxItemLevel, bool pvpBonus, uint32 azeriteLevel)
|
||||
uint32 minItemLevel, uint32 minItemLevelCutoff, uint32 maxItemLevel, bool pvpBonus)
|
||||
{
|
||||
if (!itemTemplate)
|
||||
return MIN_ITEM_LEVEL;
|
||||
|
||||
uint32 itemLevel = itemTemplate->GetBaseItemLevel();
|
||||
if (AzeriteLevelInfoEntry const* azeriteLevelInfo = sAzeriteLevelInfoStore.LookupEntry(azeriteLevel))
|
||||
itemLevel = azeriteLevelInfo->ItemLevel;
|
||||
|
||||
if (bonusData.PlayerLevelToItemLevelCurveId)
|
||||
{
|
||||
@@ -2505,253 +2157,6 @@ uint16 Item::GetVisibleItemVisual(Player const* owner) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Item::AddBonuses(uint32 bonusListID)
|
||||
{
|
||||
if (std::find(GetBonusListIDs().begin(), GetBonusListIDs().end(), int32(bonusListID)) != GetBonusListIDs().end())
|
||||
return;
|
||||
|
||||
WorldPackets::Item::ItemBonusKey itemBonusKey;
|
||||
itemBonusKey.ItemID = GetEntry();
|
||||
itemBonusKey.BonusListIDs = GetBonusListIDs();
|
||||
itemBonusKey.BonusListIDs.push_back(bonusListID);
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ItemBonusKey), std::move(itemBonusKey));
|
||||
for (ItemBonusEntry const* bonus : ItemBonusMgr::GetItemBonuses(bonusListID))
|
||||
_bonusData.AddBonus(bonus->Type, bonus->Value);
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ItemAppearanceModID), _bonusData.AppearanceModID);
|
||||
}
|
||||
|
||||
void Item::SetBonuses(std::vector<int32> bonusListIDs)
|
||||
{
|
||||
WorldPackets::Item::ItemBonusKey itemBonusKey;
|
||||
itemBonusKey.ItemID = GetEntry();
|
||||
itemBonusKey.BonusListIDs = std::move(bonusListIDs);
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ItemBonusKey), std::move(itemBonusKey));
|
||||
|
||||
for (int32 bonusListID : GetBonusListIDs())
|
||||
_bonusData.AddBonusList(bonusListID);
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ItemAppearanceModID), _bonusData.AppearanceModID);
|
||||
}
|
||||
|
||||
void Item::ClearBonuses()
|
||||
{
|
||||
WorldPackets::Item::ItemBonusKey itemBonusKey;
|
||||
itemBonusKey.ItemID = GetEntry();
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ItemBonusKey), std::move(itemBonusKey));
|
||||
_bonusData.Initialize(GetTemplate());
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ItemAppearanceModID), _bonusData.AppearanceModID);
|
||||
}
|
||||
|
||||
bool Item::IsArtifactDisabled() const
|
||||
{
|
||||
if (ArtifactEntry const* artifact = sArtifactStore.LookupEntry(GetTemplate()->GetArtifactID()))
|
||||
return artifact->ArtifactCategoryID != 2; // fishing artifact
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
UF::ArtifactPower const* Item::GetArtifactPower(uint32 artifactPowerId) const
|
||||
{
|
||||
auto indexItr = m_artifactPowerIdToIndex.find(artifactPowerId);
|
||||
if (indexItr != m_artifactPowerIdToIndex.end())
|
||||
return &m_itemData->ArtifactPowers[indexItr->second];
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Item::AddArtifactPower(ArtifactPowerData const* artifactPower)
|
||||
{
|
||||
uint16 index = uint16(m_artifactPowerIdToIndex.size());
|
||||
m_artifactPowerIdToIndex[artifactPower->ArtifactPowerId] = index;
|
||||
|
||||
UF::ArtifactPower& powerField = AddDynamicUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ArtifactPowers));
|
||||
powerField.ArtifactPowerID = artifactPower->ArtifactPowerId;
|
||||
powerField.PurchasedRank = artifactPower->PurchasedRank;
|
||||
powerField.CurrentRankWithBonus = artifactPower->CurrentRankWithBonus;
|
||||
}
|
||||
|
||||
void Item::SetArtifactPower(uint16 artifactPowerId, uint8 purchasedRank, uint8 currentRankWithBonus)
|
||||
{
|
||||
auto indexItr = m_artifactPowerIdToIndex.find(artifactPowerId);
|
||||
if (indexItr != m_artifactPowerIdToIndex.end())
|
||||
{
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData)
|
||||
.ModifyValue(&UF::ItemData::ArtifactPowers, indexItr->second)
|
||||
.ModifyValue(&UF::ArtifactPower::PurchasedRank), purchasedRank);
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData)
|
||||
.ModifyValue(&UF::ItemData::ArtifactPowers, indexItr->second)
|
||||
.ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), currentRankWithBonus);
|
||||
}
|
||||
}
|
||||
|
||||
void Item::InitArtifactPowers(uint8 artifactId, uint8 artifactTier)
|
||||
{
|
||||
for (ArtifactPowerEntry const* artifactPower : sDB2Manager.GetArtifactPowers(artifactId))
|
||||
{
|
||||
if (artifactPower->Tier != artifactTier)
|
||||
continue;
|
||||
|
||||
if (m_artifactPowerIdToIndex.find(artifactPower->ID) != m_artifactPowerIdToIndex.end())
|
||||
continue;
|
||||
|
||||
ArtifactPowerData powerData;
|
||||
powerData.ArtifactPowerId = artifactPower->ID;
|
||||
powerData.PurchasedRank = 0;
|
||||
powerData.CurrentRankWithBonus = (artifactPower->Flags & ARTIFACT_POWER_FLAG_FIRST) == ARTIFACT_POWER_FLAG_FIRST ? 1 : 0;
|
||||
AddArtifactPower(&powerData);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Item::GetTotalUnlockedArtifactPowers() const
|
||||
{
|
||||
uint32 purchased = GetTotalPurchasedArtifactPowers();
|
||||
uint64 artifactXp = m_itemData->ArtifactXP;
|
||||
uint32 currentArtifactTier = GetModifier(ITEM_MODIFIER_ARTIFACT_TIER);
|
||||
uint32 extraUnlocked = 0;
|
||||
do
|
||||
{
|
||||
uint64 xpCost = 0;
|
||||
if (GtArtifactLevelXPEntry const* cost = sArtifactLevelXPGameTable.GetRow(purchased + extraUnlocked + 1))
|
||||
xpCost = uint64(currentArtifactTier == MAX_ARTIFACT_TIER ? cost->XP2 : cost->XP);
|
||||
|
||||
if (artifactXp < xpCost)
|
||||
break;
|
||||
|
||||
artifactXp -= xpCost;
|
||||
++extraUnlocked;
|
||||
|
||||
} while (true);
|
||||
|
||||
return purchased + extraUnlocked;
|
||||
}
|
||||
|
||||
uint32 Item::GetTotalPurchasedArtifactPowers() const
|
||||
{
|
||||
uint32 purchasedRanks = 0;
|
||||
for (UF::ArtifactPower const& power : m_itemData->ArtifactPowers)
|
||||
purchasedRanks += power.PurchasedRank;
|
||||
|
||||
return purchasedRanks;
|
||||
}
|
||||
|
||||
void Item::ApplyArtifactPowerEnchantmentBonuses(EnchantmentSlot slot, uint32 enchantId, bool apply, Player* owner)
|
||||
{
|
||||
if (SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId))
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
|
||||
{
|
||||
switch (enchant->Effect[i])
|
||||
{
|
||||
case ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_BY_TYPE:
|
||||
for (uint32 artifactPowerIndex = 0; artifactPowerIndex < m_itemData->ArtifactPowers.size(); ++artifactPowerIndex)
|
||||
{
|
||||
UF::ArtifactPower const& artifactPower = m_itemData->ArtifactPowers[artifactPowerIndex];
|
||||
if (uint32(sArtifactPowerStore.AssertEntry(artifactPower.ArtifactPowerID)->Label) == enchant->EffectArg[i])
|
||||
{
|
||||
uint8 newRank = artifactPower.CurrentRankWithBonus;
|
||||
if (apply)
|
||||
newRank += enchant->EffectPointsMin[i];
|
||||
else
|
||||
newRank -= enchant->EffectPointsMin[i];
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData)
|
||||
.ModifyValue(&UF::ItemData::ArtifactPowers, artifactPowerIndex)
|
||||
.ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_BY_ID:
|
||||
{
|
||||
if (uint16 const* artifactPowerIndex = Trinity::Containers::MapGetValuePtr(m_artifactPowerIdToIndex, enchant->EffectArg[i]))
|
||||
{
|
||||
uint8 newRank = m_itemData->ArtifactPowers[*artifactPowerIndex].CurrentRankWithBonus;
|
||||
if (apply)
|
||||
newRank += enchant->EffectPointsMin[i];
|
||||
else
|
||||
newRank -= enchant->EffectPointsMin[i];
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData)
|
||||
.ModifyValue(&UF::ItemData::ArtifactPowers, *artifactPowerIndex)
|
||||
.ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_PICKER:
|
||||
if (slot >= SOCK_ENCHANTMENT_SLOT && slot <= SOCK_ENCHANTMENT_SLOT_3 && _bonusData.GemRelicType[slot - SOCK_ENCHANTMENT_SLOT] != -1)
|
||||
{
|
||||
if (ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i]))
|
||||
{
|
||||
PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactPowerPicker->PlayerConditionID);
|
||||
if (!playerCondition || sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition))
|
||||
{
|
||||
for (uint32 artifactPowerIndex = 0; artifactPowerIndex < m_itemData->ArtifactPowers.size(); ++artifactPowerIndex)
|
||||
{
|
||||
UF::ArtifactPower const& artifactPower = m_itemData->ArtifactPowers[artifactPowerIndex];
|
||||
if (sArtifactPowerStore.AssertEntry(artifactPower.ArtifactPowerID)->Label == _bonusData.GemRelicType[slot - SOCK_ENCHANTMENT_SLOT])
|
||||
{
|
||||
uint8 newRank = artifactPower.CurrentRankWithBonus;
|
||||
if (apply)
|
||||
newRank += enchant->EffectPointsMin[i];
|
||||
else
|
||||
newRank -= enchant->EffectPointsMin[i];
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData)
|
||||
.ModifyValue(&UF::ItemData::ArtifactPowers, artifactPowerIndex)
|
||||
.ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Item::CopyArtifactDataFromParent(Item* parent)
|
||||
{
|
||||
memcpy(_bonusData.GemItemLevelBonus, parent->GetBonus()->GemItemLevelBonus, sizeof(_bonusData.GemItemLevelBonus));
|
||||
SetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID, parent->GetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID));
|
||||
SetAppearanceModId(parent->GetAppearanceModId());
|
||||
}
|
||||
|
||||
void Item::GiveArtifactXp(uint64 amount, Item* sourceItem, uint32 artifactCategoryId)
|
||||
{
|
||||
Player* owner = GetOwner();
|
||||
if (!owner)
|
||||
return;
|
||||
|
||||
if (artifactCategoryId)
|
||||
{
|
||||
uint32 artifactKnowledgeLevel = 1;
|
||||
if (sourceItem && sourceItem->GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL))
|
||||
artifactKnowledgeLevel = sourceItem->GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL);
|
||||
|
||||
if (GtArtifactKnowledgeMultiplierEntry const* artifactKnowledge = sArtifactKnowledgeMultiplierGameTable.GetRow(artifactKnowledgeLevel))
|
||||
amount = uint64(amount * artifactKnowledge->Multiplier);
|
||||
|
||||
if (amount >= 5000)
|
||||
amount = 50 * (amount / 50);
|
||||
else if (amount >= 1000)
|
||||
amount = 25 * (amount / 25);
|
||||
else if (amount >= 50)
|
||||
amount = 5 * (amount / 5);
|
||||
}
|
||||
|
||||
SetArtifactXP(m_itemData->ArtifactXP + amount);
|
||||
|
||||
WorldPackets::Artifact::ArtifactXpGain artifactXpGain;
|
||||
artifactXpGain.ArtifactGUID = GetGUID();
|
||||
artifactXpGain.Amount = amount;
|
||||
owner->SendDirectMessage(artifactXpGain.Write());
|
||||
|
||||
SetState(ITEM_CHANGED, owner);
|
||||
}
|
||||
|
||||
void Item::SetFixedLevel(uint8 level)
|
||||
{
|
||||
if (!_bonusData.HasFixedLevel || GetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL))
|
||||
@@ -2819,9 +2224,6 @@ void BonusData::Initialize(ItemTemplate const* proto)
|
||||
RelicType = -1;
|
||||
HasFixedLevel = false;
|
||||
RequiredLevelOverride = 0;
|
||||
AzeriteTierUnlockSetId = 0;
|
||||
if (AzeriteEmpoweredItemEntry const* azeriteEmpoweredItem = sDB2Manager.GetAzeriteEmpoweredItem(proto->GetId()))
|
||||
AzeriteTierUnlockSetId = azeriteEmpoweredItem->AzeriteTierUnlockSetID;
|
||||
|
||||
Suffix = 0;
|
||||
RequiredLevelCurve = 0;
|
||||
@@ -2839,7 +2241,6 @@ void BonusData::Initialize(ItemTemplate const* proto)
|
||||
_state.SuffixPriority = std::numeric_limits<int32>::max();
|
||||
_state.AppearanceModPriority = std::numeric_limits<int32>::max();
|
||||
_state.ScalingStatDistributionPriority = std::numeric_limits<int32>::max();
|
||||
_state.AzeriteTierUnlockSetPriority = std::numeric_limits<int32>::max();
|
||||
_state.RequiredLevelCurvePriority = std::numeric_limits<int32>::max();
|
||||
_state.HasQualityBonus = false;
|
||||
}
|
||||
@@ -2851,125 +2252,4 @@ void BonusData::Initialize(WorldPackets::Item::ItemInstance const& itemInstance)
|
||||
return;
|
||||
|
||||
Initialize(proto);
|
||||
|
||||
if (itemInstance.ItemBonus)
|
||||
for (uint32 bonusListID : itemInstance.ItemBonus->BonusListIDs)
|
||||
AddBonusList(bonusListID);
|
||||
}
|
||||
|
||||
void BonusData::AddBonusList(uint32 bonusListId)
|
||||
{
|
||||
for (ItemBonusEntry const* bonus : ItemBonusMgr::GetItemBonuses(bonusListId))
|
||||
AddBonus(bonus->Type, bonus->Value);
|
||||
}
|
||||
|
||||
void BonusData::AddBonus(uint32 type, std::array<int32, 4> const& values)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ITEM_BONUS_ITEM_LEVEL:
|
||||
ItemLevelBonus += values[0];
|
||||
break;
|
||||
case ITEM_BONUS_STAT:
|
||||
{
|
||||
uint32 statIndex = 0;
|
||||
for (statIndex = 0; statIndex < MAX_ITEM_PROTO_STATS; ++statIndex)
|
||||
if (ItemStatType[statIndex] == values[0] || ItemStatType[statIndex] == -1)
|
||||
break;
|
||||
|
||||
if (statIndex < MAX_ITEM_PROTO_STATS)
|
||||
{
|
||||
ItemStatType[statIndex] = values[0];
|
||||
StatPercentEditor[statIndex] += values[1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ITEM_BONUS_QUALITY:
|
||||
if (!_state.HasQualityBonus)
|
||||
{
|
||||
Quality = static_cast<uint32>(values[0]);
|
||||
_state.HasQualityBonus = true;
|
||||
}
|
||||
else if (Quality < static_cast<uint32>(values[0]))
|
||||
Quality = static_cast<uint32>(values[0]);
|
||||
break;
|
||||
case ITEM_BONUS_SUFFIX:
|
||||
if (values[1] < _state.SuffixPriority)
|
||||
{
|
||||
Suffix = static_cast<uint32>(values[0]);
|
||||
_state.SuffixPriority = values[1];
|
||||
}
|
||||
break;
|
||||
case ITEM_BONUS_SOCKET:
|
||||
{
|
||||
uint32 socketCount = values[0];
|
||||
for (uint32 i = 0; i < MAX_ITEM_PROTO_SOCKETS && socketCount; ++i)
|
||||
{
|
||||
if (!SocketColor[i])
|
||||
{
|
||||
SocketColor[i] = values[1];
|
||||
--socketCount;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ITEM_BONUS_APPEARANCE:
|
||||
if (values[1] < _state.AppearanceModPriority)
|
||||
{
|
||||
AppearanceModID = static_cast<uint32>(values[0]);
|
||||
_state.AppearanceModPriority = values[1];
|
||||
}
|
||||
break;
|
||||
case ITEM_BONUS_REQUIRED_LEVEL:
|
||||
RequiredLevel += values[0];
|
||||
break;
|
||||
case ITEM_BONUS_REPAIR_COST_MULTIPLIER:
|
||||
RepairCostMultiplier *= static_cast<float>(values[0]) * 0.01f;
|
||||
break;
|
||||
case ITEM_BONUS_SCALING_STAT_DISTRIBUTION:
|
||||
case ITEM_BONUS_SCALING_STAT_DISTRIBUTION_FIXED:
|
||||
if (values[1] < _state.ScalingStatDistributionPriority)
|
||||
{
|
||||
ContentTuningId = static_cast<uint32>(values[2]);
|
||||
PlayerLevelToItemLevelCurveId = static_cast<uint32>(values[3]);
|
||||
_state.ScalingStatDistributionPriority = values[1];
|
||||
HasFixedLevel = type == ITEM_BONUS_SCALING_STAT_DISTRIBUTION_FIXED;
|
||||
}
|
||||
break;
|
||||
case ITEM_BONUS_BONDING:
|
||||
Bonding = ItemBondingType(values[0]);
|
||||
break;
|
||||
case ITEM_BONUS_RELIC_TYPE:
|
||||
RelicType = values[0];
|
||||
break;
|
||||
case ITEM_BONUS_OVERRIDE_REQUIRED_LEVEL:
|
||||
RequiredLevelOverride = values[0];
|
||||
break;
|
||||
case ITEM_BONUS_AZERITE_TIER_UNLOCK_SET:
|
||||
if (values[1] < _state.AzeriteTierUnlockSetPriority)
|
||||
{
|
||||
AzeriteTierUnlockSetId = values[0];
|
||||
_state.AzeriteTierUnlockSetPriority = values[1];
|
||||
}
|
||||
break;
|
||||
case ITEM_BONUS_OVERRIDE_CAN_DISENCHANT:
|
||||
CanDisenchant = values[0] != 0;
|
||||
break;
|
||||
case ITEM_BONUS_OVERRIDE_CAN_SCRAP:
|
||||
CanScrap = values[0] != 0;
|
||||
break;
|
||||
case ITEM_BONUS_ITEM_EFFECT_ID:
|
||||
if (ItemEffectEntry const* itemEffect = sItemEffectStore.LookupEntry(values[0]))
|
||||
Effects[EffectCount++] = itemEffect;
|
||||
break;
|
||||
case ITEM_BONUS_REQUIRED_LEVEL_CURVE:
|
||||
if (values[2] < _state.RequiredLevelCurvePriority)
|
||||
{
|
||||
RequiredLevelCurve = values[0];
|
||||
_state.RequiredLevelCurvePriority = values[2];
|
||||
if (values[1])
|
||||
ContentTuningId = static_cast<uint32>(values[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,6 @@ struct BonusData
|
||||
uint16 GemRelicRankBonus[MAX_ITEM_PROTO_SOCKETS];
|
||||
int32 RelicType;
|
||||
int32 RequiredLevelOverride;
|
||||
int32 AzeriteTierUnlockSetId;
|
||||
uint32 Suffix;
|
||||
int32 RequiredLevelCurve;
|
||||
std::array<ItemEffectEntry const*, 13> Effects;
|
||||
@@ -96,8 +95,6 @@ struct BonusData
|
||||
|
||||
void Initialize(ItemTemplate const* proto);
|
||||
void Initialize(WorldPackets::Item::ItemInstance const& itemInstance);
|
||||
void AddBonusList(uint32 bonusListId);
|
||||
void AddBonus(uint32 type, std::array<int32, 4> const& values);
|
||||
|
||||
private:
|
||||
struct
|
||||
@@ -105,58 +102,11 @@ private:
|
||||
int32 SuffixPriority;
|
||||
int32 AppearanceModPriority;
|
||||
int32 ScalingStatDistributionPriority;
|
||||
int32 AzeriteTierUnlockSetPriority;
|
||||
int32 RequiredLevelCurvePriority;
|
||||
bool HasQualityBonus;
|
||||
} _state;
|
||||
};
|
||||
|
||||
struct ArtifactPowerData
|
||||
{
|
||||
uint32 ArtifactPowerId = 0;
|
||||
uint8 PurchasedRank = 0;
|
||||
uint8 CurrentRankWithBonus = 0;
|
||||
};
|
||||
|
||||
struct ArtifactData
|
||||
{
|
||||
uint64 Xp = 0;
|
||||
uint32 ArtifactAppearanceId = 0;
|
||||
uint32 ArtifactTierId = 0;
|
||||
std::vector<ArtifactPowerData> ArtifactPowers;
|
||||
};
|
||||
|
||||
struct AzeriteItemSelectedEssencesData
|
||||
{
|
||||
uint32 SpecializationId = 0;
|
||||
std::array<uint32, MAX_AZERITE_ESSENCE_SLOT> AzeriteEssenceId = { };
|
||||
};
|
||||
|
||||
struct AzeriteItemData
|
||||
{
|
||||
uint64 Xp;
|
||||
uint32 Level;
|
||||
uint32 KnowledgeLevel;
|
||||
std::vector<uint32> AzeriteItemMilestonePowers;
|
||||
std::vector<AzeriteEssencePowerEntry const*> UnlockedAzeriteEssences;
|
||||
std::array<AzeriteItemSelectedEssencesData, 4> SelectedAzeriteEssences = { };
|
||||
};
|
||||
|
||||
struct AzeriteEmpoweredItemData
|
||||
{
|
||||
std::array<int32, MAX_AZERITE_EMPOWERED_TIER> SelectedAzeritePowers;
|
||||
};
|
||||
|
||||
struct ItemAdditionalLoadInfo
|
||||
{
|
||||
static void Init(std::unordered_map<ObjectGuid::LowType, ItemAdditionalLoadInfo>* loadInfo, PreparedQueryResult artifactResult, PreparedQueryResult azeriteItemResult,
|
||||
PreparedQueryResult azeriteItemMilestonePowersResult, PreparedQueryResult azeriteItemUnlockedEssencesResult, PreparedQueryResult azeriteEmpoweredItemResult);
|
||||
|
||||
Optional<ArtifactData> Artifact;
|
||||
Optional<AzeriteItemData> AzeriteItem;
|
||||
Optional<AzeriteEmpoweredItemData> AzeriteEmpoweredItem;
|
||||
};
|
||||
|
||||
struct ItemDynamicFieldGems
|
||||
{
|
||||
uint32 ItemId;
|
||||
@@ -172,7 +122,7 @@ class TC_GAME_API Item : public Object
|
||||
friend void RemoveItemFromUpdateQueueOf(Item* item, Player* player);
|
||||
|
||||
public:
|
||||
static Item* CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Player const* player = nullptr, bool addDefaultBonuses = true);
|
||||
static Item* CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Player const* player = nullptr);
|
||||
Item* CloneItem(uint32 count, Player const* player = nullptr) const;
|
||||
|
||||
Item();
|
||||
@@ -222,13 +172,6 @@ class TC_GAME_API Item : public Object
|
||||
bool IsBoundByEnchant() const;
|
||||
virtual void SaveToDB(CharacterDatabaseTransaction trans);
|
||||
virtual bool LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fields, uint32 entry);
|
||||
void LoadArtifactData(Player const* owner, uint64 xp, uint32 artifactAppearanceId, uint32 artifactTier, std::vector<ArtifactPowerData>& powers); // must be called after LoadFromDB to have gems (relics) initialized
|
||||
void CheckArtifactRelicSlotUnlock(Player const* owner);
|
||||
|
||||
void AddBonuses(uint32 bonusListID);
|
||||
std::vector<int32> const& GetBonusListIDs() const { return m_itemData->ItemBonusKey->BonusListIDs; }
|
||||
void SetBonuses(std::vector<int32> bonusListIDs);
|
||||
void ClearBonuses();
|
||||
|
||||
static void DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid);
|
||||
virtual void DeleteFromDB(CharacterDatabaseTransaction trans);
|
||||
@@ -246,8 +189,6 @@ class TC_GAME_API Item : public Object
|
||||
bool IsWrapped() const { return HasItemFlag(ITEM_FIELD_FLAG_WRAPPED); }
|
||||
bool IsLocked() const { return !HasItemFlag(ITEM_FIELD_FLAG_UNLOCKED); }
|
||||
bool IsBag() const { return GetTemplate()->GetInventoryType() == INVTYPE_BAG; }
|
||||
bool IsAzeriteItem() const { return GetTypeId() == TYPEID_AZERITE_ITEM; }
|
||||
bool IsAzeriteEmpoweredItem() const { return GetTypeId() == TYPEID_AZERITE_EMPOWERED_ITEM; }
|
||||
bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
|
||||
bool IsNotEmptyBag() const;
|
||||
bool IsBroken() const { return *m_itemData->MaxDurability > 0 && *m_itemData->Durability == 0; }
|
||||
@@ -285,8 +226,6 @@ class TC_GAME_API Item : public Object
|
||||
|
||||
uint32 GetSkill();
|
||||
|
||||
ItemRandomBonusListId GetItemRandomBonusListId() const { return m_randomBonusListId; }
|
||||
void SetItemRandomBonusList(ItemRandomBonusListId bonusListId);
|
||||
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster = ObjectGuid::Empty);
|
||||
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
|
||||
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
|
||||
@@ -333,7 +272,7 @@ class TC_GAME_API Item : public Object
|
||||
uint32 GetQuality() const { return _bonusData.Quality; }
|
||||
uint32 GetItemLevel(Player const* owner) const;
|
||||
static uint32 GetItemLevel(ItemTemplate const* itemTemplate, BonusData const& bonusData, uint32 level, uint32 fixedLevel,
|
||||
uint32 minItemLevel, uint32 minItemLevelCutoff, uint32 maxItemLevel, bool pvpBonus, uint32 azeriteLevel);
|
||||
uint32 minItemLevel, uint32 minItemLevelCutoff, uint32 maxItemLevel, bool pvpBonus);
|
||||
int32 GetRequiredLevel() const;
|
||||
int32 GetItemStatType(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return _bonusData.ItemStatType[index]; }
|
||||
float GetItemStatValue(uint32 index, Player const* owner) const;
|
||||
@@ -416,24 +355,6 @@ class TC_GAME_API Item : public Object
|
||||
uint32 GetModifier(ItemModifier modifier) const;
|
||||
void SetModifier(ItemModifier modifier, uint32 value);
|
||||
|
||||
ObjectGuid GetChildItem() const { return m_childItem; }
|
||||
void SetChildItem(ObjectGuid childItem) { m_childItem = childItem; }
|
||||
|
||||
bool IsArtifactDisabled() const;
|
||||
|
||||
UF::ArtifactPower const* GetArtifactPower(uint32 artifactPowerId) const;
|
||||
void AddArtifactPower(ArtifactPowerData const* artifactPower);
|
||||
void SetArtifactPower(uint16 artifactPowerId, uint8 purchasedRank, uint8 currentRankWithBonus);
|
||||
|
||||
void InitArtifactPowers(uint8 artifactId, uint8 artifactTier);
|
||||
uint32 GetTotalUnlockedArtifactPowers() const;
|
||||
uint32 GetTotalPurchasedArtifactPowers() const;
|
||||
void ApplyArtifactPowerEnchantmentBonuses(EnchantmentSlot slot, uint32 enchantId, bool apply, Player* owner);
|
||||
void CopyArtifactDataFromParent(Item* parent);
|
||||
|
||||
void SetArtifactXP(uint64 xp) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ArtifactXP), xp); }
|
||||
void GiveArtifactXp(uint64 amount, Item* sourceItem, uint32 artifactCategoryId);
|
||||
|
||||
ItemContext GetContext() const { return ItemContext(*m_itemData->Context); }
|
||||
void SetContext(ItemContext context) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Context), int32(context)); }
|
||||
|
||||
@@ -445,7 +366,6 @@ class TC_GAME_API Item : public Object
|
||||
UF::UpdateField<UF::ItemData, 0, TYPEID_ITEM> m_itemData;
|
||||
|
||||
protected:
|
||||
void ApplyBonusList(uint32 itemBonusListId);
|
||||
BonusData _bonusData;
|
||||
|
||||
private:
|
||||
@@ -460,9 +380,6 @@ class TC_GAME_API Item : public Object
|
||||
uint64 m_paidMoney;
|
||||
uint32 m_paidExtendedCost;
|
||||
GuidSet allowedGUIDs;
|
||||
ItemRandomBonusListId m_randomBonusListId; // store separately to easily find which bonus list is the one randomly given for stat rerolling
|
||||
ObjectGuid m_childItem;
|
||||
std::unordered_map<uint32, uint16> m_artifactPowerIdToIndex;
|
||||
std::array<uint32, MAX_ITEM_PROTO_SOCKETS> m_gemScalingLevels;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,259 +0,0 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "ConditionMgr.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "MapUtils.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct ItemLevelSelectorQualityEntryComparator
|
||||
{
|
||||
bool operator()(ItemLevelSelectorQualityEntry const* left, ItemLevelSelectorQualityEntry const* right) const { return left->Quality < right->Quality; }
|
||||
bool operator()(ItemLevelSelectorQualityEntry const* left, ItemQualities quality) const { return left->Quality < quality; }
|
||||
};
|
||||
|
||||
using ItemLevelSelectorQualities = std::set<ItemLevelSelectorQualityEntry const*, ItemLevelSelectorQualityEntryComparator>;
|
||||
|
||||
std::unordered_map<uint32 /*itemBonusListId*/, std::vector<ItemBonusEntry const*>> _itemBonusLists;
|
||||
std::unordered_map<int16 /*itemLevelDelta*/, uint32 /*itemBonusListId*/> _itemLevelDeltaToBonusListContainer;
|
||||
std::unordered_map<uint32 /*itemLevelSelectorQualitySetId*/, ItemLevelSelectorQualities> _itemLevelQualitySelectorQualities;
|
||||
std::unordered_map<uint32 /*itemBonusTreeId*/, std::set<ItemBonusTreeNodeEntry const*>> _itemBonusTrees;
|
||||
std::unordered_multimap<uint32 /*itemId*/, uint32 /*itemBonusTreeId*/> _itemToBonusTree;
|
||||
}
|
||||
|
||||
namespace ItemBonusMgr
|
||||
{
|
||||
void Load()
|
||||
{
|
||||
for (ItemBonusEntry const* bonus : sItemBonusStore)
|
||||
_itemBonusLists[bonus->ParentItemBonusListID].push_back(bonus);
|
||||
|
||||
for (ItemBonusListLevelDeltaEntry const* itemBonusListLevelDelta : sItemBonusListLevelDeltaStore)
|
||||
_itemLevelDeltaToBonusListContainer[itemBonusListLevelDelta->ItemLevelDelta] = itemBonusListLevelDelta->ID;
|
||||
|
||||
for (ItemLevelSelectorQualityEntry const* itemLevelSelectorQuality : sItemLevelSelectorQualityStore)
|
||||
_itemLevelQualitySelectorQualities[itemLevelSelectorQuality->ParentILSQualitySetID].insert(itemLevelSelectorQuality);
|
||||
|
||||
for (ItemBonusTreeNodeEntry const* bonusTreeNode : sItemBonusTreeNodeStore)
|
||||
_itemBonusTrees[bonusTreeNode->ParentItemBonusTreeID].insert(bonusTreeNode);
|
||||
|
||||
for (ItemXBonusTreeEntry const* itemBonusTreeAssignment : sItemXBonusTreeStore)
|
||||
_itemToBonusTree.insert({ itemBonusTreeAssignment->ItemID, itemBonusTreeAssignment->ItemBonusTreeID });
|
||||
}
|
||||
|
||||
ItemContext GetContextForPlayer(MapDifficultyEntry const* mapDifficulty, Player const* player)
|
||||
{
|
||||
auto evalContext = [](ItemContext currentContext, ItemContext newContext)
|
||||
{
|
||||
if (newContext == ItemContext::NONE)
|
||||
newContext = currentContext;
|
||||
else if (newContext == ItemContext::Force_to_NONE)
|
||||
newContext = ItemContext::NONE;
|
||||
return newContext;
|
||||
};
|
||||
|
||||
ItemContext context = ItemContext::NONE;
|
||||
if (DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(mapDifficulty->DifficultyID))
|
||||
context = evalContext(context, ItemContext(difficulty->ItemContext));
|
||||
|
||||
context = evalContext(context, ItemContext(mapDifficulty->ItemContext));
|
||||
|
||||
if (mapDifficulty->ItemContextPickerID)
|
||||
{
|
||||
uint32 contentTuningId = mapDifficulty->ContentTuningID;
|
||||
|
||||
ItemContextPickerEntryEntry const* selectedPickerEntry = nullptr;
|
||||
for (ItemContextPickerEntryEntry const* itemContextPickerEntry : sItemContextPickerEntryStore)
|
||||
{
|
||||
if (itemContextPickerEntry->ItemContextPickerID != uint32(mapDifficulty->ItemContextPickerID))
|
||||
continue;
|
||||
|
||||
if (itemContextPickerEntry->PVal <= 0)
|
||||
continue;
|
||||
|
||||
bool meetsPlayerCondition = false;
|
||||
if (player)
|
||||
if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(itemContextPickerEntry->PlayerConditionID))
|
||||
meetsPlayerCondition = ConditionMgr::IsPlayerMeetingCondition(player, playerCondition);
|
||||
|
||||
if (itemContextPickerEntry->Flags & 0x1)
|
||||
meetsPlayerCondition = !meetsPlayerCondition;
|
||||
|
||||
if (!meetsPlayerCondition)
|
||||
continue;
|
||||
|
||||
if (!selectedPickerEntry || selectedPickerEntry->OrderIndex < itemContextPickerEntry->OrderIndex)
|
||||
selectedPickerEntry = itemContextPickerEntry;
|
||||
}
|
||||
|
||||
if (selectedPickerEntry)
|
||||
context = evalContext(context, ItemContext(selectedPickerEntry->ItemCreationContext));
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
std::span<ItemBonusEntry const*> GetItemBonuses(uint32 bonusListId)
|
||||
{
|
||||
if (std::vector<ItemBonusEntry const*>* itemBonusEntries = Trinity::Containers::MapGetValuePtr(_itemBonusLists, bonusListId))
|
||||
return std::span(*itemBonusEntries);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
uint32 GetItemBonusListForItemLevelDelta(int16 delta)
|
||||
{
|
||||
if (uint32 const* itemBonusListId = Trinity::Containers::MapGetValuePtr(_itemLevelDeltaToBonusListContainer, delta))
|
||||
return *itemBonusListId;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CanApplyBonusTreeToItem(ItemTemplate const* itemTemplate, uint32 itemBonusTreeId, ItemBonusGenerationParams const& params)
|
||||
{
|
||||
if (std::set<ItemBonusTreeNodeEntry const*>* bonusTreeNodes = Trinity::Containers::MapGetValuePtr(_itemBonusTrees, itemBonusTreeId))
|
||||
{
|
||||
bool anyNodeMatched = false;
|
||||
for (ItemBonusTreeNodeEntry const* bonusTreeNode : *bonusTreeNodes)
|
||||
{
|
||||
ItemContext nodeContext = ItemContext(bonusTreeNode->ItemContext);
|
||||
if (nodeContext == ItemContext::NONE || nodeContext == params.Context)
|
||||
{
|
||||
if (anyNodeMatched)
|
||||
return false;
|
||||
|
||||
anyNodeMatched = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 GetBonusTreeIdOverride(uint32 itemBonusTreeId, ItemBonusGenerationParams const& params)
|
||||
{
|
||||
return itemBonusTreeId;
|
||||
}
|
||||
|
||||
void ApplyBonusTreeHelper(ItemTemplate const* itemTemplate, uint32 itemBonusTreeId, ItemBonusGenerationParams const& params, int32 sequenceLevel, uint32* itemLevelSelectorId, std::vector<int32>* bonusListIDs)
|
||||
{
|
||||
uint32 originalItemBonusTreeId = itemBonusTreeId;
|
||||
|
||||
// override bonus tree with season specific values
|
||||
itemBonusTreeId = GetBonusTreeIdOverride(itemBonusTreeId, params);
|
||||
|
||||
if (!CanApplyBonusTreeToItem(itemTemplate, itemBonusTreeId, params))
|
||||
return;
|
||||
|
||||
auto treeItr = _itemBonusTrees.find(itemBonusTreeId);
|
||||
if (treeItr == _itemBonusTrees.end())
|
||||
return;
|
||||
|
||||
for (ItemBonusTreeNodeEntry const* bonusTreeNode : treeItr->second)
|
||||
{
|
||||
ItemContext nodeContext = ItemContext(bonusTreeNode->ItemContext);
|
||||
ItemContext requiredContext = nodeContext != ItemContext::Force_to_NONE ? nodeContext : ItemContext::NONE;
|
||||
if (nodeContext != ItemContext::NONE && params.Context != requiredContext)
|
||||
continue;
|
||||
|
||||
if (bonusTreeNode->ChildItemBonusTreeID)
|
||||
ApplyBonusTreeHelper(itemTemplate, bonusTreeNode->ChildItemBonusTreeID, params, sequenceLevel, itemLevelSelectorId, bonusListIDs);
|
||||
else if (bonusTreeNode->ChildItemBonusListID)
|
||||
bonusListIDs->push_back(bonusTreeNode->ChildItemBonusListID);
|
||||
else if (bonusTreeNode->ChildItemLevelSelectorID)
|
||||
*itemLevelSelectorId = bonusTreeNode->ChildItemLevelSelectorID;
|
||||
}
|
||||
}
|
||||
|
||||
int32 GetAzeriteUnlockBonusList(uint16 azeriteUnlockMappingSetId, uint16 minItemLevel, InventoryType inventoryType)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<int32> GetBonusListsForItem(uint32 itemId, ItemBonusGenerationParams const& params)
|
||||
{
|
||||
std::vector<int32> bonusListIDs;
|
||||
|
||||
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
|
||||
if (!itemTemplate)
|
||||
return bonusListIDs;
|
||||
|
||||
uint32 itemLevelSelectorId = 0;
|
||||
|
||||
for (auto [_, itemBonusTreeId] : Trinity::Containers::MapEqualRange(_itemToBonusTree, itemId))
|
||||
ApplyBonusTreeHelper(itemTemplate, itemBonusTreeId, params, 0, &itemLevelSelectorId, &bonusListIDs);
|
||||
|
||||
if (ItemLevelSelectorEntry const* selector = sItemLevelSelectorStore.LookupEntry(itemLevelSelectorId))
|
||||
{
|
||||
int16 delta = int16(selector->MinItemLevel) - int16(itemTemplate->GetBaseItemLevel());
|
||||
|
||||
if (uint32 bonus = GetItemBonusListForItemLevelDelta(delta))
|
||||
bonusListIDs.push_back(bonus);
|
||||
|
||||
if (ItemLevelSelectorQualitySetEntry const* selectorQualitySet = sItemLevelSelectorQualitySetStore.LookupEntry(selector->ItemLevelSelectorQualitySetID))
|
||||
{
|
||||
auto itemSelectorQualities = _itemLevelQualitySelectorQualities.find(selector->ItemLevelSelectorQualitySetID);
|
||||
if (itemSelectorQualities != _itemLevelQualitySelectorQualities.end())
|
||||
{
|
||||
ItemQualities quality = ITEM_QUALITY_UNCOMMON;
|
||||
if (selector->MinItemLevel >= selectorQualitySet->IlvlEpic)
|
||||
quality = ITEM_QUALITY_EPIC;
|
||||
else if (selector->MinItemLevel >= selectorQualitySet->IlvlRare)
|
||||
quality = ITEM_QUALITY_RARE;
|
||||
|
||||
auto itemSelectorQuality = std::lower_bound(itemSelectorQualities->second.begin(), itemSelectorQualities->second.end(),
|
||||
quality, ItemLevelSelectorQualityEntryComparator{});
|
||||
|
||||
if (itemSelectorQuality != itemSelectorQualities->second.end())
|
||||
bonusListIDs.push_back((*itemSelectorQuality)->QualityItemBonusListID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bonusListIDs;
|
||||
}
|
||||
|
||||
template<typename Visitor>
|
||||
void VisitItemBonusTree(uint32 itemBonusTreeId, Visitor visitor)
|
||||
{
|
||||
auto treeItr = _itemBonusTrees.find(itemBonusTreeId);
|
||||
if (treeItr == _itemBonusTrees.end())
|
||||
return;
|
||||
|
||||
for (ItemBonusTreeNodeEntry const* bonusTreeNode : treeItr->second)
|
||||
{
|
||||
visitor(bonusTreeNode);
|
||||
if (bonusTreeNode->ChildItemBonusTreeID)
|
||||
VisitItemBonusTree(bonusTreeNode->ChildItemBonusTreeID, visitor);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<int32> GetAllBonusListsForTree(uint32 itemBonusTreeId)
|
||||
{
|
||||
std::vector<int32> bonusListIDs;
|
||||
VisitItemBonusTree(itemBonusTreeId, [&bonusListIDs](ItemBonusTreeNodeEntry const* bonusTreeNode)
|
||||
{
|
||||
if (bonusTreeNode->ChildItemBonusListID)
|
||||
bonusListIDs.push_back(bonusTreeNode->ChildItemBonusListID);
|
||||
});
|
||||
return bonusListIDs;
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TRINITY_ITEM_BONUS_MGR_H
|
||||
#define TRINITY_ITEM_BONUS_MGR_H
|
||||
|
||||
#include "Define.h"
|
||||
#include "Optional.h"
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
class Player;
|
||||
struct ItemBonusEntry;
|
||||
struct MapDifficultyEntry;
|
||||
enum class ItemContext : uint8;
|
||||
|
||||
namespace ItemBonusMgr
|
||||
{
|
||||
TC_GAME_API void Load();
|
||||
|
||||
TC_GAME_API ItemContext GetContextForPlayer(MapDifficultyEntry const* mapDifficulty, Player const* player);
|
||||
|
||||
TC_GAME_API std::span<ItemBonusEntry const*> GetItemBonuses(uint32 bonusListId);
|
||||
|
||||
TC_GAME_API uint32 GetItemBonusListForItemLevelDelta(int16 delta);
|
||||
|
||||
struct ItemBonusGenerationParams
|
||||
{
|
||||
/*implicit*/ ItemBonusGenerationParams(ItemContext context, Optional<int32> mythicPlusKeystoneLevel = {}, Optional<int32> pvpTier = {})
|
||||
: Context(context), MythicPlusKeystoneLevel(mythicPlusKeystoneLevel), PvpTier(pvpTier) { }
|
||||
|
||||
ItemContext Context;
|
||||
Optional<int32> MythicPlusKeystoneLevel;
|
||||
Optional<int32> PvpTier;
|
||||
};
|
||||
|
||||
TC_GAME_API std::vector<int32> GetBonusListsForItem(uint32 itemId, ItemBonusGenerationParams const& params);
|
||||
TC_GAME_API std::vector<int32> GetAllBonusListsForTree(uint32 itemBonusTreeId);
|
||||
}
|
||||
|
||||
#endif // TRINITY_ITEM_BONUS_MGR_H
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "Containers.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -38,52 +37,6 @@ namespace
|
||||
std::unordered_map<uint32, RandomBonusListIds> _storage;
|
||||
}
|
||||
|
||||
void LoadItemRandomBonusListTemplates()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
_storage.clear();
|
||||
|
||||
// 0 1 2
|
||||
QueryResult result = WorldDatabase.Query("SELECT Id, BonusListID, Chance FROM item_random_bonus_list_template");
|
||||
|
||||
if (result)
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 id = fields[0].GetUInt32();
|
||||
uint32 bonusListId = fields[1].GetUInt32();
|
||||
float chance = fields[2].GetFloat();
|
||||
|
||||
if (ItemBonusMgr::GetItemBonuses(bonusListId).empty())
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Bonus list {} used in `item_random_bonus_list_template` by id {} doesn't have exist in ItemBonus.db2", bonusListId, id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (chance < 0.000001f || chance > 100.0f)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Bonus list {} used in `item_random_bonus_list_template` by id {} has invalid chance {}", bonusListId, id, chance);
|
||||
continue;
|
||||
}
|
||||
|
||||
RandomBonusListIds& ids = _storage[id];
|
||||
ids.BonusListIDs.push_back(bonusListId);
|
||||
ids.Chances.push_back(chance);
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
TC_LOG_INFO("server.loading", ">> Loaded {} Random item bonus list definitions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
else
|
||||
TC_LOG_INFO("server.loading", ">> Loaded 0 Random item bonus list definitions. DB table `item_random_bonus_list_template` is empty.");
|
||||
}
|
||||
|
||||
ItemRandomBonusListId GenerateItemRandomBonusListId(uint32 item_id)
|
||||
{
|
||||
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
using ItemRandomBonusListId = uint32;
|
||||
|
||||
TC_GAME_API void LoadItemRandomBonusListTemplates();
|
||||
TC_GAME_API ItemRandomBonusListId GenerateItemRandomBonusListId(uint32 item_id);
|
||||
TC_GAME_API float GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subclass);
|
||||
|
||||
|
||||
@@ -266,9 +266,6 @@ void CollectionMgr::UpgradeHeirloom(uint32 itemId, int32 castItem)
|
||||
}
|
||||
}
|
||||
|
||||
for (Item* item : player->GetItemListByEntry(itemId, true))
|
||||
item->AddBonuses(bonusId);
|
||||
|
||||
// Get heirloom offset to update only one part of dynamic field
|
||||
auto const& heirlooms = player->m_activePlayerData->Heirlooms;
|
||||
uint32 offset = uint32(std::distance(heirlooms.begin(), std::find(heirlooms.begin(), heirlooms.end(), int32(itemId))));
|
||||
@@ -321,20 +318,6 @@ void CollectionMgr::CheckHeirloomUpgrades(Item* item)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<int32> const& bonusListIDs = item->GetBonusListIDs();
|
||||
|
||||
for (uint32 bonusId : bonusListIDs)
|
||||
{
|
||||
if (bonusId != itr->second.bonusId)
|
||||
{
|
||||
item->ClearBonuses();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (std::find(bonusListIDs.begin(), bonusListIDs.end(), int32(itr->second.bonusId)) == bonusListIDs.end())
|
||||
item->AddBonuses(itr->second.bonusId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -588,7 +588,7 @@ bool Player::StoreNewItemInBestSlots(uint32 itemId, uint32 amount, ItemContext c
|
||||
InventoryResult msg = CanStoreNewItem(INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, itemId, amount);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
StoreNewItem(sDest, itemId, true, GenerateItemRandomBonusListId(itemId), GuidSet(), context);
|
||||
StoreNewItem(sDest, itemId, true, GuidSet(), context);
|
||||
return true; // stored
|
||||
}
|
||||
|
||||
@@ -2375,10 +2375,6 @@ void Player::GiveLevel(uint8 level)
|
||||
|
||||
_ApplyAllLevelScaleItemMods(true); // Moved to above SetFullHealth so player will have full health from Heirlooms
|
||||
|
||||
if (Aura const* artifactAura = GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE))
|
||||
if (Item* artifact = GetItemByGuid(artifactAura->GetCastItemGUID()))
|
||||
artifact->CheckArtifactRelicSlotUnlock(this);
|
||||
|
||||
// Only health and mana are set to maximum.
|
||||
SetFullHealth();
|
||||
for (PowerTypeEntry const* powerType : sPowerTypeStore)
|
||||
@@ -3935,35 +3931,11 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||
|
||||
if (resultItems)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS_ARTIFACT);
|
||||
stmt->setUInt64(0, guid);
|
||||
PreparedQueryResult artifactResult = CharacterDatabase.Query(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS_AZERITE);
|
||||
stmt->setUInt64(0, guid);
|
||||
PreparedQueryResult azeriteResult = CharacterDatabase.Query(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS_AZERITE_MILESTONE_POWER);
|
||||
stmt->setUInt64(0, guid);
|
||||
PreparedQueryResult azeriteItemMilestonePowersResult = CharacterDatabase.Query(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS_AZERITE_UNLOCKED_ESSENCE);
|
||||
stmt->setUInt64(0, guid);
|
||||
PreparedQueryResult azeriteItemUnlockedEssencesResult = CharacterDatabase.Query(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS_AZERITE_EMPOWERED);
|
||||
stmt->setUInt64(0, guid);
|
||||
PreparedQueryResult azeriteEmpoweredItemResult = CharacterDatabase.Query(stmt);
|
||||
|
||||
std::unordered_map<ObjectGuid::LowType, ItemAdditionalLoadInfo> additionalData;
|
||||
ItemAdditionalLoadInfo::Init(&additionalData, artifactResult, azeriteResult, azeriteItemMilestonePowersResult,
|
||||
azeriteItemUnlockedEssencesResult, azeriteEmpoweredItemResult);
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = resultItems->Fetch();
|
||||
uint64 mailId = fields[44].GetUInt64();
|
||||
if (Item* mailItem = _LoadMailedItem(playerguid, nullptr, mailId, nullptr, fields, Trinity::Containers::MapGetValuePtr(additionalData, fields[0].GetUInt64())))
|
||||
if (Item* mailItem = _LoadMailedItem(playerguid, nullptr, mailId, nullptr, fields))
|
||||
itemsByMail[mailId].push_back(mailItem);
|
||||
|
||||
} while (resultItems->NextRow());
|
||||
@@ -4161,34 +4133,10 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||
stmt->setUInt64(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_BY_OWNER);
|
||||
stmt->setUInt64(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS_BY_OWNER);
|
||||
stmt->setUInt64(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS_BY_OWNER);
|
||||
stmt->setUInt64(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_BY_OWNER);
|
||||
stmt->setUInt64(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER_BY_OWNER);
|
||||
stmt->setUInt64(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE_BY_OWNER);
|
||||
stmt->setUInt64(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_EMPOWERED_BY_OWNER);
|
||||
stmt->setUInt64(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_BY_OWNER);
|
||||
stmt->setUInt64(0, guid);
|
||||
trans->Append(stmt);
|
||||
@@ -9335,21 +9283,6 @@ Item* Player::GetShield(bool useable) const
|
||||
return item;
|
||||
}
|
||||
|
||||
Item* Player::GetChildItemByGuid(ObjectGuid guid) const
|
||||
{
|
||||
Item* result = nullptr;
|
||||
ForEachItem(ItemSearchLocation::Equipment | ItemSearchLocation::Inventory, [&result, guid](Item* item)
|
||||
{
|
||||
if (item->GetGUID() == guid)
|
||||
{
|
||||
result = item;
|
||||
return ItemSearchCallbackResult::Stop;
|
||||
}
|
||||
return ItemSearchCallbackResult::Continue;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
WeaponAttackType Player::GetAttackBySlot(uint8 slot, InventoryType inventoryType)
|
||||
{
|
||||
switch (slot)
|
||||
@@ -10830,46 +10763,6 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
|
||||
return !swap ? EQUIP_ERR_ITEM_NOT_FOUND : EQUIP_ERR_CANT_SWAP;
|
||||
}
|
||||
|
||||
InventoryResult Player::CanEquipChildItem(Item* parentItem) const
|
||||
{
|
||||
Item* childItem = GetChildItemByGuid(parentItem->GetChildItem());
|
||||
if (!childItem)
|
||||
return EQUIP_ERR_OK;
|
||||
|
||||
ItemChildEquipmentEntry const* childEquipement = sDB2Manager.GetItemChildEquipment(parentItem->GetEntry());
|
||||
if (!childEquipement)
|
||||
return EQUIP_ERR_OK;
|
||||
|
||||
Item* dstItem = GetItemByPos(INVENTORY_SLOT_BAG_0, childEquipement->ChildItemEquipSlot);
|
||||
if (!dstItem)
|
||||
return EQUIP_ERR_OK;
|
||||
|
||||
uint16 childDest = (INVENTORY_SLOT_BAG_0 << 8) | childEquipement->ChildItemEquipSlot;
|
||||
InventoryResult msg = CanUnequipItem(childDest, !childItem->IsBag());
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
return msg;
|
||||
|
||||
// check dest->src move possibility
|
||||
uint16 src = parentItem->GetPos();
|
||||
ItemPosCountVec dest;
|
||||
if (IsInventoryPos(src))
|
||||
{
|
||||
msg = CanStoreItem(parentItem->GetBagSlot(), NULL_SLOT, dest, dstItem, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
msg = CanStoreItem(NULL_BAG, NULL_SLOT, dest, dstItem, true);
|
||||
}
|
||||
else if (IsBankPos(src))
|
||||
{
|
||||
msg = CanBankItem(parentItem->GetBagSlot(), NULL_SLOT, dest, dstItem, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
msg = CanBankItem(NULL_BAG, NULL_SLOT, dest, dstItem, true);
|
||||
}
|
||||
else if (IsEquipmentPos(src))
|
||||
return EQUIP_ERR_CANT_SWAP;
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const
|
||||
{
|
||||
// Applied only to equipped items and bank bags
|
||||
@@ -11261,22 +11154,16 @@ InventoryResult Player::CanRollNeedForItem(ItemTemplate const* proto, Map const*
|
||||
}
|
||||
|
||||
// Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case.
|
||||
Item* Player::StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, ItemRandomBonusListId randomBonusListId /*= 0*/,
|
||||
GuidSet const& allowedLooters /*= GuidSet()*/, ItemContext context /*= ItemContext::NONE*/,
|
||||
std::vector<int32> const* bonusListIDs /*= std::vector<int32>()*/, bool addToCollection /*= true*/)
|
||||
Item* Player::StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, GuidSet const& allowedLooters /*= GuidSet()*/, ItemContext context /*= ItemContext::NONE*/, bool addToCollection /*= true*/)
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (ItemPosCountVec::const_iterator itr = pos.begin(); itr != pos.end(); ++itr)
|
||||
count += itr->count;
|
||||
|
||||
Item* item = Item::CreateItem(itemId, count, context, this, bonusListIDs == nullptr);
|
||||
Item* item = Item::CreateItem(itemId, count, context, this);
|
||||
if (item)
|
||||
{
|
||||
item->SetItemFlag(ITEM_FIELD_FLAG_NEW_ITEM);
|
||||
|
||||
if (bonusListIDs)
|
||||
item->SetBonuses(*bonusListIDs);
|
||||
|
||||
item = StoreItem(pos, item, update);
|
||||
|
||||
ItemAddedQuestCheck(itemId, count);
|
||||
@@ -11284,7 +11171,6 @@ Item* Player::StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool updat
|
||||
UpdateCriteria(CriteriaType::AcquireItem, itemId, count);
|
||||
|
||||
item->SetFixedLevel(GetLevel());
|
||||
item->SetItemRandomBonusList(randomBonusListId);
|
||||
|
||||
if (allowedLooters.size() > 1 && item->GetTemplate()->GetMaxStackSize() == 1 && item->IsSoulBound())
|
||||
{
|
||||
@@ -11308,21 +11194,6 @@ Item* Player::StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool updat
|
||||
if (addToCollection)
|
||||
GetSession()->GetCollectionMgr()->OnItemAdded(item);
|
||||
|
||||
if (ItemChildEquipmentEntry const* childItemEntry = sDB2Manager.GetItemChildEquipment(itemId))
|
||||
{
|
||||
if (ItemTemplate const* childTemplate = sObjectMgr->GetItemTemplate(childItemEntry->ChildItemID))
|
||||
{
|
||||
ItemPosCountVec childDest;
|
||||
CanStoreItem_InInventorySlots(CHILD_EQUIPMENT_SLOT_START, CHILD_EQUIPMENT_SLOT_END, childDest, childTemplate, count, false, nullptr, NULL_BAG, NULL_SLOT);
|
||||
if (Item* childItem = StoreNewItem(childDest, childTemplate->GetId(), update, {}, {}, context, {}, addToCollection))
|
||||
{
|
||||
childItem->SetCreator(item->GetGUID());
|
||||
childItem->SetItemFlag(ITEM_FIELD_FLAG_CHILD);
|
||||
item->SetChildItem(childItem->GetGUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (item->GetTemplate()->GetInventoryType() != INVTYPE_NON_EQUIP)
|
||||
UpdateAverageItemLevelTotal();
|
||||
}
|
||||
@@ -11352,8 +11223,6 @@ Item* Player::StoreItem(ItemPosCountVec const& dest, Item* pItem, bool update)
|
||||
lastItem = _StoreItem(pos, pItem, count, true, update);
|
||||
}
|
||||
|
||||
AutoUnequipChildItem(lastItem);
|
||||
|
||||
return lastItem;
|
||||
}
|
||||
|
||||
@@ -11588,105 +11457,6 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void Player::EquipChildItem(uint8 parentBag, uint8 parentSlot, Item* parentItem)
|
||||
{
|
||||
if (ItemChildEquipmentEntry const* itemChildEquipment = sDB2Manager.GetItemChildEquipment(parentItem->GetEntry()))
|
||||
{
|
||||
if (Item* childItem = GetChildItemByGuid(parentItem->GetChildItem()))
|
||||
{
|
||||
uint16 childDest = (INVENTORY_SLOT_BAG_0 << 8) | itemChildEquipment->ChildItemEquipSlot;
|
||||
if (childItem->GetPos() != childDest)
|
||||
{
|
||||
Item* dstItem = GetItemByPos(childDest);
|
||||
if (!dstItem) // empty slot, simple case
|
||||
{
|
||||
RemoveItem(childItem->GetBagSlot(), childItem->GetSlot(), true);
|
||||
EquipItem(childDest, childItem, true);
|
||||
AutoUnequipOffhandIfNeed();
|
||||
}
|
||||
else // have currently equipped item, not simple case
|
||||
{
|
||||
uint8 dstbag = dstItem->GetBagSlot();
|
||||
uint8 dstslot = dstItem->GetSlot();
|
||||
|
||||
InventoryResult msg = CanUnequipItem(childDest, !childItem->IsBag());
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
SendEquipError(msg, dstItem);
|
||||
return;
|
||||
}
|
||||
|
||||
// check dest->src move possibility but try to store currently equipped item in the bag where the parent item is
|
||||
ItemPosCountVec sSrc;
|
||||
uint16 eSrc = 0;
|
||||
if (IsInventoryPos(parentBag, parentSlot))
|
||||
{
|
||||
msg = CanStoreItem(parentBag, NULL_SLOT, sSrc, dstItem, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
msg = CanStoreItem(NULL_BAG, NULL_SLOT, sSrc, dstItem, true);
|
||||
}
|
||||
else if (IsBankPos(parentBag, parentSlot))
|
||||
{
|
||||
msg = CanBankItem(parentBag, NULL_SLOT, sSrc, dstItem, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
msg = CanBankItem(NULL_BAG, NULL_SLOT, sSrc, dstItem, true);
|
||||
}
|
||||
else if (IsEquipmentPos(parentBag, parentSlot))
|
||||
{
|
||||
msg = CanEquipItem(parentSlot, eSrc, dstItem, true);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
msg = CanUnequipItem(eSrc, true);
|
||||
}
|
||||
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
SendEquipError(msg, dstItem, childItem);
|
||||
return;
|
||||
}
|
||||
|
||||
// now do moves, remove...
|
||||
RemoveItem(dstbag, dstslot, false);
|
||||
RemoveItem(childItem->GetBagSlot(), childItem->GetSlot(), false);
|
||||
|
||||
// add to dest
|
||||
EquipItem(childDest, childItem, true);
|
||||
|
||||
// add to src
|
||||
if (IsInventoryPos(parentBag, parentSlot))
|
||||
StoreItem(sSrc, dstItem, true);
|
||||
else if (IsBankPos(parentBag, parentSlot))
|
||||
BankItem(sSrc, dstItem, true);
|
||||
else if (IsEquipmentPos(parentBag, parentSlot))
|
||||
EquipItem(eSrc, dstItem, true);
|
||||
|
||||
AutoUnequipOffhandIfNeed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::AutoUnequipChildItem(Item* parentItem)
|
||||
{
|
||||
if (sDB2Manager.GetItemChildEquipment(parentItem->GetEntry()))
|
||||
{
|
||||
if (Item* childItem = GetChildItemByGuid(parentItem->GetChildItem()))
|
||||
{
|
||||
if (IsChildEquipmentPos(childItem->GetPos()))
|
||||
return;
|
||||
|
||||
ItemPosCountVec dest;
|
||||
uint32 count = childItem->GetCount();
|
||||
InventoryResult result = CanStoreItem_InInventorySlots(CHILD_EQUIPMENT_SLOT_START, CHILD_EQUIPMENT_SLOT_END, dest, childItem->GetTemplate(), count, false, childItem, NULL_BAG, NULL_SLOT);
|
||||
if (result != EQUIP_ERR_OK)
|
||||
return;
|
||||
|
||||
RemoveItem(childItem->GetBagSlot(), childItem->GetSlot(), true);
|
||||
StoreItem(dest, childItem, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::QuickEquipItem(uint16 pos, Item* pItem)
|
||||
{
|
||||
if (pItem)
|
||||
@@ -11842,8 +11612,6 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
|
||||
if (IsInWorld() && update)
|
||||
pItem->SendUpdateToPlayer(this);
|
||||
|
||||
AutoUnequipChildItem(pItem);
|
||||
|
||||
if (bag == INVENTORY_SLOT_BAG_0)
|
||||
UpdateAverageItemLevelEquipped();
|
||||
}
|
||||
@@ -12504,7 +12272,6 @@ void Player::SwapItem(uint16 src, uint16 dst)
|
||||
{
|
||||
if (IsEquipmentPos(src))
|
||||
{
|
||||
AutoUnequipChildItem(parentItem); // we need to unequip child first since it cannot go into whatever is going to happen next
|
||||
SwapItem(dst, src); // src is now empty
|
||||
SwapItem(parentItem->GetPos(), dst);// dst is now empty
|
||||
return;
|
||||
@@ -12517,7 +12284,6 @@ void Player::SwapItem(uint16 src, uint16 dst)
|
||||
{
|
||||
if (IsEquipmentPos(dst))
|
||||
{
|
||||
AutoUnequipChildItem(parentItem); // we need to unequip child first since it cannot go into whatever is going to happen next
|
||||
SwapItem(src, dst); // dst is now empty
|
||||
SwapItem(parentItem->GetPos(), src);// src is now empty
|
||||
return;
|
||||
@@ -12646,9 +12412,6 @@ void Player::SwapItem(uint16 src, uint16 dst)
|
||||
else
|
||||
return;
|
||||
|
||||
if (msg == EQUIP_ERR_OK && IsEquipmentPos(dst) && !pSrcItem->GetChildItem().IsEmpty())
|
||||
msg = CanEquipChildItem(pSrcItem);
|
||||
|
||||
// can be merge/fill
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
@@ -12663,9 +12426,6 @@ void Player::SwapItem(uint16 src, uint16 dst)
|
||||
else if (IsEquipmentPos(dst))
|
||||
{
|
||||
EquipItem(eDest, pSrcItem, true);
|
||||
if (!pSrcItem->GetChildItem().IsEmpty())
|
||||
EquipChildItem(srcbag, srcslot, pSrcItem);
|
||||
|
||||
AutoUnequipOffhandIfNeed();
|
||||
}
|
||||
}
|
||||
@@ -12723,9 +12483,6 @@ void Player::SwapItem(uint16 src, uint16 dst)
|
||||
msg = CanUnequipItem(eDest2, true);
|
||||
}
|
||||
|
||||
if (msg == EQUIP_ERR_OK && IsEquipmentPos(dst) && !pSrcItem->GetChildItem().IsEmpty())
|
||||
msg = CanEquipChildItem(pSrcItem);
|
||||
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
SendEquipError(msg, pDstItem, pSrcItem);
|
||||
@@ -12811,8 +12568,6 @@ void Player::SwapItem(uint16 src, uint16 dst)
|
||||
else if (IsEquipmentPos(dst))
|
||||
{
|
||||
EquipItem(eDest, pSrcItem, true);
|
||||
if (!pSrcItem->GetChildItem().IsEmpty())
|
||||
EquipChildItem(srcbag, srcslot, pSrcItem);
|
||||
}
|
||||
|
||||
// add to src
|
||||
@@ -14803,7 +14558,7 @@ void Player::RewardQuestPackage(uint32 questPackageId, ItemContext context, uint
|
||||
ItemPosCountVec dest;
|
||||
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, questPackageItem->ItemID, questPackageItem->ItemQuantity) == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, GenerateItemRandomBonusListId(questPackageItem->ItemID), {}, context);
|
||||
Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, {}, context);
|
||||
SendNewItem(item, questPackageItem->ItemQuantity, true, false);
|
||||
}
|
||||
}
|
||||
@@ -14822,7 +14577,7 @@ void Player::RewardQuestPackage(uint32 questPackageId, ItemContext context, uint
|
||||
ItemPosCountVec dest;
|
||||
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, questPackageItem->ItemID, questPackageItem->ItemQuantity) == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, GenerateItemRandomBonusListId(questPackageItem->ItemID), {}, context);
|
||||
Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, {}, context);
|
||||
SendNewItem(item, questPackageItem->ItemQuantity, true, false);
|
||||
}
|
||||
}
|
||||
@@ -14882,7 +14637,7 @@ void Player::RewardQuest(Quest const* quest, LootItemType rewardType, uint32 rew
|
||||
ItemPosCountVec dest;
|
||||
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardItemCount[i]) == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* item = StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId), {}, ItemContext::Quest_Reward);
|
||||
Item* item = StoreNewItem(dest, itemId, true, {}, ItemContext::Quest_Reward);
|
||||
SendNewItem(item, quest->RewardItemCount[i], true, false);
|
||||
}
|
||||
else if (quest->IsDFQuest())
|
||||
@@ -14927,7 +14682,7 @@ void Player::RewardQuest(Quest const* quest, LootItemType rewardType, uint32 rew
|
||||
ItemPosCountVec dest;
|
||||
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, rewardId, quest->RewardChoiceItemCount[i]) == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* item = StoreNewItem(dest, rewardId, true, GenerateItemRandomBonusListId(rewardId), {}, ItemContext::Quest_Reward);
|
||||
Item* item = StoreNewItem(dest, rewardId, true, {}, ItemContext::Quest_Reward);
|
||||
SendNewItem(item, quest->RewardChoiceItemCount[i], true, false);
|
||||
}
|
||||
}
|
||||
@@ -17779,13 +17534,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
|
||||
// must be before inventory (some items required reputation check)
|
||||
m_reputationMgr->LoadFromDB(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_REPUTATION));
|
||||
|
||||
_LoadInventory(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INVENTORY),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ARTIFACTS),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AZERITE),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AZERITE_MILESTONE_POWERS),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AZERITE_UNLOCKED_ESSENCES),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AZERITE_EMPOWERED),
|
||||
time_diff);
|
||||
_LoadInventory(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INVENTORY), time_diff);
|
||||
|
||||
if (IsVoidStorageUnlocked())
|
||||
_LoadVoidStorage(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_VOID_STORAGE));
|
||||
@@ -17796,13 +17545,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
|
||||
StartLoadingActionButtons();
|
||||
|
||||
// unread mails and next delivery time, actual mails not loaded
|
||||
_LoadMail(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAILS),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_ARTIFACT),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE_MILESTONE_POWER),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE_UNLOCKED_ESSENCE),
|
||||
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE_EMPOWERED));
|
||||
_LoadMail(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAILS), holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS));
|
||||
|
||||
m_social = sSocialMgr->LoadFromDB(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST), GetGUID());
|
||||
|
||||
@@ -18231,9 +17974,7 @@ void Player::LoadCorpse(PreparedQueryResult result)
|
||||
RemoveAtLoginFlag(AT_LOGIN_RESURRECT);
|
||||
}
|
||||
|
||||
void Player::_LoadInventory(PreparedQueryResult result, PreparedQueryResult artifactsResult, PreparedQueryResult azeriteResult,
|
||||
PreparedQueryResult azeriteItemMilestonePowersResult, PreparedQueryResult azeriteItemUnlockedEssencesResult,
|
||||
PreparedQueryResult azeriteEmpoweredItemResult, uint32 timeDiff)
|
||||
void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
||||
// SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text,
|
||||
@@ -18263,10 +18004,6 @@ void Player::_LoadInventory(PreparedQueryResult result, PreparedQueryResult arti
|
||||
//NOTE2: the "order by `slot`" is needed because mainhand weapons are (wrongly?)
|
||||
//expected to be equipped before offhand items (@todo fixme)
|
||||
|
||||
std::unordered_map<ObjectGuid::LowType, ItemAdditionalLoadInfo> additionalData;
|
||||
ItemAdditionalLoadInfo::Init(&additionalData, artifactsResult, azeriteResult, azeriteItemMilestonePowersResult,
|
||||
azeriteItemUnlockedEssencesResult, azeriteEmpoweredItemResult);
|
||||
|
||||
if (result)
|
||||
{
|
||||
uint32 zoneId = GetZoneId();
|
||||
@@ -18283,36 +18020,13 @@ void Player::_LoadInventory(PreparedQueryResult result, PreparedQueryResult arti
|
||||
Field* fields = result->Fetch();
|
||||
if (Item* item = _LoadItem(trans, zoneId, timeDiff, fields))
|
||||
{
|
||||
if (ItemAdditionalLoadInfo* addionalDataPtr = Trinity::Containers::MapGetValuePtr(additionalData, fields[0].GetUInt64()))
|
||||
{
|
||||
if (item->GetTemplate()->GetArtifactID() && addionalDataPtr->Artifact)
|
||||
item->LoadArtifactData(this, addionalDataPtr->Artifact->Xp, addionalDataPtr->Artifact->ArtifactAppearanceId,
|
||||
addionalDataPtr->Artifact->ArtifactTierId, addionalDataPtr->Artifact->ArtifactPowers);
|
||||
}
|
||||
|
||||
ObjectGuid bagGuid = fields[51].GetUInt64() ? ObjectGuid::Create<HighGuid::Item>(fields[51].GetUInt64()) : ObjectGuid::Empty;
|
||||
uint8 slot = fields[52].GetUInt8();
|
||||
ObjectGuid bagGuid = fields[49].GetUInt64() ? ObjectGuid::Create<HighGuid::Item>(fields[49].GetUInt64()) : ObjectGuid::Empty;
|
||||
uint8 slot = fields[50].GetUInt8();
|
||||
|
||||
GetSession()->GetCollectionMgr()->CheckHeirloomUpgrades(item);
|
||||
GetSession()->GetCollectionMgr()->AddItemAppearance(item);
|
||||
|
||||
InventoryResult err = EQUIP_ERR_OK;
|
||||
if (item->HasItemFlag(ITEM_FIELD_FLAG_CHILD))
|
||||
{
|
||||
if (Item* parent = GetItemByGuid(item->GetCreator()))
|
||||
{
|
||||
parent->SetChildItem(item->GetGUID());
|
||||
item->CopyArtifactDataFromParent(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("entities.player", "Player::_LoadInventory: Player '{}' ({}) has child item ({}, entry: {}) which can't be loaded into inventory because parent item was not found (Bag {}, slot: {}). Item will be sent by mail.",
|
||||
GetName(), GetGUID().ToString(), item->GetGUID().ToString(), item->GetEntry(), bagGuid.ToString(), slot);
|
||||
item->DeleteFromInventoryDB(trans);
|
||||
problematicItems.push_back(item);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Item is not in bag
|
||||
if (!bagGuid)
|
||||
@@ -18431,15 +18145,8 @@ void Player::_LoadVoidStorage(PreparedQueryResult result)
|
||||
uint32 itemEntry = fields[1].GetUInt32();
|
||||
uint8 slot = fields[2].GetUInt8();
|
||||
ObjectGuid creatorGuid = fields[3].GetUInt64() ? ObjectGuid::Create<HighGuid::Player>(fields[3].GetUInt64()) : ObjectGuid::Empty;
|
||||
ItemRandomBonusListId randomBonusListId = fields[4].GetUInt32();
|
||||
uint32 fixedScalingLevel = fields[5].GetUInt32();
|
||||
uint32 artifactKnowledgeLevel = fields[6].GetUInt32();
|
||||
ItemContext context = ItemContext(fields[7].GetUInt8());
|
||||
std::vector<int32> bonusListIDs;
|
||||
for (std::string_view bonusListIDtoken : Trinity::Tokenize(fields[8].GetStringView(), ' ', false))
|
||||
if (Optional<int32> bonusListID = Trinity::StringTo<int32>(bonusListIDtoken))
|
||||
bonusListIDs.push_back(*bonusListID);
|
||||
|
||||
uint32 fixedScalingLevel = fields[4].GetUInt32();
|
||||
ItemContext context = ItemContext(fields[5].GetUInt8());
|
||||
if (!itemId)
|
||||
{
|
||||
TC_LOG_ERROR("entities.player", "Player::_LoadVoidStorage: Player '{}' ({}) has an item with an invalid id (item id: {}, entry: {}).",
|
||||
@@ -18461,8 +18168,7 @@ void Player::_LoadVoidStorage(PreparedQueryResult result)
|
||||
continue;
|
||||
}
|
||||
|
||||
_voidStorageItems[slot] = new VoidStorageItem(itemId, itemEntry, creatorGuid, randomBonusListId, fixedScalingLevel, artifactKnowledgeLevel,
|
||||
context, bonusListIDs);
|
||||
_voidStorageItems[slot] = new VoidStorageItem(itemId, itemEntry, creatorGuid, fixedScalingLevel, context);
|
||||
|
||||
WorldPackets::Item::ItemInstance voidInstance;
|
||||
voidInstance.Initialize(_voidStorageItems[slot]);
|
||||
@@ -18600,7 +18306,7 @@ Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint3
|
||||
}
|
||||
|
||||
// load mailed item which should receive current player
|
||||
Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint64 mailId, Mail* mail, Field* fields, ItemAdditionalLoadInfo* addionalData)
|
||||
Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint64 mailId, Mail* mail, Field* fields)
|
||||
{
|
||||
ObjectGuid::LowType itemGuid = fields[0].GetUInt64();
|
||||
uint32 itemEntry = fields[1].GetUInt32();
|
||||
@@ -18625,7 +18331,7 @@ Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint
|
||||
|
||||
Item* item = NewItemOrBag(proto);
|
||||
|
||||
ObjectGuid ownerGuid = fields[51].GetUInt64() ? ObjectGuid::Create<HighGuid::Player>(fields[51].GetUInt64()) : ObjectGuid::Empty;
|
||||
ObjectGuid ownerGuid = fields[49].GetUInt64() ? ObjectGuid::Create<HighGuid::Player>(fields[49].GetUInt64()) : ObjectGuid::Empty;
|
||||
if (!item->LoadFromDB(itemGuid, ownerGuid, fields, itemEntry))
|
||||
{
|
||||
TC_LOG_ERROR("entities.player", "Player::_LoadMailedItems: Item (GUID: {}) in mail ({}) doesn't exist, deleted from mail.", itemGuid, mailId);
|
||||
@@ -18641,13 +18347,6 @@ Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (addionalData)
|
||||
{
|
||||
if (item->GetTemplate()->GetArtifactID() && addionalData->Artifact)
|
||||
item->LoadArtifactData(player, addionalData->Artifact->Xp, addionalData->Artifact->ArtifactAppearanceId,
|
||||
addionalData->Artifact->ArtifactTierId, addionalData->Artifact->ArtifactPowers);
|
||||
}
|
||||
|
||||
if (mail)
|
||||
mail->AddItem(itemGuid, itemEntry);
|
||||
|
||||
@@ -18657,8 +18356,7 @@ Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint
|
||||
return item;
|
||||
}
|
||||
|
||||
void Player::_LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult, PreparedQueryResult artifactResult, PreparedQueryResult azeriteItemResult,
|
||||
PreparedQueryResult azeriteItemMilestonePowersResult, PreparedQueryResult azeriteItemUnlockedEssencesResult, PreparedQueryResult azeriteEmpoweredItemResult)
|
||||
void Player::_LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult)
|
||||
{
|
||||
std::unordered_map<uint64, Mail*> mailById;
|
||||
|
||||
@@ -18699,15 +18397,12 @@ void Player::_LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mail
|
||||
|
||||
if (mailItemsResult)
|
||||
{
|
||||
std::unordered_map<ObjectGuid::LowType, ItemAdditionalLoadInfo> additionalData;
|
||||
ItemAdditionalLoadInfo::Init(&additionalData, artifactResult, azeriteItemResult, azeriteItemMilestonePowersResult,
|
||||
azeriteItemUnlockedEssencesResult, azeriteEmpoweredItemResult);
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = mailItemsResult->Fetch();
|
||||
uint64 mailId = fields[52].GetUInt64();
|
||||
_LoadMailedItem(GetGUID(), this, mailId, mailById[mailId], fields, Trinity::Containers::MapGetValuePtr(additionalData, fields[0].GetUInt64()));
|
||||
uint64 mailId = fields[50].GetUInt64();
|
||||
_LoadMailedItem(GetGUID(), this, mailId, mailById[mailId], fields);
|
||||
} while (mailItemsResult->NextRow());
|
||||
}
|
||||
|
||||
@@ -20114,14 +19809,8 @@ void Player::_SaveVoidStorage(CharacterDatabaseTransaction trans)
|
||||
stmt->setUInt32(2, _voidStorageItems[i]->ItemEntry);
|
||||
stmt->setUInt8(3, i);
|
||||
stmt->setUInt64(4, _voidStorageItems[i]->CreatorGuid.GetCounter());
|
||||
stmt->setUInt32(5, _voidStorageItems[i]->RandomBonusListId);
|
||||
stmt->setUInt32(6, _voidStorageItems[i]->FixedScalingLevel);
|
||||
stmt->setUInt32(7, _voidStorageItems[i]->ArtifactKnowledgeLevel);
|
||||
stmt->setUInt8(8, AsUnderlyingType(_voidStorageItems[i]->Context));
|
||||
std::ostringstream bonusListIDs;
|
||||
for (int32 bonusListID : _voidStorageItems[i]->BonusListIDs)
|
||||
bonusListIDs << bonusListID << ' ';
|
||||
stmt->setString(9, bonusListIDs.str());
|
||||
stmt->setUInt32(5, _voidStorageItems[i]->FixedScalingLevel);
|
||||
stmt->setUInt8(6, AsUnderlyingType(_voidStorageItems[i]->Context));
|
||||
}
|
||||
|
||||
trans->Append(stmt);
|
||||
@@ -22267,7 +21956,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
|
||||
}
|
||||
|
||||
Item* it = bStore ?
|
||||
StoreNewItem(vDest, item, true, GenerateItemRandomBonusListId(item), {}, ItemContext::Vendor, &crItem->BonusListIDs, false) :
|
||||
StoreNewItem(vDest, item, true, {}, ItemContext::Vendor, false) :
|
||||
EquipNewItem(uiDest, item, ItemContext::Vendor, true);
|
||||
if (it)
|
||||
{
|
||||
@@ -25800,7 +25489,7 @@ void Player::StoreLootItem(ObjectGuid lootWorldObjectGuid, uint8 lootSlot, Loot*
|
||||
InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* newitem = StoreNewItem(dest, item->itemid, true, item->randomBonusListId, item->GetAllowedLooters(), item->context);
|
||||
Item* newitem = StoreNewItem(dest, item->itemid, true, item->GetAllowedLooters(), item->context);
|
||||
|
||||
if (ffaItem)
|
||||
{
|
||||
@@ -27647,7 +27336,7 @@ bool Player::AddItem(uint32 itemId, uint32 count)
|
||||
return false;
|
||||
}
|
||||
|
||||
Item* item = StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId));
|
||||
Item* item = StoreNewItem(dest, itemId, true);
|
||||
if (item)
|
||||
SendNewItem(item, count, true, false);
|
||||
else
|
||||
|
||||
@@ -38,7 +38,6 @@ struct AccessRequirement;
|
||||
struct AchievementEntry;
|
||||
struct AreaTableEntry;
|
||||
struct AreaTriggerEntry;
|
||||
struct ArtifactPowerRankEntry;
|
||||
struct BarberShopStyleEntry;
|
||||
struct BattlegroundTemplate;
|
||||
struct CharTitlesEntry;
|
||||
@@ -47,7 +46,6 @@ struct ChrSpecializationEntry;
|
||||
struct CreatureTemplate;
|
||||
struct CurrencyTypesEntry;
|
||||
struct FactionEntry;
|
||||
struct ItemAdditionalLoadInfo;
|
||||
struct ItemExtendedCostEntry;
|
||||
struct ItemLimitCategoryEntry;
|
||||
struct ItemSetEffect;
|
||||
@@ -847,18 +845,8 @@ enum PlayerLoginQueryIndex
|
||||
PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS,
|
||||
PLAYER_LOGIN_QUERY_LOAD_REPUTATION,
|
||||
PLAYER_LOGIN_QUERY_LOAD_INVENTORY,
|
||||
PLAYER_LOGIN_QUERY_LOAD_ARTIFACTS,
|
||||
PLAYER_LOGIN_QUERY_LOAD_AZERITE,
|
||||
PLAYER_LOGIN_QUERY_LOAD_AZERITE_MILESTONE_POWERS,
|
||||
PLAYER_LOGIN_QUERY_LOAD_AZERITE_UNLOCKED_ESSENCES,
|
||||
PLAYER_LOGIN_QUERY_LOAD_AZERITE_EMPOWERED,
|
||||
PLAYER_LOGIN_QUERY_LOAD_MAILS,
|
||||
PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS,
|
||||
PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_ARTIFACT,
|
||||
PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE,
|
||||
PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE_MILESTONE_POWER,
|
||||
PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE_UNLOCKED_ESSENCE,
|
||||
PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE_EMPOWERED,
|
||||
PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST,
|
||||
PLAYER_LOGIN_QUERY_LOAD_HOME_BIND,
|
||||
PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS,
|
||||
@@ -1017,25 +1005,17 @@ struct BGData
|
||||
|
||||
struct VoidStorageItem
|
||||
{
|
||||
VoidStorageItem() : ItemId(0), ItemEntry(0), RandomBonusListId(0), FixedScalingLevel(0), ArtifactKnowledgeLevel(0), Context(ItemContext::NONE) { }
|
||||
VoidStorageItem(uint64 id, uint32 entry, ObjectGuid const& creator, ItemRandomBonusListId randomBonusListId,
|
||||
uint32 fixedScalingLevel, uint32 artifactKnowledgeLevel, ItemContext context, std::vector<int32> const& bonuses)
|
||||
: ItemId(id), ItemEntry(entry), CreatorGuid(creator), RandomBonusListId(randomBonusListId),
|
||||
FixedScalingLevel(fixedScalingLevel), ArtifactKnowledgeLevel(artifactKnowledgeLevel), Context(context)
|
||||
{
|
||||
BonusListIDs.insert(BonusListIDs.end(), bonuses.begin(), bonuses.end());
|
||||
}
|
||||
VoidStorageItem(VoidStorageItem&& vsi) noexcept : ItemId(vsi.ItemId), ItemEntry(vsi.ItemEntry), CreatorGuid(vsi.CreatorGuid), RandomBonusListId(vsi.RandomBonusListId),
|
||||
FixedScalingLevel(vsi.FixedScalingLevel), ArtifactKnowledgeLevel(vsi.ArtifactKnowledgeLevel), Context(vsi.Context), BonusListIDs(std::move(vsi.BonusListIDs)) { }
|
||||
VoidStorageItem() : ItemId(0), ItemEntry(0), FixedScalingLevel(0), Context(ItemContext::NONE) { }
|
||||
VoidStorageItem(uint64 id, uint32 entry, ObjectGuid const& creator, uint32 fixedScalingLevel, ItemContext context) :
|
||||
ItemId(id), ItemEntry(entry), CreatorGuid(creator), FixedScalingLevel(fixedScalingLevel), Context(context) { }
|
||||
VoidStorageItem(VoidStorageItem&& vsi) noexcept : ItemId(vsi.ItemId), ItemEntry(vsi.ItemEntry), CreatorGuid(vsi.CreatorGuid),
|
||||
FixedScalingLevel(vsi.FixedScalingLevel), Context(vsi.Context) { }
|
||||
|
||||
uint64 ItemId;
|
||||
uint32 ItemEntry;
|
||||
ObjectGuid CreatorGuid;
|
||||
ItemRandomBonusListId RandomBonusListId;
|
||||
uint32 FixedScalingLevel;
|
||||
uint32 ArtifactKnowledgeLevel;
|
||||
ItemContext Context;
|
||||
std::vector<int32> BonusListIDs;
|
||||
};
|
||||
|
||||
struct ResurrectionData
|
||||
@@ -1340,7 +1320,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
uint32 GetFreeInventorySpace() const;
|
||||
Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const;
|
||||
Item* GetShield(bool useable = false) const;
|
||||
Item* GetChildItemByGuid(ObjectGuid guid) const;
|
||||
static WeaponAttackType GetAttackBySlot(uint8 slot, InventoryType inventoryType); // MAX_ATTACK if not weapon slot
|
||||
std::vector<Item*>& GetItemUpdateQueue() { return m_itemUpdateQueue; }
|
||||
static bool IsInventoryPos(uint16 pos) { return IsInventoryPos(pos >> 8, pos & 255); }
|
||||
@@ -1377,9 +1356,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const;
|
||||
InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading = true) const;
|
||||
|
||||
// This method must be called before equipping parent item!
|
||||
InventoryResult CanEquipChildItem(Item* parentItem) const;
|
||||
|
||||
InventoryResult CanEquipUniqueItem(Item* pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
|
||||
InventoryResult CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
|
||||
InventoryResult CanUnequipItems(uint32 item, uint32 count) const;
|
||||
@@ -1389,14 +1365,12 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
bool HasItemTotemCategory(uint32 TotemCategory) const;
|
||||
InventoryResult CanUseItem(ItemTemplate const* pItem, bool skipRequiredLevelCheck = false) const;
|
||||
InventoryResult CanRollNeedForItem(ItemTemplate const* item, Map const* map, bool restrictOnlyLfg) const;
|
||||
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, ItemRandomBonusListId randomBonusListId = 0, GuidSet const& allowedLooters = GuidSet(),
|
||||
ItemContext context = ItemContext::NONE, std::vector<int32> const* bonusListIDs = nullptr, bool addToCollection = true);
|
||||
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, GuidSet const& allowedLooters = GuidSet(),
|
||||
ItemContext context = ItemContext::NONE, bool addToCollection = true);
|
||||
Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
|
||||
Item* EquipNewItem(uint16 pos, uint32 item, ItemContext context, bool update);
|
||||
Item* EquipItem(uint16 pos, Item* pItem, bool update);
|
||||
void AutoUnequipOffhandIfNeed(bool force = false);
|
||||
void EquipChildItem(uint8 parentBag, uint8 parentSlot, Item* parentItem);
|
||||
void AutoUnequipChildItem(Item* parentItem);
|
||||
bool StoreNewItemInBestSlots(uint32 itemId, uint32 amount, ItemContext context);
|
||||
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, ItemContext context = ItemContext::NONE, bool broadcast = false, bool createdByPlayer = false);
|
||||
void AutoStoreLoot(uint32 loot_id, LootStore const& store, ItemContext context = ItemContext::NONE, bool broadcast = false, bool createdByPlayer = false) { AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, context, broadcast, createdByPlayer); }
|
||||
@@ -2877,13 +2851,10 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void _LoadActions(PreparedQueryResult result);
|
||||
void _LoadAuras(PreparedQueryResult auraResult, PreparedQueryResult effectResult, uint32 timediff);
|
||||
void _LoadGlyphAuras();
|
||||
void _LoadInventory(PreparedQueryResult result, PreparedQueryResult artifactsResult, PreparedQueryResult azeriteResult,
|
||||
PreparedQueryResult azeriteItemMilestonePowersResult, PreparedQueryResult azeriteItemUnlockedEssencesResult,
|
||||
PreparedQueryResult azeriteEmpoweredItemResult, uint32 timeDiff);
|
||||
void _LoadInventory(PreparedQueryResult result, uint32 timeDiff);
|
||||
void _LoadVoidStorage(PreparedQueryResult result);
|
||||
void _LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult, PreparedQueryResult artifactResult, PreparedQueryResult azeriteItemResult,
|
||||
PreparedQueryResult azeriteItemMilestonePowersResult, PreparedQueryResult azeriteItemUnlockedEssencesResult, PreparedQueryResult azeriteEmpoweredItemResult);
|
||||
static Item* _LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint64 mailId, Mail* mail, Field* fields, ItemAdditionalLoadInfo* addionalData);
|
||||
void _LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult);
|
||||
static Item* _LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint64 mailId, Mail* mail, Field* fields);
|
||||
void _LoadQuestStatus(PreparedQueryResult result);
|
||||
void _LoadQuestStatusObjectives(PreparedQueryResult result);
|
||||
void _LoadQuestStatusRewarded(PreparedQueryResult result);
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Item.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "KillRewarder.h"
|
||||
#include "ListUtils.h"
|
||||
#include "Log.h"
|
||||
@@ -10739,7 +10738,7 @@ void Unit::SetMeleeAnimKitId(uint16 animKitId)
|
||||
Loot* loot = new Loot(creature->GetMap(), creature->GetGUID(), LOOT_CORPSE, dungeonEncounter ? group : nullptr);
|
||||
|
||||
if (uint32 lootid = creature->GetLootId())
|
||||
loot->FillLoot(lootid, LootTemplates_Creature, looter, dungeonEncounter != nullptr, false, creature->GetLootMode(), ItemBonusMgr::GetContextForPlayer(creature->GetMap()->GetMapDifficulty(), looter));
|
||||
loot->FillLoot(lootid, LootTemplates_Creature, looter, dungeonEncounter != nullptr, false, creature->GetLootMode());
|
||||
|
||||
if (creature->GetLootMode() > 0)
|
||||
loot->generateMoneyLoot(creature->GetCreatureDifficulty()->GoldMin, creature->GetCreatureDifficulty()->GoldMax);
|
||||
@@ -10765,7 +10764,7 @@ void Unit::SetMeleeAnimKitId(uint16 animKitId)
|
||||
loot->SetDungeonEncounterId(dungeonEncounter->ID);
|
||||
|
||||
if (uint32 lootid = creature->GetLootId())
|
||||
loot->FillLoot(lootid, LootTemplates_Creature, tapper, true, false, creature->GetLootMode(), ItemBonusMgr::GetContextForPlayer(creature->GetMap()->GetMapDifficulty(), tapper));
|
||||
loot->FillLoot(lootid, LootTemplates_Creature, tapper, true, false, creature->GetLootMode());
|
||||
|
||||
if (creature->GetLootMode() > 0)
|
||||
loot->generateMoneyLoot(creature->GetCreatureDifficulty()->GoldMin, creature->GetCreatureDifficulty()->GoldMax);
|
||||
@@ -11973,12 +11972,6 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form, uint32 spellId) const
|
||||
|
||||
if (Player const* player = ToPlayer())
|
||||
{
|
||||
if (Aura* artifactAura = GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE))
|
||||
if (Item* artifact = player->GetItemByGuid(artifactAura->GetCastItemGUID()))
|
||||
if (ArtifactAppearanceEntry const* artifactAppearance = sArtifactAppearanceStore.LookupEntry(artifact->GetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID)))
|
||||
if (ShapeshiftForm(artifactAppearance->OverrideShapeshiftFormID) == form)
|
||||
return artifactAppearance->OverrideShapeshiftDisplayID;
|
||||
|
||||
if (ShapeshiftFormModelData const* formModelData = sDB2Manager.GetShapeshiftFormModelData(GetRace(), player->GetNativeGender(), form))
|
||||
{
|
||||
bool useRandom = false;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#define VISUAL_WAYPOINT 1 // Creature Entry ID used for waypoints show, visible only for GMs
|
||||
#define WORLD_TRIGGER 12999
|
||||
#define ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE 197886
|
||||
#define SPELL_DH_DOUBLE_JUMP 196055
|
||||
#define DISPLAYID_HIDDEN_MOUNT 73200
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "GuildMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Item.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "Language.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "Log.h"
|
||||
@@ -9824,15 +9823,6 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, VendorItem const& vItem,
|
||||
TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has `maxcount`=0 for item {} of vendor (Entry: {}) but `incrtime`<>0, ignore", vItem.item, vendor_entry);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int32 bonusListId : vItem.BonusListIDs)
|
||||
{
|
||||
if (ItemBonusMgr::GetItemBonuses(bonusListId).empty())
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have Item (Entry: {}) with invalid bonus {} for vendor ({}), ignore", vItem.item, bonusListId, vendor_entry);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VendorItemData const* vItems = GetNpcVendorItemList(vendor_entry);
|
||||
|
||||
@@ -1,241 +0,0 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "WorldSession.h"
|
||||
#include "ArtifactPackets.h"
|
||||
#include "ConditionMgr.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTables.h"
|
||||
#include "Item.h"
|
||||
#include "Player.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellPackets.h"
|
||||
|
||||
void WorldSession::HandleArtifactAddPower(WorldPackets::Artifact::ArtifactAddPower& artifactAddPower)
|
||||
{
|
||||
if (!_player->GetGameObjectIfCanInteractWith(artifactAddPower.ForgeGUID, GAMEOBJECT_TYPE_ITEM_FORGE))
|
||||
return;
|
||||
|
||||
Item* artifact = _player->GetItemByGuid(artifactAddPower.ArtifactGUID);
|
||||
if (!artifact || artifact->IsArtifactDisabled())
|
||||
return;
|
||||
|
||||
uint32 currentArtifactTier = artifact->GetModifier(ITEM_MODIFIER_ARTIFACT_TIER);
|
||||
|
||||
uint64 xpCost = 0;
|
||||
if (GtArtifactLevelXPEntry const* cost = sArtifactLevelXPGameTable.GetRow(artifact->GetTotalPurchasedArtifactPowers() + 1))
|
||||
xpCost = uint64(currentArtifactTier == MAX_ARTIFACT_TIER ? cost->XP2 : cost->XP);
|
||||
|
||||
if (xpCost > artifact->m_itemData->ArtifactXP)
|
||||
return;
|
||||
|
||||
if (artifactAddPower.PowerChoices.empty())
|
||||
return;
|
||||
|
||||
UF::ArtifactPower const* artifactPower = artifact->GetArtifactPower(artifactAddPower.PowerChoices[0].ArtifactPowerID);
|
||||
if (!artifactPower)
|
||||
return;
|
||||
|
||||
ArtifactPowerEntry const* artifactPowerEntry = sArtifactPowerStore.LookupEntry(artifactPower->ArtifactPowerID);
|
||||
if (!artifactPowerEntry)
|
||||
return;
|
||||
|
||||
if (artifactPowerEntry->Tier > currentArtifactTier)
|
||||
return;
|
||||
|
||||
uint32 maxRank = artifactPowerEntry->MaxPurchasableRank;
|
||||
if (artifactPowerEntry->Tier < currentArtifactTier)
|
||||
{
|
||||
if (artifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_FINAL)
|
||||
maxRank = 1;
|
||||
else if (artifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_MAX_RANK_WITH_TIER)
|
||||
maxRank += currentArtifactTier - artifactPowerEntry->Tier;
|
||||
}
|
||||
|
||||
if (artifactAddPower.PowerChoices[0].Rank != artifactPower->PurchasedRank + 1 ||
|
||||
artifactAddPower.PowerChoices[0].Rank > maxRank)
|
||||
return;
|
||||
|
||||
if (!(artifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_NO_LINK_REQUIRED))
|
||||
{
|
||||
if (std::vector<uint32> const* artifactPowerLinks = sDB2Manager.GetArtifactPowerLinks(artifactPower->ArtifactPowerID))
|
||||
{
|
||||
bool hasAnyLink = false;
|
||||
for (uint32 artifactPowerLinkId : *artifactPowerLinks)
|
||||
{
|
||||
ArtifactPowerEntry const* artifactPowerLink = sArtifactPowerStore.LookupEntry(artifactPowerLinkId);
|
||||
if (!artifactPowerLink)
|
||||
continue;
|
||||
|
||||
UF::ArtifactPower const* artifactPowerLinkLearned = artifact->GetArtifactPower(artifactPowerLinkId);
|
||||
if (!artifactPowerLinkLearned)
|
||||
continue;
|
||||
|
||||
if (artifactPowerLinkLearned->PurchasedRank >= artifactPowerLink->MaxPurchasableRank)
|
||||
{
|
||||
hasAnyLink = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasAnyLink)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower->ArtifactPowerID, artifactPower->CurrentRankWithBonus + 1 - 1); // need data for next rank, but -1 because of how db2 data is structured
|
||||
if (!artifactPowerRank)
|
||||
return;
|
||||
|
||||
artifact->SetArtifactPower(artifactPower->ArtifactPowerID, artifactPower->PurchasedRank + 1, artifactPower->CurrentRankWithBonus + 1);
|
||||
|
||||
if (artifact->IsEquipped())
|
||||
{
|
||||
for (UF::ArtifactPower const& power : artifact->m_itemData->ArtifactPowers)
|
||||
{
|
||||
ArtifactPowerEntry const* scaledArtifactPowerEntry = sArtifactPowerStore.AssertEntry(power.ArtifactPowerID);
|
||||
if (!(scaledArtifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS))
|
||||
continue;
|
||||
|
||||
ArtifactPowerRankEntry const* scaledArtifactPowerRank = sDB2Manager.GetArtifactPowerRank(scaledArtifactPowerEntry->ID, 0);
|
||||
if (!scaledArtifactPowerRank)
|
||||
continue;
|
||||
|
||||
artifact->SetArtifactPower(power.ArtifactPowerID, power.PurchasedRank, power.CurrentRankWithBonus + 1);
|
||||
}
|
||||
}
|
||||
|
||||
artifact->SetArtifactXP(artifact->m_itemData->ArtifactXP - xpCost);
|
||||
artifact->SetState(ITEM_CHANGED, _player);
|
||||
|
||||
uint32 totalPurchasedArtifactPower = artifact->GetTotalPurchasedArtifactPowers();
|
||||
uint32 artifactTier = 0;
|
||||
|
||||
for (ArtifactTierEntry const* tier : sArtifactTierStore)
|
||||
{
|
||||
if (artifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_FINAL && artifactPowerEntry->Tier < MAX_ARTIFACT_TIER)
|
||||
{
|
||||
artifactTier = artifactPowerEntry->Tier + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (totalPurchasedArtifactPower < tier->MaxNumTraits)
|
||||
{
|
||||
artifactTier = tier->ArtifactTier;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
artifactTier = std::max(artifactTier, currentArtifactTier);
|
||||
|
||||
for (uint32 i = currentArtifactTier; i <= artifactTier; ++i)
|
||||
artifact->InitArtifactPowers(artifact->GetTemplate()->GetArtifactID(), uint8(i));
|
||||
|
||||
artifact->SetModifier(ITEM_MODIFIER_ARTIFACT_TIER, artifactTier);
|
||||
}
|
||||
|
||||
void WorldSession::HandleArtifactSetAppearance(WorldPackets::Artifact::ArtifactSetAppearance& artifactSetAppearance)
|
||||
{
|
||||
if (!_player->GetGameObjectIfCanInteractWith(artifactSetAppearance.ForgeGUID, GAMEOBJECT_TYPE_ITEM_FORGE))
|
||||
return;
|
||||
|
||||
ArtifactAppearanceEntry const* artifactAppearance = sArtifactAppearanceStore.LookupEntry(artifactSetAppearance.ArtifactAppearanceID);
|
||||
if (!artifactAppearance)
|
||||
return;
|
||||
|
||||
Item* artifact = _player->GetItemByGuid(artifactSetAppearance.ArtifactGUID);
|
||||
if (!artifact)
|
||||
return;
|
||||
|
||||
ArtifactAppearanceSetEntry const* artifactAppearanceSet = sArtifactAppearanceSetStore.LookupEntry(artifactAppearance->ArtifactAppearanceSetID);
|
||||
if (!artifactAppearanceSet || artifactAppearanceSet->ArtifactID != artifact->GetTemplate()->GetArtifactID())
|
||||
return;
|
||||
|
||||
if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactAppearance->UnlockPlayerConditionID))
|
||||
if (!sConditionMgr->IsPlayerMeetingCondition(_player, playerCondition))
|
||||
return;
|
||||
|
||||
artifact->SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
|
||||
artifact->SetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID, artifactAppearance->ID);
|
||||
artifact->SetState(ITEM_CHANGED, _player);
|
||||
Item* childItem = _player->GetChildItemByGuid(artifact->GetChildItem());
|
||||
if (childItem)
|
||||
{
|
||||
childItem->SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
|
||||
childItem->SetState(ITEM_CHANGED, _player);
|
||||
}
|
||||
|
||||
if (artifact->IsEquipped())
|
||||
{
|
||||
// change weapon appearance
|
||||
_player->SetVisibleItemSlot(artifact->GetSlot(), artifact);
|
||||
if (childItem)
|
||||
_player->SetVisibleItemSlot(childItem->GetSlot(), childItem);
|
||||
|
||||
// change druid form appearance
|
||||
if (artifactAppearance->OverrideShapeshiftDisplayID && artifactAppearance->OverrideShapeshiftFormID && _player->GetShapeshiftForm() == ShapeshiftForm(artifactAppearance->OverrideShapeshiftFormID))
|
||||
_player->RestoreDisplayId(_player->IsMounted());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleConfirmArtifactRespec(WorldPackets::Artifact::ConfirmArtifactRespec& confirmArtifactRespec)
|
||||
{
|
||||
if (!_player->GetNPCIfCanInteractWith(confirmArtifactRespec.NpcGUID, UNIT_NPC_FLAG_ARTIFACT_POWER_RESPEC, UNIT_NPC_FLAG_2_NONE))
|
||||
return;
|
||||
|
||||
Item* artifact = _player->GetItemByGuid(confirmArtifactRespec.ArtifactGUID);
|
||||
if (!artifact || artifact->IsArtifactDisabled())
|
||||
return;
|
||||
|
||||
uint64 xpCost = 0;
|
||||
if (GtArtifactLevelXPEntry const* cost = sArtifactLevelXPGameTable.GetRow(artifact->GetTotalPurchasedArtifactPowers() + 1))
|
||||
xpCost = uint64(artifact->GetModifier(ITEM_MODIFIER_ARTIFACT_TIER) == 1 ? cost->XP2 : cost->XP);
|
||||
|
||||
if (xpCost > artifact->m_itemData->ArtifactXP)
|
||||
return;
|
||||
|
||||
uint64 newAmount = artifact->m_itemData->ArtifactXP - xpCost;
|
||||
for (uint32 i = 0; i <= artifact->GetTotalPurchasedArtifactPowers(); ++i)
|
||||
if (GtArtifactLevelXPEntry const* cost = sArtifactLevelXPGameTable.GetRow(i))
|
||||
newAmount += uint64(artifact->GetModifier(ITEM_MODIFIER_ARTIFACT_TIER) == 1 ? cost->XP2 : cost->XP);
|
||||
|
||||
for (UF::ArtifactPower const& artifactPower : artifact->m_itemData->ArtifactPowers)
|
||||
{
|
||||
uint8 oldPurchasedRank = artifactPower.PurchasedRank;
|
||||
if (!oldPurchasedRank)
|
||||
continue;
|
||||
|
||||
artifact->SetArtifactPower(artifactPower.ArtifactPowerID, artifactPower.PurchasedRank - oldPurchasedRank, artifactPower.CurrentRankWithBonus - oldPurchasedRank);
|
||||
}
|
||||
|
||||
for (UF::ArtifactPower const& power : artifact->m_itemData->ArtifactPowers)
|
||||
{
|
||||
ArtifactPowerEntry const* scaledArtifactPowerEntry = sArtifactPowerStore.AssertEntry(power.ArtifactPowerID);
|
||||
if (!(scaledArtifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS))
|
||||
continue;
|
||||
|
||||
ArtifactPowerRankEntry const* scaledArtifactPowerRank = sDB2Manager.GetArtifactPowerRank(scaledArtifactPowerEntry->ID, 0);
|
||||
if (!scaledArtifactPowerRank)
|
||||
continue;
|
||||
|
||||
artifact->SetArtifactPower(power.ArtifactPowerID, power.PurchasedRank, 0);
|
||||
}
|
||||
|
||||
artifact->SetArtifactXP(newAmount);
|
||||
artifact->SetState(ITEM_CHANGED, _player);
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "WorldSession.h"
|
||||
#include "AzeritePackets.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "NPCPackets.h"
|
||||
#include "Player.h"
|
||||
#include "SpellHistory.h"
|
||||
|
||||
void WorldSession::HandleAzeriteEssenceUnlockMilestone(WorldPackets::Azerite::AzeriteEssenceUnlockMilestone& azeriteEssenceUnlockMilestone)
|
||||
{
|
||||
}
|
||||
|
||||
void WorldSession::HandleAzeriteEssenceActivateEssence(WorldPackets::Azerite::AzeriteEssenceActivateEssence& azeriteEssenceActivateEssence)
|
||||
{
|
||||
}
|
||||
|
||||
void WorldSession::HandleAzeriteEmpoweredItemViewed(WorldPackets::Azerite::AzeriteEmpoweredItemViewed& azeriteEmpoweredItemViewed)
|
||||
{
|
||||
}
|
||||
|
||||
void WorldSession::HandleAzeriteEmpoweredItemSelectPower(WorldPackets::Azerite::AzeriteEmpoweredItemSelectPower& azeriteEmpoweredItemSelectPower)
|
||||
{
|
||||
}
|
||||
|
||||
void WorldSession::SendAzeriteRespecNPC(ObjectGuid npc)
|
||||
{
|
||||
WorldPackets::NPC::NPCInteractionOpenResult npcInteraction;
|
||||
npcInteraction.Npc = npc;
|
||||
npcInteraction.InteractionType = PlayerInteractionType::AzeriteRespec;
|
||||
npcInteraction.Success = true;
|
||||
SendPacket(npcInteraction.Write());
|
||||
}
|
||||
@@ -157,26 +157,6 @@ bool LoginQueryHolder::Initialize()
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_INVENTORY, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_INSTANCE_ARTIFACT);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ARTIFACTS, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_INSTANCE_AZERITE);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_AZERITE, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_AZERITE_MILESTONE_POWERS, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_AZERITE_UNLOCKED_ESSENCES, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_INSTANCE_AZERITE_EMPOWERED);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_AZERITE_EMPOWERED, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_VOID_STORAGE);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_VOID_STORAGE, stmt);
|
||||
@@ -189,26 +169,6 @@ bool LoginQueryHolder::Initialize()
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS_ARTIFACT);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_ARTIFACT, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS_AZERITE);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS_AZERITE_MILESTONE_POWER);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE_MILESTONE_POWER, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS_AZERITE_UNLOCKED_ESSENCE);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE_UNLOCKED_ESSENCE, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS_AZERITE_EMPOWERED);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS_AZERITE_EMPOWERED, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SOCIALLIST);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST, stmt);
|
||||
|
||||
@@ -202,20 +202,8 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPackets::Item::AutoEquipItem&
|
||||
Item* dstItem = _player->GetItemByPos(dest);
|
||||
if (!dstItem) // empty slot, simple case
|
||||
{
|
||||
if (!srcItem->GetChildItem().IsEmpty())
|
||||
{
|
||||
InventoryResult childEquipResult = _player->CanEquipChildItem(srcItem);
|
||||
if (childEquipResult != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, srcItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_player->RemoveItem(autoEquipItem.PackSlot, autoEquipItem.Slot, true);
|
||||
_player->EquipItem(dest, srcItem, true);
|
||||
if (!srcItem->GetChildItem().IsEmpty())
|
||||
_player->EquipChildItem(autoEquipItem.PackSlot, autoEquipItem.Slot, srcItem);
|
||||
|
||||
_player->AutoUnequipOffhandIfNeed();
|
||||
}
|
||||
@@ -259,9 +247,6 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPackets::Item::AutoEquipItem&
|
||||
msg = _player->CanUnequipItem(eSrc, true);
|
||||
}
|
||||
|
||||
if (msg == EQUIP_ERR_OK && Player::IsEquipmentPos(dest) && !srcItem->GetChildItem().IsEmpty())
|
||||
msg = _player->CanEquipChildItem(srcItem);
|
||||
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, dstItem, srcItem);
|
||||
@@ -282,9 +267,6 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPackets::Item::AutoEquipItem&
|
||||
_player->BankItem(sSrc, dstItem, true);
|
||||
else if (_player->IsEquipmentPos(src))
|
||||
_player->EquipItem(eSrc, dstItem, true);
|
||||
|
||||
if (Player::IsEquipmentPos(dest) && !srcItem->GetChildItem().IsEmpty())
|
||||
_player->EquipChildItem(autoEquipItem.PackSlot, autoEquipItem.Slot, srcItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -292,7 +274,6 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPackets::Item::AutoEquipItem&
|
||||
{
|
||||
if (Player::IsEquipmentPos(dest))
|
||||
{
|
||||
_player->AutoUnequipChildItem(parentItem);
|
||||
// dest is now empty
|
||||
_player->SwapItem(src, dest);
|
||||
// src is now empty
|
||||
@@ -957,8 +938,6 @@ void WorldSession::HandleSocketGems(WorldPackets::Item::SocketGems& socketGems)
|
||||
gems[i] = gem;
|
||||
gemData[i].ItemId = gem->GetEntry();
|
||||
gemData[i].Context = gem->m_itemData->Context;
|
||||
for (std::size_t b = 0; b < gem->GetBonusListIDs().size() && b < 16; ++b)
|
||||
gemData[i].BonusListIDs[b] = gem->GetBonusListIDs()[b];
|
||||
|
||||
gemProperties[i] = sGemPropertiesStore.LookupEntry(gem->GetTemplate()->GetGemProperties());
|
||||
}
|
||||
@@ -1105,15 +1084,6 @@ void WorldSession::HandleSocketGems(WorldPackets::Item::SocketGems& socketGems)
|
||||
if (itemTarget->IsEquipped())
|
||||
_player->_ApplyItemMods(itemTarget, itemTarget->GetSlot(), true);
|
||||
|
||||
if (Item* childItem = _player->GetChildItemByGuid(itemTarget->GetChildItem()))
|
||||
{
|
||||
if (childItem->IsEquipped())
|
||||
_player->_ApplyItemMods(childItem, childItem->GetSlot(), false);
|
||||
childItem->CopyArtifactDataFromParent(itemTarget);
|
||||
if (childItem->IsEquipped())
|
||||
_player->_ApplyItemMods(childItem, childItem->GetSlot(), true);
|
||||
}
|
||||
|
||||
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
|
||||
if (SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
|
||||
{
|
||||
|
||||
@@ -462,7 +462,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPackets::Loot::MasterLootItem
|
||||
}
|
||||
|
||||
// now move item from loot to target inventory
|
||||
Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, &item.BonusListIDs);
|
||||
Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.GetAllowedLooters(), item.context);
|
||||
aeResult.Add(newitem, item.count, loot->loot_type, loot->GetDungeonEncounterId());
|
||||
|
||||
// mark as looted
|
||||
|
||||
@@ -834,7 +834,7 @@ void WorldSession::HandlePlayerChoiceResponse(WorldPackets::Quest::ChoiceRespons
|
||||
ItemPosCountVec dest;
|
||||
if (_player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.Id, item.Quantity) == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* newItem = _player->StoreNewItem(dest, item.Id, true, GenerateItemRandomBonusListId(item.Id), {}, ItemContext::Quest_Reward, &item.BonusListIDs);
|
||||
Item* newItem = _player->StoreNewItem(dest, item.Id, true, {}, ItemContext::Quest_Reward);
|
||||
_player->SendNewItem(newItem, item.Quantity, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,9 +148,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPackets::VoidStorage::VoidStor
|
||||
continue;
|
||||
}
|
||||
|
||||
VoidStorageItem itemVS(sObjectMgr->GenerateVoidStorageItemId(), item->GetEntry(), item->GetCreator(),
|
||||
item->GetItemRandomBonusListId(), item->GetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL), item->GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL),
|
||||
item->GetContext(), item->GetBonusListIDs());
|
||||
VoidStorageItem itemVS(sObjectMgr->GenerateVoidStorageItemId(), item->GetEntry(), item->GetCreator(), item->GetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL), item->GetContext());
|
||||
|
||||
WorldPackets::VoidStorage::VoidItem voidItem;
|
||||
voidItem.Guid = ObjectGuid::Create<HighGuid::Item>(itemVS.ItemId);
|
||||
@@ -187,7 +185,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPackets::VoidStorage::VoidStor
|
||||
return;
|
||||
}
|
||||
|
||||
Item* item = _player->StoreNewItem(dest, itemVS->ItemEntry, true, itemVS->RandomBonusListId, GuidSet(), itemVS->Context, &itemVS->BonusListIDs);
|
||||
Item* item = _player->StoreNewItem(dest, itemVS->ItemEntry, true, GuidSet(), itemVS->Context);
|
||||
item->SetCreator(itemVS->CreatorGuid);
|
||||
item->SetBinding(true);
|
||||
GetCollectionMgr()->AddItemAppearance(item);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Item.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "Log.h"
|
||||
#include "LootMgr.h"
|
||||
@@ -52,7 +51,6 @@ LootItem::LootItem(LootStoreItem const& li)
|
||||
|
||||
needs_quest = li.needs_quest;
|
||||
|
||||
randomBonusListId = GenerateItemRandomBonusListId(itemid);
|
||||
context = ItemContext::NONE;
|
||||
count = 0;
|
||||
is_looted = false;
|
||||
@@ -568,7 +566,7 @@ ItemDisenchantLootEntry const* LootRoll::GetItemDisenchantLoot() const
|
||||
return nullptr;
|
||||
|
||||
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(m_lootItem->itemid);
|
||||
uint32 itemLevel = Item::GetItemLevel(itemTemplate, bonusData, 1, 0, 0, 0, 0, false, 0);
|
||||
uint32 itemLevel = Item::GetItemLevel(itemTemplate, bonusData, 1, 0, 0, 0, 0, false);
|
||||
return Item::GetDisenchantLoot(itemTemplate, bonusData.Quality, itemLevel);
|
||||
}
|
||||
|
||||
@@ -839,7 +837,6 @@ void Loot::AddItem(LootStoreItem const& item)
|
||||
generatedLoot.context = _itemContext;
|
||||
generatedLoot.count = std::min(count, proto->GetMaxStackSize());
|
||||
generatedLoot.LootListId = items.size();
|
||||
generatedLoot.BonusListIDs = ItemBonusMgr::GetBonusListsForItem(generatedLoot.itemid, _itemContext);
|
||||
|
||||
items.push_back(generatedLoot);
|
||||
count -= proto->GetMaxStackSize();
|
||||
@@ -888,7 +885,7 @@ bool Loot::AutoStore(Player* player, uint8 bag, uint8 slot, bool broadcast, bool
|
||||
|
||||
--unlootedCount;
|
||||
|
||||
Item* pItem = player->StoreNewItem(dest, lootItem->itemid, true, lootItem->randomBonusListId, GuidSet(), lootItem->context, &lootItem->BonusListIDs);
|
||||
Item* pItem = player->StoreNewItem(dest, lootItem->itemid, true, GuidSet(), lootItem->context);
|
||||
player->SendNewItem(pItem, lootItem->count, false, createdByPlayer, broadcast);
|
||||
player->ApplyItemLootedSpell(pItem, true);
|
||||
}
|
||||
|
||||
@@ -176,8 +176,6 @@ struct TC_GAME_API LootItem
|
||||
{
|
||||
uint32 itemid;
|
||||
uint32 LootListId;
|
||||
ItemRandomBonusListId randomBonusListId;
|
||||
std::vector<int32> BonusListIDs;
|
||||
ItemContext context;
|
||||
ConditionContainer conditions; // additional loot condition
|
||||
GuidSet allowedGUIDs;
|
||||
@@ -196,7 +194,7 @@ struct TC_GAME_API LootItem
|
||||
explicit LootItem(LootStoreItem const& li);
|
||||
|
||||
// Empty constructor for creating an empty LootItem to be filled in with DB data
|
||||
LootItem() : itemid(0), LootListId(0), randomBonusListId(0), context(ItemContext::NONE), count(0), is_looted(false), is_blocked(false),
|
||||
LootItem() : itemid(0), LootListId(0), context(ItemContext::NONE), count(0), is_looted(false), is_blocked(false),
|
||||
freeforall(false), is_underthreshold(false), is_counted(false), needs_quest(false), follow_loot_rules(false) { }
|
||||
|
||||
LootItem(LootItem const&);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace
|
||||
|
||||
StoredLootItem::StoredLootItem(LootItem const& lootItem) : ItemId(lootItem.itemid), Count(lootItem.count), ItemIndex(lootItem.LootListId), FollowRules(lootItem.follow_loot_rules),
|
||||
FFA(lootItem.freeforall), Blocked(lootItem.is_blocked), Counted(lootItem.is_counted), UnderThreshold(lootItem.is_underthreshold),
|
||||
NeedsQuest(lootItem.needs_quest), RandomBonusListId(lootItem.randomBonusListId), Context(lootItem.context), BonusListIDs(lootItem.BonusListIDs)
|
||||
NeedsQuest(lootItem.needs_quest), Context(lootItem.context)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -79,11 +79,7 @@ void LootItemStorage::LoadStorageFromDB()
|
||||
lootItem.is_counted = fields[7].GetBool();
|
||||
lootItem.is_underthreshold = fields[8].GetBool();
|
||||
lootItem.needs_quest = fields[9].GetBool();
|
||||
lootItem.randomBonusListId = fields[10].GetUInt32();
|
||||
lootItem.context = ItemContext(fields[11].GetUInt8());
|
||||
for (std::string_view bonusList : Trinity::Tokenize(fields[12].GetStringView(), ' ', false))
|
||||
if (Optional<int32> bonusListID = Trinity::StringTo<int32>(bonusList))
|
||||
lootItem.BonusListIDs.push_back(*bonusListID);
|
||||
lootItem.context = ItemContext(fields[10].GetUInt8());
|
||||
|
||||
storedContainer.AddLootItem(lootItem, trans);
|
||||
|
||||
@@ -150,9 +146,7 @@ bool LootItemStorage::LoadStoredLoot(Item* item, Player* player)
|
||||
li.is_counted = storedItemPair.second.Counted;
|
||||
li.is_underthreshold = storedItemPair.second.UnderThreshold;
|
||||
li.needs_quest = storedItemPair.second.NeedsQuest;
|
||||
li.randomBonusListId = storedItemPair.second.RandomBonusListId;
|
||||
li.context = storedItemPair.second.Context;
|
||||
li.BonusListIDs = storedItemPair.second.BonusListIDs;
|
||||
|
||||
// Copy the extra loot conditions from the item in the loot template
|
||||
lt->CopyConditions(&li);
|
||||
@@ -293,12 +287,7 @@ void StoredLootContainer::AddLootItem(LootItem const& lootItem, CharacterDatabas
|
||||
stmt->setBool(7, lootItem.is_counted);
|
||||
stmt->setBool(8, lootItem.is_underthreshold);
|
||||
stmt->setBool(9, lootItem.needs_quest);
|
||||
stmt->setInt32(10, lootItem.randomBonusListId);
|
||||
stmt->setUInt8(11, AsUnderlyingType(lootItem.context));
|
||||
std::ostringstream bonusListIDs;
|
||||
for (int32 bonusListID : lootItem.BonusListIDs)
|
||||
bonusListIDs << bonusListID << ' ';
|
||||
stmt->setString(12, bonusListIDs.str());
|
||||
stmt->setUInt8(10, AsUnderlyingType(lootItem.context));
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,7 @@ struct StoredLootItem
|
||||
bool Counted;
|
||||
bool UnderThreshold;
|
||||
bool NeedsQuest;
|
||||
ItemRandomBonusListId RandomBonusListId;
|
||||
ItemContext Context;
|
||||
std::vector<int32> BonusListIDs;
|
||||
};
|
||||
|
||||
class StoredLootContainer
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "Containers.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "Log.h"
|
||||
#include "Loot.h"
|
||||
@@ -960,7 +959,6 @@ std::unordered_map<ObjectGuid, std::unique_ptr<Loot>> GenerateDungeonEncounterPe
|
||||
|
||||
std::unique_ptr<Loot>& loot = tempLoot[tapper];
|
||||
loot.reset(new Loot(lootOwner->GetMap(), lootOwner->GetGUID(), type, nullptr));
|
||||
loot->SetItemContext(ItemBonusMgr::GetContextForPlayer(mapDifficulty, tapper));
|
||||
loot->SetDungeonEncounterId(dungeonEncounterId);
|
||||
loot->generateMoneyLoot(minMoney, maxMoney);
|
||||
}
|
||||
|
||||
@@ -52,14 +52,6 @@ void ItemInstance::Initialize(::Item const* item)
|
||||
RandomPropertiesSeed = item->m_itemData->PropertySeed;
|
||||
RandomPropertiesID = item->m_itemData->RandomPropertiesID;
|
||||
|
||||
std::vector<int32> const& bonusListIds = item->GetBonusListIDs();
|
||||
if (!bonusListIds.empty())
|
||||
{
|
||||
ItemBonus.emplace();
|
||||
ItemBonus->BonusListIDs.insert(ItemBonus->BonusListIDs.end(), bonusListIds.begin(), bonusListIds.end());
|
||||
ItemBonus->Context = item->GetContext();
|
||||
}
|
||||
|
||||
for (UF::ItemMod mod : item->m_itemData->Modifiers->Values)
|
||||
Modifications.Values.emplace_back(mod.Value, ItemModifier(mod.Type));
|
||||
}
|
||||
@@ -81,15 +73,6 @@ void ItemInstance::Initialize(UF::SocketedGem const* gem)
|
||||
void ItemInstance::Initialize(::LootItem const& lootItem)
|
||||
{
|
||||
ItemID = lootItem.itemid;
|
||||
|
||||
if (!lootItem.BonusListIDs.empty() || lootItem.randomBonusListId)
|
||||
{
|
||||
ItemBonus.emplace();
|
||||
ItemBonus->BonusListIDs = lootItem.BonusListIDs;
|
||||
ItemBonus->Context = lootItem.context;
|
||||
if (lootItem.randomBonusListId)
|
||||
ItemBonus->BonusListIDs.push_back(lootItem.randomBonusListId);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemInstance::Initialize(::VoidStorageItem const* voidItem)
|
||||
@@ -98,16 +81,6 @@ void ItemInstance::Initialize(::VoidStorageItem const* voidItem)
|
||||
|
||||
if (voidItem->FixedScalingLevel)
|
||||
Modifications.Values.emplace_back(voidItem->FixedScalingLevel, ITEM_MODIFIER_TIMEWALKER_LEVEL);
|
||||
|
||||
if (voidItem->ArtifactKnowledgeLevel)
|
||||
Modifications.Values.emplace_back(voidItem->ArtifactKnowledgeLevel, ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL);
|
||||
|
||||
if (!voidItem->BonusListIDs.empty())
|
||||
{
|
||||
ItemBonus.emplace();
|
||||
ItemBonus->Context = voidItem->Context;
|
||||
ItemBonus->BonusListIDs = voidItem->BonusListIDs;
|
||||
}
|
||||
}
|
||||
|
||||
bool ItemInstance::operator==(ItemInstance const& r) const
|
||||
|
||||
@@ -158,8 +158,8 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_HANDLER(CMSG_AREA_SPIRIT_HEALER_QUERY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAreaSpiritHealerQueryOpcode);
|
||||
DEFINE_HANDLER(CMSG_AREA_SPIRIT_HEALER_QUEUE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAreaSpiritHealerQueueOpcode);
|
||||
DEFINE_HANDLER(CMSG_AREA_TRIGGER, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleAreaTriggerOpcode);
|
||||
DEFINE_HANDLER(CMSG_ARTIFACT_ADD_POWER, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleArtifactAddPower);
|
||||
DEFINE_HANDLER(CMSG_ARTIFACT_SET_APPEARANCE, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleArtifactSetAppearance);
|
||||
DEFINE_HANDLER(CMSG_ARTIFACT_ADD_POWER, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_ARTIFACT_SET_APPEARANCE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_ARENA_TEAM_ACCEPT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_ARENA_TEAM_DECLINE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_ARENA_TEAM_DISBAND, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
|
||||
@@ -204,10 +204,10 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_HANDLER(CMSG_AUTO_GUILD_BANK_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAutoGuildBankItem);
|
||||
DEFINE_HANDLER(CMSG_AUTO_STORE_BAG_ITEM, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleAutoStoreBagItemOpcode);
|
||||
DEFINE_HANDLER(CMSG_AUTO_STORE_GUILD_BANK_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAutoStoreGuildBankItem);
|
||||
DEFINE_HANDLER(CMSG_AZERITE_EMPOWERED_ITEM_SELECT_POWER, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleAzeriteEmpoweredItemSelectPower);
|
||||
DEFINE_HANDLER(CMSG_AZERITE_EMPOWERED_ITEM_VIEWED, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleAzeriteEmpoweredItemViewed);
|
||||
DEFINE_HANDLER(CMSG_AZERITE_ESSENCE_ACTIVATE_ESSENCE, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleAzeriteEssenceActivateEssence);
|
||||
DEFINE_HANDLER(CMSG_AZERITE_ESSENCE_UNLOCK_MILESTONE, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleAzeriteEssenceUnlockMilestone);
|
||||
DEFINE_HANDLER(CMSG_AZERITE_EMPOWERED_ITEM_SELECT_POWER, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_AZERITE_EMPOWERED_ITEM_VIEWED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_AZERITE_ESSENCE_ACTIVATE_ESSENCE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_AZERITE_ESSENCE_UNLOCK_MILESTONE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_BANKER_ACTIVATE, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBankerActivateOpcode);
|
||||
DEFINE_HANDLER(CMSG_BATTLEFIELD_LEAVE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlefieldLeaveOpcode);
|
||||
DEFINE_HANDLER(CMSG_BATTLEFIELD_LIST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlefieldListOpcode);
|
||||
@@ -381,7 +381,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_HANDLER(CMSG_COMPLAINT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleComplaint);
|
||||
DEFINE_HANDLER(CMSG_COMPLETE_CINEMATIC, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleCompleteCinematic);
|
||||
DEFINE_HANDLER(CMSG_COMPLETE_MOVIE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleCompleteMovie);
|
||||
DEFINE_HANDLER(CMSG_CONFIRM_ARTIFACT_RESPEC, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleConfirmArtifactRespec);
|
||||
DEFINE_HANDLER(CMSG_CONFIRM_ARTIFACT_RESPEC, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_CONFIRM_BARBERS_CHOICE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_CONFIRM_RESPEC_WIPE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleConfirmRespecWipeOpcode);
|
||||
DEFINE_HANDLER(CMSG_CONNECT_TO_FAILED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_EarlyProccess);
|
||||
|
||||
@@ -119,13 +119,6 @@ namespace WorldPackets
|
||||
class AreaTrigger;
|
||||
}
|
||||
|
||||
namespace Artifact
|
||||
{
|
||||
class ArtifactAddPower;
|
||||
class ArtifactSetAppearance;
|
||||
class ConfirmArtifactRespec;
|
||||
}
|
||||
|
||||
namespace AuctionHouse
|
||||
{
|
||||
class AuctionBrowseQuery;
|
||||
@@ -152,14 +145,6 @@ namespace WorldPackets
|
||||
enum class ConnectToSerial : uint32;
|
||||
}
|
||||
|
||||
namespace Azerite
|
||||
{
|
||||
class AzeriteEmpoweredItemSelectPower;
|
||||
class AzeriteEmpoweredItemViewed;
|
||||
class AzeriteEssenceUnlockMilestone;
|
||||
class AzeriteEssenceActivateEssence;
|
||||
}
|
||||
|
||||
namespace Bank
|
||||
{
|
||||
class AutoBankItem;
|
||||
@@ -1819,21 +1804,9 @@ class TC_GAME_API WorldSession
|
||||
|
||||
void HandleQueryRealmName(WorldPackets::Query::QueryRealmName& queryRealmName);
|
||||
|
||||
// Artifact
|
||||
void HandleArtifactAddPower(WorldPackets::Artifact::ArtifactAddPower& artifactAddPower);
|
||||
void HandleArtifactSetAppearance(WorldPackets::Artifact::ArtifactSetAppearance& artifactSetAppearance);
|
||||
void HandleConfirmArtifactRespec(WorldPackets::Artifact::ConfirmArtifactRespec& confirmArtifactRespec);
|
||||
|
||||
// Scenario
|
||||
void HandleQueryScenarioPOI(WorldPackets::Scenario::QueryScenarioPOI& queryScenarioPOI);
|
||||
|
||||
// Azerite
|
||||
void HandleAzeriteEssenceUnlockMilestone(WorldPackets::Azerite::AzeriteEssenceUnlockMilestone& azeriteEssenceUnlockMilestone);
|
||||
void HandleAzeriteEssenceActivateEssence(WorldPackets::Azerite::AzeriteEssenceActivateEssence& azeriteEssenceActivateEssence);
|
||||
void HandleAzeriteEmpoweredItemViewed(WorldPackets::Azerite::AzeriteEmpoweredItemViewed& azeriteEmpoweredItemViewed);
|
||||
void HandleAzeriteEmpoweredItemSelectPower(WorldPackets::Azerite::AzeriteEmpoweredItemSelectPower& azeriteEmpoweredItemSelectPower);
|
||||
void SendAzeriteRespecNPC(ObjectGuid npc);
|
||||
|
||||
void HandleRequestLatestSplashScreen(WorldPackets::Misc::RequestLatestSplashScreen& requestLatestSplashScreen);
|
||||
|
||||
void HandleSocialContractRequest(WorldPackets::Social::SocialContractRequest& socialContractRequest);
|
||||
|
||||
@@ -6483,29 +6483,6 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32
|
||||
|
||||
break;
|
||||
}
|
||||
case SPELL_EFFECT_GIVE_ARTIFACT_POWER:
|
||||
case SPELL_EFFECT_GIVE_ARTIFACT_POWER_NO_BONUS:
|
||||
{
|
||||
Player* playerCaster = m_caster->ToPlayer();
|
||||
if (!playerCaster)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Aura* artifactAura = playerCaster->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE);
|
||||
if (!artifactAura)
|
||||
return SPELL_FAILED_NO_ARTIFACT_EQUIPPED;
|
||||
|
||||
Item* artifact = playerCaster->GetItemByGuid(artifactAura->GetCastItemGUID());
|
||||
if (!artifact)
|
||||
return SPELL_FAILED_NO_ARTIFACT_EQUIPPED;
|
||||
|
||||
if (spellEffectInfo.Effect == SPELL_EFFECT_GIVE_ARTIFACT_POWER)
|
||||
{
|
||||
ArtifactEntry const* artifactEntry = sArtifactStore.LookupEntry(artifact->GetTemplate()->GetArtifactID());
|
||||
if (!artifactEntry || artifactEntry->ArtifactCategoryID != spellEffectInfo.MiscValue)
|
||||
return SPELL_FAILED_WRONG_ARTIFACT_EQUIPPED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPELL_EFFECT_CHANGE_BATTLEPET_QUALITY:
|
||||
case SPELL_EFFECT_GRANT_BATTLEPET_LEVEL:
|
||||
case SPELL_EFFECT_GRANT_BATTLEPET_EXPERIENCE:
|
||||
|
||||
@@ -403,8 +403,6 @@ class TC_GAME_API Spell
|
||||
void EffectApplyEnchantIllusion();
|
||||
void EffectUpdatePlayerPhase();
|
||||
void EffectUpdateZoneAurasAndPhases();
|
||||
void EffectGiveArtifactPower();
|
||||
void EffectGiveArtifactPowerNoBonus();
|
||||
void EffectPlaySceneScriptPackage();
|
||||
void EffectCreateSceneObject();
|
||||
void EffectCreatePrivateSceneObject();
|
||||
@@ -412,8 +410,6 @@ class TC_GAME_API Spell
|
||||
void EffectGiveHonor();
|
||||
void EffectJumpCharge();
|
||||
void EffectLearnTransmogSet();
|
||||
void EffectRespecAzeriteEmpoweredItem();
|
||||
void EffectLearnAzeriteEssencePower();
|
||||
void EffectCreatePrivateConversation();
|
||||
void EffectSendChatMessage();
|
||||
void EffectGrantBattlePetExperience();
|
||||
@@ -506,7 +502,7 @@ class TC_GAME_API Spell
|
||||
uint32 getState() const { return m_spellState; }
|
||||
void setState(uint32 state) { m_spellState = state; }
|
||||
|
||||
void DoCreateItem(uint32 itemId, ItemContext context = ItemContext::NONE, std::vector<int32> const* bonusListIDs = nullptr);
|
||||
void DoCreateItem(uint32 itemId, ItemContext context = ItemContext::NONE);
|
||||
|
||||
bool CheckEffectTarget(Unit const* target, SpellEffectInfo const& spellEffectInfo, Position const* losPosition) const;
|
||||
bool CheckEffectTarget(GameObject const* target, SpellEffectInfo const& spellEffectInfo) const;
|
||||
|
||||
@@ -325,9 +325,9 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
|
||||
&Spell::EffectGiveRestedExperience, //237 SPELL_EFFECT_GIVE_RESTED_EXPERIENCE_BONUS
|
||||
&Spell::EffectNULL, //238 SPELL_EFFECT_INCREASE_SKILL
|
||||
&Spell::EffectNULL, //239 SPELL_EFFECT_END_GARRISON_BUILDING_CONSTRUCTION
|
||||
&Spell::EffectGiveArtifactPower, //240 SPELL_EFFECT_GIVE_ARTIFACT_POWER
|
||||
&Spell::EffectNULL, //240 SPELL_EFFECT_GIVE_ARTIFACT_POWER
|
||||
&Spell::EffectUnused, //241 SPELL_EFFECT_241
|
||||
&Spell::EffectGiveArtifactPowerNoBonus, //242 SPELL_EFFECT_GIVE_ARTIFACT_POWER_NO_BONUS
|
||||
&Spell::EffectNULL, //242 SPELL_EFFECT_GIVE_ARTIFACT_POWER_NO_BONUS
|
||||
&Spell::EffectApplyEnchantIllusion, //243 SPELL_EFFECT_APPLY_ENCHANT_ILLUSION
|
||||
&Spell::EffectNULL, //244 SPELL_EFFECT_LEARN_FOLLOWER_ABILITY
|
||||
&Spell::EffectUpgradeHeirloom, //245 SPELL_EFFECT_UPGRADE_HEIRLOOM
|
||||
@@ -344,13 +344,13 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
|
||||
&Spell::EffectUnused, //256 SPELL_EFFECT_256
|
||||
&Spell::EffectUnused, //257 SPELL_EFFECT_257
|
||||
&Spell::EffectNULL, //258 SPELL_EFFECT_MODIFY_KEYSTONE
|
||||
&Spell::EffectRespecAzeriteEmpoweredItem, //259 SPELL_EFFECT_RESPEC_AZERITE_EMPOWERED_ITEM
|
||||
&Spell::EffectNULL, //259 SPELL_EFFECT_RESPEC_AZERITE_EMPOWERED_ITEM
|
||||
&Spell::EffectNULL, //260 SPELL_EFFECT_SUMMON_STABLED_PET
|
||||
&Spell::EffectNULL, //261 SPELL_EFFECT_SCRAP_ITEM
|
||||
&Spell::EffectUnused, //262 SPELL_EFFECT_262
|
||||
&Spell::EffectNULL, //263 SPELL_EFFECT_REPAIR_ITEM
|
||||
&Spell::EffectNULL, //264 SPELL_EFFECT_REMOVE_GEM
|
||||
&Spell::EffectLearnAzeriteEssencePower, //265 SPELL_EFFECT_LEARN_AZERITE_ESSENCE_POWER
|
||||
&Spell::EffectNULL, //265 SPELL_EFFECT_LEARN_AZERITE_ESSENCE_POWER
|
||||
&Spell::EffectNULL, //266 SPELL_EFFECT_SET_ITEM_BONUS_LIST_GROUP_ENTRY
|
||||
&Spell::EffectCreatePrivateConversation, //267 SPELL_EFFECT_CREATE_PRIVATE_CONVERSATION
|
||||
&Spell::EffectNULL, //268 SPELL_EFFECT_APPLY_MOUNT_EQUIPMENT
|
||||
@@ -1290,7 +1290,7 @@ void Spell::EffectHealthLeech()
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::DoCreateItem(uint32 itemId, ItemContext context /*= ItemContext::NONE*/, std::vector<int32> const* bonusListIDs /*= nullptr*/)
|
||||
void Spell::DoCreateItem(uint32 itemId, ItemContext context /*= ItemContext::NONE*/)
|
||||
{
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
@@ -1365,7 +1365,7 @@ void Spell::DoCreateItem(uint32 itemId, ItemContext context /*= ItemContext::NON
|
||||
if (num_to_add)
|
||||
{
|
||||
// create the new item and store it
|
||||
Item* pItem = player->StoreNewItem(dest, newitemid, true, GenerateItemRandomBonusListId(newitemid), GuidSet(), context, bonusListIDs);
|
||||
Item* pItem = player->StoreNewItem(dest, newitemid, true, GuidSet(), context);
|
||||
|
||||
// was it successful? return error if not
|
||||
if (!pItem)
|
||||
@@ -5453,10 +5453,7 @@ void Spell::EffectCreateHeirloomItem()
|
||||
if (!collectionMgr)
|
||||
return;
|
||||
|
||||
std::vector<int32> bonusList;
|
||||
bonusList.push_back(collectionMgr->GetHeirloomBonus(m_misc.Raw.Data[0]));
|
||||
|
||||
DoCreateItem(m_misc.Raw.Data[0], ItemContext::NONE, &bonusList);
|
||||
DoCreateItem(m_misc.Raw.Data[0], ItemContext::NONE);
|
||||
ExecuteLogEffectCreateItem(SpellEffectName(effectInfo->Effect), m_misc.Raw.Data[0]);
|
||||
}
|
||||
|
||||
@@ -5660,33 +5657,6 @@ void Spell::EffectUpdateZoneAurasAndPhases()
|
||||
unitTarget->ToPlayer()->UpdateAreaDependentAuras(unitTarget->GetAreaId());
|
||||
}
|
||||
|
||||
void Spell::EffectGiveArtifactPower()
|
||||
{
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
|
||||
return;
|
||||
|
||||
Player* playerCaster = m_caster->ToPlayer();
|
||||
if (!playerCaster)
|
||||
return;
|
||||
|
||||
if (Aura* artifactAura = playerCaster->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE))
|
||||
if (Item* artifact = playerCaster->GetItemByGuid(artifactAura->GetCastItemGUID()))
|
||||
artifact->GiveArtifactXp(damage, m_CastItem, uint32(effectInfo->MiscValue));
|
||||
}
|
||||
|
||||
void Spell::EffectGiveArtifactPowerNoBonus()
|
||||
{
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
|
||||
return;
|
||||
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (Aura* artifactAura = unitTarget->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE))
|
||||
if (Item* artifact = unitTarget->ToPlayer()->GetItemByGuid(artifactAura->GetCastItemGUID()))
|
||||
artifact->GiveArtifactXp(damage, m_CastItem, 0);
|
||||
}
|
||||
|
||||
void Spell::EffectPlaySceneScriptPackage()
|
||||
{
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||
@@ -5838,14 +5808,6 @@ void Spell::EffectLearnTransmogSet()
|
||||
unitTarget->ToPlayer()->GetSession()->GetCollectionMgr()->AddTransmogSet(effectInfo->MiscValue);
|
||||
}
|
||||
|
||||
void Spell::EffectRespecAzeriteEmpoweredItem()
|
||||
{
|
||||
}
|
||||
|
||||
void Spell::EffectLearnAzeriteEssencePower()
|
||||
{
|
||||
}
|
||||
|
||||
void Spell::EffectCreatePrivateConversation()
|
||||
{
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
|
||||
|
||||
@@ -139,12 +139,6 @@ DumpTable const DumpTables[] =
|
||||
{ "item_instance", DTT_ITEM }, // must be after character_inventory and mail_items
|
||||
{ "character_equipmentsets", DTT_EQSET_TABLE}, // must be after item_instance
|
||||
{ "character_gifts", DTT_ITEM_GIFT }, // must be after item_instance
|
||||
{ "item_instance_artifact", DTT_ITEM_TABLE }, // must be after item_instance
|
||||
{ "item_instance_artifact_powers", DTT_ITEM_TABLE }, // must be after item_instance
|
||||
{ "item_instance_azerite", DTT_ITEM_TABLE }, // must be after item_instance
|
||||
{ "item_instance_azerite_empowered", DTT_ITEM_TABLE }, // must be after item_instance
|
||||
{ "item_instance_azerite_milestone_power", DTT_ITEM_TABLE }, // must be after item_instance
|
||||
{ "item_instance_azerite_unlocked_essence", DTT_ITEM_TABLE }, // must be after item_instance
|
||||
{ "item_instance_gems", DTT_ITEM_TABLE }, // must be after item_instance
|
||||
{ "item_instance_modifiers", DTT_ITEM_TABLE }, // must be after item_instance
|
||||
{ "item_instance_transmog", DTT_ITEM_TABLE }, // must be after item_instance
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
#include "GuildMgr.h"
|
||||
#include "InstanceLockMgr.h"
|
||||
#include "IPLocation.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "Language.h"
|
||||
#include "LanguageMgr.h"
|
||||
#include "LFGMgr.h"
|
||||
@@ -1961,12 +1960,6 @@ void World::SetInitialWorldSettings()
|
||||
TC_LOG_INFO("server.loading", "Loading Enchant Spells Proc datas...");
|
||||
sSpellMgr->LoadSpellEnchantProcData();
|
||||
|
||||
TC_LOG_INFO("server.loading", "Loading item bonus data...");
|
||||
ItemBonusMgr::Load();
|
||||
|
||||
TC_LOG_INFO("server.loading", "Loading Random item bonus list definitions...");
|
||||
LoadItemRandomBonusListTemplates();
|
||||
|
||||
TC_LOG_INFO("server.loading", "Loading Disables"); // must be before loading quests and items
|
||||
DisableMgr::LoadDisables();
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "IpAddress.h"
|
||||
#include "IPLocation.h"
|
||||
#include "Item.h"
|
||||
#include "ItemBonusMgr.h"
|
||||
#include "Language.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "MMapFactory.h"
|
||||
@@ -1233,14 +1232,7 @@ public:
|
||||
|
||||
ItemContext itemContext = ItemContext::NONE;
|
||||
if (context)
|
||||
{
|
||||
itemContext = ItemContext(Trinity::StringTo<uint8>(context).value_or(0));
|
||||
if (itemContext < ItemContext::Max)
|
||||
{
|
||||
std::vector<int32> contextBonuses = ItemBonusMgr::GetBonusListsForItem(itemId, itemContext);
|
||||
bonusListIDs.insert(bonusListIDs.begin(), contextBonuses.begin(), contextBonuses.end());
|
||||
}
|
||||
}
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
Player* playerTarget = handler->getSelectedPlayer();
|
||||
@@ -1298,8 +1290,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
Item* item = playerTarget->StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId), GuidSet(), itemContext,
|
||||
bonusListIDs.empty() ? nullptr : &bonusListIDs);
|
||||
Item* item = playerTarget->StoreNewItem(dest, itemId, true, GuidSet(), itemContext);
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (player == playerTarget)
|
||||
@@ -1399,14 +1390,7 @@ public:
|
||||
|
||||
ItemContext itemContext = ItemContext::NONE;
|
||||
if (context)
|
||||
{
|
||||
itemContext = ItemContext(Trinity::StringTo<uint8>(context).value_or(0));
|
||||
if (itemContext < ItemContext::Max)
|
||||
{
|
||||
std::vector<int32> contextBonuses = ItemBonusMgr::GetBonusListsForItem(itemId, itemContext);
|
||||
bonusListIDs.insert(bonusListIDs.begin(), contextBonuses.begin(), contextBonuses.end());
|
||||
}
|
||||
}
|
||||
|
||||
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
|
||||
if (!itemTemplate)
|
||||
@@ -1459,8 +1443,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
Item* item = playerTarget->StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId), GuidSet(), itemContext,
|
||||
bonusListIDs.empty() ? nullptr : &bonusListIDs);
|
||||
Item* item = playerTarget->StoreNewItem(dest, itemId, true, GuidSet(), itemContext);
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (player == playerTarget)
|
||||
@@ -1481,7 +1464,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleAddItemSetCommand(ChatHandler* handler, Variant<Hyperlink<itemset>, uint32> itemSetId, Optional<std::string_view> bonuses, Optional<uint8> context)
|
||||
static bool HandleAddItemSetCommand(ChatHandler* handler, Variant<Hyperlink<itemset>, uint32> itemSetId, Optional<std::string_view> /*bonuses*/, Optional<uint8> context)
|
||||
{
|
||||
// prevent generation all items with itemset field value '0'
|
||||
if (*itemSetId == 0)
|
||||
@@ -1493,12 +1476,6 @@ public:
|
||||
|
||||
std::vector<int32> bonusListIDs;
|
||||
|
||||
// semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
|
||||
if (bonuses)
|
||||
for (std::string_view token : Trinity::Tokenize(*bonuses, ';', false))
|
||||
if (Optional<int32> bonusListId = Trinity::StringTo<int32>(token); bonusListId && *bonusListId)
|
||||
bonusListIDs.push_back(*bonusListId);
|
||||
|
||||
ItemContext itemContext = ItemContext::NONE;
|
||||
if (context)
|
||||
itemContext = ItemContext(*context);
|
||||
@@ -1520,15 +1497,7 @@ public:
|
||||
InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemTemplatePair.first, 1);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
std::vector<int32> bonusListIDsForItem = bonusListIDs; // copy, bonuses for each depending on context might be different for each item
|
||||
if (itemContext < ItemContext::Max)
|
||||
{
|
||||
std::vector<int32> contextBonuses = ItemBonusMgr::GetBonusListsForItem(itemTemplatePair.first, itemContext);
|
||||
bonusListIDsForItem.insert(bonusListIDsForItem.begin(), contextBonuses.begin(), contextBonuses.end());
|
||||
}
|
||||
|
||||
Item* item = playerTarget->StoreNewItem(dest, itemTemplatePair.first, true, {}, GuidSet(), itemContext,
|
||||
bonusListIDsForItem.empty() ? nullptr : &bonusListIDsForItem);
|
||||
Item* item = playerTarget->StoreNewItem(dest, itemTemplatePair.first, true, GuidSet(), itemContext);
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (player == playerTarget)
|
||||
|
||||
@@ -882,7 +882,6 @@ public:
|
||||
static bool HandleReloadItemRandomBonusListTemplatesCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
TC_LOG_INFO("misc", "Re-Loading Random item bonus list definitions...");
|
||||
LoadItemRandomBonusListTemplates();
|
||||
handler->SendGlobalGMSysMessage("DB table `item_random_bonus_list_template` reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3935,54 +3935,6 @@ class spell_item_zandalarian_charm : public SpellScriptLoader
|
||||
uint32 _spellId;
|
||||
};
|
||||
|
||||
class spell_item_artifical_stamina : public AuraScript
|
||||
{
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
|
||||
}
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
return GetOwner()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
|
||||
{
|
||||
if (Item* artifact = GetOwner()->ToPlayer()->GetItemByGuid(GetAura()->GetCastItemGUID()))
|
||||
amount = GetEffectInfo(EFFECT_1).BasePoints * artifact->GetTotalPurchasedArtifactPowers() / 100;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_artifical_stamina::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_item_artifical_damage : public AuraScript
|
||||
{
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
|
||||
}
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
return GetOwner()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
|
||||
{
|
||||
if (Item* artifact = GetOwner()->ToPlayer()->GetItemByGuid(GetAura()->GetCastItemGUID()))
|
||||
amount = GetSpellInfo()->GetEffect(EFFECT_1).BasePoints * artifact->GetTotalPurchasedArtifactPowers() / 100;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_artifical_damage::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
}
|
||||
};
|
||||
|
||||
enum AuraProcRemoveSpells
|
||||
{
|
||||
SPELL_TALISMAN_OF_ASCENDANCE = 28200,
|
||||
@@ -4740,8 +4692,6 @@ void AddSC_item_spell_scripts()
|
||||
RegisterSpellScript(spell_item_frozen_shadoweave);
|
||||
RegisterSpellScript(spell_item_gnomish_death_ray);
|
||||
RegisterSpellScript(spell_item_harm_prevention_belt);
|
||||
RegisterSpellScriptWithArgs((spell_item_heartpierce<SPELL_INVIGORATION_ENERGY, SPELL_INVIGORATION_MANA, SPELL_INVIGORATION_RAGE, SPELL_INVIGORATION_RP>), "spell_item_heartpierce");
|
||||
RegisterSpellScriptWithArgs((spell_item_heartpierce<SPELL_INVIGORATION_ENERGY_HERO, SPELL_INVIGORATION_MANA_HERO, SPELL_INVIGORATION_RAGE_HERO, SPELL_INVIGORATION_RP_HERO>), "spell_item_heartpierce_hero");
|
||||
RegisterSpellScript(spell_item_hourglass_sand);
|
||||
RegisterSpellScript(spell_item_crystal_spire_of_karabor);
|
||||
RegisterSpellScript(spell_item_make_a_wish);
|
||||
@@ -4818,8 +4768,6 @@ void AddSC_item_spell_scripts()
|
||||
RegisterSpellScript(spell_item_universal_remote);
|
||||
new spell_item_zandalarian_charm("spell_item_unstable_power", SPELL_UNSTABLE_POWER_AURA_STACK);
|
||||
new spell_item_zandalarian_charm("spell_item_restless_strength", SPELL_RESTLESS_STRENGTH_AURA_STACK);
|
||||
RegisterSpellScript(spell_item_artifical_stamina);
|
||||
RegisterSpellScript(spell_item_artifical_damage);
|
||||
RegisterSpellScript(spell_item_talisman_of_ascendance);
|
||||
RegisterSpellScript(spell_item_battle_trance);
|
||||
RegisterSpellScript(spell_item_world_queller_focus);
|
||||
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 39883, 1); // Cracked Egg
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
player->StoreNewItem(dest, 39883, true, GenerateItemRandomBonusListId(39883));
|
||||
player->StoreNewItem(dest, 39883, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 44718, 1); // Ripe Disgusting Jar
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
player->StoreNewItem(dest, 44718, true, GenerateItemRandomBonusListId(44718));
|
||||
player->StoreNewItem(dest, 44718, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user