diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-06-25 06:42:44 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-06-25 06:42:44 -0300 |
commit | 9f1c5dd12cae810fcd8d150b88959db355bbac45 (patch) | |
tree | 92584169e5762cfce87dcdc8845122350e167ae5 /npc/functions/util.txt | |
parent | 79092018414d656f40734cdaab4c73698f9128aa (diff) | |
download | serverdata-9f1c5dd12cae810fcd8d150b88959db355bbac45.tar.gz serverdata-9f1c5dd12cae810fcd8d150b88959db355bbac45.tar.bz2 serverdata-9f1c5dd12cae810fcd8d150b88959db355bbac45.tar.xz serverdata-9f1c5dd12cae810fcd8d150b88959db355bbac45.zip |
Fix ordering
Diffstat (limited to 'npc/functions/util.txt')
-rw-r--r-- | npc/functions/util.txt | 72 |
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}... ) |