Updated the rule system to automatically add new rules and remove orphaned entries from the rule values tables

This commit is contained in:
Uleat
2019-09-03 04:04:05 -04:00
parent a534ab83ec
commit f9536f9621
8 changed files with 1064 additions and 709 deletions
+15 -5
View File
@@ -332,16 +332,28 @@ int main(int argc, char** argv) {
Log(Logs::General, Logs::World_Server, "Error: Could not load skill cap data. But ignoring");
Log(Logs::General, Logs::World_Server, "Loading guilds..");
guild_mgr.LoadGuilds();
//rules:
{
if (!RuleManager::Instance()->UpdateInjectedRules(&database, "default")) {
Log(Logs::General, Logs::World_Server, "Failed to process 'Injected Rules' for ruleset 'default' update operation.");
}
if (!RuleManager::Instance()->UpdateOrphanedRules(&database)) {
Log(Logs::General, Logs::World_Server, "Failed to process 'Orphaned Rules' update operation.");
}
std::string tmp;
if (database.GetVariable("RuleSet", tmp)) {
Log(Logs::General, Logs::World_Server, "Loading rule set '%s'", tmp.c_str());
if (!RuleManager::Instance()->LoadRules(&database, tmp.c_str(), false)) {
Log(Logs::General, Logs::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp.c_str());
}
}
else {
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) {
Log(Logs::General, Logs::World_Server, "No rule set configured, using default rules");
}
@@ -349,18 +361,16 @@ int main(int argc, char** argv) {
Log(Logs::General, Logs::World_Server, "Loaded default rule set 'default'", tmp.c_str());
}
}
EQEmu::InitializeDynamicLookups();
Log(Logs::General, Logs::World_Server, "Initialized dynamic dictionary entries");
}
EQEmu::InitializeDynamicLookups();
Log(Logs::General, Logs::World_Server, "Initialized dynamic dictionary entries");
if (RuleB(World, ClearTempMerchantlist)) {
Log(Logs::General, Logs::World_Server, "Clearing temporary merchant lists..");
database.ClearMerchantTemp();
}
RuleManager::Instance()->SaveRules(&database);
Log(Logs::General, Logs::World_Server, "Loading EQ time of day..");
TimeOfDay_Struct eqTime;
time_t realtime;