summaryrefslogblamecommitdiff
path: root/npc/custom/eAAC_Scripts/kafraExpress/ke_stats.txt
blob: 73618c9eb060f187e5fbbf8b44b09bc89a1b8473 (plain) (tree)

































































































































                                                                                                             
//===== eAthena Script =======================================
//= Kafra Express - Stat/Reset Module
//===== By: ==================================================
//= Skotlex
//===== Current Version: =====================================
//= 2.2
//===== Compatible With: =====================================
//= eAthena SVN R3424+
//===== Description: =========================================
//= Part of the Kafra Express Script Package.
//= Offers stat raising and Stat/Reset skills
//===== Additional Comments: =================================
//= See config.txt for configuration.
//============================================================

-	script	keInit_stats	-1,{
OnInit:	//Load Config
	donpcevent "keConfig::OnLoadStats";
	end;
}

function	script	F_keStats	{

	function SF_statRaise;

	set @discount,callfunc("F_keCost",100,$@kest_discount);
	do {
		set @kmenu, select(
			"- Return",
			"- Raise Stats",
			"- Reset Stats ("+$@kest_stResetCost+"z+"+$@kest_BaseLvCost+"/blv)",
			"- Reset Skills ("+$@kest_skResetCost+"z+"+$@kest_JobLvCost+"/jlv)",
			"- Reset Both ("+$@kest_resetCost+"z+"+$@kest_BothLvCost+"/lv)"
		);
		switch (@kmenu) {
		case 2: //Stat raising
			SF_statRaise();
			set @cost, 0;
			set @reset, 0;
			break;
		case 3: //Reset Stat
			set @cost, $@kest_stResetCost+BaseLevel*$@kest_BaseLvCost;
			set @reset, 1;
			break;
		case 4: //Reset Skills
			set @cost, $@kest_skResetCost+(JobLevel+jobchange_level)*$@kest_JobLvCost;
			set @reset, 2;
			break;
		case 5: //Reset Both
			set @cost, $@kest_resetCost+(BaseLevel+JobLevel+jobchange_level)*$@kest_BothLvCost;
			set @reset, 3;
			break;
		default: //Cancel
			set @cost, 0;
			set @reset, 0;
			break;
		}
		if (@reset > 0) {
			if (select("- Cancel","- Reset for "+(@cost*@discount/100)+"z") == 2) {
				if (!(callfunc("F_keCharge",@cost,$@kest_discount,1))) { 
					callfunc "F_keIntro", e_an, "Sorry, you don't have enough Zeny.";
				} else {
					if (@reset&1)
						ResetStatus;
					if (@reset&2) {
						if ($@kest_resetBasic)
							ResetSkill;
						else {
							set @skill1,getskilllv(1);
							ResetSkill;
							skill 1,@skill1,0;
							set SkillPoint,SkillPoint-@skill1;
						}
					}
					emotion e_hmm;
				}
			}
		}
	} while (@kmenu > 1);
	return;
	
function SF_statRaise {
	do {
		set @submenu, select(
			"- Return",
			"- Raise Strength",
			"- Raise Agility",
			"- Raise Vitality",
			"- Raise Intelligence",
			"- Raise Dexterity",
			"- Raise Luck"
		);
		switch (@submenu) {
		case 2:
			set @stat,bStr;
			break;
		case 3:
			set @stat,bAgi;
			break;
		case 4:
			set @stat,bVit;
			break;
		case 5:
			set @stat,bInt;
			break;
		case 6:
			set @stat,bDex;
			break;
		case 7:
			set @stat,bLuk;
			break;
		default:
			return;
		}
		input @qty;
		if (@qty <1) {
			callfunc "F_keIntro", e_swt, "I don't lower stats, try resetting them.";
		} else if (@qty >100) {
			callfunc "F_keIntro", e_swt2, "Sorry... I can only raise stats up to 100 at a time.";
		} else {
			do {
				statusup @stat;
				set @qty,@qty-1;
			} while (@qty > 0);
			emotion e_ok;
		}
	} while (@submenu > 1);
}

}