mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-27 05:45:55 +00:00
# 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>
55 lines
1.9 KiB
C++
55 lines
1.9 KiB
C++
/*
|
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
|
*/
|
|
|
|
#include "Log.h"
|
|
#include "Timer.h"
|
|
#include "DatabaseEnv.h"
|
|
#include "Field.h"
|
|
#include "World.h"
|
|
// Required import due to poor implementation by AC
|
|
#include "QueryResult.h"
|
|
|
|
#include "PlayerbotDungeonRepository.h"
|
|
|
|
std::vector<DungeonSuggestion> const PlayerbotDungeonRepository::GetDungeonSuggestions()
|
|
{
|
|
return m_dungeonSuggestions;
|
|
}
|
|
|
|
void PlayerbotDungeonRepository::LoadDungeonSuggestions()
|
|
{
|
|
LOG_INFO("server.loading", "Loading playerbots dungeon suggestions...");
|
|
uint32 oldMSTime = getMSTime();
|
|
|
|
uint32 count = 0;
|
|
auto statement = PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_DUNGEON_SUGGESTION);
|
|
uint8 const expansion = sWorld->getIntConfig(CONFIG_EXPANSION);
|
|
statement->SetData(0, expansion);
|
|
|
|
PreparedQueryResult result = PlayerbotsDatabase.Query(statement);
|
|
if (result)
|
|
{
|
|
do
|
|
{
|
|
Field* fields = result->Fetch();
|
|
std::string const name = fields[0].Get<std::string>();
|
|
uint8 const difficulty = fields[1].Get<uint8>();
|
|
uint8 const min_level = fields[2].Get<uint8>();
|
|
uint8 const max_level = fields[3].Get<uint8>();
|
|
std::string const abbrevation = fields[4].Get<std::string>();
|
|
std::string const strategy = fields[5].Get<std::string>();
|
|
|
|
DungeonSuggestion const row = {
|
|
name, static_cast<Difficulty>(difficulty), min_level, max_level, abbrevation, strategy};
|
|
|
|
m_dungeonSuggestions.push_back(row);
|
|
++count;
|
|
} while (result->NextRow());
|
|
}
|
|
|
|
LOG_INFO("server.loading", "{} playerbots dungeon suggestions loaded in {} ms", count,
|
|
GetMSTimeDiffToNow(oldMSTime));
|
|
}
|