summaryrefslogblamecommitdiff
path: root/npc/guilds/logs.txt
blob: 27d47c42d02ccfc9cd37b8daf5bf82660cc1ffb3 (plain) (tree)
1
2
3
4
5
6
7
8
9






                                                       

                        
                       









                                                         






                                                                                 
                                       


























                                                                                   

                                                           

                                  
 






                                                                                              
 
                                       
                      


                         

          

                                                            

                                                     
                        


















                                                                                       











                                  
                                                       




















                                                                                                     




                
// Moubootaur Legends Script
// Author:
//    Jesusalva
// Description:
//  Guild Facility - Contains recipe list

guilds,47,39,0	script	Guild Logs	NPC_NO_SPRITE,{
    function showRecipe;
    function calcRecipe;
    .@gid=getcharid(2);

    mes ".:: " + l("Alchemy Recipes") + " ::.";
    showRecipe(CraftPiberriesInfusion, PiberriesInfusion,
               5, Piberries, 1, Curshroom);
    showRecipe(CraftSacredManaPot, SacredManaPot,
               1, GoldenApple, 15, CelestiaTea);
    showRecipe(CraftSacredLifePot, SacredLifePot,
               1, GoldenApple, 1, ElixirOfLife);


    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;
                    skill GD_EXTENSION, getskilllv(GD_EXTENSION)+1, 0;
                    break;
                }
                break;
            case 3:
                mes ".:: " + l("Alchemy Recipes") + " ::.";
                do {
                    clearRecipe();

                    // Setup the Recipes
                    if (!showRecipe(CraftPiberriesInfusion, false))
                        calcRecipe(CraftPiberriesInfusion, 3, 10000, l("Piberries Infusion"));
                    if (!showRecipe(CraftSacredManaPot, false))
                        calcRecipe(CraftSacredManaPot, 5, 100000, l("Sacred Mana Potion"));
                    if (!showRecipe(CraftSacredLifePot, false))
                        calcRecipe(CraftSacredLifePot, 5, 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 {
    if ($RECIPES_ALCHEMY[getcharid(2)] & getarg(0)) {
        if (getarg(1)) {
            mesn l("Craft @@", getitemlink(getarg(1)));
            mesc l("* @@ @@", getarg(2), getitemlink(getarg(3)));
            mesc l("* @@ @@", getarg(4), getitemlink(getarg(5)));
            mes "";
        }
        return 1;
    }
    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)+", "+getarg(2)+" GP");
    return;
}

// clearRecipe ()
function clearRecipe {
    deletearray(@tmp_alcrep_id);
    deletearray(@tmp_alcrep_glv);
    deletearray(@tmp_alcrep_ggp);
    deletearray(@tmp_alcrep_txt$);
    return;
}

// hudRecipe ()
function hudRecipe {
    // Select
    select (implode(@tmp_alcrep_txt$, ":")+":Nothing");
    if (@tmp_alcrep_glv[@menu] == 0)
        return 1;

    if (getguildlvl(.@gid) < @tmp_alcrep_glv[@menu]) {
        mesc l("Insufficient Guild Level!"), 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];
    $RECIPES_ALCHEMY[getcharid(2)]=$RECIPES_ALCHEMY[getcharid(2)]|@tmp_alcrep_id[@menu];
    mesc l("Skill learnt!"), 2;
    next;
    return 0;
}

OnInit:
    .distance=2;
    end;
}