Rename groupmaster to groupleader and related variables. (#1875)

Fix the naming conventions. 
Master should be reserved to identify a bots Master. 
groupleaders are not necessarily group masters and it should be clear
what the bot is looking for. (In most solo cases leader=master)
This commit is contained in:
Keleborn
2025-12-03 04:25:01 -08:00
committed by GitHub
parent 38e2d8584b
commit 52c3e96641
29 changed files with 101 additions and 101 deletions

View File

@@ -420,7 +420,7 @@ void PlayerbotAI::UpdateAIGroupAndMaster()
{ {
botAI->ChangeStrategy("+follow", BOT_STATE_NON_COMBAT); botAI->ChangeStrategy("+follow", BOT_STATE_NON_COMBAT);
if (botAI->GetMaster() == botAI->GetGroupMaster()) if (botAI->GetMaster() == botAI->GetGroupLeader())
botAI->TellMaster("Hello, I follow you!"); botAI->TellMaster("Hello, I follow you!");
else else
botAI->TellMaster(!urand(0, 2) ? "Hello!" : "Hi!"); botAI->TellMaster(!urand(0, 2) ? "Hello!" : "Hi!");
@@ -4093,7 +4093,7 @@ Player* PlayerbotAI::FindNewMaster()
if (!group) if (!group)
return nullptr; return nullptr;
Player* groupLeader = GetGroupMaster(); Player* groupLeader = GetGroupLeader();
PlayerbotAI* leaderBotAI = GET_PLAYERBOT_AI(groupLeader); PlayerbotAI* leaderBotAI = GET_PLAYERBOT_AI(groupLeader);
if (!leaderBotAI || leaderBotAI->IsRealPlayer()) if (!leaderBotAI || leaderBotAI->IsRealPlayer())
return groupLeader; return groupLeader;
@@ -4144,7 +4144,7 @@ bool PlayerbotAI::HasActivePlayerMaster() { return master && !GET_PLAYERBOT_AI(m
bool PlayerbotAI::IsAlt() { return HasRealPlayerMaster() && !sRandomPlayerbotMgr->IsRandomBot(bot); } bool PlayerbotAI::IsAlt() { return HasRealPlayerMaster() && !sRandomPlayerbotMgr->IsRandomBot(bot); }
Player* PlayerbotAI::GetGroupMaster() Player* PlayerbotAI::GetGroupLeader()
{ {
if (!bot->InBattleground()) if (!bot->InBattleground())
if (Group* group = bot->GetGroup()) if (Group* group = bot->GetGroup())

View File

@@ -540,7 +540,7 @@ public:
// Get the group leader or the master of the bot. // Get the group leader or the master of the bot.
// Checks if the bot is summoned as alt of a player // Checks if the bot is summoned as alt of a player
bool IsAlt(); bool IsAlt();
Player* GetGroupMaster(); Player* GetGroupLeader();
// Returns a semi-random (cycling) number that is fixed for each bot. // Returns a semi-random (cycling) number that is fixed for each bot.
uint32 GetFixedBotNumer(uint32 maxNum = 100, float cyclePerMin = 1); uint32 GetFixedBotNumer(uint32 maxNum = 100, float cyclePerMin = 1);
GrouperType GetGrouperType(); GrouperType GetGrouperType();

View File

@@ -251,9 +251,9 @@ bool PlayerbotSecurity::CheckLevelFor(PlayerbotSecurityLevel level, bool silent,
out << "I am currently leading a group. I can invite you if you want."; out << "I am currently leading a group. I can invite you if you want.";
break; break;
case PLAYERBOT_DENY_NOT_LEADER: case PLAYERBOT_DENY_NOT_LEADER:
if (botAI->GetGroupMaster()) if (botAI->GetGroupLeader())
{ {
out << "I am in a group with " << botAI->GetGroupMaster()->GetName() out << "I am in a group with " << botAI->GetGroupLeader()->GetName()
<< ". You can ask him for invite."; << ". You can ask him for invite.";
} }
else else

View File

@@ -1480,10 +1480,10 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
if (!sRandomPlayerbotMgr->IsRandomBot(player)) if (!sRandomPlayerbotMgr->IsRandomBot(player))
update = false; update = false;
if (player->GetGroup() && botAI->GetGroupMaster()) if (player->GetGroup() && botAI->GetGroupLeader())
{ {
PlayerbotAI* groupMasterBotAI = GET_PLAYERBOT_AI(botAI->GetGroupMaster()); PlayerbotAI* groupLeaderBotAI = GET_PLAYERBOT_AI(botAI->GetGroupLeader());
if (!groupMasterBotAI || groupMasterBotAI->IsRealPlayer()) if (!groupLeaderBotAI || groupLeaderBotAI->IsRealPlayer())
{ {
update = false; update = false;
} }

View File

@@ -121,7 +121,7 @@ public:
creators["shoot"] = &ActionContext::shoot; creators["shoot"] = &ActionContext::shoot;
creators["follow"] = &ActionContext::follow; creators["follow"] = &ActionContext::follow;
creators["move from group"] = &ActionContext::move_from_group; creators["move from group"] = &ActionContext::move_from_group;
creators["flee to master"] = &ActionContext::flee_to_master; creators["flee to group leader"] = &ActionContext::flee_to_group_leader;
creators["runaway"] = &ActionContext::runaway; creators["runaway"] = &ActionContext::runaway;
creators["stay"] = &ActionContext::stay; creators["stay"] = &ActionContext::stay;
creators["sit"] = &ActionContext::sit; creators["sit"] = &ActionContext::sit;
@@ -318,7 +318,7 @@ private:
static Action* runaway(PlayerbotAI* botAI) { return new RunAwayAction(botAI); } static Action* runaway(PlayerbotAI* botAI) { return new RunAwayAction(botAI); }
static Action* follow(PlayerbotAI* botAI) { return new FollowAction(botAI); } static Action* follow(PlayerbotAI* botAI) { return new FollowAction(botAI); }
static Action* move_from_group(PlayerbotAI* botAI) { return new MoveFromGroupAction(botAI); } static Action* move_from_group(PlayerbotAI* botAI) { return new MoveFromGroupAction(botAI); }
static Action* flee_to_master(PlayerbotAI* botAI) { return new FleeToMasterAction(botAI); } static Action* flee_to_group_leader(PlayerbotAI* botAI) { return new FleeToGroupLeaderAction(botAI); }
static Action* add_gathering_loot(PlayerbotAI* botAI) { return new AddGatheringLootAction(botAI); } static Action* add_gathering_loot(PlayerbotAI* botAI) { return new AddGatheringLootAction(botAI); }
static Action* add_loot(PlayerbotAI* botAI) { return new AddLootAction(botAI); } static Action* add_loot(PlayerbotAI* botAI) { return new AddLootAction(botAI); }
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); } static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }

View File

@@ -311,7 +311,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldObject* target)
bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos) bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
{ {
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot); PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
Player* gmaster = botAI->GetGroupMaster(); Player* groupLeader = botAI->GetGroupLeader();
Player* realMaster = botAI->GetMaster(); Player* realMaster = botAI->GetMaster();
AiObjectContext* context = botAI->GetAiObjectContext(); AiObjectContext* context = botAI->GetAiObjectContext();
@@ -327,30 +327,30 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
return false; return false;
} }
if (!gmaster || bot == gmaster) if (!groupLeader || bot == groupLeader)
return true; return true;
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT)) if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
return true; return true;
if (bot->GetDistance(gmaster) > sPlayerbotAIConfig->rpgDistance * 2) if (bot->GetDistance(groupLeader) > sPlayerbotAIConfig->rpgDistance * 2)
return false; return false;
Formation* formation = AI_VALUE(Formation*, "formation"); Formation* formation = AI_VALUE(Formation*, "formation");
float distance = gmaster->GetDistance2d(pos.getX(), pos.getY()); float distance = groupLeader->GetDistance2d(pos.getX(), pos.getY());
if (!botAI->HasActivePlayerMaster() && distance < 50.0f) if (!botAI->HasActivePlayerMaster() && distance < 50.0f)
{ {
Player* player = gmaster; Player* player = groupLeader;
if (gmaster && !gmaster->isMoving() || if (groupLeader && !groupLeader->isMoving() ||
PAI_VALUE(WorldPosition, "last long move").distance(pos) < sPlayerbotAIConfig->reactDistance) PAI_VALUE(WorldPosition, "last long move").distance(pos) < sPlayerbotAIConfig->reactDistance)
return true; return true;
} }
if ((inDungeon || !gmaster->HasPlayerFlag(PLAYER_FLAGS_RESTING)) && realMaster == gmaster && distance > 5.0f) if ((inDungeon || !groupLeader->HasPlayerFlag(PLAYER_FLAGS_RESTING)) && realMaster == groupLeader && distance > 5.0f)
return false; return false;
if (!gmaster->isMoving() && distance < 25.0f) if (!groupLeader->isMoving() && distance < 25.0f)
return true; return true;
if (distance < formation->GetMaxDistance()) if (distance < formation->GetMaxDistance())

View File

@@ -180,7 +180,7 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
void ChooseTravelTargetAction::setNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget) void ChooseTravelTargetAction::setNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget)
{ {
// Tell the master where we are going. // Tell the master where we are going.
if (!bot->GetGroup() || (botAI->GetGroupMaster() == bot)) if (!bot->GetGroup() || (botAI->GetGroupLeader() == bot))
ReportTravelTarget(newTarget, oldTarget); ReportTravelTarget(newTarget, oldTarget);
// If we are heading to a creature/npc clear it from the ignore list. // If we are heading to a creature/npc clear it from the ignore list.

View File

@@ -70,7 +70,7 @@ bool FollowAction::isUseful()
if (!target.empty()) if (!target.empty())
fTarget = AI_VALUE(Unit*, target); fTarget = AI_VALUE(Unit*, target);
else else
fTarget = AI_VALUE(Unit*, "master target"); fTarget = AI_VALUE(Unit*, "group leader");
if (fTarget) if (fTarget)
{ {
@@ -114,9 +114,9 @@ bool FollowAction::CanDeadFollow(Unit* target)
return true; return true;
} }
bool FleeToMasterAction::Execute(Event event) bool FleeToGroupLeaderAction::Execute(Event event)
{ {
Unit* fTarget = AI_VALUE(Unit*, "master target"); Unit* fTarget = AI_VALUE(Unit*, "group leader");
bool canFollow = Follow(fTarget); bool canFollow = Follow(fTarget);
if (!canFollow) if (!canFollow)
{ {
@@ -146,22 +146,22 @@ bool FleeToMasterAction::Execute(Event event)
return true; return true;
} }
bool FleeToMasterAction::isUseful() bool FleeToGroupLeaderAction::isUseful()
{ {
if (!botAI->GetGroupMaster()) if (!botAI->GetGroupLeader())
return false; return false;
if (botAI->GetGroupMaster() == bot) if (botAI->GetGroupLeader() == bot)
return false; return false;
Unit* target = AI_VALUE(Unit*, "current target"); Unit* target = AI_VALUE(Unit*, "current target");
if (target && botAI->GetGroupMaster()->GetTarget() == target->GetGUID()) if (target && botAI->GetGroupLeader()->GetTarget() == target->GetGUID())
return false; return false;
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT)) if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
return false; return false;
Unit* fTarget = AI_VALUE(Unit*, "master target"); Unit* fTarget = AI_VALUE(Unit*, "group leader");
if (!CanDeadFollow(fTarget)) if (!CanDeadFollow(fTarget))
return false; return false;

View File

@@ -20,10 +20,10 @@ public:
bool CanDeadFollow(Unit* target); bool CanDeadFollow(Unit* target);
}; };
class FleeToMasterAction : public FollowAction class FleeToGroupLeaderAction : public FollowAction
{ {
public: public:
FleeToMasterAction(PlayerbotAI* botAI) : FollowAction(botAI, "flee to master") {} FleeToGroupLeaderAction(PlayerbotAI* botAI) : FollowAction(botAI, "flee to group leader") {}
bool Execute(Event event) override; bool Execute(Event event) override;
bool isUseful() override; bool isUseful() override;

View File

@@ -141,7 +141,7 @@ bool InviteNearbyToGroupAction::isUseful()
if (group->isRaidGroup() && group->IsFull()) if (group->isRaidGroup() && group->IsFull())
return false; return false;
if (botAI->GetGroupMaster() != bot) if (botAI->GetGroupLeader() != bot)
return false; return false;
uint32 memberCount = group->GetMembersCount(); uint32 memberCount = group->GetMembersCount();

View File

@@ -109,22 +109,22 @@ bool LeaveFarAwayAction::isUseful()
if (!bot->GetGroup()) if (!bot->GetGroup())
return false; return false;
Player* master = botAI->GetGroupMaster(); Player* groupLeader = botAI->GetGroupLeader();
Player* trueMaster = botAI->GetMaster(); Player* trueMaster = botAI->GetMaster();
if (!master || (bot == master && !botAI->IsRealPlayer())) if (!groupLeader || (bot == groupLeader && !botAI->IsRealPlayer()))
return false; return false;
PlayerbotAI* masterBotAI = nullptr; PlayerbotAI* groupLeaderBotAI = nullptr;
if (master) if (groupLeader)
masterBotAI = GET_PLAYERBOT_AI(master); groupLeaderBotAI = GET_PLAYERBOT_AI(groupLeader);
if (master && !masterBotAI) if (groupLeader && !groupLeaderBotAI)
return false; return false;
if (trueMaster && !GET_PLAYERBOT_AI(trueMaster)) if (trueMaster && !GET_PLAYERBOT_AI(trueMaster))
return false; return false;
if (botAI->IsAlt() && if (botAI->IsAlt() &&
(!masterBotAI || masterBotAI->IsRealPlayer())) // Don't leave group when alt grouped with player master. (!groupLeaderBotAI || groupLeaderBotAI->IsRealPlayer())) // Don't leave group when alt grouped with player groupLeader.
return false; return false;
if (botAI->GetGrouperType() == GrouperType::SOLO) if (botAI->GetGrouperType() == GrouperType::SOLO)
@@ -138,19 +138,19 @@ bool LeaveFarAwayAction::isUseful()
if (dCount > 4 && !botAI->HasRealPlayerMaster()) if (dCount > 4 && !botAI->HasRealPlayerMaster())
return true; return true;
if (bot->GetGuildId() == master->GetGuildId()) if (bot->GetGuildId() == groupLeader->GetGuildId())
{ {
if (bot->GetLevel() > master->GetLevel() + 5) if (bot->GetLevel() > groupLeader->GetLevel() + 5)
{ {
if (AI_VALUE(bool, "should get money")) if (AI_VALUE(bool, "should get money"))
return false; return false;
} }
} }
if (abs(int32(master->GetLevel() - bot->GetLevel())) > 4) if (abs(int32(groupLeader->GetLevel() - bot->GetLevel())) > 4)
return true; return true;
if (bot->GetMapId() != master->GetMapId() || bot->GetDistance2d(master) >= 2 * sPlayerbotAIConfig->rpgDistance) if (bot->GetMapId() != groupLeader->GetMapId() || bot->GetDistance2d(groupLeader) >= 2 * sPlayerbotAIConfig->rpgDistance)
{ {
return true; return true;
} }

View File

@@ -18,7 +18,7 @@ bool MoveToTravelTargetAction::Execute(Event event)
WorldLocation location = *target->getPosition(); WorldLocation location = *target->getPosition();
Group* group = bot->GetGroup(); Group* group = bot->GetGroup();
if (group && !urand(0, 1) && bot == botAI->GetGroupMaster() && !bot->IsInCombat()) if (group && !urand(0, 1) && bot == botAI->GetGroupLeader() && !bot->IsInCombat())
{ {
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next()) for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{ {

View File

@@ -1102,7 +1102,7 @@ void MovementAction::UpdateMovementState()
// { // {
// if (Unit* pTarget = sServerFacade->GetChaseTarget(bot)) // if (Unit* pTarget = sServerFacade->GetChaseTarget(bot))
// { // {
// if (pTarget != botAI->GetGroupMaster()) // if (pTarget != botAI->GetGroupLeader())
// return; // return;
// if (!bot->IsWithinMeleeRange(pTarget)) // if (!bot->IsWithinMeleeRange(pTarget))
@@ -2663,7 +2663,7 @@ bool DisperseSetAction::Execute(Event event)
return true; return true;
} }
bool RunAwayAction::Execute(Event event) { return Flee(AI_VALUE(Unit*, "master target")); } bool RunAwayAction::Execute(Event event) { return Flee(AI_VALUE(Unit*, "group leader")); }
bool MoveToLootAction::Execute(Event event) bool MoveToLootAction::Execute(Event event)
{ {

View File

@@ -13,10 +13,10 @@ bool RandomBotUpdateAction::Execute(Event event)
if (!sRandomPlayerbotMgr->IsRandomBot(bot)) if (!sRandomPlayerbotMgr->IsRandomBot(bot))
return false; return false;
if (bot->GetGroup() && botAI->GetGroupMaster()) if (bot->GetGroup() && botAI->GetGroupLeader())
{ {
PlayerbotAI* groupMasterBotAI = GET_PLAYERBOT_AI(botAI->GetGroupMaster()); PlayerbotAI* groupLeaderBotAI = GET_PLAYERBOT_AI(botAI->GetGroupLeader());
if (!groupMasterBotAI || groupMasterBotAI->IsRealPlayer()) if (!groupLeaderBotAI || groupLeaderBotAI->IsRealPlayer())
return true; return true;
} }

View File

@@ -168,15 +168,15 @@ bool AutoReleaseSpiritAction::ShouldAutoRelease() const
if (!bot->GetGroup()) if (!bot->GetGroup())
return true; return true;
Player* groupMaster = botAI->GetGroupMaster(); Player* groupLeader = botAI->GetGroupLeader();
if (!groupMaster || groupMaster == bot) if (!groupLeader || groupLeader == bot)
return true; return true;
if (!botAI->HasActivePlayerMaster()) if (!botAI->HasActivePlayerMaster())
return true; return true;
if (botAI->HasActivePlayerMaster() && if (botAI->HasActivePlayerMaster() &&
groupMaster->GetMapId() == bot->GetMapId() && groupLeader->GetMapId() == bot->GetMapId() &&
bot->GetMap() && bot->GetMap() &&
(bot->GetMap()->IsRaid() || bot->GetMap()->IsDungeon())) (bot->GetMap()->IsRaid() || bot->GetMap()->IsDungeon()))
{ {
@@ -184,7 +184,7 @@ bool AutoReleaseSpiritAction::ShouldAutoRelease() const
} }
return sServerFacade->IsDistanceGreaterThan( return sServerFacade->IsDistanceGreaterThan(
AI_VALUE2(float, "distance", "master target"), AI_VALUE2(float, "distance", "group leader"),
sPlayerbotAIConfig->sightDistance); sPlayerbotAIConfig->sightDistance);
} }

View File

@@ -16,4 +16,4 @@ bool ResetInstancesAction::Execute(Event event)
return true; return true;
} }
bool ResetInstancesAction::isUseful() { return botAI->GetGroupMaster() == bot; }; bool ResetInstancesAction::isUseful() { return botAI->GetGroupLeader() == bot; };

View File

@@ -17,14 +17,14 @@
bool ReviveFromCorpseAction::Execute(Event event) bool ReviveFromCorpseAction::Execute(Event event)
{ {
Player* master = botAI->GetGroupMaster(); Player* groupLeader = botAI->GetGroupLeader();
Corpse* corpse = bot->GetCorpse(); Corpse* corpse = bot->GetCorpse();
// follow master when master revives // follow group Leader when group Leader revives
WorldPacket& p = event.getPacket(); WorldPacket& p = event.getPacket();
if (!p.empty() && p.GetOpcode() == CMSG_RECLAIM_CORPSE && master && !corpse && bot->IsAlive()) if (!p.empty() && p.GetOpcode() == CMSG_RECLAIM_CORPSE && groupLeader && !corpse && bot->IsAlive())
{ {
if (sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "master target"), if (sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
sPlayerbotAIConfig->farDistance)) sPlayerbotAIConfig->farDistance))
{ {
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT)) if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
@@ -43,10 +43,10 @@ bool ReviveFromCorpseAction::Execute(Event event)
// time(nullptr)) // time(nullptr))
// return false; // return false;
if (master) if (groupLeader)
{ {
if (!GET_PLAYERBOT_AI(master) && master->isDead() && master->GetCorpse() && if (!GET_PLAYERBOT_AI(groupLeader) && groupLeader->isDead() && groupLeader->GetCorpse() &&
sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "master target"), sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
sPlayerbotAIConfig->farDistance)) sPlayerbotAIConfig->farDistance))
return false; return false;
} }
@@ -79,15 +79,15 @@ bool FindCorpseAction::Execute(Event event)
if (bot->InBattleground()) if (bot->InBattleground())
return false; return false;
Player* master = botAI->GetGroupMaster(); Player* groupLeader = botAI->GetGroupLeader();
Corpse* corpse = bot->GetCorpse(); Corpse* corpse = bot->GetCorpse();
if (!corpse) if (!corpse)
return false; return false;
// if (master) // if (groupLeader)
// { // {
// if (!GET_PLAYERBOT_AI(master) && // if (!GET_PLAYERBOT_AI(groupLeader) &&
// sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "master target"), // sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
// sPlayerbotAIConfig->farDistance)) return false; // sPlayerbotAIConfig->farDistance)) return false;
// } // }
@@ -110,20 +110,20 @@ bool FindCorpseAction::Execute(Event event)
WorldPosition botPos(bot); WorldPosition botPos(bot);
WorldPosition corpsePos(corpse); WorldPosition corpsePos(corpse);
WorldPosition moveToPos = corpsePos; WorldPosition moveToPos = corpsePos;
WorldPosition masterPos(master); WorldPosition leaderPos(groupLeader);
float reclaimDist = CORPSE_RECLAIM_RADIUS - 5.0f; float reclaimDist = CORPSE_RECLAIM_RADIUS - 5.0f;
float corpseDist = botPos.distance(corpsePos); float corpseDist = botPos.distance(corpsePos);
int64 deadTime = time(nullptr) - corpse->GetGhostTime(); int64 deadTime = time(nullptr) - corpse->GetGhostTime();
bool moveToMaster = master && master != bot && masterPos.fDist(corpsePos) < reclaimDist; bool moveToLeader = groupLeader && groupLeader != bot && leaderPos.fDist(corpsePos) < reclaimDist;
// Should we ressurect? If so, return false. // Should we ressurect? If so, return false.
if (corpseDist < reclaimDist) if (corpseDist < reclaimDist)
{ {
if (moveToMaster) // We are near master. if (moveToLeader) // We are near group leader.
{ {
if (botPos.fDist(masterPos) < sPlayerbotAIConfig->spellDistance) if (botPos.fDist(leaderPos) < sPlayerbotAIConfig->spellDistance)
return false; return false;
} }
else if (deadTime > 8 * MINUTE) // We have walked too long already. else if (deadTime > 8 * MINUTE) // We have walked too long already.
@@ -140,8 +140,8 @@ bool FindCorpseAction::Execute(Event event)
// If we are getting close move to a save ressurrection spot instead of just the corpse. // If we are getting close move to a save ressurrection spot instead of just the corpse.
if (corpseDist < sPlayerbotAIConfig->reactDistance) if (corpseDist < sPlayerbotAIConfig->reactDistance)
{ {
if (moveToMaster) if (moveToLeader)
moveToPos = masterPos; moveToPos = leaderPos;
else else
{ {
FleeManager manager(bot, reclaimDist, 0.0, urand(0, 1), moveToPos); FleeManager manager(bot, reclaimDist, 0.0, urand(0, 1), moveToPos);
@@ -215,12 +215,12 @@ GraveyardStruct const* SpiritHealerAction::GetGrave(bool startZone)
if (!startZone && ClosestGrave) if (!startZone && ClosestGrave)
return ClosestGrave; return ClosestGrave;
if (botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT) && botAI->GetGroupMaster() && botAI->GetGroupMaster() != bot) if (botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT) && botAI->GetGroupLeader() && botAI->GetGroupLeader() != bot)
{ {
Player* master = botAI->GetGroupMaster(); Player* groupLeader = botAI->GetGroupLeader();
if (master && master != bot) if (groupLeader && groupLeader != bot)
{ {
ClosestGrave = sGraveyard->GetClosestGraveyard(master, bot->GetTeamId()); ClosestGrave = sGraveyard->GetClosestGraveyard(groupLeader, bot->GetTeamId());
if (ClosestGrave) if (ClosestGrave)
return ClosestGrave; return ClosestGrave;

View File

@@ -35,8 +35,8 @@ bool RewardAction::Execute(Event event)
return true; return true;
} }
Unit* mtar = AI_VALUE(Unit*, "master target"); Unit* groupLeaderUnit = AI_VALUE(Unit*, "group leader");
if (mtar && Reward(itemId, mtar)) if (groupLeaderUnit && Reward(itemId, groupLeaderUnit))
return true; return true;
botAI->TellError("Cannot talk to quest giver"); botAI->TellError("Cannot talk to quest giver");

View File

@@ -76,7 +76,7 @@ void RpgHelper::setFacing(GuidPosition guidPosition)
void RpgHelper::setDelay(bool waitForGroup) void RpgHelper::setDelay(bool waitForGroup)
{ {
if (!botAI->HasRealPlayerMaster() || (waitForGroup && botAI->GetGroupMaster() == bot && bot->GetGroup())) if (!botAI->HasRealPlayerMaster() || (waitForGroup && botAI->GetGroupLeader() == bot && bot->GetGroup()))
botAI->SetNextCheckDelay(sPlayerbotAIConfig->rpgDelay); botAI->SetNextCheckDelay(sPlayerbotAIConfig->rpgDelay);
else else
botAI->SetNextCheckDelay(sPlayerbotAIConfig->rpgDelay / 5); botAI->SetNextCheckDelay(sPlayerbotAIConfig->rpgDelay / 5);

View File

@@ -22,8 +22,8 @@ bool SecurityCheckAction::Execute(Event event)
ItemQualities threshold = group->GetLootThreshold(); ItemQualities threshold = group->GetLootThreshold();
if (method == MASTER_LOOT || method == FREE_FOR_ALL || threshold > ITEM_QUALITY_UNCOMMON) if (method == MASTER_LOOT || method == FREE_FOR_ALL || threshold > ITEM_QUALITY_UNCOMMON)
{ {
if ((botAI->GetGroupMaster()->GetSession()->GetSecurity() == SEC_PLAYER) && if ((botAI->GetGroupLeader()->GetSession()->GetSecurity() == SEC_PLAYER) &&
(!bot->GetGuildId() || bot->GetGuildId() != botAI->GetGroupMaster()->GetGuildId())) (!bot->GetGuildId() || bot->GetGuildId() != botAI->GetGroupLeader()->GetGuildId()))
{ {
botAI->TellError("I will play with this loot type only if I'm in your guild :/"); botAI->TellError("I will play with this loot type only if I'm in your guild :/");
botAI->ChangeStrategy("+passive,+stay", BOT_STATE_NON_COMBAT); botAI->ChangeStrategy("+passive,+stay", BOT_STATE_NON_COMBAT);

View File

@@ -22,7 +22,7 @@ bool OutOfReactRangeAction::Execute(Event event)
bool OutOfReactRangeAction::isUseful() bool OutOfReactRangeAction::isUseful()
{ {
bool canFollow = Follow(AI_VALUE(Unit*, "master target")); bool canFollow = Follow(AI_VALUE(Unit*, "group leader"));
if (!canFollow) if (!canFollow)
{ {
return false; return false;

View File

@@ -64,7 +64,7 @@ bool MoveToDarkPortalAction::Execute(Event event)
{ {
if (bot->GetGroup()) if (bot->GetGroup())
if (bot->GetGroup()->GetLeaderGUID() != bot->GetGUID() && if (bot->GetGroup()->GetLeaderGUID() != bot->GetGUID() &&
!GET_PLAYERBOT_AI(GET_PLAYERBOT_AI(bot)->GetGroupMaster())) !GET_PLAYERBOT_AI(GET_PLAYERBOT_AI(bot)->GetGroupLeader()))
return false; return false;
if (bot->GetLevel() > 57) if (bot->GetLevel() > 57)

View File

@@ -22,8 +22,8 @@ bool UnstealthTrigger::IsActive()
return botAI->HasAura("stealth", bot) && !AI_VALUE(uint8, "attacker count") && return botAI->HasAura("stealth", bot) && !AI_VALUE(uint8, "attacker count") &&
(AI_VALUE2(bool, "moving", "self target") && (AI_VALUE2(bool, "moving", "self target") &&
((botAI->GetMaster() && ((botAI->GetMaster() &&
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "master target"), 10.0f) && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "group leader"), 10.0f) &&
AI_VALUE2(bool, "moving", "master target")) || AI_VALUE2(bool, "moving", "group leader")) ||
!AI_VALUE(uint8, "attacker count"))); !AI_VALUE(uint8, "attacker count")));
} }

View File

@@ -213,7 +213,7 @@ PartyMemberToHealOutOfSpellRangeTrigger::PartyMemberToHealOutOfSpellRangeTrigger
bool FarFromMasterTrigger::IsActive() bool FarFromMasterTrigger::IsActive()
{ {
return sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "master target"), distance); return sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "group leader"), distance);
} }
bool TooCloseToCreatureTrigger::TooCloseToCreature(uint32 creatureId, float range, bool alive) bool TooCloseToCreatureTrigger::TooCloseToCreature(uint32 creatureId, float range, bool alive)

View File

@@ -62,7 +62,7 @@ class MeleeFormation : public FollowFormation
public: public:
MeleeFormation(PlayerbotAI* botAI) : FollowFormation(botAI, "melee") {} MeleeFormation(PlayerbotAI* botAI) : FollowFormation(botAI, "melee") {}
std::string const GetTargetName() override { return "master target"; } std::string const GetTargetName() override { return "group leader"; }
}; };
class QueueFormation : public FollowFormation class QueueFormation : public FollowFormation

View File

@@ -3,8 +3,8 @@
* and/or modify it under version 3 of the License, or (at your option), any later version. * and/or modify it under version 3 of the License, or (at your option), any later version.
*/ */
#include "MasterTargetValue.h" #include "GroupLeaderValue.h"
#include "Playerbots.h" #include "Playerbots.h"
Unit* MasterTargetValue::Calculate() { return botAI->GetGroupMaster(); } Unit* GroupLeaderValue::Calculate() { return botAI->GetGroupLeader(); }

View File

@@ -3,18 +3,18 @@
* and/or modify it under version 3 of the License, or (at your option), any later version. * and/or modify it under version 3 of the License, or (at your option), any later version.
*/ */
#ifndef _PLAYERBOT_MASTERTARGETVALUE_H #ifndef _PLAYERBOT_GROUPLEADERVALUE_H
#define _PLAYERBOT_MASTERTARGETVALUE_H #define _PLAYERBOT_GROUPLEADERVALUE_H
#include "Value.h" #include "Value.h"
class PlayerbotAI; class PlayerbotAI;
class Unit; class Unit;
class MasterTargetValue : public UnitCalculatedValue class GroupLeaderValue : public UnitCalculatedValue
{ {
public: public:
MasterTargetValue(PlayerbotAI* botAI, std::string const name = "master target") : UnitCalculatedValue(botAI, name) GroupLeaderValue(PlayerbotAI* botAI, std::string const name = "group leader") : UnitCalculatedValue(botAI, name)
{ {
} }

View File

@@ -28,7 +28,7 @@ GuidVector GroupMembersValue::Calculate()
bool IsFollowingPartyValue::Calculate() bool IsFollowingPartyValue::Calculate()
{ {
if (botAI->GetGroupMaster() == bot) if (botAI->GetGroupLeader() == bot)
return true; return true;
if (botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT)) if (botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
@@ -39,15 +39,15 @@ bool IsFollowingPartyValue::Calculate()
bool IsNearLeaderValue::Calculate() bool IsNearLeaderValue::Calculate()
{ {
Player* groupMaster = botAI->GetGroupMaster(); Player* groupLeader = botAI->GetGroupLeader();
if (!groupMaster) if (!groupLeader)
return false; return false;
if (groupMaster == bot) if (groupLeader == bot)
return true; return true;
return sServerFacade->GetDistance2d(bot, botAI->GetGroupMaster()) < sPlayerbotAIConfig->sightDistance; return sServerFacade->GetDistance2d(bot, botAI->GetGroupLeader()) < sPlayerbotAIConfig->sightDistance;
} }
bool BoolANDValue::Calculate() bool BoolANDValue::Calculate()
@@ -154,8 +154,8 @@ bool GroupReadyValue::Calculate()
// We only wait for members that are in range otherwise we might be waiting for bots stuck in dead loops // We only wait for members that are in range otherwise we might be waiting for bots stuck in dead loops
// forever. // forever.
if (botAI->GetGroupMaster() && if (botAI->GetGroupLeader() &&
sServerFacade->GetDistance2d(member, botAI->GetGroupMaster()) > sPlayerbotAIConfig->sightDistance) sServerFacade->GetDistance2d(member, botAI->GetGroupLeader()) > sPlayerbotAIConfig->sightDistance)
continue; continue;
if (member->GetHealthPct() < sPlayerbotAIConfig->almostFullHealth) if (member->GetHealthPct() < sPlayerbotAIConfig->almostFullHealth)

View File

@@ -30,6 +30,7 @@
#include "Formations.h" #include "Formations.h"
#include "GrindTargetValue.h" #include "GrindTargetValue.h"
#include "GroupValues.h" #include "GroupValues.h"
#include "GroupLeaderValue.h"
#include "GuildValues.h" #include "GuildValues.h"
#include "HasAvailableLootValue.h" #include "HasAvailableLootValue.h"
#include "HasTotemValue.h" #include "HasTotemValue.h"
@@ -51,7 +52,6 @@
#include "LootStrategyValue.h" #include "LootStrategyValue.h"
#include "MaintenanceValues.h" #include "MaintenanceValues.h"
#include "ManaSaveLevelValue.h" #include "ManaSaveLevelValue.h"
#include "MasterTargetValue.h"
#include "NearestAdsValue.h" #include "NearestAdsValue.h"
#include "NearestCorpsesValue.h" #include "NearestCorpsesValue.h"
#include "NearestFriendlyPlayersValue.h" #include "NearestFriendlyPlayersValue.h"
@@ -130,7 +130,7 @@ public:
creators["party member to resurrect"] = &ValueContext::party_member_to_resurrect; creators["party member to resurrect"] = &ValueContext::party_member_to_resurrect;
creators["current target"] = &ValueContext::current_target; creators["current target"] = &ValueContext::current_target;
creators["self target"] = &ValueContext::self_target; creators["self target"] = &ValueContext::self_target;
creators["master target"] = &ValueContext::master; creators["group leader"] = &ValueContext::group_leader;
creators["line target"] = &ValueContext::line_target; creators["line target"] = &ValueContext::line_target;
creators["tank target"] = &ValueContext::tank_target; creators["tank target"] = &ValueContext::tank_target;
creators["dps target"] = &ValueContext::dps_target; creators["dps target"] = &ValueContext::dps_target;
@@ -439,7 +439,7 @@ private:
static UntypedValue* current_target(PlayerbotAI* botAI) { return new CurrentTargetValue(botAI); } static UntypedValue* current_target(PlayerbotAI* botAI) { return new CurrentTargetValue(botAI); }
static UntypedValue* old_target(PlayerbotAI* botAI) { return new CurrentTargetValue(botAI); } static UntypedValue* old_target(PlayerbotAI* botAI) { return new CurrentTargetValue(botAI); }
static UntypedValue* self_target(PlayerbotAI* botAI) { return new SelfTargetValue(botAI); } static UntypedValue* self_target(PlayerbotAI* botAI) { return new SelfTargetValue(botAI); }
static UntypedValue* master(PlayerbotAI* botAI) { return new MasterTargetValue(botAI); } static UntypedValue* group_leader(PlayerbotAI* botAI) { return new GroupLeaderValue(botAI); }
static UntypedValue* line_target(PlayerbotAI* botAI) { return new LineTargetValue(botAI); } static UntypedValue* line_target(PlayerbotAI* botAI) { return new LineTargetValue(botAI); }
static UntypedValue* tank_target(PlayerbotAI* botAI) { return new TankTargetValue(botAI); } static UntypedValue* tank_target(PlayerbotAI* botAI) { return new TankTargetValue(botAI); }
static UntypedValue* dps_target(PlayerbotAI* botAI) { return new DpsTargetValue(botAI); } static UntypedValue* dps_target(PlayerbotAI* botAI) { return new DpsTargetValue(botAI); }