EQ2Emulator Rules System Information

This is a design and development forum for EQ2Emulator's extensive Rules System.

Moderator: Team Members

Post Reply
User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

EQ2Emulator Rules System Information

Post by John Adams » Sat Aug 18, 2012 6:06 pm

This is a simple list of the current rules defined in EQ2Emulator. As new rules are added, this list will be automatically updated. All rules should have a default value and description, so you can use this list as a true reference.

You can also get a current listing of rules from the 'ruleset_details` table in our database.

Link: EQ2Emulator Ruleset List


What is the Rules System?
You can read this post to find the general description and examples. Below is extensive technical detail.


How are Rule Sets used?
You can define multiple rule sets to be used individually, or on combinations of many, by setting up a `ruleset` table record. This table consists of 3 crucial values; ruleset_id, ruleset_name and ruleset_active.

"default_ruleset" comes with the EQ2Emulator DB and is a basic, default set of values out-of-the-box. If you wish to tweak those values, you can modify the existing ruleset_id 1, and not have to mess with adding any others.

However, if you want to preserve the default ruleset and create your own, it is simple. Just insert a new rulesets record:

Code: Select all

INSERT INTO `rulesets` (
  ruleset_id,
  ruleset_name,
  ruleset_active
) 
VALUES
  (2, "my_ruleset", 1) ;
Now that you have your own ruleset_id, simply copy the values from ruleset_id 1 to your own ID in the `ruleset_details` table:

Code: Select all

INSERT INTO `ruleset_details` (
  ruleset_id,
  rule_category,
  rule_type,
  rule_value,
  description
) 
SELECT 
  2,
  rule_category,
  rule_type,
  rule_value,
  description 
FROM
  `ruleset_details` 
WHERE ruleset_id = 1 ;
Note: The `ruleset_id` value to insert is your new ruleset_id you created in the `rulesets` table.

To tell your world to use the new Rule Set, update the `default_ruleset_id` in your `variables` table before booting your world:

Code: Select all

UPDATE `variables` SET variable_value = 2 WHERE variable_name = 'default_ruleset_id';
Doing this will tell your World to boot up using the new values you have set up in Rule Set #2.


What about Zone Rules?
Zone Rules are more precise, though rarely needed (at least not yet in our development). But for example, say you are okay with our default R_Zone::MaxPlayers = 100 rule, which is in Rule Set ID 1. But you have a custom zone that you want no more than 6 players to be able to zone into at one time. You would need to make a custom ruleset for that 1 zone -

Code: Select all

INSERT INTO `rulesets` (
  ruleset_id,
  ruleset_name,
  ruleset_active
) 
VALUES
  (3, "6PlayersMax", 1) ;
Here I have created a new ruleset called "6PlayersMax" (so I can use it on more than 1 zone if I wish, nice and generic). With my new ruleset_id, now I need to create just the rules I need for this special zone, and not a copy of the entire list! In this case, I simply want R_Zone::MaxPlayers in my ruleset_details table for ruleset_id 3 -

Code: Select all

INSERT INTO `ruleset_details` (
  ruleset_id,
  rule_category,
  rule_type,
  rule_value
) 
VALUES
  (3, 'R_Zone', 'MaxPlayers', 6) ;
I now have a new ruleset_details for a Zone of MaxPlayers = 6, ruleset_id = 3.

To tell my zone to start using this new ruleset, I set it's ruleset_id value in the `zones` table:

Code: Select all

UPDATE `zones` SET `ruleset_id`='3' WHERE `name`='MySmallZone'; 
That's it! Now boot your world and try zoning 7 players into MySmallZone and you should be denied access.


In my next post, I will go over the code details of how Rules are implemented and how to use them throughout the code for those interested in helping us add new or convert old values to rules.

Hope this was helpful!
John Adams
EQ2Emulator - Project Ghost
"Everything should work now, except the stuff that doesn't" ~Xinux

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests