From dc9c6ac482b353fe9a4b1e1628f691c487a517fc Mon Sep 17 00:00:00 2001 From: mekolat Date: Tue, 12 Apr 2016 16:37:08 -0400 Subject: add default permissions --- GNUmakefile | 2 +- world/map/.gitignore | 1 - world/map/conf/.gitignore | 1 + world/map/conf/permissions.txt | 20 ++++++++++++++++ world/map/conf/permissions_local.txt.example | 10 ++++++++ world/map/conf/tmwa-map.conf | 2 ++ world/map/db/item_db_head.txt | 2 +- world/map/npc/007-2/witch.txt | 2 +- world/map/npc/017-9/npcs.txt | 10 ++++---- .../map/npc/commands/_atcommand_local.txt.example | 27 ---------------------- world/map/npc/commands/_import.txt | 1 - world/map/npc/commands/changesex.txt | 16 ++++++------- world/map/npc/commands/class.txt | 18 +++++++-------- world/map/npc/commands/debug.txt | 2 +- world/map/npc/commands/destroynpc.txt | 6 ++--- world/map/npc/commands/numa.txt | 12 +++++----- world/map/npc/commands/pullrabbit.txt | 2 +- world/map/npc/commands/zeny.txt | 6 ++--- 18 files changed, 70 insertions(+), 70 deletions(-) create mode 100644 world/map/conf/permissions.txt create mode 100644 world/map/conf/permissions_local.txt.example delete mode 100644 world/map/npc/commands/_atcommand_local.txt.example diff --git a/GNUmakefile b/GNUmakefile index 8f124784..edde25a3 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -10,7 +10,7 @@ maps: conf: login/conf/login_local.conf login/conf/ladmin_local.conf login/save/gm_account.txt login/save/account.txt \ world/conf/char_local.conf \ world/map/conf/map_local.conf world/map/conf/battle_local.conf world/map/conf/atcommand_local.conf world/map/db/const-debugflag.txt \ -world/map/npc/functions/motd.txt world/map/npc/commands/_atcommand_local.txt +world/map/npc/functions/motd.txt world/map/conf/permissions_local.txt format: find world/map/npc -type f -exec sed -ri \ diff --git a/world/map/.gitignore b/world/map/.gitignore index 07be4021..2c681650 100644 --- a/world/map/.gitignore +++ b/world/map/.gitignore @@ -5,4 +5,3 @@ /db/const-debugflag.txt /npc/functions/motd.txt -/npc/commands/_atcommand_local.txt diff --git a/world/map/conf/.gitignore b/world/map/conf/.gitignore index 2c43e911..a1c73f43 100644 --- a/world/map/conf/.gitignore +++ b/world/map/conf/.gitignore @@ -1 +1,2 @@ /*_local.conf +/*_local.txt diff --git a/world/map/conf/permissions.txt b/world/map/conf/permissions.txt new file mode 100644 index 00000000..7da7006c --- /dev/null +++ b/world/map/conf/permissions.txt @@ -0,0 +1,20 @@ +// command permissions below +CMD_ZENY 80 +CMD_CHARZENY 99 +CMD_DEBUG 80 +CMD_CHANGESEX 40 +CMD_CHARCHANGESEX 60 +CMD_CLASS 40 +CMD_CHARCLASS 50 +CMD_DESTROYNPC 99 + +// special permissions below +MAP_LOUNGE 20 // level to enter the GM Lounge & talk to Numa +EVT_KILLTHEGM 50 // this is both for the event and the magic gm top hat +DBG_HOLIDAY 40 // holiday debug (xmas, halloween, ...) +EVT_DEBUG 50 // event debug (open portals, disguise, ...) +DBG_SCHEDULED 40 // scheduled broadcasts (schedule broadcast, stop broadcast, trigger broadcast, ...) +DBG_MOTD 40 // motd debug (show/hide motd) + +// very specific debug menus +DBG_VALIA 40 // illia quest debug info diff --git a/world/map/conf/permissions_local.txt.example b/world/map/conf/permissions_local.txt.example new file mode 100644 index 00000000..422da753 --- /dev/null +++ b/world/map/conf/permissions_local.txt.example @@ -0,0 +1,10 @@ +// in this file you can overwrite anything from permissions.txt + + +// Template for test server: +//CMD_ZENY 0 +//CMD_DEBUG 0 +//CMD_CHANGESEX 0 +//CMD_CLASS 0 +//MAP_LOUNGE 0 +//DBG_VALIA 0 diff --git a/world/map/conf/tmwa-map.conf b/world/map/conf/tmwa-map.conf index fa28abe5..53926ffb 100644 --- a/world/map/conf/tmwa-map.conf +++ b/world/map/conf/tmwa-map.conf @@ -15,6 +15,8 @@ const_db: db/const-magic.txt const_db: db/const-quest.txt const_db: db/const-mapflags.txt const_db: db/const-debugflag.txt +const_db: conf/permissions.txt +const_db: conf/permissions_local.txt quest_db: db/quest-log.txt diff --git a/world/map/db/item_db_head.txt b/world/map/db/item_db_head.txt index 9faaf4c2..7ecec5b3 100644 --- a/world/map/db/item_db_head.txt +++ b/world/map/db/item_db_head.txt @@ -63,7 +63,7 @@ 885, GreenEggshellHat, 5, 7000, 5000, 15, 0, 9, 0, 3, 0, 2, 256, 0, 1, 0, {}, {} 886, OrangeEggshellHat, 5, 7000, 5000, 15, 0, 9, 0, 3, 0, 2, 256, 0, 1, 0, {}, {} 887, DarkEggshellHat, 5, 7000, 5000, 15, 0, 9, 0, 3, 0, 2, 256, 0, 1, 0, {}, {} -888, MagicGMTopHat, 5, 4200, 1900, 30, 0, 60, 0, 20, 0, 2, 256, 0, 0, 0, {}, {set @minLvl, get(.killthegm, "GM"); callfunc "RestrictedItem"; bonus bMaxHP, 31000; bonus bFlee, -200; bonus bHPrecovRate, -400; bonus bCriticalDef, 250; bonus bMdef, 89;} +888, MagicGMTopHat, 5, 4200, 1900, 30, 0, 60, 0, 20, 0, 2, 256, 0, 0, 0, {}, {set @minLvl, EVT_KILLTHEGM; callfunc "RestrictedItem"; bonus bMaxHP, 31000; bonus bFlee, -200; bonus bHPrecovRate, -400; bonus bCriticalDef, 250; bonus bMdef, 89;} 889, MurdererCrown, 5, 75000, 12000, 240, 0, 4, 0, 0, 0, 2, 256, 0, 0, 0, {}, {} 890, BeanieCopter, 5, 8000, 2000, 20, 0, 4, 0, 2, 0, 2, 256, 0, 0, 0, {}, {} 897, RedRoseHat, 5, 5000, 1000, 0, 0, 1, 0, 8, 0, 2, 256, 0, 0, 0, {}, {} diff --git a/world/map/npc/007-2/witch.txt b/world/map/npc/007-2/witch.txt index 3e80dccc..360f2885 100644 --- a/world/map/npc/007-2/witch.txt +++ b/world/map/npc/007-2/witch.txt @@ -23,7 +23,7 @@ set @illia_iced_water, 4; set $@illia_min_level, 90; - if ((GM >= get(.valia, "GM") || debug) && getequipid(equip_head) == 647) + if ((GM >= DBG_VALIA || debug) && getequipid(equip_head) == 647) goto L_DeveloperBoard; if (BaseLevel < $@illia_min_level) goto L_Unexperienced; diff --git a/world/map/npc/017-9/npcs.txt b/world/map/npc/017-9/npcs.txt index 188ef2e0..2db61d1f 100644 --- a/world/map/npc/017-9/npcs.txt +++ b/world/map/npc/017-9/npcs.txt @@ -1,6 +1,6 @@ 009-1,42,43,0|script|#SecretDoor|32767,0,0 { - if (GM < get(.lounge, "GM") && GM < G_SYSOP && !debug) end; + if (GM < MAP_LOUNGE && GM < G_SYSOP && !debug) end; gmlog "@warp 017-9"; warp "017-9", 27, 23; end; @@ -8,7 +8,7 @@ 020-1,60,76,0|script|#SecretDoor2|32767,0,0 { - if (GM < get(.lounge, "GM") && GM < G_SYSOP && !debug) end; + if (GM < MAP_LOUNGE && GM < G_SYSOP && !debug) end; gmlog "@warp 017-9"; warp "017-9", 29, 21; end; @@ -16,7 +16,7 @@ 001-1,54,118,0|script|#SecretDoor3|32767,0,0 { - if (GM < get(.lounge, "GM") && GM < G_SYSOP && !debug) end; + if (GM < MAP_LOUNGE && GM < G_SYSOP && !debug) end; gmlog "@warp 017-9"; warp "017-9", 21, 21; end; @@ -24,7 +24,7 @@ 027-2,118,111,0|script|#SecretDoor4|32767,0,0 { - if (GM < get(.lounge, "GM") && GM < G_SYSOP && !debug) end; + if (GM < MAP_LOUNGE && GM < G_SYSOP && !debug) end; gmlog "@warp 017-9"; warp "017-9", 31, 21; end; @@ -32,7 +32,7 @@ 029-1,34,96,0|script|#SecretDoor5|32767,0,0 { - if (GM < get(.lounge, "GM") && GM < G_SYSOP && !debug) end; + if (GM < MAP_LOUNGE && GM < G_SYSOP && !debug) end; gmlog "@warp 017-9"; warp "017-9", 23, 21; end; diff --git a/world/map/npc/commands/_atcommand_local.txt.example b/world/map/npc/commands/_atcommand_local.txt.example deleted file mode 100644 index ec1fae51..00000000 --- a/world/map/npc/commands/_atcommand_local.txt.example +++ /dev/null @@ -1,27 +0,0 @@ --|script|GM|32767 -{ - end; - -OnInit: - // command permissions here - set .zeny, G_ADMIN; - set .charzeny, G_SYSOP; - set .debug, G_ADMIN; - set .changesex, G_DEV; - set .charchangesex, G_GM; - set .class, G_DEV; - set .charclass, G_EVENT; - - // special permissions below - set .lounge, G_TESTER; // level to enter the GM Lounge & talk to Numa - set .killthegm, G_EVENT; // this is both for the event and the magic gm top hat - set .holiday, G_DEV; // holiday debug (xmas, halloween, ...) - set .event, G_EVENT; // event debug (open portals, disguise, ...) - set .scheduled, G_DEV; // scheduled broadcasts (schedule broadcast, stop broadcast, trigger broadcast, ...) - set .motd, G_DEV; // motd debug (show/hide motd) - - // very specific debug menus - set .valia, G_DEV; // illia quest debug info - - end; -} diff --git a/world/map/npc/commands/_import.txt b/world/map/npc/commands/_import.txt index d123d405..81994b80 100644 --- a/world/map/npc/commands/_import.txt +++ b/world/map/npc/commands/_import.txt @@ -1,5 +1,4 @@ npc: npc/commands/_procedures.txt -npc: npc/commands/_atcommand_local.txt npc: npc/commands/zeny.txt npc: npc/commands/marry.txt npc: npc/commands/debug.txt diff --git a/world/map/npc/commands/changesex.txt b/world/map/npc/commands/changesex.txt index ba08783d..fca27645 100644 --- a/world/map/npc/commands/changesex.txt +++ b/world/map/npc/commands/changesex.txt @@ -2,29 +2,27 @@ { callfunc "argv_splitter"; set .@n$, if_then_else(@argv$[1] != "", "char", "") + "changesex"; - if (GM < get(.changesex, "GM") && GM < G_SYSOP) goto L_GM; // check if you can use it on self + if (GM < CMD_CHANGESEX && GM < G_SYSOP) goto L_GM; // check if you can use it on self set .@target_id, BL_ID; if (@argv$[1] != "") set .@target_id, getcharid(3, @argv$[1]); if (@argv$[1] != "" && !(isloggedin(.@target_id))) goto L_Failed; // do NOT fallback to self - if (@argv$[1] != "" && GM < get(.charchangesex, "GM") && GM < G_SYSOP) goto L_GM; // when target is not self, use charchangesex permission + if (@argv$[1] != "" && GM < CMD_CHARCHANGESEX && GM < G_SYSOP) goto L_GM; // when target is not self, use charchangesex permission + set .@s, 3; // default to non-binary if (@argv$[0] == "M" || @argv$[0] == "m") set .@s, 1; if (@argv$[0] == "F" || @argv$[0] == "f") set .@s, 0; set Sex, .@s, .@target_id; - goto L_Success; + gmlog "@"+.@n$+" " + @args$; + message strcharinfo(0), .@n$+" : The operation succeeded."; + end; L_Failed: // XXX: should we allow GMs to change sex of users that are not logged in? message strcharinfo(0), .@n$+" : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?"; end; -L_Success: - gmlog "@"+.@n$+" " + @args$; - message strcharinfo(0), .@n$+" : The operation succeeded."; - end; - L_GM: - message strcharinfo(0), .@n$+" : GM command is level "+ get(if_then_else(@argv$[1] != "", .charchangesex, .changesex), "GM") +", but you are level " + GM; + message strcharinfo(0), .@n$+" : GM command is level "+ if_then_else(@argv$[1] != "", CMD_CHARCHANGESEX, CMD_CHANGESEX) +", but you are level " + GM; end; OnInit: diff --git a/world/map/npc/commands/class.txt b/world/map/npc/commands/class.txt index f9275591..9143e08a 100644 --- a/world/map/npc/commands/class.txt +++ b/world/map/npc/commands/class.txt @@ -2,28 +2,26 @@ { callfunc "argv_splitter"; set .@n$, if_then_else(@argv$[1] != "", "char", "") + "class"; - if (GM < get(.class, "GM") && GM < G_SYSOP) goto L_GM; // check if you can use it on self + if (GM < CMD_CLASS && GM < G_SYSOP) goto L_GM; // check if you can use it on self set .@target_id, BL_ID; if (@argv$[1] != "") set .@target_id, getcharid(3, @argv$[1]); if (@argv$[1] != "" && !(isloggedin(.@target_id))) goto L_Failed; // do NOT fallback to self - if (@argv$[1] != "" && GM < get(.charclass, "GM") && GM < G_SYSOP) goto L_GM; // when target is not self, use charclass permission + if (@argv$[1] != "" && GM < CMD_CHARCLASS && GM < G_SYSOP) goto L_GM; // when target is not self, use charclass permission + set .@c, 1; // default to human - if (@argv[0] >= 0 || @argv[0] <= 32767) set .@c, @argv[0]; + if (@argv[0] >= 1 || @argv[0] <= 32767) set .@c, @argv[0]; set Class, .@c, .@target_id; - goto L_Success; + gmlog "@"+.@n$+" " + @args$; + message strcharinfo(0), .@n$+" : The operation succeeded."; + end; L_Failed: // XXX: should we allow GMs to change class of users that are not logged in? message strcharinfo(0), .@n$+" : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?"; end; -L_Success: - gmlog "@"+.@n$+" " + @args$; - message strcharinfo(0), .@n$+" : The operation succeeded."; - end; - L_GM: - message strcharinfo(0), .@n$+" : GM command is level "+ get(if_then_else(@argv$[1] != "", .charclass, .class), "GM") +", but you are level " + GM; + message strcharinfo(0), .@n$+" : GM command is level "+ if_then_else(@argv$[1] != "", CMD_CHARCLASS, CMD_CLASS) +", but you are level " + GM; end; OnInit: diff --git a/world/map/npc/commands/debug.txt b/world/map/npc/commands/debug.txt index 7b653b26..19ac4114 100644 --- a/world/map/npc/commands/debug.txt +++ b/world/map/npc/commands/debug.txt @@ -924,7 +924,7 @@ L_Close: -|script|Debug Spell|32767 { - if(!debug && getgmlevel() < get(.debug, "GM")) end; + if(!debug && getgmlevel() < CMD_DEBUG) end; callfunc "Debug"; end; OnDeprecated: diff --git a/world/map/npc/commands/destroynpc.txt b/world/map/npc/commands/destroynpc.txt index fcda52ef..1ebede9e 100644 --- a/world/map/npc/commands/destroynpc.txt +++ b/world/map/npc/commands/destroynpc.txt @@ -1,7 +1,7 @@ -|script|@destroynpc|32767 { callfunc "argv_splitter"; - if (GM < get(.destroynpc, "GM") && GM < G_SYSOP) + if (GM < CMD_DESTROYNPC && GM < G_SYSOP) goto L_GM; set .@id, getnpcid(@argv$[0]); @@ -13,7 +13,7 @@ gmlog "@destroynpc " + @args$; message strcharinfo(0), "destroynpc : The operation succeeded."; debugmes "!!! => npc destroyed: `"+@argv$[0]+"` ("+.@id+")"; - if (1==1) destroy .@id; // FIXME: allow destroy to work as a non-terminator when arg0 is given + if (1==1) destroy .@id; // FIXME: allow destroy to work as a non-terminator when arg0 is given (TMWA) end; L_Confirm: @@ -26,7 +26,7 @@ L_Failed: end; L_GM: - message strcharinfo(0), "destroynpc : GM command is level "+ get(destroynpc, "GM") +", but you are level " + GM; + message strcharinfo(0), "destroynpc : GM command is level "+ CMD_DESTROYNPC +", but you are level " + GM; end; OnInit: diff --git a/world/map/npc/commands/numa.txt b/world/map/npc/commands/numa.txt index 4184743b..e8e8cabd 100644 --- a/world/map/npc/commands/numa.txt +++ b/world/map/npc/commands/numa.txt @@ -3,14 +3,14 @@ -|script|SuperDebug|32767 { - if (GM < get(.lounge, "GM") && GM < G_SYSOP && !debug) goto L_GM2; // make sure you can enter the gm lounge + if (GM < MAP_LOUNGE && GM < G_SYSOP && !debug) goto L_GM2; // make sure you can enter the gm lounge if (target(BL_ID,getnpcid("Numa"),1)) goto L_Main; npcaction 6, 12; title "Numa"; goto L_Main; L_GM2: - message strcharinfo(0), "numa : GM command is level "+ get(.lounge, "GM") +", but you are level " + GM; + message strcharinfo(0), "numa : GM command is level "+ MAP_LOUNGE +", but you are level " + GM; end; L_Main: @@ -36,7 +36,7 @@ L_WhoAmI: goto L_Main; L_Holiday: - if (GM < get(.holiday, "GM") && GM < G_SYSOP) goto L_GM; + if (GM < DBG_HOLIDAY && GM < G_SYSOP) goto L_GM; mes "What holiday do you want to debug?"; next; menu @@ -60,18 +60,18 @@ L_EasterDebug: goto L_Close; L_Event: - if (GM < get(.event, "GM") && GM < G_EVENT) goto L_GM; + if (GM < EVT_DEBUG && GM < G_EVENT) goto L_GM; gmlog strcharinfo(0) + " accessed the GM event debug."; callfunc "GmDebug"; goto L_Close; L_StoneBoard: - if (GM < get(.scheduled, "GM") && GM < G_SYSOP) goto L_GM; + if (GM < DBG_SCHEDULED && GM < G_SYSOP) goto L_GM; callfunc "SBConfig"; goto L_Close; L_MOTD: - if (GM < get(.motd, "GM") && GM < G_SYSOP) goto L_GM; + if (GM < DBG_MOTD && GM < G_SYSOP) goto L_GM; callfunc "MOTDConfig"; goto L_Close; diff --git a/world/map/npc/commands/pullrabbit.txt b/world/map/npc/commands/pullrabbit.txt index 3994b795..022f3753 100644 --- a/world/map/npc/commands/pullrabbit.txt +++ b/world/map/npc/commands/pullrabbit.txt @@ -1,6 +1,6 @@ -|script|@pullrabbit|32767 { - if (GM < get(.killthegm, "GM") && GM < G_SYSOP) end; + if (GM < EVT_KILLTHEGM && GM < G_SYSOP) end; if (getequipid(equip_head) != 888) end; getinventorylist; if ((checkweight("MurdererCrown", 1) == 0) || (@inventorylist_count == 100)) diff --git a/world/map/npc/commands/zeny.txt b/world/map/npc/commands/zeny.txt index 94c02c4b..513330b5 100644 --- a/world/map/npc/commands/zeny.txt +++ b/world/map/npc/commands/zeny.txt @@ -2,11 +2,11 @@ { callfunc "argv_splitter"; set .@n$, if_then_else(@argv$[1] != "", "char", "") + "zeny"; - if (GM < get(.zeny, "GM") && GM < G_SYSOP) goto L_GM; // check if you can use it on self + if (GM < CMD_ZENY && GM < G_SYSOP) goto L_GM; // check if you can use it on self set .@target_id, BL_ID; if (@argv$[1] != "") set .@target_id, getcharid(3, @argv$[1]); if (@argv$[1] != "" && !(isloggedin(.@target_id))) goto L_Failed; // do NOT fallback to self - if (@argv$[1] != "" && GM < get(.charzeny, "GM") && GM < G_SYSOP) goto L_GM; // when target is not self, use charzeny permission + if (@argv$[1] != "" && GM < CMD_CHARZENY && GM < G_SYSOP) goto L_GM; // when target is not self, use charzeny permission if (@argv$[0] == "--") goto L_Remove; if (@argv$[0] == "---") goto L_RemoveAll; if (@argv$[0] == "++") goto L_Max; @@ -67,7 +67,7 @@ L_Success: end; L_GM: - message strcharinfo(0), .@n$+" : GM command is level "+ get(if_then_else(@argv$[1] != "", .charzeny, .zeny), "GM") +", but you are level " + GM; + message strcharinfo(0), .@n$+" : GM command is level "+ if_then_else(@argv$[1] != "", CMD_CHARZENY, CMD_ZENY) +", but you are level " + GM; end; OnInit: -- cgit v1.2.3-60-g2f50