summaryrefslogblamecommitdiff
path: root/npc/029-1/rewards_master.txt
blob: 972c2bef2a87b341864741ab9e0f40c2ab76daa2 (plain) (tree)
1
2
3
4
5
6
7
8






                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                                                 










































































































































                                                                                                                        
029-1,47,97,0	script	Ishi	NPC106,{
    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";
    //if magic: "AlizarinScroll", "CobaltScroll", "GambogeScroll", "MauveScroll";

    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;

    @i = 0;
    setarray @Menu$, "", "", "", "", "", "", "", "", "", "", "", "";
    callsub S_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;

    @req = @menu;
    @rec = 0;
    goto L_Item_Loop;

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

    callsub S_give_item;
    @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.
    @gotocounter = 50;
    goto L_Give_all_loop;

L_Give_all_loop:
    @gotocounter = @gotocounter - 1;
    if (@gotocounter < 1) goto L_Give_all_next;
    @itemgiveerror = 0;
    callsub S_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:
    @gotocounter = 0;
    @itemgiveerror = 0;
    @pts = 0;
    @dif = 0;
    @i = 0;
    cleararray @Menu$[0], "", 10;
    cleararray @items$[0], "", 10;
    close;


S_prep_menu:
    @pts = Mobpt;
    @dif = tvis;
    goto L_Menu_Loop;

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

    @Menu$[@i] = @i + 1;

    @i = @i + 1;
    @pts = @pts - @dif;
    @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;
        @Menu$[@i] = "Please give me as many as I deserve!";
        @i = @i + 1;
    goto L_Menu_Done;

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

S_give_item:
    @itemgiveerror = 0;
    getinventorylist;
    if (@inventorylist_count == 100) goto S_give_noinv;
    if (Mobpt < tvis) goto S_give_nomobpts;
    Mobpt = Mobpt - tvis;
    tvis = tvis + 1;
    @item$ = @items$[rand(getarraysize(@items$))];

    getitem @item$, 1;

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

S_give_noinv:
    mes "Your inventory is full!";
    @itemgiveerror = 1;
    return;

S_give_nomobpts:
    mes "It looks like your Monster Points were over estimated.";
    @itemgiveerror = 1;
    return;
}