diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-07-19 18:37:16 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-07-19 18:37:16 -0300 |
commit | 5841adb8f9004da464f59aa59a0523f78871a97a (patch) | |
tree | 2b51dc1c91a63cd856f2375676acb9b1f6825788 /npc/functions/util.txt | |
parent | 9da610fafef407684a38ffab53985fe25ddd6b06 (diff) | |
download | serverdata-5841adb8f9004da464f59aa59a0523f78871a97a.tar.gz serverdata-5841adb8f9004da464f59aa59a0523f78871a97a.tar.bz2 serverdata-5841adb8f9004da464f59aa59a0523f78871a97a.tar.xz serverdata-5841adb8f9004da464f59aa59a0523f78871a97a.zip |
Earliest working prototype
Diffstat (limited to 'npc/functions/util.txt')
-rw-r--r-- | npc/functions/util.txt | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt index 4e12e5fed..426219bb5 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -593,22 +593,29 @@ function script sk_maxpoints { return .@val; } +// Returns how many points you can allocate +function script sk_points { + return sk_maxpoints()-MAGIC_PTS; +} + // Returns true if a skill can be leveled up. -// TODO: Ideally, we would also check for skill max level... -// sk_canlvup( sk, {cost=1} ) +// sk_canlvup( item{, cost=1} ) function script sk_canlvup { - if (MAGIC_PTS+getarg(1,1) >= sk_maxpoints()) - return 1; - return 0; + return ( + countitem(getarg(0)) && + (MAGIC_PTS+getarg(1,1)) <= sk_maxpoints()); } // Level up a skill in 1 level // TODO: Return the point if leveling about Max Level -// sk_lvup( sk ) +// sk_lvup( sk{, cost=0} ) function script sk_lvup { .@lvl=getskilllv(getarg(0)); getexp 0, 50*(.@lvl+1); addtoskill(getarg(0),.@lvl+1,0); + if (getarg(1,0)) { + MAGIC_PTS+=getarg(1,0); + } return; } |