mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-09 21:41:29 +00:00
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:
@@ -24,7 +24,7 @@ bool TalkToQuestGiverAction::ProcessQuest(Quest const* quest, Object* questGiver
|
||||
QuestStatus status = bot->GetQuestStatus(quest->GetQuestId());
|
||||
Player* master = GetMaster();
|
||||
|
||||
if (sPlayerbotAIConfig->syncQuestForPlayer && master)
|
||||
if (sPlayerbotAIConfig.syncQuestForPlayer && master)
|
||||
{
|
||||
PlayerbotAI* masterBotAI = GET_PLAYERBOT_AI(master);
|
||||
if (!masterBotAI || masterBotAI->IsRealPlayer())
|
||||
@@ -35,7 +35,7 @@ bool TalkToQuestGiverAction::ProcessQuest(Quest const* quest, Object* questGiver
|
||||
}
|
||||
}
|
||||
|
||||
if (sPlayerbotAIConfig->syncQuestWithPlayer)
|
||||
if (sPlayerbotAIConfig.syncQuestWithPlayer)
|
||||
{
|
||||
if (master && master->GetQuestStatus(quest->GetQuestId()) == QUEST_STATUS_COMPLETE &&
|
||||
(status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_FAILED))
|
||||
@@ -105,14 +105,14 @@ void TalkToQuestGiverAction::RewardNoItem(Quest const* quest, Object* questGiver
|
||||
|
||||
if (bot->CanRewardQuest(quest, false))
|
||||
{
|
||||
out << BOT_TEXT2("quest_status_completed", args);
|
||||
out << PlayerbotTextMgr::instance().GetBotText("quest_status_completed", args);
|
||||
BroadcastHelper::BroadcastQuestTurnedIn(botAI, bot, quest);
|
||||
|
||||
bot->RewardQuest(quest, 0, questGiver, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
out << BOT_TEXT2("quest_status_unable_to_complete", args);
|
||||
out << PlayerbotTextMgr::instance().GetBotText("quest_status_unable_to_complete", args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,13 +126,13 @@ void TalkToQuestGiverAction::RewardSingleItem(Quest const* quest, Object* questG
|
||||
|
||||
if (bot->CanRewardQuest(quest, index, false))
|
||||
{
|
||||
out << BOT_TEXT2("quest_status_complete_single_reward", args);
|
||||
out << PlayerbotTextMgr::instance().GetBotText("quest_status_complete_single_reward", args);
|
||||
BroadcastHelper::BroadcastQuestTurnedIn(botAI, bot, quest);
|
||||
bot->RewardQuest(quest, index, questGiver, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
out << BOT_TEXT2("quest_status_unable_to_complete", args);
|
||||
out << PlayerbotTextMgr::instance().GetBotText("quest_status_unable_to_complete", args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ void TalkToQuestGiverAction::RewardMultipleItem(Quest const* quest, Object* ques
|
||||
std::set<uint32> bestIds;
|
||||
|
||||
std::ostringstream outid;
|
||||
if (!botAI->IsAlt() || sPlayerbotAIConfig->autoPickReward == "yes")
|
||||
if (!botAI->IsAlt() || sPlayerbotAIConfig.autoPickReward == "yes")
|
||||
{
|
||||
bestIds = BestRewards(quest);
|
||||
if (!bestIds.empty())
|
||||
@@ -198,7 +198,7 @@ void TalkToQuestGiverAction::RewardMultipleItem(Quest const* quest, Object* ques
|
||||
AskToSelectReward(quest, out, true);
|
||||
}
|
||||
}
|
||||
else if (sPlayerbotAIConfig->autoPickReward == "no")
|
||||
else if (sPlayerbotAIConfig.autoPickReward == "no")
|
||||
{
|
||||
// Old functionality, list rewards.
|
||||
AskToSelectReward(quest, out, false);
|
||||
@@ -260,7 +260,7 @@ bool TurnInQueryQuestAction::Execute(Event event)
|
||||
QuestStatus status = bot->GetQuestStatus(quest->GetQuestId());
|
||||
Player* master = GetMaster();
|
||||
|
||||
if (sPlayerbotAIConfig->syncQuestForPlayer && master)
|
||||
if (sPlayerbotAIConfig.syncQuestForPlayer && master)
|
||||
{
|
||||
PlayerbotAI* masterBotAI = GET_PLAYERBOT_AI(master);
|
||||
if (!masterBotAI || masterBotAI->IsRealPlayer())
|
||||
@@ -271,7 +271,7 @@ bool TurnInQueryQuestAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
|
||||
if (sPlayerbotAIConfig->syncQuestWithPlayer)
|
||||
if (sPlayerbotAIConfig.syncQuestWithPlayer)
|
||||
{
|
||||
if (status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_FAILED)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user