mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-01 04:31:29 +00:00
Dependency inject into world content service
This commit is contained in:
parent
ffd76f3362
commit
9c450ac95b
@ -10,12 +10,6 @@
|
||||
#include "../repositories/rule_values_repository.h"
|
||||
#include "../zone_store.h"
|
||||
|
||||
|
||||
WorldContentService::WorldContentService()
|
||||
{
|
||||
SetCurrentExpansion(Expansion::EXPANSION_ALL);
|
||||
}
|
||||
|
||||
int WorldContentService::GetCurrentExpansion() const
|
||||
{
|
||||
return current_expansion;
|
||||
@ -362,7 +356,6 @@ void WorldContentService::LoadTargetedRulesets(Database* db)
|
||||
constexpr int8 EXPANSION_ZERO_VALUE = -2;
|
||||
|
||||
auto rules = RuleValuesRepository::GetWhere(*db, "TRUE ORDER BY ruleset_id, rule_name");
|
||||
auto inst = RuleManager::Instance();
|
||||
auto sets = RuleSetsRepository::GetWhere(*db, "TRUE ORDER BY ruleset_id");
|
||||
for (auto& e : sets) {
|
||||
bool has_filters =
|
||||
@ -402,7 +395,7 @@ void WorldContentService::LoadTargetedRulesets(Database* db)
|
||||
continue;
|
||||
}
|
||||
|
||||
inst->SetRule(r.rule_name, r.rule_value);
|
||||
m_rule_manager->SetRule(r.rule_name, r.rule_value);
|
||||
|
||||
LogInfo(
|
||||
"Loading targeted rule from ruleset [{}] ruleset_name [{}] rule_name [{}] rule_value [{}]",
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../rulesys.h"
|
||||
#include "../repositories/content_flags_repository.h"
|
||||
#include "../repositories/zone_repository.h"
|
||||
#include "../repositories/instance_list_repository.h"
|
||||
@ -88,7 +89,18 @@ namespace Expansion {
|
||||
class WorldContentService {
|
||||
public:
|
||||
|
||||
WorldContentService();
|
||||
// Constructor can initialize from singleton
|
||||
WorldContentService()
|
||||
: m_rule_manager(RuleManager::Instance())
|
||||
{
|
||||
SetCurrentExpansion(Expansion::EXPANSION_ALL);
|
||||
}
|
||||
|
||||
static WorldContentService* Instance()
|
||||
{
|
||||
static WorldContentService instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
std::string GetCurrentExpansionName();
|
||||
int GetCurrentExpansion() const;
|
||||
@ -181,12 +193,6 @@ public:
|
||||
FindZoneResult FindZone(uint32 zone_id, uint32 instance_id);
|
||||
bool IsInPublicStaticInstance(uint32 instance_id);
|
||||
|
||||
static WorldContentService* Instance()
|
||||
{
|
||||
static WorldContentService instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
// targeted rulesets
|
||||
void LoadTargetedRulesets(Database* db);
|
||||
inline void SetZoneId(int zone_id) { m_zone_id = zone_id; }
|
||||
@ -199,6 +205,7 @@ private:
|
||||
// reference to database
|
||||
Database *m_database;
|
||||
Database *m_content_database;
|
||||
RuleManager* m_rule_manager;
|
||||
|
||||
int m_zone_id = 0;
|
||||
int m_instance_version = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user