summaryrefslogtreecommitdiff
path: root/npc/functions/util.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions/util.txt')
-rw-r--r--npc/functions/util.txt72
1 files changed, 36 insertions, 36 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index 2a079436e..05c649b18 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -708,6 +708,42 @@ function script sk_lvup {
return;
}
+// LEGACY Magic School Learning Interface
+// mlearn( skill, MAX_LV, MSP cost, item, amount{, AP cost} )
+// returns false if cheater
+function script mlearn {
+ .@sk=getarg(0);
+ .@ff=getarg(1);
+ .@msp=getarg(2);
+ .@it=getarg(3);
+ .@am=getarg(4);
+ .@ap=getarg(5, 0);
+ // Max level reached
+ if (getskilllv(.@sk) >= .@ff) {
+ return true;
+ }
+ // Not enough items
+ if (countitem(.@it) < .@am && !(countitem(ScholarshipBadge)))
+ return false;
+ // Not enough MSP
+ if (!sk_canlvup(.@msp))
+ return false;
+ // TODO: Not enough AP
+ //if (MAGIC_AP < .@ap) {
+ // return false;
+ //}
+
+ // Payment
+ if (countitem(.@it) < .@am)
+ delitem ScholarshipBadge, 1;
+ else
+ delitem .@it, .@am;
+
+ // Level up
+ sk_lvup(.@sk, .@msp);
+ return true;
+}
+
// NEW Magic School Learning Interface
// learn_magic(Skill)
function script learn_magic {
@@ -759,42 +795,6 @@ function script learn_magic {
return mlearn(.@ski, .@mlv, .@msp, .@it, .@am);
}
-// LEGACY Magic School Learning Interface
-// mlearn( skill, MAX_LV, MSP cost, item, amount{, AP cost} )
-// returns false if cheater
-function script mlearn {
- .@sk=getarg(0);
- .@ff=getarg(1);
- .@msp=getarg(2);
- .@it=getarg(3);
- .@am=getarg(4);
- .@ap=getarg(5, 0);
- // Max level reached
- if (getskilllv(.@sk) >= .@ff) {
- return true;
- }
- // Not enough items
- if (countitem(.@it) < .@am && !(countitem(ScholarshipBadge)))
- return false;
- // Not enough MSP
- if (!sk_canlvup(.@msp))
- return false;
- // TODO: Not enough AP
- //if (MAGIC_AP < .@ap) {
- // return false;
- //}
-
- // Payment
- if (countitem(.@it) < .@am)
- delitem ScholarshipBadge, 1;
- else
- delitem .@it, .@am;
-
- // Level up
- sk_lvup(.@sk, .@msp);
- return true;
-}
-
/*
// Magic School Learning Interface
// mlearn( skill, {item 1, amount 1}, {item 2, amount 2}... )