summaryrefslogtreecommitdiff
path: root/npc/guilds/bank.txt
blob: dadd5277ddb81560ce62e119098124185c9020cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Moubootaur Legends Script
// Author:
//    Jesusalva
// Description:
//  Guild Facility - Guild Vault

guilds,35,35,0	script	Guild Vault	NPC_NO_SPRITE,{
    .@gid=getcharid(2);
    .@role=getguildrole(.@gid, getcharid(3));
    do
    {
        mesn;
        mesc l("This vault currently have @@ GP inside.", format_number($GUILD_BANK[.@gid]));
        select
            l("Okay, laters"),
            l("Donate GP"),
            rif(.@role == GPOS_TREASURER || .@role <= GPOS_VICELEADER, l("Withdraw GP"));
        mes "";
        switch (@menu)
        {
            case 1:
                close;
            case 2:
                input .@mx;
                if (Zeny < .@mx || .@mx < 0)
                {
                    mesc l("Invalid amount!"), 1;
                }
                else
                {
                    Zeny=Zeny-.@mx;
                    $GUILD_BANK[.@gid]+=.@mx;
                    mesc l("Donation successful!"), 3;
                }
                break;
            case 3:
                input .@mx;
                if ($GUILD_BANK[.@gid] < .@mx || .@mx < 0)
                {
                    mesc l("Invalid amount!"), 1;
                }
                else
                {
                    $GUILD_BANK[.@gid]-=.@mx;
                    Zeny=Zeny+.@mx;
                    mesc l("Money withdrawn!"), 3;
                }
                break;
        }

    } while (true);
    close;

OnInit:
    .distance=2;
    end;
}