// TMW2 Script.
// Authors:
// Vasily_Makarov (original from Evol)
// Jesusalva
// Description:
// Status Reset NPC utils
// Reset status and return permanent bonuses
// StatusResetReinvest( - )
function script StatusResetReinvest {
// Compulsory check
inventoryplace NPCEyes, 6;
// Permanent boosts were now lost, return the fruits
if (STATUSUP_STR) {
getitem StrengthFruit, STATUSUP_STR;
STATUSUP_STR=0;
}
if (STATUSUP_AGI) {
getitem AgilityFruit, STATUSUP_AGI;
STATUSUP_AGI=0;
}
if (STATUSUP_VIT) {
getitem VitalityFruit, STATUSUP_VIT;
STATUSUP_VIT=0;
}
if (STATUSUP_INT) {
getitem IntelligenceFruit, STATUSUP_INT;
STATUSUP_INT=0;
}
if (STATUSUP_DEX) {
getitem DexterityFruit, STATUSUP_DEX;
STATUSUP_DEX=0;
}
if (STATUSUP_LUK) {
getitem LuckFruit, STATUSUP_LUK;
STATUSUP_LUK=0;
}
resetstatus();
return true;
}
// Return wasSP on success, 0 on failure
// ConfirmReset( {price} )
function script ConfirmStatusReset {
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);
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 {
Zeny-=.@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;
}