mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 00:58:33 +00:00
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:
@@ -420,7 +420,7 @@ void PlayerbotAI::UpdateAIGroupAndMaster()
|
||||
{
|
||||
botAI->ChangeStrategy("+follow", BOT_STATE_NON_COMBAT);
|
||||
|
||||
if (botAI->GetMaster() == botAI->GetGroupMaster())
|
||||
if (botAI->GetMaster() == botAI->GetGroupLeader())
|
||||
botAI->TellMaster("Hello, I follow you!");
|
||||
else
|
||||
botAI->TellMaster(!urand(0, 2) ? "Hello!" : "Hi!");
|
||||
@@ -4093,7 +4093,7 @@ Player* PlayerbotAI::FindNewMaster()
|
||||
if (!group)
|
||||
return nullptr;
|
||||
|
||||
Player* groupLeader = GetGroupMaster();
|
||||
Player* groupLeader = GetGroupLeader();
|
||||
PlayerbotAI* leaderBotAI = GET_PLAYERBOT_AI(groupLeader);
|
||||
if (!leaderBotAI || leaderBotAI->IsRealPlayer())
|
||||
return groupLeader;
|
||||
@@ -4144,7 +4144,7 @@ bool PlayerbotAI::HasActivePlayerMaster() { return master && !GET_PLAYERBOT_AI(m
|
||||
|
||||
bool PlayerbotAI::IsAlt() { return HasRealPlayerMaster() && !sRandomPlayerbotMgr->IsRandomBot(bot); }
|
||||
|
||||
Player* PlayerbotAI::GetGroupMaster()
|
||||
Player* PlayerbotAI::GetGroupLeader()
|
||||
{
|
||||
if (!bot->InBattleground())
|
||||
if (Group* group = bot->GetGroup())
|
||||
|
||||
@@ -540,7 +540,7 @@ public:
|
||||
// Get the group leader or the master of the bot.
|
||||
// Checks if the bot is summoned as alt of a player
|
||||
bool IsAlt();
|
||||
Player* GetGroupMaster();
|
||||
Player* GetGroupLeader();
|
||||
// Returns a semi-random (cycling) number that is fixed for each bot.
|
||||
uint32 GetFixedBotNumer(uint32 maxNum = 100, float cyclePerMin = 1);
|
||||
GrouperType GetGrouperType();
|
||||
|
||||
@@ -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.";
|
||||
break;
|
||||
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.";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1480,10 +1480,10 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
|
||||
if (!sRandomPlayerbotMgr->IsRandomBot(player))
|
||||
update = false;
|
||||
|
||||
if (player->GetGroup() && botAI->GetGroupMaster())
|
||||
if (player->GetGroup() && botAI->GetGroupLeader())
|
||||
{
|
||||
PlayerbotAI* groupMasterBotAI = GET_PLAYERBOT_AI(botAI->GetGroupMaster());
|
||||
if (!groupMasterBotAI || groupMasterBotAI->IsRealPlayer())
|
||||
PlayerbotAI* groupLeaderBotAI = GET_PLAYERBOT_AI(botAI->GetGroupLeader());
|
||||
if (!groupLeaderBotAI || groupLeaderBotAI->IsRealPlayer())
|
||||
{
|
||||
update = false;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
creators["shoot"] = &ActionContext::shoot;
|
||||
creators["follow"] = &ActionContext::follow;
|
||||
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["stay"] = &ActionContext::stay;
|
||||
creators["sit"] = &ActionContext::sit;
|
||||
@@ -318,7 +318,7 @@ private:
|
||||
static Action* runaway(PlayerbotAI* botAI) { return new RunAwayAction(botAI); }
|
||||
static Action* follow(PlayerbotAI* botAI) { return new FollowAction(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_loot(PlayerbotAI* botAI) { return new AddLootAction(botAI); }
|
||||
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }
|
||||
|
||||
@@ -311,7 +311,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldObject* target)
|
||||
bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
{
|
||||
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
||||
Player* gmaster = botAI->GetGroupMaster();
|
||||
Player* groupLeader = botAI->GetGroupLeader();
|
||||
Player* realMaster = botAI->GetMaster();
|
||||
AiObjectContext* context = botAI->GetAiObjectContext();
|
||||
|
||||
@@ -327,30 +327,30 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!gmaster || bot == gmaster)
|
||||
if (!groupLeader || bot == groupLeader)
|
||||
return true;
|
||||
|
||||
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
|
||||
return true;
|
||||
|
||||
if (bot->GetDistance(gmaster) > sPlayerbotAIConfig->rpgDistance * 2)
|
||||
if (bot->GetDistance(groupLeader) > sPlayerbotAIConfig->rpgDistance * 2)
|
||||
return false;
|
||||
|
||||
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)
|
||||
{
|
||||
Player* player = gmaster;
|
||||
if (gmaster && !gmaster->isMoving() ||
|
||||
Player* player = groupLeader;
|
||||
if (groupLeader && !groupLeader->isMoving() ||
|
||||
PAI_VALUE(WorldPosition, "last long move").distance(pos) < sPlayerbotAIConfig->reactDistance)
|
||||
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;
|
||||
|
||||
if (!gmaster->isMoving() && distance < 25.0f)
|
||||
if (!groupLeader->isMoving() && distance < 25.0f)
|
||||
return true;
|
||||
|
||||
if (distance < formation->GetMaxDistance())
|
||||
|
||||
@@ -180,7 +180,7 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
|
||||
void ChooseTravelTargetAction::setNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget)
|
||||
{
|
||||
// Tell the master where we are going.
|
||||
if (!bot->GetGroup() || (botAI->GetGroupMaster() == bot))
|
||||
if (!bot->GetGroup() || (botAI->GetGroupLeader() == bot))
|
||||
ReportTravelTarget(newTarget, oldTarget);
|
||||
|
||||
// If we are heading to a creature/npc clear it from the ignore list.
|
||||
|
||||
@@ -70,7 +70,7 @@ bool FollowAction::isUseful()
|
||||
if (!target.empty())
|
||||
fTarget = AI_VALUE(Unit*, target);
|
||||
else
|
||||
fTarget = AI_VALUE(Unit*, "master target");
|
||||
fTarget = AI_VALUE(Unit*, "group leader");
|
||||
|
||||
if (fTarget)
|
||||
{
|
||||
@@ -114,9 +114,9 @@ bool FollowAction::CanDeadFollow(Unit* target)
|
||||
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);
|
||||
if (!canFollow)
|
||||
{
|
||||
@@ -146,22 +146,22 @@ bool FleeToMasterAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FleeToMasterAction::isUseful()
|
||||
bool FleeToGroupLeaderAction::isUseful()
|
||||
{
|
||||
if (!botAI->GetGroupMaster())
|
||||
if (!botAI->GetGroupLeader())
|
||||
return false;
|
||||
|
||||
if (botAI->GetGroupMaster() == bot)
|
||||
if (botAI->GetGroupLeader() == bot)
|
||||
return false;
|
||||
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
if (target && botAI->GetGroupMaster()->GetTarget() == target->GetGUID())
|
||||
if (target && botAI->GetGroupLeader()->GetTarget() == target->GetGUID())
|
||||
return false;
|
||||
|
||||
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
|
||||
return false;
|
||||
|
||||
Unit* fTarget = AI_VALUE(Unit*, "master target");
|
||||
Unit* fTarget = AI_VALUE(Unit*, "group leader");
|
||||
|
||||
if (!CanDeadFollow(fTarget))
|
||||
return false;
|
||||
|
||||
@@ -20,10 +20,10 @@ public:
|
||||
bool CanDeadFollow(Unit* target);
|
||||
};
|
||||
|
||||
class FleeToMasterAction : public FollowAction
|
||||
class FleeToGroupLeaderAction : public FollowAction
|
||||
{
|
||||
public:
|
||||
FleeToMasterAction(PlayerbotAI* botAI) : FollowAction(botAI, "flee to master") {}
|
||||
FleeToGroupLeaderAction(PlayerbotAI* botAI) : FollowAction(botAI, "flee to group leader") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
@@ -141,7 +141,7 @@ bool InviteNearbyToGroupAction::isUseful()
|
||||
if (group->isRaidGroup() && group->IsFull())
|
||||
return false;
|
||||
|
||||
if (botAI->GetGroupMaster() != bot)
|
||||
if (botAI->GetGroupLeader() != bot)
|
||||
return false;
|
||||
|
||||
uint32 memberCount = group->GetMembersCount();
|
||||
|
||||
@@ -109,22 +109,22 @@ bool LeaveFarAwayAction::isUseful()
|
||||
if (!bot->GetGroup())
|
||||
return false;
|
||||
|
||||
Player* master = botAI->GetGroupMaster();
|
||||
Player* groupLeader = botAI->GetGroupLeader();
|
||||
Player* trueMaster = botAI->GetMaster();
|
||||
if (!master || (bot == master && !botAI->IsRealPlayer()))
|
||||
if (!groupLeader || (bot == groupLeader && !botAI->IsRealPlayer()))
|
||||
return false;
|
||||
|
||||
PlayerbotAI* masterBotAI = nullptr;
|
||||
if (master)
|
||||
masterBotAI = GET_PLAYERBOT_AI(master);
|
||||
if (master && !masterBotAI)
|
||||
PlayerbotAI* groupLeaderBotAI = nullptr;
|
||||
if (groupLeader)
|
||||
groupLeaderBotAI = GET_PLAYERBOT_AI(groupLeader);
|
||||
if (groupLeader && !groupLeaderBotAI)
|
||||
return false;
|
||||
|
||||
if (trueMaster && !GET_PLAYERBOT_AI(trueMaster))
|
||||
return false;
|
||||
|
||||
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;
|
||||
|
||||
if (botAI->GetGrouperType() == GrouperType::SOLO)
|
||||
@@ -138,19 +138,19 @@ bool LeaveFarAwayAction::isUseful()
|
||||
if (dCount > 4 && !botAI->HasRealPlayerMaster())
|
||||
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"))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(int32(master->GetLevel() - bot->GetLevel())) > 4)
|
||||
if (abs(int32(groupLeader->GetLevel() - bot->GetLevel())) > 4)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ bool MoveToTravelTargetAction::Execute(Event event)
|
||||
WorldLocation location = *target->getPosition();
|
||||
|
||||
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())
|
||||
{
|
||||
|
||||
@@ -1102,7 +1102,7 @@ void MovementAction::UpdateMovementState()
|
||||
// {
|
||||
// if (Unit* pTarget = sServerFacade->GetChaseTarget(bot))
|
||||
// {
|
||||
// if (pTarget != botAI->GetGroupMaster())
|
||||
// if (pTarget != botAI->GetGroupLeader())
|
||||
// return;
|
||||
|
||||
// if (!bot->IsWithinMeleeRange(pTarget))
|
||||
@@ -2663,7 +2663,7 @@ bool DisperseSetAction::Execute(Event event)
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -13,10 +13,10 @@ bool RandomBotUpdateAction::Execute(Event event)
|
||||
if (!sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
return false;
|
||||
|
||||
if (bot->GetGroup() && botAI->GetGroupMaster())
|
||||
if (bot->GetGroup() && botAI->GetGroupLeader())
|
||||
{
|
||||
PlayerbotAI* groupMasterBotAI = GET_PLAYERBOT_AI(botAI->GetGroupMaster());
|
||||
if (!groupMasterBotAI || groupMasterBotAI->IsRealPlayer())
|
||||
PlayerbotAI* groupLeaderBotAI = GET_PLAYERBOT_AI(botAI->GetGroupLeader());
|
||||
if (!groupLeaderBotAI || groupLeaderBotAI->IsRealPlayer())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,15 +168,15 @@ bool AutoReleaseSpiritAction::ShouldAutoRelease() const
|
||||
if (!bot->GetGroup())
|
||||
return true;
|
||||
|
||||
Player* groupMaster = botAI->GetGroupMaster();
|
||||
if (!groupMaster || groupMaster == bot)
|
||||
Player* groupLeader = botAI->GetGroupLeader();
|
||||
if (!groupLeader || groupLeader == bot)
|
||||
return true;
|
||||
|
||||
if (!botAI->HasActivePlayerMaster())
|
||||
return true;
|
||||
|
||||
if (botAI->HasActivePlayerMaster() &&
|
||||
groupMaster->GetMapId() == bot->GetMapId() &&
|
||||
groupLeader->GetMapId() == bot->GetMapId() &&
|
||||
bot->GetMap() &&
|
||||
(bot->GetMap()->IsRaid() || bot->GetMap()->IsDungeon()))
|
||||
{
|
||||
@@ -184,7 +184,7 @@ bool AutoReleaseSpiritAction::ShouldAutoRelease() const
|
||||
}
|
||||
|
||||
return sServerFacade->IsDistanceGreaterThan(
|
||||
AI_VALUE2(float, "distance", "master target"),
|
||||
AI_VALUE2(float, "distance", "group leader"),
|
||||
sPlayerbotAIConfig->sightDistance);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,4 +16,4 @@ bool ResetInstancesAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ResetInstancesAction::isUseful() { return botAI->GetGroupMaster() == bot; };
|
||||
bool ResetInstancesAction::isUseful() { return botAI->GetGroupLeader() == bot; };
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
|
||||
bool ReviveFromCorpseAction::Execute(Event event)
|
||||
{
|
||||
Player* master = botAI->GetGroupMaster();
|
||||
Player* groupLeader = botAI->GetGroupLeader();
|
||||
Corpse* corpse = bot->GetCorpse();
|
||||
|
||||
// follow master when master revives
|
||||
// follow group Leader when group Leader revives
|
||||
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))
|
||||
{
|
||||
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
|
||||
@@ -43,10 +43,10 @@ bool ReviveFromCorpseAction::Execute(Event event)
|
||||
// time(nullptr))
|
||||
// return false;
|
||||
|
||||
if (master)
|
||||
if (groupLeader)
|
||||
{
|
||||
if (!GET_PLAYERBOT_AI(master) && master->isDead() && master->GetCorpse() &&
|
||||
sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "master target"),
|
||||
if (!GET_PLAYERBOT_AI(groupLeader) && groupLeader->isDead() && groupLeader->GetCorpse() &&
|
||||
sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
|
||||
sPlayerbotAIConfig->farDistance))
|
||||
return false;
|
||||
}
|
||||
@@ -79,15 +79,15 @@ bool FindCorpseAction::Execute(Event event)
|
||||
if (bot->InBattleground())
|
||||
return false;
|
||||
|
||||
Player* master = botAI->GetGroupMaster();
|
||||
Player* groupLeader = botAI->GetGroupLeader();
|
||||
Corpse* corpse = bot->GetCorpse();
|
||||
if (!corpse)
|
||||
return false;
|
||||
|
||||
// if (master)
|
||||
// if (groupLeader)
|
||||
// {
|
||||
// if (!GET_PLAYERBOT_AI(master) &&
|
||||
// sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "master target"),
|
||||
// if (!GET_PLAYERBOT_AI(groupLeader) &&
|
||||
// sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
|
||||
// sPlayerbotAIConfig->farDistance)) return false;
|
||||
// }
|
||||
|
||||
@@ -110,20 +110,20 @@ bool FindCorpseAction::Execute(Event event)
|
||||
WorldPosition botPos(bot);
|
||||
WorldPosition corpsePos(corpse);
|
||||
WorldPosition moveToPos = corpsePos;
|
||||
WorldPosition masterPos(master);
|
||||
WorldPosition leaderPos(groupLeader);
|
||||
|
||||
float reclaimDist = CORPSE_RECLAIM_RADIUS - 5.0f;
|
||||
float corpseDist = botPos.distance(corpsePos);
|
||||
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.
|
||||
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;
|
||||
}
|
||||
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 (corpseDist < sPlayerbotAIConfig->reactDistance)
|
||||
{
|
||||
if (moveToMaster)
|
||||
moveToPos = masterPos;
|
||||
if (moveToLeader)
|
||||
moveToPos = leaderPos;
|
||||
else
|
||||
{
|
||||
FleeManager manager(bot, reclaimDist, 0.0, urand(0, 1), moveToPos);
|
||||
@@ -215,12 +215,12 @@ GraveyardStruct const* SpiritHealerAction::GetGrave(bool startZone)
|
||||
if (!startZone && 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();
|
||||
if (master && master != bot)
|
||||
Player* groupLeader = botAI->GetGroupLeader();
|
||||
if (groupLeader && groupLeader != bot)
|
||||
{
|
||||
ClosestGrave = sGraveyard->GetClosestGraveyard(master, bot->GetTeamId());
|
||||
ClosestGrave = sGraveyard->GetClosestGraveyard(groupLeader, bot->GetTeamId());
|
||||
|
||||
if (ClosestGrave)
|
||||
return ClosestGrave;
|
||||
|
||||
@@ -35,8 +35,8 @@ bool RewardAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
Unit* mtar = AI_VALUE(Unit*, "master target");
|
||||
if (mtar && Reward(itemId, mtar))
|
||||
Unit* groupLeaderUnit = AI_VALUE(Unit*, "group leader");
|
||||
if (groupLeaderUnit && Reward(itemId, groupLeaderUnit))
|
||||
return true;
|
||||
|
||||
botAI->TellError("Cannot talk to quest giver");
|
||||
|
||||
@@ -76,7 +76,7 @@ void RpgHelper::setFacing(GuidPosition guidPosition)
|
||||
|
||||
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);
|
||||
else
|
||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->rpgDelay / 5);
|
||||
|
||||
@@ -22,8 +22,8 @@ bool SecurityCheckAction::Execute(Event event)
|
||||
ItemQualities threshold = group->GetLootThreshold();
|
||||
if (method == MASTER_LOOT || method == FREE_FOR_ALL || threshold > ITEM_QUALITY_UNCOMMON)
|
||||
{
|
||||
if ((botAI->GetGroupMaster()->GetSession()->GetSecurity() == SEC_PLAYER) &&
|
||||
(!bot->GetGuildId() || bot->GetGuildId() != botAI->GetGroupMaster()->GetGuildId()))
|
||||
if ((botAI->GetGroupLeader()->GetSession()->GetSecurity() == SEC_PLAYER) &&
|
||||
(!bot->GetGuildId() || bot->GetGuildId() != botAI->GetGroupLeader()->GetGuildId()))
|
||||
{
|
||||
botAI->TellError("I will play with this loot type only if I'm in your guild :/");
|
||||
botAI->ChangeStrategy("+passive,+stay", BOT_STATE_NON_COMBAT);
|
||||
|
||||
@@ -22,7 +22,7 @@ bool OutOfReactRangeAction::Execute(Event event)
|
||||
|
||||
bool OutOfReactRangeAction::isUseful()
|
||||
{
|
||||
bool canFollow = Follow(AI_VALUE(Unit*, "master target"));
|
||||
bool canFollow = Follow(AI_VALUE(Unit*, "group leader"));
|
||||
if (!canFollow)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -64,7 +64,7 @@ bool MoveToDarkPortalAction::Execute(Event event)
|
||||
{
|
||||
if (bot->GetGroup())
|
||||
if (bot->GetGroup()->GetLeaderGUID() != bot->GetGUID() &&
|
||||
!GET_PLAYERBOT_AI(GET_PLAYERBOT_AI(bot)->GetGroupMaster()))
|
||||
!GET_PLAYERBOT_AI(GET_PLAYERBOT_AI(bot)->GetGroupLeader()))
|
||||
return false;
|
||||
|
||||
if (bot->GetLevel() > 57)
|
||||
|
||||
@@ -22,8 +22,8 @@ bool UnstealthTrigger::IsActive()
|
||||
return botAI->HasAura("stealth", bot) && !AI_VALUE(uint8, "attacker count") &&
|
||||
(AI_VALUE2(bool, "moving", "self target") &&
|
||||
((botAI->GetMaster() &&
|
||||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "master target"), 10.0f) &&
|
||||
AI_VALUE2(bool, "moving", "master target")) ||
|
||||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "group leader"), 10.0f) &&
|
||||
AI_VALUE2(bool, "moving", "group leader")) ||
|
||||
!AI_VALUE(uint8, "attacker count")));
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ PartyMemberToHealOutOfSpellRangeTrigger::PartyMemberToHealOutOfSpellRangeTrigger
|
||||
|
||||
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)
|
||||
|
||||
@@ -62,7 +62,7 @@ class MeleeFormation : public FollowFormation
|
||||
public:
|
||||
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
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* 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"
|
||||
|
||||
Unit* MasterTargetValue::Calculate() { return botAI->GetGroupMaster(); }
|
||||
Unit* GroupLeaderValue::Calculate() { return botAI->GetGroupLeader(); }
|
||||
@@ -3,18 +3,18 @@
|
||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYERBOT_MASTERTARGETVALUE_H
|
||||
#define _PLAYERBOT_MASTERTARGETVALUE_H
|
||||
#ifndef _PLAYERBOT_GROUPLEADERVALUE_H
|
||||
#define _PLAYERBOT_GROUPLEADERVALUE_H
|
||||
|
||||
#include "Value.h"
|
||||
|
||||
class PlayerbotAI;
|
||||
class Unit;
|
||||
|
||||
class MasterTargetValue : public UnitCalculatedValue
|
||||
class GroupLeaderValue : public UnitCalculatedValue
|
||||
{
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ GuidVector GroupMembersValue::Calculate()
|
||||
|
||||
bool IsFollowingPartyValue::Calculate()
|
||||
{
|
||||
if (botAI->GetGroupMaster() == bot)
|
||||
if (botAI->GetGroupLeader() == bot)
|
||||
return true;
|
||||
|
||||
if (botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
|
||||
@@ -39,15 +39,15 @@ bool IsFollowingPartyValue::Calculate()
|
||||
|
||||
bool IsNearLeaderValue::Calculate()
|
||||
{
|
||||
Player* groupMaster = botAI->GetGroupMaster();
|
||||
Player* groupLeader = botAI->GetGroupLeader();
|
||||
|
||||
if (!groupMaster)
|
||||
if (!groupLeader)
|
||||
return false;
|
||||
|
||||
if (groupMaster == bot)
|
||||
if (groupLeader == bot)
|
||||
return true;
|
||||
|
||||
return sServerFacade->GetDistance2d(bot, botAI->GetGroupMaster()) < sPlayerbotAIConfig->sightDistance;
|
||||
return sServerFacade->GetDistance2d(bot, botAI->GetGroupLeader()) < sPlayerbotAIConfig->sightDistance;
|
||||
}
|
||||
|
||||
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
|
||||
// forever.
|
||||
if (botAI->GetGroupMaster() &&
|
||||
sServerFacade->GetDistance2d(member, botAI->GetGroupMaster()) > sPlayerbotAIConfig->sightDistance)
|
||||
if (botAI->GetGroupLeader() &&
|
||||
sServerFacade->GetDistance2d(member, botAI->GetGroupLeader()) > sPlayerbotAIConfig->sightDistance)
|
||||
continue;
|
||||
|
||||
if (member->GetHealthPct() < sPlayerbotAIConfig->almostFullHealth)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "Formations.h"
|
||||
#include "GrindTargetValue.h"
|
||||
#include "GroupValues.h"
|
||||
#include "GroupLeaderValue.h"
|
||||
#include "GuildValues.h"
|
||||
#include "HasAvailableLootValue.h"
|
||||
#include "HasTotemValue.h"
|
||||
@@ -51,7 +52,6 @@
|
||||
#include "LootStrategyValue.h"
|
||||
#include "MaintenanceValues.h"
|
||||
#include "ManaSaveLevelValue.h"
|
||||
#include "MasterTargetValue.h"
|
||||
#include "NearestAdsValue.h"
|
||||
#include "NearestCorpsesValue.h"
|
||||
#include "NearestFriendlyPlayersValue.h"
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
creators["party member to resurrect"] = &ValueContext::party_member_to_resurrect;
|
||||
creators["current target"] = &ValueContext::current_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["tank target"] = &ValueContext::tank_target;
|
||||
creators["dps target"] = &ValueContext::dps_target;
|
||||
@@ -439,7 +439,7 @@ private:
|
||||
static UntypedValue* current_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* 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* tank_target(PlayerbotAI* botAI) { return new TankTargetValue(botAI); }
|
||||
static UntypedValue* dps_target(PlayerbotAI* botAI) { return new DpsTargetValue(botAI); }
|
||||
|
||||
Reference in New Issue
Block a user