summaryrefslogtreecommitdiff
path: root/npc/magic/config.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-04-13 23:24:07 -0300
committerJesusaves <cpntb1@ymail.com>2021-04-13 23:24:07 -0300
commit5e1255c584092c1bbd8d014814acd2ac9716ecc6 (patch)
tree12ad17925826060dffc4457976deb9466cc5b38f /npc/magic/config.txt
parent1b3c05034f011c93f152f443b60e3717b81df035 (diff)
downloadserverdata-5e1255c584092c1bbd8d014814acd2ac9716ecc6.tar.gz
serverdata-5e1255c584092c1bbd8d014814acd2ac9716ecc6.tar.bz2
serverdata-5e1255c584092c1bbd8d014814acd2ac9716ecc6.tar.xz
serverdata-5e1255c584092c1bbd8d014814acd2ac9716ecc6.zip
Optimize magic skill charge code, add warning when low on supply (3 or less)
Diffstat (limited to 'npc/magic/config.txt')
-rw-r--r--npc/magic/config.txt17
1 files changed, 17 insertions, 0 deletions
diff --git a/npc/magic/config.txt b/npc/magic/config.txt
index 229c0521..ddbbf99d 100644
--- a/npc/magic/config.txt
+++ b/npc/magic/config.txt
@@ -369,6 +369,23 @@ function script isfocused {
return (FOCUSING & .@f);
}
+// mcharge(item, school, charges) {inheirs = @skillId}
+function script mcharge {
+ .@it=getarg(0);
+ .@sc=getarg(1);
+ .@cr=getarg(2, 0);
+ if (@MCHARGE[@skillId] < 1) {
+ delitem .@it, 1;
+ @MCHARGE[@skillId] = .@cr+getskilllv(SKILL_MAGIC)+getskilllv(.@cr);
+ // Low supply warning
+ if (countitem(.@it) <= 3)
+ dispbottom col(b(l("Warning, %d remaining: %s",
+ 3, getitemname(.@it))), 1);
+ }
+ @MCHARGE[@skillId]-=1;
+ return;
+}
+
- script Magic Load NPC_HIDDEN,{
OnInit:
end;