summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--world/map/db/const.txt12
-rw-r--r--world/map/npc/functions/global_event_handler.txt3
-rw-r--r--world/map/npc/functions/hug.txt7
-rw-r--r--world/map/npc/magic/_procedures.txt8
4 files changed, 24 insertions, 6 deletions
diff --git a/world/map/db/const.txt b/world/map/db/const.txt
index 0a4b5fb0..a76f16b9 100644
--- a/world/map/db/const.txt
+++ b/world/map/db/const.txt
@@ -413,3 +413,15 @@ G_EVENT 50
G_GM 60
G_ADMIN 80
G_SYSOP 99
+
+// Server Message Types (smsg builtin)
+SMSG_DEBUG 0
+SMSG_GM 1
+SMSG_WARNING 2
+SMSG_SUCCESS 3
+SMSG_FAILURE 4
+SMSG_ERROR 5
+SMSG_LEGAL 6
+SMSG_MOTD 7
+SMSG_AUTOMATIC 8
+SMSG_EVENT 9
diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt
index 4d453c83..ad1ba65c 100644
--- a/world/map/npc/functions/global_event_handler.txt
+++ b/world/map/npc/functions/global_event_handler.txt
@@ -13,6 +13,7 @@ OnPCLoginEvent:
callfunc "ClearVariables"; // removes / converts old variables
callfunc "DisplayMOTD"; // send the motd to the client, if enabled
callfunc "getBroadcast"; // get the scheduled broadcast, if any
+ addtimer 0, "Magic Timer::OnLogin"; // prevent cast rate abuse
// add more here
set @login_event, 2;
end;
@@ -29,7 +30,7 @@ OnPCDieEvent:
callfunc "fightclub_GoBack"; // this used by the battle master
//callfunc "fightclub_event_die"; // this is used by the 1v1 arena
set @necromancer, 0;
- set @_M_BLOCK, 0; // reset magic block on death
+ addtimer 0, "Magic Timer::OnClear"; // reset magic block on death
set @killerrid, 0; // reset killer rid
end;
diff --git a/world/map/npc/functions/hug.txt b/world/map/npc/functions/hug.txt
index d8fc81df..f1bd2637 100644
--- a/world/map/npc/functions/hug.txt
+++ b/world/map/npc/functions/hug.txt
@@ -6,7 +6,9 @@
if (.@name$[0] == "Tree" || .@name$[0] == "tree") set @target_id, .tree_id;
set .@range, if_then_else(@target_id == .tree_id, 3, 6);
if (distance(BL_ID, @target_id) >= .@range) end;
+ if (gettimetick(2) - @hugspell_time < 3) end;
+ set @hugspell_time, gettimetick(2);
misceffect FX_HUG, strcharinfo(0);
if (@target_id != BL_ID) misceffect FX_HUG, @target_id;
@@ -16,11 +18,6 @@
OnInit:
set .tree_id, getnpcid("#DruidTree0#_M");
- registercmd "hug", strnpcinfo(0);
- registercmd "*hug", strnpcinfo(0);
- registercmd "*hug*", strnpcinfo(0);
- registercmd "hugs", strnpcinfo(0);
registercmd "*hugs", strnpcinfo(0);
- registercmd "*hugs*", strnpcinfo(0);
end;
}
diff --git a/world/map/npc/magic/_procedures.txt b/world/map/npc/magic/_procedures.txt
index 466d8ca8..d3c63bf7 100644
--- a/world/map/npc/magic/_procedures.txt
+++ b/world/map/npc/magic/_procedures.txt
@@ -12,6 +12,12 @@ function|script|magic_register
-|script|Magic Timer|32767
{
end;
+
+OnLogin:
+ set @_M_BLOCK, 1;
+ addtimer 10000, "Magic Timer::OnClear";
+ end;
+
OnClear:
set @_M_BLOCK, 0;
end;
@@ -24,6 +30,8 @@ function|script|magic_checks
if(getpvpflag(1)) set .@r, 1; // FIXME: make HIDDEN into a param
if(@_M_BLOCK) set .@r, 2; // check if last debuff ended
if(Hp < 1) set .@r, 3; // can not cast when dead
+ if (.@r)
+ smsg SMSG_FAILURE, "Magic: Impossible to cast right now.";
return .@r;
}