Improper singletons migration to clean Meyer's singletons (cherry-pick) (#2082)

# Pull Request

- Applies the clean and corrected singletons, Meyer pattern. (cherry
picked from @SmashingQuasar )

Testing by just playing the game in various ways. Been tested by myself
@Celandriel and @SmashingQuasar
---

## Complexity & Impact

- Does this change add new decision branches?
    - [x] No
    - [ ] 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**)

---

## AI Assistance

- Was AI assistance (e.g. ChatGPT or similar tools) used while working
on this change?
    - [x] No
    - [ ] Yes (**explain below**)
---

## 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

Anything that significantly improves realism at the cost of stability or
performance should be carefully discussed
before merging.

---------

Co-authored-by: Nicolas Lebacq <nicolas.cordier@outlook.com>
Co-authored-by: Keleborn <22352763+Celandriel@users.noreply.github.com>
This commit is contained in:
bashermens
2026-01-30 21:49:37 +01:00
committed by GitHub
parent a92886032c
commit 13fff46fa0
233 changed files with 2460 additions and 2354 deletions

View File

@@ -31,7 +31,7 @@ bool InviteToGroupAction::Invite(Player* inviter, Player* player)
if (!group->isRaidGroup() && group->GetMembersCount() > 4)
{
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(inviter->GetGUID());
sPlayerbotWorldProcessor->QueueOperation(std::move(convertOp));
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
}
}
@@ -62,7 +62,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
if (player->GetGroup())
continue;
if (!sPlayerbotAIConfig->randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
if (!sPlayerbotAIConfig.randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
continue;
Group* group = bot->GetGroup();
@@ -88,7 +88,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
if (abs(int32(player->GetLevel() - bot->GetLevel())) > 2)
continue;
if (sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->sightDistance)
if (ServerFacade::instance().GetDistance2d(bot, player) > sPlayerbotAIConfig.sightDistance)
continue;
// When inviting the 5th member of the group convert to raid for future invites.
@@ -96,19 +96,19 @@ bool InviteNearbyToGroupAction::Execute(Event event)
bot->GetGroup()->GetMembersCount() > 3)
{
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(bot->GetGUID());
sPlayerbotWorldProcessor->QueueOperation(std::move(convertOp));
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
}
if (sPlayerbotAIConfig->inviteChat && sRandomPlayerbotMgr->IsRandomBot(bot))
if (sPlayerbotAIConfig.inviteChat && sRandomPlayerbotMgr.IsRandomBot(bot))
{
std::map<std::string, std::string> placeholders;
placeholders["%player"] = player->GetName();
if (group && group->isRaidGroup())
bot->Say(BOT_TEXT2("join_raid", placeholders),
bot->Say(PlayerbotTextMgr::instance().GetBotText("join_raid", placeholders),
(bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
else
bot->Say(BOT_TEXT2("join_group", placeholders),
bot->Say(PlayerbotTextMgr::instance().GetBotText("join_group", placeholders),
(bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
}
@@ -120,7 +120,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
bool InviteNearbyToGroupAction::isUseful()
{
if (!sPlayerbotAIConfig->randomBotGroupNearby)
if (!sPlayerbotAIConfig.randomBotGroupNearby)
return false;
if (bot->InBattleground())
@@ -186,7 +186,7 @@ bool InviteGuildToGroupAction::Execute(Event event)
if (player->isDND())
continue;
if (!sPlayerbotAIConfig->randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
if (!sPlayerbotAIConfig.randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
continue;
if (player->IsBeingTeleported())
@@ -221,7 +221,7 @@ bool InviteGuildToGroupAction::Execute(Event event)
player->GetLevel() + 5) // Do not invite members that too low level or risk dragging them to deadly places.
continue;
if (!playerAi && sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->sightDistance)
if (!playerAi && ServerFacade::instance().GetDistance2d(bot, player) > sPlayerbotAIConfig.sightDistance)
continue;
Group* group = bot->GetGroup();
@@ -230,11 +230,11 @@ bool InviteGuildToGroupAction::Execute(Event event)
bot->GetGroup()->GetMembersCount() > 3)
{
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(bot->GetGUID());
sPlayerbotWorldProcessor->QueueOperation(std::move(convertOp));
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
}
if (sPlayerbotAIConfig->inviteChat &&
(sRandomPlayerbotMgr->IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
if (sPlayerbotAIConfig.inviteChat &&
(sRandomPlayerbotMgr.IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
{
BroadcastHelper::BroadcastGuildGroupOrRaidInvite(botAI, bot, player, group);
}
@@ -373,7 +373,7 @@ bool LfgAction::Execute(Event event)
else
{
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(requester->GetGUID());
sPlayerbotWorldProcessor->QueueOperation(std::move(convertOp));
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
}
}