summaryrefslogblamecommitdiff
path: root/npc/custom/eAAC_Scripts/kafraExpress/global_functionsKE.txt
blob: f536e8e32784ff6b6f647081a65289fe50bbd0b9 (plain) (tree)


























































                                                                 
                           






















































































































































































































































                                                                                 
                           






















                                    
 
//===== eAthena Script ======================================= 
//= Global functions
//===== By: ================================================== 
//= Skotlex 
//===== Current Version: ===================================== 
//= 1.5
//===== Compatible With: ===================================== 
//= eAthena SVN R3424+, RO Ep6+
//===== Description: ========================================= 
//= Global Functions
//= 
//===== Additional Comments: ================================= 
//= GF_getJobName= function for getting a job's name
//= GF_getJobName2= gets a jobs name modified by Type (see below)
//= GF_getJobId=  gets a jobs number modified by Type (see below)
//= GF_getJobLevel= identifies novices/1st/2nd among classes
//= GF_getJobType= identifies normal/advanced/babies classes
//= - GF_getJobClass= identifies job class (swordie, mage, etc)
//============================================================ 

function	script	GF_getJobName	{

	switch (getarg(0)) {

	case Job_Novice:
		return "novice";
	case Job_Acolyte:
		return "acolyte";
	case Job_Archer:
		return "archer";
	case Job_Mage:
		return "mage";
	case Job_Merchant:
		return "merchant";
	case Job_Swordman:
		return "swordsman";
	case Job_Thief:
		return "thief";
	case Job_Taekwon:
		return "taekwon kid";
	case Job_SuperNovice:
		return "super novice";
		
	case Job_Hunter:
		return "hunter";
	case Job_Dancer:
		return "dancer";
	case Job_Bard:
		return "bard";
	case Job_Priest:
		return "priest";
	case Job_Monk:
		return "monk";
	case Job_Wizard:
		return "wizard";
	case Job_Sage:
		return "sage";
	case Job_BlackSmith:
		return "blacksmith";
	case Job_Alchemist:
		return "alchemist";
	case Job_Knight:
	case Job_Knight2:
		return "knight";
	case Job_Crusader:
	case Job_Crusader2:
		return "crusader";
	case Job_Assassin:
		return "assassin";
	case Job_Rogue:
		return "rogue";
	case Job_Star_Gladiator:
	case Job_Star_Gladiator2:
		return "star gladiator";
	case Job_Soul_Linker:
		return "soul linker";
		
	case Job_Novice_High:
		return "high novice";
	case Job_Acolyte_High:
		return "high acolyte";
	case Job_Archer_High:
		return "high archer";
	case Job_Mage_High:
		return "high mage";
	case Job_Merchant_High:
		return "high merchant";
	case Job_Swordman_High:
		return "high swordsman";
	case Job_Thief_High:
		return "high thief";
		
	case Job_Assassin_Cross:
		return "assassin cross";
	case Job_Champion:
		return "champion";
	case Job_Clown:
		return "minstrel";
	case Job_Creator:
		return "biochemist";
	case Job_Gypsy:
		return "gypsy";
	case Job_High_Priest:
		return "high priest";
	case Job_High_Wizard:
		return "high wizard";
	case Job_Lord_Knight:
	case Job_Lord_Knight2:
		return "lord knight";
	case Job_Paladin:
	case Job_Paladin2:
		return "paladin";
	case Job_Professor:
		return "professor";
	case Job_Sniper:
		return "sniper";
	case Job_Stalker:
		return "stalker";
	case Job_Whitesmith:
		return "whitesmith";

	case Job_Baby:
		return "baby";
	case Job_Baby_Acolyte:
		return "baby acolyte";
	case Job_Baby_Archer:
		return "baby archer";
	case Job_Baby_Mage:
		return "baby mage";
	case Job_Baby_Merchant:
		return "baby merchant";
	case Job_Baby_Swordman:
		return "baby swordsman";
	case Job_Baby_Thief:
		return "baby thief";
	case Job_Super_Baby:
		return "super baby";

	case Job_Baby_Hunter:
		return "baby hunter";
	case Job_Baby_Dancer:
		return "baby dancer";
	case Job_Baby_Bard:
		return "baby bard";
	case Job_Baby_Priest:
		return "baby priest";
	case Job_Baby_Monk:
		return "baby monk";
	case Job_Baby_Wizard:
		return "baby wizard";
	case Job_Baby_Sage:
		return "baby sage";
	case Job_Baby_BlackSmith:
		return "baby blacksmith";
	case Job_Baby_Alchem:
		return "baby alchemist";
	case Job_Baby_Knight:
	case Job_Baby_Knight2:
		return "baby knight";
	case Job_Baby_Crusader:
	case Job_Baby_Crusader2:
		return "baby crusader";
	case Job_Baby_Assassin:
		return "baby assassin";
	case Job_Baby_Rogue:
		return "baby rogue";
	default:
		return "unknown";
	}

}

