summaryrefslogtreecommitdiff
path: root/world/map/npc/001-1/rewards_master.txt
blob: f078c62b7f6400f273e1ca8027388b2e02d37dc7 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//

001-1.gat,50,53,0|script|Ishi|106,
{
    if (MPQUEST == 0) goto L_Register;
    if (tvis == 0) set tvis, 1;
    if (Mobpt < tvis) goto L_NotEnough;

    setarray @Items$, "AppleCake", "Arrow", "Beer", "Boots", "BugLeg", "CactusDrink", "CactusPotion", "Cake", "Candy", "CasinoCoins", "CherryCake", "ChickenLeg", "ChocolateBar", "ChocolateCake", "CottonBoots", "CottonCloth", "CottonShirt", "CottonShorts", "FancyHat", "GreenApple", "HardSpike", "IronOre", "Lifestone", "LightBlueDye", "MaggotSlime", "Milk", "Orange", "OrangeCake", "OrangeCupcake", "PinkPetal", "PileOfAsh", "PinkAntenna", "PoltergeistPowder", "RawLog", "RedApple", "RedDye", "ScorpionStinger", "SerfHat", "SmallHealingPotion", "SmallMushroom", "SnakeSkin", "SpectrePowder", "Steak", "TinyHealingPotion", "WhiteCake", "WhiteFur", "WispPowder", "YellowDye", "Coal";

    mes "[Ishi the Rewards Master]";
    mes "\"Welcome! I see you have " + Mobpt + " Monster Points. Would you like to exchange some of those for items?\"";
    next;

    set @i, 0;
    setarray @Menu$, "", "", "", "", "", "", "", "", "", "", "", "";
    callsub SUB_prep_menu;

    menu
        @Menu$[0], L_MenuItems,
        @Menu$[1], L_MenuItems,
        @Menu$[2], L_MenuItems,
        @Menu$[3], L_MenuItems,
        @Menu$[4], L_MenuItems,
        @Menu$[5], L_MenuItems,
        @Menu$[6], L_MenuItems,
        @Menu$[7], L_MenuItems,
        @Menu$[8], L_MenuItems,
        @Menu$[9], L_MenuItems,
        @Menu$[10], L_MenuItems,
        @Menu$[11], L_MenuItems;

L_MenuItems:
    // this is for the last entry "No thanks":
    if (@menu > @i) goto L_Close;
    // this is for the "Give all" entry:
    if (@menu == 11) goto L_Give_all;

    set @req, @menu;
    set @rec, 0;
    goto L_Item_Loop;

L_Item_Loop:
    if (@rec == @req || Mobpt < tvis) goto L_Item_Done;

    callsub SUB_give_item;
    set @rec, @rec + 1;
    goto L_Item_Loop;

L_Item_Done:
    if (@rec < @req) mes "It looks like your Monster Points were over estimated.";
    goto L_Close;

L_Register:
    mes "[Ishi the Rewards Master]";
    mes "\"Hey, it seems like you didn't register as a quest participant yet! You can sign up with Aidan.\"";
    goto L_Close;

L_NotEnough:
    mes "[Ishi the Rewards Master]";
    mes "\"You don't have enough Monster Points for a reward. You'll need to kill some more monsters first.\"";
    goto L_Close;

L_Give_all:
    // we need to count how many loop iterations are done there,
    // since the server complains about more than 250 (70 according to Jaxad0127)
    // gotos without interrupting next statement.
    set @gotocounter, 50;
    goto L_Give_all_loop;

L_Give_all_loop:
    set @gotocounter, @gotocounter - 1;
    if (@gotocounter < 1) goto L_Give_all_next;
    set @itemgiveerror, 0;
    callsub SUB_give_item;
    if (@itemgiveerror != 0) goto L_Close;
    goto L_Give_all_loop;

L_Give_all_next:
    next;
    mes "[Ishi the Rewards Master]";
    mes "\"You have received a lot of items. You still have " + Mobpt + " monster points. Shall we continue?\"";
    menu
        "Yes", L_Give_all,
        "No", L_Close;

L_Close:
    set @gotocounter, 0;
    set @itemgiveerror, 0;
    set @pts, 0;
    set @dif, 0;
    set @i, 0;
    cleararray @Menu$[0], "", 10;
    cleararray @Items$[0], "", 10;
    close;

//////////////////////////////////////////////////
// Subroutines
//////////////////////////////////////////////////

SUB_prep_menu:
    set @pts, Mobpt;
    set @dif, tvis;
    goto L_Menu_Loop;

L_Menu_Loop:
    if (@pts < @dif || @i == 10) goto L_Menu_Check;

    set @Menu$[@i], @i + 1;

    set @i, @i + 1;
    set @pts, @pts - @dif;
    set @dif, @dif + 1;

    goto L_Menu_Loop;

L_Menu_Check:
    // if we are able to give 10, we can enable the option to give all we can have
    if (@i != 10) goto L_Menu_Done;
        set @Menu$[@i], "Please give me as many as I deserve!";
        set @i, @i + 1;
    goto L_Menu_Done;

L_Menu_Done:
    set @Menu$[@i], "No thanks";
    return;

SUB_give_item:
    set @itemgiveerror, 0;
    getinventorylist;
    if (@inventorylist_count == 100) goto SUB_give_noinv;
    if (Mobpt < tvis) goto SUB_give_nomobpts;
    set Mobpt, Mobpt - tvis;
    set tvis, tvis + 1;
    set @item$, @Items$[rand(getarraysize(@Items$))];

    getitem @item$, 1;

    mes "You received one " + getitemname(@item$) + "!";
    return;

SUB_give_noinv:
    mes "Your inventory is full!";
    set @itemgiveerror, 1;
    return;

SUB_give_nomobpts:
    mes "It looks like your Monster Points were over estimated.";
    set @itemgiveerror, 1;
    return;
}