summaryrefslogblamecommitdiff
path: root/npc/031-5/beatrice.txt
blob: 711d135351670d8261e497f6707c85ee9a6b5023 (plain) (tree)
1
2
3
4
5
6
7






                                                      





                                                                                                                                                                            







                                                                                                                                                                     










                                                     





                                      









                                                       


























                                                                                                  
                                 
                                                                      
                                                             
                    
                  
                        

                        
                  










                                                      
                               
                                              
                           





                                                                                                                                                
                          



                  











                                                      



                                                                                  
                                                                                                                                                                                                                                                                                                                                                                                                                            







                                       
               

                                   
 




                                   

                             










                                   
                             



                                  
                                
                             
                          










                                      

                      









                                        





                                      
                           
        












                                                                          

 
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Questmaker Handbook 14.0 (F = Favorable)

031-5,97,41,0	script	Beatrice	NPC_SAVIOR_F,{
    // Unlocks upon: Rebirth
    if (!REBIRTH) {
        mesn;
        mesq l("Hey there, %s. What I deal with is too much for your weak bones. So please come again after you are reborn, then I'll have something for you.", get_race());
        close;
    }
    mesn;
    mesq l("Hey there, %s. I deal with ultra rare items. If the Powers That Be decided you're out of luck, well, I am here to help you to bypass it.", get_race());
    next;
    mesn;
    mesq l("For that, I use a special currency - Aethyr points. You can trade rare items for points. I also sell one point for %d GP. So, what will it me?", .price);
    next;

L_Loop:
    mesc l("Aethyr Points: %s", fnum(AETHYR_PTS)), 2;
    select
        l("Nothing right now."),
        l("Buying rares"),
        l("Selling rares"),
        l("Purchasing points");
    mes "";
    switch (@menu) {
    case 1:
        closeclientdialog;
        close;
    case 2:
        openshop;
        closedialog; // Top-Level exit
        end;
    case 3:
        goto L_Seller;
    case 4:
        mesc l("How many points? (0-%d)", Zeny/.price);
        input .@points, 0, Zeny/.price;
        if (.@points * .price > Zeny)
            .@points = 0;
        Zeny-=.price*.@points;
        AETHYR_PTS+=.@points;
        mesc l("Done!"), 2;
        break;
    }
    clear;
    goto L_Loop;

L_Seller:
    .@id = 0;
    .@rt = 0;
    .@pc = 0;
    .@am = 0;

    .@mr$=sprintf("%d.%02d", .ratio/100, .ratio%100);
    mesc l("Only items with max %s%% drop rate are accepted!", .@mr$), 1;
    .@id = requestitem();
    if (.@id < 1) goto L_Cont;
    if (checkbound(.@id)) goto L_Cont;
    .@rt = getiteminfo(.@id, ITEMINFO_MAXCHANCE);
    // Some items are... special. Refuse them.
    if (.@rt == 0)
        .@rt=10000;
    if (array_find(.blacklist, .@id) >= 0)
        .@rt=10000;

    .@mb$=sprintf("%d.%02d", .@rt/100, .@rt%100);
    if (.@rt > .ratio) {
        mesc l("This item drop rate is %s%%, which exceeds the threshold of %s%%.", .@mb$, .@mr$);
        next;
        goto L_Cont;
    }
    //debugmes "Ratio %s", .@mb$;
    .@pc = 1+.ratio-(.@rt); // The reverse, so it goes from 1 to ratio
    // Bonus points for when quadratic scaling apply (42 pts)
    if (.@pc >= 100)
        .@pc += 4;
    else if (.@pc >= 99)
        .@pc += 2;
    else if (.@pc >= 98)
        .@pc += 1;
    // These values may be incorrect due to truncation
    // 0.01% = 1144 pts
    // 0.02% = 1122 pts
    // 0.03% =  990 pts
    // 0.04% =  970 pts
    // 0.05% =  960 pts
    // 0.10% =  910 pts
    // 0.12% =  810 pts
    // 0.50% =  306 pts
    // 0.90% =   22 pts
    // 1.00% =    2 pts
    // Sanitization and Scaling
    .@pc *= (.@pc < 10 ? 2 : 1) + (.@pc / 10);
    .@pc = min(.@pc, 1200);
    mesn;
    mesq l("I offer you %s Aethyr Points per unit of %s. How many do you wish to sell? (0-%d)", fnum(.@pc), getitemlink(.@id), countitem(.@id));
    input .@am, 0, countitem(.@id);
    if (.@am < 1)
        goto L_Cont;
    delitem .@id, .@am;
    AETHYR_PTS+=.@pc*.@am;
    // FALLTHROUGH

L_Cont:
    clear;
    goto L_Loop;

OnInit:
    .@npcId = getnpcid(.name$);
    setunitdata(.@npcId, UDT_HEADBOTTOM, CottonSkirt);
    setunitdata(.@npcId, UDT_HEADMIDDLE, SaviorArmor);
    setunitdata(.@npcId, UDT_HEADTOP, TrapperHat);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 9);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 18);

    .sex = G_FEMALE;
    .distance = 5;
    .price = 520; // Loosely ased on Crafty Wings price
    .ratio = 100; // Max drop rate
    // Some items can be obtained by "other means" and thus, their value cannot be
    // reliably calculated
    setarray .blacklist, GuildCoin, WarlordPlate, Lightsaber, PowerfulLightsaber, Emperium, PinkieCrystal, PinkieHat, IronIngot, Kanabo, WarlordHelmet, Kitana, LeatherGloves, SacredManaPotion, EverburnPowder, WoodenSword, MoubooFigurine, FancyHat, LOFCoin, JeansShorts, MinerHat, LeatherShield, Boots, CommonCarp, IcedBottle, ShortBow, CottonShirt, MinerGloves, LoveLetter, LegendaryTortuga, ChocolateDye, Quill;

	tradertype(NST_CUSTOM);
    // Okay, so for the catalog
    /* Some important prices
        Crystallized Maggot - 1,200 pts
        Light Green Diamond - 1,176 pts
        Amethyst - 384 pts
       TL;DR From 12 to 1200 pts */
    // Failsafe
    //sellitem SunnyCrystal, 50000;
    //sellitem MylarinDust,  15000;

    // Rare equips
    sellitem HeartNecklace, 7500;
    sellitem MoubiHat, 7500;
    sellitem BloodyMoubooHat, 7000;
    sellitem AlphaMoubooHat, 6500;
    sellitem LightRing, 6500;
    sellitem ThetaRing, 6500;
    sellitem MoubooHat, 6000;
    sellitem AntlersHat, 6000;
    sellitem FluffyHat, 6000;
    sellitem ShroomHat, 6000;
    sellitem CaveSnakeHat, 6000;
    sellitem SantaBeardHat, 6000;
    sellitem MushHat, 6000;
    sellitem ForestShroomHat, 6000;
    sellitem WickedShroomHat, 6000;
    sellitem MoonshroomHat, 6000;
    sellitem TerraniteMask, 6000;
    sellitem OperaMask, 6000;
    sellitem DragonStar, 6000;
    sellitem Kanabo, 6000;
    sellitem FourLeafClover, 6000;
    sellitem IceGladius, 6000;
    sellitem CursedScythe, 6000;
    sellitem PinkieHat, 5500;
    sellitem Setzer, 5500;

    // Rare non-equips are cheaper
    sellitem Bloodstone, 5000;
    sellitem Butterfly, 5000;
    sellitem CrystallizedMaggot, 5000;
    sellitem PirateTreasureMap, 5000;
    sellitem BlueManaPearl, 5000;
    sellitem DesertTablet, 5000;
    sellitem LavaManaPearl, 5000;
    sellitem LightGreenDiamond, 5000;
    sellitem BlackPearl, 5000;

    // "Kinda generic"
    sellitem BanditPants, 2500;
    sellitem CentaurSpear, 2500;
    sellitem DarkDesertMushroom, 2500;
    sellitem SkullMask, 2500;
    sellitem BunnyEars, 2500;
    //sellitem TerraniteBlueprint, 2500;
    sellitem Quill, 2400;
    sellitem CopperKey, 2400;
    sellitem SilverMirror, 2400;
    sellitem GoldenApple, 2400;
    sellitem SaxsoKey, 1200;

    // Not drops
    sellitem StrangeCoin, 1000;
    sellitem BottleOfDivineWater, 600;
	sellitem Curshroom, 300;
	sellitem Coal, 250;
    end;

OnCountFunds:
	setcurrency(AETHYR_PTS);
	end;

/* @price is total cost. @points is if we accept two items as currency. */
OnPayFunds:
	if( AETHYR_PTS < @price )
		end;
	AETHYR_PTS -= @price;
	purchaseok();
	end;

}