//Returns job name using two params: JobId and Type
function	script	GF_getJobName2	{
	set @classId, callfunc("GF_getJobId", getarg(0), getarg(1));
	return callfunc("GF_getJobName", @classId);
}

//Returns a Job's ID modified by their Type
function	script	GF_getJobId	{
	set @classId, getarg(0);
	set @type, getarg(1);

	if (@classId == Job_SuperNovice || @classId == Job_Super_Baby) {
		switch (@type) {
		case 0:
			return Job_SuperNovice;
		case 2:
			return Job_Super_Baby;
		default:
			return @classId;
		}
	}
	if (@classId >= Job_Taekwon && @classId <= Job_Soul_Linker) {
		//Currently has no alternates.
		return @classId;	
	}
	if (@classId >= Job_Novice_High && @classId <= Job_Paladin2)
		set @classId, @classId -Job_Novice_High;
	else 	
	if (@classId >= Job_Baby && @classId <= Job_Super_Baby)
		set @classId, @classId -Job_Baby;
		
	if (@type == 1)
		set @classId, @classId +Job_Novice_High;
		
	if (@type == 2)
		set @classId, @classId +Job_Baby;

	return @classId;
}

//Returns the type of class:
//0= Novice, 1= First Class, 2= Second Class, 3= Super Novice
//4= Wedding
function	script	GF_getJobLevel	{

	set @classId, getarg(0);
	
	if (@classId >= Job_Novice_High && @classId <= Job_Paladin2)
		set @classId, @classId -Job_Novice_High;

	if (@classId >= Job_Baby && @classId <= Job_Baby_Crusader2)
		set @classId, @classId -Job_Baby;
	
	if(@classId == Job_Novice) {
		return 0;
	}
	if((@classId >= Job_Swordman && @classId <= Job_Thief)
		|| @classId == Job_Taekwon) {
		return 1;
	}
	if ((@classId >= Job_Knight && @classId <= Job_Crusader2)
	|| (@classId >= Job_Star_Gladiator && @classId <= Job_Soul_Linker)) {
		return 2;
	}
	
	if(@classId == Job_SuperNovice || @classId == Job_Super_Baby) {
		return 3;
	}
	if(@classId == 22) {
		return 4;
	}
	return -1;
}

//Returns the type of class, based on path:
//0= Normal Jobs, 1= Upper Jobs, 2= Baby Jobs
//Works the same as Upper, except you can pass any job id to get it's upper value
function	script	GF_getJobType	{
	set @classId, getarg(0);
	
	if ((@classId >= Job_Novice && @classId <= Job_SuperNovice) 
		|| (@classId >= Job_Taekwon && @classId <= Job_Soul_Linker)) {
		return 0;
	}
	if (@classId >= Job_Novice_High && @classId <= Job_Paladin2) {
		return 1;
	}
	if (@classId >= Job_Baby && @classId <= Job_Super_Baby) {
		return 2;
	}
	return -1;
}
//Returns the base class of the given job, return values are:
//Job_Novice (Novice, Baby Novice, Super Novice
//Job_Acolyte (Aco, Priest, Monk +High/Baby variations)
//Job_Archer (Archer, Sniper, Bard, Dancer +High/Baby variations)
//Job_Mage (Mage, Wizard, Sage +High/Baby variations)
//Job_Swordman (Swordsman, Knight, Crusader +High/Baby variations)
//Job_Thief (Thief, Assassin, Rogue +High/Baby variations)
//-1 : others (when wearing Tux/Wedding dress, for example)
//Works the same as baseClass, except you pass the class which you want
//examined.
function	script	GF_getJobClass	{
	set @classId, getarg(0);
	
	if (@classId >= Job_Novice_High && @classId <= Job_Paladin2)
		set @classId, @classId -Job_Novice_High;

	if (@classId >= Job_Baby && @classId <= Job_Baby_Crusader2)
		set @classId, @classId -Job_Baby;
	
	switch (@classId) {
	case Job_Novice:
	case Job_SuperNovice:
	case Job_Super_Baby:
		return Job_Novice;
		
	case Job_Acolyte:
	case Job_Priest:
	case Job_Monk:
		return Job_Acolyte;
		
	case Job_Archer:
	case Job_Hunter:
	case Job_Bard:
	case Job_Dancer:
		return Job_Archer;
	
	case Job_Mage:
	case Job_Wizard:
	case Job_Sage:
		return Job_Mage;

	case Job_Merchant:
	case Job_BlackSmith:
	case Job_Alchemist:
		return Job_Merchant;
	
	case Job_Swordman:
	case Job_Knight:
	case Job_Knight2:
	case Job_Paladin:
	case Job_Paladin2:
		return Job_Swordman;
		
	case Job_Thief:
	case Job_Assassin:
	case Job_Rogue:
		return Job_Thief;

	case Job_Taekwon:
	case Job_Star_Gladiator:
	case Job_Star_Gladiator2:
	case Job_Soul_Linker:
		return Job_Taekwon;

	default:
		return -1;
	}
}