From e5f64e68d40a43e96950e3dd2004ad4471fa2579 Mon Sep 17 00:00:00 2001 From: Keleborn <22352763+Celandriel@users.noreply.github.com> Date: Fri, 19 Jun 2026 15:31:20 -0700 Subject: [PATCH] Required update for core (#2492) ## Pull Request Description CHanges the ID and quest action packets required by core update commits. ## Feature Evaluation - Describe the **minimum logic** required to achieve the intended behavior. - Describe the **processing cost** when this logic executes across many bots. ## How to Test the Changes ## Impact Assessment - Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots? - - [x] No, not at all - - [ ] Minimal impact (**explain below**) - - [ ] Moderate impact (**explain below**) - Does this change modify default bot behavior? - - [x] No - - [ ] Yes (**explain why**) - Does this change add new decision branches or increase maintenance complexity? - - [x] No - - [ ] Yes (**explain below**) ## AI Assistance Was AI assistance used while working on this change? - - [ ] No - - [x] Yes (**explain below**) ## Final Checklist - - [x] Stability is not compromised. - - [x] Performance impact is understood, tested, and acceptable. - - [x] Added logic complexity is justified and explained. - - [x] Any new bot dialogue lines are translated. - - [x] Documentation updated if needed (Conf comments, WiKi commands). ## Notes for Reviewers --- .../Base/Actions/QuestConfirmAcceptAction.cpp | 5 ++++- src/Ai/Base/Actions/ShareQuestAction.cpp | 13 +++++++++---- src/Ai/Base/Value/PvpValues.cpp | 2 +- src/Ai/Base/Value/QuestValues.cpp | 2 +- src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp | 13 ++++++++++--- src/Bot/Engine/Value/Value.cpp | 4 ++-- src/Bot/PlayerbotAI.cpp | 4 ++-- src/Bot/RandomPlayerbotMgr.cpp | 4 ++-- src/Mgr/Guild/GuildTaskMgr.cpp | 4 ++-- src/Mgr/Item/RandomItemMgr.cpp | 6 +++--- src/Mgr/Travel/TravelMgr.cpp | 18 +++++++++--------- src/Mgr/Travel/TravelNode.cpp | 4 ++-- 12 files changed, 47 insertions(+), 32 deletions(-) diff --git a/src/Ai/Base/Actions/QuestConfirmAcceptAction.cpp b/src/Ai/Base/Actions/QuestConfirmAcceptAction.cpp index 9c47af37b..4197f53ed 100644 --- a/src/Ai/Base/Actions/QuestConfirmAcceptAction.cpp +++ b/src/Ai/Base/Actions/QuestConfirmAcceptAction.cpp @@ -1,5 +1,6 @@ #include "QuestConfirmAcceptAction.h" +#include "QuestPackets.h" #include "WorldPacket.h" bool QuestConfirmAcceptAction::Execute(Event event) @@ -18,6 +19,8 @@ bool QuestConfirmAcceptAction::Execute(Event event) std::ostringstream out; out << "Quest: " << chat->FormatQuest(quest) << " confirm accept"; botAI->TellMaster(out); - bot->GetSession()->HandleQuestConfirmAccept(sendPacket); + WorldPackets::Quest::QuestConfirmAcceptClient confirmAccept(std::move(sendPacket)); + confirmAccept.Read(); + bot->GetSession()->HandleQuestConfirmAccept(confirmAccept); return true; } diff --git a/src/Ai/Base/Actions/ShareQuestAction.cpp b/src/Ai/Base/Actions/ShareQuestAction.cpp index 492b3ad6e..d80758e70 100644 --- a/src/Ai/Base/Actions/ShareQuestAction.cpp +++ b/src/Ai/Base/Actions/ShareQuestAction.cpp @@ -8,6 +8,7 @@ #include "Event.h" #include "PlayerbotTextMgr.h" #include "Playerbots.h" +#include "QuestPackets.h" bool ShareQuestAction::Execute(Event event) { @@ -30,9 +31,11 @@ bool ShareQuestAction::Execute(Event event) uint32 logQuest = bot->GetQuestSlotQuestId(slot); if (logQuest == entry) { - WorldPacket p; + WorldPacket p(CMSG_PUSHQUESTTOPARTY); p << entry; - bot->GetSession()->HandlePushQuestToParty(p); + WorldPackets::Quest::PushQuestToParty pushQuest(std::move(p)); + pushQuest.Read(); + bot->GetSession()->HandlePushQuestToParty(pushQuest); botAI->TellMaster(PlayerbotTextMgr::instance().GetBotTextOrDefault( "quest_shared", "Quest shared", {})); return true; @@ -97,9 +100,11 @@ bool AutoShareQuestAction::Execute(Event /*event*/) if (!partyNeedsQuest) continue; - WorldPacket p; + WorldPacket p(CMSG_PUSHQUESTTOPARTY); p << logQuest; - bot->GetSession()->HandlePushQuestToParty(p); + WorldPackets::Quest::PushQuestToParty pushQuest(std::move(p)); + pushQuest.Read(); + bot->GetSession()->HandlePushQuestToParty(pushQuest); botAI->TellMaster(PlayerbotTextMgr::instance().GetBotTextOrDefault( "quest_shared", "Quest shared", {})); shared = true; diff --git a/src/Ai/Base/Value/PvpValues.cpp b/src/Ai/Base/Value/PvpValues.cpp index c8caf1441..12ac5f2e2 100644 --- a/src/Ai/Base/Value/PvpValues.cpp +++ b/src/Ai/Base/Value/PvpValues.cpp @@ -136,7 +136,7 @@ CreatureData const* BgMasterValue::NearestBm(bool allowDead) if (rbmPair && rDist <= dist) continue; - CreatureTemplate const* bmTemplate = sObjectMgr->GetCreatureTemplate(bmPair->id1); + CreatureTemplate const* bmTemplate = sObjectMgr->GetCreatureTemplate(bmPair->id); if (!bmTemplate) continue; diff --git a/src/Ai/Base/Value/QuestValues.cpp b/src/Ai/Base/Value/QuestValues.cpp index f556f443d..0ce201f78 100644 --- a/src/Ai/Base/Value/QuestValues.cpp +++ b/src/Ai/Base/Value/QuestValues.cpp @@ -64,7 +64,7 @@ void FindQuestObjectData::GetObjectiveEntries() // quest map. void FindQuestObjectData::operator()(CreatureData const& creData) { - uint32 entry = creData.id1; + uint32 entry = creData.id; for (auto& relation : relationMap[entry]) { diff --git a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp index 5ae65e14e..e67a1c7c4 100644 --- a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp +++ b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp @@ -24,6 +24,7 @@ #include "Playerbots.h" #include "Position.h" #include "QuestDef.h" +#include "QuestPackets.h" #include "Random.h" #include "RandomPlayerbotMgr.h" #include "SharedDefines.h" @@ -604,7 +605,9 @@ bool NewRpgBaseAction::OrganizeQuestLog() LOG_DEBUG("playerbots", "[New RPG] {} drop quest {}", bot->GetName(), questId); WorldPacket packet(CMSG_QUESTLOG_REMOVE_QUEST); packet << (uint8)i; - bot->GetSession()->HandleQuestLogRemoveQuest(packet); + WorldPackets::Quest::QuestLogRemoveQuest removeQuest(std::move(packet)); + removeQuest.Read(); + bot->GetSession()->HandleQuestLogRemoveQuest(removeQuest); if (botAI->GetMaster()) botAI->TellMasterNoFacing(PlayerbotTextMgr::instance().GetBotTextOrDefault( "new_rpg_quest_dropped", @@ -634,7 +637,9 @@ bool NewRpgBaseAction::OrganizeQuestLog() LOG_DEBUG("playerbots", "[New RPG] {} drop quest {}", bot->GetName(), questId); WorldPacket packet(CMSG_QUESTLOG_REMOVE_QUEST); packet << (uint8)i; - bot->GetSession()->HandleQuestLogRemoveQuest(packet); + WorldPackets::Quest::QuestLogRemoveQuest removeQuest(std::move(packet)); + removeQuest.Read(); + bot->GetSession()->HandleQuestLogRemoveQuest(removeQuest); if (botAI->GetMaster()) botAI->TellMasterNoFacing(PlayerbotTextMgr::instance().GetBotTextOrDefault( "new_rpg_quest_dropped", @@ -659,7 +664,9 @@ bool NewRpgBaseAction::OrganizeQuestLog() LOG_DEBUG("playerbots", "[New RPG] {} drop quest {}", bot->GetName(), questId); WorldPacket packet(CMSG_QUESTLOG_REMOVE_QUEST); packet << (uint8)i; - bot->GetSession()->HandleQuestLogRemoveQuest(packet); + WorldPackets::Quest::QuestLogRemoveQuest removeQuest(std::move(packet)); + removeQuest.Read(); + bot->GetSession()->HandleQuestLogRemoveQuest(removeQuest); if (botAI->GetMaster()) botAI->TellMasterNoFacing(PlayerbotTextMgr::instance().GetBotTextOrDefault( "new_rpg_quest_dropped", diff --git a/src/Bot/Engine/Value/Value.cpp b/src/Bot/Engine/Value/Value.cpp index a9235a8e9..ec3aae01c 100644 --- a/src/Bot/Engine/Value/Value.cpp +++ b/src/Bot/Engine/Value/Value.cpp @@ -58,7 +58,7 @@ std::string const CDPairCalculatedValue::Format() CreatureData const* creatureData = Calculate(); if (creatureData) { - CreatureTemplate const* bmTemplate = sObjectMgr->GetCreatureTemplate(creatureData->id1); + CreatureTemplate const* bmTemplate = sObjectMgr->GetCreatureTemplate(creatureData->id); return bmTemplate ? bmTemplate->Name : ""; } @@ -78,7 +78,7 @@ std::string const CDPairListCalculatedValue::Format() std::vector cdPairs = Calculate(); for (CreatureData const* cdPair : cdPairs) { - out << cdPair->id1 << ","; + out << cdPair->id << ","; } out << "}"; diff --git a/src/Bot/PlayerbotAI.cpp b/src/Bot/PlayerbotAI.cpp index 00f878686..27f0d6a4c 100644 --- a/src/Bot/PlayerbotAI.cpp +++ b/src/Bot/PlayerbotAI.cpp @@ -2589,7 +2589,7 @@ Player* PlayerbotAI::GetPlayer(ObjectGuid guid) uint32 GetCreatureIdForCreatureTemplateId(uint32 creatureTemplateId) { QueryResult results = - WorldDatabase.Query("SELECT guid FROM `creature` WHERE id1 = {} LIMIT 1;", creatureTemplateId); + WorldDatabase.Query("SELECT guid FROM `creature` WHERE id = {} LIMIT 1;", creatureTemplateId); if (results) { Field* fields = results->Fetch(); @@ -2610,7 +2610,7 @@ Unit* PlayerbotAI::GetUnit(CreatureData const* creatureData) uint32 spawnId = creatureData->spawnId; if (!spawnId) // workaround for CreatureData with missing spawnId (this just uses first matching creatureId in DB, // but thats ok this method is only used for battlemasters and theres only 1 of each type) - spawnId = GetCreatureIdForCreatureTemplateId(creatureData->id1); + spawnId = GetCreatureIdForCreatureTemplateId(creatureData->id); auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(spawnId); if (creatureBounds.first == creatureBounds.second) return nullptr; diff --git a/src/Bot/RandomPlayerbotMgr.cpp b/src/Bot/RandomPlayerbotMgr.cpp index bca119664..5910c2f64 100644 --- a/src/Bot/RandomPlayerbotMgr.cpp +++ b/src/Bot/RandomPlayerbotMgr.cpp @@ -2029,7 +2029,7 @@ uint32 RandomPlayerbotMgr::GetZoneLevel(uint16 mapId, float teleX, float teleY, uint32 level = 0; QueryResult results = WorldDatabase.Query( "SELECT AVG(t.minlevel) minlevel, AVG(t.maxlevel) maxlevel FROM creature c " - "INNER JOIN creature_template t ON c.id1 = t.entry WHERE map = {} AND minlevel > 1 AND ABS(position_x - {}) < " + "INNER JOIN creature_template t ON c.id = t.entry WHERE map = {} AND minlevel > 1 AND ABS(position_x - {}) < " "{} AND ABS(position_y - {}) < {}", mapId, teleX, sPlayerbotAIConfig.randomBotTeleportDistance / 2, teleY, sPlayerbotAIConfig.randomBotTeleportDistance / 2); @@ -3053,7 +3053,7 @@ CreatureData const* RandomPlayerbotMgr::GetCreatureDataByEntry(uint32 entry) if (entry != 0) { for (auto const& itr : sObjectMgr->GetAllCreatureData()) - if (itr.second.id1 == entry) + if (itr.second.id == entry) return &itr.second; } diff --git a/src/Mgr/Guild/GuildTaskMgr.cpp b/src/Mgr/Guild/GuildTaskMgr.cpp index d73662a79..1a9c011a9 100644 --- a/src/Mgr/Guild/GuildTaskMgr.cpp +++ b/src/Mgr/Guild/GuildTaskMgr.cpp @@ -223,7 +223,7 @@ bool GuildTaskMgr::CreateKillTask(Player* player, uint32 guildId) uint32 level = player->GetLevel(); QueryResult results = WorldDatabase.Query( "SELECT ct.Entry, c.map, c.position_x, c.position_y, ct.Name FROM creature_template ct " - "JOIN creature c ON ct.Entry = c.id1 WHERE ct.MaxLevel < {} AND ct.MinLevel > {} AND ct.Rank = {} ", + "JOIN creature c ON ct.Entry = c.id WHERE ct.MaxLevel < {} AND ct.MinLevel > {} AND ct.Rank = {} ", level + 4, level - 3, rank); if (results) { @@ -387,7 +387,7 @@ bool GuildTaskMgr::SendKillAdvertisement(CharacterDatabaseTransaction& trans, ui return false; QueryResult result = - WorldDatabase.Query("SELECT map, position_x, position_y, position_z FROM creature WHERE id1 = {}", creatureId); + WorldDatabase.Query("SELECT map, position_x, position_y, position_z FROM creature WHERE id = {}", creatureId); if (!result) return false; diff --git a/src/Mgr/Item/RandomItemMgr.cpp b/src/Mgr/Item/RandomItemMgr.cpp index c57080644..f5ac958b8 100644 --- a/src/Mgr/Item/RandomItemMgr.cpp +++ b/src/Mgr/Item/RandomItemMgr.cpp @@ -2694,7 +2694,7 @@ void RandomItemMgr::BuildRarityCache() ") chance, 'creature' type " "FROM creature_loot_template lt " "JOIN creature_template ct ON ct.LootId = lt.entry " - "JOIN creature c ON c.id1 = ct.entry " + "JOIN creature c ON c.id = ct.entry " "WHERE lt.item = {} " "union all " // "-- Gameobject " @@ -2712,7 +2712,7 @@ void RandomItemMgr::BuildRarityCache() ") chance, 'gameobject' type " "FROM gameobject_loot_template lt " "JOIN gameobject_template ct ON ct.data1 = lt.entry " - "JOIN gameobject c ON c.id1 = ct.entry " + "JOIN gameobject c ON c.id = ct.entry " "WHERE lt.item = {} " "union all " // "-- Disenchant " @@ -2763,7 +2763,7 @@ void RandomItemMgr::BuildRarityCache() ") chance, 'skinning' type " "FROM skinning_loot_template lt " "JOIN creature_template ct ON ct.SkinningLootId = lt.entry " - "JOIN creature c ON c.id1 = ct.entry " + "JOIN creature c ON c.id = ct.entry " "WHERE lt.item = {}) q; ", itr.first, itr.first, itr.first, itr.first, itr.first); diff --git a/src/Mgr/Travel/TravelMgr.cpp b/src/Mgr/Travel/TravelMgr.cpp index 7192c2c26..a0ff63b57 100644 --- a/src/Mgr/Travel/TravelMgr.cpp +++ b/src/Mgr/Travel/TravelMgr.cpp @@ -909,7 +909,7 @@ uint32 WorldPosition::getUnitsAggro(GuidVector& units, Player* bot) void FindPointCreatureData::operator()(CreatureData const& creatureData) { - if (!entry || creatureData.id1 == entry) + if (!entry || creatureData.id == entry) if ((!point || creatureData.mapid == point.GetMapId()) && (!radius || point.sqDistance(WorldPosition(creatureData.mapid, creatureData.posX, creatureData.posY, creatureData.posZ)) < radius * radius)) @@ -1060,7 +1060,7 @@ bool GuidPosition::IsCreatureOrGOAccessible() GuidPosition::GuidPosition(WorldObject* wo) : ObjectGuid(wo->GetGUID()), WorldPosition(wo), loadedFromDB(false) {} GuidPosition::GuidPosition(CreatureData const& creData) - : ObjectGuid(HighGuid::Unit, creData.id1, creData.spawnId), + : ObjectGuid(HighGuid::Unit, creData.id, creData.spawnId), WorldPosition(creData.mapid, creData.posX, creData.posY, creData.posZ, creData.orientation) { loadedFromDB = true; @@ -1885,14 +1885,14 @@ void TravelMgr::LoadQuestTravelTable() for (auto& creatureData : WorldPosition().getCreaturesNear()) { t_unit.type = 0; - t_unit.entry = creatureData->id1; + t_unit.entry = creatureData->id; t_unit.map = creatureData->mapid; t_unit.x = creatureData->posX; t_unit.y = creatureData->posY; t_unit.z = creatureData->posZ; t_unit.o = creatureData->orientation; - entryCount[creatureData->id1]++; + entryCount[creatureData->id]++; units.push_back(t_unit); } @@ -1920,7 +1920,7 @@ void TravelMgr::LoadQuestTravelTable() /* // 0 1 2 3 4 5 6 7 8 std::string const query = "SELECT 0,guid,id,map,position_x,position_y,position_z,orientation, (SELECT COUNT(*) FROM - creature k WHERE c.id1 = k.id1) FROM creature c UNION ALL SELECT + creature k WHERE c.id = k.id) FROM creature c UNION ALL SELECT 1,guid,id,map,position_x,position_y,position_z,orientation, (SELECT COUNT(*) FROM gameobject h WHERE h.id = g.id) FROM gameobject g"; @@ -2918,7 +2918,7 @@ void TravelMgr::LoadQuestTravelTable() { for (CreatureData const* cData : WorldPosition().getCreaturesNear()) { - CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(cData->id1); + CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(cData->id); if (!cInfo) continue; @@ -4648,7 +4648,7 @@ void TravelMgr::PrepareDestinationCache() std::map>> tempCreatureCache; for (auto const& [guid, creatureData] : sObjectMgr->GetAllCreatureData()) { - CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(creatureData.id1); + CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(creatureData.id); if (!creatureTemplate) continue; @@ -4661,7 +4661,7 @@ void TravelMgr::PrepareDestinationCache() float y = creatureData.posY; float z = creatureData.posZ; float orient = creatureData.orientation; - uint32 templateEntry = creatureData.id1; + uint32 templateEntry = creatureData.id; Map* map = sMapMgr->FindMap(mapId, 0); if (!map) @@ -4813,7 +4813,7 @@ void TravelMgr::PrepareDestinationCache() { if (creatureDataList.size() >= 2) { - CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(creatureDataList[0].id1); + CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(creatureDataList[0].id); uint32 level = (creatureTemplate->minlevel + creatureTemplate->maxlevel + 1) / 2; for (int32 l = (int32)level - (int32)sPlayerbotAIConfig.randomBotTeleLowerLevel; l <= (int32)level + (int32)sPlayerbotAIConfig.randomBotTeleHigherLevel; l++) diff --git a/src/Mgr/Travel/TravelNode.cpp b/src/Mgr/Travel/TravelNode.cpp index 9d25d4ea7..c18bc2940 100644 --- a/src/Mgr/Travel/TravelNode.cpp +++ b/src/Mgr/Travel/TravelNode.cpp @@ -56,7 +56,7 @@ void TravelNodePath::calculateCost(bool distanceOnly) { for (CreatureData const* cData : point.getCreaturesNear(50)) // Agro radius + 5 { - CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(cData->id1); + CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(cData->id); if (cInfo) { FactionTemplateEntry const* factionEntry = sFactionTemplateStore.LookupEntry(cInfo->faction); @@ -1597,7 +1597,7 @@ void TravelNodeMap::generateNpcNodes() WorldPosition guidP(creatureData->mapid, creatureData->posX, creatureData->posY, creatureData->posZ, creatureData->orientation); - CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureData->id1); + CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureData->id); if (!cInfo) continue;