mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 23:49:25 +02:00
Required update for core (#2492)
<!--
Thank you for contributing to mod-playerbots, please make sure that
you...
1. Submit your PR to the test-staging branch, not master.
2. Read the guidelines below before submitting.
3. Don't delete parts of this template.
DESIGN PHILOSOPHY: We prioritize STABILITY, PERFORMANCE, AND
PREDICTABILITY over behavioral realism.
Every action and decision executes PER BOT AND PER TRIGGER. Small
increases in logic complexity scale
poorly across thousands of bots and negatively affect all. We prioritize
a stable system over a smarter
one. Bots don't need to behave perfectly; believable behavior is the
goal, not human simulation.
Default behavior must be cheap in processing; expensive behavior must be
opt-in.
Before submitting, make sure your changes aligns with these principles.
-->
## Pull Request Description
<!-- Describe what this change does and why it is needed -->
CHanges the ID and quest action packets required by core update commits.
## Feature Evaluation
<!--
If your PR is very minimal (comment typo, wrong ID reference, etc), and
it is very obvious it will not have
any impact on performance, you may skip these question. If necessary, a
maintainer may ask you for them later.
-->
<!-- Please answer the following: -->
- 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
<!--
- Step-by-step instructions to test the change.
- Any required setup (e.g. multiple players, number of bots, specific
configuration).
- Expected behavior and how to verify it.
-->
## Impact Assessment
<!-- As a generic test, before and after measure of pmon (playerbot pmon
tick) can help you here. -->
- 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
<!--
AI assistance is allowed, but all submitted code must be fully
understood, reviewed, and owned by the contributor.
We expect contributors to be honest about what they do and do not
understand.
-->
Was AI assistance used while working on this change?
- - [ ] No
- - [x] Yes (**explain below**)
<!--
If yes, please specify:
- Purpose of usage (e.g. brainstorming, refactoring, documentation, code
generation).
- Which parts of the change were influenced or generated, and whether it
was thoroughly reviewed.
-->
<!--
TRANSLATIONS:
Anything new that the bots say in chat must be in a translatable format.
This is done using GetBotTextOrDefault,
which you can search for in the codebase to find examples. Your code
needs to have English as the default fallback,
while the full translations need to be in an SQL update file. The
languages in the file are the nine language
options supported by AzerothCore: English, Korean, French, German,
Chinese, Taiwanese, Spanish, Spanish Mexico, and
Russian. See
data/sql/playerbots/updates/2025_12_27_ai_playerbot_fishing_text.sql as
an example of a translation SQL
update, whose content are called within the codebase at
src/strategy/actions/FishingAction.cpp
-->
## 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
<!-- Anything else that's helpful to review or test your pull request.
-->
This commit is contained in:
parent
fc882f9a91
commit
e5f64e68d4
@ -1,5 +1,6 @@
|
|||||||
#include "QuestConfirmAcceptAction.h"
|
#include "QuestConfirmAcceptAction.h"
|
||||||
|
|
||||||
|
#include "QuestPackets.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
|
|
||||||
bool QuestConfirmAcceptAction::Execute(Event event)
|
bool QuestConfirmAcceptAction::Execute(Event event)
|
||||||
@ -18,6 +19,8 @@ bool QuestConfirmAcceptAction::Execute(Event event)
|
|||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "Quest: " << chat->FormatQuest(quest) << " confirm accept";
|
out << "Quest: " << chat->FormatQuest(quest) << " confirm accept";
|
||||||
botAI->TellMaster(out);
|
botAI->TellMaster(out);
|
||||||
bot->GetSession()->HandleQuestConfirmAccept(sendPacket);
|
WorldPackets::Quest::QuestConfirmAcceptClient confirmAccept(std::move(sendPacket));
|
||||||
|
confirmAccept.Read();
|
||||||
|
bot->GetSession()->HandleQuestConfirmAccept(confirmAccept);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotTextMgr.h"
|
#include "PlayerbotTextMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
#include "QuestPackets.h"
|
||||||
|
|
||||||
bool ShareQuestAction::Execute(Event event)
|
bool ShareQuestAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
@ -30,9 +31,11 @@ bool ShareQuestAction::Execute(Event event)
|
|||||||
uint32 logQuest = bot->GetQuestSlotQuestId(slot);
|
uint32 logQuest = bot->GetQuestSlotQuestId(slot);
|
||||||
if (logQuest == entry)
|
if (logQuest == entry)
|
||||||
{
|
{
|
||||||
WorldPacket p;
|
WorldPacket p(CMSG_PUSHQUESTTOPARTY);
|
||||||
p << entry;
|
p << entry;
|
||||||
bot->GetSession()->HandlePushQuestToParty(p);
|
WorldPackets::Quest::PushQuestToParty pushQuest(std::move(p));
|
||||||
|
pushQuest.Read();
|
||||||
|
bot->GetSession()->HandlePushQuestToParty(pushQuest);
|
||||||
botAI->TellMaster(PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
botAI->TellMaster(PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"quest_shared", "Quest shared", {}));
|
"quest_shared", "Quest shared", {}));
|
||||||
return true;
|
return true;
|
||||||
@ -97,9 +100,11 @@ bool AutoShareQuestAction::Execute(Event /*event*/)
|
|||||||
if (!partyNeedsQuest)
|
if (!partyNeedsQuest)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
WorldPacket p;
|
WorldPacket p(CMSG_PUSHQUESTTOPARTY);
|
||||||
p << logQuest;
|
p << logQuest;
|
||||||
bot->GetSession()->HandlePushQuestToParty(p);
|
WorldPackets::Quest::PushQuestToParty pushQuest(std::move(p));
|
||||||
|
pushQuest.Read();
|
||||||
|
bot->GetSession()->HandlePushQuestToParty(pushQuest);
|
||||||
botAI->TellMaster(PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
botAI->TellMaster(PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"quest_shared", "Quest shared", {}));
|
"quest_shared", "Quest shared", {}));
|
||||||
shared = true;
|
shared = true;
|
||||||
|
|||||||
@ -136,7 +136,7 @@ CreatureData const* BgMasterValue::NearestBm(bool allowDead)
|
|||||||
if (rbmPair && rDist <= dist)
|
if (rbmPair && rDist <= dist)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CreatureTemplate const* bmTemplate = sObjectMgr->GetCreatureTemplate(bmPair->id1);
|
CreatureTemplate const* bmTemplate = sObjectMgr->GetCreatureTemplate(bmPair->id);
|
||||||
if (!bmTemplate)
|
if (!bmTemplate)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ void FindQuestObjectData::GetObjectiveEntries()
|
|||||||
// quest map.
|
// quest map.
|
||||||
void FindQuestObjectData::operator()(CreatureData const& creData)
|
void FindQuestObjectData::operator()(CreatureData const& creData)
|
||||||
{
|
{
|
||||||
uint32 entry = creData.id1;
|
uint32 entry = creData.id;
|
||||||
|
|
||||||
for (auto& relation : relationMap[entry])
|
for (auto& relation : relationMap[entry])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "Position.h"
|
#include "Position.h"
|
||||||
#include "QuestDef.h"
|
#include "QuestDef.h"
|
||||||
|
#include "QuestPackets.h"
|
||||||
#include "Random.h"
|
#include "Random.h"
|
||||||
#include "RandomPlayerbotMgr.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
@ -604,7 +605,9 @@ bool NewRpgBaseAction::OrganizeQuestLog()
|
|||||||
LOG_DEBUG("playerbots", "[New RPG] {} drop quest {}", bot->GetName(), questId);
|
LOG_DEBUG("playerbots", "[New RPG] {} drop quest {}", bot->GetName(), questId);
|
||||||
WorldPacket packet(CMSG_QUESTLOG_REMOVE_QUEST);
|
WorldPacket packet(CMSG_QUESTLOG_REMOVE_QUEST);
|
||||||
packet << (uint8)i;
|
packet << (uint8)i;
|
||||||
bot->GetSession()->HandleQuestLogRemoveQuest(packet);
|
WorldPackets::Quest::QuestLogRemoveQuest removeQuest(std::move(packet));
|
||||||
|
removeQuest.Read();
|
||||||
|
bot->GetSession()->HandleQuestLogRemoveQuest(removeQuest);
|
||||||
if (botAI->GetMaster())
|
if (botAI->GetMaster())
|
||||||
botAI->TellMasterNoFacing(PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
botAI->TellMasterNoFacing(PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"new_rpg_quest_dropped",
|
"new_rpg_quest_dropped",
|
||||||
@ -634,7 +637,9 @@ bool NewRpgBaseAction::OrganizeQuestLog()
|
|||||||
LOG_DEBUG("playerbots", "[New RPG] {} drop quest {}", bot->GetName(), questId);
|
LOG_DEBUG("playerbots", "[New RPG] {} drop quest {}", bot->GetName(), questId);
|
||||||
WorldPacket packet(CMSG_QUESTLOG_REMOVE_QUEST);
|
WorldPacket packet(CMSG_QUESTLOG_REMOVE_QUEST);
|
||||||
packet << (uint8)i;
|
packet << (uint8)i;
|
||||||
bot->GetSession()->HandleQuestLogRemoveQuest(packet);
|
WorldPackets::Quest::QuestLogRemoveQuest removeQuest(std::move(packet));
|
||||||
|
removeQuest.Read();
|
||||||
|
bot->GetSession()->HandleQuestLogRemoveQuest(removeQuest);
|
||||||
if (botAI->GetMaster())
|
if (botAI->GetMaster())
|
||||||
botAI->TellMasterNoFacing(PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
botAI->TellMasterNoFacing(PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"new_rpg_quest_dropped",
|
"new_rpg_quest_dropped",
|
||||||
@ -659,7 +664,9 @@ bool NewRpgBaseAction::OrganizeQuestLog()
|
|||||||
LOG_DEBUG("playerbots", "[New RPG] {} drop quest {}", bot->GetName(), questId);
|
LOG_DEBUG("playerbots", "[New RPG] {} drop quest {}", bot->GetName(), questId);
|
||||||
WorldPacket packet(CMSG_QUESTLOG_REMOVE_QUEST);
|
WorldPacket packet(CMSG_QUESTLOG_REMOVE_QUEST);
|
||||||
packet << (uint8)i;
|
packet << (uint8)i;
|
||||||
bot->GetSession()->HandleQuestLogRemoveQuest(packet);
|
WorldPackets::Quest::QuestLogRemoveQuest removeQuest(std::move(packet));
|
||||||
|
removeQuest.Read();
|
||||||
|
bot->GetSession()->HandleQuestLogRemoveQuest(removeQuest);
|
||||||
if (botAI->GetMaster())
|
if (botAI->GetMaster())
|
||||||
botAI->TellMasterNoFacing(PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
botAI->TellMasterNoFacing(PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"new_rpg_quest_dropped",
|
"new_rpg_quest_dropped",
|
||||||
|
|||||||
@ -58,7 +58,7 @@ std::string const CDPairCalculatedValue::Format()
|
|||||||
CreatureData const* creatureData = Calculate();
|
CreatureData const* creatureData = Calculate();
|
||||||
if (creatureData)
|
if (creatureData)
|
||||||
{
|
{
|
||||||
CreatureTemplate const* bmTemplate = sObjectMgr->GetCreatureTemplate(creatureData->id1);
|
CreatureTemplate const* bmTemplate = sObjectMgr->GetCreatureTemplate(creatureData->id);
|
||||||
return bmTemplate ? bmTemplate->Name : "<none>";
|
return bmTemplate ? bmTemplate->Name : "<none>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ std::string const CDPairListCalculatedValue::Format()
|
|||||||
std::vector<CreatureData const*> cdPairs = Calculate();
|
std::vector<CreatureData const*> cdPairs = Calculate();
|
||||||
for (CreatureData const* cdPair : cdPairs)
|
for (CreatureData const* cdPair : cdPairs)
|
||||||
{
|
{
|
||||||
out << cdPair->id1 << ",";
|
out << cdPair->id << ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
out << "}";
|
out << "}";
|
||||||
|
|||||||
@ -2589,7 +2589,7 @@ Player* PlayerbotAI::GetPlayer(ObjectGuid guid)
|
|||||||
uint32 GetCreatureIdForCreatureTemplateId(uint32 creatureTemplateId)
|
uint32 GetCreatureIdForCreatureTemplateId(uint32 creatureTemplateId)
|
||||||
{
|
{
|
||||||
QueryResult results =
|
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)
|
if (results)
|
||||||
{
|
{
|
||||||
Field* fields = results->Fetch();
|
Field* fields = results->Fetch();
|
||||||
@ -2610,7 +2610,7 @@ Unit* PlayerbotAI::GetUnit(CreatureData const* creatureData)
|
|||||||
uint32 spawnId = creatureData->spawnId;
|
uint32 spawnId = creatureData->spawnId;
|
||||||
if (!spawnId) // workaround for CreatureData with missing spawnId (this just uses first matching creatureId in DB,
|
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)
|
// 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);
|
auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(spawnId);
|
||||||
if (creatureBounds.first == creatureBounds.second)
|
if (creatureBounds.first == creatureBounds.second)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@ -2029,7 +2029,7 @@ uint32 RandomPlayerbotMgr::GetZoneLevel(uint16 mapId, float teleX, float teleY,
|
|||||||
uint32 level = 0;
|
uint32 level = 0;
|
||||||
QueryResult results = WorldDatabase.Query(
|
QueryResult results = WorldDatabase.Query(
|
||||||
"SELECT AVG(t.minlevel) minlevel, AVG(t.maxlevel) maxlevel FROM creature c "
|
"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 - {}) < {}",
|
"{} AND ABS(position_y - {}) < {}",
|
||||||
mapId, teleX, sPlayerbotAIConfig.randomBotTeleportDistance / 2, teleY,
|
mapId, teleX, sPlayerbotAIConfig.randomBotTeleportDistance / 2, teleY,
|
||||||
sPlayerbotAIConfig.randomBotTeleportDistance / 2);
|
sPlayerbotAIConfig.randomBotTeleportDistance / 2);
|
||||||
@ -3053,7 +3053,7 @@ CreatureData const* RandomPlayerbotMgr::GetCreatureDataByEntry(uint32 entry)
|
|||||||
if (entry != 0)
|
if (entry != 0)
|
||||||
{
|
{
|
||||||
for (auto const& itr : sObjectMgr->GetAllCreatureData())
|
for (auto const& itr : sObjectMgr->GetAllCreatureData())
|
||||||
if (itr.second.id1 == entry)
|
if (itr.second.id == entry)
|
||||||
return &itr.second;
|
return &itr.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -223,7 +223,7 @@ bool GuildTaskMgr::CreateKillTask(Player* player, uint32 guildId)
|
|||||||
uint32 level = player->GetLevel();
|
uint32 level = player->GetLevel();
|
||||||
QueryResult results = WorldDatabase.Query(
|
QueryResult results = WorldDatabase.Query(
|
||||||
"SELECT ct.Entry, c.map, c.position_x, c.position_y, ct.Name FROM creature_template ct "
|
"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);
|
level + 4, level - 3, rank);
|
||||||
if (results)
|
if (results)
|
||||||
{
|
{
|
||||||
@ -387,7 +387,7 @@ bool GuildTaskMgr::SendKillAdvertisement(CharacterDatabaseTransaction& trans, ui
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
QueryResult result =
|
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)
|
if (!result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@ -2694,7 +2694,7 @@ void RandomItemMgr::BuildRarityCache()
|
|||||||
") chance, 'creature' type "
|
") chance, 'creature' type "
|
||||||
"FROM creature_loot_template lt "
|
"FROM creature_loot_template lt "
|
||||||
"JOIN creature_template ct ON ct.LootId = lt.entry "
|
"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 = {} "
|
"WHERE lt.item = {} "
|
||||||
"union all "
|
"union all "
|
||||||
// "-- Gameobject "
|
// "-- Gameobject "
|
||||||
@ -2712,7 +2712,7 @@ void RandomItemMgr::BuildRarityCache()
|
|||||||
") chance, 'gameobject' type "
|
") chance, 'gameobject' type "
|
||||||
"FROM gameobject_loot_template lt "
|
"FROM gameobject_loot_template lt "
|
||||||
"JOIN gameobject_template ct ON ct.data1 = lt.entry "
|
"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 = {} "
|
"WHERE lt.item = {} "
|
||||||
"union all "
|
"union all "
|
||||||
// "-- Disenchant "
|
// "-- Disenchant "
|
||||||
@ -2763,7 +2763,7 @@ void RandomItemMgr::BuildRarityCache()
|
|||||||
") chance, 'skinning' type "
|
") chance, 'skinning' type "
|
||||||
"FROM skinning_loot_template lt "
|
"FROM skinning_loot_template lt "
|
||||||
"JOIN creature_template ct ON ct.SkinningLootId = lt.entry "
|
"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; ",
|
"WHERE lt.item = {}) q; ",
|
||||||
itr.first, itr.first, itr.first, itr.first, itr.first);
|
itr.first, itr.first, itr.first, itr.first, itr.first);
|
||||||
|
|
||||||
|
|||||||
@ -909,7 +909,7 @@ uint32 WorldPosition::getUnitsAggro(GuidVector& units, Player* bot)
|
|||||||
|
|
||||||
void FindPointCreatureData::operator()(CreatureData const& creatureData)
|
void FindPointCreatureData::operator()(CreatureData const& creatureData)
|
||||||
{
|
{
|
||||||
if (!entry || creatureData.id1 == entry)
|
if (!entry || creatureData.id == entry)
|
||||||
if ((!point || creatureData.mapid == point.GetMapId()) &&
|
if ((!point || creatureData.mapid == point.GetMapId()) &&
|
||||||
(!radius || point.sqDistance(WorldPosition(creatureData.mapid, creatureData.posX, creatureData.posY,
|
(!radius || point.sqDistance(WorldPosition(creatureData.mapid, creatureData.posX, creatureData.posY,
|
||||||
creatureData.posZ)) < radius * radius))
|
creatureData.posZ)) < radius * radius))
|
||||||
@ -1060,7 +1060,7 @@ bool GuidPosition::IsCreatureOrGOAccessible()
|
|||||||
GuidPosition::GuidPosition(WorldObject* wo) : ObjectGuid(wo->GetGUID()), WorldPosition(wo), loadedFromDB(false) {}
|
GuidPosition::GuidPosition(WorldObject* wo) : ObjectGuid(wo->GetGUID()), WorldPosition(wo), loadedFromDB(false) {}
|
||||||
|
|
||||||
GuidPosition::GuidPosition(CreatureData const& creData)
|
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)
|
WorldPosition(creData.mapid, creData.posX, creData.posY, creData.posZ, creData.orientation)
|
||||||
{
|
{
|
||||||
loadedFromDB = true;
|
loadedFromDB = true;
|
||||||
@ -1885,14 +1885,14 @@ void TravelMgr::LoadQuestTravelTable()
|
|||||||
for (auto& creatureData : WorldPosition().getCreaturesNear())
|
for (auto& creatureData : WorldPosition().getCreaturesNear())
|
||||||
{
|
{
|
||||||
t_unit.type = 0;
|
t_unit.type = 0;
|
||||||
t_unit.entry = creatureData->id1;
|
t_unit.entry = creatureData->id;
|
||||||
t_unit.map = creatureData->mapid;
|
t_unit.map = creatureData->mapid;
|
||||||
t_unit.x = creatureData->posX;
|
t_unit.x = creatureData->posX;
|
||||||
t_unit.y = creatureData->posY;
|
t_unit.y = creatureData->posY;
|
||||||
t_unit.z = creatureData->posZ;
|
t_unit.z = creatureData->posZ;
|
||||||
t_unit.o = creatureData->orientation;
|
t_unit.o = creatureData->orientation;
|
||||||
|
|
||||||
entryCount[creatureData->id1]++;
|
entryCount[creatureData->id]++;
|
||||||
|
|
||||||
units.push_back(t_unit);
|
units.push_back(t_unit);
|
||||||
}
|
}
|
||||||
@ -1920,7 +1920,7 @@ void TravelMgr::LoadQuestTravelTable()
|
|||||||
/*
|
/*
|
||||||
// 0 1 2 3 4 5 6 7 8
|
// 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
|
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)
|
1,guid,id,map,position_x,position_y,position_z,orientation, (SELECT COUNT(*) FROM gameobject h WHERE h.id = g.id)
|
||||||
FROM gameobject g";
|
FROM gameobject g";
|
||||||
|
|
||||||
@ -2918,7 +2918,7 @@ void TravelMgr::LoadQuestTravelTable()
|
|||||||
{
|
{
|
||||||
for (CreatureData const* cData : WorldPosition().getCreaturesNear())
|
for (CreatureData const* cData : WorldPosition().getCreaturesNear())
|
||||||
{
|
{
|
||||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(cData->id1);
|
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(cData->id);
|
||||||
if (!cInfo)
|
if (!cInfo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -4648,7 +4648,7 @@ void TravelMgr::PrepareDestinationCache()
|
|||||||
std::map<uint32, std::map<uint32, std::vector<WorldLocation>>> tempCreatureCache;
|
std::map<uint32, std::map<uint32, std::vector<WorldLocation>>> tempCreatureCache;
|
||||||
for (auto const& [guid, creatureData] : sObjectMgr->GetAllCreatureData())
|
for (auto const& [guid, creatureData] : sObjectMgr->GetAllCreatureData())
|
||||||
{
|
{
|
||||||
CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(creatureData.id1);
|
CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(creatureData.id);
|
||||||
if (!creatureTemplate)
|
if (!creatureTemplate)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -4661,7 +4661,7 @@ void TravelMgr::PrepareDestinationCache()
|
|||||||
float y = creatureData.posY;
|
float y = creatureData.posY;
|
||||||
float z = creatureData.posZ;
|
float z = creatureData.posZ;
|
||||||
float orient = creatureData.orientation;
|
float orient = creatureData.orientation;
|
||||||
uint32 templateEntry = creatureData.id1;
|
uint32 templateEntry = creatureData.id;
|
||||||
|
|
||||||
Map* map = sMapMgr->FindMap(mapId, 0);
|
Map* map = sMapMgr->FindMap(mapId, 0);
|
||||||
if (!map)
|
if (!map)
|
||||||
@ -4813,7 +4813,7 @@ void TravelMgr::PrepareDestinationCache()
|
|||||||
{
|
{
|
||||||
if (creatureDataList.size() >= 2)
|
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;
|
uint32 level = (creatureTemplate->minlevel + creatureTemplate->maxlevel + 1) / 2;
|
||||||
for (int32 l = (int32)level - (int32)sPlayerbotAIConfig.randomBotTeleLowerLevel;
|
for (int32 l = (int32)level - (int32)sPlayerbotAIConfig.randomBotTeleLowerLevel;
|
||||||
l <= (int32)level + (int32)sPlayerbotAIConfig.randomBotTeleHigherLevel; l++)
|
l <= (int32)level + (int32)sPlayerbotAIConfig.randomBotTeleHigherLevel; l++)
|
||||||
|
|||||||
@ -56,7 +56,7 @@ void TravelNodePath::calculateCost(bool distanceOnly)
|
|||||||
{
|
{
|
||||||
for (CreatureData const* cData : point.getCreaturesNear(50)) // Agro radius + 5
|
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)
|
if (cInfo)
|
||||||
{
|
{
|
||||||
FactionTemplateEntry const* factionEntry = sFactionTemplateStore.LookupEntry(cInfo->faction);
|
FactionTemplateEntry const* factionEntry = sFactionTemplateStore.LookupEntry(cInfo->faction);
|
||||||
@ -1597,7 +1597,7 @@ void TravelNodeMap::generateNpcNodes()
|
|||||||
WorldPosition guidP(creatureData->mapid, creatureData->posX, creatureData->posY, creatureData->posZ,
|
WorldPosition guidP(creatureData->mapid, creatureData->posX, creatureData->posY, creatureData->posZ,
|
||||||
creatureData->orientation);
|
creatureData->orientation);
|
||||||
|
|
||||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureData->id1);
|
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureData->id);
|
||||||
if (!cInfo)
|
if (!cInfo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user