summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHello=) <hello@themanaworld.org>2024-04-10 20:52:45 +0300
committerLed Mitz <smoothshifter@tuta.io>2024-04-11 04:58:52 +0000
commit97e7713b729981081e3001db2c2e7b152298b109 (patch)
tree94b74342f4586d6a21d61a8223015d164127ee86
parentf71f26affd599fa87a4c03319a979c6786f978f3 (diff)
downloadclassic-serverdata-97e7713b729981081e3001db2c2e7b152298b109.tar.gz
classic-serverdata-97e7713b729981081e3001db2c2e7b152298b109.tar.bz2
classic-serverdata-97e7713b729981081e3001db2c2e7b152298b109.tar.xz
classic-serverdata-97e7713b729981081e3001db2c2e7b152298b109.zip
Boss Actions: add permissions checks. Boss/event spells are GM >= 40 by default.
-rw-r--r--world/map/npc/magic/_procedures.txt35
1 files changed, 23 insertions, 12 deletions
diff --git a/world/map/npc/magic/_procedures.txt b/world/map/npc/magic/_procedures.txt
index c50f0ab5..601d5b15 100644
--- a/world/map/npc/magic/_procedures.txt
+++ b/world/map/npc/magic/_procedures.txt
@@ -97,36 +97,47 @@ L_Return:
// this function is call()-only
// Custom version of checks for Dungeon Masters boss "powerups".
-// Both GMs and player eventers MAY eventually call boss powerups.
-// That's why GM Lv check removed, some things relaxed.
-// Its up to powerup "spell" itself to check who can call it or why.
+// Both GMs and player eventers MAY eventually call "boss powerups".
+// By default, only GMs >= 40 can use BossPowers, but:
+// - If someone abuses BossPowers, setting #BOSS_POWERS_DISABLED = 1 on them locks them out.
+// - Some (trusted) player can be allowed to invoke this by setting #IS_EVENTER = 42 on them.
+// On TMWA these changes need GM Lv 80 to issue @setvar, so access can only be changed by Lv 80.
+// Advantage of this permissions system is: no need to shuffle GM levels, nor there's need to restart server.
function|script|boss_powerup_checks
{
set .@flags, getarg(0);
set .@nonmagic, .@flags & (1<<0);
- if ($BOSS_KILLSWITCH) goto L_Killswitch; // If things go wrong direction, boss powers can be disabled.
- if(HIDDEN) goto L_Hidden; // can not cast with @hide
- if(@_M_BLOCK) goto L_Blocked; // check if last debuff ended
- if(Hp < 1) goto L_Dead; // can not cast when dead
- return 0;
+ if ($BOSS_KILLSWITCH) goto L_Killswitch; // If things go wrong, boss powers can be completely disabled.
+ if (#BOSS_POWERS_DISABLED) goto L_Killswitch; // If someone abuses BossPowers they can get DENY flag set.
+ if (HIDDEN) goto L_Hidden; // can not cast with @hide
+ if (@_M_BLOCK) goto L_Blocked; // check if last debuff ended
+ if (Hp < 1) goto L_Dead; // can not cast when dead
+ if (GM >= 40) goto L_Allowed; // GM >= 40 can use boss actions
+ if (#IS_EVENTER == 42) goto L_Allowed; // Trusted player(s) could be allowed to access Eventer "magic":
+ // Use @setvar #IS_EVENTER 0 42 Nick (GM Lv 80 command) to do it.
+ smsg SMSG_FAILURE, "BossPowers: Only few of mere mortals may try to enter the twilight zone";
+ return 1; // Not allowed by default.
+
+L_Allowed:
+ return 0; // Whoever gets here allowed to invoke BossPowers spells
L_Killswitch:
smsg SMSG_FAILURE, "BossPowers: disabled by kill switch!";
- return 7;
+ return 2;
L_Hidden:
smsg SMSG_FAILURE, "BossPowers: can't be used when hidden!";
- return 1;
+ return 3;
L_Blocked:
smsg SMSG_FAILURE, "BossPowers: cooldown is in effect. Please wait.";
- return 2;
+ return 4;
L_Dead:
smsg SMSG_FAILURE, "BossPowers: you're dead!";
- return 3;
+ return 5;
}
function|script|elt_damage