summaryrefslogtreecommitdiff
path: root/npc/guilds/exchange.txt
blob: 1d2fe9b178e54e51dd52444efb5e08211b8894a2 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// TMW2 Script
// Author:
//  Jesusalva
// Description:
//  Trades Guild Coins for useful items
// Variable:
//  GUILDSHOP (bitmask)

guilds,29,24,0	script	Guild Coin Exchange	NPC_NO_SPRITE,{
    do
    {
        mes l("You have %d %s", countitem(GuildCoin), getitemlink(GuildCoin));
        next;
        // Calculate fruit cost
        if (!(GUILDSHOP & GEX_fruit1)) {
            .@fruitcost=100; .@fruitId=GEX_fruit1;
        } else if (!(GUILDSHOP & GEX_fruit2)) {
            .@fruitcost=200; .@fruitId=GEX_fruit2;
        } else if (!(GUILDSHOP & GEX_fruit3)) {
            .@fruitcost=350; .@fruitId=GEX_fruit3;
        } else if (!(GUILDSHOP & GEX_fruit4)) {
            .@fruitcost=500; .@fruitId=GEX_fruit4;
        } else if (!(GUILDSHOP & GEX_fruit5)) {
            .@fruitcost=750; .@fruitId=GEX_fruit5;
        } else {
            .@fruitcost=false; .@fruitId=GEX_fruitMAX;
        }

        // Calculate mercbox cost
        if (!(GUILDSHOP & GEX_merc1)) {
            .@merccost=50; .@mercId=GEX_merc1;
        } else if (!(GUILDSHOP & GEX_merc2)) {
            .@merccost=100; .@mercId=GEX_merc2;
        } else if (!(GUILDSHOP & GEX_merc3)) {
            .@merccost=175; .@mercId=GEX_merc3;
        } else if (!(GUILDSHOP & GEX_merc4)) {
            .@merccost=250; .@mercId=GEX_merc4;
        } else if (!(GUILDSHOP & GEX_merc5)) {
            .@merccost=350; .@mercId=GEX_merc5;
        } else {
            .@merccost=false; .@mercId=GEX_mercMAX;
        }

        // Calculate blueprint cost
        if (!(GUILDSHOP & GEX_blue1)) {
            .@bluecost=50; .@blueId=GEX_blue1;
        } else if (!(GUILDSHOP & GEX_blue2)) {
            .@bluecost=75; .@blueId=GEX_blue2;
        } else if (!(GUILDSHOP & GEX_blue3)) {
            .@bluecost=100; .@blueId=GEX_blue3;
        } else if (!(GUILDSHOP & GEX_blue4)) {
            .@bluecost=150; .@blueId=GEX_blue4;
        } else if (!(GUILDSHOP & GEX_blue5)) {
            .@bluecost=200; .@blueId=GEX_blue5;
        } else {
            .@bluecost=200; .@blueId=GEX_blueMAX;
        }

        menuint
            l("Close"), 0,
            rif(.@fruitcost, .@fruitcost+l(" Coins - Mysterious Fruit")), .@fruitId,
            rif(.@merccost, .@merccost+l(" Coins - Mercenary Boxset ++")), .@mercId,
            rif(.@bluecost, .@bluecost+l(" Coins - Ancient Blueprint")), .@blueId;

        mes "";
        switch (@menuret) {
            case GEX_fruit1:
            case GEX_fruit2:
            case GEX_fruit3:
            case GEX_fruit4:
            case GEX_fruit5:
            case GEX_fruitMAX:
                if (countitem(GuildCoin) < .@fruitcost)
                    close;
                delitem GuildCoin, .@fruitcost;
                getitem MysteriousFruit, 1;
                if (@menuret > 0)
                    GUILDSHOP=GUILDSHOP|@menuret;
                break;

            case GEX_merc1:
            case GEX_merc2:
            case GEX_merc3:
            case GEX_merc4:
            case GEX_merc5:
            case GEX_mercMAX:
                if (countitem(GuildCoin) < .@merccost)
                    close;
                delitem GuildCoin, .@merccost;
                getitem (GUILDSHOP & GEX_merc3 ? MercBoxE : MercBoxD), 1;
                if (@menuret > 0)
                    GUILDSHOP=GUILDSHOP|@menuret;
                break;

            case GEX_blue1:
            case GEX_blue2:
            case GEX_blue3:
            case GEX_blue4:
            case GEX_blue5:
            case GEX_blueMAX:
                if (countitem(GuildCoin) < .@bluecost)
                    close;
                delitem GuildCoin, .@bluecost;
                getitem AncientBlueprint, 1;
                if (@menuret > 0)
                    GUILDSHOP=GUILDSHOP|@menuret;
                break;
        }

    } while (@menuret != 0);
    close;

OnInit:
    .@npcId = getnpcid(.name$);
    setunitdata(.@npcId, UDT_HEADTOP, TopHat);
    setunitdata(.@npcId, UDT_HEADMIDDLE, GoldenWarlordPlate);
    setunitdata(.@npcId, UDT_WEAPON, JeansChaps);
    setunitdata(.@npcId, UDT_HEADBOTTOM, AssassinBoots);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 25);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 4);

    .sex = G_MALE;
    .distance = 5;
    end;
}