From a9f6793ab05f3f8490de3dfa7f97f91f11915bc7 Mon Sep 17 00:00:00 2001 From: gumi Date: Mon, 1 May 2017 11:36:01 -0400 Subject: remove usage of getgroupid --- npc/001-2-36/training_room_npc.txt | 4 ++-- npc/commands/debug-look.txt | 2 +- npc/commands/debug-preset.txt | 2 +- npc/commands/debug-quest.txt | 2 +- npc/commands/debug-skill.txt | 2 +- npc/commands/debug.txt | 2 +- npc/commands/rate-management.txt | 2 +- npc/commands/super-menu.txt | 9 +++------ npc/functions/permissions.txt | 30 ++++++++++++++++++++++++++++++ npc/functions/quest-debug/functions.txt | 4 ++-- npc/scripts.conf | 1 + 11 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 npc/functions/permissions.txt diff --git a/npc/001-2-36/training_room_npc.txt b/npc/001-2-36/training_room_npc.txt index ce56651c..d7f9e443 100644 --- a/npc/001-2-36/training_room_npc.txt +++ b/npc/001-2-36/training_room_npc.txt @@ -27,7 +27,7 @@ set $@CURRENT_WAVE_LEVEL, 1; set $@MAX_WAVES, 10; - //Room and Mobspawn Coordinates + //Room and Mobspawn Coordinates // TL BR setarray $@MOB_SPAWN_COORDINATES, 24, 34, 31, 41; setarray $@MAP_NAME$, "001-2-36"; @@ -46,7 +46,7 @@ //call in Warp door if (1 = block) set $@FightingIsActive, 1; - if (getgmlevel() <= 61) + if (!debug || !is_dev()) goto start; //can be removed later! diff --git a/npc/commands/debug-look.txt b/npc/commands/debug-look.txt index ef12e83e..436bdcca 100644 --- a/npc/commands/debug-look.txt +++ b/npc/commands/debug-look.txt @@ -89,7 +89,7 @@ function script BarberDebug { end; OnCall: - if (!debug && getgroupid() < 3) + if (!debug && !is_dev()) { end; } diff --git a/npc/commands/debug-preset.txt b/npc/commands/debug-preset.txt index bc2fc180..59cda9f2 100644 --- a/npc/commands/debug-preset.txt +++ b/npc/commands/debug-preset.txt @@ -230,7 +230,7 @@ function script DoRoutine { end; OnCall: - if (!debug && getgroupid() < 99) + if (!debug && !is_admin()) { end; } diff --git a/npc/commands/debug-quest.txt b/npc/commands/debug-quest.txt index 041879d2..889c988d 100644 --- a/npc/commands/debug-quest.txt +++ b/npc/commands/debug-quest.txt @@ -144,7 +144,7 @@ function script GlobalQuestDebug { end; OnCall: - if (!debug && getgroupid() < 1) + if (!debug && !is_trusted()) { end; } diff --git a/npc/commands/debug-skill.txt b/npc/commands/debug-skill.txt index f4a55a50..2e5393a4 100644 --- a/npc/commands/debug-skill.txt +++ b/npc/commands/debug-skill.txt @@ -68,7 +68,7 @@ function script GlobalSkillDebug { end; OnCall: - if (!debug && getgroupid() < 99) + if (!debug && !is_admin()) { end; } diff --git a/npc/commands/debug.txt b/npc/commands/debug.txt index 83387d26..fc352bd2 100644 --- a/npc/commands/debug.txt +++ b/npc/commands/debug.txt @@ -129,7 +129,7 @@ function script GlobalDebugMenu { end; OnCall: - if (!debug && getgroupid() < 99) + if (!debug && !is_admin()) { end; } diff --git a/npc/commands/rate-management.txt b/npc/commands/rate-management.txt index 06f1c77b..54f64fb3 100644 --- a/npc/commands/rate-management.txt +++ b/npc/commands/rate-management.txt @@ -20,7 +20,7 @@ } OnCall: - if (getgroupid() < 3) + if (!is_evtc()) { end; } diff --git a/npc/commands/super-menu.txt b/npc/commands/super-menu.txt index fede6e71..5e5fb6f7 100644 --- a/npc/commands/super-menu.txt +++ b/npc/commands/super-menu.txt @@ -1,9 +1,7 @@ function script SuperMenu { do { - .@gid = getgroupid(); - - if (.@gid < 3) + if (debug && !is_dev()) { GlobalDebugMenu; return; @@ -18,7 +16,7 @@ function script SuperMenu { select l("Scheduled broadcasts"), l("MOTD"), - rif(.@gid >= 4, l("Event management")), + rif(is_evtc(), l("Event management")), l("Debug"); switch (@menu) @@ -37,9 +35,8 @@ function script SuperMenu { end; OnCall: - .@gid = getgroupid(); - if (!debug && .@gid < 3) + if (!debug && !is_dev()) { dispbottom l("You do not have the required access privileges to use the Super Menu."); end; diff --git a/npc/functions/permissions.txt b/npc/functions/permissions.txt new file mode 100644 index 00000000..646b3779 --- /dev/null +++ b/npc/functions/permissions.txt @@ -0,0 +1,30 @@ +// Evol scripts. +// Author: +// gumi +// Description: +// checks player permissions + +// any staff member +function script is_trusted { + return has_permission("show_client_version", getarg(0, getcharid(CHAR_ID_ACCOUNT))); +} + +// developer +function script is_dev { + return has_permission(PERM_RECEIVE_REQUESTS, getarg(0, getcharid(CHAR_ID_ACCOUNT))); +} + +// event coordinator +function script is_evtc { + return can_use_command("@monster", getarg(0, getcharid(CHAR_ID_ACCOUNT))); +} + +// game master +function script is_gm { + return has_permission("send_gm", getarg(0, getcharid(CHAR_ID_ACCOUNT))); +} + +// administrator +function script is_admin { + return has_permission(PERM_USE_ALL_COMMANDS, getarg(0, getcharid(CHAR_ID_ACCOUNT))); +} diff --git a/npc/functions/quest-debug/functions.txt b/npc/functions/quest-debug/functions.txt index 3d319820..f89adfab 100644 --- a/npc/functions/quest-debug/functions.txt +++ b/npc/functions/quest-debug/functions.txt @@ -11,7 +11,7 @@ // is in debug mode. function script GenericQuestDebug { - if (!debug) + if (!debug && !is_admin()) { select menuimage("actions/back", l("Go back")); @@ -39,7 +39,7 @@ function script GenericQuestDebug { } } - if (getgroupid() >= 99) + if (is_admin()) { .@menustr$ += menuimage("actions/nuke", l("Set state manually")); .@vals[.@cnt] = -0x7FFFFFFE; diff --git a/npc/scripts.conf b/npc/scripts.conf index 6d39acc5..b172664c 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -6,6 +6,7 @@ "npc/items/rand_sc_heal.txt", // Script functions +"npc/functions/permissions.txt", "npc/functions/input.txt", "npc/functions/asleep.txt", "npc/functions/barber.txt", -- cgit v1.2.3-60-g2f50