From 9f1c5dd12cae810fcd8d150b88959db355bbac45 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 25 Jun 2020 06:42:44 -0300 Subject: Fix ordering --- npc/functions/util.txt | 72 +++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'npc/functions') 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}... ) -- cgit v1.2.3-70-g09d2