summaryrefslogtreecommitdiff
path: root/npc/guilds/logs.txt
blob: 1463d5b13d1d90fc755ca4aa406887f99f08e645 (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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
// Moubootaur Legends Script
// Author:
//    Jesusalva
// Description:
//  Guild Facility - Contains recipe list

guilds,47,39,0	script	Guild Logs	NPC_NO_SPRITE,{
    function hudRecipe;
    function showRecipe;
    function calcRecipe;
    function clearRecipe;
    .@gid=getcharid(2);
    .@s=0; // How many was displayed, to use next(); if needed

    mes ".:: " + l("Alchemy Recipes") + " ::.";
    // Healing
    .@s+=showRecipe(CraftPiberriesInfusion, PiberriesInfusion,
                    5, Piberries, 1, Curshroom);

    if (.@s > 1)
        next;

    // General Boosts
    .@s+=showRecipe(CraftHastePotion, HastePotion,
                    15, Plushroom);
    .@s+=showRecipe(CraftStrengthPotion, StrengthPotion,
                    15, Chagashroom);
    .@s+=showRecipe(CraftResetPotion, StatusResetPotion,
                    90, ManaPiouFeathers, 10, Curshroom);
    .@s+=showRecipe(CraftSpeedPotion, MoveSpeedPotion,
                    1, GemPowder, 5, FluoPowder);
    .@s+=showRecipe(CraftPrecisionPotion, PrecisionPotion,
                    3, Piberries, 1, MountainSnakeEgg);
    .@s+=showRecipe(CraftDodgePotion, DodgePotion,
                    3, Piberries, 1, SnakeEgg);

    if (.@s > 5)
        next;

    // Stats Boosts
    .@s+=showRecipe(CraftLukPotionA, LukPotionA,
                    1, EmeraldPowder, 1, HerbalTea);
    .@s+=showRecipe(CraftLukPotionB, LukPotionB,
                    1, Emerald, 2, HerbalTea);
    .@s+=showRecipe(CraftLukPotionC, LukPotionC,
                    1, PolishedEmerald, 3, HerbalTea);

    .@s+=showRecipe(CraftDexPotionA, DexPotionA,
                    1, AmethystPowder, 1, HerbalTea);
    .@s+=showRecipe(CraftDexPotionB, DexPotionB,
                    1, Amethyst, 2, HerbalTea);
    .@s+=showRecipe(CraftDexPotionC, DexPotionC,
                    1, PolishedAmethyst, 3, HerbalTea);

    .@s+=showRecipe(CraftIntPotionA, IntPotionA,
                    1, SapphirePowder, 1, HerbalTea);
    .@s+=showRecipe(CraftIntPotionB, IntPotionB,
                    1, Sapphire, 2, HerbalTea);
    .@s+=showRecipe(CraftIntPotionC, IntPotionC,
                    1, PolishedSapphire, 3, HerbalTea);

    .@s+=showRecipe(CraftVitPotionA, VitPotionA,
                    1, DiamondPowder, 1, HerbalTea);
    .@s+=showRecipe(CraftVitPotionB, VitPotionB,
                    1, Diamond, 2, HerbalTea);
    .@s+=showRecipe(CraftVitPotionC, VitPotionC,
                    1, PolishedDiamond, 3, HerbalTea);

    .@s+=showRecipe(CraftAgiPotionA, AgiPotionA,
                    1, TopazPowder, 1, HerbalTea);
    .@s+=showRecipe(CraftAgiPotionB, AgiPotionB,
                    1, Topaz, 2, HerbalTea);
    .@s+=showRecipe(CraftAgiPotionC, AgiPotionC,
                    1, PolishedTopaz, 3, HerbalTea);

    if (.@s > 14)
        next;

    // Limit Boosts
    .@s+=showRecipe(CraftSacredManaPot, SacredManaPotion,
                    1, GoldenApple, 15, CelestiaTea);
    .@s+=showRecipe(CraftSacredLifePot, SacredLifePotion,
                    1, GoldenApple, 1, ElixirOfLife);

    if (.@s == 0)
        mesc l("Your guild doesn't knows any recipes!"), 1;

    if (getguildrole(.@gid, getcharid(3)) > GPOS_VICELEADER)
        close;
    do
    {
        select
            l("Do nothing"),
            rif(strcharinfo(0) == getguildmaster(.@gid), l("Raise max members")),
            l("Learn Alchemy Recipes");
        mes "";

        switch (@menu) {
            case 2:
                .@cur_lv=getguildlvl(.@gid);
                .@min_lv=(getskilllv(GD_EXTENSION)+1)*4;
                .@price=.@min_lv*274;
                if (.@cur_lv < .@min_lv)
                {
                    mesc l("Guild Level is not enough: @@/@@", .@cur_lv, .@min_lv);
                    next;
                    break;
                }
                mesc l("Raising this skill will allow to recruit 4 more members.");
                mesc l("The cost for Guild Vault is @@ GP.", .@price);
                next;
                select
                    rif($GUILD_BANK[.@gid] >= .@price, l("Upgrade it")),
                    l("Don't upgrade it");
                mes "";
                if (@menu == 1 && $GUILD_BANK[.@gid] >= .@price)
                {
                    $GUILD_BANK[.@gid]-=.@price;
                    // guildskill()?
                    skill GD_EXTENSION, getskilllv(GD_EXTENSION)+1, 0;
                    break;
                }
                break;
            case 3:
                mes ".:: " + l("Alchemy Recipes") + " ::.";
                do {
                    clearRecipe();

                    // Healing Recipes
                    if (!showRecipe(CraftPiberriesInfusion, false))
                        calcRecipe(CraftPiberriesInfusion, 3, 10000, l("Piberries Infusion"));

                    // General Boosts
                    if (!showRecipe(CraftHastePotion, false))
                         calcRecipe(CraftHastePotion, 2, 5000, l("Haste Potion"));
                    if (!showRecipe(CraftStrengthPotion, false))
                         calcRecipe(CraftStrengthPotion, 2, 5000, l("Strength Potion"));

                    if (!showRecipe(CraftResetPotion, false))
                         calcRecipe(CraftResetPotion, 4, 50000, l("Status Reset Potion"));
                    if (!showRecipe(CraftSpeedPotion, false))
                         calcRecipe(CraftSpeedPotion, 4, 50000, l("Movement Speed Potion"));

                    if (!showRecipe(CraftPrecisionPotion, false))
                         calcRecipe(CraftPrecisionPotion, 5, 20000, l("Precision Potion"));
                    if (!showRecipe(CraftDodgePotion, false))
                         calcRecipe(CraftDodgePotion, 5, 20000, l("Dodge Potion"));

                    // Stats Boosts
                    if (!showRecipe(CraftLukPotionA, false))
                         calcRecipe(CraftLukPotionA, 4, 15000, l("Luck Potion"));
                    if (!showRecipe(CraftLukPotionB, false))
                         calcRecipe(CraftLukPotionB, 6, 25000, l("Luck+ Potion"));
                    if (!showRecipe(CraftLukPotionC, false))
                         calcRecipe(CraftLukPotionC, 8, 35000, l("Luck++ Potion"));

                    if (!showRecipe(CraftDexPotionA, false))
                         calcRecipe(CraftDexPotionA, 4, 15000, l("Dex Potion"));
                    if (!showRecipe(CraftDexPotionB, false))
                         calcRecipe(CraftDexPotionB, 6, 25000, l("Dex+ Potion"));
                    if (!showRecipe(CraftDexPotionC, false))
                         calcRecipe(CraftDexPotionC, 8, 35000, l("Dex++ Potion"));

                    if (!showRecipe(CraftIntPotionA, false))
                         calcRecipe(CraftIntPotionA, 4, 15000, l("Int Potion"));
                    if (!showRecipe(CraftIntPotionB, false))
                         calcRecipe(CraftIntPotionB, 6, 25000, l("Int+ Potion"));
                    if (!showRecipe(CraftIntPotionC, false))
                         calcRecipe(CraftIntPotionC, 8, 35000, l("Int++ Potion"));

                    if (!showRecipe(CraftVitPotionA, false))
                         calcRecipe(CraftVitPotionA, 4, 15000, l("Vit Potion"));
                    if (!showRecipe(CraftVitPotionB, false))
                         calcRecipe(CraftVitPotionB, 6, 25000, l("Vit+ Potion"));
                    if (!showRecipe(CraftVitPotionC, false))
                         calcRecipe(CraftVitPotionC, 8, 35000, l("Vit++ Potion"));

                    if (!showRecipe(CraftAgiPotionA, false))
                         calcRecipe(CraftAgiPotionA, 4, 15000, l("Agi Potion"));
                    if (!showRecipe(CraftAgiPotionB, false))
                         calcRecipe(CraftAgiPotionB, 6, 25000, l("Agi+ Potion"));
                    if (!showRecipe(CraftAgiPotionC, false))
                         calcRecipe(CraftAgiPotionC, 8, 35000, l("Agi++ Potion"));

                    // Limit Boosts
                    if (!showRecipe(CraftSacredManaPot, false))
                         calcRecipe(CraftSacredManaPot, 7, 100000, l("Sacred Mana Potion"));
                    if (!showRecipe(CraftSacredLifePot, false))
                         calcRecipe(CraftSacredLifePot, 7, 100000, l("Sacred Life Potion"));

                } while (!hudRecipe());
                break;
        }

    } while (@menu != 1);
    close;

// showRecipe (Craft, Bonus, Req1No, Req1Id, Req2No, Req2Id)
// Bonus must NOT be zero to display text
function showRecipe {
    /*
    debugmes "Exist: %d", getd("$RECIPES_ALCHEMY_"+getcharid(2)+"["+getarg(0)+"]");
    debugmes "Seeking for slot %d on guild %d", getarg(0), getcharid(2);
    */
    if (getd("$RECIPES_ALCHEMY_"+getcharid(2)+"["+getarg(0)+"]")) {
        //debugmes "Hooray! It exists! We have %d defined", getarg(1);
        if (getarg(1)) {
            mesn l("Craft @@", getitemlink(getarg(1)));
            if (getarg(2,0))
                mesc l("* @@ @@", getarg(2), getitemlink(getarg(3)));
            if (getarg(4,0))
                mesc l("* @@ @@", getarg(4), getitemlink(getarg(5)));
            mes "";
        }
        //debugmes "You got it: %d (global: %d)", getarg(0), $RECIPES_ALCHEMY[getcharid(2)];
        return 1;
    }
    //debugmes "Nope, nothing here";
    return 0;
}

// calcRecipe (CraftID, GLV, GGP, TXT)
function calcRecipe {
    array_push(@tmp_alcrep_id, getarg(0));
    array_push(@tmp_alcrep_glv, getarg(1));
    array_push(@tmp_alcrep_ggp, getarg(2));
    array_push(@tmp_alcrep_txt$, getarg(3) + " - GLV "+getarg(1)+", "+format_number(getarg(2))+" GP");
    return;
}

// clearRecipe ()
function clearRecipe {
    deletearray(@tmp_alcrep_id);
    deletearray(@tmp_alcrep_glv);
    deletearray(@tmp_alcrep_ggp);
    deletearray(@tmp_alcrep_txt$);
    @tmp_alcrep_id[0]=-1;
    @tmp_alcrep_glv[0]=-1;
    @tmp_alcrep_ggp[0]=-1;
    @tmp_alcrep_txt$[0]=l("Learn Nothing");
    return;
}

// hudRecipe ()
function hudRecipe {
    .@gid=getcharid(2);
    // Select
    select (implode(@tmp_alcrep_txt$, ":"));
    @menu=@menu-1;

    /* DEBUG prints
    debugmes "You choose: %d", @menu;
    debugmes getd("$RECIPES_ALCHEMY_"+.@gid);
    copyarray(.@v, getd("$RECIPES_ALCHEMY_"+.@gid), getarraysize(getd("$RECIPES_ALCHEMY_"+.@gid)) );
    debugmes "Width: %d (out of %d)", getarraysize(.@v), getarraysize(getd("$RECIPES_ALCHEMY_"+.@gid));
    debugmes "Slot 44: %d", .@v[44];
    debugmes "Slot 43: %d", .@v[43];
    debugmes "Slot 42: %d", .@v[42];
    debugmes "GLVL Options: %d-%d-%d-%d", @tmp_alcrep_glv[0], @tmp_alcrep_glv[1], @tmp_alcrep_glv[2], @tmp_alcrep_glv[3];
    */

    if (@tmp_alcrep_glv[@menu] <= 0)
        return 1;

    if (getguildlvl(.@gid) < @tmp_alcrep_glv[@menu]) {
        mesc l("Insufficient Guild Level! (@@/@@)", getguildlvl(.@gid), @tmp_alcrep_glv[@menu]), 1;
        next;
        return 0;
    }
    if ($GUILD_BANK[.@gid] < @tmp_alcrep_ggp[@menu]) {
        mesc l("Insufficient Guild Money! (Guild has: @@ GP)", format_number($GUILD_BANK[.@gid])), 1;
        next;
        return 0;
    }
    // All fine, proceed
    $GUILD_BANK[.@gid] -= @tmp_alcrep_ggp[@menu];
    setd("$RECIPES_ALCHEMY_"+getcharid(2)+"["+@tmp_alcrep_id[@menu]+"]", true);
    mesc l("Skill learnt!"), 2;
    next;
    return 0;
}

OnInit:
    .distance=2;
    end;
}