summaryrefslogblamecommitdiff
path: root/npc/020-5/bracco.txt
blob: 8510c59749460d9e53514ba0fbadff019f6c5b72 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                                                    












                                                                                                                                      




                                                                                 



                                                                                                                                   
                          

                      
                                                                            


                                                                    
                                                 
                                                   

                                                                                     




                  








































                                                                                                                   
               









                                                      
                                          
                   
           



                     


                        



















                                                                                                                 
                                                                                  

                  
                                                                                

                  
                                                                            



                  




                                                                                                                                                                   

                 





                                                                           


                                                                  
                    

                                                                     
                    
                                                                     

               
                                                                  

                    
                                                                  

                
                                                                         
              














                                                                                  





                                                        
                                                                                









                                                                                                              
                                                                                                                                      



                                                                                                                                
















                                                                       





                                                                                                    



                                   

                    


































                                                       
// TMW-2 Script
// Author:
//    Jesusalva
// Description:
//    Nivalis shopkeeper & forge master. He deals with the equipment which Nicholas,
//    Silversmith and Nahred doesn't works with.

020-5,31,25,0	script	Bracco	NPC_M_SHOPKEEPER,{
    goto L_Start;
    // Meltdown( item, price, {id1, amount1}, {id2, amount2}... )
    function Meltdown {
        if (getargcount() < 2 || getargcount() % 2 != 0)
            return Exception("Faulty learning Meltdown command invoked - error");

        .@index=getarg(0);
        .@price=getarg(1);
        mesn;
        mesc l("Really melt down your @@? It'll cost you @@ GP. This action cannot be undone!", getinvindexlink(.@index), .@price), 1;
        next;
        if (askyesno() == ASK_NO || Zeny < .@price)
            return;

        //failedremovecardsindex .@index, 0; // TODO: Fix this and upgrade server
        delinventorylist();
        getinventorylist();
        .@item=@inventorylist_id[.@index];

        if (.@item <= 0) {
            Exception(l("Error translating item ID @@ to @@ (Bracco, idx, id)", .@index, .@item), RB_DEFAULT|RB_SPEECH|RB_ISFATAL);
        }

        delitem .@item, 1;
        Zeny-=.@price;

        mesc l("@@ melt down your @@...", .name$, getinvindexlink(.@index));
        // TODO: Inventoryplace
        // Add Items (if inventory is full, your fault and not mine)
        for (.@i=2;.@i < getargcount(); .@i++) {
            if (getarg(.@i+1)) {// It may be zero
                getitem getarg(.@i), getarg(.@i+1);
                mesc l("* Acquired @@ @@!", getarg(.@i+1), getitemlink(getarg(.@i)));
            }
            .@i++;
        }
        return;
    }

    // blacksmith_create( BaseItem1, Amount, BaseItem2, Amount, PrizeItem, Price )
    function blacksmith_create {
        .@base1=getarg(0);
        .@amon1=getarg(1);
        .@base2=getarg(2);
        .@amon2=getarg(3);
        .@prize=getarg(4);
        .@price=getarg(5);

        mesn;
        mesq l("Do you want to craft @@? For that I will need:", getitemlink(.@prize));
        mesc l("@@/@@ @@", countitem(.@base1), .@amon1, getitemlink(.@base1));
        mesc l("@@/@@ @@", countitem(.@base2), .@amon2, getitemlink(.@base2));
        mesc l("@@/@@ GP", format_number(Zeny), format_number(.@price));

        select
            l("Yes"),
            l("No");

        if (@menu == 2)
            return;

        if (countitem(.@base1) >= .@amon1 &&
            countitem(.@base2) >= .@amon2 &&
            Zeny >= .@price) {
            inventoryplace .@prize, 1;
            delitem .@base1, .@amon1;
            delitem .@base2, .@amon2;
            Zeny = Zeny - .@price;
            getitem .@prize, 1;
            .@xp=getiteminfo(.@base1, ITEMINFO_SELLPRICE)*.@amon1+getiteminfo(.@base2, ITEMINFO_SELLPRICE)*.@amon2;
            .@xp=.@xp*2/3;
            getexp .@xp, rand(1,10);

            mes "";
            mesn;
            mesq l("Many thanks! Come back soon.");
        } else {
            speech S_FIRST_BLANK_LINE,// | S_LAST_NEXT,
                    l("You don't have enough material, sorry.");
        }
        return;
    }

// Start
L_Start:
    mesn;
    mesq l("Welcome to my fine establishment!");
    mes "";
    select
        l("Trade"),
        l("I'm actually looking for an item forged!"),
        l("I would like an item melted!"),
        l("Leave");
    mes "";

    if (@menu == 2)
        goto L_Forge;

    if (@menu == 3)
        goto L_Meltdown;

    closedialog;
    if (@menu == 1)
        shop .name$;
    goodbye;
    close;
// Note: the prices are absurd atm, but hey hey, every single one of them are cap items currently
L_Forge:
    mesn;
    mesq l("Well, if you want warrior craft, perhaps you should look for @@ or @@.", l("Nicholas"), l("Nahrec"));
    mes "";
    select
        l("Nothing, sorry!"),
        l("I want leather armbands!"),
        l("I want copper armbands!"),
        l("I want iron armbands!");
    mes "";
    switch (@menu) {
        case 1:
            close; break;
        case 2:
            blacksmith_create(LeatherPatch, 50, TitaniumIngot, 1, Armbands, 6500);
            break;
        case 3:
            blacksmith_create(CopperIngot, 30, Coal, 40, CopperArmbands, 11000);
            break;
        case 4:
            blacksmith_create(IronIngot, 90, Coal, 80, IronArmbands, 21000);
            break;
    }
    goto L_Forge;

L_Meltdown:
    mesn;
    mesc l("What item do you want to melt down? This is irreversible, and may return some ingots to you, but there is no way to tell how many you'll receive!"), 1;
    mesc l("Each item have it's own tax.");
    .@it=requestitemindex();
    if (.@it < 0)
        close;
    delinventorylist();
    getinventorylist();
    .@id=@inventorylist_id[.@it];
    mes "";
    // Returns 50~70% of invested ingots, rounded down. Never returns Coal.
    switch (.@id) {
    case SilverMirror:
        Meltdown(.@it, 500, SilverOre, rand2(5, 10)); // Exception
        break;
    case RustyKnife:
        Meltdown(.@it, 15, IronOre, any(0, 0, 0, 1, 1)); // Exception
        break;
    case SmallKnife:
        Meltdown(.@it, 15, IronOre, any(0, 0, 1, 1, 1)); // Exception
        break;
    case Knife:
        Meltdown(.@it, 25, IronOre, any(0, 1, 1, 2)); // Exception
        break;
    case SharpKnife:
        Meltdown(.@it, 50, IronOre, any(1, 2, 2, 3)); // Exception
        break;
    case Dagger:
        Meltdown(.@it, 100, IronOre, any(2, 2, 3, 3, 4, 5)); // Exception
        break;
    case WoodenSword:
        Meltdown(.@it, 500, WoodenLog, rand2(5,10)); // Exception: 25~50% returned
        break;
    case BugSlayer:
        Meltdown(.@it, 1000, IronIngot, rand2(4,5));
        break;
    case ShortGladius:
        Meltdown(.@it, 1500, IronIngot, rand2(6,8));
        break;
    case Backsword:
        Meltdown(.@it, 2000, IronIngot, rand2(9,12), TinIngot, rand2(1,2));
        break;
    case ShortSword:
        Meltdown(.@it, 2500, IronIngot, rand2(12,16), TinIngot, rand2(2,3));
        break;
    case MiereCleaver:
        Meltdown(.@it, 2000, SilverIngot, rand2(6,8));
        break;
    case Broadsword:
        Meltdown(.@it, 2000, SilverIngot, rand2(13,18));
        break;
    // Wands have no warranted min. and are more expensive because they are sold
    case TrainingWand:
        Meltdown(.@it, 12000, WoodenLog, rand2(1,14), ManaPiouFeathers, rand2(0, 21), FluoPowder, rand2(0,3));
        break;
    case NoviceWand:
        Meltdown(.@it, 12000, WoodenLog, rand2(2,28), ManaPiouFeathers, rand2(1, 42), FluoPowder, rand2(0,5));
        break;
    case ApprenticeWand:
        Meltdown(.@it, 12000, WoodenLog, rand2(3,42), ManaPiouFeathers, rand2(2, 63), FluoPowder, rand2(0,8));
        break;
    case LeaderWand:
        Meltdown(.@it, 12000, WoodenLog, rand2(5,70), ManaPiouFeathers, rand2(3, 84), FluoPowder, rand2(2,10), GemPowder, any(0,0,1));
        break;
    case LegendaryWand:
        Meltdown(.@it, 12000, WoodenLog, rand2(7,77), GoldenApple, rand2(0, 1), FluoPowder, rand2(4,14), GemPowder, rand2(1,3));
        break;
    // Shields - same rule (except leather shield)
    case RoundLeatherShield:
        Meltdown(.@it, 500, LeatherPatch, rand2(0,1));
        break;
    case LeatherShield:
        Meltdown(.@it, 500, LeatherPatch, rand2(1,3));
        break;
    case WoodenShield:
        Meltdown(.@it, 1500, WoodenLog, rand2(20,28), LeatherPatch, 1);
        break;
    case BladeShield:
        Meltdown(.@it, 1500, IronIngot, rand2(7,9), TitaniumIngot, 1);
        break;
    // Etc
    case GoldenRing:
        Meltdown(.@it, 1500, GoldPieces, rand2(2,3));
        break;
    default:
        mesn;
        mesq l("I cannot melt this. I only melt down equipment, and not everything I know how to!");
        next;
        break;
    }
    mesc l("Melt something else?");
    if (askyesno() == ASK_NO)
        close;
    mes "";
    goto L_Meltdown;

OnInit:
    .@npcId = getnpcid(.name$);
    setunitdata(.@npcId, UDT_HEADTOP, NPCEyes);
    setunitdata(.@npcId, UDT_HEADMIDDLE, TneckSweater);
    setunitdata(.@npcId, UDT_HEADBOTTOM, RaidTrousers);
    setunitdata(.@npcId, UDT_WEAPON, FurBoots);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 26);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 2);

    tradertype(NST_MARKET);
    sellitem LeatherShirt, 15000, 1;
    sellitem LeatherShield, 5000, 1;
    sellitem ShortBow, 11200, 1;
	sellitem ArrowAmmoBox,-1,rand(8,12);
	sellitem IronAmmoBox,-1,rand(3,5);

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

OnWed0000:
OnThu0400:
OnFri0800:
OnSat1200:
OnSun1600:
OnMon2000:
    restoreshopitem LeatherShirt, 15000, 1;
    restoreshopitem LeatherShield, 5000, 1;
    restoreshopitem ShortBow, 11200, 1;
	restoreshopitem ArrowAmmoBox,rand(8,12);
	restoreshopitem IronAmmoBox,rand(3,5);
    end;

}