summaryrefslogblamecommitdiff
path: root/npc/003-1/ishi.txt
blob: 7e6b26f77ad3b79798f7b6e1df020af0a33252c1 (plain) (tree)
1
2
3
4
5
6
7
8
9
10





                                  
                                    


                                            
                     

















                                                                                                                                 

                                                                               



























































































                                                                                                                    
                                 
                                                               
                                                                 




                                                                                     
                           
                                         
             
                                                       




































































                                                                                                                                              



                                                              







                                            
// TMW-2 Script
// Author: 
// Crazyfefe
// Jesusalva
// 
// Do not add void items to array.
// note : the rare item system suck.

003-1,97,97,0	script	Ishi	NPC_PLAYER,{

    if (MPQUEST == 0)
    {
        mesn l("Ishi, the Rewards Master");
        mesq l("Hey, it seems like you didn't register as a Monster Hunting Quest participant yet! You can sign up with Aidan.");
        close;
    }


    if (Mobpt < BaseLevel ** 2)
    {
        mesn l("Ishi, the Rewards Master");
        mesq l("Welcome! I see you have @@ Monster Points. But that isn't enough to get items, sorry!", Mobpt);
        close;
    }

    setarray @Items$,   "Bread", "Croconut","Plushroom",
                        "RedApple","Beer","Candy","Orange","ChocolateBar","BugLeg","CoinBag",
                        "Coal","SnakeSkin","CottonCloth","GrassSeeds","HardSpike","CobaltHerb","GambogeHerb",
                        "MauveHerb","IronOre","MaggotSlime","RawLog","ScorpionStinger","SilkCocoon","TreasureKey",
                        "FluffyFur","EmptyBottle","RustyKnife","BlueCottonDye";
    setarray @Rares$,   "BrimmedHat", 5, "IronIngot", 10, "BronzeGift", 10;

    mesn l("Ishi, the Rewards Master");
    mesq l("Welcome! I see you have @@ Monster Points. Would you like to exchange some of those for items?", Mobpt);
    next;

    do
    {
        select
            rif(Mobpt >= BaseLevel ** 2,l("1")),
            rif(Mobpt >= (BaseLevel ** 2)*2,l("2")),
            rif(Mobpt >= (BaseLevel ** 2)*3,l("3")),
            rif(Mobpt >= (BaseLevel ** 2)*4,l("4")),
            rif(Mobpt >= (BaseLevel ** 2)*5,l("5")),
            rif(Mobpt >= (BaseLevel ** 2)*6,l("6")),
            rif(Mobpt >= (BaseLevel ** 2)*7,l("7")),
            rif(Mobpt >= (BaseLevel ** 2)*8,l("8")),
            rif(Mobpt >= (BaseLevel ** 2)*9,l("9")),
            rif(Mobpt >= (BaseLevel ** 2)*10,l("10")),
            rif(Mobpt >= (BaseLevel ** 2)*11,l("Gimme as many as I deserve!")),
            l("Sorry, I have to go now.");

        switch (@menu)
        {
            case 1 :
                @var = 1;
                goto L_Items;
                break;
            case 2 :
                @var = 2;
                goto L_Items;
                break;
            case 3 :
                @var = 3;
                goto L_Items;
                break;
            case 4 :
                @var = 4;
                goto L_Items;
                break;
            case 5 :
                @var = 5;
                goto L_Items;
                break;
            case 6 :
                @var = 6;
                goto L_Items;
                break;
            case 7 :
                @var = 7;
                goto L_Items;
                break;
            case 8 :
                @var = 8;
                goto L_Items;
                break;
            case 9 : 
                @var = 9;
                goto L_Items;
                break;
            case 10 :
                @var = 10;
                goto L_Items;
                break;
            case 11 :
                goto L_Give_all;
                break;
            default :
                goto L_Close;
                break;
        }
    } while (@menu != 12);

    closedialog;
    goodbye;
    close;

L_Close:
    @var =0;
    close;

L_Items:
    debugmes "Reaching item loop";
    for (.@i = 0; .@i < @var; .@i ++)
    {
        debugmes "Items: "+str(@var);
        .@lucked=0;
        .@reward$="";
        getinventorylist;
        if (@inventorylist_count == 100)
            goto L_NoPlace;

        debugmes "Testing rares";
        @lucky = rand(10000) + 1;
        for (.@b = 0; .@b < getarraysize(@Rares$); .@b=.@b+2) {
            debugmes "Checking "+@Rares$[.@b]+" - b is now "+.@b;
            debugmes l("Check @@ <= @@", @lucky, @Rares$[.@b+1]);
            if (.@b == 0)
                @control = 0;
            if(@lucky >= (@control + 1) && @lucky <= @control + atoi(@Rares$[.@b+1]))
            {
                .@lucked=1;
                .@reward$ = @Rares$[.@b];
            }
            @control = @control + atoi(@Rares$[.@b+1]);
        }

        debugmes "Setting reward"; // could be if (!.@lucked) but for sanity...
        if (.@reward$ == "")
            set .@reward$, @Items$[rand(getarraysize(@Items$))];

        debugmes "Check weight";
        .@weight = checkweight(.@reward$,1);
        if (!.@weight)
            goto L_NoPlaceWeight;

        debugmes "Processing...";
        Mobpt = Mobpt - BaseLevel ** 2;
        getitem .@reward$,1;

        debugmes "Printing...";
        if (.@lucked) {
            mes "";
            mes l("Wow!");
            mes l("I can't believe.");
            mes l("you got lucky and got a(n) @@!", getitemlink(.@reward$));
            mes "";
        } else {
            mesq l("You received one @@!", getitemlink(.@reward$));
        }

    }
    close;

L_Continue:
    mesq l("You still have @@ Monster Points! Do you want more items?", Mobpt);
    do
        {
        select
            l("Yes"),
            l("No");

        switch (@menu)
        {
            case 1:
                goto L_Give_all;
                break;
            case 2:
                goto L_Close;
                break;
        }
        } while (@menu != 2);

L_NoPlace :
    mesq l("You seem to run out of place, you should go to the storage.");
    close;

L_NoPlaceWeight :
    mesq l("You can't carry more items, you should go to the storage.");
    close;

L_Give_all:
    @var = Mobpt / BaseLevel ** 2;
    if (@var > 50) { // limit to avoid lag server. Probably a bad idea.
        @var = 50;
        mes l("You have too much points. I can't allow you to take all at once right now. I'll try to give you 50, and you come back later!");
        next;
    }

    goto L_Items;
    close;

OnInit:
    .@npcId = getnpcid(0, .name$);
    //setunitdata(.@npcId, UDT_HEADTOP, NPCEyes);
    setunitdata(.@npcId, UDT_HEADMIDDLE, LegionCopperArmor);
    setunitdata(.@npcId, UDT_HEADBOTTOM, CottonTrousers);
    setunitdata(.@npcId, UDT_WEAPON, DeepBlackBoots); // Boots
    setunitdata(.@npcId, UDT_HAIRSTYLE, 4);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 13);

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