Skip to content

Commit 52c3e96

Browse files
authored
Rename groupmaster to groupleader and related variables. (mod-playerbots#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)
1 parent 38e2d85 commit 52c3e96

29 files changed

Lines changed: 101 additions & 101 deletions

src/PlayerbotAI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ void PlayerbotAI::UpdateAIGroupAndMaster()
420420
{
421421
botAI->ChangeStrategy("+follow", BOT_STATE_NON_COMBAT);
422422

423-
if (botAI->GetMaster() == botAI->GetGroupMaster())
423+
if (botAI->GetMaster() == botAI->GetGroupLeader())
424424
botAI->TellMaster("Hello, I follow you!");
425425
else
426426
botAI->TellMaster(!urand(0, 2) ? "Hello!" : "Hi!");
@@ -4093,7 +4093,7 @@ Player* PlayerbotAI::FindNewMaster()
40934093
if (!group)
40944094
return nullptr;
40954095

4096-
Player* groupLeader = GetGroupMaster();
4096+
Player* groupLeader = GetGroupLeader();
40974097
PlayerbotAI* leaderBotAI = GET_PLAYERBOT_AI(groupLeader);
40984098
if (!leaderBotAI || leaderBotAI->IsRealPlayer())
40994099
return groupLeader;
@@ -4144,7 +4144,7 @@ bool PlayerbotAI::HasActivePlayerMaster() { return master && !GET_PLAYERBOT_AI(m
41444144

41454145
bool PlayerbotAI::IsAlt() { return HasRealPlayerMaster() && !sRandomPlayerbotMgr->IsRandomBot(bot); }
41464146

4147-
Player* PlayerbotAI::GetGroupMaster()
4147+
Player* PlayerbotAI::GetGroupLeader()
41484148
{
41494149
if (!bot->InBattleground())
41504150
if (Group* group = bot->GetGroup())

src/PlayerbotAI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ class PlayerbotAI : public PlayerbotAIBase
540540
// Get the group leader or the master of the bot.
541541
// Checks if the bot is summoned as alt of a player
542542
bool IsAlt();
543-
Player* GetGroupMaster();
543+
Player* GetGroupLeader();
544544
// Returns a semi-random (cycling) number that is fixed for each bot.
545545
uint32 GetFixedBotNumer(uint32 maxNum = 100, float cyclePerMin = 1);
546546
GrouperType GetGrouperType();

src/PlayerbotSecurity.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ bool PlayerbotSecurity::CheckLevelFor(PlayerbotSecurityLevel level, bool silent,
251251
out << "I am currently leading a group. I can invite you if you want.";
252252
break;
253253
case PLAYERBOT_DENY_NOT_LEADER:
254-
if (botAI->GetGroupMaster())
254+
if (botAI->GetGroupLeader())
255255
{
256-
out << "I am in a group with " << botAI->GetGroupMaster()->GetName()
256+
out << "I am in a group with " << botAI->GetGroupLeader()->GetName()
257257
<< ". You can ask him for invite.";
258258
}
259259
else

src/RandomPlayerbotMgr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,10 +1480,10 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
14801480
if (!sRandomPlayerbotMgr->IsRandomBot(player))
14811481
update = false;
14821482

1483-
if (player->GetGroup() && botAI->GetGroupMaster())
1483+
if (player->GetGroup() && botAI->GetGroupLeader())
14841484
{
1485-
PlayerbotAI* groupMasterBotAI = GET_PLAYERBOT_AI(botAI->GetGroupMaster());
1486-
if (!groupMasterBotAI || groupMasterBotAI->IsRealPlayer())
1485+
PlayerbotAI* groupLeaderBotAI = GET_PLAYERBOT_AI(botAI->GetGroupLeader());
1486+
if (!groupLeaderBotAI || groupLeaderBotAI->IsRealPlayer())
14871487
{
14881488
update = false;
14891489
}

src/strategy/actions/ActionContext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class ActionContext : public NamedObjectContext<Action>
121121
creators["shoot"] = &ActionContext::shoot;
122122
creators["follow"] = &ActionContext::follow;
123123
creators["move from group"] = &ActionContext::move_from_group;
124-
creators["flee to master"] = &ActionContext::flee_to_master;
124+
creators["flee to group leader"] = &ActionContext::flee_to_group_leader;
125125
creators["runaway"] = &ActionContext::runaway;
126126
creators["stay"] = &ActionContext::stay;
127127
creators["sit"] = &ActionContext::sit;
@@ -318,7 +318,7 @@ class ActionContext : public NamedObjectContext<Action>
318318
static Action* runaway(PlayerbotAI* botAI) { return new RunAwayAction(botAI); }
319319
static Action* follow(PlayerbotAI* botAI) { return new FollowAction(botAI); }
320320
static Action* move_from_group(PlayerbotAI* botAI) { return new MoveFromGroupAction(botAI); }
321-
static Action* flee_to_master(PlayerbotAI* botAI) { return new FleeToMasterAction(botAI); }
321+
static Action* flee_to_group_leader(PlayerbotAI* botAI) { return new FleeToGroupLeaderAction(botAI); }
322322
static Action* add_gathering_loot(PlayerbotAI* botAI) { return new AddGatheringLootAction(botAI); }
323323
static Action* add_loot(PlayerbotAI* botAI) { return new AddLootAction(botAI); }
324324
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }

src/strategy/actions/ChooseRpgTargetAction.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldObject* target)
311311
bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
312312
{
313313
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
314-
Player* gmaster = botAI->GetGroupMaster();
314+
Player* groupLeader = botAI->GetGroupLeader();
315315
Player* realMaster = botAI->GetMaster();
316316
AiObjectContext* context = botAI->GetAiObjectContext();
317317

@@ -327,30 +327,30 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
327327
return false;
328328
}
329329

330-
if (!gmaster || bot == gmaster)
330+
if (!groupLeader || bot == groupLeader)
331331
return true;
332332

333333
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
334334
return true;
335335

336-
if (bot->GetDistance(gmaster) > sPlayerbotAIConfig->rpgDistance * 2)
336+
if (bot->GetDistance(groupLeader) > sPlayerbotAIConfig->rpgDistance * 2)
337337
return false;
338338

339339
Formation* formation = AI_VALUE(Formation*, "formation");
340-
float distance = gmaster->GetDistance2d(pos.getX(), pos.getY());
340+
float distance = groupLeader->GetDistance2d(pos.getX(), pos.getY());
341341

342342
if (!botAI->HasActivePlayerMaster() && distance < 50.0f)
343343
{
344-
Player* player = gmaster;
345-
if (gmaster && !gmaster->isMoving() ||
344+
Player* player = groupLeader;
345+
if (groupLeader && !groupLeader->isMoving() ||
346346
PAI_VALUE(WorldPosition, "last long move").distance(pos) < sPlayerbotAIConfig->reactDistance)
347347
return true;
348348
}
349349

350-
if ((inDungeon || !gmaster->HasPlayerFlag(PLAYER_FLAGS_RESTING)) && realMaster == gmaster && distance > 5.0f)
350+
if ((inDungeon || !groupLeader->HasPlayerFlag(PLAYER_FLAGS_RESTING)) && realMaster == groupLeader && distance > 5.0f)
351351
return false;
352352

353-
if (!gmaster->isMoving() && distance < 25.0f)
353+
if (!groupLeader->isMoving() && distance < 25.0f)
354354
return true;
355355

356356
if (distance < formation->GetMaxDistance())

src/strategy/actions/ChooseTravelTargetAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
180180
void ChooseTravelTargetAction::setNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget)
181181
{
182182
// Tell the master where we are going.
183-
if (!bot->GetGroup() || (botAI->GetGroupMaster() == bot))
183+
if (!bot->GetGroup() || (botAI->GetGroupLeader() == bot))
184184
ReportTravelTarget(newTarget, oldTarget);
185185

186186
// If we are heading to a creature/npc clear it from the ignore list.

src/strategy/actions/FollowActions.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ bool FollowAction::isUseful()
7070
if (!target.empty())
7171
fTarget = AI_VALUE(Unit*, target);
7272
else
73-
fTarget = AI_VALUE(Unit*, "master target");
73+
fTarget = AI_VALUE(Unit*, "group leader");
7474

7575
if (fTarget)
7676
{
@@ -114,9 +114,9 @@ bool FollowAction::CanDeadFollow(Unit* target)
114114
return true;
115115
}
116116

117-
bool FleeToMasterAction::Execute(Event event)
117+
bool FleeToGroupLeaderAction::Execute(Event event)
118118
{
119-
Unit* fTarget = AI_VALUE(Unit*, "master target");
119+
Unit* fTarget = AI_VALUE(Unit*, "group leader");
120120
bool canFollow = Follow(fTarget);
121121
if (!canFollow)
122122
{
@@ -146,22 +146,22 @@ bool FleeToMasterAction::Execute(Event event)
146146
return true;
147147
}
148148

149-
bool FleeToMasterAction::isUseful()
149+
bool FleeToGroupLeaderAction::isUseful()
150150
{
151-
if (!botAI->GetGroupMaster())
151+
if (!botAI->GetGroupLeader())
152152
return false;
153153

154-
if (botAI->GetGroupMaster() == bot)
154+
if (botAI->GetGroupLeader() == bot)
155155
return false;
156156

157157
Unit* target = AI_VALUE(Unit*, "current target");
158-
if (target && botAI->GetGroupMaster()->GetTarget() == target->GetGUID())
158+
if (target && botAI->GetGroupLeader()->GetTarget() == target->GetGUID())
159159
return false;
160160

161161
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
162162
return false;
163163

164-
Unit* fTarget = AI_VALUE(Unit*, "master target");
164+
Unit* fTarget = AI_VALUE(Unit*, "group leader");
165165

166166
if (!CanDeadFollow(fTarget))
167167
return false;

src/strategy/actions/FollowActions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class FollowAction : public MovementAction
2020
bool CanDeadFollow(Unit* target);
2121
};
2222

23-
class FleeToMasterAction : public FollowAction
23+
class FleeToGroupLeaderAction : public FollowAction
2424
{
2525
public:
26-
FleeToMasterAction(PlayerbotAI* botAI) : FollowAction(botAI, "flee to master") {}
26+
FleeToGroupLeaderAction(PlayerbotAI* botAI) : FollowAction(botAI, "flee to group leader") {}
2727

2828
bool Execute(Event event) override;
2929
bool isUseful() override;

src/strategy/actions/InviteToGroupAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ bool InviteNearbyToGroupAction::isUseful()
141141
if (group->isRaidGroup() && group->IsFull())
142142
return false;
143143

144-
if (botAI->GetGroupMaster() != bot)
144+
if (botAI->GetGroupLeader() != bot)
145145
return false;
146146

147147
uint32 memberCount = group->GetMembersCount();

0 commit comments

Comments
 (0)