mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-19 01:54:35 +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:
@@ -182,7 +182,7 @@ bool QuestAction::ProcessQuests(WorldObject* questGiver)
|
||||
{
|
||||
ObjectGuid guid = questGiver->GetGUID();
|
||||
|
||||
if (bot->GetDistance(questGiver) > INTERACTION_DISTANCE && !sPlayerbotAIConfig->syncQuestWithPlayer)
|
||||
if (bot->GetDistance(questGiver) > INTERACTION_DISTANCE && !sPlayerbotAIConfig.syncQuestWithPlayer)
|
||||
{
|
||||
//if (botAI->HasStrategy("debug", BotState::BOT_STATE_COMBAT) || botAI->HasStrategy("debug", BotState::BOT_STATE_NON_COMBAT))
|
||||
|
||||
@@ -190,7 +190,7 @@ bool QuestAction::ProcessQuests(WorldObject* questGiver)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bot->HasInArc(CAST_ANGLE_IN_FRONT, questGiver, sPlayerbotAIConfig->sightDistance))
|
||||
if (!bot->HasInArc(CAST_ANGLE_IN_FRONT, questGiver, sPlayerbotAIConfig.sightDistance))
|
||||
bot->SetFacingToObject(questGiver);
|
||||
|
||||
bot->SetTarget(guid);
|
||||
@@ -238,7 +238,7 @@ bool QuestAction::AcceptQuest(Quest const* quest, ObjectGuid questGiver)
|
||||
p.rpos(0);
|
||||
bot->GetSession()->HandleQuestgiverAcceptQuestOpcode(p);
|
||||
|
||||
if (bot->GetQuestStatus(questId) == QUEST_STATUS_NONE && sPlayerbotAIConfig->syncQuestWithPlayer)
|
||||
if (bot->GetQuestStatus(questId) == QUEST_STATUS_NONE && sPlayerbotAIConfig.syncQuestWithPlayer)
|
||||
{
|
||||
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*bot, questGiver,
|
||||
TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
|
||||
@@ -366,7 +366,7 @@ bool QuestUpdateAddItemAction::Execute(Event event)
|
||||
placeholders["%quest_obj_required"] = std::to_string(requiredItemsCount);
|
||||
if (botAI->HasStrategy("debug quest", BotState::BOT_STATE_COMBAT) || botAI->HasStrategy("debug quest", BotState::BOT_STATE_NON_COMBAT))
|
||||
{
|
||||
const auto text = BOT_TEXT2("%quest_link - %item_link %quest_obj_available/%quest_obj_required", placeholders);
|
||||
const auto text = PlayerbotTextMgr::instance().GetBotText("%quest_link - %item_link %quest_obj_available/%quest_obj_required", placeholders);
|
||||
botAI->Say(text);
|
||||
LOG_INFO("playerbots", "{} => {}", bot->GetName(), text);
|
||||
}
|
||||
@@ -454,7 +454,7 @@ bool QuestUpdateFailedTimerAction::Execute(Event event)
|
||||
{
|
||||
std::map<std::string, std::string> placeholders;
|
||||
placeholders["%quest_link"] = botAI->GetChatHelper()->FormatQuest(qInfo);
|
||||
botAI->TellMaster(BOT_TEXT2("Failed timer for %quest_link, abandoning", placeholders));
|
||||
botAI->TellMaster(PlayerbotTextMgr::instance().GetBotText("Failed timer for %quest_link, abandoning", placeholders));
|
||||
BroadcastHelper::BroadcastQuestUpdateFailedTimer(botAI, bot, qInfo);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user