access_levels.sql 3.4 KB

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