EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Linux Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=588)
-   -   zone ruleset loading question (https://www.eqemulator.org/forums/showthread.php?t=31883)

amraist 08-18-2010 10:33 PM

zone ruleset loading question
 
have a question regarding how the following block of code from zone.cpp is supposed to work. I'm trying to use a custom ruleset. According to the logs it initially loads the custom ruleset, but after the zone config, it loads the default config. I believe it is because of this block of code. My question is, am I missing something that I should be doing to use a custom ruleset or is this code not working as intended?

Code:

        //load the zone config file.
        if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name...
                LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults

        if(rules->GetActiveRulesetID() != default_ruleset)
        {
                string r_name = rules->GetRulesetName(&database, default_ruleset);
                if(r_name.size() > 0)
                {
                        rules->LoadRules(&database, r_name.c_str());
                }
        }


trevius 08-19-2010 08:30 AM

According to what KLS said, it will either load the zone custom ruleset or the default, but it doesn't load zone and then default. I would love to get it set to load any custom rules set for particular zones and then load the rest of the default rules after that, but that isn't how it works yet.

So basically, if you want a custom ruleset for a zone, you will want to copy all of your default rules and set them to another ruleset and then customize any ones from there. Any rules not in your custom ruleset currently will default to what the source has set for them.

amraist 08-19-2010 10:36 AM

Quote:

it will either load the zone custom ruleset or the default,
I'm only trying to load a custom ruleset, but whenever I zone into the zone, the default ruleset is loaded. When I look at the zone.cpp code block, I see that it will do exactly that, if I have have a custom ruleset specified.
Code:

if(rules->GetActiveRulesetID() != default_ruleset)
This if block executes, because my custom ruleset id is 2(and the default is apparently 1). And inside the if block, it just loads the default, and I'm not sure why, unless it is only supposed to execute when 'LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)' returns an error, like so:
Code:

//load the zone config file.
        if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) { // try loading the zone name...
                LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults

              if(rules->GetActiveRulesetID() != default_ruleset)
              {
                      string r_name = rules->GetRulesetName(&database, default_ruleset);
                      if(r_name.size() > 0)
                      {
                                rules->LoadRules(&database, r_name.c_str());
                      }
                }
      }

To see illustrate this behavior I added a line in GetRuleSetID in common/rulesys.cpp (@line ~353) as follows:
Code:

if (db->RunQuery(query, MakeAnyLenString(&query,
                "SELECT ruleset_id"
                " FROM rule_sets"
                " WHERE name='%s'", rst), errbuf, &result))
        {
                if((row = mysql_fetch_row(result))) {
                        res = atoi(row[0]);
                        LogFile->write(EQEMuLog::Error, "Fred: %s: %s",query,row[0]);
                }
                mysql_free_result(result);
        } else {

Which leads to zone output as below. You can see where it tells me it's loading my custom ruleset, then below that it 'quietly' loads the default.
Code:

[Debug] [ZONE__INIT] Loading rule set 'FreEQEMU'
[Error] Starting Log: logs/eqemu_error_zone.log
[Error] Fred: SELECT ruleset_id FROM rule_sets WHERE name='FreEQEMU': 2
[Debug] [ZONE__INIT] Loading Tasks
[Debug] [ZONE__INIT] Loading embedded perl XS
[Debug] [ZONE__INIT] Loading quests
[Quest] Starting Log: logs/eqemu_quest_zone.log
[Quest] Tying perl output to eqemu logs
[Quest] Creating EQEmuIO=HASH(0xc507c8)
[Quest] Creating EQEmuIO=HASH(0xc50c28)
[Quest] Loading perlemb plugins.
[Quest] Loading perl commands...
[Status] Booting povalor (208:0)
[Debug] [COMMON__THREADS] Starting TCPConnectionLoop with thread ID 27303552
[Debug] Graveyard ID is 5.
[Debug] Loaded a graveyard for zone povalor: graveyard zoneid is 208 x is 207.399994 y is -1615.099976 z is 77.900002 heading is 0.000000.
[Debug] The next weather check for zone: povalor will be in 14368 seconds.
[Status] Loading spawn conditions...
[Status] Loading static zone points...
[Status] Loading spawn groups...
[Status] Loading spawn2 points...
[Status] Loading player corpses...
[Status] Loading traps...
[Status] Loading adventure flavor text...
[Status] Loading ground spawns...
[Status] Loading Ground Spawns from DB...
[Status] Loading World Objects from DB...
[Status] Loading Objects from DB...
[Status] Loading doors for povalor ...
[Status] Loading Doors from database...
[Status] Loading Blocked Spells from database...
[Status] Loading AA information...
[Status] Loading AA Effects...
[Status] Loaded 284 AA Effects.
[Status] Loading Merchant Lists...
[Status] Loading Temporary Merchant Lists...
[Status] Successfully loaded Zone Config.
[Error] Fred: SELECT ruleset_id FROM rule_sets WHERE name='default': 1
[Status] Loading timezone data...



All times are GMT -4. The time now is 11:27 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.