diff options
author | Saulc <lucashelaine14@gmail.com> | 2018-01-13 20:50:42 +0100 |
---|---|---|
committer | Saulc <lucashelaine14@gmail.com> | 2018-01-13 20:50:42 +0100 |
commit | 20df2abc1aca00d6aa5dc78347133890f36b32f3 (patch) | |
tree | 4ad4a8bb8b0605473a702e314799a4626347721a /npc/commands/zeny.txt | |
download | serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.gz serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.bz2 serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.xz serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.zip |
Initial commit
Diffstat (limited to 'npc/commands/zeny.txt')
-rw-r--r-- | npc/commands/zeny.txt | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/npc/commands/zeny.txt b/npc/commands/zeny.txt new file mode 100644 index 000000000..77f6d2dea --- /dev/null +++ b/npc/commands/zeny.txt @@ -0,0 +1,98 @@ +// @esp atcommand +// changes the number of Esperin +// +// group lv: 3 +// group char lv: 99 +// log: True +// +// usage: +// @esp <delta> +// #esp "char" <delta> +// +// example: +// @esp +5 +// @esp -5 +// @esp +++ + +- script @esp 32767,{ + end; + +OnCall: + .@delta$ = .@atcmd_parameters$[0]; + + if (debug && startswith(.@delta$, "--")) + { + Zeny = 0; + if (.@delta$ == "---") + { + BankVault = 0; + } + } + else if (debug && (startswith(.@delta$, "++") || .@delta$ == "")) + { + Zeny = MAX_ZENY; + if (.@delta$ == "+++") + { + BankVault = MAX_BANK_ZENY; + } + } + else + { + .@d = atoi(.@delta$); + if (.@d < 0) + { + .@a = Zeny + .@d; // The amount of zeny remaining after + if (.@a < 0) // If we can't remove that much zeny, try removing from bank too + { + Zeny = 0; + .@b = BankVault + .@a; // amount remaining in bank after + if (.@b < 0) + { + BankVault = 0; + } + else + { + BankVault += .@a; + } + } + else // We can remove that much zeny + { + Zeny += .@d; + } + } + else + { + .@a = Zeny + .@d; // The amount of zeny after + if (.@a < 0 || .@a >= MAX_ZENY) // If we can't add that much zeny, try adding to bank + { + .@c = .@d - (.@a - Zeny); // the amount to put in bank + Zeny = MAX_ZENY; + .@b = BankVault + .@c; // amout in bank after + if (.@b < 0 || .@b == MAX_BANK_ZENY) + { + BankVault = MAX_BANK_ZENY; + } + else + { + BankVault += .@c; + } + } + else // We can add that much zeny + { + Zeny += .@d; + } + } + } + end; + +OnInit: + if (debug > 0) + { + bindatcmd "e", "@esp::OnCall", 0, 99, 0; + bindatcmd "esp", "@esp::OnCall", 0, 99, 0; + bindatcmd "money", "@esp::OnCall", 0, 99, 0; + end; + } + + bindatcmd "esp", "@esp::OnCall", 3, 99, 1; +} |