summaryrefslogblamecommitdiff
path: root/npc/functions/resetstatus.txt
blob: eb5d0cfc59ac9909e6b3100488706725280f3e68 (plain) (tree)
1
2
3
4
5
6
7
8
9






                                         
                                            
                                       

                                                 






                                                     


                                                        
                                                    


                       
                                                   


                       
                                                    


                       
                                                        


                       
                                                     


                       
                                                





                       

                                        
                                                 


                                                         



                                                              


                                   

                                                     

                                                                            





















                                                                                                                       
                                                                       
                                  
                                  

                                                                              


                                                                           

                                                                 
                                                               
















                                                                                                            
// TMW2 Script.
// Authors:
//    Vasily_Makarov (original from Evol)
//    Jesusalva
// Description:
//    Status Reset NPC utils

// Reset status and return permanent bonuses
// StatusResetReinvest( {script=True} )
function	script	StatusResetReinvest	{
    // Compulsory check
    if (getarg(0, true)) {
        inventoryplace NPCEyes, 6;
    } else if (!checkweight2(NPCEyes, 6)) {
        getitembound StatusResetPotion, 1, 4;
        dispbottom l("You cannot carry the fruits.");
        end; // Die
    }

    // Permanent boosts were now lost, return the fruits
    if (STATUSUP_STR) {
        getitembound StrengthFruit, STATUSUP_STR, 4;
        STATUSUP_STR=0;
    }
    if (STATUSUP_AGI) {
        getitembound AgilityFruit, STATUSUP_AGI, 4;
        STATUSUP_AGI=0;
    }
    if (STATUSUP_VIT) {
        getitembound VitalityFruit, STATUSUP_VIT, 4;
        STATUSUP_VIT=0;
    }
    if (STATUSUP_INT) {
        getitembound IntelligenceFruit, STATUSUP_INT, 4;
        STATUSUP_INT=0;
    }
    if (STATUSUP_DEX) {
        getitembound DexterityFruit, STATUSUP_DEX, 4;
        STATUSUP_DEX=0;
    }
    if (STATUSUP_LUK) {
        getitembound LuckFruit, STATUSUP_LUK, 4;
        STATUSUP_LUK=0;
    }
    resetstatus();
    return true;
}

// Return wasSP on success, 0 on failure
// ConfirmReset( {price} )
function	script	ConfirmStatusReset	{
    if (BaseLevel >= 15)
        .@plush_count=(1000-BaseLevel*10+(BaseLevel*18));
    else if (BaseLevel >= 10)
        .@plush_count=(BaseLevel*210-(10*210))/(BaseLevel/10);
    else
        .@plush_count=1;

    if (getarg(0,-1) >= 0)
        .@plush_count=getarg(0,-1);

	.@plush_count=POL_AdjustPrice(.@plush_count);

    mesc l("WARNING: Permanent boosts will return to their fruit form."), 1;

    switch (select(lg("Yes, I am sure."),
                   lg("I need to think about it..."),
                   lg("I won't need it, thank you.")))
    {
        case 1:
            speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
                l("Let me just have a quick look at you. Hm... I will need @@ GP to reset your stats.", .@plush_count);

            select
                rif(Zeny >= .@plush_count, l("Here, take as much as you need, I have plenty!")),
                rif(Zeny > 0 && Zeny < .@plush_count, l("I don't have enough money...")),
                rif(Zeny == 0, l("Oh no, I don't have any money on me right now.")),
                l("I have to go, sorry.");

            if (@menu > 1) {
                return 0;
            }

            speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
                l("Thank you."),
                l("Now stand still... It should not take much time...");

            // Reset status have an inventorycheck, so we charge later.
            .@wasSP = StatusPoint;
            StatusResetReinvest();

            // Nothing to do: Do not charge (eg. you just got the fruits back)
            if (StatusPoint == .@wasSP) {
                speech S_LAST_NEXT,
                    l("It seems that you have no status points to reset!"),
                    l("Come back when you will really need me.");
            } else {
				POL_PlayerMoney(.@plush_count);
                speech S_LAST_NEXT,
                    l("Let's see... @@ of your status points have just been reset!", StatusPoint - .@wasSP),
                    l("Spend it wisely this time."),
                    l("But you are welcome to reset your stats again! I need the money.");
            }
            return .@wasSP;

        case 2:
            return 0;
        case 3:
            return 0;
    }
    Exception("Unknown Error: ConfirmStatusReset() failed");
    return 0;

}