fix profession salvage skill increment
Build (Windows x64) / build (push) Canceled after 0s
Build (Windows x64) / linux-build (push) Canceled after 0s

This commit is contained in:
luis
2026-08-08 02:31:37 -03:00
parent 551f40098c
commit 4d291cfe7f
13 changed files with 119 additions and 7 deletions
@@ -0,0 +1,26 @@
--
-- Table structure for table `item_salvage_loot`
--
DROP TABLE IF EXISTS `item_salvage_loot`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `item_salvage_loot` (
`ID` int NOT NULL DEFAULT '0',
`SalvagedItemID` int NOT NULL DEFAULT '0',
`ItemSalvageID` int NOT NULL DEFAULT '0',
`ResultingTreasureID` int NOT NULL DEFAULT '0',
`VerifiedBuild` int NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`,`VerifiedBuild`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `item_salvage_loot`
--
LOCK TABLES `item_salvage_loot` WRITE;
/*!40000 ALTER TABLE `item_salvage_loot` DISABLE KEYS */;
/*!40000 ALTER TABLE `item_salvage_loot` ENABLE KEYS */;
UNLOCK TABLES;
@@ -3020,6 +3020,11 @@ void HotfixDatabaseConnection::DoPrepareStatements()
" FROM item_logical_cost WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
PREPARE_MAX_ID_STMT(HOTFIX_SEL_ITEM_LOGICAL_COST, "SELECT MAX(ID) + 1 FROM item_logical_cost", CONNECTION_SYNCH);
// ItemSalvageLoot.db2
PrepareStatement(HOTFIX_SEL_ITEM_SALVAGE_LOOT, "SELECT ID, SalvagedItemID, ItemSalvageID, ResultingTreasureID FROM item_salvage_loot"
" WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
PREPARE_MAX_ID_STMT(HOTFIX_SEL_ITEM_SALVAGE_LOOT, "SELECT MAX(ID) + 1 FROM item_salvage_loot", CONNECTION_SYNCH);
}
HotfixDatabaseConnection::HotfixDatabaseConnection(MySQLConnectionInfo& connInfo, ConnectionFlags connectionFlags) : MySQLConnection(connInfo, connectionFlags)
@@ -1760,6 +1760,8 @@ enum HotfixDatabaseStatements : uint32
HOTFIX_SEL_ITEM_LOGICAL_COST,
HOTFIX_SEL_ITEM_LOGICAL_COST_MAX_ID,
HOTFIX_SEL_ITEM_SALVAGE_LOOT,
HOTFIX_SEL_ITEM_SALVAGE_LOOT_MAX_ID,
//WowCommunity end
MAX_HOTFIXDATABASE_STATEMENTS
};
@@ -112,7 +112,6 @@ namespace Trinity::Impl::ChatCommands
template <typename... Ts> struct CommandInvokerTraits<bool(ChatHandler*, Ts...)>
{
using Func = bool(ChatHandler*, Ts...);
using Refs = std::tuple<Ts...>;
using Vals = std::tuple<std::remove_cvref_t<Ts>...>;
static bool Wrapper(void* handler, ChatHandler* chatHandler, std::string_view argsStr) noexcept
@@ -121,7 +120,7 @@ namespace Trinity::Impl::ChatCommands
ChatCommandResult result = std::nullopt;
ConsumeFromOffset<Vals, 0>(result, arguments, chatHandler, argsStr);
if (result.IsSuccessful())
return Invoke(reinterpret_cast<Func*>(handler), chatHandler, arguments, std::make_index_sequence<std::tuple_size_v<Vals>>{});
return Invoke(reinterpret_cast<Func*>(handler), chatHandler, arguments, std::index_sequence_for<Ts...>{});
if (result.HasErrorMessage())
SendErrorMessageToHandler(chatHandler, result.GetErrorMessage());
@@ -133,7 +132,7 @@ namespace Trinity::Impl::ChatCommands
inline static constexpr bool Invoke(Func* handler, ChatHandler* chatHandler, Vals& arguments, std::index_sequence<I...>) noexcept
{
// Invoke command handler preserving original reference category of each argument
return handler(chatHandler, std::get<I>(advstd::forward_like<std::tuple_element_t<I, Refs>>(arguments))...);
return handler(chatHandler, std::get<I>(advstd::forward_like<Ts>(arguments))...);
}
};
+13
View File
@@ -3585,6 +3585,19 @@ struct ItemDisenchantLootLoadInfo
static constexpr DB2LoadInfo Instance{ Fields, 8, &ItemDisenchantLootMeta::Instance, HOTFIX_SEL_ITEM_DISENCHANT_LOOT };
};
struct ItemSalvageLootLoadInfo
{
static constexpr DB2FieldMeta Fields[4] =
{
{.IsSigned = false, .Type = FT_INT, .Name = "ID" },
{.IsSigned = false, .Type = FT_INT, .Name = "SalvagedItemID" },
{.IsSigned = true, .Type = FT_INT, .Name = "ItemSalvageID" },
{.IsSigned = true, .Type = FT_INT, .Name = "ResultingTreasureID" },
};
static constexpr DB2LoadInfo Instance{ Fields, 4, &ItemSalvageLootMeta::Instance, HOTFIX_SEL_ITEM_SALVAGE_LOOT };
};
struct ItemEffectLoadInfo
{
static constexpr DB2FieldMeta Fields[10] =
+2
View File
@@ -281,6 +281,7 @@ DB2Storage<ItemDamageTwoHandEntry> sItemDamageTwoHandStore("ItemDam
DB2Storage<ItemDamageTwoHandCasterEntry> sItemDamageTwoHandCasterStore("ItemDamageTwoHandCaster.db2", &ItemDamageTwoHandCasterLoadInfo::Instance);
DB2Storage<ItemDisenchantLootEntry> sItemDisenchantLootStore("ItemDisenchantLoot.db2", &ItemDisenchantLootLoadInfo::Instance);
DB2Storage<ItemEffectEntry> sItemEffectStore("ItemEffect.db2", &ItemEffectLoadInfo::Instance);
DB2Storage<ItemSalvageLootEntry> sItemSalvageLootStore("ItemSalvageLoot.db2", &ItemSalvageLootLoadInfo::Instance);
DB2Storage<ItemEntry> sItemStore("Item.db2", &ItemLoadInfo::Instance);
DB2Storage<ItemExtendedCostEntry> sItemExtendedCostStore("ItemExtendedCost.db2", &ItemExtendedCostLoadInfo::Instance);
DB2Storage<ItemLevelSelectorEntry> sItemLevelSelectorStore("ItemLevelSelector.db2", &ItemLevelSelectorLoadInfo::Instance);
@@ -1087,6 +1088,7 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
LOAD_DB2(sItemDamageTwoHandCasterStore);
LOAD_DB2(sItemDisenchantLootStore);
LOAD_DB2(sItemEffectStore);
LOAD_DB2(sItemSalvageLootStore);
LOAD_DB2(sItemStore);
LOAD_DB2(sItemExtendedCostStore);
LOAD_DB2(sItemLevelSelectorStore);
+1
View File
@@ -237,6 +237,7 @@ TC_GAME_API extern DB2Storage<ItemDamageTwoHandEntry> sItemDamageT
TC_GAME_API extern DB2Storage<ItemDamageTwoHandCasterEntry> sItemDamageTwoHandCasterStore;
TC_GAME_API extern DB2Storage<ItemDisenchantLootEntry> sItemDisenchantLootStore;
TC_GAME_API extern DB2Storage<ItemEffectEntry> sItemEffectStore;
TC_GAME_API extern DB2Storage<ItemSalvageLootEntry> sItemSalvageLootStore;
TC_GAME_API extern DB2Storage<ItemEntry> sItemStore;
TC_GAME_API extern DB2Storage<ItemExtendedCostEntry> sItemExtendedCostStore;
TC_GAME_API extern DB2Storage<ItemLevelSelectorEntry> sItemLevelSelectorStore;
@@ -3226,6 +3226,14 @@ struct ItemDisenchantLootEntry
uint32 Class;
};
struct ItemSalvageLootEntry
{
int32 ID;
int32 SalvagedItemID;
int32 ItemSalvageID;
int32 ResultingTreasureID;
};
struct ItemEffectEntry
{
uint32 ID;
+4 -3
View File
@@ -1268,9 +1268,10 @@ enum ItemBonusType
ITEM_BONUS_OVERRIDE_REQUIRED_LEVEL = 18,
ITEM_BONUS_AZERITE_TIER_UNLOCK_SET = 19,
ITEM_BONUS_SCRAPPING_LOOT_ID = 20, /*NYI*/
ITEM_BONUS_OVERRIDE_CAN_DISENCHANT = 21,
ITEM_BONUS_OVERRIDE_CAN_SCRAP = 22,
ITEM_BONUS_ITEM_EFFECT_ID = 23,
ITEM_BONUS_SALVAGE_LOOT_ID = 21,
ITEM_BONUS_OVERRIDE_CAN_DISENCHANT = 22,
ITEM_BONUS_OVERRIDE_CAN_SCRAP = 23,
ITEM_BONUS_ITEM_EFFECT_ID = 24,
ITEM_BONUS_MODIFIED_CRAFTING_STAT = 25, /*NYI*/
ITEM_BONUS_REQUIRED_LEVEL_CURVE = 27,
ITEM_BONUS_ICON_FILE_DATA_ID = 28,
+14
View File
@@ -2452,6 +2452,20 @@ Optional<uint16> Item::GetDisenchantSkillRequired() const
return disenchantLoot->SkillRequired;
}
std::vector<ItemSalvageLootEntry const*> Item::GetSalvageLoot() const
{
std::vector<ItemSalvageLootEntry const*> salvageLoot;
if (!_bonusData.CanSalvage)
return salvageLoot;
for (ItemSalvageLootEntry const* entry : sItemSalvageLootStore)
if (entry->SalvagedItemID == int32(GetEntry()))
salvageLoot.push_back(entry);
return salvageLoot;
}
ItemDisenchantLootEntry const* Item::GetBaseDisenchantLoot(ItemTemplate const* itemTemplate, uint32 quality, uint32 itemLevel)
{
if (itemTemplate->HasFlag(ITEM_FLAG_CONJURED) || itemTemplate->HasFlag(ITEM_FLAG_NO_DISENCHANT) || itemTemplate->GetBonding() == BIND_QUEST)
+1
View File
@@ -368,6 +368,7 @@ class TC_GAME_API Item : public Object
uint32 GetScalingContentTuningId() const { return _bonusData.ContentTuningId; }
Optional<uint32> GetDisenchantLootId() const;
Optional<uint16> GetDisenchantSkillRequired() const;
std::vector<ItemSalvageLootEntry const*> GetSalvageLoot() const;
static ItemDisenchantLootEntry const* GetBaseDisenchantLoot(ItemTemplate const* itemTemplate, uint32 quality, uint32 itemLevel);
void SetFixedLevel(uint8 level);
std::span<ItemEffectEntry const* const> GetEffects() const { return { _bonusData.Effects.data(), _bonusData.EffectCount }; }
+1 -1
View File
@@ -110,7 +110,7 @@ enum LootType : uint8
LOOT_CORPSE_PERSONAL = 14,
LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead
LOOT_INSIGNIA = 21, // unsupported by client, sending LOOT_CORPSE instead
LOOT_INSIGNIA = 21, // unsupported by client, sending LOOT_SKINNING instead
LOOT_FISHING_JUNK = 22, // unsupported by client, sending LOOT_FISHING instead
LOOT_PROSPECTING = 23,
LOOT_MILLING = 24,
+40
View File
@@ -2948,6 +2948,46 @@ void Spell::EffectCraftSalvageItem()
if (!itemTarget->GetBonus()->CanSalvage)
return;
if (!m_CastItem)
player->UpdateCraftSkill(m_spellInfo);
std::vector<ItemSalvageLootEntry const*> salvageLoot = itemTarget->GetSalvageLoot();
if (salvageLoot.empty())
{
player->DestroyItem(itemTarget->GetBagSlot(), itemTarget->GetSlot(), true);
return;
}
itemTarget->m_loot.reset(new Loot(player->GetMap(), itemTarget->GetGUID(), LOOT_DISENCHANTING, nullptr));
for (ItemSalvageLootEntry const* entry : salvageLoot)
{
if (entry->ResultingTreasureID)
{
itemTarget->m_loot->FillLoot(entry->ResultingTreasureID, LootTemplates_Disenchant, player, true);
}
else if (entry->ItemSalvageID)
{
// Direct item drop
ItemPosCountVec dest;
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, entry->ItemSalvageID, 1);
if (msg == EQUIP_ERR_OK)
{
if (Item* newItem = player->StoreNewItem(dest, entry->ItemSalvageID, true, GenerateItemRandomBonusListId(entry->ItemSalvageID)))
{
player->SendNewItem(newItem, 1, true, false);
}
}
else
{
player->SendEquipError(msg, nullptr, nullptr, entry->ItemSalvageID);
}
}
}
if (itemTarget->m_loot->items.size() > 0)
player->SendLoot(*itemTarget->m_loot);
player->DestroyItem(itemTarget->GetBagSlot(), itemTarget->GetSlot(), true);
}