mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-20 02:24:35 +00:00
Stage1 refactor world position method names (#2126)
# Pull Request This change replaces the non‑standard WorldPosition::getX/getY/getZ/getO/getMapId wrappers with the core getters (GetPositionX/Y/Z, GetOrientation, GetMapId) and removes the redundant wrappers. Goal: align the module with AzerothCore conventions, reduce local adapters, and improve long‑term maintainability. --- ## Design Philosophy This is a structural cleanup only (coordinate access) and does not alter any AI behavior or decision logic. It follows the stability/performance-first philosophy and does not add branches or extra runtime work. Before submitting: yes, this change aligns with the principles of stability, performance, and predictability. Principles: - **Stability before intelligence** A stable system is always preferred over a smarter one. - **Performance is a shared resource** Any increase in bot cost affects all players and all bots. - **Simple logic scales better than smart logic** Predictable behavior under load is more valuable than perfect decisions. - **Complexity must justify itself** If a feature cannot clearly explain its cost, it should not exist. - **Defaults must be cheap** Expensive behavior must always be optional and clearly communicated. - **Bots should look reasonable, not perfect** The goal is believable behavior, not human simulation. Before submitting, confirm that this change aligns with those principles. --- ## Feature Evaluation Please answer the following: - Minimum logic required: use core getters (GetPositionX/Y/Z, GetMapId, GetOrientation) wherever coordinates are needed. - Cheapest implementation: direct call replacement and removal of redundant wrappers. - Runtime cost: negligible (same data access, no additional logic). --- ## How to Test the Changes - No functional testing required (behavior‑neutral refactor). - Recommended: compile the module and run a normal server startup as validation. ## Complexity & Impact Does this change add new decision branches? - - [x] No - - [x] Yes (**explain below**) Does this change increase per-bot or per-tick processing? - - [x] No - - [ ] Yes (**describe and justify impact**) Could this logic scale poorly under load? - - [x] No - - [ ] Yes (**explain why**) --- ## Defaults & Configuration Does this change modify default bot behavior? - - [x] No - - [ ] Yes (**explain why**) If this introduces more advanced or AI-heavy logic: - - [x] Lightweight mode remains the default - - [x] More complex behavior is optional and thereby configurable --- ## AI Assistance Was AI assistance (e.g. ChatGPT or similar tools) used while working on this change? - - [ ] No - - [x] Yes (**explain below**) If yes, please specify: - AI tool or model used: Copilot - Purpose of usage: Translate this PR text from french to English --- ## Final Checklist - - [x] Stability is not compromised - - [x] Performance impact is understood, tested, and acceptable - - [x] Added logic complexity is justified and explained - - [x] Documentation updated if needed --- ## Notes for Reviewers This is a core-friendly cleanup only, with no behavioral change. No additional logic or CPU cost is introduced.
This commit is contained in:
@@ -320,7 +320,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
inDungeon = true;
|
||||
|
||||
if (realMaster && realMaster->IsInWorld() && realMaster->GetMap()->IsDungeon() &&
|
||||
(realMaster->GetMapId() != pos.getMapId()))
|
||||
(realMaster->GetMapId() != pos.GetMapId()))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
return false;
|
||||
|
||||
Formation* formation = AI_VALUE(Formation*, "formation");
|
||||
float distance = groupLeader->GetDistance2d(pos.getX(), pos.getY());
|
||||
float distance = groupLeader->GetDistance2d(pos.GetPositionX(), pos.GetPositionY());
|
||||
|
||||
if (!botAI->HasActivePlayerMaster() && distance < 50.0f)
|
||||
{
|
||||
|
||||
@@ -28,8 +28,8 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
uint32 areaId = 0;
|
||||
uint32 zoneId = 0;
|
||||
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.getMapId(), pos.getX(), pos.getY(),
|
||||
pos.getZ());
|
||||
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.GetMapId(), pos.GetPositionX(), pos.GetPositionY(),
|
||||
pos.GetPositionZ());
|
||||
|
||||
std::ostringstream out;
|
||||
out << zoneId << "," << areaId << "," << (pos.getAreaName().empty() ? "none" : pos.getAreaName()) << ",";
|
||||
@@ -298,7 +298,7 @@ bool DebugAction::Execute(Event event)
|
||||
for (auto p : ppath)
|
||||
{
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature(1, p.getX(), p.getY(), p.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000.0f);
|
||||
bot->SummonCreature(1, p.GetPositionX(), p.GetPositionY(), p.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000.0f);
|
||||
// addAura(246, wpCreature);
|
||||
units.push_back(wpCreature->GetGUID());
|
||||
|
||||
@@ -325,11 +325,11 @@ bool DebugAction::Execute(Event event)
|
||||
WorldPosition botPos(bot);
|
||||
WorldPosition botPos1 = botPos;
|
||||
|
||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
FakeSpell(spellEffect, wpCreature, wpCreature, prev->GetGUID(), {}, {}, botPos, botPos);
|
||||
@@ -352,11 +352,11 @@ bool DebugAction::Execute(Event event)
|
||||
WorldPosition botPos(bot);
|
||||
WorldPosition botPos1 = botPos;
|
||||
|
||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
@@ -383,11 +383,11 @@ bool DebugAction::Execute(Event event)
|
||||
WorldPosition botPos(bot);
|
||||
WorldPosition botPos1 = botPos;
|
||||
|
||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 5000.0f + i * 100.0f);
|
||||
wpCreature->SetObjectScale(0.5f);
|
||||
|
||||
@@ -411,11 +411,11 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
units.push_back(wpCreature->GetGUID());
|
||||
@@ -480,13 +480,13 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(), botPos.GetPositionY(),
|
||||
botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
@@ -512,11 +512,11 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(effect, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
}
|
||||
}
|
||||
@@ -532,8 +532,8 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
FakeSpell(effect, bot, nullptr, ObjectGuid::Empty, {}, {}, botPos, botPos, true);
|
||||
@@ -552,11 +552,11 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
@@ -568,7 +568,7 @@ bool DebugAction::Execute(Event event)
|
||||
// wpCreature->SendMessageToSet(&data, true);
|
||||
datMap.push_back(data);
|
||||
|
||||
// wpCreature->MonsterMoveWithSpeed(botPos.getX(), botPos.getY() + 80, botPos.getZ(), 8.0f, true,
|
||||
// wpCreature->MonsterMoveWithSpeed(botPos.GetPositionX(), botPos.GetPositionY() + 80, botPos.GetPositionZ(), 8.0f, true,
|
||||
// true);
|
||||
}
|
||||
}
|
||||
@@ -600,13 +600,13 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(), botPos.GetPositionY(),
|
||||
botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
@@ -646,12 +646,12 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(),
|
||||
botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(),
|
||||
botPos.GetPositionY(), botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature && lCreature)
|
||||
{
|
||||
@@ -675,11 +675,11 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
@@ -708,11 +708,11 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
all_targets.push_back(wpCreature->GetGUID());
|
||||
@@ -788,11 +788,11 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
all_targets.push_back(wpCreature->GetGUID());
|
||||
@@ -868,13 +868,13 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + soundEffects * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(), botPos.GetPositionY(),
|
||||
botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
wpCreature->PlayDistanceSound(effect);
|
||||
}
|
||||
@@ -964,7 +964,7 @@ void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, Obje
|
||||
m_targets.SetDst(dest);
|
||||
|
||||
if ((spellInfo && spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION) || forceDest)
|
||||
m_targets.SetSrc(source.getX(), source.getY(), source.getZ());
|
||||
m_targets.SetSrc(source.GetPositionX(), source.GetPositionY(), source.GetPositionZ());
|
||||
|
||||
if (!forceDest && target)
|
||||
if (!spellInfo ||
|
||||
|
||||
@@ -370,7 +370,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
// {
|
||||
// movePosition = endPosition;
|
||||
|
||||
// if (startPosition.getMapId() != endPosition.getMapId() || totalDistance > maxDist)
|
||||
// if (startPosition.GetMapId() != endPosition.GetMapId() || totalDistance > maxDist)
|
||||
// {
|
||||
// if (!TravelNodeMap::instance().getNodes().empty() && !bot->InBattleground())
|
||||
// {
|
||||
@@ -421,7 +421,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
// {
|
||||
// //Use standard PathGenerator to find a route.
|
||||
// PathGenerator path(mover);
|
||||
// path.CalculatePath(movePosition.getX(), movePosition.getY(), movePosition.getZ(), false);
|
||||
// path.CalculatePath(movePosition.GetPositionX(), movePosition.GetPositionY(), movePosition.GetPositionZ(), false);
|
||||
// PathType type = path.GetPathType();
|
||||
// Movement::PointsArray const& points = path.GetPath();
|
||||
// movePath.addPath(startPosition.fromPointsArray(points));
|
||||
@@ -485,8 +485,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
// else
|
||||
// {
|
||||
// LOG_DEBUG("playerbots", "!entry");
|
||||
// return bot->TeleportTo(movePosition.getMapId(), movePosition.getX(), movePosition.getY(),
|
||||
// movePosition.getZ(), movePosition.getO(), 0);
|
||||
// return bot->TeleportTo(movePosition.GetMapId(), movePosition.GetPositionX(), movePosition.GetPositionY(),
|
||||
// movePosition.GetPositionZ(), movePosition.GetOrientation(), 0);
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -563,14 +563,14 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
|
||||
// AI_VALUE(LastMovement&, "last movement").setPath(movePath);
|
||||
|
||||
// if (!movePosition || movePosition.getMapId() != bot->GetMapId())
|
||||
// if (!movePosition || movePosition.GetMapId() != bot->GetMapId())
|
||||
// {
|
||||
// movePath.clear();
|
||||
// AI_VALUE(LastMovement&, "last movement").setPath(movePath);
|
||||
|
||||
// if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
||||
// botAI->TellMasterNoFacing("No point. Rebuilding.");
|
||||
// LOG_DEBUG("playerbots", "!movePosition || movePosition.getMapId() != bot->GetMapId()");
|
||||
// LOG_DEBUG("playerbots", "!movePosition || movePosition.GetMapId() != bot->GetMapId()");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@@ -609,15 +609,15 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
// float cz = z;
|
||||
// for (auto i : movePath.getPath())
|
||||
// {
|
||||
// CreateWp(bot, i.point.getX(), i.point.getY(), i.point.getZ(), 0.f, 2334);
|
||||
// CreateWp(bot, i.point.GetPositionX(), i.point.GetPositionY(), i.point.GetPositionZ(), 0.f, 2334);
|
||||
|
||||
// cx = i.point.getX();
|
||||
// cy = i.point.getY();
|
||||
// cz = i.point.getZ();
|
||||
// cx = i.point.GetPositionX();
|
||||
// cy = i.point.GetPositionY();
|
||||
// cz = i.point.GetPositionZ();
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// CreateWp(bot, movePosition.getX(), movePosition.getY(), movePosition.getZ(), 0, 2334, true);
|
||||
// CreateWp(bot, movePosition.GetPositionX(), movePosition.GetPositionY(), movePosition.GetPositionZ(), 0, 2334, true);
|
||||
// }
|
||||
|
||||
// //Log bot movement
|
||||
@@ -634,8 +634,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
|
||||
// sPlayerbotAIConfig.log("bot_movement.csv", out.str().c_str());
|
||||
// }
|
||||
// // LOG_DEBUG("playerbots", "({}, {}) -> ({}, {})", startPosition.getX(), startPosition.getY(),
|
||||
// movePosition.getX(), movePosition.getY()); if (!react)
|
||||
// // LOG_DEBUG("playerbots", "({}, {}) -> ({}, {})", startPosition.GetPositionX(), startPosition.GetPositionY(),
|
||||
// movePosition.GetPositionX(), movePosition.GetPositionY()); if (!react)
|
||||
// if (totalDistance > maxDist)
|
||||
// WaitForReach(startPosition.distance(movePosition) - 10.0f);
|
||||
// else
|
||||
@@ -671,7 +671,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
// // else
|
||||
// // {
|
||||
// // mover->GetMotionMaster()->GetDestination(x, y, z);
|
||||
// // if (movePosition.distance(WorldPosition(movePosition.getMapId(), x, y, z, 0)) > minDist)
|
||||
// // if (movePosition.distance(WorldPosition(movePosition.GetMapId(), x, y, z, 0)) > minDist)
|
||||
// // {
|
||||
// // mover->StopMoving();
|
||||
// // mover->GetMotionMaster()->Clear();
|
||||
@@ -685,8 +685,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
|
||||
// AI_VALUE(LastMovement&, "last movement").nextTeleport = now +
|
||||
// (time_t)MoveDelay(startPosition.distance(movePosition)); LOG_DEBUG("playerbots", "totalDistance > maxDist &&
|
||||
// !detailedMove && !botAI->HasPlayerNearby(&movePosition)"); return bot->TeleportTo(movePosition.getMapId(),
|
||||
// movePosition.getX(), movePosition.getY(), movePosition.getZ(), startPosition.getAngleTo(movePosition));
|
||||
// !detailedMove && !botAI->HasPlayerNearby(&movePosition)"); return bot->TeleportTo(movePosition.GetMapId(),
|
||||
// movePosition.GetPositionX(), movePosition.GetPositionY(), movePosition.GetPositionZ(), startPosition.getAngleTo(movePosition));
|
||||
// }
|
||||
|
||||
// // walk if master walks and is close
|
||||
@@ -708,9 +708,9 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
// if (!bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !bot->HasAuraType(SPELL_AURA_FLY))
|
||||
// {
|
||||
// bot->SetWalk(masterWalking);
|
||||
// bot->GetMotionMaster()->MovePoint(movePosition.getMapId(), movePosition.getX(), movePosition.getY(),
|
||||
// movePosition.getZ(), generatePath); WaitForReach(startPosition.distance(movePosition));
|
||||
// // LOG_DEBUG("playerbots", "Movepoint to ({}, {})", movePosition.getX(), movePosition.getY());
|
||||
// bot->GetMotionMaster()->MovePoint(movePosition.GetMapId(), movePosition.GetPositionX(), movePosition.GetPositionY(),
|
||||
// movePosition.GetPositionZ(), generatePath); WaitForReach(startPosition.distance(movePosition));
|
||||
// // LOG_DEBUG("playerbots", "Movepoint to ({}, {})", movePosition.GetPositionX(), movePosition.GetPositionY());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
@@ -756,9 +756,9 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
// }
|
||||
// }
|
||||
|
||||
// bot->GetMotionMaster()->MovePoint(movePosition.getMapId(), Position(movePosition.getX(), movePosition.getY(),
|
||||
// movePosition.getZ(), 0.f)); WaitForReach(startPosition.distance(movePosition)); LOG_DEBUG("playerbots",
|
||||
// "Movepoint to ({}, {})", movePosition.getX(), movePosition.getY());
|
||||
// bot->GetMotionMaster()->MovePoint(movePosition.GetMapId(), Position(movePosition.GetPositionX(), movePosition.GetPositionY(),
|
||||
// movePosition.GetPositionZ(), 0.f)); WaitForReach(startPosition.distance(movePosition)); LOG_DEBUG("playerbots",
|
||||
// "Movepoint to ({}, {})", movePosition.GetPositionX(), movePosition.GetPositionY());
|
||||
// }
|
||||
|
||||
// AI_VALUE(LastMovement&, "last movement").setShort(movePosition);
|
||||
@@ -1190,7 +1190,7 @@ bool MovementAction::Follow(Unit* target, float distance, float angle)
|
||||
WorldPosition cPos(corpse);
|
||||
|
||||
if (botPos.fDist(cPos) > sPlayerbotAIConfig.spellDistance)
|
||||
return MoveTo(cPos.getMapId(), cPos.getX(), cPos.getY(), cPos.getZ());
|
||||
return MoveTo(cPos.GetMapId(), cPos.GetPositionX(), cPos.GetPositionY(), cPos.GetPositionZ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1217,7 +1217,7 @@ bool MovementAction::Follow(Unit* target, float distance, float angle)
|
||||
if ((lDist * 1.5 < tDist && ang < static_cast<float>(M_PI) / 2) ||
|
||||
target->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||
{
|
||||
return MoveTo(longMove.getMapId(), longMove.getX(), longMove.getY(), longMove.getZ());
|
||||
return MoveTo(longMove.GetMapId(), longMove.GetPositionX(), longMove.GetPositionY(), longMove.GetPositionZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ bool FindCorpseAction::Execute(Event event)
|
||||
{
|
||||
float rx, ry, rz;
|
||||
if (manager.CalculateDestination(&rx, &ry, &rz))
|
||||
moveToPos = WorldPosition(moveToPos.getMapId(), rx, ry, rz, 0.0);
|
||||
moveToPos = WorldPosition(moveToPos.GetMapId(), rx, ry, rz, 0.0);
|
||||
else if (!moveToPos.GetReachableRandomPointOnGround(bot, reclaimDist, urand(0, 1)))
|
||||
moveToPos = corpsePos;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ bool FindCorpseAction::Execute(Event event)
|
||||
{
|
||||
bot->GetMotionMaster()->Clear();
|
||||
bot->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TELEPORTED | AURA_INTERRUPT_FLAG_CHANGE_MAP);
|
||||
bot->TeleportTo(moveToPos.getMapId(), moveToPos.getX(), moveToPos.getY(), moveToPos.getZ(), 0);
|
||||
bot->TeleportTo(moveToPos.GetMapId(), moveToPos.GetPositionX(), moveToPos.GetPositionY(), moveToPos.GetPositionZ(), 0);
|
||||
}
|
||||
|
||||
moved = true;
|
||||
@@ -184,7 +184,7 @@ bool FindCorpseAction::Execute(Event event)
|
||||
if (deadTime < 10 * MINUTE && dCount < 5) // Look for corpse up to 30 minutes.
|
||||
{
|
||||
moved =
|
||||
MoveTo(moveToPos.getMapId(), moveToPos.getX(), moveToPos.getY(), moveToPos.getZ(), false, false);
|
||||
MoveTo(moveToPos.GetMapId(), moveToPos.GetPositionX(), moveToPos.GetPositionY(), moveToPos.GetPositionZ(), false, false);
|
||||
}
|
||||
|
||||
if (!moved)
|
||||
@@ -237,10 +237,10 @@ GraveyardStruct const* SpiritHealerAction::GetGrave(bool startZone)
|
||||
{
|
||||
uint32 areaId = 0;
|
||||
uint32 zoneId = 0;
|
||||
sMapMgr->GetZoneAndAreaId(bot->GetPhaseMask(), zoneId, areaId, travelPos.getMapId(), travelPos.getX(),
|
||||
travelPos.getY(), travelPos.getZ());
|
||||
ClosestGrave = sGraveyard->GetClosestGraveyard(travelPos.getMapId(), travelPos.getX(), travelPos.getY(),
|
||||
travelPos.getZ(), bot->GetTeamId(), areaId, zoneId,
|
||||
sMapMgr->GetZoneAndAreaId(bot->GetPhaseMask(), zoneId, areaId, travelPos.GetMapId(), travelPos.GetPositionX(),
|
||||
travelPos.GetPositionY(), travelPos.GetPositionZ());
|
||||
ClosestGrave = sGraveyard->GetClosestGraveyard(travelPos.GetMapId(), travelPos.GetPositionX(), travelPos.GetPositionY(),
|
||||
travelPos.GetPositionZ(), bot->GetTeamId(), areaId, zoneId,
|
||||
bot->getClass() == CLASS_DEATH_KNIGHT);
|
||||
|
||||
if (ClosestGrave)
|
||||
|
||||
@@ -150,7 +150,7 @@ bool RpgTaxiAction::Execute(Event event)
|
||||
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
||||
|
||||
uint32 node =
|
||||
sObjectMgr->GetNearestTaxiNode(guidP.getX(), guidP.getY(), guidP.getZ(), guidP.getMapId(), bot->GetTeamId());
|
||||
sObjectMgr->GetNearestTaxiNode(guidP.GetPositionX(), guidP.GetPositionY(), guidP.GetPositionZ(), guidP.GetMapId(), bot->GetTeamId());
|
||||
|
||||
std::vector<uint32> nodes;
|
||||
for (uint32 i = 0; i < sTaxiPathStore.GetNumRows(); ++i)
|
||||
@@ -208,7 +208,7 @@ bool RpgDiscoverAction::Execute(Event event)
|
||||
GuidPosition guidP = rpg->guidP();
|
||||
|
||||
uint32 node =
|
||||
sObjectMgr->GetNearestTaxiNode(guidP.getX(), guidP.getY(), guidP.getZ(), guidP.getMapId(), bot->GetTeamId());
|
||||
sObjectMgr->GetNearestTaxiNode(guidP.GetPositionX(), guidP.GetPositionY(), guidP.GetPositionZ(), guidP.GetMapId(), bot->GetTeamId());
|
||||
|
||||
if (!node)
|
||||
return false;
|
||||
|
||||
@@ -80,8 +80,9 @@ bool RTSCAction::Execute(Event event)
|
||||
SET_AI_VALUE2(WorldPosition, "RTSC saved location", locationName, spellPosition);
|
||||
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature(15631, spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(),
|
||||
spellPosition.getO(), TEMPSUMMON_TIMED_DESPAWN, 2000.0f);
|
||||
bot->SummonCreature(15631, spellPosition.GetPositionX(), spellPosition.GetPositionY(),
|
||||
spellPosition.GetPositionZ(), spellPosition.GetOrientation(), TEMPSUMMON_TIMED_DESPAWN,
|
||||
2000.0f);
|
||||
wpCreature->SetObjectScale(0.5f);
|
||||
|
||||
return true;
|
||||
@@ -110,8 +111,9 @@ bool RTSCAction::Execute(Event event)
|
||||
if (spellPosition)
|
||||
{
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature(15631, spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(),
|
||||
spellPosition.getO(), TEMPSUMMON_TIMED_DESPAWN, 2000.0f);
|
||||
bot->SummonCreature(15631, spellPosition.GetPositionX(), spellPosition.GetPositionY(),
|
||||
spellPosition.GetPositionZ(), spellPosition.GetOrientation(),
|
||||
TEMPSUMMON_TIMED_DESPAWN, 2000.0f);
|
||||
wpCreature->SetObjectScale(0.5f);
|
||||
}
|
||||
|
||||
|
||||
@@ -134,8 +134,8 @@ bool SeeSpellAction::Execute(Event event)
|
||||
SET_AI_VALUE2(WorldPosition, "RTSC saved location", locationName, spellPosition);
|
||||
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature(15631, spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(),
|
||||
spellPosition.getO(), TEMPSUMMON_TIMED_DESPAWN, 2000.0f);
|
||||
bot->SummonCreature(15631, spellPosition.GetPositionX(), spellPosition.GetPositionY(), spellPosition.GetPositionZ(),
|
||||
spellPosition.GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 2000.0f);
|
||||
wpCreature->SetObjectScale(0.5f);
|
||||
RESET_AI_VALUE(std::string, "RTSC next spell action");
|
||||
|
||||
@@ -167,14 +167,14 @@ bool SeeSpellAction::MoveToSpell(WorldPosition& spellPosition, bool inFormation)
|
||||
PositionMap& posMap = AI_VALUE(PositionMap&, "position");
|
||||
PositionInfo stayPosition = posMap["stay"];
|
||||
|
||||
stayPosition.Set(spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(), spellPosition.getMapId());
|
||||
stayPosition.Set(spellPosition.GetPositionX(), spellPosition.GetPositionY(), spellPosition.GetPositionZ(), spellPosition.GetMapId());
|
||||
posMap["stay"] = stayPosition;
|
||||
}
|
||||
|
||||
if (bot->IsWithinLOS(spellPosition.getX(), spellPosition.getY(), spellPosition.getZ()))
|
||||
return MoveNear(spellPosition.getMapId(), spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(), 0);
|
||||
if (bot->IsWithinLOS(spellPosition.GetPositionX(), spellPosition.GetPositionY(), spellPosition.GetPositionZ()))
|
||||
return MoveNear(spellPosition.GetMapId(), spellPosition.GetPositionX(), spellPosition.GetPositionY(), spellPosition.GetPositionZ(), 0);
|
||||
|
||||
return MoveTo(spellPosition.getMapId(), spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(), false,
|
||||
return MoveTo(spellPosition.GetMapId(), spellPosition.GetPositionX(), spellPosition.GetPositionY(), spellPosition.GetPositionZ(), false,
|
||||
false);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,8 @@ bool RpgTaxiTrigger::IsActive()
|
||||
return false;
|
||||
|
||||
uint32 node =
|
||||
sObjectMgr->GetNearestTaxiNode(guidP.getX(), guidP.getY(), guidP.getZ(), guidP.getMapId(), bot->GetTeamId());
|
||||
sObjectMgr->GetNearestTaxiNode(guidP.GetPositionX(), guidP.GetPositionY(), guidP.GetPositionZ(),
|
||||
guidP.GetMapId(), bot->GetTeamId());
|
||||
|
||||
if (!node)
|
||||
return false;
|
||||
@@ -68,7 +69,8 @@ bool RpgDiscoverTrigger::IsActive()
|
||||
return false;
|
||||
|
||||
uint32 node =
|
||||
sObjectMgr->GetNearestTaxiNode(guidP.getX(), guidP.getY(), guidP.getZ(), guidP.getMapId(), bot->GetTeamId());
|
||||
sObjectMgr->GetNearestTaxiNode(guidP.GetPositionX(), guidP.GetPositionY(), guidP.GetPositionZ(),
|
||||
guidP.GetMapId(), bot->GetTeamId());
|
||||
|
||||
if (bot->m_taxi.IsTaximaskNodeKnown(node))
|
||||
return false;
|
||||
|
||||
@@ -90,7 +90,7 @@ bool MoveLongStuckTrigger::IsActive()
|
||||
}
|
||||
|
||||
if (cell.GridX() > 0 && cell.GridY() > 0 &&
|
||||
!MMAP::MMapFactory::createOrGetMMapMgr()->loadMap(botPos.getMapId(), cell.GridX(), cell.GridY()))
|
||||
!MMAP::MMapFactory::createOrGetMMapMgr()->loadMap(botPos.GetMapId(), cell.GridX(), cell.GridY()))
|
||||
{
|
||||
// LOG_INFO("playerbots", "Bot {} {}:{} <{}> was in unloaded grid {},{} on map {}",
|
||||
// bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
|
||||
Reference in New Issue
Block a user