summaryrefslogtreecommitdiff
path: root/npc/config/magic.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/config/magic.txt')
-rw-r--r--npc/config/magic.txt47
1 files changed, 36 insertions, 11 deletions
diff --git a/npc/config/magic.txt b/npc/config/magic.txt
index 1617bfeff..587b2f081 100644
--- a/npc/config/magic.txt
+++ b/npc/config/magic.txt
@@ -5,24 +5,30 @@
//
// Used for our pseudo-magic.
// These are only helpers, you can add more restrictions and effects freely.
+// Important Variables: MAGIC_EXP, LAST_SKILL
-// SkillID, Mana, MobID{, MP per level, MobPerSkillLevel=2}
-function script SummonMagic {
+// SkillID, EXP Points
+function script GetManaExp {
.@sk=getarg(0);
- .@mp=getarg(1);
- .@id=getarg(2);
- .@adj=getarg(4,2);
-
- if (.@adj < 1) {
- debugmes "\033[31mInvalid MobPerSkillLevel for SummonMagic (.@adj): "+.@adj+"\033[0m";
- dispbottom l("Invalid parameter specified, blame saulc.");
+ .@pt=getarg(1);
+ if (LAST_SKILL == .@sk)
end;
- }
+ LAST_SKILL=.@sk;
+ MAGIC_EXP=MAGIC_EXP+.@pt;
+ end;
+}
+// SkillID, Mana{, MP per level}
+function script MagicCheck {
// PRE EXECUTION
+ // Load Variables
+ .@sk=getarg(0);
+ .@mp=getarg(1);
+ .@amp=getarg(2,0);
+
// Check Skill
if (getskilllv(.@sk) < 1)
- end;
+ return 0;
// Load mana cost
.@amp=getarg(3,0);
@@ -31,9 +37,28 @@ function script SummonMagic {
// Check mana
if (readparam(Sp) < .@mp) {
dispbottom l("Insufficient mana: @@/@@.", readparam(Sp), .@mp);
+ return 0;
+ }
+ return 1;
+}
+
+// SkillID, Mana, MobID{, MP per level, MobPerSkillLevel=2}
+function script SummonMagic {
+ .@sk=getarg(0);
+ .@mp=getarg(1);
+ .@id=getarg(2);
+ .@adj=getarg(4,2);
+
+ if (.@adj < 1) {
+ debugmes "\033[31mInvalid MobPerSkillLevel for SummonMagic (.@adj): "+.@adj+"\033[0m";
+ dispbottom l("Invalid parameter specified, blame saulc.");
end;
}
+ // PRE EXECUTION
+ if (!MagicCheck(.@sk, .@mp, .@amp))
+ end;
+
// EXECUTION
// Apply costs