summaryrefslogblamecommitdiff
path: root/npc/020-1/trainer.txt
blob: 1fb4774accec98183bf6f56329b0d0e10336f40e (plain) (tree)






































































































































































                                                                                                                                                                 
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Mercenary Trainer

020-1,39,89,0	script	Mercenary Trainer	NPC_REDY_MALE_SWORD,{
    mesn;
    mesq l("Hello, I am a sword to hire, a Mercenary Trainer and Chief.");
    next;
    mesn;
    mesq l("Do you want to hire a mercenary? Or perhaps get a card so you can invoke them later? I can even make them stronger if you wish.");
    next;
    goto L_Main;

L_Main:
    select
        l("Hire a mercenary"),
        l("Buy a mercenary card"),
        l("Evolve mercenaries"),
        l("Bye.");
    mes "";
    switch (@menu) {
        // Hire Card
        case 1:
            menuint
                l("[%d GP] [Lv 1~25] Hire for one hour", 2500), 1,
                l("[%d GP] [Lv 26~40] Hire for one hour", 7500), 2,
                l("[%d GP] [Lv 41~60] Hire for one hour", 15000), 3,
                l("[%d GP] [Lv 61~79] Hire for one hour", 30000), 4,
                l("[%d GP] [Lv 80~100] Hire for one hour", 50000), 5,
                l("I've changed my mind"), 0;
            switch (@menuret) {
                case 1:
                    .@gp=max(2000, POL_AdjustPrice(2500));
                    if (Zeny < .@gp) {
                        mesc l("You cannot pay."), 1;
                        next;
                    } else {
                        .@mid=merc_randid(0, 0, 0, 0, 1000);
                        mercenary_create(.@mid, 3600000);
                        POL_PlayerMoney(.@gp);
                    }
                    break;
                case 2:
                    .@gp=max(7000, POL_AdjustPrice(7500));
                    if (Zeny < .@gp) {
                        mesc l("You cannot pay."), 1;
                        next;
                    } else {
                        .@mid=merc_randid(0, 0, 0, 1000, 0);
                        mercenary_create(.@mid, 3600000);
                        POL_PlayerMoney(.@gp);
                    }
                    break;
                case 3:
                    .@gp=max(14000, POL_AdjustPrice(15000));
                    if (Zeny < .@gp) {
                        mesc l("You cannot pay."), 1;
                        next;
                    } else {
                        mercenary_create merc_randid(0, 0, 1000, 0, 0), 3600000;
                        POL_PlayerMoney(.@gp);
                    }
                    break;
                case 4:
                    .@gp=max(27000, POL_AdjustPrice(30000));
                    if (Zeny < .@gp) {
                        mesc l("You cannot pay."), 1;
                        next;
                    } else {
                        mercenary_create merc_randid(0, 1000, 0, 0, 0), 3600000;
                        POL_PlayerMoney(.@gp);
                    }
                    break;
                case 5:
                    .@gp=max(45000, POL_AdjustPrice(50000));
                    if (Zeny < .@gp) {
                        mesc l("You cannot pay."), 1;
                        next;
                    } else {
                        mercenary_create merc_randid(1000, 0, 0, 0, 0), 3600000;
                        POL_PlayerMoney(.@gp);
                    }
                    break;
                default:
                    break;
            }
            break;
        // Buy Card
        case 2:
            npcshopattach(.name$);
            openshop;
            closedialog;
            close;
            break;
        // Evolve Card
        case 3:
            mesn;
            mesq l("Give me %s cards of the same type, and I'll give you one card of a higher rarity. There is no cost, but the card is random.", b(l("three")));
            next;
            mes "##B" + l("Drag and drop an item from your inventory.") + "##b";

            .@card = requestitem();
            if (.@card <= 1) break;
            if (countitem(.@card) < 3) {
                mesc l("You need at least %d cards of same kind.", 3), 1;
                break;
            }
            .@st = merc_getstar(.@card);
            if (.@st < 1 || .@st >= 5) {
                mesc l("This cannot be evolved."), 1;
                break;
            }
            delitem .@card, 3;
            merc_boxset(
                        (.@st == 4 ? 1000 : 0),
                        (.@st == 3 ? 1000 : 0),
                        (.@st == 2 ? 1000 : 0),
                        (.@st == 1 ? 1000 : 0),
                        0);
            mesn;
            mesq l("Here you go! Wasn't this a sweet deal?");
            break;
        // Leave
        default:
            closeclientdialog;
            goodbye;
            close;
            break;
    }
    goto L_Main;

OnInit:
	tradertype(NST_MARKET);
    sellitem MercBoxEE, 25000, 1;
    sellitem MercBoxDD, 15000, 2;
    sellitem MercBoxCC, 7500, 3;
    sellitem MercBoxBB, 3750, 4;
    sellitem MercBoxAA, 1250, 5;

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

OnClock0001:
OnClock1201:
    restoreshopitem MercBoxEE, 25000, 1;
    restoreshopitem MercBoxDD, 15000, 2;
    restoreshopitem MercBoxCC, 7500, 3;
    restoreshopitem MercBoxBB, 3750, 4;
    restoreshopitem MercBoxAA, 1250, 5;
    end;

// Pay your taxes!
OnBuyItem:
    debugmes("Purchase confirmed");
    PurchaseTaxes("Nival");
    end;

OnSellItem:
    debugmes("Sale confirmed");
    PurchaseTaxes("Nival");
    end;

}