access_levels.sql 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. -- How to configure the SQL based access level system :
  2. -- There are two tables.
  3. -- First one is named acess_levels and it's meant to define the different possible
  4. -- groups a GM can belong to.
  5. -- You can see in this table six predefined GM groups. Each group has a different
  6. -- accessLevel, and GM's access_level in the characters table should match with
  7. -- one of these. You could define as many groups as needed and give them whatever
  8. -- number you wanted to, from 1 to 255. Nevertheless please note the fact that
  9. -- there is one group that will be reserved for allmighty administrators, and this
  10. -- group is bound to the following rules:
  11. -- * There's no need/way to restrict the commands this group is able to run, its
  12. -- members will be able to perform ANY admin_command.
  13. -- * One number must be reserved for this group, and by default it is set to 127.
  14. -- * In order to change this default group number or its name/title colors,
  15. -- you should look at the Character.properties configuration file and
  16. -- change the value of MasterAccessLevel, MasterNameColor and MasterTitleColor
  17. -- respectively.
  18. -- * You should better not use this group as a part of any childs hierarchy.
  19. -- In our predefined set of examples, access_level=1 is for the highest admin,
  20. -- and access_level=3 is for Event GMs.
  21. -- The rest of the access_levels table columns are expected to be self explanatory.
  22. -- And there is a second table named admin_command_access_rights and in this table
  23. -- administrators should add every command they wanted GMs to use.
  24. -- We left just one query here to show how commands should be added to the table:
  25. -- INSERT IGNORE INTO `admin_command_access_rights` VALUES ('admin_admin','6');
  26. -- If an administrator wanted to grant his GMs from group 4 the usage of the //para
  27. -- command, he should just copy our example and replace values like this:
  28. -- INSERT IGNORE INTO `admin_command_access_rights` VALUES ('admin_para','4');
  29. -- So on, for each command there should be a record in this table. And it would be
  30. -- advisable to use one query per command to avoid messups ;)
  31. CREATE TABLE IF NOT EXISTS `access_levels` (
  32. `accessLevel` MEDIUMINT(9) NOT NULL,
  33. `name` VARCHAR(255) NOT NULL DEFAULT '',
  34. `nameColor` CHAR(6) NOT NULL DEFAULT 'FFFFFF',
  35. `titleColor` CHAR(6) NOT NULL DEFAULT 'FFFFFF',
  36. `childAccess` VARCHAR(255) NOT NULL DEFAULT '',
  37. `isGm` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
  38. `allowPeaceAttack` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
  39. `allowFixedRes` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
  40. `allowTransaction` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
  41. `allowAltg` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
  42. `giveDamage` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
  43. `takeAggro` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
  44. `gainExp` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
  45. PRIMARY KEY (`accessLevel`)
  46. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  47. INSERT IGNORE INTO `access_levels` VALUES
  48. (1,'Admin','0FF000','0FF000','2;3;4;5;6;7',1,1,1,1,1,1,1,1),
  49. (2,'Head GM','0C0000','0C0000','5;6;7',0,0,1,1,1,1,1,1),
  50. (3,'Event GM','00C000','00C000','5;6;7',0,0,1,0,1,0,0,0),
  51. (4,'Support GM','000C00','000C00','5;6;7',0,0,1,0,1,0,0,0),
  52. (5,'General GM','0000C0','0000C0','6;7',0,0,1,0,1,0,0,0),
  53. (6,'Test GM','FFFFFF','FFFFFF','','0',0,1,0,1,0,0,0),
  54. (7,'Chat Moderator','-1','-1','','0',0,0,1,0,1,1,1);