#library "RPGSCRIP"
#define MATH_E 178145
#include "zcommon.acs"

#define MAXPLAYERS 32
#define PLAYERTID 1256
#define PET1TID 1321
#define PET2TID 1386
#define PET3TID 1451
#define PET4TID 1516
#define PET5TID 1581
#define HPBARID 2000

#define WOC_STAT				1
#define WOC_BOSS				2
#define WOC_NORANDOM			4
#define WOC_SUBBOSS 			8
#define WOC_MAXLEVEL 			16
#define WOC_ALLYSUMMON			32
#define WOC_TRACERSUMMON		64

#define WOC_AREAHEAL	 		497
#define WOC_SETGLOBALLEVEL 		498
#define WOC_STARTSCRIPT 		499
#define WOC_RPGPLAYERSCRIPT 	500
#define WOC_DECORATE            501
#define WOC_DEATHSCRIPT         502
#define WOC_RESPAWNSCRIPT       503
#define WOC_MONSTERSCRIPT		504
#define WOC_MONSTERXPSCRIPT	    505
#define WOC_MULTIKILLSCRIPT		506
#define WOC_HEALSCRIPT			507
#define WOC_RETURNSCRIPT		508
#define WOC_MONSTERSCALE		509	

#define WOC_CASTSTOMP     		510
#define WOC_CASTBERSERK     	511
#define WOC_CASTBLOODRUSH     	512
#define WOC_CASTCHARGE			513
#define WOC_CASTBATTLESHOUT		514
#define WOC_CASTDEFLECTION		515

#define WOC_CASTBLESSING     		516
#define WOC_CASTSACRIFICE     		517
#define WOC_CASTPROTECTAURA     	518
#define WOC_CASTSUMMONLEGEND     	519
#define WOC_SUMMONLEGENDSCRIPT     	520
#define WOC_CASTPRESERVERANCEAURA  	521
#define WOC_PRESERVERANCEHEALING  	522
#define WOC_VISIONSSCRIPT		  	523
#define WOC_CASTFURYAURA		  	524
#define WOC_HOLYBOLTSCRIPT			651
#define WOC_WRAITHSSCRIPT			653

#define WOC_CASTTELEKINESIS     525
#define WOC_CASTMANACHARGE      526
#define WOC_CASTARCANEBARRIER    527
#define WOC_CASTTHUNDERSTORM    528

#define WOC_CASTSPRINT		    529
#define WOC_CASTPRECISION       530
#define WOC_CASTCAMOFLAUGE      531
#define WOC_CASTRAVENCOMPANION  532
#define WOC_INVIGHEAL   		550
#define WOC_NATURESSALVE		652

#define WOC_CASTENFEEBLE     		533
#define WOC_CASTSUMMONSHADOW     	534
#define WOC_CASTTERRIFY		    	535
#define WOC_CASTSUMMONGHOUL     	536
#define WOC_CASTCHAOS		     	537
#define WOC_CASTSUMMONREVENANT  	538
#define WOC_CASTMIASMA			  	539
#define WOC_CASTDRAIN		  		540
#define WOC_CASTSUMMONDEATHKNIGHT	541
#define WOC_CASTMETAMORPH 			542
#define WOC_MINIONREGEN 			543
#define WOC_MOVEMINION	 			544

#define WOC_MYSTICAMBITINCANT	 	545
#define WOC_ARMORITEM				546
#define WOC_MONSTERSIGHT			547
#define WOC_HEALTARGET				548
#define WOC_ACCESSORYSCRIPT			549

#define WOC_MENUKEY				  	600
#define WOC_MAINMENU			  	601
#define WOC_MAINMENUTEXT		  	602
#define WOC_SHOPSTART			  	603
#define WOC_SHOPMENU   			  	604
#define WOC_SHOPMENUTEXT		  	605
#define WOC_SHOPDEAD			  	606
#define WOC_ACCESSORYMENU			607
#define WOC_ACCESSORYMENUTEXT		608
#define WOC_ALCHEMYMENU				609
#define WOC_ALCHEMYMENUTEXT			610
#define WOC_ALCHEMYMIXTEST			612
#define WOC_CLIENTCVAR				613
#define WOC_CHESTSCRIPT				614
#define WOC_ARMORCHECK				615
#define WOC_READENEMYVALUES			617

#define	WOC_CLIENTSET				700
#define	WOC_CLIENT_CLASS 			701
#define	WOC_GIVEWEAPON				702
#define	WOC_WEAPONMESSAGE			703
#define	WOC_FLOATINGBARS			704

#define	WOC_INSPIRE					710
#define	WOC_BLESSEDGROUND			711
#define	WOC_HARVESTERSOUL			712
#define	WOC_RESPECSCRIPT			713

//type
#define GAMESETTINGS			0
#define STATS		        	1
#define FIGHTERSKILLS       	2
#define CLERICSKILLS        	3
#define MAGESKILLS          	4
#define HUNTERSKILLS        	5
#define NECROMANCERSKILLS   	6
#define MONSTERACS   			7

//option GAMESETTINGS
#define GORELEVEL				0
#define WEAPONSTAY				1
#define DAMAGEINDICATOR			2

//option (Stat Scale)
#define STRENGTH		        0
#define AGILITY 		        1
#define CONSTITUTION		    2
#define WISDOM  		        3
#define INTELLECT		        4
#define CHARISMA		        5
#define LEVEL		            6
#define GLOBALLEVEL		        7
#define MAXHEALTH		    	8
#define MAXARMOR		    	9
#define MAXARMOR1		    	10
#define MAXARMOR2		    	11
#define MAXARMOR3		    	12
#define MAXARMOR4		    	13
#define MAXARMOR5		    	14
#define MAXARMOR6		    	15
#define MAXARMOR7		    	16
#define MAXARMOR8		    	17
#define MAXMANA			    	18
#define PLAYERNUM			    19
#define ITEMCAP				    20
#define PREVIOUSHP				21
#define ZPOSITION				22
#define BASESTRENGTH		    23
#define ISFRIEND			    24
#define MAXMAGICK			    25
#define XOUTBREAK			    51
#define YOUTBREAK			    52
#define ZOUTBREAK			    53

//option (Monster ACS)
#define MEDUSA		    	    0
#define PREVHEALTH				1
#define PREVHEALTH2				2

//suboption Stat/Skill
#define ACTIVATOR		        	0
#define TARGET		        	1
#define TRACER		        	2
#define MASTER		        	3
#define MASTERPLAYER		   	4
#define TARGETMASTERPLAYER		5

//cvars
#define WoC_DamageIndicator		0
#define WoC_GoreLevel			1
#define WoC_FloatingHealthBar			2
#DEFINE ABIL_ARRAYMAX			16
#DEFINE ABIL_MAX				15
#define MAXSKILLPOINTS 			160

//option (Fighter Skills)
 #DEFINE ABIL_MIGHTYBLOW 0
 #DEFINE ABIL_CRITICALSTRIKE 1
 #DEFINE ABIL_WARCRY 2
 #DEFINE ABIL_STOMP 3
 #DEFINE ABIL_AXEMASTERY 4
 #DEFINE ABIL_BESERK 5
 #DEFINE ABIL_BLOODRUSH 6
 #DEFINE ABIL_CHARGE 7
 #DEFINE ABIL_HAMMERMASTERY 8
 #DEFINE ABIL_BATTLESHOUT 9
 #DEFINE ABIL_CONCENTRATION 10
 #DEFINE ABIL_HOOKSHOT 11
 #DEFINE ABIL_SWORDMASTERY 12
 #DEFINE ABIL_VENGEANCE 13
 #DEFINE ABIL_DEFLECTION 14
 #DEFINE ABIL_DEATHBLOW 15
 
//option (Cleric Skills)
 #DEFINE ABIL_BLESSING 0
 #DEFINE ABIL_CURSE 1
 #DEFINE ABIL_BLUNTMASTERY 2
 #DEFINE ABIL_HOLYSHIELD 3
 #DEFINE ABIL_HOLYBOLT 4
 #DEFINE ABIL_WRAITHS 5
 #DEFINE ABIL_SACRIFICE 6
 #DEFINE ABIL_PROTECTAURA 7
 #DEFINE ABIL_CONSECRATION 8
 #DEFINE ABIL_SUMMONLEGEND 9
 #DEFINE ABIL_RETRIBUTION 10 
 #DEFINE ABIL_PRESERVERANCEAURA 11
 #DEFINE ABIL_DIVINELIGHT 12
 #DEFINE ABIL_VISIONS 13
 #DEFINE ABIL_INTERVENTION 14
 #DEFINE ABIL_FURYAURA 15
 
//option (MAGE Skills)
 #DEFINE ABIL_FIREBALL 0
 #DEFINE ABIL_TELEKINESIS 1
 #DEFINE ABIL_ICEBOLT 2
 #DEFINE ABIL_SPARK 3
 #DEFINE ABIL_FIRETRAP 4
 #DEFINE ABIL_MANACHARGE 5
 #DEFINE ABIL_DEEPFREEZE 6
 #DEFINE ABIL_ENERGYABSORB 7
 #DEFINE ABIL_METEOR 8
 #DEFINE ABIL_ARCANEBARRIER 9
 #DEFINE ABIL_BLIZZARD 10
 #DEFINE ABIL_THUNDERSTORM 11
 #DEFINE ABIL_PILLAROFFLAME 12
 #DEFINE ABIL_POLYMORPH 13
 #DEFINE ABIL_ARTICGLACIER 14
 #DEFINE ABIL_LIGHTNINGSURGE 15
 
//option (Hunter Skills)
 #DEFINE ABIL_RANGEDMASTERY 0
 #DEFINE ABIL_MELEEMASTERY 1
 #DEFINE ABIL_BEARTRAP 2
 #DEFINE ABIL_SPRINT 3
 #DEFINE ABIL_FIREARROW 4
 #DEFINE ABIL_PRECISION 5
 #DEFINE ABIL_INVIGORATION 6
 #DEFINE ABIL_SPIKETRAP 7
 #DEFINE ABIL_CAMOFLAUGE 8
 #DEFINE ABIL_ICEARROW 9
 #DEFINE ABIL_FANOFKNIVES 10
 #DEFINE ABIL_TRIPBOMB 11
 #DEFINE ABIL_NATURESSALVE 12
 #DEFINE ABIL_LIGHTNINGARROW 13
 #DEFINE ABIL_NOXIOUSTRAP 14
 #DEFINE ABIL_RAVENCOMPANION 15

//option (Necromancer Skills)
 #DEFINE ABIL_ENFEEBLE 0
 #DEFINE ABIL_SUMMONSHADOW 1
 #DEFINE ABIL_BLIGHT 2
 #DEFINE ABIL_TERRIFY 3
 #DEFINE ABIL_SUMMONGHOUL 4
 #DEFINE ABIL_DARKNESS 5
 #DEFINE ABIL_POISONBLAST 6
 #DEFINE ABIL_CHAOS 7
 #DEFINE ABIL_SUMMONREVENANT 8
 #DEFINE ABIL_POISONNOVA 9
 #DEFINE ABIL_MIASMA 10
 #DEFINE ABIL_DRAIN 11
 #DEFINE ABIL_SUMMONDEATHKNIGHT 12
 #DEFINE ABIL_BONESHOWER 13
 #DEFINE ABIL_RAISEDEAD 14
 #DEFINE ABIL_METAMORPH 15	
 
int MapGlobalLevel;
int MapPlayerCount;
int pool;

//Common Defined Functions
function int SetInventory (str item, int count) {
	int n = count - CheckInventory (item);
	if (n > 0)
		GiveInventory (item, n);
	else if (n < 0)
		TakeInventory (item, -n);
	
	return n;
}

function int SetActorInventory (int tid, str item, int count) {
	int n = count - CheckActorInventory (tid, item);
	if (n > 0)
		GiveActorInventory (tid, item, n);
	else if (n < 0)
		TakeActorInventory (tid, item, -1*n);
	
	return n;
}

function int zsqrt (int x)
{
	int r;
	x = x + 1 >> 1;
	while (x > r)
		x -= r++;
	return r;
}

function int distance (int tid1, int tid2)
{
	int len;
	int y = getactory(tid1) - getactory(tid2);
	int x = getactorx(tid1) - getactorx(tid2);
	int z = getactorz(tid1) - getactorz(tid2);

	int ang = vectorangle(x,y);
	if(((ang+0.125)%0.5) > 0.25) len = fixeddiv(y, sin(ang));
	else len = fixeddiv(x, cos(ang));

	ang = vectorangle(len, z);
	if(((ang+0.125)%0.5) > 0.25) len = fixeddiv(z, sin(ang));
	else len = fixeddiv(len, cos(ang));

	return (len >> 16);
}

function void spawnradius (str type, int spotid, int radius, int angle, int newtid)
{
    int x, y;
    x = GetActorX(spotid) + radius * cos(angle);
    y = GetActorY(spotid) + radius * sin(angle);
    Spawn(type, x, y, GetActorZ(spotid), newtid, angle >> 8);
}

function void spawnradius_randomz (str type, int spotid, int radius, int angle, int newtid)
{
    int x, y;
    x = GetActorX(spotid) + radius * cos(angle);
    y = GetActorY(spotid) + radius * sin(angle);
    Spawn(type, x, y, GetActorZ(spotid)+((32+Random(-5,5)) << 16), newtid, angle);
}

function void particle_effect_circle (str actor, int units)
{
	SpawnRadius(actor, ActivatorTid(), units, 0.0, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.05, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.10, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.15, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.20, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.25, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.30, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.35, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.40, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.45, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.50, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.55, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.60, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.65, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.70, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.75, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.80, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.85, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.90, 0);
	SpawnRadius(actor, ActivatorTid(), units, 0.95, 0);
}

function void particle_effect_cast (str actor)
{
	SpawnRadius_RandomZ(actor, ActivatorTid(), 9, GetActorAngle(0)+Random(-0.1,0.1), 0);
	SpawnRadius_RandomZ(actor, ActivatorTid(), 9, GetActorAngle(0)+Random(-0.1,0.1), 0);
	SpawnRadius_RandomZ(actor, ActivatorTid(), 9, GetActorAngle(0)+Random(-0.1,0.1), 0);
	SpawnRadius_RandomZ(actor, ActivatorTid(), 9, GetActorAngle(0)+Random(-0.1,0.1), 0);
	SpawnRadius_RandomZ(actor, ActivatorTid(), 9, GetActorAngle(0)+Random(-0.1,0.1), 0);
}

function int IsFriendly( int tid )
{
	int value;
	if(tid == 0)
	{
		If(CheckInventory("ImAFighter")==1 || CheckInventory("ImACleric")==1 || CheckInventory("ImAMage")==1 || CheckInventory("ImAHunter")==1 || CheckInventory("ImAWarlock")==1 || CheckInventory("ImAPet")==1)
			value = TRUE;
		else If(CheckInventory("EnemyInDisguise")==0 && CheckActorProperty(0, APROP_Friendly, 0) || CheckInventory("FriendlyInDisguise")>0 )
			value = FALSE;
		else If(CheckActorProperty(0, APROP_Friendly, 1) || CheckInventory("EnemyInDisguise")>0)
			value = TRUE;
	}
	else if(tid != 0)
	{
		If(CheckActorInventory(tid, "ImAFighter")==1 || CheckActorInventory(tid, "ImACleric")==1 || CheckActorInventory(tid, "ImAMage")==1 || CheckActorInventory(tid, "ImAHunter")==1 || CheckActorInventory(tid, "ImAWarlock")==1 || CheckActorInventory(tid, "ImAPet")==1)
			value = TRUE;
		else If(CheckActorInventory(tid, "EnemyInDisguise")==0 && CheckActorProperty(tid, APROP_Friendly, 0) || CheckActorInventory(tid, "FriendlyInDisguise")>0 )
			value = FALSE;
		else If(CheckActorProperty(tid, APROP_Friendly, 1) || CheckActorInventory(tid, "EnemyInDisguise")>0)
			value = TRUE;
	}
	return value;
}

//End


//RPG Functions

function bool CheckIfPlayer( int tid )
{
	int value;
	if(tid == 0)
		If(CheckInventory("ImAFighter")==1 || CheckInventory("ImACleric")==1 || CheckInventory("ImAMage")==1 || CheckInventory("ImAHunter")==1 || CheckInventory("ImAWarlock")==1 || CheckInventory("ImAPet")==1)
			value = TRUE;
	else if(tid != 0)
		If(CheckActorInventory(tid, "ImAFighter")==1 || CheckActorInventory(tid, "ImACleric")==1 || CheckActorInventory(tid, "ImAMage")==1 || CheckActorInventory(tid, "ImAHunter")==1 || CheckActorInventory(tid, "ImAWarlock")==1 || CheckActorInventory(tid, "ImAPet")==1)
			value = TRUE;
	return value;
}

function bool checkinfo( int cost, str skill )
{
	int lol;
	If(CheckInventory("MP") < cost) { Print(s:"Not Enough Magick!"); LocalAmbientSound("misc/invuse",108); }
	If(!CheckInventory(skill)) Print(s:"You haven't learned this yet!");
	If(CheckInventory("MP") >= cost && CheckInventory(skill))
	{
		lol = TRUE;
		TakeInventory("MP",cost);
	}
	return lol;
}

function int HasOnSlots (int skillnumber)
{
	int success;
	If(CheckInventory("SkillSlot1") == skillnumber ||
	CheckInventory("SkillSlot2") == skillnumber ||
	CheckInventory("SkillSlot3") == skillnumber ||
	CheckInventory("SkillSlot4") == skillnumber) success = TRUE;
	return success;
}

function int requirements (int levelreq, str neededskill)
{
	int success;
	If(CheckInventory("SkillPoint") >= levelreq && CheckInventory(neededskill)) success = TRUE;
	return success;
}

function int requirements2 (int levelreq, str neededskill, str neededskill2)
{
	int success;
	If(CheckInventory("SkillPoint") >= levelreq && CheckInventory(neededskill) && CheckInventory(neededskill2)) success = TRUE;
	return success;
}

function int checklevelaverage ( void )
{
	int lvlavg;
	int avg;
	int playerlevel;
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
		if (!playeringame (i))
			continue;
		if (playercount()!=0)
		{
			playerlevel = checkactorinventory (PLAYERTID+i,"Level");
			If(playerlevel < GetCVar("WoC_MinLevel"))
				playerlevel = GetCVar("WoC_MinLevel");
			avg += playerlevel;
			if(GetCVar("WoC_GlobalLevelType")==0)
				lvlavg = (avg / PlayerCount());
			If(GetCVar("WoC_GlobalLevelType")==1)
				lvlavg = (avg);
		}
	}
	
	return lvlavg;
}

function void HealingActor (int tid, int HealAmount)
{
	int damage, overflow, h;
	If(tid != 0)
	{
		if(CheckActorInventory(tid,"CurrentMaxHealth"))
		{
			Damage = CheckActorInventory(tid,"CurrentMaxHealth")-CheckActorInventory(tid,"Health");//amount of damage we've taken
			OverFlow = CheckActorInventory(tid,"CurrentMaxHealth")-CheckActorInventory(tid,"Health")-HealAmount;//(the negative of)The amount by which healing by the desired amount will put us over our max health
			H = HealAmount;
			if(OverFlow<0)H -= -OverFlow; //this will heal us by the desired amount, or up to our maximum
			If(GetActorProperty(tid,APROP_Health) > 0)
				SetActorProperty(tid,APROP_Health,GetActorProperty(tid,APROP_Health)+H);
		}
	}
	Else If(Tid == 0)
	{
		if(CheckInventory("CurrentMaxHealth"))
		{
			Damage = CheckInventory("CurrentMaxHealth")-CheckInventory("Health");//amount of damage we've taken
			OverFlow = CheckInventory("CurrentMaxHealth")-CheckInventory("Health")-HealAmount;//(the negative of)The amount by which healing by the desired amount will put us over our max health
			H = HealAmount;
			if(OverFlow<0)H -= -OverFlow; //this will heal us by the desired amount, or up to our maximum
			If(GetActorProperty(0,APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+H);
		}
	}
}

function void SetManaCapacity(void)							// mana capacity
{
	int capacity;
	capacity = CheckInventory("Intellect");
	if(CheckInventory("ImAFighter")==1)
	{
		SetAmmoCapacity ("Mana1", (50+2*capacity)+(CheckInventory("Level")*2));
		SetAmmoCapacity ("Mana2", (50+2*capacity)+(CheckInventory("Level")*2));
	}
	else if(CheckInventory("ImACleric")==1)
	{
		SetAmmoCapacity ("Mana1", (50+3*capacity)+(CheckInventory("Level")*3));
		SetAmmoCapacity ("Mana2", (50+3*capacity)+(CheckInventory("Level")*3));
	}
	else if(CheckInventory("ImAMage")==1)
	{
		SetAmmoCapacity ("Mana1", (50+6*capacity)+(CheckInventory("Level")*6));
		SetAmmoCapacity ("Mana2", (50+6*capacity)+(CheckInventory("Level")*6));
	}
	else if(CheckInventory("ImAHunter")==1)
	{
		SetAmmoCapacity ("Mana1", (50+4*capacity)+(CheckInventory("Level")*4));
		SetAmmoCapacity ("Mana2", (50+4*capacity)+(CheckInventory("Level")*4));
	}
	else if(CheckInventory("ImAWarlock")==1)
	{
		SetAmmoCapacity ("Mana1", (50+5*capacity)+(CheckInventory("Level")*5));
		SetAmmoCapacity ("Mana2", (50+5*capacity)+(CheckInventory("Level")*5));
	}
}

function void SetXPRequired (void)
{
	int XPRequired = (CheckInventory("Level")*100)+(CheckInventory("Level")*75);
	SetAmmoCapacity ("XP", XPRequired);
}

function void SetMaximumHealth (void)
{
	if(CheckInventory("ImAFighter")==1)
		SetInventory("CurrentMaxHealth", 130 + ((CheckInventory("Level")+CheckInventory("Constitution")-16)*6));
	else if(CheckInventory("ImACleric")==1)
		SetInventory("CurrentMaxHealth", 100 + ((CheckInventory("Level")+CheckInventory("Constitution")-14)*5));
	else if(CheckInventory("ImAMage")==1)
		SetInventory("CurrentMaxHealth", 55 + ((CheckInventory("Level")+CheckInventory("Constitution")-8)*2));
	else if(CheckInventory("ImAHunter")==1)
		SetInventory("CurrentMaxHealth", 85 + ((CheckInventory("Level")+CheckInventory("Constitution")-11)*4));
	else if(CheckInventory("ImAWarlock")==1)
		SetInventory("CurrentMaxHealth", 70 + ((CheckInventory("Level")+CheckInventory("Constitution")-9)*3));
	SetActorProperty(0,APROP_SpawnHEALTH,CheckInventory("CurrentMaxHealth"));
}

function void SetMagickCapacity (void)//Enter							// Magick capacity
{
	if(CheckInventory("ImAFighter")==1)
		SetAmmoCapacity ("MP", (10+(CheckInventory("Wisdom")*2))+(CheckInventory("Level")*2));
	else if(CheckInventory("ImACleric")==1)
		SetAmmoCapacity ("MP", (10+(CheckInventory("Wisdom")*3))+(CheckInventory("Level")*3));
	else if(CheckInventory("ImAMage")==1)
		SetAmmoCapacity ("MP", (10+(CheckInventory("Wisdom")*6))+(CheckInventory("Level")*6));
	else if(CheckInventory("ImAHunter")==1)
		SetAmmoCapacity ("MP", (10+(CheckInventory("Wisdom")*4))+(CheckInventory("Level")*4));
	else if(CheckInventory("ImAWarlock")==1)
		SetAmmoCapacity ("MP", (10+(CheckInventory("Wisdom")*5))+(CheckInventory("Level")*5));
}

function int GetMasterLevel (void)
{
	SetActivator(0, AAPTR_MASTER);
	return CheckInventory("Level");
}
//End

str SlotType[5] = { "SkillSlot0", "SkillSlot1", "SkillSlot2", "SkillSlot3", "SkillSlot4" };

str DescriptionArrayStat[7] = {
"Strength: \nIncreases the damage of your melee attacks and increases your carrying capacity.",
"Agility: \nIncreases your movement speed, jump height, and the damage of your ranged attacks.",
"Constitution: \nIncreases your maximum health.",
"Wisdom: \nIncreases your Magick capacity, success rate of Alchemy, experience gained, and improves support abilities.",
"Intellect: \nIncreases your Mana capacity and the damage of your magical attacks.",
"Charisma: \nIncreases the damage and health of your pets, and improves buy and sell prices.",
};

//"Willpower: \nIncreases your Health and Magick regeneration.",

str FighterAbilities[ABIL_ARRAYMAX] = { "Mighty Blow", "Critical Strike", "War Cry", 
                "Stomp", "Axe Mastery", "Berserk", 
                "Blood Rush", "Charge", "Hammer Mastery", 
                "Battle Shout", "Concentration", "Hook Shot", 
				"Sword Mastery", "Vengeance", "Deflection", "Death Blow",};

str FighterIcons[ABIL_ARRAYMAX] = { "ARTIMB", "ARTICS", "ARTIWARC", 
                "ARTISTOM", "ARTIAXEM", "ARTIBESE", 
                "ARTIRUSH", "ARTICHAR", "ARTIHAM", 
                "ARTIADRN", "ARTIADRE", "ARTIHOOK", 
				"ARTISWRD", "ARTIVENG", "ARTIRFCT", "ARTIDBLW" };
				
str FighterItemNames[ABIL_ARRAYMAX] = { "MightyBlow", "CriticalStrike", "WarCry",
							 "Stomp", "AxeMastery", "Beserk", "BloodRush", "Charge",
							 "HammerMastery", "BattleShout", "Concentration", "HookShot", 
							 "SwordMastery", "Vengeance", "Deflection", "DeathBlow", };
							 
str DescriptionArrayF[ABIL_ARRAYMAX] = {
"Mighty Blow \nMagick Cost: 2 + AbilityLevel/4\nBrutally punch a target.\nUpgrading increases the damage of Mighty Blow, Stomp, Charge, and Hook Shot.",
"Critical Strike \nPassive\nGives melee attacks a chance to inflict double damage.\nUpgrading increases your chance to do a critical strike.",
"War Cry \nMagick Cost: 10\nLet out a roaring shout that has a chance to fear nearby monsters.\nUpgrading increases the range and chance to fear.",
"Stomp \nMagick Cost: 10\nRequires: 8 Skill Points Spent, Mighty Blow\nStomp on the ground to inflict heavy damage to nearby foes.\nUpgrading increases the range of Stomp and the damage of Stomp, Charge, and Hook Shot.",
"Axe Mastery \nPassive\nRequires: 4 Skill Points Spent, Critical Strike\nIncreases your damage with axe based attacks.\nUpgrading increases your damage with axe based attacks.",
"Berserk \nMagick Cost: 2\nRequires: 12 Skill Points Spent, War Cry\nIncrease your strength but also increase the damage that you take.\nUpgrading increases the strength boost and reduces the magick drain rate and bonus damage taken.",
"Blood Rush \nMagick Cost: 15 + AbilityLevel/2\nRequires: 15 Skill Points Spent, Berserk\nHeal yourself instantly and regenerate extra health afterwards.\nUpgrading increases the health restored.",
"Charge \nMagick Cost: 4\nRequires: 10 Skill Points Spent, Stomp\nCharge forward, stunning and knocking back enemy units in your way.\nUpgrading increases the force of the charge and the damage of Charge and Hook Shot.",
"Hammer Mastery \nPassive\nRequires: 10 Skill Points Spent, Axe Mastery\nIncrease your damage with hammer based attacks.\nUpgrading increases your damage with hammer based attacks.",
"Battle Shout \nMagick Cost: 10\nRequires: 18 Skill Points Spent, Berserk\nRally your teammates, increasing you and your teammate's damage and speed.\nUpgrading increases the damage bonus.",
"Concentration \nPassive\nRequires: 20 Skill Points Spent, Blood Rush\nGrants a chance to recover mana upon taking damage.\nUpgrading increases the chance and mana restored.",
"Hook Shot \nMagick Cost: 14\nRequires: 19 Skill Points Spent, Charge\nSends out a hook that pulls enemy monsters to you.\nUpgrading increases the damage of Hook Shot.",
"Sword Mastery \nPassive\nRequires: 18 Skill Points Spent, Hammer Mastery\nIncrease your damage with sword based attacks.\nUpgrading increases your damage with sword based attacks.",
"Vengeance \nPassive\nRequires: 22 Skill Points Spent, Battle Shout\nTaking damage will increase your own damage.\nUpgrading increases the damage bonus.",
"Deflection \nMagick Cost: 12\nRequires: 24 Skill Points Spent, Concentration\nFor 5 seconds, reduce the damage you take and reflect incoming projectiles.\nUpgrading increases the damage reduction.",
"Death Blow \nMagick Cost: 15\nRequires: 28 Skill Points Spent, Hook Shot\nPunch the enemy with a chance to instantly kill.\nUpgrading increases the chance of instant killing the target.",
};

str FighterSpec[3] = { "\crDestroyer", "\csVanguard", "\ciCommander"};
str FighterSpecItem[3] = { "IsDestroyer", "IsVanguard", "IsCommander"};
str FighterSpecIcons [3][3]  =
{
	//Destroyer
	{
		"ARTIBLUS",
		"ARTIVIGR",
		"ARTIRELT",
	},
					   
	//Vanguard
	{
		"ARTITEMP",
		"ARTIPRES",
		"ARTISWND",
	},
							 
	//Commander
	{
		"ARTIINSP",
		"ARTIINTI",
		"ARTIRALY",
	},
};
str FighterSpecNames [3][3]  =
{
	//Destroyer
	{
		"Bloodlust",
		"Vigor",
		"Relentless",
	},
					   
	//Vanguard
	{
		"Temperance",
		"Presence",
		"Second Wind",
	},
							 
	//Commander
	{
		"Inspire",
		"Intimidate",
		"Rally",
	},
};
str FighterSpecDescriptions [3][4]  =
{
	//Destroyer
	{
		"A battle hardened warrior who uses overbearing strength to cut foes down.",
		"Bloodlust\nKilling an enemy grants a short duration damage buff.",
		"Vigor\nCritical Strikes now restore a small amount of Magick.",
		"Relentless\nLanding melee attacks increases your strength for 4 seconds. This can stack indefinitely.",
	},
					   
	//Vanguard
	{
		"A stalwart protector with powerful defenses, protecting themselves and allies.",
		"Temperance\nTaking damage reduces subsequent damage received by 6% and stacks up to 30%.",
		"Presence\nNearby enemies are more likely to attack you.",
		"Second Wind\nYour health regeneration is increased by 2% for every 1% of missing health.",
	},
							 
	//Commander
	{
		"A veteran of battle whose presence motivates nearby allies.",
		"Inspire\nLanding critical hits also heal allies.",
		"Intimidate\nWar Cry causes enemies to take 25% increased damage.",
		"Rally\nBattle Shout also reduces the damage allies take by 15%.",
	},
};
				
str ClericAbilities[ABIL_ARRAYMAX] = { "Blessing", "Curse", "Blunt Mastery", 
                "Holy Shield", "Holy Bolt", 
				"Wraiths", "Sacrifice",
                "Protect Aura", "Consecration", "Summon Legend", 
				"Retribution", "Perserverance Aura", "Divine Light", "Visions",
                "Intervention", "Fury Aura", };
				
str ClericItemNames[ABIL_ARRAYMAX] = { "Blessing", "Curse", "BluntMastery", "HolyShield", "HolyBolt", 
						    "SummonAncestors", "Sacrifice", "ProtectAura", "Consecration", 
							"SummonLegend", "Retribution", "PreserveranceAura", "DivineLight", 
							"Visions", "Intervention", "FuryAura", };

str ClericIcons[ABIL_ARRAYMAX] = { "ARTIBL", "ARTICU", "ARTIMACE", "ARTISHLD", 
                "ARTIHOBT", "ARTIANCE", "ARTISACR",
                "ARTIPROT", "ARTICNSC", "ARTILEGE", "ARTIRETR", "ARTIREGN",
                "ARTIDIVP", "ARTIVISI", "ARTIINTR", "ARTIHF", };
				


str DescriptionArrayC[ABIL_ARRAYMAX] = {
"Blessing \nMagick Cost: 10 + AbilityLevel/2\nHeal yourself and nearby teammates.\nUpgrading increases the healing of Blessing and Holy Bolt.",
"Curse \nMagick Cost: 5\nFire a curse to stun the enemy.\nUpgrading increases the duration of the Curse, Wraiths, and Summon Legend.",
"Blunt Mastery \nPassive\nIncreases your damage with blunt weapons.\nUpgrading increases the damage with blunt weapons.",
"Holy Shield \nMagick Cost: 7\nRequires: 9 Skill Points Spent, Blessing\nCreate magic walls that blocks projectiles.\nUpgrading increases the number of walls.",
"Holy Bolt \nMagick Cost: 12 + AbilityLevel\nRequires: 12 Skill Points Spent, Blessing\nFire a holy missile that explodes, healing allies and damaging foes.\nUpgrading increases the damage of Holy Bolt, Consecration, and Divine Light and healing of Holy Bolt.",
"Wraiths \nMagick Cost: 10\nRequires: 8 Skill Points Spent, Curse\nSummon a vengeful spirit that attacks nearby monsters.\nUpgrading increases the damage, health, and duration of Wraiths and the duration of Summon Legend.",
"Sacrifice \nMagick Cost: 10\nRequires: 6 Skill Points Spent, Mace Mastery\nTemporarily grants a massive strength boost at the cost of health.\nUpgrading increases the strength boost, duration, and reduces the health cost.",
"Protect Aura \nToggle\nRequires: 14 Skill Points Spent, Holy Shield\nReduces the damage taken by you and nearby allies.\nUpgrading increases the damage reduction and range.",
"Consecration \nMagick Cost: 20+AbilityLevel\nRequires: 23 Skill Points Spent, Holy Bolt\nFill the ground with pulsing light, inflicting damage.\nUpgrading increases the damage of Consecration and Divine Light.",
"Summon Legend \nMagick Cost: 15\nRequires: 18 Skill Points Spent, Wraiths\nSummon a holy spirit to fight by your side.\nUpgrading increases the health and duration of the spirit.",
"Retribution \nPassive\nRequires: 20 Skill Points Spent, Sacrifice\nGives a chance to fire a projectile to attackers when taking damage.\nUpgrading increases the chance and damage of the spell.",
"Perserverance Aura \nToggle\nRequires: 17 Skill Points Spent, Protect Aura\nRegenerates the health of you and nearby allies.\nUpgrading increases the rate of regeneration and range.",
"Divine Light \nMagick Cost: 40 + AbilityLevel*1.5\nRequires: 32 Skill Points Spent, Consecration\nFloods the area with holy energy that inflicts constant damage to enemies in the area.\nUpgrading increases the damage and duration of the spell.",
"Visions \nMagick Cost: 14\nRequires: 30 Skill Points Spent, Summon Legend\nFire a projectile that has a chance to convert the enemy target to your side.\nUpgrading increases the chance of conversion.",
"Intervention \nPassive\nRequires: 28 Skill Points Spent, Retribution\nOnce every 5 minutes, whenever your health is reduced to below 10%, heal yourself and become invulnerable.\nUpgrading increases the healing and duration of the invulnerability.",
"Fury Aura \nToggle\nRequires: 21 Skill Points Spent, Perserverance Aura\nAmplifies the damage done by you and nearby allies.\nUpgrading increases the damage boost and range.",
};

str ClericSpec[3] = { "\cfPurifier", "\cjOracle", "\ckInquisitor"};
str ClericSpecItem[3] = { "IsPurifier", "IsOracle", "IsInquisitor"};
str ClericSpecIcons[3][3]  =
{
	//Purifier
	{
		"ARTIBLSG",
		"ARTIDHEL",
		"ARTISANC",
	},
					   
	//Oracle
	{
		"ARTIMART",
		"ARTIJUDG",
		"ARTIPUNI",
	},
							 
	//Inquisitor
	{
		"ARTIBGFT",
		"ARTIAMAS",
		"ARTIBAIL",
	},
};

str ClericSpecNames[3][3]  =
{
	//Purifier
	{
		"Blessed Ground",
		"Deep Healing",
		"Sanctuary",
	},
					   
	//Oracle
	{
		"Martyrdom",
		"Judgement",
		"Punishment",
	},
							 
	//Inquisitor
	{
		"Blood Gift",
		"Aura Mastery",
		"Bathed In Light",
	},
};

str ClericSpecDescriptions [3][4]  =
{
	//Purifier
	{
		"A wielder of holy light, smities foes and bolstering allies.",
		"Blessed Ground\nConsecration now also heals allies for each pulse.",
		"Deep Healing\nHeals are increased by 0.5% per 1% of the target's missing health.",
		"Sanctuary\nHoly Shield can now block monsters.",
	},
					   
	//Oracle
	{
		"Watchers of the afterlife, using the spirits of the dead to wreak havoc on enemies.",
		"Martyrdom\nSummon Legend no longer has a time limit.",
		"Judgement\nVisions can now also convert enemies in a small area of effect.",
		"Punishment\nCurse now explodes, dealing damage at the end of its duration.",
	},
							 
	//Inquisitor
	{
		"A righteous crusader who strikes down foes with blunted strikes empowered by the scars of battle.",
		"Blood Gift\nAttacks with Sacrifice empowered attacks now also heal the cleric for 10% of his missing health.",
		"Aura Mastery\nAuras now give the cleric a 10% additional boost.",
		"Bathed in Light\nWhenever Intervention is triggered, you also gain a 50% damage boost and 50% damage resistance for twice the duration.",
	},
};

str MageAbilities[ABIL_ARRAYMAX] = { "Fireball", "Telekinesis", "Ice Bolt", 
                "Spark", "Fire Trap", "Mana Charge", 
                "Deep Freeze", "Energy Absorb", 
                "Meteor", "Arcane Barrier", 
                "Blizzard", "Thunderstorm", "Pillar Of Flame", 
				"Polymorph", "Artic Glacier", "Lightning Surge", };
				
str MageItemNames[ABIL_ARRAYMAX] = { "MFireBall", "Telekinesis", "IceBolt", "MSpark", 
						"FireTrap", "ManaCharge",  "DeepFreeze", "EnergyAbsorb", 
						"Meteor", "ArcaneBarrier", "Blizzard", "Thunderstorm",
						"PillarOfFlame", "Polymorph", "ArticGlacier", "LightningSurge", };
				
str MageIcons[ABIL_ARRAYMAX] = { "ARTIDFBA", "ARTITK", "ARTIICBO", 
                "ARTISPAR", "ARTIFT", "ARTIMCHA", 
                "ARTIFREE", "ARTIABSO", "ARTIMETE",
                "ARTIMARM", "ARTIBLIZ", "ARTITHST", 
				"ARTIFPIL", "ARTIPOLY", "ARTIGLAC", "ARTISURG", };



str DescriptionArrayM[ABIL_ARRAYMAX] = {
"Fireball \nMagick Cost: 7 + AbilityLevel/2\nSend out a bouncing fireball.\nUpgrading increases the damage of the spell, Fire Trap, Meteor, and Pillar of Flame.",
"Telekinesis \nMagick Cost: 4\nDeflect nearby projectiles and monsters infront of you .\nUpgrading increases strength and range of the repulsion.",
"Ice Bolt \nMagick Cost: 3 + AbilityLevel/2\nFire a shard of ice.\nUpgrading increases the damage of the spell, Deep Freeze, Blizzard, and Artic Glacier.",
"Spark \nMagick Cost: 5 + AbilityLevel/2\nBlast an area with electricity.\nUpgrading increases the damage of the spell, Energy Absorb, Thunderstorm, and Lightning Surge.",
"Fire Trap \nMagick Cost: 10 + AbilityLevel\nRequires: 9 Skill Points Spent, Fireball\nSummons a floating orb of fire that explodes upon contact.\nUpgrading increases the damage of the spell, Meteor, and Pillar of Flame.",
"Mana Charge \nMagick Cost: 1\nRequires: 7 Skill Points Spent, Telekinesis\nRegenerate mana at the cost of Magick over time.\nUpgrading reduces the magick drain rate and increases the mana regeneration rate.",
"Deep Freeze \nMagick Cost: 15 + AbilityLevel\nRequires: 12 Skill Points Spent, Ice Bolt\nFire a ball of ice that freezes nearby monsters around it.\nUpgrading increases the damage of the spell, Blizzard, and Artic Glacier.",
"Energy Absorb \nMagick Cost: 7\nRequires: 14 Skill Points Spent, Spark\nCharge up power for the next shot from the arc of death.\nUpgrading increases the power and damage of the charge, and the damage of Thunderstorm and Lightning Surge.",
"Meteor \nMagick Cost: 35 + AbilityLevel*1.5\nRequires: 21 Skill Points Spent, Fire Trap\nFire a large meteor that leaves burning flames on impact.\nUpgrading increases the damage of the spell and Pillar of Flame.",
"Arcane Barrier \nMagick Cost: 25% of Max Magick\nRequires: 18 Skill Points Spent, Mana Charge\nConverts 25% of your total Magick into a damage absorbing shield.\nUpgrading increases the amount of shield gained.",
"Blizzard \nMagick Cost: 30 + AbilityLevel*1.5\nRequires: 24 Skill Points Spent, Deep Freeze\nCreate a shower of icicles to rain down on target area.\nUpgrading increases the damage and duration of the spell and Artic Glacier.",
"Thunderstorm \nMagick Cost: 6 + AbilityLevel/5\nRequires: 23 Skill Points Spent, Energy Absorb\nConjure a deadly storm of lightning nearby.\nUpgrading increases the damage of the spell and Lightning Surge.",
"Pillar Of Flame \nMagick Cost: 70 + AbilityLevel*2\nRequires: 27 Skill Points Spent, Meteor\nSummon a fireball to crash down from above.\nUpgrading increases the damage of the spell.",
"Polymorph \nMagick Cost: 15 + AbilityLevel\nRequires: 22 Skill Points Spent, Fade\nFire a projectile that morphs the target into a pig.\nUpgrading increases the amount of projectiles fired.",
"Artic Glacier \nMagick Cost: 60 + AbilityLevel*2\nRequires: 30 Skill Points Spent, Blizzard\nCreates an area of sharp ice spikes, damaging all enemies near them.\nUpgrading increases the damage of the spell.",
"Lightning Surge \nMagick Cost: 65 + AbilityLevel*2\nRequires: 29 Skill Points Spent, Thunderstorm\nFire a slow moving orb that sends out bolts of lightning to nearby enemies.\nUpgrading increases the damage and duration of the spell.",
};

str MageSpec[3] = { "\cgPyro", "\cnIceborn", "\chArchon"};
str MageSpecItem[3] = { "IsPyro", "IsIceborn", "IsArchon"};
str MageSpecIcons [3][3]  =
{
	//Pyro
	{
		"ARTIFMAS",
		"ARTIFSHL",
		"ARTIBWAV",
	},
					   
	//Iceborn
	{
		"ARTIIMAS",
		"ARTIIARM",
		"ARTIFRIG",
	},
							 
	//Archon
	{
		"ARTIEMAS",
		"ARTIEWRD",
		"ARTIGBAR",
	},
};

str MageSpecNames [3][3]  =
{
	//Pyro
	{
		"Flame Mastery",
		"Molten Shield",
		"Blast Wave",
	},
					   
	//Iceborn
	{
		"Ice Mastery",
		"Ice Armor",
		"Frigidity",
	},
							 
	//Archon
	{
		"Energy Mastery",
		"Energy Ward",
		"Greater Arcane Barrier",
	},
};

str MageSpecDescriptions [3][4]  =
{
	//Pyro
	{
		"A spellcaster igniting enemies with gouts of fire and flame.",
		"Flame Mastery\nAll fire damage dealt is increased by 10%.",
		"Molten Shield\nReduces fire damage taken by 20% and causes attacking monsters to take damage.",
		"Blast Wave\nExplosive fire damage now inflict full damage in it's splash radius.",
	},
					   
	//Iceborn
	{
		"A wielder of ice and cold who freezes and shatters enemies in their tracks.",
		"Ice Mastery\nAll ice damage is increased by 10%.",
		"Ice Armor\nReduces ice damage taken by 20% and reduces all other damage taken by 10%.",
		"Frigidity\nAll ice spells force pain.",
	},
							 
	//Archon
	{
		"Manipulator of mana and energy, creating storms and warping space to annihilate foes.",
		"Energy Mastery\nAll lightning and arcane damage is increased by 10%.",
		"Energy Ward\nReduces arcane and lightning damage by 20% and causes incoming damage to restore magick.",
		"Greater Arcane Barrier\nArcane Barrier now also grants allies a barrier for 50% of the original barrier.",
	},
};
				
str HunterAbilities[ABIL_ARRAYMAX] = { "Ranged Mastery", "Blade Mastery", "Bear Trap", 
                "Sprint", "Fire Arrow", "Precision", "Invigoration",  
                "Spike Trap", "Camoflauge", "Ice Arrow", "Fan of Knives", 
				"Trip Bomb", "Nature's Salve", "Lightning Arrow",
				"Noxious Trap", "Raven Companion", };

str HunterItemNames[ABIL_ARRAYMAX] = { "RangedMastery", "BladeMastery", "BearTrapSkill",
							 "Sprint", "FireArrowSkill", "Precision", "Invigoration", "SpikeTrapSkill",
							 "Camoflauge", "IceArrowSkill", "FanOfKnives", "TripBomb", "NaturesSalve", 
							 "LightningArrow", "NoxiousTrapSkill", "RavenCompanion", };

str HunterIcons[ABIL_ARRAYMAX] = { "ARTIRNGE", "ARTIBLMA", "ARTIBEAR", "ARTISPRT",
                "ARTIFRAR", "ARTIPREC", "ARTIIVIG", "ARTISPTR",
                "ARTICAMO", "ARTIICAR", "ARTIKNIF", "ARTIGLYP", "ARTISALV",
                "ARTILIAR", "ARTINOXS", "ARTIRAVN", };

str DescriptionArrayH[ABIL_ARRAYMAX] = {
"Ranged Mastery \nPassive\nIncrease the damage of your ranged weaponry.\nUpgrading increases the damage of your ranged weaponry.",
"Blade Mastery \nPassive\nIncrease the damage of your blade based attacks.\nUpgrading increases your damage with blade based attacks.",
"Bear Trap \nMagick Cost: 8\nPlace a bear trap, inflicting damage to whatever steps on it.\nUpgrading increases the damage of the trap.",
"Sprint \nMagick Cost: 2\nIncrease your movement speed by 50%.\nUpgrading reduces the magick drain rate.",
"Fire Arrow \nMagick Cost: 4\nRequires: 5 Skill Points Spent, Ranged Mastery\nEnchant your bow to shoot explosive flaming arrows.\nUpgrading increases the damage of the arrows.",
"Precision \nMagick Cost: 2\nRequires: 9 Skill Points Spent, Blade Mastery, Ranged Mastery\nIncreases all your damage.\nUpgrading increases the damage bonus and reduces the magick drain rate.",
"Invigoration \nPassive\nRequires: 5 Skill Points Spent, Melee Mastery\nMachete attacks have a chance to give you health regeneration and a damage increase for 10 seconds.\nUpgrading increases the chance to trigger.",
"Spike Trap Skill \nMagick Cost: 12\nRequires: 12 Skill Points Spent, Bear Trap\nPlace a spike trap when stepped on, sends a spike to impale enemies.\nUpgrading increases the damage and duration of impalement.",
"Camoflauge \nMagick Cost: 1\nRequires: 7 Skill Points Spent, Sprint\nBecome stealthened, causing monster attacks to miss, be unable to be tracked by seeker missiles, and be unable to be hit by physical projectiles.\nUpgrading reduces the magick draining rate.",
"Ice Arrow \nMagick Cost: 6\nRequires: 10 Skill Points Spent, Fire Arrow\nEnchant your bow to shoot several shards of ice.\nUpgrading increases the damage of the arrows.",
"Fan of Knives \nMagick Cost: 15\nRequires: 16 Skill Points Spent, Invigoration\nSend out several throwing knives around you.\nUpgrading increases the damage of the knives.",
"Trip Bomb \nMagick Cost: 12 + AbilityLevel/2\nRequires: 15 Skill Points Spent, Spike Trap\nPlace a mine infront of you that sends out a trip wire.\nUpgrading increases the damage of the trap.",
"Nature's Salve \nMagick Cost: 14 + AbilityLevel/2\nRequires: 14 Skill Points Spent, Camoflauge\nPlaces a potion that will heal whoever picks it up.\nUpgrading increases the health restored.",
"Lightning Arrow \nMagick Cost: 8\nRequires: 20 Skill Points Spent, Ice Arrow\nEnchant your bow to shoot a piercing bolt of lightning.\nUpgrading increases the damage of the arrow.",
"Noxious Trap \nMagick Cost: 16 + AbilityLevel\nRequires: 21 Skill Points Spent, Trip Bomb\nPlace a trap that fills the room with toxic gas when triggered.\nUpgrading increases the damage of the trap.",
"Raven Companion \nMagick Cost: 14\nRequires: 24 Skill Points Spent, Nature's Salve\nSummon a raven that will assist you in combat.\nUpgrading increases the power of the raven.",
};

str HunterSpec[3] = { "\cbMarksman", "\cuDuelist", "\cdSurvivalist"};
str HunterSpecItem[3] = { "IsMarksman", "IsDuelist", "IsSurvivalist"};

str HunterSpecIcons [3][3]  =
{
	//Marksman
	{
		"ARTIFOCS",
		"ARTIMOBI",
		"ARTIEEYE",
	},
					   
	//Duelist
	{
		"ARTILACE",
		"ARTIPOST",
		"ARTIPARR",
	},
							 
	//Survivalist
	{
		"ARTITLAU",
		"ARTIPSLV",
		"ARTIETRP",
	},
};

str HunterSpecNames [3][3]  =
{
	//Pyro
	{
		"Focus",
		"Mobility",
		"Farsight",
	},
					   
	//Iceborn
	{
		"Laceration",
		"Posthaste",
		"Deterrance",
	},
							 
	//Survivalist
	{
		"Trap Launching",
		"Potent Salve",
		"Entrapment",
	},
};

str HunterSpecDescriptions [3][4]  =
{
	//Marksman
	{
		"A sharpshooter who uses ranged weaponry to kill from afar.",
		"Focus\nStanding still for 5 seconds grants a 2x damage bonus.",
		"Mobility\nThe Enchanted Bow no longer slows you when drawn.",
		"Farsight\nUnlocks your weapon's ability to zoom, granting a 2x zoom effect and a 25% damage increase. Does not apply to Machete.",
	},
					   
	//Duelist
	{
		"An agile fighter who uses speed and precision to overwhelm enemies.",
		"Laceration\nThe Machete now forces pain and causes enemies to bleed overtime.",
		"Posthaste\nYou gain a speed boost whenever you take damage.",
		"Detterance\nYour machete strikes now block projectiles.",
	},
							 
	//Survivalist
	{
		"An expert in self preservation, using their wits and cunning to dispatch foes.",
		"Trap Launching\nBear Trap, Spike Trap, and Noxious Trap can now be lobbed a short distance away.",
		"Potent Salve\nNature's Salve heals health over 5 seconds instead of 10.",
		"Entrapment\nWhenever a trap is triggered, you restore magick equal to 25% of its cost.",
	},
};


str NecromancerAbilities[ABIL_ARRAYMAX] = { "Enfeeble", "Summon Shadow", "Blight", 
                "Terrify", "Summon Ghoul", "Darkness", 
                "Poison Blast", "Chaos", "Summon Revenant", 
                "Poison Nova", "Miasma", "Life Tap", 
				"Summon Death Knight", "Bone Shower", "Raise Dead", "Metamorph",};

str NecromancerIcons[ABIL_ARRAYMAX] = { "ARTIENFE", "ARTISHAD", "ARTIBLTE", 
                "ARTITERR", "ARTIGHOL", "ARTIDRKN", 
                "ARTIPBOL", "ARTICHAO", "ARTIREVE", 
                "ARTIPNOV", "ARTIMIAS", "ARTIDRAN", 
				"ARTIDKGT", "ARTIBNST", "ARTIRESS", "ARTIMTRF", };
				
str NecromancerItemNames[ABIL_ARRAYMAX] = { "Enfeeble", "SummonShadow", "Blight",
							 "Terrify", "SummonGhoul", "Darkness", "PoisonBlast", "Chaos",
							 "SummonRevenant", "PoisonNova", "Miasma", "Drain", 
							 "SummonDeathKnight", "BoneShower", "RaiseDead", "Metamorph", };

str DescriptionArrayN[ABIL_ARRAYMAX] = {
"Enfeeble \nMagick Cost: 5\nCurses the target, lowering their damage and defense.\nUpgrading increases the effectiveness of the spell.",
"Summon Shadow \nMagick Cost: 10\nSummons a shadow, a ranged-oriented minion.\nUpgrading increases the power of the minion and the damage of Darkness.",
"Blight \nMagick Cost: 6 + AbilityLevel/2\nCreate toxic gas at target location, causing damage over time.\nUpgrading increases the duration of Blight and the damage of Blight, Poison Blast, and Miasma.",
"Terrify \nMagick Cost: 8\nRequires: 4 Skill Points Spent, Enfeeble\nCurses the target, causing them to run away in fear.\nUpgrading increases the duration of the spell.",
"Summon Ghoul \nMagick Cost: 20\nRequires: 7 Skill Points Spent, Summon Shadow\nSummons a ghoul, a melee-oriented minion.\nUpgrading increases the power of the minion and the damage of Poison Nova.",
"Darkness \nMagick Cost: 8 + AbilityLevel/2\nRequires: 6 Skill Points Spent, Summon Shadow\nSends out a bouncing cloud of deadly smoke.\nUpgrading increases the damage of the spell.",
"Poison Blast \nMagick Cost: 12 + AbilityLevel\nRequires: 10 Skill Points Spent, Blight\nFire an erratic poisonous blast.\nUpgrading increases the damage of Poison Blast and Miasma.",
"Chaos \nMagick Cost: 10\nRequires: 8 Skill Points Spent, Terrify\nCurses the target, causing nearby monsters to attack it.\nUpgrading increases the duration of the spell.",
"Summon Revenant \nMagick Cost: 30\nRequires: 14 Skill Points Spent, Summon Ghoul\nSummons a revenant, a support-oriented minion.\nUpgrading increases the power of the minion and the damage of Bone Shower.",
"Poison Nova \nMagick Cost: 15+AbilityLevel\nRequires: 18 Skill Points Spent, Darkness, Summon Ghoul\nCause a burst of poison to erupt from you.\nUpgrading increases the damage of the spell.",
"Miasma \nMagick Cost: 2\nRequires: 15 Skill Points Spent, Poison Blast\nDesecrates the area nearby, inflicting steady damage over time.\nUpgrading increases the damage of the spell.",
"Life Tap \nMagick Cost: 12+AbilityLevel/2\nRequires: 12 Skill Points Spent, Chaos\nCurses a target, causing them to heal nearby teammates.\nUpgrading increases the amount of health restored.",
"Summon Death Knight \nMagick Cost: 40\nRequires: 21 Skill Points Spent, Summon Revenant\nSummons a death knight, an AoE-oriented minion.\nUpgrading increases the power of the minion and the damage of Metamorph.",
"Bone Shower \nMagick Cost: 25+AbilityLevel*2\nRequires: 24 Skill Points Spent, Poison Nova, Summon Revenant\nCauses bone spikes to rain from the sky infront of you.\nUpgrading increases the damage of the spell.",
"Raise Dead \nMagick Cost: 25\nRequires: 26 Skill Points Spent, Summon Death Knight\nResurrect slain enemies infront of you.\nUpgrading increases range and amount of monsters resurrected.",
"Metamorph \nMagick Cost: 25\nRequires: 28 Skill Points Spent, Bone Shower, Summon Death Knight\nTransform into a powerful demon.\nUpgrading increases the power and duration of the spell.",
};

str NecromancerSpec[3] = { "\cqPlaguebringer", "\cmHarvester", "\ctConjuror"};
str NecromancerSpecItem[3] = { "IsPlaguebringer", "IsHarvester", "IsConjuror"};

str NecromancerSpecIcons [3][3]  =
{
	//Plaguebringer
	{
		"ARTIEPID",
		"ARTIPLAG",
		"ARTIOUTB",
	},
					   
	//Harvester
	{
		"ARTIDFIL",
		"ARTIREAP",
		"ARTIBBND",
	},
							 
	//Conjuror
	{
		"ARTISERV",
		"ARTIDREN",
		"ARTIUINF",
	},
};

str NecromancerSpecNames [3][3]  =
{
	//Pyro
	{
		"Epidemic",
		"Plague",
		"Outbreak",
	},
					   
	//Iceborn
	{
		"Defilement",
		"Reap",
		"Blood Bound",
	},
							 
	//Survivalist
	{
		"Servitude",
		"Deathly Renewal",
		"Unholy Infusion",
	},
};

str NecromancerSpecDescriptions [3][4]  =
{
	//Plaguebringer
	{
		"A master of poisons and toxins, spreading disease all around to bring foes an agonizing death.",
		"Epidemic\nPoison attacks are now fully explosive and have a 50% larger splash radius.",
		"Plague\nPoisonous projectiles now cause extra poison damage overtime.",
		"Outbreak\nAny monster that is killed by you explodes in Blight.",
	},
					   
	//Harvester
	{
		"A manipulator of souls who uses them to either bolster allies or impair enemies.",
		"Defilement\nCurse abilities now also afflict nearby enemies.",
		"Reap\nNearby enemies have a chance to drop a soul upon death, restoring some health and mana.",
		"Blood Bound\nWhenever you are healed, you also heal nearby allies for 25% of the healing received.",
	},
							 
	//Conjuror
	{
		"Master of death, raising the dead and commanding summons to overwhelm enemies.",
		"Servitude\nWhenever a summon is killed, restore magick equal to 50% of its cost.",
		"Deathly Renewal\nSummon health regeneration is doubled.",
		"Unholy Infusion\nHaving a Shadow out makes you ghostlike, having a Ghoul out reduces damage taken by 15%, having a Revenant out increases your speed by 15%, and having a Death Knight out increases your damage by 15%.",
	},
};

str AccessoryNames[14] = {
"None",
"QuickSilver Treads",
"Living Steel Amulet",
"Lich Skull",
"Mask of Terror",
"Polymorph Protection Rune",
"Talisman of the Depths",
"Ring Of Focus",
"Charm of Spirit",
"Bracers of Force",
"Cloak of Shadows",
"Blood Amulet",
"Philosopher's Stone",
"Orb Of Clarity",
};

str AccessoryDescriptions[14] = {
" ",
"Increases your movement speed and jump height by 20%.",
"You regenerate a point of Armor every 10 seconds, up to 20 points.",
"Your attacks have a chance to restore health equal to 50% of the damage dealt.",
"You cause monsters to run away from you in fear in random intervals.",
"You become immune to polymorph effects and reduces all damage by 10%.",
"You can breathe endlessly underwater and reduces ice damage taken by 50%.",
"Reduces the delay between spells by 10 tics.",
"Increases your health and magick regeneration by 50%.",
"Every 10 seconds, your weapon fires an extra magical projectile.",
"You become invisible and ghostlike in low light areas.",
"Increases your damage by 50% when below 50% health.",
"Increases success rate of alchemy, increases health gained from potions by 50%, and increases damage of flasks by 25%.",
"Killing monsters grants you a chance to restore your mana.",
};

str AccessoryImages[14] = {
"ACCESS00",
"ACCESS01",
"ACCESS02",
"ACCESS03",
"ACCESS04",
"ACCESS05",
"ACCESS06",
"ACCESS07",
"ACCESS08",
"ACCESS09",
"ACCESS10",
"ACCESS11",
"ACCESS12",
"ACCESS13",
};

str AccessoryImagesGrey[14] = {
"ACCESS00",
"ACCGSS01",
"ACCGSS02",
"ACCGSS03",
"ACCGSS04",
"ACCGSS05",
"ACCGSS06",
"ACCGSS07",
"ACCGSS08",
"ACCGSS09",
"ACCGSS10",
"ACCGSS11",
"ACCGSS12",
"ACCGSS13",
};

str AccessoryItemNames[14] = {
"Level",
"QuickSilverTreadsItem",
"LivingSteelAmuletItem",
"LichSkullItem",
"MaskOfTerrorItem",
"PolymorphProtectionRuneItem",
"TalismanOfTheDepthsItem",
"RingOfFocusItem",
"CharmOfSpiritItem",
"BracersOfForceItem",
"CloakOfShadowsItem",
"BloodAmuletItem",
"PhilosopherStoneItem",
"OrbOfClarityItem",
};

str ArmorCount[8] = { "Armour1Count", "Armour2Count", "Armour3Count", "Armour4Count", 
					 "Armour5Count", "Armour6Count", "Armour7Count", "Armour8Count"};
					 
int FighterArmor[8] = { 25, 20, 25,  5, 25, 15, 15, 10 };
int ClericArmor[8] =  { 20, 25, 20, 15,  5, 10, 20, 15 };
int MageArmor[8] =    {  5, 10,  5, 25, 10, 20,  5, 20 };
int HunterArmor[8] =  { 15, 15, 10, 10, 20, 25, 25,  5 };
int NecroArmor[8] =   { 10, 5,  15, 20, 15,  5, 10, 25 };

str PowerProtect[10] = { "PowerProtect1", "PowerProtect2", "PowerProtect3",
					    "PowerProtect4", "PowerProtect5", "PowerProtect6", "PowerProtect7",
						"PowerProtect8",  "PowerProtect9", "PowerProtect10" };
						
int PowerProtectModifier[10] = { 0.88, 0.86, 0.84,
					    0.82, 0.8, 0.78, 0.76,
						0.74,  0.72, 0.7 };
						
str PowerDeflectionDefense[10] = { "PowerDeflectionDefense1", "PowerDeflectionDefense2", "PowerDeflectionDefense3",
					    "PowerDeflectionDefense4", "PowerDeflectionDefense5", "PowerDeflectionDefense6", "PowerDeflectionDefense7",
						"PowerDeflectionDefense8",  "PowerDeflectionDefense9", "PowerDeflectionDefense10" };
						
int PowerDeflectionDefenseModifier[10] = { 0.76, 0.72, 0.68,
					    0.64, 0.6, 0.56, 0.52,
						0.48,  0.44, 0.4 };
						
str PowerBeserkCurse[10] = { "PowerBeserkCurse1", "PowerBeserkCurse2", "PowerBeserkCurse3",
					    "PowerBeserkCurse4", "PowerBeserkCurse5", "PowerBeserkCurse6", "PowerBeserkCurse7",
						"PowerBeserkCurse8",  "PowerBeserkCurse9", "PowerBeserkCurse10" };
						
int PowerBeserkCurseModifier[10] = { 1.9, 1.8, 1.7,
					    1.6, 1.5, 1.4, 1.3,
						1.2,  1.1, 1.0 };


function void SetMaximumArmor (void)
{
	if(CheckInventory("ImAFighter")==1)
	{
		SetAmmoCapacity(ArmorCount[0], FighterArmor[0]);
		SetAmmoCapacity(ArmorCount[1], FighterArmor[1]);
		SetAmmoCapacity(ArmorCount[2], FighterArmor[2]);
		SetAmmoCapacity(ArmorCount[3], FighterArmor[3]);
		SetAmmoCapacity(ArmorCount[4], FighterArmor[4]);
		SetAmmoCapacity(ArmorCount[5], FighterArmor[5]);
		SetAmmoCapacity(ArmorCount[6], FighterArmor[6]);
		SetAmmoCapacity(ArmorCount[7], FighterArmor[7]);
	}
	else if(CheckInventory("ImACleric")==1)
	{
		SetAmmoCapacity(ArmorCount[0], ClericArmor[0]);
		SetAmmoCapacity(ArmorCount[1], ClericArmor[1]);
		SetAmmoCapacity(ArmorCount[2], ClericArmor[2]);
		SetAmmoCapacity(ArmorCount[3], ClericArmor[3]);
		SetAmmoCapacity(ArmorCount[4], ClericArmor[4]);
		SetAmmoCapacity(ArmorCount[5], ClericArmor[5]);
		SetAmmoCapacity(ArmorCount[6], ClericArmor[6]);
		SetAmmoCapacity(ArmorCount[7], ClericArmor[7]);
	}
	else if(CheckInventory("ImAMage")==1)
	{
		SetAmmoCapacity(ArmorCount[0], MageArmor[0]);
		SetAmmoCapacity(ArmorCount[1], MageArmor[1]);
		SetAmmoCapacity(ArmorCount[2], MageArmor[2]);
		SetAmmoCapacity(ArmorCount[3], MageArmor[3]);
		SetAmmoCapacity(ArmorCount[4], MageArmor[4]);
		SetAmmoCapacity(ArmorCount[5], MageArmor[5]);
		SetAmmoCapacity(ArmorCount[6], MageArmor[6]);
		SetAmmoCapacity(ArmorCount[7], MageArmor[7]);
	}
	else if(CheckInventory("ImAHunter")==1)
	{
		SetAmmoCapacity(ArmorCount[0], HunterArmor[0]);
		SetAmmoCapacity(ArmorCount[1], HunterArmor[1]);
		SetAmmoCapacity(ArmorCount[2], HunterArmor[2]);
		SetAmmoCapacity(ArmorCount[3], HunterArmor[3]);
		SetAmmoCapacity(ArmorCount[4], HunterArmor[4]);
		SetAmmoCapacity(ArmorCount[5], HunterArmor[5]);
		SetAmmoCapacity(ArmorCount[6], HunterArmor[6]);
		SetAmmoCapacity(ArmorCount[7], HunterArmor[7]);
	}
	else if(CheckInventory("ImAWarlock")==1)
	{
		SetAmmoCapacity(ArmorCount[0], NecroArmor[0]);
		SetAmmoCapacity(ArmorCount[1], NecroArmor[1]);
		SetAmmoCapacity(ArmorCount[2], NecroArmor[2]);
		SetAmmoCapacity(ArmorCount[3], NecroArmor[3]);
		SetAmmoCapacity(ArmorCount[4], NecroArmor[4]);
		SetAmmoCapacity(ArmorCount[5], NecroArmor[5]);
		SetAmmoCapacity(ArmorCount[6], NecroArmor[6]);
		SetAmmoCapacity(ArmorCount[7], NecroArmor[7]);
	}
}

 #DEFINE ACCESSORY_LIMIT 13

function int UpgradeSkill (int UpgradeSlot)
{//Upgrade ability
	int IsItTrue = 0;
	if(CheckInventory("LvlUp")>0)
	{
		if(CheckInventory("ImAFighter"))
		{//fighter abilities
			if(UpgradeSlot == ABIL_MIGHTYBLOW && (CheckInventory("MightyBlow") < 10))
			{
				GiveInventory("MightyBlow",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_STOMP && (CheckInventory("Stomp") < 10 && Requirements(8,"MightyBlow")))
			{
				GiveInventory("Stomp",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_CRITICALSTRIKE && (CheckInventory("CriticalStrike") < 10))
			{
				GiveInventory("CriticalStrike",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_WARCRY && (CheckInventory("WarCry") < 10))
			{
				GiveInventory("Warcry",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_AXEMASTERY && (CheckInventory("AxeMastery") < 10 && Requirements(4,"CriticalStrike")))
			{
				GiveInventory("AxeMastery",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_BESERK && (CheckInventory("Beserk") < 10 && Requirements(12,"WarCry")))
			{
				GiveInventory("Beserk",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_CONCENTRATION && (CheckInventory("Concentration") < 10 && Requirements(20,"BloodRush")))
			{
				GiveInventory("Concentration",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_HAMMERMASTERY && (CheckInventory("HammerMastery") < 10 && Requirements(10,"AxeMastery")))
			{
				GiveInventory("HammerMastery",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_SWORDMASTERY && (CheckInventory("SwordMastery") < 10 && Requirements(18,"HammerMastery")))
			{
				GiveInventory("SwordMastery",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_CHARGE && (CheckInventory("Charge") < 10 && Requirements(10,"Stomp")))
			{
				GiveInventory("Charge",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_HOOKSHOT && (CheckInventory("HookShot") < 10 && Requirements(19,"Charge")))
			{
				GiveInventory("HookShot",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_BLOODRUSH && (CheckInventory("BloodRush") < 10 && Requirements(15,"Beserk")))
			{
				GiveInventory("BloodRush",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_BATTLESHOUT && (CheckInventory("BattleShout") < 10 && Requirements(18,"Beserk")))
			{
				GiveInventory("BattleShout",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_VENGEANCE && (CheckInventory("Vengeance") < 10 && Requirements(22,"BattleShout")))
			{
				GiveInventory("Vengeance",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_DEFLECTION && (CheckInventory("Deflection") < 10 && Requirements(24,"Concentration")))
			{
				GiveInventory("Deflection",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_DEATHBLOW && (CheckInventory("DeathBlow") < 10 && Requirements(28,"HookShot")))
			{
				GiveInventory("DeathBlow",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
		}
		if(CheckInventory("ImACleric"))
		{
			if(UpgradeSlot == ABIL_BLESSING && (CheckInventory("Blessing") < 10))
			{
				GiveInventory("Blessing",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_CURSE && (CheckInventory("Curse") < 10))
			{
				GiveInventory("Curse",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_PROTECTAURA && (CheckInventory("ProtectAura") < 10 && Requirements(14,"HolyShield")))
			{
				GiveInventory("ProtectAura",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_WRAITHS && (CheckInventory("SummonAncestors") < 10 && Requirements(8,"Curse")))
			{
				GiveInventory("SummonAncestors",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_SACRIFICE && (CheckInventory("Sacrifice") < 10 && Requirements(6,"BluntMastery")))
			{
				GiveInventory("Sacrifice",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_HOLYBOLT && (CheckInventory("HolyBolt") < 10 && Requirements(12,"Blessing")))
			{
				GiveInventory("HolyBolt",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_SUMMONLEGEND && (CheckInventory("SummonLegend") < 10 && Requirements(18,"SummonAncestors")))
			{
				GiveInventory("SummonLegend",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_FURYAURA && (CheckInventory("FuryAura") < 10 && Requirements(21,"PreserveranceAura")))
			{
				GiveInventory("FuryAura",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_DIVINELIGHT && (CheckInventory("DivineLight") < 10 && Requirements(32,"Consecration")))
			{
				GiveInventory("DivineLight",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_VISIONS && (CheckInventory("Visions") < 10 && Requirements(30,"SummonLegend")))
			{
				GiveInventory("Visions",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_BluntMastery && (CheckInventory("BluntMastery") < 10))
			{
				GiveInventory("BluntMastery",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_RETRIBUTION && (CheckInventory("Retribution") < 10 && Requirements(20,"Sacrifice")))
			{
				GiveInventory("Retribution",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_HOLYSHIELD && (CheckInventory("HolyShield") < 10 && Requirements(9,"Blessing")))
			{
				GiveInventory("HolyShield",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_CONSECRATION && (CheckInventory("Consecration") < 10 && Requirements(23,"HolyBolt")))
			{
				GiveInventory("Consecration",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_PRESERVERANCEAURA && (CheckInventory("PreserveranceAura") < 10 && Requirements(17,"ProtectAura")))
			{
				GiveInventory("PreserveranceAura",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_INTERVENTION && (CheckInventory("Intervention") < 10 && Requirements(18,"Retribution")))
			{
				GiveInventory("Intervention",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
		}
		if(CheckInventory("ImAMage"))
		{//fighter abilities
			if(UpgradeSlot == ABIL_TELEKINESIS && (CheckInventory("Telekinesis") < 10))
			{
				GiveInventory("Telekinesis",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_FIRETRAP && (CheckInventory("FireTrap") < 10 && Requirements(9,"MFireBall")))
			{
				GiveInventory("FireTrap",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_MANACHARGE && (CheckInventory("ManaCharge") < 10 && Requirements(7,"Telekinesis")))
			{
				GiveInventory("ManaCharge",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_ICEBOLT && (CheckInventory("IceBolt") < 10))
			{
				GiveInventory("IceBolt",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_SPARK && (CheckInventory("MSpark") < 10))
			{
				GiveInventory("MSpark",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_DEEPFREEZE && (CheckInventory("DeepFreeze") < 10 && Requirements(12,"IceBolt")))
			{
				GiveInventory("DeepFreeze",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_POLYMORPH && (CheckInventory("PolyMorph") < 10 && Requirements(22,"ArcaneBarrier")))
			{
				GiveInventory("Polymorph",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_FIREBALL && (CheckInventory("MFireBall") < 10))
			{
				GiveInventory("MFireball",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_METEOR && (CheckInventory("Meteor") < 10 && Requirements(21,"FireTrap")))
			{
				GiveInventory("Meteor",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_ENERGYABSORB && (CheckInventory("EnergyAbsorb") < 10 && Requirements(14,"MSpark")))
			{
				GiveInventory("EnergyAbsorb",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_THUNDERSTORM && (CheckInventory("ThunderStorm") < 10 && Requirements(23,"EnergyAbsorb")))
			{
				GiveInventory("Thunderstorm",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_BLIZZARD && (CheckInventory("Blizzard") < 10 && Requirements(24,"DeepFreeze")))
			{
				GiveInventory("Blizzard",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_PILLAROFFLAME && (CheckInventory("PillarOfFlame") < 10 && Requirements(27,"Meteor")))
			{
				GiveInventory("PillarOfFlame",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_ARCANEBARRIER && (CheckInventory("ArcaneBarrier") < 10 && Requirements(18,"ManaCharge")))
			{
				GiveInventory("ArcaneBarrier",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_ARTICGLACIER && (CheckInventory("ArticGlacier") < 10 && Requirements(30,"Blizzard")))
			{
				GiveInventory("ArticGlacier",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_LIGHTNINGSURGE && (CheckInventory("LightningSurge") < 10 && Requirements(29,"Thunderstorm")))
			{
				GiveInventory("LightningSurge",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
		}
		if(CheckInventory("ImAHunter"))
		{//fighter abilities
			if(UpgradeSlot == ABIL_RANGEDMASTERY && (CheckInventory("RangedMastery") < 10))
			{
				GiveInventory("RangedMastery",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_MELEEMASTERY && (CheckInventory("BladeMastery") < 10))
			{
				GiveInventory("BladeMastery",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_BEARTRAP && (CheckInventory("BearTrapSkill") < 10))
			{
				GiveInventory("BearTrapSkill",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_FIREARROW && (CheckInventory("FireArrowSkill") < 10 && Requirements(5,"RangedMastery")))
			{
				GiveInventory("FireArrowSkill",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_PRECISION && (CheckInventory("Precision") < 10 && Requirements2(9,"RangedMastery", "BladeMastery")))
			{
				GiveInventory("Precision",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_INVIGORATION && (CheckInventory("Invigoration") < 10 && Requirements(5,"BladeMastery")))
			{
				GiveInventory("Invigoration",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_SPIKETRAP && (CheckInventory("SpikeTrapSkill") < 10 && Requirements(12,"BearTrapSkill")))
			{
				GiveInventory("SpikeTrapSkill",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_ICEARROW && (CheckInventory("IceArrowSkill") < 10 && Requirements(10,"FireArrowSkill")))
			{
				GiveInventory("IceArrowSkill",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_NOXIOUSTRAP && (CheckInventory("NoxiousTrapSkill") < 10 && Requirements(21,"TripBomb")))
			{
				GiveInventory("NoxiousTrapSkill",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_LIGHTNINGARROW && (CheckInventory("LightningArrow") < 10 && Requirements(20,"IceArrowSkill")))
			{
				GiveInventory("LightningArrow",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_CAMOFLAUGE && (CheckInventory("Camoflauge") < 10 && Requirements(7,"Sprint")))
			{
				GiveInventory("Camoflauge",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_TRIPBOMB && (CheckInventory("TripBomb") < 10 && Requirements(15,"SpikeTrapSkill")))
			{
				GiveInventory("TripBomb",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_FANOFKNIVES && (CheckInventory("FanOfKnives") < 10 && Requirements(16,"Invigoration")))
			{
				GiveInventory("FanOfKnives",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_SPRINT && (CheckInventory("Sprint") < 10))
			{
				GiveInventory("Sprint",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_NATURESSALVE && (CheckInventory("NaturesSalve") < 10 && Requirements(14,"Camoflauge")))
			{
				GiveInventory("NaturesSalve",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_RAVENCOMPANION && (CheckInventory("RavenCompanion") < 10 && Requirements(24,"NaturesSalve")))
			{
				GiveInventory("RavenCompanion",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
		}
		if(CheckInventory("ImAWarlock"))
		{//fighter abilities
			if(UpgradeSlot == ABIL_ENFEEBLE && (CheckInventory("Enfeeble") < 10))
			{
				GiveInventory("Enfeeble",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_SUMMONSHADOW && (CheckInventory("SummonShadow") < 10))
			{
				GiveInventory("SummonShadow",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_BLIGHT && (CheckInventory("Blight") < 10))
			{
				GiveInventory("Blight",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_TERRIFY && (CheckInventory("Terrify") < 10 && Requirements(4,"Enfeeble")))
			{
				GiveInventory("Terrify",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_SUMMONGHOUL && (CheckInventory("SummonGhoul") < 10 && Requirements(7,"SummonShadow")))
			{
				GiveInventory("SummonGhoul",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_DARKNESS && (CheckInventory("Darkness") < 10 && Requirements(6,"SummonShadow")))
			{
				GiveInventory("Darkness",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_POISONBLAST && (CheckInventory("PoisonBlast") < 10 && Requirements(10,"Blight")))
			{
				GiveInventory("PoisonBlast",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_CHAOS && (CheckInventory("Chaos") < 10 && Requirements(8,"Terrify")))
			{
				GiveInventory("Chaos",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_SUMMONREVENANT && (CheckInventory("SummonRevenant") < 10 && Requirements(14,"SummonGhoul")))
			{
				GiveInventory("SummonRevenant",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_POISONNOVA && (CheckInventory("PoisonNova") < 10 && Requirements2(18,"Darkness","SummonGhoul")))
			{
				GiveInventory("PoisonNova",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_MIASMA && (CheckInventory("Miasma") < 10 && Requirements(15,"PoisonBlast")))
			{
				GiveInventory("Miasma",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_DRAIN && (CheckInventory("Drain") < 10 && Requirements(12,"Chaos")))
			{
				GiveInventory("Drain",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_SUMMONDEATHKNIGHT && (CheckInventory("SummonDeathKnight") < 10 && Requirements(21,"SummonRevenant")))
			{
				GiveInventory("SummonDeathKnight",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_BONESHOWER && (CheckInventory("BoneShower") < 10 && Requirements2(24,"PoisonNova","SummonRevenant")))
			{
				GiveInventory("BoneShower",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_METAMORPH && (CheckInventory("Metamorph") < 10 && Requirements2(28,"BoneShower","SummonDeathKnight")))
			{
				GiveInventory("Metamorph",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
			if(UpgradeSlot == ABIL_RAISEDEAD && (CheckInventory("RaiseDead") < 10 && Requirements(26,"SummonDeathKnight")))
			{
				GiveInventory("RaiseDead",1);
				TakeInventory("LvlUp",1); GiveInventory("SkillPoint",1); IsItTrue = 1;
			}
		}
	}
	return IsItTrue;
}

//RPG Scripts

script WOC_SETGLOBALLEVEL OPEN
{
	MapGlobalLevel = CheckLevelAverage();
	If(!MapGlobalLevel)
		MapGlobalLevel = 1;
	MapPlayerCount = PlayerCount();
	If(!MapPlayerCount)
		MapPlayerCount = 1;
}

script WOC_STARTSCRIPT ENTER
{
	Int StartLevel = GetCvar("WoC_MinLevel")-1;
	If(StartLevel>0 && !CheckInventory("InGame"))
	{
		GiveInventory("Level", StartLevel);
		GiveInventory("LvlUp", StartLevel);
		GiveInventory("LvlUpPoints", StartLevel*3);
		//IncreaseMaximumHealth
		SetManaCapacity();
		SetMagickCapacity();
		if(CheckInventory("ImAFighter")==1)
		{
			GiveInventory("MP",2*StartLevel);
			SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+6*StartLevel);
		}
		else if(CheckInventory("ImACleric")==1)
		{
			GiveInventory("MP",3*StartLevel);
			SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+5*StartLevel);
		}
		else if(CheckInventory("ImAMage")==1)
		{
			GiveInventory("MP",6*StartLevel);
			SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+2*StartLevel);
		}
		else if(CheckInventory("ImAHunter")==1)
		{
			GiveInventory("MP",4*StartLevel);
			SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+4*StartLevel);
			
		}
		else if(CheckInventory("ImAWarlock")==1)
		{
			GiveInventory("MP",5*StartLevel);
			SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+3*StartLevel);
		}
	}
	SetManaCapacity();
	SetMagickCapacity();
	SetXPRequired();
	SetMaximumHealth();
	SetMaximumArmor();
	GiveInventory ("InGame", 1);
	If(CheckInventory("LvlUp")==0)
	{
		GiveInventory("LvlUp", 1);
		TakeInventory("LvlUp", 1);
	}
	ClearFX();
	ACS_ExecuteAlways(986,0,0,0,0);
	ACS_ExecuteAlways(WOC_FLOATINGBARS,0,0,0,0);
	SetInventory("MonsterHeightCheck", 56);
}

str InterventionInvul[10] = { "InterventionInvul1", "InterventionInvul2", "InterventionInvul3",
					    "InterventionInvul4", "InterventionInvul5", "InterventionInvul6", "InterventionInvul7",
						"InterventionInvul8",  "InterventionInvul9", "InterventionInvul10" };
						
str InterventionBoost[10] = { "InterventionBoost1", "InterventionBoost2", "InterventionBoost3",
					    "InterventionBoost4", "InterventionBoost5", "InterventionBoost6", "InterventionBoost7",
						"InterventionBoost8",  "InterventionBoost9", "InterventionBoost10" };
						
str InterventionProtect[10] = { "InterventionProtect1", "InterventionProtect2", "InterventionProtect3",
					    "InterventionProtect4", "InterventionProtect5", "InterventionProtect6", "InterventionProtect7",
						"InterventionProtect8",  "InterventionProtect9", "InterventionProtect10" };
						
str VengeanceBoost[10] = { "VengeanceBoost1", "VengeanceBoost2", "VengeanceBoost3",
					    "VengeanceBoost4", "VengeanceBoost5", "VengeanceBoost6", "VengeanceBoost7",
						"VengeanceBoost8",  "VengeanceBoost9", "VengeanceBoost10" };

#DEFINE SpeedCo 0.01
						
script WOC_RPGPLAYERSCRIPT Enter
{
 	Thing_ChangeTID(0, PlayerNumber()+PLAYERTID);
	int Kills;
	int KillBonus;
	int Items;
	int ItemsBonus;
	int SecretsFound;
	int SecretsBonus;
	int AllBonus;
	int strengthcount;
	int agilitycount;
	int constitutioncount;
	int charismacount;
	int wisdomcount;
	int intellectcount;
	int skilltype0;
	int skilltype1;
	int skilltype2;
	int skilltype3;
	int skilltype4;
	int skilltype5;
	int skilltype6;
	int skilltype7;
	int skilltype8;
	int skilltype9;
	int skilltype10;
	int skilltype11;
	int skilltype12;
	int skilltype13;
	int skilltype14;
	int skilltype15;
	int regentimer;
	int maxspeed;
	int agilitybonus;
	int maxjump;
	int jumpbonus;
	int magickregenamount;
	int healthregenamount;
	int armor;
	int barrier;
	int MPCheck;
	int MPTrack;
	int MPCountdown;
  while(playeringame (PlayerNumber()))
  {
	SetInventory("PlayerNumber", PlayerNumber());
	strengthcount = 0;
	agilitycount = 0;
	constitutioncount = 0;
	charismacount = 0;
	wisdomcount = 0;
	intellectcount = 0;
	skilltype0 = 0;
	skilltype1 = 0;
	skilltype2 = 0;
	skilltype3 = 0;
	skilltype4 = 0;
	skilltype5 = 0;
	skilltype6 = 0;
	skilltype7 = 0;
	skilltype8 = 0;
	skilltype9 = 0;
	skilltype10 = 0;
	skilltype11 = 0;
	skilltype12 = 0;
	skilltype13 = 0;
	skilltype14 = 0;
	skilltype15 = 0;
	SetActorProperty(0, APROP_NameTag, StrParam(n:0));
	armor = GetActorProperty(0, APROP_Health);
	barrier = CheckInventory("BasicArmor");
	SetInventory("PreviousHP", GetActorProperty(0, APROP_Health));
	Thing_ChangeTID(0, PlayerNumber()+PLAYERTID);//make sure our TID is correct
	//---UNIVERSAL CODE
	SetFont("FONTA");
	if(playeringame (PlayerNumber()))
	{
		//make Agility take effect
		maxspeed = (GetCVar("WoC_MaxSpeed")*1.0)/100 - CheckInventory("EnchantedBowSpeedCheck")*0.4;
		If(CheckInventory("ImAFighter")==1)
			agilitybonus = FixedDiv((CheckInventory("Agility")-12) * 0.01 , (1.0 + 3*(CheckInventory("Agility")-12) * SpeedCo)); //1.0 - (100/(100+CheckInventory("Agility")-12))*1.0;
		else If(CheckInventory("ImACleric")==1)
			agilitybonus = FixedDiv((CheckInventory("Agility")-8) * 0.01 , (1.0 + 3*(CheckInventory("Agility")-8) * SpeedCo));
		else If(CheckInventory("ImAMage")==1)
			agilitybonus = FixedDiv((CheckInventory("Agility")-7) * 0.01 , (1.0 + 3*(CheckInventory("Agility")-7) * SpeedCo));
		else If(CheckInventory("ImAHunter")==1)
			agilitybonus = FixedDiv((CheckInventory("Agility")-14) * 0.01 , (1.0 + 3*(CheckInventory("Agility")-14) * SpeedCo));
		else If(CheckInventory("ImAWarlock")==1)
			agilitybonus = FixedDiv((CheckInventory("Agility")-10) * 0.01 , (1.0 + 3*(CheckInventory("Agility")-10) * SpeedCo));
		maxjump = (GetCvar("WoC_MaxJump")*1.0);
		If(CheckInventory("Agility")<100)
			jumpbonus = (CheckInventory("Agility")*(0.04-(CheckInventory("Agility")*0.0002)));
		Else
			jumpbonus = 100*(0.04-(100*0.0002))+(CheckInventory("Agility")-100)*0.0001;
		//GiveInventory("ArmorDamageReduction",1);
		
		If(CheckInventory(ArmorCount[0]))
			GiveInventory(StrParam(s:"PowerArmor1Protection", i:CheckInventory(ArmorCount[0])),1);
		
		If(CheckInventory(ArmorCount[1]))
			GiveInventory(StrParam(s:"PowerArmor2Protection", i:CheckInventory(ArmorCount[1])),1);
			
		If(CheckInventory(ArmorCount[2]))
			GiveInventory(StrParam(s:"PowerArmor3Protection", i:CheckInventory(ArmorCount[2])),1);
		
		If(CheckInventory(ArmorCount[3]))
			GiveInventory(StrParam(s:"PowerArmor4Protection", i:CheckInventory(ArmorCount[3])),1);
			
		If(CheckInventory(ArmorCount[4]))
			GiveInventory(StrParam(s:"PowerArmor5Protection", i:CheckInventory(ArmorCount[4])),1);
		
		If(CheckInventory(ArmorCount[5]))
			GiveInventory(StrParam(s:"PowerArmor6Protection", i:CheckInventory(ArmorCount[5])),1);
			
		If(CheckInventory(ArmorCount[6]))
			GiveInventory(StrParam(s:"PowerArmor7Protection", i:CheckInventory(ArmorCount[6])),1);
		
		If(CheckInventory(ArmorCount[7]))
			GiveInventory(StrParam(s:"PowerArmor8Protection", i:CheckInventory(ArmorCount[7])),1);

		SetActorProperty(0,APROP_JumpZ,8.79 + jumpbonus - (GetCVar("WoC_JumpModifier")*1.00) + (8.79+jumpbonus-(GetCVar("WoC_JumpModifier")*1.00))/5*CheckInventory("QuickSilverTreadsTracker"));
		if(maxjump > 0 && (GetActorProperty(0,APROP_JumpZ) > maxjump - (GetCVar("WoC_JumpModifier")*1.00) + (maxjump-(GetCVar("WoC_JumpModifier")*1.00))/5*CheckInventory("QuickSilverTreadsTracker")))
			SetActorProperty(0,APROP_JumpZ,maxjump - (GetCVar("WoC_JumpModifier")*1.00) + (maxjump-(GetCVar("WoC_JumpModifier")*1.00))/5*CheckInventory("QuickSilverTreadsTracker"));
		If(CheckInventory("ImAFighter")==1)
			SetActorProperty(0,APROP_Speed,0.95+agilitybonus + (0.95+agilitybonus)/5*CheckInventory("QuickSilverTreadsTracker") );
		else If(CheckInventory("ImACleric")==1)
			SetActorProperty(0,APROP_Speed,0.85+agilitybonus + (0.85+agilitybonus)/5*CheckInventory("QuickSilverTreadsTracker"));
		else If(CheckInventory("ImAMage")==1)
			SetActorProperty(0,APROP_Speed,0.80+agilitybonus + (0.80+agilitybonus)/5*CheckInventory("QuickSilverTreadsTracker"));
		else If(CheckInventory("ImAHunter")==1)
			SetActorProperty(0,APROP_Speed,1.00+agilitybonus - CheckInventory("EnchantedBowSpeedCheck")*0.4 + (1.0+agilitybonus- CheckInventory("EnchantedBowSpeedCheck")*0.4)/5*CheckInventory("QuickSilverTreadsTracker"));
		else If(CheckInventory("ImAWarlock")==1)
			SetActorProperty(0,APROP_Speed,0.90+agilitybonus + (0.9+agilitybonus)/5*CheckInventory("QuickSilverTreadsTracker"));
		if(maxspeed > 0 && (GetActorProperty(0,APROP_Speed) > maxspeed + (maxspeed)/5*CheckInventory("QuickSilverTreadsTracker")))
			SetActorProperty(0,APROP_Speed,maxspeed + (maxspeed)/5*CheckInventory("QuickSilverTreadsTracker"));
		TakeInventory("InterventionTracker", 1);
		
		If(!CheckInventory("PowerFuryTimer"))
			SetInventory("Fury", 0);
		
		If(CheckInventory("PowerTemperanceTimer"))
			SetActorProperty(0, APROP_DamageFactor, 1.0 - CheckInventory("Temperance")*0.06);
		Else
			SetActorProperty(0, APROP_DamageFactor, 1.0);
		
		MPCHECK = CheckInventory("MP");
		
		If(CheckInventory("IsPyro"))
		{
			GiveInventory("PyroDamage",1);
			GiveInventory("PyroArmor",1);
			TakeInventory("PowerIcebornDamage",1);
			TakeInventory("PowerIcebornArmor",1);
			TakeInventory("PowerArchonDamage",1);
			TakeInventory("PowerArchonArmor",1);
		}
		else If(CheckInventory("IsIceborn"))
		{
			GiveInventory("IcebornDamage",1);
			GiveInventory("IcebornArmor",1);
			TakeInventory("PyroDamage",1);
			TakeInventory("PyroArmor",1);
			TakeInventory("PowerArchonDamage",1);
			TakeInventory("PowerArchonArmor",1);
		}
		else If(CheckInventory("IsArchon"))
		{
			GiveInventory("ArchonDamage",1);
			GiveInventory("ArchonArmor",1);
			TakeInventory("PyroDamage",1);
			TakeInventory("PyroArmor",1);
			TakeInventory("PowerIcebornDamage",1);
			TakeInventory("PowerIcebornArmor",1);
		}
		
		int MarksmanFocus;
		If((GetActorVelX(0) == 0) && (GetActorVelY(0) == 0) && (GetActorVelZ(0) == 0) && CheckInventory("IsMarksman") && StrIcmp(GetWeapon(), "Machete") != 0 )
		{
			If(MarksmanFocus < 35 * 5)
				MarksmanFocus++;
			If(MarksmanFocus >= 100)
				GiveInventory("MarksmanDamage",1);
			Else
				TakeInventory("PowerMarksmanDamage",1);
		}
		Else
		{
			MarksmanFocus = 0;
			TakeInventory("PowerMarksmanDamage",1);
		}
		
		Delay(1);
		if(armor > GetActorProperty(0,APROP_Health))
			If(CheckInventory("Vengeance"))
				GiveInventory(VengeanceBoost[CheckInventory("Vengeance")-1],1);
		If(CheckInventory("Intervention") && !CheckInventory("InterventionTracker") && GetActorProperty(0,APROP_health)>0 && (GetActorProperty(0,APROP_health)<CheckInventory("CurrentMaxHealth")/10))
		{
			ActivatorSound("ability/intervention",127);
			GiveInventory("InverventionFullHeal",1);
			GiveInventory(InterventionInvul[CheckInventory("Intervention")-1],1);
			GiveInventory("InterventionTracker", 10500);
			If(CheckInventory("IsInquisitor"))
			{
				GiveInventory(InterventionBoost[CheckInventory("Intervention")-1],1);
				GiveInventory(InterventionProtect[CheckInventory("Intervention")-1],1);
			}
		}
		
		if(armor < GetActorProperty(0,APROP_Health) && CheckInventory("IsHarvester"))
				ACS_ExecuteAlways(WOC_AREAHEAL,0,GetActorProperty(0,APROP_Health)-armor,512);
		TakeInventory("NecromancerHealed",1);
		
		int total = 0;
		for(int i = 0; i <=7; i++)
			total+=CheckInventory(ArmorCount[i]);
		SetInventory("ArmourCount",total);
		
		If((CheckInventory("BasicArmor") > 0) && (Barrier > CheckInventory("BasicArmor")) && (GetArmorInfo(ARMORINFO_CLASSNAME) == "ArcaneBarrierBonus"))
			for(int j = 0; j <=7; j++)
				If(CheckInventory(ArmorCount[j])>0 && random(1,8)==1)
					TakeInventory(ArmorCount[j],1);

		TakeInventory("FadeIntensity",1);
		regentimer++;
		If(MPCHECK > CheckInventory("MP") || CheckInventory("Punishmenting") || CheckInventory("PowerDeflectionIcon"))
			MPCountdown = 35*5;
		If(MPCountdown > 0)
			MPCountdown--;
		else
			MPTrack++;
		if(Regentimer >=35*5)
		{
			healthregenamount = ((CheckInventory("CurrentMaxHealth")*100)/5000 + (CheckInventory("CharmOfSpiritTracker")*((CheckInventory("CurrentMaxHealth")*100)/5000/2)));
			if(healthregenamount<1)
				healthregenamount = 1;
			If(CheckInventory("IsVanguard"))
				healthregenamount = healthregenamount+healthregenamount*(CheckInventory("CurrentMaxHealth")-GetActorProperty(0, APROP_Health))/(CheckInventory("CurrentMaxHealth")/2);
				
			If(GetActorProperty(0, APROP_HEALTH)>0)
				If(GetActorProperty(0, APROP_HEALTH)<(CheckInventory("CurrentMaxHealth")))
					HealingActor(0,healthregenamount);
			regentimer = 0;
		}
		
		if(MPTrack >=35*5)
		{
			magickregenamount = ((GetAmmoCapacity("MP")*100)/5000 + (CheckInventory("CharmOfSpiritTracker")*((GetAmmoCapacity("MP")*100)/5000/2)));
			if(magickregenamount<1)
				magickregenamount = 1;
				
			If(GetActorProperty(0, APROP_HEALTH)>0)
				GiveInventory("MP",magickregenamount);
			MPTrack = 0;
		}
		
		If(GetActorProperty(0, APROP_HEALTH)<(CheckInventory("CurrentMaxHealth")/4))
		{
			GiveInventory("RedHealthItem",1);
			TakeInventory("YellowHealthItem",1);
			TakeInventory("GreenHealthItem",1);
		}
		else If((GetActorProperty(0, APROP_HEALTH)<(CheckInventory("CurrentMaxHealth")/2)) && (GetActorProperty(0, APROP_HEALTH)>(CheckInventory("CurrentMaxHealth")/4)))
		{
			TakeInventory("RedHealthItem",1);
			GiveInventory("YellowHealthItem",1);
			TakeInventory("GreenHealthItem",1);
		}
		else If(GetActorProperty(0, APROP_HEALTH)>(CheckInventory("CurrentMaxHealth")/2))
		{
			TakeInventory("RedHealthItem",1);
			TakeInventory("YellowHealthItem",1);
			GiveInventory("GreenHealthItem",1);
		}
		
		SetHudSize(0,0,0);
		int success = 0;
		while (success == 0 && ((CheckInventory("Level")<GetCvar("Woc_MaxLevel")) || GetCvar("Woc_MaxLevel")==0))
		{
        if (CheckInventory("XPTracker") >= CheckInventory("Level")*100+(CheckInventory("Level")*75))
        {
		If(playeringame (PlayerNumber()))
		{
		TakeInventory("XP", (CheckInventory("Level")*100)+(CheckInventory("Level")*75));
		TakeInventory("XPTracker", (CheckInventory("Level")*100)+(CheckInventory("Level")*75));
		GiveInventory("Level",1);//level up
		LocalAmbientSound("Level/Up", 127);
		
		If(CheckInventory("Level")<=MAXSKILLPOINTS)
		{
			GiveInventory("LvlUp",1);//level up indicator, for leveling up abilities
			if(GetUserCVar(PlayerNumber(),"WoC_RandomSkills"))
			{
				while(CheckInventory("Lvlup"))
				{
					int randomskill = random(0,ABIL_MAX);
					int skilltypegive;
					if(UpgradeSkill(randomskill)==1)
						skilltypegive = randomskill;
					else 
						skilltypegive = 200;
					switch (skilltypegive)
					{
					case 0:
						skilltype0++;
						break;
					case 1:
						skilltype1++;
						break;
					case 2:
						skilltype2++;
						break;
					case 3:
						skilltype3++;
						break;
					case 4:
						skilltype4++;
						break;
					case 5:
						skilltype5++;
						break;
					case 6:
						skilltype6++;
						break;
					case 7:
						skilltype7++;
						break;
					case 8:
						skilltype8++;
						break;
					case 9:
						skilltype9++;
						break;
					case 10:
						skilltype10++;
						break;
					case 11:
						skilltype11++;
						break;
					case 12:
						skilltype12++;
						break;
					case 13:
						skilltype13++;
						break;
					case 14:
						skilltype14++;
						break;
					case 15:
						skilltype15++;
						break;
					}
				
				}
				sethudsize (800, 600, 1);
				SetFont("HBARFONT");
				if(CheckInventory("ImAFighter"))
				{
				HudMessage(s:"+",i:skilltype0,s:" ",s:FighterAbilities[0],
				s:"\n+",i:skilltype1,s:" ",s:FighterAbilities[1],
				s:"\n+",i:skilltype2,s:" ",s:FighterAbilities[2],
				s:"\n+",i:skilltype3,s:" ",s:FighterAbilities[3],
				s:"\n+",i:skilltype4,s:" ",s:FighterAbilities[4],
				s:"\n+",i:skilltype5,s:" ",s:FighterAbilities[5],
				s:"\n+",i:skilltype6,s:" ",s:FighterAbilities[6],
				s:"\n+",i:skilltype7,s:" ",s:FighterAbilities[7],
				s:"\n+",i:skilltype8,s:" ",s:FighterAbilities[8],
				s:"\n+",i:skilltype9,s:" ",s:FighterAbilities[9],
				s:"\n+",i:skilltype10,s:" ",s:FighterAbilities[10],
				s:"\n+",i:skilltype11,s:" ",s:FighterAbilities[11],
				s:"\n+",i:skilltype12,s:" ",s:FighterAbilities[12],
				s:"\n+",i:skilltype13,s:" ",s:FighterAbilities[13],
				s:"\n+",i:skilltype14,s:" ",s:FighterAbilities[14],
				s:"\n+",i:skilltype15,s:" ",s:FighterAbilities[15];HUDMSG_FADEOUT, 4002, CR_GOLD, 640.1, 180.1, 10.0);
				}
				else if(CheckInventory("ImACleric"))
				{
				HudMessage(s:"+",i:skilltype0,s:" ",s:ClericAbilities[0],
				s:"\n+",i:skilltype1,s:" ",s:ClericAbilities[1],
				s:"\n+",i:skilltype2,s:" ",s:ClericAbilities[2],
				s:"\n+",i:skilltype3,s:" ",s:ClericAbilities[3],
				s:"\n+",i:skilltype4,s:" ",s:ClericAbilities[4],
				s:"\n+",i:skilltype5,s:" ",s:ClericAbilities[5],
				s:"\n+",i:skilltype6,s:" ",s:ClericAbilities[6],
				s:"\n+",i:skilltype7,s:" ",s:ClericAbilities[7],
				s:"\n+",i:skilltype8,s:" ",s:ClericAbilities[8],
				s:"\n+",i:skilltype9,s:" ",s:ClericAbilities[9],
				s:"\n+",i:skilltype10,s:" ",s:ClericAbilities[10],
				s:"\n+",i:skilltype11,s:" ",s:ClericAbilities[11],
				s:"\n+",i:skilltype12,s:" ",s:ClericAbilities[12],
				s:"\n+",i:skilltype13,s:" ",s:ClericAbilities[13],
				s:"\n+",i:skilltype14,s:" ",s:ClericAbilities[14],
				s:"\n+",i:skilltype15,s:" ",s:ClericAbilities[15];HUDMSG_FADEOUT, 4002, CR_GOLD, 640.1, 180.1, 10.0);
				}
				else if(CheckInventory("ImAMage"))
				{
				HudMessage(s:"+",i:skilltype0,s:" ",s:MageAbilities[0],
				s:"\n+",i:skilltype1,s:" ",s:MageAbilities[1],
				s:"\n+",i:skilltype2,s:" ",s:MageAbilities[2],
				s:"\n+",i:skilltype3,s:" ",s:MageAbilities[3],
				s:"\n+",i:skilltype4,s:" ",s:MageAbilities[4],
				s:"\n+",i:skilltype5,s:" ",s:MageAbilities[5],
				s:"\n+",i:skilltype6,s:" ",s:MageAbilities[6],
				s:"\n+",i:skilltype7,s:" ",s:MageAbilities[7],
				s:"\n+",i:skilltype8,s:" ",s:MageAbilities[8],
				s:"\n+",i:skilltype9,s:" ",s:MageAbilities[9],
				s:"\n+",i:skilltype10,s:" ",s:MageAbilities[10],
				s:"\n+",i:skilltype11,s:" ",s:MageAbilities[11],
				s:"\n+",i:skilltype12,s:" ",s:MageAbilities[12],
				s:"\n+",i:skilltype13,s:" ",s:MageAbilities[13],
				s:"\n+",i:skilltype14,s:" ",s:MageAbilities[14],
				s:"\n+",i:skilltype15,s:" ",s:MageAbilities[15];HUDMSG_FADEOUT, 4002, CR_GOLD, 640.1, 180.1, 10.0);
				}
				else if(CheckInventory("ImAHunter"))
				{
				HudMessage(s:"+",i:skilltype0,s:" ",s:HunterAbilities[0],
				s:"\n+",i:skilltype1,s:" ",s:HunterAbilities[1],
				s:"\n+",i:skilltype2,s:" ",s:HunterAbilities[2],
				s:"\n+",i:skilltype3,s:" ",s:HunterAbilities[3],
				s:"\n+",i:skilltype4,s:" ",s:HunterAbilities[4],
				s:"\n+",i:skilltype5,s:" ",s:HunterAbilities[5],
				s:"\n+",i:skilltype6,s:" ",s:HunterAbilities[6],
				s:"\n+",i:skilltype7,s:" ",s:HunterAbilities[7],
				s:"\n+",i:skilltype8,s:" ",s:HunterAbilities[8],
				s:"\n+",i:skilltype9,s:" ",s:HunterAbilities[9],
				s:"\n+",i:skilltype10,s:" ",s:HunterAbilities[10],
				s:"\n+",i:skilltype11,s:" ",s:HunterAbilities[11],
				s:"\n+",i:skilltype12,s:" ",s:HunterAbilities[12],
				s:"\n+",i:skilltype13,s:" ",s:HunterAbilities[13],
				s:"\n+",i:skilltype14,s:" ",s:HunterAbilities[14],
				s:"\n+",i:skilltype15,s:" ",s:HunterAbilities[15];HUDMSG_FADEOUT, 4002, CR_GOLD, 640.1, 180.1, 10.0);
				}
				else if(CheckInventory("ImAWarlock"))
				{
				HudMessage(s:"+",i:skilltype0,s:" ",s:NecromancerAbilities[0],
				s:"\n+",i:skilltype1,s:" ",s:NecromancerAbilities[1],
				s:"\n+",i:skilltype2,s:" ",s:NecromancerAbilities[2],
				s:"\n+",i:skilltype3,s:" ",s:NecromancerAbilities[3],
				s:"\n+",i:skilltype4,s:" ",s:NecromancerAbilities[4],
				s:"\n+",i:skilltype5,s:" ",s:NecromancerAbilities[5],
				s:"\n+",i:skilltype6,s:" ",s:NecromancerAbilities[6],
				s:"\n+",i:skilltype7,s:" ",s:NecromancerAbilities[7],
				s:"\n+",i:skilltype8,s:" ",s:NecromancerAbilities[8],
				s:"\n+",i:skilltype9,s:" ",s:NecromancerAbilities[9],
				s:"\n+",i:skilltype10,s:" ",s:NecromancerAbilities[10],
				s:"\n+",i:skilltype11,s:" ",s:NecromancerAbilities[11],
				s:"\n+",i:skilltype12,s:" ",s:NecromancerAbilities[12],
				s:"\n+",i:skilltype13,s:" ",s:NecromancerAbilities[13],
				s:"\n+",i:skilltype14,s:" ",s:NecromancerAbilities[14],
				s:"\n+",i:skilltype15,s:" ",s:NecromancerAbilities[15];HUDMSG_FADEOUT, 4002, CR_GOLD, 640.1, 180.1, 10.0);
				}
				sethudsize (0, 0, 1);
			}
		}
		
		GiveInventory("LvlUpPoints",3);
		
		if(GetUserCVar(PlayerNumber(),"WoC_RandomStats"))
		{
		for(int SkillAmounts = CheckInventory("LvlUpPoints"); SkillAmounts>0; SkillAmounts--)
		{
		int choosestat = random(0,5);
		switch (choosestat)
		{
		case 0:
			GiveInventory("Strength", 1);
			strengthcount++;
			TakeInventory("LvlUpPoints",1);
			break;
		case 1:
			GiveInventory("Agility", 1);
			agilitycount++;
			TakeInventory("LvlUpPoints",1);
			break;
		case 2:
			GiveInventory("Constitution", 1);
			constitutioncount++;
			SetMaximumHealth();
			if(CheckInventory("ImAFighter")==1 && GetActorProperty(0, APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+6);
			else if(CheckInventory("ImACleric")==1 && GetActorProperty(0, APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+5);
			else if(CheckInventory("ImAMage")==1 && GetActorProperty(0, APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+2);
			else if(CheckInventory("ImAHunter")==1 && GetActorProperty(0, APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+4);
			else if(CheckInventory("ImAWarlock")==1 && GetActorProperty(0, APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+3);
			TakeInventory("LvlUpPoints",1);
			break;
		/*case 3:
			GiveInventory("Willpower", 1);
			willpowercount++;
			TakeInventory("LvlUpPoints",1);
			break;*/
		case 3:
			GiveInventory("Wisdom", 1);
			wisdomcount++;
			TakeInventory("LvlUpPoints",1);
			if(CheckInventory("ImAFighter")==1)
				GiveInventory("MP",2);
			else if(CheckInventory("ImACleric")==1)
				GiveInventory("MP",3);
			else if(CheckInventory("ImAMage")==1)
				GiveInventory("MP",6);
			else if(CheckInventory("ImAHunter")==1)
				GiveInventory("MP",4);
			else if(CheckInventory("ImAWarlock")==1)
				GiveInventory("MP",5);
			break;
		case 4:
			GiveInventory("Intellect", 1);
			intellectcount++;
			TakeInventory("LvlUpPoints",1);
			break;
		case 5:
			GiveInventory("Charisma", 1);
			charismacount++;
			TakeInventory("LvlUpPoints",1);
			break;
			}
		}
		//s:"\n+",i:willpowercount,s:" willpower",
		SetFont("HBARFONT");
		sethudsize (800, 600, 1);
		HudMessage(s:"+",i:strengthcount,s:" strength",
		s:"\n+",i:agilitycount,s:" agility",
		s:"\n+",i:constitutioncount,s:" constitution",
		s:"\n+",i:wisdomcount,s:" wisdom",
		s:"\n+",i:intellectcount,s:" intellect",
		s:"\n+",i:charismacount,s:" charisma";HUDMSG_FADEOUT, 4001, CR_GOLD, 640.1, 60.1, 10.0);
		sethudsize (0, 0, 1);
		}
		SetManaCapacity();
		SetMagickCapacity();
		SetMaximumHealth();
		if(CheckInventory("ImAFighter")==1)
		{
			If(GetActorProperty(0, APROP_Health) > 0)
			{
				GiveInventory("MP",2);
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+6);
			}
		}
		else if(CheckInventory("ImACleric")==1)
		{
			If(GetActorProperty(0, APROP_Health) > 0)
			{
				GiveInventory("MP",3);
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+5);
			}
		}
		else if(CheckInventory("ImAMage")==1)
		{
			If(GetActorProperty(0, APROP_Health) > 0)
			{
				GiveInventory("MP",6);
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+2);
			}
		}
		else if(CheckInventory("ImAHunter")==1)
		{
			If(GetActorProperty(0, APROP_Health) > 0)
			{
				GiveInventory("MP",4);
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+4);
			}
		}
		else if(CheckInventory("ImAWarlock")==1)
		{
			If(GetActorProperty(0, APROP_Health) > 0)
			{
				GiveInventory("MP",5);
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+3);
			}
		}

		SetXPRequired();
		sethudsize (800, 600, 1);
		SetFont("HBARFONT");
		HudMessageBold (n:0,s:" \cdleveled up to level ", i:CheckInventory("Level");HUDMSG_FADEOUT,966,CR_WHITE, 400.0, 500.0, 10.0);
		SetFont("LargeFont");
		hudmessage (s:"you have reached level ",i:CheckInventory("Level"); HUDMSG_FADEOUT, 966, CR_WHITE, 400.0, 500.0, 10.0);
		SetFont("SMALLFONT");
		sethudsize (0, 0, 1);
	}
	}
	else {success = 1;}
	}
	SetInventory("XP", CheckInventory("XPTracker"));
	If(CheckInventory("Level")>=GetCvar("Woc_MaxLevel") && GetCvar("Woc_MaxLevel")>0)
	{
		SetInventory("XP", 0);
		SetInventory("XPTracker", 0);
	}
	if(GetCVar("WoC_DisableAwards")==0)
	{
	int CurrentKills = GetLevelInfo(LEVELINFO_KILLED_MONSTERS);
	int CurrentItems = GetLevelInfo(LEVELINFO_FOUND_ITEMS);
	int CurrentSecretsFound = GetLevelInfo(LEVELINFO_FOUND_SECRETS);
	int ActualExperianceAward, ExperienceGained;
	//int ExperianceAward = ActualExperianceAward + ((ActualExperianceAward*(CheckInventory("Wisdom")))*100)/10000;
	
	SetFont("HBARFONT");
	sethudsize (800, 600, 1);
	// 100% Kills
	if (GetLevelInfo(LEVELINFO_TOTAL_MONSTERS)==0)
	{
		KillBonus = true;
	}
	else if (CurrentKills >= GetLevelInfo(LEVELINFO_TOTAL_MONSTERS) && !KillBonus)
	{
		ActualExperianceAward = (CheckInventory("Level")*7)+CurrentKills;
		int EXPMirrored = CurrentKills;
		ExperienceGained = GiveXP(0, ActualExperianceAward);
		LocalAmbientSound("killall/monsters",127);
		HudMessage(s:"100% Monsters Killed!\n", d:ExperienceGained, s:" Experience Bonus!";
				   HUDMSG_FADEOUT,785,CR_White,400.4,480.0,4.0,0.5);
		KillBonus = true;
	}
	
	// 100% Items
	if (GetLevelInfo(LEVELINFO_TOTAL_ITEMS)==0)
	{
		ItemsBonus = true;
	}
	else if (CurrentItems >= GetLevelInfo(LEVELINFO_TOTAL_ITEMS) && !ItemsBonus)
	{
		SetActorProperty(0, APROP_Health, CheckInventory("CurrentMaxHealth"));
		SetInventory("MP", GetAmmoCapacity("MP"));
		LocalAmbientSound("findall/items",127);
		HudMessage(s:"100% Items Found!\nHP/Magick Restored!";
				   HUDMSG_FADEOUT,785,CR_White,400.4,480.0,4.0,0.5);
		ItemsBonus = true;
	}

	// Secrets
	if (GetLevelInfo(LEVELINFO_TOTAL_SECRETS)==0)
	{
		SecretsBonus = true;
	}
	else if (CurrentSecretsFound == SecretsFound + 1)
	{
		LocalAmbientSound("secret/found",127);
		if (CurrentSecretsFound < GetLevelInfo(LEVELINFO_TOTAL_SECRETS))
		{
			GiveInventory("Money",10);
			HudMessage(s:"Secret Found!\n10 Gold Bonus!";
						   HUDMSG_FADEOUT,0,CR_White,400.4,480.0,4.0,0.5);
		}
		if (CurrentSecretsFound >= GetLevelInfo(LEVELINFO_TOTAL_SECRETS))
		{
			GiveInventory("Money",10+GetLevelInfo(LEVELINFO_TOTAL_SECRETS)*10);
			HudMessage(s:"100% Secrets Found!\n", d:10+GetLevelInfo(LEVELINFO_TOTAL_SECRETS)*10, s:" Gold Bonus!";
					   HUDMSG_FADEOUT,785,CR_White,400.4,480.0,4.0,0.5);
			SecretsBonus = true;
		}
	}
	
	// All Kills/Items/Secrets 100%
	if ((KillBonus && ItemsBonus && SecretsBonus) && !AllBonus)
	{
		//Everything
		If(GetLevelInfo(LEVELINFO_TOTAL_SECRETS)>0 && GetLevelInfo(LEVELINFO_TOTAL_ITEMS)>0 && GetLevelInfo(LEVELINFO_TOTAL_MONSTERS)>0)
		{
			SetActorProperty(0, APROP_Health, CheckInventory("CurrentMaxHealth"));
			SetInventory("MP", GetAmmoCapacity("MP"));
			ActualExperianceAward = (CheckInventory("Level")*7)+EXPMirrored;
			ExperienceGained = GiveXP(0, ActualExperianceAward);
			GiveInventory("Money",GetLevelInfo(LEVELINFO_TOTAL_SECRETS)*10);
			HudMessage(s:"Map Completed!\n\n",
					   d:ExperienceGained, s:" Experience Bonus!\n", s:"HP/Magick Restored!\n", d:GetLevelInfo(LEVELINFO_TOTAL_SECRETS)*10, s:" Gold Bonus!";
					   HUDMSG_FADEOUT,0,CR_White,400.4,300.0,4.0,0.5);
			AllBonus = true;
		}
		//If no secrets
		else If(GetLevelInfo(LEVELINFO_TOTAL_SECRETS)==0 && GetLevelInfo(LEVELINFO_TOTAL_ITEMS)>0 && GetLevelInfo(LEVELINFO_TOTAL_MONSTERS)>0)
		{
			SetActorProperty(0, APROP_Health, CheckInventory("CurrentMaxHealth"));
			SetInventory("MP", GetAmmoCapacity("MP"));
			ActualExperianceAward = (CheckInventory("Level")*7)+EXPMirrored;
			ExperienceGained = GiveXP(0, ActualExperianceAward);
			HudMessage(s:"Map Completed!\n\n",
					   d:ExperienceGained, s:" Experience Bonus!\n", s:"HP/Magick Restored!";
					   HUDMSG_FADEOUT,0,CR_White,400.4,300.0,4.0,0.5);
			AllBonus = true;
		}
		//If no items
		else If(GetLevelInfo(LEVELINFO_TOTAL_SECRETS)>0 && GetLevelInfo(LEVELINFO_TOTAL_ITEMS)==0 && GetLevelInfo(LEVELINFO_TOTAL_MONSTERS)>0)
		{
			ActualExperianceAward = (CheckInventory("Level")*7)+EXPMirrored;
			ExperienceGained = GiveXP(0, ActualExperianceAward);
			GiveInventory("Money",GetLevelInfo(LEVELINFO_TOTAL_SECRETS)*10);
			HudMessage(s:"Map Completed!\n\n",
					   d:ExperienceGained, s:" Experience Bonus!\n", d:GetLevelInfo(LEVELINFO_TOTAL_SECRETS)*10, s:" Gold Bonus!";
					   HUDMSG_FADEOUT,0,CR_White,400.4,300.0,4.0,0.5);
			AllBonus = true;
		}
		//If no monsters
		else If(GetLevelInfo(LEVELINFO_TOTAL_SECRETS)>0 && GetLevelInfo(LEVELINFO_TOTAL_ITEMS)>0 && GetLevelInfo(LEVELINFO_TOTAL_MONSTERS)==0)
		{
			SetActorProperty(0, APROP_Health, CheckInventory("CurrentMaxHealth"));
			SetInventory("MP", GetAmmoCapacity("MP"));
			GiveInventory("Money",GetLevelInfo(LEVELINFO_TOTAL_SECRETS)*10);
			HudMessage(s:"Map Completed!\n\n",
					   s:"HP/Magick Restored!\n", d:GetLevelInfo(LEVELINFO_TOTAL_SECRETS)*10, s:" Gold Bonus!";
					   HUDMSG_FADEOUT,0,CR_White,400.4,300.0,4.0,0.5);
			AllBonus = true;
		}
		//If only secret
		else If(GetLevelInfo(LEVELINFO_TOTAL_SECRETS)>0 && GetLevelInfo(LEVELINFO_TOTAL_ITEMS)==0 && GetLevelInfo(LEVELINFO_TOTAL_MONSTERS)==0)
		{
			GiveInventory("Money",GetLevelInfo(LEVELINFO_TOTAL_SECRETS)*10);
			HudMessage(s:"Map Completed!\n\n",
					   d:GetLevelInfo(LEVELINFO_TOTAL_SECRETS)*10, s:" Gold Bonus!";
					   HUDMSG_FADEOUT,0,CR_White,400.4,300.0,4.0,0.5);
			AllBonus = true;
		}
		//If only item
		else If(GetLevelInfo(LEVELINFO_TOTAL_SECRETS)==0 && GetLevelInfo(LEVELINFO_TOTAL_ITEMS)>0 && GetLevelInfo(LEVELINFO_TOTAL_MONSTERS)==0)
		{
			SetActorProperty(0, APROP_Health, CheckInventory("CurrentMaxHealth"));
			SetInventory("MP", GetAmmoCapacity("MP"));
			HudMessage(s:"Map Completed!\n\n",
					   s:"";
					   HUDMSG_FADEOUT,0,CR_White,400.4,300.0,4.0,0.5);
			AllBonus = true;
		}
		//If only monster
		else If(GetLevelInfo(LEVELINFO_TOTAL_SECRETS)==0 && GetLevelInfo(LEVELINFO_TOTAL_ITEMS)==0 && GetLevelInfo(LEVELINFO_TOTAL_MONSTERS)>0)
		{
			ActualExperianceAward = (CheckInventory("Level")*7)+EXPMirrored;
			ExperienceGained = GiveXP(0, ActualExperianceAward);
			HudMessage(s:"Map Completed!\n\n",
					   d:ExperienceGained, s:" Experience Bonus!";
					   HUDMSG_FADEOUT,0,CR_White,400.4,300.0,4.0,0.5);
			AllBonus = true;
		}
		//If nothing
		else If(GetLevelInfo(LEVELINFO_TOTAL_SECRETS)==0 && GetLevelInfo(LEVELINFO_TOTAL_ITEMS)==0 && GetLevelInfo(LEVELINFO_TOTAL_MONSTERS)==0)
			AllBonus = true;
	}
	
	
	CurrentKills = Kills;
	CurrentItems = Items;
	SecretsFound = CurrentSecretsFound;
	sethudsize (0, 0, 1);
	}
	}
	}
}

script WOC_DECORATE (int type, int option, int suboption)  //Type either Game 0, Stat 1, or Skill 2.
{
	If(type == GAMESETTINGS)
	{
		if(option == GORELEVEL)
		{
			if(GetCVar("WoC_GoreLevel")==0)
				SetResultValue(0);
			else if(GetCVar("WoC_GoreLevel")==1)
				SetResultValue(1);
		}
		
		if(option == WEAPONSTAY)
		{
			If(GetCVAR("sv_weaponstay")==1)
				SetResultValue(0);
		}
		
		if(option == DAMAGEINDICATOR)
		{
			If(GetCVAR("WOC_DAMAGEINDICATOR")==1)
				SetResultValue(1);
			else If(GetCVAR("WOC_DAMAGEINDICATOR")==0)
				SetResultValue(0);
		}
	}
	
	else If(type == STATS)
	{
		if(suboption == TARGET)
			SetActivatorToTarget(0);
		
		if(suboption == TRACER)
			SetActivator(0,AAPTR_TRACER);
		
		if(suboption == MASTER)
			SetActivator(0,AAPTR_MASTER);
			
		if(suboption == MASTERPLAYER)
			SetActivator(ActivatorTID()-PET5TID+PLAYERTID);
			
		if(suboption == TARGETMASTERPLAYER)
		{
			SetActivatorToTarget(0);
			SetActivator(ActivatorTID()-PET5TID+PLAYERTID);
		}
			
		if(option == STRENGTH)
		{
			int DamageModifier = CheckInventory("Strength");
			if(CheckInventory("Sacrificeing"))DamageModifier = DamageModifier+(DamageModifier*(100+CheckInventory("Sacrifice")*10)/100);//sacrifice strength calculation
			if(CheckInventory("Beserking"))DamageModifier = DamageModifier+(DamageModifier*(50+CheckInventory("Beserk")*5)/100);//berserk strength calculation
			if(CheckInventory("Fury"))DamageModifier = (DamageModifier*(1.0+(CheckInventory("Fury")*0.02))) >> 16;
			SetResultValue(DamageModifier);
		}
		
		if(option == AGILITY)
			SetResultValue(CheckInventory("Agility"));
		if(option == CONSTITUTION)
			SetResultValue(CheckInventory("Constitution"));
		if(option == WISDOM)
			SetResultValue(CheckInventory("Wisdom"));
		if(option == INTELLECT)
			SetResultValue(CheckInventory("Intellect"));
		if(option == BASESTRENGTH)
			SetResultValue(CheckInventory("Strength"));
		if(option == CHARISMA)
			SetResultValue(CheckInventory("Charisma"));
		if(option == LEVEL)
			SetResultValue(CheckInventory("Level"));
		if(option == GLOBALLEVEL)
			SetResultValue(Checklevelaverage());
		if(option == MAXHEALTH)
			SetResultValue(CheckInventory("CurrentMaxHealth"));
		if(option == MAXARMOR)
		{
			If(CheckInventory("ImAFighter"))
				SetResultValue(140);
			else If(CheckInventory("ImACleric"))
				SetResultValue(130);
			else If(CheckInventory("ImAMage"))
				SetResultValue(100);
			else If(CheckInventory("ImAHunter"))
				SetResultValue(125);
			else If(CheckInventory("ImAWarlock"))
				SetResultValue(105);
		}
		if(option == MAXARMOR1)
		{
			If(CheckInventory("ImAFighter"))
				SetResultValue(25);
			else If(CheckInventory("ImACleric"))
				SetResultValue(20);
			else If(CheckInventory("ImAMage"))
				SetResultValue(5);
			else If(CheckInventory("ImAHunter"))
				SetResultValue(15);
			else If(CheckInventory("ImAWarlock"))
				SetResultValue(10);
		}
		if(option == MAXARMOR2)
		{
			If(CheckInventory("ImAFighter"))
				SetResultValue(20);
			else If(CheckInventory("ImACleric"))
				SetResultValue(25);
			else If(CheckInventory("ImAMage"))
				SetResultValue(10);
			else If(CheckInventory("ImAHunter"))
				SetResultValue(15);
			else If(CheckInventory("ImAWarlock"))
				SetResultValue(5);
		}
		if(option == MAXARMOR3)
		{
			If(CheckInventory("ImAFighter"))
				SetResultValue(25);
			else If(CheckInventory("ImACleric"))
				SetResultValue(20);
			else If(CheckInventory("ImAMage"))
				SetResultValue(5);
			else If(CheckInventory("ImAHunter"))
				SetResultValue(10);
			else If(CheckInventory("ImAWarlock"))
				SetResultValue(15);
		}
		if(option == MAXARMOR4)
		{
			If(CheckInventory("ImAFighter"))
				SetResultValue(5);
			else If(CheckInventory("ImACleric"))
				SetResultValue(15);
			else If(CheckInventory("ImAMage"))
				SetResultValue(25);
			else If(CheckInventory("ImAHunter"))
				SetResultValue(10);
			else If(CheckInventory("ImAWarlock"))
				SetResultValue(20);
		}
		if(option == MAXARMOR5)
		{
			If(CheckInventory("ImAFighter"))
				SetResultValue(25);
			else If(CheckInventory("ImACleric"))
				SetResultValue(5);
			else If(CheckInventory("ImAMage"))
				SetResultValue(10);
			else If(CheckInventory("ImAHunter"))
				SetResultValue(20);
			else If(CheckInventory("ImAWarlock"))
				SetResultValue(15);
		}
		if(option == MAXARMOR6)
		{
			If(CheckInventory("ImAFighter"))
				SetResultValue(15);
			else If(CheckInventory("ImACleric"))
				SetResultValue(10);
			else If(CheckInventory("ImAMage"))
				SetResultValue(20);
			else If(CheckInventory("ImAHunter"))
				SetResultValue(25);
			else If(CheckInventory("ImAWarlock"))
				SetResultValue(5);
		}
		if(option == MAXARMOR7)
		{
			If(CheckInventory("ImAFighter"))
				SetResultValue(15);
			else If(CheckInventory("ImACleric"))
				SetResultValue(20);
			else If(CheckInventory("ImAMage"))
				SetResultValue(5);
			else If(CheckInventory("ImAHunter"))
				SetResultValue(25);
			else If(CheckInventory("ImAWarlock"))
				SetResultValue(10);
		}
		if(option == MAXARMOR8)
		{
			If(CheckInventory("ImAFighter"))
				SetResultValue(10);
			else If(CheckInventory("ImACleric"))
				SetResultValue(15);
			else If(CheckInventory("ImAMage"))
				SetResultValue(20);
			else If(CheckInventory("ImAHunter"))
				SetResultValue(5);
			else If(CheckInventory("ImAWarlock"))
				SetResultValue(25);
		}
		if(option == MAXMANA)
			SetResultValue(GetAmmoCapacity("Mana1"));
		if(option == PLAYERNUM)
			SetResultValue(PlayerNumber());
		if(option == ITEMCAP)
			SetResultValue(3+CheckInventory("Strength")/2);
		if(option == PREVIOUSHP)
			SetResultValue(CheckInventory("PreviousHP"));
		if(option == ZPOSITION)
			SetResultValue(GetActorZ(0) >> 16);
		if(option == ISFRIEND)
			SetResultValue(IsFriendly(0));
		if(option == MAXMAGICK)
			SetResultValue(GetAmmoCapacity("MP"));
		if(option == XOUTBREAK)
			SetResultValue(CheckInventory("XOutbreak"));
		if(option == YOUTBREAK)
			SetResultValue(CheckInventory("YOutbreak"));
		if(option == ZOUTBREAK)
			SetResultValue(CheckInventory("ZOutbreak"));
	}
	
	else If(type == FIGHTERSKILLS)
	{
		if(suboption == TARGET)
			SetActivatorToTarget(0);
		
		SetResultValue(CheckInventory(FighterItemNames[option]));
	}
	
	else If(type == CLERICSKILLS)
	{
		if(suboption == TARGET)
			SetActivatorToTarget(0);
		
		SetResultValue(CheckInventory(ClericItemNames[option]));
	}
	
	else If(type == MAGESKILLS)
	{
		if(suboption == TARGET)
			SetActivatorToTarget(0);
		
		SetResultValue(CheckInventory(MageItemNames[option]));
	}
	
	else If(type == HUNTERSKILLS)
	{
		if(suboption == TARGET)
			SetActivatorToTarget(0);
		
		SetResultValue(CheckInventory(HunterItemNames[option]));
	}
	
	else If(type == NECROMANCERSKILLS)
	{
		if(suboption == TARGET)
			SetActivatorToTarget(0);
		
		SetResultValue(CheckInventory(NecromancerItemNames[option]));
	}
	
	else If(type == MONSTERACS)
	{
		if(option == MEDUSA)
		{
			int MedusaAngle = GetActorAngle(0) >> 8;
			SetActivatorToTarget(0);
			int TargetAngle = GetActorAngle(0) >> 8;
			if((TargetAngle >= (MedusaAngle-160)%256) && (TargetAngle <= (MedusaAngle+160)%256))
				SetResultValue(1);
			else
				SetResultValue(0);
		}
		if(option == PREVHEALTH && CheckInventory("CurrentMaxHealth"))
		{
			int intensity;
			if(checkInventory("FadeIntensity"))
				intensity = CheckInventory("FadeIntensity")+100*(CheckInventory("PreviousHP")-GetActorProperty(0,APROP_Health))/(CheckInventory("CurrentMaxHealth"));
			else
				intensity = 100*(CheckInventory("PreviousHP")-GetActorProperty(0,APROP_Health))/(CheckInventory("CurrentMaxHealth"));
			If(suboption == 0)
			{
				If(Intensity > 75)
					SetInventory("FadeIntensity", 75);
				else
					SetInventory("FadeIntensity", intensity);
				If(CheckInventory("PreviousHP")>GetActorProperty(0, APROP_Health))
				{
					for(int count = 0; count < 8; count++)
						If(CheckInventory(ArmorCount[count])>0 && random(1,8)==1)
							TakeInventory(ArmorCount[count],1);
					If(Intensity == 0)
						SetInventory("FadeIntensity", 1);
				}
			}
			//Print(d:CheckInventory("FadeIntensity"));
			SetResultValue(CheckInventory("FadeIntensity"));
			SetInventory("PreviousHP",GetActorProperty(0,APROP_Health));
		}
		if(option == PREVHEALTH2 && CheckInventory("CurrentMaxHealth"))
		{
			int intensity2;
			if(checkInventory("FadeIntensity"))
				intensity2 = CheckInventory("FadeIntensity")+100*(CheckInventory("PreviousHP")-GetActorProperty(0,APROP_Health))/(CheckInventory("CurrentMaxHealth"));
			else
				intensity2 = 100*(CheckInventory("PreviousHP")-GetActorProperty(0,APROP_Health))/(CheckInventory("CurrentMaxHealth"));
			If(suboption == 0)
			{
				If(Intensity2 > 75)
					SetInventory("FadeIntensity", 75);
				else
					SetInventory("FadeIntensity", intensity2);
				If(CheckInventory("PreviousHP")>GetActorProperty(0, APROP_Health))
				{
					If(Intensity2 == 0)
						SetInventory("FadeIntensity", 1);
				}
			}
			//Print(d:CheckInventory("FadeIntensity"));
			SetResultValue(CheckInventory("FadeIntensity"));
			SetInventory("PreviousHP",GetActorProperty(0,APROP_Health));
		}
	}
}

script WOC_DEATHSCRIPT DEATH
{
	If(GetCVar("Woc_ExpDeath")==1)
	{
		TakeInventory("XP", (CheckInventory("XP")*GetCVar("WOC_ExpDeathAmount")*0.01) >> 16);
		TakeInventory("XPTracker", (CheckInventory("XP")*GetCVar("WOC_ExpDeathAmount")*0.01) >> 16);
	}
	else If(GetCVar("Woc_ExpDeath")==2)
	{
		TakeInventory("XP", (GetAmmoCapacity("XP")*GetCVar("WOC_ExpDeathAmount")*0.01) >> 16);
		TakeInventory("XPTracker", (GetAmmoCapacity("XP")*GetCVar("WOC_ExpDeathAmount")*0.01) >> 16);
	}
	If(GetCVar("Woc_GoldDeath")==1)
		TakeInventory("Money", (CheckInventory("Money")*GetCVar("WOC_GoldDeathAmount")*0.01) >> 16);
	ClearFX();
}

script WOC_RESPAWNSCRIPT RESPAWN
{
	Thing_ChangeTID(0, PlayerNumber()+PLAYERTID);
	SetManaCapacity();
	SetMagickCapacity();
	SetXPRequired();
	SetMaximumHealth();
	SetMaximumArmor();
	SetActorProperty(0, APROP_Health, CheckInventory("CurrentMaxHealth"));
	TakeInventory("BruiserWeapon", 1);
}

Script 787 ENTER Clientside
{
	SetManaCapacity();
	SetMagickCapacity();
	SetXPRequired();
	SetMaximumHealth();
	SetMaximumArmor();
}

Script 788 RETURN Clientside
{
	SetManaCapacity();
	SetMagickCapacity();
	SetXPRequired();
	SetMaximumHealth();
	SetMaximumArmor();
}

Script WOC_MONSTERSCRIPT (int base, int height, int flags)
{
	int basehealth = GetActorProperty(0,APROP_Health);
	int growth, variable, average, players;
	if(MapGlobalLevel)
		average = MapGlobalLevel+(GameSkill()*(GameSkill()-2)+2);
	else
		average = Checklevelaverage()+(GameSkill()*(GameSkill()-2)+2);
		
	If(MapPlayerCount)
		players = MapPlayerCount;
	Else
		players = PlayerCount();
		
	
	if(!CheckInventory("Level"))
		variable = average+random(-5-(average/10),5+(average/10));
	else 
		variable = CheckInventory("Level");
	
	if(variable<1)
			variable = 1;
	
	if(flags & WOC_NORANDOM)
		variable = Checklevelaverage();
	
	if(flags & WOC_MAXLEVEL)
		variable = (average+5+(average/10));
		
	If(ACS_ExecuteWithResult(WOC_DECORATE,STATS,LEVEL,MASTER))
		variable = ACS_ExecuteWithResult(WOC_DECORATE,STATS,LEVEL,MASTER);
	
	if(flags & WOC_BOSS)
	{
		variable = (average+5+(average/10));
		SetInventory("ImAWhat",WOC_BOSS);
		SetInventory("NoFear", 1);
	}
	
	If(flags & WOC_SUBBOSS)
		SetInventory("NoFear", 1);
	
	If(flags & WOC_STAT)
	{
		SetInventory("Strength", variable+10);
		SetInventory("Intellect", variable+10);
		SetInventory("Agility", variable+10);
		SetInventory("Charisma", variable+10);
		SetInventory("Wisdom", variable+10);
	}
	
	growth = (((basehealth * (variable-1))*0.02)+FixedMul((basehealth*1.0+(basehealth * (variable-1))*0.02),(Players-1)*0.2)) >> 16;
	if(flags & WOC_BOSS)
		growth = (basehealth*(Players-1)*0.2) >> 16;
	
	If(flags & WOC_ALLYSUMMON)
	{
		SetInventory("Charisma", CheckActorInventory(ActivatorTID()-PET5TID+PLAYERTID,"Charisma"));
		variable = CheckActorInventory(ActivatorTID()-PET5TID+PLAYERTID,"Level");
		growth = ((basehealth * (variable+CheckInventory("Charisma")-1))*0.02) >> 16;
		str AllySummoner = GetActorProperty(ActivatorTID()-PET5TID+PLAYERTID, APROP_NameTag);
		SetActorProperty(0, APROP_NameTag, Strparam(s:AllySummoner,s:"\c-'s ", s:GetActorProperty(0, APROP_NameTag)));
	}
	
	If(flags & WOC_TRACERSUMMON)
	{
		SetInventory("Charisma", ACS_ExecuteWithResult(WOC_DECORATE,STATS,CHARISMA,TRACER));
		variable = ACS_ExecuteWithResult(WOC_DECORATE,STATS,LEVEL,TRACER);
		growth = ((basehealth * (variable+CheckInventory("Charisma")-1))*0.02) >> 16;
		str TracerSummoner = GetActorProperty(PLAYERTID+ACS_ExecuteWithResult(WOC_DECORATE,STATS,PLAYERNUM,TRACER), APROP_NameTag);
		SetActorProperty(0, APROP_NameTag, Strparam(s:TracerSummoner,s:"\c-'s ", s:GetActorProperty(0, APROP_NameTag)));
	}
	
	SetActorProperty(0,APROP_HEALTH, basehealth+growth);
	
	If(CheckInventory("CurrentMaxHealth")<1)
		ACS_ExecuteAlways(900,0,height,0,0);
	
	SetInventory("CurrentMaxHealth", basehealth+growth);
	
	SetInventory("Level", variable);
	
	If(!CheckInventory("FriendlyInDisguise") && CheckActorProperty(0, APROP_Friendly, 1) || CheckInventory("EnemyInDisguise"))
	{
		SetActorProperty(0,APROP_Species,"Player");
		GiveInventory("FriendlyResurrect",1);
	}
}

Script WOC_MONSTERXPSCRIPT (int defaultxp) //EXP from Monsters
{
	int XPGIFT = (CheckInventory("CurrentMaxHealth")*0.1) >> 16;
	int NECROHEAL = CheckInventory("DrainHeal");
	int MONSTERLEVEL = CheckInventory("Level");
	If(GetActorProperty(0,APROP_Health)<=0)
	{
		SetInventory("CurrentMaxHealth",0);
		SetInventory("DrainHeal",0);
	}
	int x = GetActorX(0);
	int y = GetActorY(0);
	int z = GetActorZ(0);
	
	for (int j = 0; j < MAXPLAYERS; j++) 
	{
		if (!playeringame (j))
			continue;
		if(distance(0,j+PLAYERTID) < 2096 && CheckSight(0, j+PLAYERTID, 0))
			if(CheckActorInventory(j+PLAYERTID,"IsHarvester"))
				if(DropItem(0, "HarvesterSoul", 1, 64))
					Break;
	}
	
	GiveInventory("OutbreakItem",1);
	
	If(CheckInventory("EnemyInDisguise")==0 && CheckActorProperty(0, APROP_Friendly, 0) || CheckInventory("FriendlyInDisguise")>0 )
	{
		If(XPGIFT < 8)
			XPGIFT = 8;
		SetActivatorToTarget(0);
		If(CheckInventory("ImAPet") && CheckInventory("RavenCompanion"))
		{
			If(ActivatorTID() - PET1TID < MAXPLAYERS)
				SetActivator(ActivatorTID()-PET1TID+PLAYERTID);
			else If(ActivatorTID() - PET2TID < MAXPLAYERS)
				SetActivator(ActivatorTID()-PET2TID+PLAYERTID);
			else If(ActivatorTID() - PET3TID < MAXPLAYERS)
				SetActivator(ActivatorTID()-PET3TID+PLAYERTID);
		}
		else If(CheckInventory("ImAPet") && (CheckInventory("SummonLegend")))
			SetActivator(ActivatorTID()-PET1TID+PLAYERTID);
		else If(CheckInventory("ImAPet") && (CheckInventory("SummonShadow")))
			SetActivator(ActivatorTID()-PET1TID+PLAYERTID);
		else If(CheckInventory("ImAPet") && (CheckInventory("SummonGhoul")))
			SetActivator(ActivatorTID()-PET2TID+PLAYERTID);
		else If(CheckInventory("ImAPet") && (CheckInventory("SummonRevenant")))
			SetActivator(ActivatorTID()-PET3TID+PLAYERTID);
		else If(CheckInventory("ImAPet") && (CheckInventory("SummonDeathKnight")))
			SetActivator(ActivatorTID()-PET4TID+PLAYERTID);
		else If((ActivatorTID() >= PET5TID) && (ActivatorTID() < MAXPLAYERS+PET5TID))
			SetActivator(ActivatorTID()-PET5TID+PLAYERTID);
			
		If(GameType() == GAME_SINGLE_PLAYER)
			SetActivator(PLAYERTID);
			
		If(CheckInventory("IsDestroyer"))
			GiveInventory("FuryDamage",1);
		
		If(NecroHeal > 0 && CheckIfPlayer(0) && !CheckInventory("ImAPet"))
			GiveInventory("DrainEffectPuffSurround",1);
		
		for (int i = 0; i < MAXPLAYERS; i++) 
		{
			if (!playeringame (i))
				continue;
			if(distance(0,I+PLAYERTID) < 2096)
			{
				if(CheckActorInventory(I+PLAYERTID,"Level") < (CheckLevelAverage()))
					int XPCOMPENSATE = (CheckLevelAverage()-CheckActorInventory(I+PLAYERTID,"Level"));
				If(GetCVar("WoC_DisableKillingSpree")==0)
					If(CheckInventory("ImAFighter") || CheckInventory("ImACleric") || CheckInventory("ImAMage") || CheckInventory("ImAHunter") || CheckInventory("ImAWarlock"))
						ACS_ExecuteAlways(WOC_MULTIKILLSCRIPT,0,0,0,0);
				If((CheckActorInventory(I+PLAYERTID,"Level")<GetCvar("Woc_MaxLevel")) || GetCvar("Woc_MaxLevel")==0)
					GiveXP(I+PLAYERTID, XPGIFT + XPCOMPENSATE);
				If(CheckSight(0, I+PLAYERTID, 0))
				{
					HealingActor(I+PLAYERTID, NECROHEAL);
					HealingActor(I+PET1TID, NECROHEAL);
					HealingActor(I+PET2TID, NECROHEAL);
					HealingActor(I+PET3TID, NECROHEAL);
					HealingActor(I+PET4TID, NECROHEAL);
				}
			}
		}
		If(CheckInventory("OrbOfClarityTracker"))
		{
			int rand = random(0,9);
			if(rand==1)
			{
				GiveInventory("Mana1", GetAmmoCapacity("Mana1")/20);
				GiveInventory("Mana2", GetAmmoCapacity("Mana2")/20);
			}
		}
	}
	else If(CheckActorProperty(0, APROP_Friendly, 1) || CheckInventory("EnemyInDisguise")>0)
		Terminate;
}

Script WOC_MULTIKILLSCRIPT (VOID)
{
	int MultiKillNumber;
	Int ExperianceGained;
	Int EXPMONSTER;
	if(CheckInventory("PowerIsOwning"))
		GiveInventory("MultiKill",1);
	
	GiveInventory("IsOwning",1);
   
	if(CheckInventory("MultiKill"))
	{
      
		MultiKillNumber = CheckInventory("MultiKill")+1;
      
	  
      
	  
		While(CheckInventory("PowerIsOwning"))
			Delay(35);
			
		If(CheckInventory("MultiKill")>=9 && playeringame (PlayerNumber()))
		{
			MultiKillNumber = CheckInventory("MultiKill")+1;
			TakeInventory("MultiKill",10000);
			EXPMONSTER = ((MultiKillNumber*(1+MultikillNumber/10))+CheckInventory("Level"));
			ExperianceGained = GiveXp(0, EXPMONSTER);
			SetFont("HBARFONT");
			HudMessage(s:"Killing Spree! ", i:MultiKillNumber, s:" monsters killed.\n",i:ExperianceGained, s:" Experience Bonus!";
				HUDMSG_FADEOUT,785,CR_White,1.5,0.8,4.0,0.5);
			LocalAmbientSound("killspree/end",127);
		}
		else If(CheckInventory("MultiKill")<9 && playeringame (PlayerNumber()))
			TakeInventory("MultiKill",100000);
	}
}

script WOC_HEALSCRIPT (int HealAmount)
{
	int Damage = CheckInventory("CurrentMaxHealth")-CheckInventory("Health");
	int OverFlow = CheckInventory("CurrentMaxHealth")-CheckInventory("Health")-HealAmount;
	int H = HealAmount;
	
	if(OverFlow<0)H -= -OverFlow; 

	If(GetActorProperty(0, APROP_Health)>0)
		SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+H);
}

script WOC_RETURNSCRIPT RETURN
{
	SetManaCapacity();
	SetMagickCapacity();
	SetXPRequired();
	SetMaximumHealth();
	SetMaximumArmor();
	ClearFX();
	ACS_ExecuteAlways(WOC_FLOATINGBARS,0,0,0,0);
}

Script WOC_MONSTERSCALE (int val, int whose)
{
	int input;
	If(Checklevelaverage()!=0)
	{
		if(whose == TARGET)
			SetActivatorToTarget(0);
		input = ((val * CheckInventory("Level")));
		SetResultValue((input*0.25-(val*0.25)) >> 16);
	}
}

//End

script WOC_CASTSTOMP (void)
{
	int AirborneHeight = (GetActorZ(0)-GetActorFloorZ(0))>>16;
	//set player position to floor if jumping
	if(AirborneHeight >0 && AirborneHeight < 400)SetActorPosition(0,GetActorX(0),GetActorY(0),GetActorFloorZ(0),0);
	if(AirborneHeight>=400)Terminate;//dont stomp when really high in the air
	int HeightBonus = (AirborneHeight/2)<<16;
	Radius_Quake2(0,1+CheckInventory("Stomp")/2,10,0,128+CheckInventory("Stomp")*10,"");
	SpawnProjectile(0, "StompEffects", 0.0 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.1 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.2 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.3 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.4 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.5 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.6 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.7 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.8 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.9 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.05 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.15 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.25 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.35 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.45 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.55 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.65 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.75 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.85 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.95 >> 8 , HeightBonus+150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.025 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.125 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.225 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.325 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.425 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.525 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.625 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.725 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.825 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.925 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.075 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.175 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.275 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.375 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.475 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.575 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.675 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.775 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.875 >> 8 , 150, 15, 4, 0);
	SpawnProjectile(0, "StompEffects", 0.975 >> 8 , 150, 15, 4, 0);
}

str BeserkCurse[10] = { "BeserkCurse1", "BeserkCurse2", "BeserkCurse3",
					 "BeserkCurse4", "BeserkCurse5", "BeserkCurse6", "BeserkCurse7",
					 "BeserkCurse8",  "BeserkCurse9", "BeserkCurse10" };

script WOC_CASTBERSERK (void)
{//player activates Beserk
	int Counter = 0;
	int Looping = 1;
	GiveInventory("Beserking",1);
	while(HasOnSlots(ABIL_BESERK) && CheckInventory("MP")>=2 && Looping && CheckInventory("Beserking")>0)
	{
		delay(5);
		GiveInventory(BeserkCurse[CheckInventory("Beserk")-1],1);
		int X, Y, Z;
		int D = 50.0;
		int Angle = FixedDiv(Random(1,100),100);
		delay(3);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("BeserkEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("BeserkEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("BeserkEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("BeserkEffects",X,Y,Z,0,0);
		Counter++;
		if(Counter>8+CheckInventory("Beserk"))
		{
			Counter =0;
			TakeInventory("MP",2);
		}
		if(CheckInventory("MP")<=2)
		{
			Looping = 0;
		}
	}
	TakeInventory("Beserking",1);
}

script WOC_CASTBLOODRUSH (void)
{
	HealingActor(0,((CheckInventory("CurrentMaxHealth")*0.2)+((CheckInventory("BloodRush")*(CheckInventory("CurrentMaxHealth")*0.03)))) >> 16);
	int BloodRushCounter;
	while(BloodRushCounter<10)
	{
		int X, Y, Z;
		int D = 50.0;//D from player
		int Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("BeserkEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("BeserkEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("BeserkEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("BeserkEffects",X,Y,Z,0,0);
		Delay(35);
		HealingActor(0,((CheckInventory("CurrentMaxHealth")*0.02)+(((CheckInventory("BloodRush")/2)*CheckInventory("CurrentMaxHealth"))*0.01)-(CheckInventory("CurrentMaxHealth")*0.005)) >> 16);
		BloodRushCounter++;
	}
}

script WOC_CASTCHARGE(void)
{
	GiveInventory("UseCharge",1);
	ThrustThing(GetActorAngle(0)>>8,15+(CheckInventory("Charge")*4),1,0);
	GiveInventory("Chargeing",6+CheckInventory("Charge")*2);
	while(CheckInventory("Chargeing"))
	{
		GiveInventory("UseCharge",1);
		TakeInventory("Chargeing",1);//slowly run out of steam
		delay(1);
	}
}

str BattleShoutAura[10] = { "BattleShoutAura1", "BattleShoutAura2", "BattleShoutAura3",
					    "BattleShoutAura4", "BattleShoutAura5", "BattleShoutAura6", "BattleShoutAura7",
						"BattleShoutAura8",  "BattleShoutAura9", "BattleShoutAura10" };
						
script WOC_CASTBATTLESHOUT (void)
{
	ActivatorSound("fighter/warcry", 127);
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
			if (!playeringame (i))
			continue;
		if(distance(0,I+PLAYERTID) < 512 + 512*CheckInventory("BattleShout")/10 + (CheckInventory("Wisdom")) && CheckSight(0,I+PLAYERTID,0))
		{
			GiveActorInventory(I+PLAYERTID,BattleShoutAura[CheckInventory("BattleShout")-1],1);
			GiveActorInventory(I+PLAYERTID,"BattleShoutSpeed",1);
			GiveActorInventory(I+PET1TID,BattleShoutAura[CheckInventory("BattleShout")-1],1);
			GiveActorInventory(I+PET2TID,BattleShoutAura[CheckInventory("BattleShout")-1],1);
			GiveActorInventory(I+PET3TID,BattleShoutAura[CheckInventory("BattleShout")-1],1);
			GiveActorInventory(I+PET4TID,BattleShoutAura[CheckInventory("BattleShout")-1],1);
			If(CheckInventory("IsCommander"))
			{
				GiveActorInventory(I+PLAYERTID,"RallyItem",1);
				GiveActorInventory(I+PET1TID,"RallyItem",1);
				GiveActorInventory(I+PET2TID,"RallyItem",1);
				GiveActorInventory(I+PET3TID,"RallyItem",1);
				GiveActorInventory(I+PET4TID,"RallyItem",1);
			}
		}
	}
}

str DeflectionDefense[10] = { "DeflectionDefense1", "DeflectionDefense2", "DeflectionDefense3",
					    "DeflectionDefense4", "DeflectionDefense5", "DeflectionDefense6", "DeflectionDefense7",
						"DeflectionDefense8",  "DeflectionDefense9", "DeflectionDefense10" };
						
str DeflectionIcon[10] = { "DeflectionIcon1", "DeflectionIcon2", "DeflectionIcon3",
					    "DeflectionIcon4", "DeflectionIcon5", "DeflectionIcon6", "DeflectionIcon7",
						"DeflectionIcon8",  "DeflectionIcon9", "DeflectionIcon10" };

script WOC_CASTDEFLECTION (void)
{
	int ReflectCounter;
	while(ReflectCounter<5 && GetActorProperty(0,APROP_Health)>0)
	{
	GiveInventory("UseDeflectON", 1);
	GiveInventory(DeflectionIcon[CheckInventory("Deflection")-1],1);
	GiveInventory(DeflectionDefense[CheckInventory("Deflection")-1],1);
	Delay(35);
	ReflectCounter++;
	}
	GiveInventory("UseDeflectOFF", 1);
	TakeInventory("PowerDeflectionIcon",1);
	TakeInventory("PowerDeflectionDefense1",1);
	TakeInventory("PowerDeflectionDefense2",1);
	TakeInventory("PowerDeflectionDefense3",1);
	TakeInventory("PowerDeflectionDefense4",1);
	TakeInventory("PowerDeflectionDefense5",1);
	TakeInventory("PowerDeflectionDefense6",1);
	TakeInventory("PowerDeflectionDefense7",1);
	TakeInventory("PowerDeflectionDefense8",1);
	TakeInventory("PowerDeflectionDefense9",1);
	TakeInventory("PowerDeflectionDefense10",1);
}
//End

//Cleric Skills

script WOC_CASTBLESSING (void)
{
	GiveInventory("BlessingSparkleEffect",1);
	int BlessingHealAmount = 14+CheckInventory("Wisdom")+CheckInventory("Blessing")*3;
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
		if (!playeringame (i))
			continue;
		if((distance(0,I+PLAYERTID) < 512 + ((512*CheckInventory("Blessing"))/10)) && CheckSight(0,I+PLAYERTID, 0))
		{
			If(!CheckInventory("IsPurifier"))
			{
				GiveActorInventory(I+PLAYERTID, "BlessingFlash", 1);
				HealingActor(I+PLAYERTID, BlessingHealAmount);
				HealingActor(I+PET1TID, BlessingHealAmount);
				HealingActor(I+PET2TID, BlessingHealAmount);
				HealingActor(I+PET3TID, BlessingHealAmount);
				HealingActor(I+PET4TID, BlessingHealAmount);
			}
			Else If(CheckInventory("IsPurifier"))
			{
				GiveActorInventory(I+PLAYERTID, "BlessingFlash", 1);
				HealingActor(I+PLAYERTID, BlessingHealAmount+BlessingHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET1TID, BlessingHealAmount+BlessingHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET2TID, BlessingHealAmount+BlessingHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET3TID, BlessingHealAmount+BlessingHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET4TID, BlessingHealAmount+BlessingHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
			}
		}
	}
}
	
script WOC_WRAITHSSCRIPT (void)
{
	GiveInventory("Level", CheckActorInventory(ActivatorTID()-PET5TID+PLAYERTID,"Level"));
	GiveInventory("Charisma", CheckActorInventory(ActivatorTID()-PET5TID+PLAYERTID,"Charisma"));
	GiveInventory("SummonAncestors", CheckActorInventory(ActivatorTID()-PET5TID+PLAYERTID,"SummonAncestors"));
	str AllySummoner = GetActorProperty(ActivatorTID()-PET5TID+PLAYERTID, APROP_NameTag);
	SetActorProperty(0, APROP_NameTag, Strparam(s:AllySummoner,s:"\c-'s Wraith"));

	
	SetActorProperty(0, APROP_Health, 50+CheckInventory("Charisma")*2+CheckInventory("Level")*2+CheckInventory("SummonAncestors")*10);
	GiveInventory("CurrentMaxHealth", 50+CheckInventory("Charisma")*2+CheckInventory("Level")*2+CheckInventory("SummonAncestors")*10);	
	GiveInventory("ImAPet",1);
	Int SpiritTimer = CheckInventory("SummonAncestors")+5+CheckActorInventory(ActivatorTID()-PET5TID+PLAYERTID,"Curse")/2;
	ACS_ExecuteAlways(900,0,32,0,0);
	While(GetActorProperty(0, APROP_HEALTH)>0 && SpiritTimer > 0)
	{
		If(SpiritTimer<2)
			GiveInventory("A_DIEITEM", 1);
		Delay(35);
		SpiritTimer--;
	}
}

str SacrificeIcon[10] = { "SacrificeIcon1", "SacrificeIcon2", "SacrificeIcon3",
					    "SacrificeIcon4", "SacrificeIcon5", "SacrificeIcon6", "SacrificeIcon7",
						"SacrificeIcon8",  "SacrificeIcon9", "SacrificeIcon10" };
						
str LightningSurgeCounter[10] = { "LightningSurgeCounter1", "LightningSurgeCounter2", "LightningSurgeCounter3",
					    "LightningSurgeCounter4", "LightningSurgeCounter5", "LightningSurgeCounter6", "LightningSurgeCounter7",
						"LightningSurgeCounter8",  "LightningSurgeCounter9", "LightningSurgeCounter10" };

script WOC_CASTSACRIFICE (void)
{
	SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)-CheckInventory("CurrentMaxHealth")/(1+CheckInventory("Sacrifice")));
	GiveInventory("Sacrificeing",12+(CheckInventory("Sacrifice")*3));
	int X, Y, Z;
	int Ang = FixedDiv(Random(1,100),100);
	SetActorState(0,"Pain");
	GiveInventory(SacrificeIcon[CheckInventory("Sacrifice")-1],1);
	while(CheckInventory("Sacrificeing"))
	{
		delay(35);
		int D = 50.0;
		int Angle = FixedDiv(Random(1,100),100);
		for(int I = 0; I<10; I++)
		{//make 10 puffs
			Angle = FixedDiv(Random(1,100),100);
			X = GetActorX(0)+(FixedMul(sin(Angle),D));
			Y = GetActorY(0)+(FixedMul(cos(Angle),D));
			Z = GetActorZ(0)+Random(0,50);
			Z = Z - 0.0;
			Spawn("BeserkEffects",X,Y,Z,0,0);
		}
		TakeInventory("Sacrificeing",1);
		
	}
}

str ProtectAura[10] = { "ProtectAura1", "ProtectAura2", "ProtectAura3",
					    "ProtectAura4", "ProtectAura5", "ProtectAura6", "ProtectAura7",
						"ProtectAura8",  "ProtectAura9", "ProtectAura10" };

script WOC_CASTPROTECTAURA (void)
{	
	While(HasOnSlots(ABIL_PROTECTAURA) && CheckInventory("IHaveProtect")==1)
	{
		delay(5);
		int X, Y, Z;
		int D = 50.0;
		int Angle = FixedDiv(Random(1,100),100);
		delay(3);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("ProtectAuraEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("ProtectAuraEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("ProtectAuraEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("ProtectAuraEffects",X,Y,Z,0,0);
		for (int i = 0; i < MAXPLAYERS; i++) 
		{
			if (!playeringame (i))
			continue;
			if((distance(0,I+PLAYERTID) < 512 + 512*CheckInventory("ProtectAura")/10 + (CheckInventory("Wisdom"))) && CheckSight(0,I+PLAYERTID,0))
			{
					GiveActorInventory(I+PLAYERTID,ProtectAura[CheckInventory("ProtectAura")-1],1);
					GiveActorInventory(I+PET1TID,ProtectAura[CheckInventory("ProtectAura")-1],1);
					GiveActorInventory(I+PET2TID,ProtectAura[CheckInventory("ProtectAura")-1],1);
					GiveActorInventory(I+PET3TID,ProtectAura[CheckInventory("ProtectAura")-1],1);
					GiveActorInventory(I+PET4TID,ProtectAura[CheckInventory("ProtectAura")-1],1);
			}
		}
		If(CheckInventory("IsInquisitor"))
			GiveInventory("ProtectInquisitor", 1);
	}
	TakeInventory("IHaveProtect",1);
}

script WOC_CASTSUMMONLEGEND (void)
{
	Thing_Damage(PET1TID+playernumber(),10000,0);
	GiveInventory("UseSummonLegend",1);
	SetActorProperty(PET1TID+playernumber(),APROP_Health,275+(25*CheckInventory("SummonLegend"))+(5*CheckInventory("Charisma"))+(5*CheckInventory("Level")));
	SetActorProperty(PET1TID+playernumber(),APROP_ScaleX,GetActorProperty(0,APROP_ScaleX));
	SetActorProperty(PET1TID+playernumber(),APROP_ScaleY,GetActorProperty(0,APROP_ScaleY));
	SetActorProperty(PET1TID+playernumber(),APROP_Height,GetActorProperty(0,APROP_Height));
	SetActorProperty(PET1TID+playernumber(),APROP_Radius,GetActorProperty(0,APROP_Radius));
	SetActorProperty(PET1TID+playernumber(), APROP_NameTag, Strparam(n:0,s:"\c-'s Holy Legend"));
	Thing_SetTranslation(PET1TID+playernumber(), -1);
	GiveActorInventory(PET1TID+playernumber(), "SummonLegend", CheckInventory("SummonLegend"));
	GiveActorInventory(PET1TID+playernumber(), "SummonAncestors", CheckInventory("SummonAncestors"));
	GiveActorInventory(PET1TID+playernumber(), "Curse", CheckInventory("Curse"));
	GiveActorInventory(PET1TID+playernumber(), "Charisma", CheckInventory("Charisma"));
	GiveActorInventory(PET1TID+playernumber(), "Level", CheckInventory("Level"));
	GiveActorInventory(PET1TID+playernumber(), "IsOracle", CheckInventory("IsOracle"));
	GiveActorInventory(PET1TID+playernumber(), "CurrentMaxHealth", 275+(25*CheckInventory("SummonLegend"))+(5*CheckInventory("Charisma"))+(5*CheckInventory("Level")));	
}

script WOC_SUMMONLEGENDSCRIPT (void)
{
	GiveInventory("ImAPet",1);
	Int LegendTimer;
	LegendTimer = CheckInventory("SummonLegend")*5+10+CheckInventory("SummonAncestors")+CheckInventory("Curse");
	While(GetActorProperty(0, APROP_HEALTH)>0 && LegendTimer > 0 && !CheckInventory("IsOracle"))
	{
		If(LegendTimer<2)
			GiveInventory("A_DIEITEM", 1);
		Delay(35);
		LegendTimer--;
	}
}

script WOC_CASTPRESERVERANCEAURA (void)
{
	int counter;
	while(HasOnSlots(ABIL_PRESERVERANCEAURA) && CheckInventory("IHavePreserverance"))
	{
		delay(5);
		int X, Y, Z;
		int D = 50.0;
		int Angle = FixedDiv(Random(1,100),100);
		delay(3);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("PreserveranceEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("PreserveranceEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("PreserveranceEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("PreserveranceEffects",X,Y,Z,0,0);
		Counter++;
		for (int i = 0; i < MAXPLAYERS; i++) 
		{
			if (!playeringame (i))
			continue;
			
			if((distance(0,I+PLAYERTID) < 512 + 512*CheckInventory("PreserveranceAura")/10 + CheckInventory("Wisdom")) && CheckSight(0,I+PLAYERTID,0))
			{
				GiveActorInventory(I+PLAYERTID,"PreserveranceAuraIcon",1);
				If(Counter>10)
				{
					int PreserveranceHealAmount = 5+CheckInventory("PreserveranceAura") + CheckInventory("Wisdom")/10;
					If(!CheckInventory("IsPurifier"))
					{
						HealingActor(I+PLAYERTID, PreserveranceHealAmount);
						HealingActor(I+PET1TID, PreserveranceHealAmount);
						HealingActor(I+PET2TID, PreserveranceHealAmount);
						HealingActor(I+PET3TID, PreserveranceHealAmount);
						HealingActor(I+PET4TID, PreserveranceHealAmount);
					}
					Else If(CheckInventory("IsPurifier"))
					{
						HealingActor(I+PLAYERTID, PreserveranceHealAmount+PreserveranceHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
						HealingActor(I+PET1TID, PreserveranceHealAmount+PreserveranceHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
						HealingActor(I+PET2TID, PreserveranceHealAmount+PreserveranceHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
						HealingActor(I+PET3TID, PreserveranceHealAmount+PreserveranceHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
						HealingActor(I+PET4TID, PreserveranceHealAmount+PreserveranceHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
					}
					If(CheckInventory("IsInquisitor"))
						HealingActor(0, (PreserveranceHealAmount*0.1) >> 16);
					counter=0;
				}
			}
		}
	}
	TakeInventory("IHavePreserverance",1);
}

script WOC_PRESERVERANCEHEALING (void)
{
	int PreserveranceHealAmount = 5+CheckInventory("PreserveranceAura") + CheckInventory("Wisdom")/10;
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
		if (!playeringame (i))
		continue;
		if((distance(0,PLAYERTID+i) < 512 + 512/10*CheckInventory("PreserveranceAura")) && CheckSight(0,I+PLAYERTID,0))
		{
			If(!CheckInventory("IsPurifier"))
			{
				HealingActor(I+PLAYERTID, PreserveranceHealAmount);
				HealingActor(I+PET1TID, PreserveranceHealAmount);
				HealingActor(I+PET2TID, PreserveranceHealAmount);
				HealingActor(I+PET3TID, PreserveranceHealAmount);
				HealingActor(I+PET4TID, PreserveranceHealAmount);
			}
			Else If(CheckInventory("IsPurifier"))
			{
				HealingActor(I+PLAYERTID, PreserveranceHealAmount+PreserveranceHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET1TID, PreserveranceHealAmount+PreserveranceHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET2TID, PreserveranceHealAmount+PreserveranceHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET3TID, PreserveranceHealAmount+PreserveranceHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET4TID, PreserveranceHealAmount+PreserveranceHealAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
			}
		}
	}
}

str FuryAura[10] = { "FuryAura1", "FuryAura2", "FuryAura3",
					 "FuryAura4", "FuryAura5", "FuryAura6", "FuryAura7",
					 "FuryAura8",  "FuryAura9", "FuryAura10" };
					 
script WOC_VISIONSSCRIPT (void)
{
	//Thing_Raise(0);
	GiveInventory("NOCOUNTKILL", 1);
	SetActorProperty(0,APROP_Friendly,1);
	SetActorProperty(0,APROP_Alpha,0.6);
	SetActorProperty(0,APROP_RenderStyle,STYLE_Translucent);
	SetActorProperty(0,APROP_Species,"Player");
	int Time = 15;
	While(GetActorProperty(0, APROP_Health) > 0 && time > 0)
	{
		Delay(35);
		Time--;
	}
	Thing_Remove(0);
}

script WOC_CASTFURYAURA (void)
{
	While(HasOnSlots(ABIL_FURYAURA) && CheckInventory("IHaveFury")==1)
	{
		delay(5);
		int X, Y, Z;
		int D = 50.0;
		int Angle = FixedDiv(Random(1,100),100);
		delay(3);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("FuryAuraEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("FuryAuraEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("FuryAuraEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("FuryAuraEffects",X,Y,Z,0,0);
		for (int i = 0; i < MAXPLAYERS; i++) 
		{
			if (!playeringame (i))
			continue;
			if((distance(0,I+PLAYERTID) < 512 + 512*CheckInventory("FuryAura")/10 + CheckInventory("Wisdom")) && CheckSight(0,I+PLAYERTID,0))
			{//if within 256 of another player..
					GiveActorInventory(I+PLAYERTID,FuryAura[CheckInventory("FuryAura")-1],1);
					GiveActorInventory(I+PET1TID,FuryAura[CheckInventory("FuryAura")-1],1);
					GiveActorInventory(I+PET2TID,FuryAura[CheckInventory("FuryAura")-1],1);
					GiveActorInventory(I+PET3TID,FuryAura[CheckInventory("FuryAura")-1],1);
					GiveActorInventory(I+PET4TID,FuryAura[CheckInventory("FuryAura")-1],1);
			}
		}
		If(CheckInventory("IsInquisitor"))
			GiveInventory("FuryInquisitor", 1);
	}
	TakeInventory("IHaveFury",1);
}

script WOC_HOLYBOLTSCRIPT (int HolyMissileHealingAmount)
{
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
		if (!playeringame (i))
			continue;
		if((distance(0,I+PLAYERTID) < 512) && CheckSight(0,I+PLAYERTID,0))
		{
			If(!CheckInventory("IsPurifier"))
			{
				HealingActor(I+PLAYERTID, HolyMissileHealingAmount);
				HealingActor(I+PET1TID, HolyMissileHealingAmount);
				HealingActor(I+PET2TID, HolyMissileHealingAmount);
				HealingActor(I+PET3TID, HolyMissileHealingAmount);
				HealingActor(I+PET4TID, HolyMissileHealingAmount);
			}
			Else If(CheckInventory("IsPurifier"))
			{
				HealingActor(I+PLAYERTID, HolyMissileHealingAmount+HolyMissileHealingAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET1TID, HolyMissileHealingAmount+HolyMissileHealingAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET2TID, HolyMissileHealingAmount+HolyMissileHealingAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET3TID, HolyMissileHealingAmount+HolyMissileHealingAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
				HealingActor(I+PET4TID, HolyMissileHealingAmount+HolyMissileHealingAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
			}
		}
	}
}

//End

script WOC_CASTTELEKINESIS (void)
{
	int A = CheckInventory("Telekinesis")/2;
	GiveInventory("Teleblast",1);
	delay(13);
	while(A>0)
	{
		A--;
		GiveInventory("Teleblast",1);
		delay(13);
	}
}

script WOC_CASTMANACHARGE (void)
{//player activates Mana recharge
	int Counter = 0;
	int Looping = 1;
	GiveInventory("ManaChargeing",1);
	If(CheckInventory("ManaCharge")<3)
	{
	GiveInventory("ManaChargeingAura",1);
	}
	while(HasOnSlots(ABIL_MANACHARGE) && CheckInventory("MP")>0 && Looping && CheckInventory("ManaChargeing")>0)
	{
		delay(5);
		If(CheckInventory("ManaCharge")>=3)
		{
		for (int i = 0; i < MAXPLAYERS; i++) 
		{
			if (!playeringame (i))
			continue;
			if((distance(0,I+PLAYERTID) < 512 + 512*CheckInventory("ManaCharge")/10 + CheckInventory("Wisdom")) && CheckSight(0,I+PLAYERTID,0))
			{
			GiveActorInventory(I+PLAYERTID, "Mana1",1+(CheckInventory("ManaCharge")/5));
			GiveActorInventory(I+PLAYERTID, "Mana2",1+(CheckInventory("ManaCharge")/5));
			TakeInventory("PowerManaChargeingAura",1);
			GiveActorInventory(I+PLAYERTID,"ManaChargeAuraIcon",1);
			}
		}
		}
		else If(CheckInventory("ManaCharge")<3)
		{
		GiveInventory("Mana1",1+(CheckInventory("ManaCharge")/5));
		GiveInventory("Mana2",1+(CheckInventory("ManaCharge")/5));
		}
		int X, Y, Z;
		int D = 50.0;
		int Angle = FixedDiv(Random(1,100),100);
		delay(3);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("ManaChargeEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("ManaChargeEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("ManaChargeEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("ManaChargeEffects",X,Y,Z,0,0);
		Counter++;
		if(Counter>CheckInventory("ManaCharge"))
		{
			Counter = 0;
			TakeInventory("MP",1);
		}
	}
	TakeInventory("ManaChargeing",1);
	TakeInventory("PowerManaChargeingAura",1);
	TakeInventory("PowerManaChargeAuraIcon",1);
}

script WOC_CASTARCANEBARRIER (void)
{
	int ArmorBonus = GetAmmoCapacity("MP")/4+(GetAmmoCapacity("MP")*CheckInventory("ArcaneBarrier")/40);
	int ArcaneBarrierMax = ArmorBonus;
	int CurrentArmor = CheckInventory("BasicArmor");
	
	If(ArmorBonus > CurrentArmor)
	{
		if(ArmorBonus + CurrentArmor > ArmorBonus)
			ArmorBonus -= CurrentArmor;
			
	GiveInventory("ArcaneBarrierBonus",ArmorBonus);
	ActivatorSound("Mage/ArcaneBarrier", 127);
	SetInventory("ArcaneBarrierMax", ArcaneBarrierMax);
	}
	GiveInventory("ArcaneBarrierFlash",1);
	
	ArcaneBarrierMax = ArcaneBarrierMax/2;
	ArmorBonus = ArcaneBarrierMax;
	
	int CurrentActorArmor, ActorArmorBonus;
	If(CheckInventory("IsArchon"))
		for (int i = 0; i < MAXPLAYERS; i++) 
		{
			if (!playeringame (i))
				continue;
			if((distance(0,I+PLAYERTID) < 512 + 512*CheckInventory("ArcaneBarrier")/10 + CheckInventory("Wisdom")) && CheckSight(0,I+PLAYERTID,0))
			{
				ActorArmorBonus = ArmorBonus;
				CurrentActorArmor = CheckActorInventory(I+PLAYERTID, "BasicArmor");
				If(ActorArmorBonus > CurrentActorArmor)
				{
					if(ActorArmorBonus + CurrentActorArmor > ActorArmorBonus)
						ActorArmorBonus -= CurrentActorArmor;
					GiveActorInventory(I+PLAYERTID, "BlessingFlash", 1);
					GiveActorInventory(I+PLAYERTID, "ArcaneBarrierBonus", ActorArmorBonus);
					SetActorInventory(I+PLAYERTID, "ArcaneBarrierMax", ArcaneBarrierMax);
					GiveActorInventory(I+PLAYERTID, "ArcaneBarrierFlash",1);
				}
			}
		}
}

script WOC_CASTTHUNDERSTORM (void) //Thunderstorm Script
{
	int Counter = 0;
	while(HasOnSlots(ABIL_THUNDERSTORM) && CheckInventory("MP") >= CheckInventory("ThunderStorm")+5 && CheckInventory("ThunderStorming"))
	{
		delay(15);
		GiveInventory("UseThunderStorm", 1);
		GiveInventory("UseThunderStorm", 1);
		Counter++;
		if(Counter>2)
		{
			Counter =0;
			TakeInventory("MP",CheckInventory("ThunderStorm")/5+6);
		}
	}
	TakeInventory("Thunderstorming",1);
}
//End

script WOC_CASTSPRINT (void)
{//player activates sprint
	int Counter = 0;
	int Looping = 1;
	GiveInventory("Sprinting",1);
	GiveInventory("SprintSpeed",1);
	while(HasOnSlots(ABIL_SPRINT) && CheckInventory("MP")>=1 && Looping && CheckInventory("Sprinting")>0)
	{//we have magick
		Delay(8);
		Counter++;
		if(Counter>4+CheckInventory("Sprint"))
		{
			Counter = 0;
			TakeInventory("MP",1);
		}
	}
	TakeInventory("Sprinting",1);
	TakeInventory("PowerSprintSpeed",1);
}

str PrecisionAura[10] = { "PrecisionAura1", "PrecisionAura2", "PrecisionAura3",
					 "PrecisionAura4", "PrecisionAura5", "PrecisionAura6", "PrecisionAura7",
					 "PrecisionAura8",  "PrecisionAura9", "PrecisionAura10" };

script WOC_CASTPRECISION (void)
{//player activates Precision
	int Counter = 0;
	int Looping = 1;
	GiveInventory("Precisioning",1);
	while(HasOnSlots(ABIL_PRECISION) && CheckInventory("MP")>=2 && Looping && CheckInventory("Precisioning")>0)
	{
		delay(5);
		GiveInventory(PrecisionAura[CheckInventory("Precision")-1],1);
		int X, Y, Z;
		int D = 50.0;
		int Angle = FixedDiv(Random(1,100),100);
		delay(3);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("PrecisionEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("PrecisionEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("PrecisionEffects",X,Y,Z,0,0);
		Angle = FixedDiv(Random(1,100),100);
		X = GetActorX(0)+(FixedMul(sin(Angle),D));
		Y = GetActorY(0)+(FixedMul(cos(Angle),D));
		Z = GetActorZ(0)+Random(0,50);
		Z = Z - 0.0;
		Spawn("PrecisionEffects",X,Y,Z,0,0);
		Counter++;
		if(Counter>7+CheckInventory("Precision")/2)
		{
			Counter =0;
			TakeInventory("MP",2);
		}
		if(CheckInventory("MP")<2)
		{
			Looping = 0;
		}
	}
	TakeInventory("Precisioning",1);
}

script WOC_CASTCAMOFLAUGE (void)
{//player activates Camoflauge
	int Counter = 0;
	int Looping = 1;
	int buttons;
	buttons = GetPlayerInput (-1, INPUT_BUTTONS);
	GiveInventory("Stealthing",1);
	GiveInventory("CamoFlaugeInvisibility",1);
	while(HasOnSlots(ABIL_CAMOFLAUGE) && CheckInventory("MP")>=1 && Looping && CheckInventory("Stealthing")>0)
	{//we have magick
		If((GetActorVelX(0) == 0) && (GetActorVelY(0) == 0) && (GetActorVelZ(0) == 0) && ((buttons & BT_FORWARD) == 0))
		{
		GiveInventory("CamoNoTarget",1);
		}
		Else
		{
		GiveInventory("CamoTarget",1);
		}
		Counter++;
		if(Counter>(2+CheckInventory("Camoflauge"))*8)
		{
			Counter = 0;
			TakeInventory("MP",1);
		}
		Delay(1);
	}
	TakeInventory("Stealthing",1);
	TakeInventory("PowerCamoflaugeInvisibility",1);
	GiveInventory("NOCANTSEEK",1);
	GiveInventory("CamoTarget",1);
}

script WOC_CASTRAVENCOMPANION (void)
{//spawn a raven companion and give its attributes
	Thing_Remove(PET1TID+playernumber());
	Thing_Remove(PET2TID+playernumber());
	Thing_Remove(PET3TID+playernumber());
	GiveInventory("RavenCompanionCheck",1);
	GiveInventory("UseRavenCompanion1",1);
	GiveActorInventory(PET1TID+playernumber(), "ImAPet", 1);
	GiveActorInventory(PET1TID+playernumber(), "Charisma", CheckInventory("Charisma"));
	GiveActorInventory(PET1TID+playernumber(), "RavenCompanion", CheckInventory("RavenCompanion"));
	
	If(CheckInventory("RavenCompanion")>4)
	{
		GiveInventory("UseRavenCompanion2",1);
		GiveActorInventory(PET2TID+playernumber(), "ImAPet", 1);
		GiveActorInventory(PET2TID+playernumber(), "Charisma", CheckInventory("Charisma"));
		GiveActorInventory(PET2TID+playernumber(), "RavenCompanion", CheckInventory("RavenCompanion"));
	}
	
	If(CheckInventory("RavenCompanion")>7)
	{
		GiveInventory("UseRavenCompanion3",1);
		GiveActorInventory(PET3TID+playernumber(), "ImAPet", 1);
		GiveActorInventory(PET3TID+playernumber(), "Charisma", CheckInventory("Charisma"));
		GiveActorInventory(PET3TID+playernumber(), "RavenCompanion", CheckInventory("RavenCompanion"));
	}
	While(HasOnSlots(ABIL_RAVENCOMPANION) && CheckInventory("RavenCompanionCheck") == 1)
	{
		SetActorInventory(PET1TID+playernumber(), "Charisma", CheckInventory("Charisma"));
		SetActorInventory(PET1TID+playernumber(), "RavenCompanion", CheckInventory("RavenCompanion"));
		
		If(CheckInventory("RavenCompanion")>4)
		{
			SetActorInventory(PET2TID+playernumber(), "Charisma", CheckInventory("Charisma"));
			SetActorInventory(PET2TID+playernumber(), "RavenCompanion", CheckInventory("RavenCompanion"));
		}
		
		If(CheckInventory("RavenCompanion")>7)
		{
			SetActorInventory(PET3TID+playernumber(), "Charisma", CheckInventory("Charisma"));
			SetActorInventory(PET3TID+playernumber(), "RavenCompanion", CheckInventory("RavenCompanion"));
		}
		Delay(1);
		if(distance(PlayerNumber()+PET1TID,PLAYERTID+PlayerNumber()) > 768 && GetUserCVar(PlayerNumber(),"WoC_AutoPetLeash"))
		{
			SetActorPosition(PlayerNumber()+PET1TID,GetActorX(0),GetActorY(0),GetActorZ(0) + (8 << 16), 0);
			GiveActorInventory(PlayerNumber()+PET1TID, "ClearTarget", 1);
		}
		if(distance(PlayerNumber()+PET2TID,PLAYERTID+PlayerNumber()) > 768 && GetUserCVar(PlayerNumber(),"WoC_AutoPetLeash"))
		{
			SetActorPosition(PlayerNumber()+PET2TID,GetActorX(0),GetActorY(0),GetActorZ(0) + (8 << 16), 0);
			GiveActorInventory(PlayerNumber()+PET2TID, "ClearTarget", 1);
		}
		if(distance(PlayerNumber()+PET3TID,PLAYERTID+PlayerNumber()) > 768 && GetUserCVar(PlayerNumber(),"WoC_AutoPetLeash"))
		{
			SetActorPosition(PlayerNumber()+PET3TID,GetActorX(0),GetActorY(0),GetActorZ(0) + (8 << 16), 0);
			GiveActorInventory(PlayerNumber()+PET3TID, "ClearTarget", 1);
		}
	}
	TakeInventory("RavenCompanionCheck",2);
	Thing_Remove(PET1TID+playernumber());
}

script WOC_INVIGHEAL (void)
{
	If(CheckInventory("PowerInvigDamage")==0)
	{
		GiveInventory("InvigDamage",1);
		While(CheckInventory("PowerInvigDamage"))
		{
			int HealingAmount = CheckInventory("CurrentMaxHealth")/50;
			If(HealingAmount < 1)
				HealingAmount = 1;
			HealingActor(ActivatorTID(), HealingAmount);
			Delay(35);
		}
	}
	else
		GiveInventory("InvigDamage",1);
}

script WOC_NATURESSALVE (int tid)
{
	int healing = 10+CheckActorInventory(PLAYERTID+tid, "Wisdom")*3/2+CheckActorInventory(PLAYERTID+tid, "NaturesSalve")*5;
	int HealingInterval = Healing/10;
	int HealingTics = 10;
	GiveInventory("SalveIsHealing",1);
	If(CheckActorInventory(PLAYERTID+tid, "IsSurvivalist"))
	{
		GiveInventory("SalveIsHealing2",1);
		HealingTics = 5;
		HealingInterval = Healing/5;
	}
	Else
		GiveInventory("SalveIsHealing",1);
	While(HealingTics>0)
	{
		HealingActor(0,HealingInterval);
		healing = Healing - HealingInterval;
		HealingTics--;
		Delay(35);
	}
	HealingActor(0,healing);
}

str EnfeebleDebuff[10] = { "EnfeebleDebuff1", "EnfeebleDebuff2", "EnfeebleDebuff3",
					    "EnfeebleDebuff4", "EnfeebleDebuff5", "EnfeebleDebuff6", "EnfeebleDebuff7",
						"EnfeebleDebuff8",  "EnfeebleDebuff9", "EnfeebleDebuff10" };

script WOC_MINIONREGEN (void)
{
	While(GetActorProperty(0, APROP_HEALTH)>0)
	{
		If(CheckInventory("IsConjuror"))
			HealingActor(0,(CheckInventory("CurrentMaxHealth")*0.02) >> 16);
		Else
			HealingActor(0,(CheckInventory("CurrentMaxHealth")*0.01) >> 16);
		Delay(35);
	}
}

script WOC_CASTENFEEBLE (int id, int mode, int rank)
{
	If(Mode == 0)
	{
		SetActivator(0,AAPTR_TRACER);
		if(rank != 10)
			for(int i = rank; i < 10; i++)
				If(CheckInventory(StrParam(s:"PowerEnfeebleDefense",i:i)))
					Terminate;
		if(!IsFriendly(0) && !CheckInventory("EnfeebleDuration"))
		{
			GiveInventory(EnfeebleDebuff[Rank-1], 1);
			SetInventory("EnfeebleDuration", 30);
			SetInventory("EnfeebleRank", rank);
			while(CheckInventory("EnfeebleDuration") && GetActorProperty(0, APROP_health)>0)
			{
				GiveInventory("EnfeebleEffectItem",1);
				TakeInventory("EnfeebleDuration", 1);
				Delay(17);
				
				GiveInventory("EnfeebleEffectItem",1);
				TakeInventory("EnfeebleDuration", 1);
				Delay(18);
			}
			SetInventory("EnfeebleDuration",0);
		}
		else if(!IsFriendly(0) && rank >= CheckInventory("EnfeebleRank") && CheckInventory("EnfeebleDuration"))
			SetInventory("EnfeebleDuration", 30);
			{
				TakeInventory(StrParam(s:"PowerEnfeebleDefense",i:CheckInventory("EnfeebleRank")),1);
				TakeInventory(StrParam(s:"PowerEnfeebleDamage",i:CheckInventory("EnfeebleRank")),1);
				GiveInventory(EnfeebleDebuff[rank-1], 1);
				SetInventory("EnfeebleRank", rank);
			}
	}
	
	If(Mode == 1)
	{
		int tid = id+PLAYERTID;
		int Ranklevel = CheckActorInventory(tid, "Enfeeble");
		if(Ranklevel != 10)
			for(int j = Ranklevel; j < 10; j++)
				If(CheckInventory(StrParam(s:"PowerEnfeebleDefense",i:j)))
					Terminate;
		if(!IsFriendly(0) && !CheckInventory("EnfeebleDuration"))
		{
			GiveInventory(EnfeebleDebuff[Ranklevel-1], 1);
			SetInventory("EnfeebleDuration", 30);
			SetInventory("EnfeebleRank", Ranklevel);
			while(CheckInventory("EnfeebleDuration") && GetActorProperty(0, APROP_health)>0)
			{
				GiveInventory("EnfeebleEffectItem",1);
				TakeInventory("EnfeebleDuration", 1);
				Delay(17);
				
				GiveInventory("EnfeebleEffectItem",1);
				TakeInventory("EnfeebleDuration", 1);
				Delay(18);
			}
			SetInventory("EnfeebleDuration",0);
			SetActorProperty(0,APROP_Frightened,0);
		}
		else if(!IsFriendly(0) && Ranklevel >= CheckInventory("EnfeebleRank") && CheckInventory("EnfeebleDuration"))		
		{
			TakeInventory(StrParam(s:"PowerEnfeebleDefense",i:CheckInventory("EnfeebleRank")),1);
			TakeInventory(StrParam(s:"PowerEnfeebleDamage",i:CheckInventory("EnfeebleRank")),1);
			GiveInventory(EnfeebleDebuff[RankLevel-1], 1);
			SetInventory("EnfeebleDuration", 30);
			SetInventory("EnfeebleRank", Ranklevel);
		}
	}
}

script WOC_CASTSUMMONSHADOW (void)
{
	//Spawn a Shadow
	Thing_Remove(PET1TID+playernumber());
	GiveInventory("NecromancerPetCheck",1);
	GiveInventory("UseSummonShadow",1);
	GiveActorInventory(PET1TID+playernumber(), "ImAPet", 1);
	GiveActorInventory(PET1TID+playernumber(), "Charisma", CheckInventory("Charisma"));
	GiveActorInventory(PET1TID+playernumber(), "Level", CheckInventory("Level"));
	GiveActorInventory(PET1TID+playernumber(), "SummonShadow", CheckInventory("SummonShadow"));
	GiveActorInventory(PET1TID+playernumber(), "CurrentMaxHealth", 75+(CheckInventory("SummonShadow")*10)+(CheckInventory("Charisma")*2)+(CheckInventory("Level")*2));
	SetActorProperty(PET1TID+playernumber(), APROP_Health, CheckActorInventory(PET1TID+playernumber(),"CurrentMaxHealth"));
	SetActorProperty(PET1TID+playernumber(),APROP_Height,GetActorProperty(0,APROP_Height));
	SetActorProperty(PET1TID+playernumber(),APROP_Radius,GetActorProperty(0,APROP_Radius));
	While(HasOnSlots(ABIL_SUMMONSHADOW) && CheckInventory("NecromancerPetCheck") == 1 && GetActorProperty(PET1TID+playernumber(), APROP_Health)>0)
	{
		If(CheckInventory("IsConjuror"))
			GiveInventory("ShadowInvisible",1);
		SetActorInventory(PET1TID+playernumber(), "CurrentMaxHealth", 75+(CheckInventory("SummonShadow")*10)+(CheckInventory("Charisma")*2)+(CheckInventory("Level")*2));
		SetActorInventory(PET1TID+playernumber(), "Charisma", CheckInventory("Charisma"));
		SetActorInventory(PET1TID+playernumber(), "Level", CheckInventory("Level"));
		SetActorInventory(PET1TID+playernumber(), "SummonShadow", CheckInventory("SummonShadow"));
		SetActorInventory(PET1TID+playernumber(), "IsPlaguebringer", CheckInventory("IsPlaguebringer"));
		SetActorInventory(PET1TID+playernumber(), "IsConjuror", CheckInventory("IsConjuror"));
		SetActorProperty(PET1TID+playernumber(), APROP_NameTag, Strparam(n:0,s:"\c-'s Shadow"));
		Delay(1);
		if(distance(PlayerNumber()+PET1TID,PLAYERTID+PlayerNumber()) > 768 && GetUserCVar(PlayerNumber(),"WoC_AutoPetLeash"))
		{
			Thing_Move(PlayerNumber()+PET1TID,PLAYERTID+PlayerNumber(), 1);
			SetActorAngle(PlayerNumber()+PET1TID,GetActorAngle(0));
			GiveActorInventory(PlayerNumber()+PET1TID, "ClearTarget", 1);
		}
	}
	TakeInventory("NecromancerPetCheck",2);
	TakeInventory("PowerShadowInvisible",1);
	If(GetActorProperty(PET1TID+playernumber(), APROP_Health)>0)
		Thing_Remove(PET1TID+playernumber());
	else If(GetActorProperty(PET1TID+playernumber(), APROP_Health)<1)
	{
		Thing_ChangeTID(PET1TID+playernumber(),0);
		If(CheckInventory("IsConjuror"))
			GiveInventory("MP", 5);
	}
}

script WOC_MOVEMINION (int minionnumber)
{
	if(MinionNumber==1)
	{
		Thing_Move(PlayerNumber()+PET1TID,PLAYERTID+PlayerNumber(),1);
		SetActorAngle(PlayerNumber()+PET1TID,GetActorAngle(0));
		GiveActorInventory(PlayerNumber()+PET1TID, "ClearTarget", 1);
	}
	if(MinionNumber==2)
	{
		Thing_Move(PlayerNumber()+PET2TID,PLAYERTID+PlayerNumber(),1);
		SetActorAngle(PlayerNumber()+PET2TID,GetActorAngle(0));
		GiveActorInventory(PlayerNumber()+PET2TID, "ClearTarget", 1);
	}
	if(MinionNumber==3)
	{
		Thing_Move(PlayerNumber()+PET3TID,PLAYERTID+PlayerNumber(),1);
		SetActorAngle(PlayerNumber()+PET3TID,GetActorAngle(0));
		GiveActorInventory(PlayerNumber()+PET3TID, "ClearTarget", 1);
	}
	if(MinionNumber==4)
	{
		Thing_Move(PlayerNumber()+PET4TID,PLAYERTID+PlayerNumber(),1);
		SetActorAngle(PlayerNumber()+PET4TID,GetActorAngle(0));
		GiveActorInventory(PlayerNumber()+PET4TID, "ClearTarget", 1);
	}
}

script WOC_CASTTERRIFY (int id, int mode, int Duration)
{
	If(Mode == 0)
	{
		SetActivator(0,AAPTR_TRACER);	
		if(!IsFriendly(0) && !CheckInventory("TerrifyDuration") && !CheckInventory("NoFear"))
		{
			SetInventory("TerrifyDuration",Duration);
			while(CheckInventory("TerrifyDuration") && GetActorProperty(0, APROP_health)>0)
			{
				GiveInventory("TerrifyEffectItem",1);
				TakeInventory("TerrifyDuration", 1);
				SetActorProperty(0,APROP_Frightened,1);
				Delay(17);
				
				GiveInventory("TerrifyEffectItem",1);
				TakeInventory("TerrifyDuration", 1);
				SetActorProperty(0,APROP_Frightened,1);
				Delay(18);
			}
			SetInventory("TerrifyDuration",0);
			SetActorProperty(0,APROP_Frightened,0);
		}
		else if(!IsFriendly(0) && CheckInventory("TerrifyDuration"))
				SetInventory("TerrifyDuration", Duration);
	}
	
	If(Mode == 1)
	{
		int tid = id+PLAYERTID;
		int TerrifyDuration = CheckActorInventory(tid, "Terrify")*10+CheckActorInventory(tid,"Wisdom")/10;

		if(!IsFriendly(0) && !CheckInventory("TerrifyDuration") && !CheckInventory("NoFear"))
		{
			SetInventory("TerrifyDuration",TerrifyDuration);
			while(CheckInventory("TerrifyDuration") && GetActorProperty(0, APROP_health)>0)
			{
				GiveInventory("TerrifyEffectItem",1);
				TakeInventory("TerrifyDuration", 1);
				SetActorProperty(0,APROP_Frightened,1);
				Delay(17);
				
				GiveInventory("TerrifyEffectItem",1);
				TakeInventory("TerrifyDuration", 1);
				SetActorProperty(0,APROP_Frightened,1);
				Delay(18);
			}
			SetInventory("TerrifyDuration",0);
			SetActorProperty(0,APROP_Frightened,0);
		}
		else if(!IsFriendly(0) && CheckInventory("TerrifyDuration"))
			If(CheckInventory("TerrifyDuration")<TerrifyDuration)
				SetInventory("TerrifyDuration", TerrifyDuration);
	}
}

script WOC_CASTSUMMONGHOUL (void)
{
	//Spawn a Ghoul
	Thing_Remove(PET2TID+playernumber());
	GiveInventory("NecromancerPet2Check",1);
	GiveInventory("UseSummonGhoul",1);
	GiveActorInventory(PET2TID+playernumber(), "ImAPet", 1);
	GiveActorInventory(PET2TID+playernumber(), "Charisma", CheckInventory("Charisma"));
	GiveActorInventory(PET2TID+playernumber(), "Level", CheckInventory("Level"));
	GiveActorInventory(PET2TID+playernumber(), "SummonGhoul", CheckInventory("SummonGhoul"));
	GiveActorInventory(PET2TID+playernumber(), "CurrentMaxHealth", 175+CheckInventory("SummonGhoul")*25+CheckInventory("Charisma")*5+CheckInventory("Level")*5);
	SetActorProperty(PET2TID+playernumber(), APROP_Health, CheckActorInventory(PET2TID+playernumber(),"CurrentMaxHealth"));
	SetActorProperty(PET2TID+playernumber(),APROP_ScaleX,GetActorProperty(0,APROP_ScaleX));
	SetActorProperty(PET2TID+playernumber(),APROP_ScaleY,GetActorProperty(0,APROP_ScaleY));
	SetActorProperty(PET2TID+playernumber(),APROP_Height,GetActorProperty(0,APROP_Height));
	SetActorProperty(PET2TID+playernumber(),APROP_Radius,GetActorProperty(0,APROP_Radius));
	While(HasOnSlots(ABIL_SUMMONGHOUL) && CheckInventory("NecromancerPet2Check") == 1 && GetActorProperty(PET2TID+playernumber(), APROP_Health)>0)
	{
		If(CheckInventory("IsConjuror"))
			GiveInventory("GhoulProtection",1);
		SetActorInventory(PET2TID+playernumber(), "CurrentMaxHealth", 175+CheckInventory("SummonGhoul")*25+CheckInventory("Charisma")*5+CheckInventory("Level")*5);
		SetActorInventory(PET2TID+playernumber(), "Charisma", CheckInventory("Charisma"));
		SetActorInventory(PET2TID+playernumber(), "Level", CheckInventory("Level"));
		SetActorInventory(PET2TID+playernumber(), "SummonGhoul", CheckInventory("SummonGhoul"));
		SetActorInventory(PET2TID+playernumber(), "IsPlaguebringer", CheckInventory("IsPlaguebringer"));
		SetActorInventory(PET2TID+playernumber(), "IsConjuror", CheckInventory("IsConjuror"));
		SetActorProperty(PET2TID+playernumber(), APROP_NameTag, Strparam(n:0,s:"\c-'s Ghoul"));
		Delay(1);
		if(distance(PlayerNumber()+PET2TID,PLAYERTID+PlayerNumber()) > 768 && GetUserCVar(PlayerNumber(),"WoC_AutoPetLeash"))
		{
			Thing_Move(PlayerNumber()+PET2TID,PLAYERTID+PlayerNumber(), 1);
			SetActorAngle(PlayerNumber()+PET2TID,GetActorAngle(0));
			GiveActorInventory(PlayerNumber()+PET2TID, "ClearTarget", 1);
		}
	}
	TakeInventory("NecromancerPet2Check",2);
	TakeInventory("PowerGhoulProtection",1);
	If(GetActorProperty(PET2TID+playernumber(), APROP_Health)>0)
		Thing_Remove(PET2TID+playernumber());
	else If(GetActorProperty(PET2TID+playernumber(), APROP_Health)<1)
	{
		Thing_ChangeTID(PET2TID+playernumber(),0);
		If(CheckInventory("IsConjuror"))
			GiveInventory("MP", 10);
	}
}

//0 = Single Target
//1 = AoE
script WOC_CASTCHAOS (int id, int mode, int Duration)
{
	If(Mode == 0)
	{
		SetActivator(0,AAPTR_TRACER);	
		if(!IsFriendly(0) && !CheckInventory("ChaosDuration") && !CheckInventory("NoFear"))
		{
			SetInventory("ChaosDuration",Duration);
			while(CheckInventory("ChaosDuration") && GetActorProperty(0, APROP_health)>0)
			{
				GiveInventory("ChaosEffectItem",1);
				TakeInventory("ChaosDuration", 1);
				Delay(17);
				
				GiveInventory("ChaosEffectItemNoRadius",1);
				TakeInventory("ChaosDuration", 1);
				Delay(18);
			}
			SetInventory("ChaosDuration",0);
		}
		else if(!IsFriendly(0) && CheckInventory("ChaosDuration"))
				SetInventory("ChaosDuration", Duration);
	}
	
	If(Mode == 1)
	{
		int tid = id+PLAYERTID;
		int ChaosDuration = CheckActorInventory(tid, "Chaos")*10+CheckActorInventory(tid,"Wisdom")/10;

		if(!IsFriendly(0) && !CheckInventory("ChaosDuration") && !CheckInventory("NoFear"))
		{
			SetInventory("ChaosDuration",ChaosDuration);
			while(CheckInventory("ChaosDuration") && GetActorProperty(0, APROP_health)>0)
			{
				GiveInventory("ChaosEffectItem",1);
				TakeInventory("ChaosDuration", 1);
				Delay(17);
				
				GiveInventory("ChaosEffectItemNoRadius",1);
				TakeInventory("ChaosDuration", 1);
				Delay(18);
			}
			SetInventory("ChaosDuration",0);
		}
		else if(!IsFriendly(0) && CheckInventory("ChaosDuration"))
			If(CheckInventory("ChaosDuration")<ChaosDuration)
				SetInventory("ChaosDuration", ChaosDuration);
	}
}

script WOC_CASTSUMMONREVENANT (void)
{
	//Spawn a Revenant
	Thing_Remove(PET3TID+playernumber());
	GiveInventory("NecromancerPet3Check",1);
	GiveInventory("UseSummonRevenant",1);
	GiveActorInventory(PET3TID+playernumber(), "ImAPet", 1);
	GiveActorInventory(PET3TID+playernumber(), "Level", CheckInventory("Level"));
	GiveActorInventory(PET3TID+playernumber(), "Terrify", CheckInventory("Terrify"));
	GiveActorInventory(PET3TID+playernumber(), "Chaos", CheckInventory("Chaos"));
	GiveActorInventory(PET3TID+playernumber(), "Enfeeble", CheckInventory("Enfeeble"));
	GiveActorInventory(PET3TID+playernumber(), "Drain", CheckInventory("Drain"));
	GiveActorInventory(PET3TID+playernumber(), "Charisma", CheckInventory("Charisma"));
	GiveActorInventory(PET3TID+playernumber(), "Wisdom", CheckInventory("Wisdom"));
	GiveActorInventory(PET3TID+playernumber(), "BoneShower", CheckInventory("SummonRevenant"));
	GiveActorInventory(PET3TID+playernumber(), "SummonRevenant", CheckInventory("SummonRevenant"));
	GiveActorInventory(PET3TID+playernumber(), "CurrentMaxHealth", 100+CheckInventory("SummonRevenant")*15+CheckInventory("Charisma")*3+CheckInventory("Level")*3);
	SetActorProperty(PET3TID+playernumber(), APROP_Health, CheckActorInventory(PET3TID+playernumber(),"CurrentMaxHealth"));
	SetActorProperty(PET3TID+playernumber(),APROP_ScaleX,GetActorProperty(0,APROP_ScaleX));
	SetActorProperty(PET3TID+playernumber(),APROP_ScaleY,GetActorProperty(0,APROP_ScaleY));
	SetActorProperty(PET3TID+playernumber(),APROP_Height,GetActorProperty(0,APROP_Height));
	SetActorProperty(PET3TID+playernumber(),APROP_Radius,GetActorProperty(0,APROP_Radius));
	While(HasOnSlots(ABIL_SUMMONREVENANT) && CheckInventory("NecromancerPet3Check") == 1 && GetActorProperty(PET3TID+playernumber(), APROP_Health)>0)
	{
		If(CheckInventory("IsConjuror"))
			GiveInventory("RevenantSpeed",1);
		SetActorInventory(PET3TID+playernumber(), "CurrentMaxHealth", 100+CheckInventory("SummonRevenant")*15+CheckInventory("Charisma")*3+CheckInventory("Level")*3);
		SetActorInventory(PET3TID+playernumber(), "Charisma", CheckInventory("Charisma"));
		SetActorInventory(PET3TID+playernumber(), "Level", CheckInventory("Level"));
		SetActorInventory(PET3TID+playernumber(), "Terrify", CheckInventory("Terrify"));
		SetActorInventory(PET3TID+playernumber(), "Chaos", CheckInventory("Chaos"));
		SetActorInventory(PET3TID+playernumber(), "Enfeeble", CheckInventory("Enfeeble"));
		SetActorInventory(PET3TID+playernumber(), "Drain", CheckInventory("Drain"));
		SetActorInventory(PET3TID+playernumber(), "BoneShower", CheckInventory("SummonRevenant"));
		SetActorInventory(PET3TID+playernumber(), "Wisdom", CheckInventory("Wisdom"));
		SetActorInventory(PET3TID+playernumber(), "SummonRevenant", CheckInventory("SummonRevenant"));
		SetActorInventory(PET3TID+playernumber(), "IsPlaguebringer", CheckInventory("IsPlaguebringer"));
		SetActorInventory(PET3TID+playernumber(), "IsConjuror", CheckInventory("IsConjuror"));
		SetActorProperty(PET3TID+playernumber(), APROP_NameTag, Strparam(n:0,s:"\c-'s Revenant"));
		Delay(1);
		if(distance(PlayerNumber()+PET3TID,PLAYERTID+PlayerNumber()) > 768 && GetUserCVar(PlayerNumber(),"WoC_AutoPetLeash"))
		{
			Thing_Move(PlayerNumber()+PET3TID,PLAYERTID+PlayerNumber(), 1);
			SetActorAngle(PlayerNumber()+PET3TID,GetActorAngle(0));
			GiveActorInventory(PlayerNumber()+PET3TID, "ClearTarget", 1);
		}
	}
	TakeInventory("NecromancerPet3Check",2);
	TakeInventory("PowerRevenantSpeed",1);
	If(GetActorProperty(PET3TID+playernumber(), APROP_Health)>0)
		Thing_Remove(PET3TID+playernumber());
	else If(GetActorProperty(PET3TID+playernumber(), APROP_Health)<1)
	{
		Thing_ChangeTID(PET3TID+playernumber(),0);
		If(CheckInventory("IsConjuror"))
			GiveInventory("MP", 15);
	}
}

script WOC_CASTMIASMA (void)
{//Miasma ability
	int Counter = 0;
	while(HasOnSlots(ABIL_MIASMA) && CheckInventory("MP")>=2 && CheckInventory("Miasmaing"))
	{
		delay(3);
		GiveInventory("UseMiasma", 1);
		Counter++;
		if(Counter>CheckInventory("Miasma")+5)
		{
			Counter =0;
			TakeInventory("MP",2);
		}
	}
	TakeInventory("Miasmaing",1);
}

script WOC_CASTDRAIN (int id, int mode, int Duration)
{
	int DrainAmount, DrainHealTimer, DrainHealAmount;
	If(Mode == 0)
	{
		SetActivator(0,AAPTR_TRACER);
		DrainAmount = Duration;
		if(!IsFriendly(0) && !CheckInventory("DrainHeal") && CheckInventory("CurrentMaxHealth"))
		{
			
			SetInventory("DrainHeal", DrainAmount);
			DrainHealTimer = CheckInventory("DrainHeal");
			while(GetActorProperty(0, APROP_health)>0 && CheckInventory("DrainHeal"))
			{
				if(DrainHealTimer < CheckInventory("DrainHeal"))
					DrainHealTimer = CheckInventory("DrainHeal");
				DrainHealAmount = DrainHealTimer/10;
				if(DrainHealTimer%10>=5)
					DrainHealAmount = DrainHealTimer/10 + 1;
				If(CheckInventory("DrainHeal") < DrainHealAmount)
					DrainHealAmount = CheckInventory("DrainHeal");
				for (int i = 0; i < MAXPLAYERS; i++) 
				{
					if (!playeringame (i))
						continue;
					if(distance(0,I+PLAYERTID) < 1024 && CheckSight(0,I+PLAYERTID,0))
					{
						HealingActor(I+PLAYERTID, DrainHealAmount);
						HealingActor(I+PET1TID, DrainHealAmount);
						HealingActor(I+PET2TID, DrainHealAmount);
						HealingActor(I+PET3TID, DrainHealAmount);
						HealingActor(I+PET4TID, DrainHealAmount);
					}
				}
				TakeInventory("DrainHeal", DrainHealAmount);
				GiveInventory("DrainEffectItem",1);
				Delay(17);
				GiveInventory("DrainEffectItem",1);
				Delay(18);
			}
		}
		else if(!IsFriendly(0) && CheckInventory("DrainHeal") && CheckInventory("CurrentMaxHealth"))
			If(CheckInventory("DrainHeal")<DrainAmount)
				SetInventory("DrainHeal", DrainAmount);
	}
	
	If(Mode == 1)
	{
		int tid = id+PLAYERTID;
		DrainAmount = 21+CheckActorInventory(tid,"Drain")*4+CheckActorInventory(tid,"Wisdom");
		if(!IsFriendly(0) && !CheckInventory("DrainHeal") && CheckInventory("CurrentMaxHealth"))
		{
			SetInventory("DrainHeal", DrainAmount);
			DrainHealTimer = CheckInventory("DrainHeal");
			while(GetActorProperty(0, APROP_health)>0 && CheckInventory("DrainHeal"))
			{
				if(DrainHealTimer < CheckInventory("DrainHeal"))
					DrainHealTimer = CheckInventory("DrainHeal");
				DrainHealAmount = DrainHealTimer/10;
				if(DrainHealTimer%10>=5)
					DrainHealAmount = DrainHealTimer/10 + 1;
				If(CheckInventory("DrainHeal") < DrainHealAmount)
					DrainHealAmount = CheckInventory("DrainHeal");
				for (int j = 0; j < MAXPLAYERS; j++) 
				{
					if (!playeringame (j))
						continue;
					if(distance(0,j+PLAYERTID) < 1024 && CheckSight(0,J+PLAYERTID,0))
					{
						HealingActor(j+PLAYERTID, DrainHealAmount);
						HealingActor(j+PET1TID, DrainHealAmount);
						HealingActor(j+PET2TID, DrainHealAmount);
						HealingActor(j+PET3TID, DrainHealAmount);
						HealingActor(j+PET4TID, DrainHealAmount);
					}
				}
				TakeInventory("DrainHeal", DrainHealAmount);
				GiveInventory("DrainEffectItem",1);
				Delay(17);
				GiveInventory("DrainEffectItem",1);
				Delay(18);
			}
		}
		else if(!IsFriendly(0) && CheckInventory("DrainHeal") && CheckInventory("CurrentMaxHealth"))
			If(CheckInventory("DrainHeal")<DrainAmount)
				SetInventory("DrainHeal", DrainAmount);
	}
}

script WOC_CASTSUMMONDEATHKNIGHT (void)
{
	//Spawn a Death Knight
	Thing_Remove(PET4TID+playernumber());
	GiveInventory("NecromancerPet4Check",1);
	GiveInventory("UseSummonDeathKnight",1);
	GiveActorInventory(PET4TID+playernumber(), "ImAPet", 1);
	GiveActorInventory(PET4TID+playernumber(), "Charisma", CheckInventory("Charisma"));
	GiveActorInventory(PET4TID+playernumber(), "Level", CheckInventory("Level"));
	GiveActorInventory(PET4TID+playernumber(), "SummonDeathKnight", CheckInventory("SummonDeathKnight"));
	GiveActorInventory(PET4TID+playernumber(), "CurrentMaxHealth", 125+CheckInventory("SummonDeathKnight")*20+CheckInventory("Charisma")*4+CheckInventory("Level")*4);
	SetActorProperty(PET4TID+playernumber(), APROP_Health, CheckActorInventory(PET4TID+playernumber(),"CurrentMaxHealth"));
	SetActorProperty(PET4TID+playernumber(),APROP_ScaleX,GetActorProperty(0,APROP_ScaleX));
	SetActorProperty(PET4TID+playernumber(),APROP_ScaleY,GetActorProperty(0,APROP_ScaleY));
	SetActorProperty(PET4TID+playernumber(),APROP_Height,GetActorProperty(0,APROP_Height));
	SetActorProperty(PET4TID+playernumber(),APROP_Radius,GetActorProperty(0,APROP_Radius));
	While(HasOnSlots(ABIL_SUMMONDEATHKNIGHT) && CheckInventory("NecromancerPet4Check") == 1 && GetActorProperty(PET4TID+playernumber(), APROP_Health)>0)
	{
		If(CheckInventory("IsConjuror"))
			GiveInventory("DeathKnightDamage",1);
		SetActorInventory(PET4TID+playernumber(), "CurrentMaxHealth", 125+CheckInventory("SummonDeathKnight")*20+CheckInventory("Charisma")*4+CheckInventory("Level")*4);
		SetActorInventory(PET4TID+playernumber(), "Charisma", CheckInventory("Charisma"));
		SetActorInventory(PET4TID+playernumber(), "Level", CheckInventory("Level"));
		SetActorInventory(PET4TID+playernumber(), "SummonDeathKnight", CheckInventory("SummonDeathKnight"));
		SetActorInventory(PET4TID+playernumber(), "IsPlaguebringer", CheckInventory("IsPlaguebringer"));
		SetActorInventory(PET4TID+playernumber(), "IsConjuror", CheckInventory("IsConjuror"));
		SetActorProperty(PET4TID+playernumber(), APROP_NameTag, Strparam(n:0,s:"\c-'s Death Knight"));
		Delay(1);
		if(distance(PlayerNumber()+PET4TID,PLAYERTID+PlayerNumber()) > 768 && GetUserCVar(PlayerNumber(),"WoC_AutoPetLeash"))
		{
			Thing_Move(PlayerNumber()+PET4TID,PLAYERTID+PlayerNumber(), 1);
			SetActorAngle(PlayerNumber()+PET4TID,GetActorAngle(0));
			GiveActorInventory(PlayerNumber()+PET4TID, "ClearTarget", 1);
		}
	}
	TakeInventory("NecromancerPet4Check",2);
	TakeInventory("PowerDeathKnightDamage",1);
	If(GetActorProperty(PET4TID+playernumber(), APROP_Health)>0)
		Thing_Remove(PET4TID+playernumber());
	else If(GetActorProperty(PET4TID+playernumber(), APROP_Health)<1)
	{
		Thing_ChangeTID(PET4TID+playernumber(),0);
		If(CheckInventory("IsConjuror"))
			GiveInventory("MP", 20);
	}
}

script WOC_CASTMETAMORPH (void)
{
	SetInventory("TargetMaximumHealth", 0);
	SetInventory("TargetCurrentHealth", 0);
	SetInventory("TargetHealthBarColor",0);
	int MorphTime = (12+CheckInventory("MetaMorph")*3);
	int MorphingHealth = GetActorProperty(0, APROP_Health);
	MorphActor(0, "NewMetamorphesisPlayer", "", (35)*(12+CheckInventory("MetaMorph")*3), MRF_UNDOBYDEATHFORCED|MRF_UNDOBYDEATH, "", "");
	SetActorProperty(0, APROP_Health, MorphingHealth);
	SetActorProperty(0, APROP_SpawnHealth, CheckInventory("CurrentMaxHealth"));
	int UnMorphingHealth;
	GiveInventory("ImAMorph",1);
	While(MorphTime>0 && GetActorProperty(0, APROP_Health)>0)
	{
		UnMorphingHealth = GetActorProperty(0, APROP_Health);
		MorphTime--;
		Delay(35);
	}
	If(GetActorProperty(0, APROP_Health)>0 && MorphTime <=0)
	{
		SetActorProperty(0, APROP_Health, UnMorphingHealth);
		SetActorProperty(0, APROP_SpawnHealth, CheckInventory("CurrentMaxHealth"));
		TakeInventory("ImAMorph",1);
	}
}

//END

script WOC_MYSTICAMBITINCANT (void)
{//make mystic ambit incants work properly
	ActivatorSound("MysticIncant", 127);
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
			if (!playeringame (i))
			continue;
		if(distance(0,I+PLAYERTID) < 512 && CheckSight(0,I+PLAYERTID,0))
		{//if within 256 of another player..
			if(CheckInventory("ImAFighter")==1)
			{//boost their armour
				GiveInventory("FighterGreenOrbEffect",1);
				for(int armortype = 0; armortype < 8; armortype++)
				{
					if((CheckActorInventory(I+PLAYERTID,"ImAFighter")==1) && (CheckActorInventory(I+PLAYERTID,ArmorCount[armortype])<FighterArmor[armortype]))
						GiveActorInventory(I+PLAYERTID,ArmorCount[armortype], 2);
					else if((CheckActorInventory(I+PLAYERTID,"ImACleric")==1) && (CheckActorInventory(I+PLAYERTID,ArmorCount[armortype])<ClericArmor[armortype]))
						GiveActorInventory(I+PLAYERTID,ArmorCount[armortype], 2);
					else if((CheckActorInventory(I+PLAYERTID,"ImAMage")==1) && (CheckActorInventory(I+PLAYERTID,ArmorCount[armortype])<MageArmor[armortype]))
						GiveActorInventory(I+PLAYERTID,ArmorCount[armortype], 2);
					else if((CheckActorInventory(I+PLAYERTID,"ImAHunter")==1) && (CheckActorInventory(I+PLAYERTID,ArmorCount[armortype])<HunterArmor[armortype]))
						GiveActorInventory(I+PLAYERTID,ArmorCount[armortype], 2);
					else if((CheckActorInventory(I+PLAYERTID,"ImAWarlock")==1) && (CheckActorInventory(I+PLAYERTID,ArmorCount[armortype])<NecroArmor[armortype]))
						GiveActorInventory(I+PLAYERTID,ArmorCount[armortype], 2);
				}
			}
			if(CheckInventory("ImACleric")==1)
			{//boost their health
				GiveInventory("ClericBlueOrbEffect",1);
				GiveActorInventory(I+PLAYERTID,"NewArtiHealingRadiusHealth",1);
			}
			if(CheckInventory("ImAMage")==1)
			{//boost their health
				GiveInventory("MageRedOrbEffect",1);
				GiveActorInventory(I+PLAYERTID,"Mana1",GetAmmoCapacity("Mana1")/4);
				GiveActorInventory(I+PLAYERTID,"Mana2",GetAmmoCapacity("Mana2")/4);
				GiveActorInventory(I+PLAYERTID,"MP",GetAmmoCapacity("MP")/4);
			}
			If(CheckInventory("ImAHunter")==1)
			{
				GiveInventory("HunterYellowOrbEffect",1);
				GiveActorInventory(I+PLAYERTID,"HunterSpeedBuff",1);
			}
			If(CheckInventory("ImAWarlock")==1)
			{
				GiveInventory("NecroPurpleOrbEffect",1);
				GiveActorInventory(I+PLAYERTID,"ArtiHealingRadiusFearPowerup",1);
			}
		}
	}
}

Script WOC_ARMORITEM (int armortype)
{
	if(armortype<10)
	{
		if(CheckInventory("ImAFighter")==1)
			GiveInventory(ArmorCount[armortype-1], FighterArmor[armortype-1]-CheckInventory(ArmorCount[armortype-1]));
		else if(CheckInventory("ImACleric")==1)
			GiveInventory(ArmorCount[armortype-1], ClericArmor[armortype-1]-CheckInventory(ArmorCount[armortype-1]));
		else if(CheckInventory("ImAMage")==1)
			GiveInventory(ArmorCount[armortype-1], MageArmor[armortype-1]-CheckInventory(ArmorCount[armortype-1]));
		else if(CheckInventory("ImAHunter")==1)
			GiveInventory(ArmorCount[armortype-1], HunterArmor[armortype-1]-CheckInventory(ArmorCount[armortype-1]));	
		else if(CheckInventory("ImAWarlock")==1)
			GiveInventory(ArmorCount[armortype-1], NecroArmor[armortype-1]-CheckInventory(ArmorCount[armortype-1]));
	}
	if(armortype >= 10)
	{
		int armorgive = 25;
		if(armortype == 11)
			armorgive = 50;
		while(armorgive>0 && CheckInventory("ArmourCount")<ACS_ExecuteWithResult(WOC_DECORATE,STATS,MAXARMOR))
		{
			int randomness = random(0,7);
			if(CheckInventory("ImAFighter"))
				if(CheckInventory(armorcount[randomness])<FighterArmor[randomness])
				{
					GiveInventory("FighterArmorBonus",1);
					GiveInventory(ArmorCount[randomness],1);
					armorgive--;
				}
				else
					randomness = random(0,7);
			if(CheckInventory("ImACleric"))
				if(CheckInventory(armorcount[randomness])<ClericArmor[randomness])
				{
					GiveInventory("ClericArmorBonus",1);
					GiveInventory(ArmorCount[randomness],1);
					armorgive--;
				}
				else
					randomness = random(0,7);
			if(CheckInventory("ImAMage"))
				if(CheckInventory(armorcount[randomness])<MageArmor[randomness])
				{
					GiveInventory("MageArmorBonus",1);
					GiveInventory(ArmorCount[randomness],1);
					armorgive--;
				}
				else
					randomness = random(0,7);
			if(CheckInventory("ImAHunter"))
				if(CheckInventory(armorcount[randomness])<HunterArmor[randomness])
				{
					GiveInventory("HunterArmorBonus",1);
					GiveInventory(ArmorCount[randomness],1);
					armorgive--;
				}
				else
					randomness = random(0,7);
			if(CheckInventory("ImAWarlock"))
				if(CheckInventory(armorcount[randomness])<NecroArmor[randomness])
				{
					GiveInventory("NecromancerArmorBonus",1);
					GiveInventory(ArmorCount[randomness],1);
					armorgive--;
				}
				else
					randomness = random(0,7);
			
		}
	}
}

//END
function void ClearFX(void)
{
	GiveInventory("CamoTarget",1);
	If(CheckInventory("ShowingAlch")==1);
	{
		Acs_ExecuteAlways(WOC_ALCHEMYMIXTEST,0,20,20,0);
	}
	TakeInventory("PowerPrecisionDamageBuff",1);
	TakeInventory("PowerManaCharge",1);
	TakeInventory("Beserking",1);
	TakeInventory("Sacrificeing", 10000);
	TakeInventory("ManaChargeing",100);
	TakeInventory("Precisioning",100);
	TakeInventory("IHaveFury",100);
	TakeInventory("IHaveProtect",100);
	TakeInventory("IHavePreserverance",100);
	GiveInventory("UseDeflectOFF", 1);
	TakeInventory("BruiserWeapon", 1);
	TakeInventory("Sprinting", 1);
	TakeInventory("Stealthing", 1);
	TakeInventory("ShowedMenu", 1);
	TakeInventory("Miasmaing", 1);
	TakeInventory("RavenCompanionCheck", 2);
	TakeInventory("NecromancerPetCheck", 2);
	TakeInventory("NecromancerPet2Check", 2);
	TakeInventory("NecromancerPet3Check", 2);
	TakeInventory("NecromancerPet4Check", 2);
	TakeInventory("Blizzarding", 1);
    TakeInventory("ShowingMenu", 1);
	TakeInventory("ShowingStatMenu", 1);
	TakeInventory("ShowingSkillMenu", 1);
	TakeInventory("ShowingAlch",1);
	TakeInventory("MultiKill",10000);
	TakeInventory("Punishmenting", 1000);
	TakeInventory("AlchemyD",2);
	TakeInventory("ImAMorph",1);
	TakeInventory("InShop",1);
	If(GetActorProperty(0,APROP_Health)>0)
		GiveInventory("FadeRemoved",1);
	SetPlayerProperty (0, 0, 4);
}

script WOC_MENUKEY (void) net
{
	if(!CheckInventory("InShop"))
	{
		SetInventory("MainMenuItem", 0);
		SetInventory("StatMenuItem", 0);
		SetInventory("SkillMenuItem", 0);
		SetInventory("SpecMenuItem", 0);
		SetInventory("AccessorySlot", 0);
		switch (CheckInventory("ShowedMenu"))
		{
		case 0:
			GiveInventory("ShowedMenu", 1);
			GiveInventory("ShowingMenu", 1);
			acs_executealways(WOC_MAINMENU,0,0,0,0);
			acs_executealways(WOC_MAINMENUTEXT,0,0,0,0);
			SetPlayerProperty (0, 1, 4);
			break;

		case 1:
			TakeInventory("ShowedMenu", 1);
			TakeInventory("ShowingMenu", 1);
			TakeInventory("ShowingStatMenu", 1);
			TakeInventory("ShowingSkillMenu", 1);
			TakeInventory("ShowingAccessoryMenu",1);
			TakeInventory("ShowingSpecMenu",1);
			If(CheckInventory("ShowingAlch")==1);
				Acs_ExecuteAlways(WOC_ALCHEMYMIXTEST,0,20,20,0);
			TakeInventory("ShowingAlch",1);
			TakeInventory("AlchemyD",2);
			SetPlayerProperty (0, 0, 4);
			break;
		}
	}
	else if(CheckInventory("InShop"))
	{
		TakeInventory("InShop",1);
		SetPlayerProperty (0, 0, 4);
	}
}

script WOC_MAINMENU (void)
{//---------------------------MENU SCREEN!
	int SelectedAtt;// = CheckInventory("UpDownStats");
	int buttons;
	int oldbuttons;
	
	while(CheckInventory("ShowingMenu")==1)
	{
		int MenuSelect;
		buttons = GetPlayerInput (-1, INPUT_BUTTONS);
		oldbuttons = GetPlayerInput (-1, INPUT_OLDBUTTONS);
		if (buttons & BT_FORWARD && !(OldButtons & BT_FORWARD))
		{
			If(SelectedAtt>0)
			{
				SelectedAtt--;
				SetInventory("MainMenuItem", SelectedAtt);
			}
			Else
			{
				SelectedAtt = 4;
				SetInventory("MainMenuItem", SelectedAtt);
			}
		}
		if (buttons & BT_BACK && !(OldButtons & BT_BACK))
		{
			If(SelectedAtt<4)
			{
				SelectedAtt++;
				SetInventory("MainMenuItem", SelectedAtt);
			}
			Else
			{
				SelectedAtt = 0;
				SetInventory("MainMenuItem", SelectedAtt);
			}
		}
		if (buttons & BT_USE && !(OldButtons & BT_USE))
			MenuSelect = 1;

		//----Stats
		if(SelectedAtt==0)
		{
			if(MenuSelect>=1)
			{
				GiveInventory("ShowingStatMenu",1);
				TakeInventory("ShowingSkillMenu", 1);
				TakeInventory("ShowingAlch",1);
				TakeInventory("ShowingAccessoryMenu",1);
				TakeInventory("ShowingMenu", 1);
				TakeInventory("ShowingSpecMenu", 1);
				SelectedAtt = 0;
			}
		}
		//----Skills
		if(SelectedAtt==1)
		{
			if(MenuSelect>=1)
			{
				TakeInventory("ShowingStatMenu", 1);
				TakeInventory("ShowingAlch",1);
				TakeInventory("ShowingAccessoryMenu",1);
				GiveInventory("ShowingSkillMenu",1);
				TakeInventory("ShowingMenu", 1);
				TakeInventory("ShowingSpecMenu", 1);
				SelectedAtt = 0;
			}
		}
		//----Accessories
		if(SelectedAtt==2)
		{
			if(MenuSelect>=1)
			{
				TAKEInventory("ShowingStatMenu",1);
				TakeInventory("ShowingSkillMenu", 1);
				TakeInventory("ShowingAlch",1);
				GiveInventory("ShowingAccessoryMenu",1);
				SetInventory("AlchemyD",0);
				TakeInventory("ShowingMenu", 1);
				SelectedAtt = 0;
			}
		}
		//----Alchemy
		if(SelectedAtt==3)
		{
			if(MenuSelect>=1)
			{
				TAKEInventory("ShowingStatMenu",1);
				TakeInventory("ShowingSkillMenu", 1);
				TakeInventory("ShowingAccessoryMenu",1);
				GiveInventory("ShowingAlch",1);
				SetInventory("AlchemyD",0);
				SelectedAtt = 0;
				TakeInventory("ShowingMenu", 1);
				TakeInventory("ShowingSpecMenu", 1);
			}
		}
		//----Specialization
		if(SelectedAtt==4)
		{
			if(MenuSelect>=1)
			{
				TAKEInventory("ShowingStatMenu",1);
				TakeInventory("ShowingSkillMenu", 1);
				TakeInventory("ShowingAccessoryMenu",1);
				TakeInventory("ShowingAlch",1);
				SetInventory("AlchemyD",0);
				SelectedAtt = 0;
				TakeInventory("ShowingMenu", 1);
				GiveInventory("ShowingSpecMenu", 1);
			}
		}
		Delay(1);
	}
	
	while(CheckInventory("ShowingStatMenu")==1)
	{
		buttons = GetPlayerInput (-1, INPUT_BUTTONS);
		oldbuttons = GetPlayerInput (-1, INPUT_OLDBUTTONS);
		if (buttons & BT_FORWARD && !(OldButtons & BT_FORWARD))
		{
			If(SelectedAtt>0)
				SelectedAtt--;
			Else
				SelectedAtt = 5;
		}
		if (buttons & BT_BACK && !(OldButtons & BT_BACK))
		{
			If(SelectedAtt<5)
				SelectedAtt++;
			Else
				SelectedAtt = 0;
		}
		SetInventory("StatMenuItem", SelectedAtt);
		if (buttons & BT_USE && !(OldButtons & BT_USE) && CheckInventory("LvlUpPoints"))
		{
			//Strength
			if(SelectedAtt==0)
				GiveInventory("Strength",1);
			//----Agility
			if(SelectedAtt==1)
				GiveInventory("Agility",1);
			//----Constitution
			if(SelectedAtt==2)
			{
				GiveInventory("Constitution",1);
				SetMaximumHealth();
				if(CheckInventory("ImAFighter")==1 && GetActorProperty(0, APROP_Health) > 0)
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+6);
				else if(CheckInventory("ImACleric")==1 && GetActorProperty(0, APROP_Health) > 0)
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+5);
				else if(CheckInventory("ImAMage")==1 && GetActorProperty(0, APROP_Health) > 0)
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+2);
				else if(CheckInventory("ImAHunter")==1 && GetActorProperty(0, APROP_Health) > 0)
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+4);
				else if(CheckInventory("ImAWarlock")==1 && GetActorProperty(0, APROP_Health) > 0)
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+3);
			}
			//----Wisdom
			if(SelectedAtt==3)
			{
				GiveInventory("Wisdom",1);
				SetMagickCapacity();
				if(CheckInventory("ImAFighter")==1)
					GiveInventory("MP",2);
				else if(CheckInventory("ImACleric")==1)
					GiveInventory("MP",3);
				else if(CheckInventory("ImAMage")==1)
					GiveInventory("MP",6);
				else if(CheckInventory("ImAHunter")==1)
					GiveInventory("MP",4);
				else if(CheckInventory("ImAWarlock")==1)
					GiveInventory("MP",5);
			}
			//----Intellect
			if(SelectedAtt==4)
			{
				GiveInventory("Intellect",1);
				SetManaCapacity();
			}
			
			//Charisma
			if(SelectedAtt==5)
				GiveInventory("Charisma",1);
			TakeInventory("LvlUpPoints",1);
		}
		if (buttons & BT_ALTATTACK && !(OldButtons & BT_ALTATTACK) && CheckInventory("LvlUpPoints"))
		{
			int multiple = 5;
			If(CheckInventory("LvlUpPoints") < multiple)
				Multiple = CheckInventory("LvlUpPoints");
				//Strength
			if(SelectedAtt==0)
				GiveInventory("Strength",multiple);
			//----Agility
			if(SelectedAtt==1)
				GiveInventory("Agility",multiple);
			//----Constitution
			if(SelectedAtt==2)
			{
				GiveInventory("Constitution",multiple);
				SetMaximumHealth();
				if(CheckInventory("ImAFighter")==1 && GetActorProperty(0, APROP_Health) > 0)
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+6*multiple);
				else if(CheckInventory("ImACleric")==1 && GetActorProperty(0, APROP_Health) > 0)
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+5*multiple);
				else if(CheckInventory("ImAMage")==1 && GetActorProperty(0, APROP_Health) > 0)
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+2*multiple);
				else if(CheckInventory("ImAHunter")==1 && GetActorProperty(0, APROP_Health) > 0)
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+4*multiple);
				else if(CheckInventory("ImAWarlock")==1 && GetActorProperty(0, APROP_Health) > 0)
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+3*multiple);
			}
			//----Wisdom
			if(SelectedAtt==3)
			{
				GiveInventory("Wisdom",multiple);
				SetMagickCapacity();
				if(CheckInventory("ImAFighter")==1)
					GiveInventory("MP",2*multiple);
				else if(CheckInventory("ImACleric")==1)
					GiveInventory("MP",3*multiple);
				else if(CheckInventory("ImAMage")==1)
					GiveInventory("MP",6*multiple);
				else if(CheckInventory("ImAHunter")==1)
					GiveInventory("MP",4*multiple);
				else if(CheckInventory("ImAWarlock")==1)
					GiveInventory("MP",5*multiple);
			}
			//----Intellect
			if(SelectedAtt==4)
			{
				GiveInventory("Intellect",multiple);
				SetManaCapacity();
			}
			
			//Charisma
			if(SelectedAtt==5)
				GiveInventory("Charisma",multiple);
			TakeInventory("LvlUpPoints",multiple);
		}
		Delay(1);
	}
	
	while(CheckInventory("ShowingSkillMenu")==1)
	{
		int Skill1;
		skill1 = CheckInventory("SkillSlot1");
		int Skill2;
		skill2 = CheckInventory("SkillSlot2");
		int Skill3;
		skill3 = CheckInventory("SkillSlot3");
		int Skill4;
		skill4 = CheckInventory("SkillSlot4");
		buttons = GetPlayerInput (-1, INPUT_BUTTONS);
		oldbuttons = GetPlayerInput (-1, INPUT_OLDBUTTONS);
		if (buttons & BT_FORWARD && !(OldButtons & BT_FORWARD))
		{
			If(SelectedAtt>0)
				SelectedAtt--;	
			Else
				SelectedAtt = 3;
		}
		if (buttons & BT_BACK && !(OldButtons & BT_BACK))
		{
			If(SelectedAtt<3)
				SelectedAtt++;
			Else
				SelectedAtt = 0;
		}
		SetInventory("SkillMenuItem", SelectedAtt);	
		if (buttons & BT_USE && !(OldButtons & BT_USE))
		{
			if(CheckInventory("LvlUp")>0)
			{
				If(SelectedAtt==0)
					UpgradeSkill(CheckInventory("SkillSlot1"));
				If(SelectedAtt==1)
					UpgradeSkill(CheckInventory("SkillSlot2"));
				If(SelectedAtt==2)
					UpgradeSkill(CheckInventory("SkillSlot3"));
				If(SelectedAtt==3)
					UpgradeSkill(CheckInventory("SkillSlot4"));	
			}
			else
				print(s:"You need to level up before upgrading this ability");
		}
		if (buttons & BT_MOVELEFT && !(OldButtons & BT_MOVELEFT))
		{
			If(SelectedAtt==0)
			{
				If(Skill1>0)
					Skill1--;
				Else
					Skill1=ABIL_MAX;
			}
			If(SelectedAtt==1)
			{
				If(Skill2>0)
					Skill2--;
				Else
					Skill2=ABIL_MAX;
			}
			If(SelectedAtt==2)
			{
				If(Skill3>0)
					Skill3--;
				Else
					Skill3=ABIL_MAX;
			}
			If(SelectedAtt==3)
			{
				If(Skill4>0)
					Skill4--;
				Else
					Skill4=ABIL_MAX;
			}
		}
		else if (buttons & BT_MOVERIGHT && !(OldButtons & BT_MOVERIGHT))
		{
			If(SelectedAtt==0)
			{
				If(Skill1<ABIL_MAX)
					Skill1++;
				Else
					Skill1=0;
			}
			If(SelectedAtt==1)
			{
				If(Skill2<ABIL_MAX)
					Skill2++;
				Else
					Skill2=0;
			}
			If(SelectedAtt==2)
			{
				If(Skill3<ABIL_MAX)
					Skill3++;
				Else
					Skill3=0;
			}
			If(SelectedAtt==3)
			{
				If(Skill4<ABIL_MAX)
					Skill4++;
				Else
					Skill4=0;
			}
		}
		SetInventory("SkillSlot1", Skill1);
		SetInventory("SkillSlot2", Skill2);
		SetInventory("SkillSlot3", Skill3);
		SetInventory("SkillSlot4", Skill4);
		Delay(1);
	}
	
	while(CheckInventory("ShowingAccessoryMenu")==1)
	{
		int Slot1Item, Slot2Item, i;
		Slot1Item = CheckInventory("AccessoryTypesItem");
		Slot2Item = CheckInventory("AccessoryTypes2Item");
		buttons = GetPlayerInput (-1, INPUT_BUTTONS); oldbuttons = GetPlayerInput (-1, INPUT_OLDBUTTONS);
		if (buttons & BT_FORWARD && !(OldButtons & BT_FORWARD))
		{
			If(SelectedAtt>0)
				SelectedAtt--;
			Else
				SelectedAtt=1;
		}
		else if (buttons & BT_BACK && !(OldButtons & BT_BACK))
		{
			If(SelectedAtt<1)
				SelectedAtt++;
			Else
				SelectedAtt=0;
		}
		else if (buttons & BT_MOVELEFT && !(OldButtons & BT_MOVELEFT))
		{
			If(SelectedAtt==0)
			{
				If(Slot1Item>0)
				{
					For(i = Slot1Item-1; i >= 0; i--)
					{
						If(i == 0)
						{
							Slot1Item = i;
							break;
						}
						If(i == Slot2Item)
							i--;
						If(CheckInventory(AccessoryItemNames[i]))
						{
							Slot1Item = i;
							break;
						}
					}
				}
				Else
				{
					For(i = ACCESSORY_LIMIT; i >= 0; i--)
					{
						If(i == Slot2Item)
							i--;
						If(CheckInventory(AccessoryItemNames[i]))
						{
							if(i < ACCESSORY_LIMIT || Slot2Item != ACCESSORY_LIMIT)
								Slot1Item = i;
							break;
						}
					}
				}
			}
			If(SelectedAtt==1)
			{
				If(Slot2Item>0)
				{
					For(i = Slot2Item-1; i >= 0; i--)
					{
						If(i == 0)
						{
							Slot2Item = i;
							break;
						}
						If(i == Slot1Item)
							i--;
						If(CheckInventory(AccessoryItemNames[i]))
						{
							Slot2Item = i;
							break;
						}
					}
				}
				Else
				{
					For(i = ACCESSORY_LIMIT; i >= 0; i--)
					{
						If(i == Slot1Item)
							i--;
						If(CheckInventory(AccessoryItemNames[i]))
						{
							if(i < ACCESSORY_LIMIT || Slot1Item != ACCESSORY_LIMIT)
								Slot2Item = i;
							break;
						}
					}
				}
			}				
		}
		else if (buttons & BT_MOVERIGHT && !(OldButtons & BT_MOVERIGHT))
		{
			If(SelectedAtt==0)
			{
				If(Slot1Item<ACCESSORY_LIMIT && !(Slot1Item==(ACCESSORY_LIMIT-1) && Slot2Item==ACCESSORY_LIMIT))
				{
					For(i = Slot1Item+1; i <= ACCESSORY_LIMIT; i++)
					{
						If(i == Slot2Item)
							i++;
						If(CheckInventory(AccessoryItemNames[i]))
						{
							if(i < ACCESSORY_LIMIT || Slot2Item != ACCESSORY_LIMIT)
								Slot1Item = i;
							break;
						}
					}
				}
				Else
				{
					For(i = 0; i <= ACCESSORY_LIMIT; i++)
					{
						If(i == 0)
						{
							Slot1Item = i;
							break;
						}
						If(i == Slot2Item)
							i++;
						If(CheckInventory(AccessoryItemNames[i]))
						{
							Slot1Item = i;
							break;
						}
					}
				}
			}
			If(SelectedAtt==1)
			{
				If(Slot2Item<ACCESSORY_LIMIT && !(Slot2Item==(ACCESSORY_LIMIT-1) && Slot1Item==ACCESSORY_LIMIT))
				{
					For(i = Slot2Item+1; i <= ACCESSORY_LIMIT; i++)
					{
						If(i == Slot1Item)
							i++;
						If(CheckInventory(AccessoryItemNames[i]))
						{
							if(i < ACCESSORY_LIMIT || Slot1Item != ACCESSORY_LIMIT)
								Slot2Item = i;
							break;
						}
					}
				}
				Else
				{
					For(i = 0; i <= ACCESSORY_LIMIT; i++)
					{
						If(i == 0)
						{
							Slot2Item = i;
							break;
						}
						If(i == Slot1Item)
							i++;
						If(CheckInventory(AccessoryItemNames[i]))
						{
							Slot2Item = i;
							break;
						}
					}
				}
			}
		}
		SetInventory("AccessorySlot", SelectedAtt);
		SetInventory("AccessoryTypesItem", Slot1Item);
		SetInventory("AccessoryTypes2Item", Slot2Item);
		Delay(1);
	}
	
	While(CheckInventory("ShowingAlch") == 1)
	{
		int pnum;
		pnum = PlayerNumber();
		int done = 0;
		buttons = GetPlayerInput (-1, INPUT_BUTTONS);
		oldbuttons = GetPlayerInput (-1, INPUT_OLDBUTTONS);
		if(CheckInventory("AlchemyD")==0)
			SetInventory("AlchemyD",1);
		if(CheckInventory("AlchemyD") == 1) //Open Mixing menu
		{
			if (buttons & BT_MOVERIGHT && !(OldButtons & BT_MOVERIGHT))
			{
				If(CheckInventory("AlchemyMix")<10)
					GiveInventory("AlchemyMix", 1);
				Else
					SetInventory("AlchemyMix", 0);
			}
			if (buttons & BT_MOVELEFT && !(OldButtons & BT_MOVELEFT))
			{
				If(CheckInventory("AlchemyMix")>0)
					TakeInventory("AlchemyMix", 1);
				Else
					SetInventory("AlchemyMix", 10);
			}
			if (buttons & BT_USE && !(OldButtons & BT_USE))
				SetInventory("AlchemyD", 2);
		}
		else if(CheckInventory("AlchemyD") == 2) //verify 1st flask
		{
			if (buttons & BT_MOVERIGHT && !(OldButtons & BT_MOVERIGHT))
			{
				If(CheckInventory("AlchemyMix2")<10)
					GiveInventory("AlchemyMix2", 1);
				Else
					SetInventory("AlchemyMix2", 0);
			}
			if (buttons & BT_MOVELEFT && !(OldButtons & BT_MOVELEFT))
			{
				If(CheckInventory("AlchemyMix2")>0)
					TakeInventory("AlchemyMix2", 1);
				Else
					SetInventory("AlchemyMix2", 10);
			}
			if (buttons & BT_USE && !(OldButtons & BT_USE))
			{
				done = 1;
				Acs_ExecuteAlways(WOC_ALCHEMYMIXTEST,0,CheckInventory("AlchemyMix"),CheckInventory("AlchemyMix2"),0);
				SetInventory("AlchemyD", 1);
			}
		}
		if(CheckInventory("AlchemyD") == 3)
			If(CheckInventory("AlchemyD")>0)
				Acs_ExecuteAlways(WOC_ALCHEMYMIXTEST,0,CheckInventory("AlchemyMix"),CheckInventory("AlchemyMix2"),0);
		Delay(1);
	}
	
	//SpecMenuItem
	while(CheckInventory("ShowingSpecMenu")==1)
	{
		int Spec;
		Spec = CheckInventory("SpecSideItem");

		buttons = GetPlayerInput (-1, INPUT_BUTTONS);
		oldbuttons = GetPlayerInput (-1, INPUT_OLDBUTTONS);
		if (buttons & BT_FORWARD && !(OldButtons & BT_FORWARD))
		{
			If(SelectedAtt>0)
				SelectedAtt--;
			Else If(SelectedAtt == 0 && CheckInventory("Level")>=15 && !CheckInventory("SpecChosen"))
				SelectedAtt = 4;
			Else
				SelectedAtt = 3;
		}
		if (buttons & BT_BACK && !(OldButtons & BT_BACK))
		{
			If(CheckInventory("Level")>=15 && !CheckInventory("SpecChosen"))
			{
				If(SelectedAtt<4)
					SelectedAtt++;
				Else
					SelectedAtt = 0;
			}
			Else
			{
				If(SelectedAtt<3)
					SelectedAtt++;
				Else
					SelectedAtt = 0;
			}
		}
		if (buttons & BT_USE && !(OldButtons & BT_USE))
		{
			If(SelectedAtt==4)
			{
				If(CheckInventory("Level")>=15 && !CheckInventory("SpecChosen"))
				{
					GiveInventory("SpecChosen",1);
					if(CheckInventory("ImAFighter")==1)
						GiveInventory(FighterSpecItem[Spec], 1);
					else if(CheckInventory("ImACleric")==1)
						GiveInventory(ClericSpecItem[Spec], 1);
					else if(CheckInventory("ImAMage")==1)
						GiveInventory(MageSpecItem[Spec], 1);
					else if(CheckInventory("ImAHunter")==1)
						GiveInventory(HunterSpecItem[Spec], 1);
					else if(CheckInventory("ImAWarlock")==1)
						GiveInventory(NecromancerSpecItem[Spec], 1);
					SelectedAtt--;
					SetInventory("SpecMenuItem", SelectedAtt);
				}
				else
					print(s:"You need to be at least level 15 before choosing a specialization.");
			}
		}
		if (buttons & BT_MOVELEFT && !(OldButtons & BT_MOVELEFT))
		{
			If(Spec>0)
				Spec--;
			Else
				Spec = 2;
		}
		else if (buttons & BT_MOVERIGHT && !(OldButtons & BT_MOVERIGHT))
		{
			If(Spec<2)
				Spec++;
			Else
				Spec = 0;
		}
		SetInventory("SpecMenuItem", SelectedAtt);
		SetInventory("SpecSideItem", spec);
		Delay(1);
	}
}

script WOC_MAINMENUTEXT (void) CLIENTSIDE
{//---------------------------MENU SCREEN (MESSAGES ONLY)!
	while(CheckInventory("ShowingMenu")==1)
	{
		SetFont("LargeFont");
		sethudsize (800, 600, 1);
		int SelectedAtt;// = CheckInventory("UpDownStats");
		
		setfont("HBARFONT");
		hudmessage (s:"press ",k:"+forward",s:" or ",k:"+back",s:" to select a sub menu, press ",k:"+use",s:" to open"; 0, 714, CR_WHITE, 400.0, 18.0, 1.0 / 35 + 1);
		hudmessage (s:"the sub menu and press ",k:"viewstats",s:" to return to the game."; 0, 715, CR_WHITE, 400.0, 30.0, 1.0 / 35 + 1);
		setfont("LargeFont");
			
		SelectedAtt = CheckInventory("MainMenuItem");


		//----Stats
		if(SelectedAtt==0)
		{
			HudMessage (s:"Stat Menu: ";
					   HUDMSG_PLAIN,701,CR_GOLD, 400.2, 210.0, 1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Stat Menu: ";
					   HUDMSG_PLAIN,701,CR_GREY, 400.2, 210.0, 1.0 / 35 + 1);
		};
		//----Skills
		if(SelectedAtt==1)
		{
			HudMessage (s:"Skill Menu: ";
					   HUDMSG_PLAIN,702,CR_GOLD, 400.2, 270.0, 1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Skill Menu: ";
					   HUDMSG_PLAIN,702,CR_GREY, 400.2, 270.0, 1.0 / 35 + 1);
		};
		//----Accessories
		if(SelectedAtt==2)
		{
			HudMessage (s:"Accessories Menu: ";
					   HUDMSG_PLAIN,703,CR_GOLD, 400.2, 330.0, 1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Accessories Menu: ";
					   HUDMSG_PLAIN,703,CR_GREY, 400.2, 330.0, 1.0 / 35 + 1);
		};
		//----Alchemy
		if(SelectedAtt==3)
		{
			HudMessage (s:"Alchemy Menu: ";
					   HUDMSG_PLAIN,704,CR_GOLD, 400.2, 390.0, 1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Alchemy Menu: ";
					   HUDMSG_PLAIN,704,CR_GREY, 400.2, 390.0, 1.0 / 35 + 1);
		};
		if(SelectedAtt==4)
		{
			HudMessage (s:"Path Menu: ";
					   HUDMSG_PLAIN,705,CR_GOLD, 400.2, 450.0, 1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Path Menu: ";
					   HUDMSG_PLAIN,705,CR_GREY, 400.2, 450.0, 1.0 / 35 + 1);
		};
		Delay(1);
	}
	
		//---------------------------STAT SELECTION SCREEN
	while(CheckInventory("ShowingStatMenu")==1)
	{
		int health = GetActorProperty(0, APROP_DamageFactor);
		SetFont("LargeFont");
		sethudsize (800, 600, 1);
		hudmessage (s:"with  \cd",i:(CheckInventory("XP")),s:" \cc experience points this level"; 0, 719, CR_WHITE, 400.0, 120.0, 1.0 / 35 + 1);
		hudmessage (s:"you need  \cd",i:((GetAmmoCapacity("XP"))-(CheckInventory("XP"))),s:" \cc experience points for level  \ca", i:(CheckInventory("Level")+1); 0, 720, CR_WHITE, 400.0, 150.0, 1.0 / 35 + 1);
		setfont("HBARFONT");
		hudmessage (s:"press ",k:"+forward",s:" or ",k:"+back",s:" to select a stat, press ",k:"+use",s:" to raise"; 0, 714, CR_WHITE, 400.0, 18.0, 1.0 / 35 + 1);
		hudmessage (s:"stat by 1, press ",k:"+altattack",s:" to raise stat by 5 and press ",k:"viewstats",s:" to return to the game."; 0, 715, CR_WHITE, 400.0, 30.0, 1.0 / 35 + 1);
		setfont("LargeFont");
		int UpStat;
		SelectedAtt = CheckInventory("StatMenuItem");
			
		setfont("HBARFONT");
		
		int reduction = GetActorProperty(0, APROP_DamageFactor);
		for(int i = 0; i <=7; i++)
			reduction = FixedMul(reduction, 1.0 - CheckInventory(ArmorCount[i])*0.01);
		for(int j = 1; j <=10; j++)
		{
			If(CheckInventory(StrParam(s:"PowerProtect", i:j)))
				reduction = FixedMul(reduction, PowerProtectModifier[j-1]+0.01);
				
			If(CheckInventory(StrParam(s:"PowerDeflectionDefense", i:j)))
				reduction = FixedMul(reduction, PowerDeflectionDefenseModifier[j-1]+0.01);
				
			If(CheckInventory(StrParam(s:"PowerBeserkCurse", i:j)))
				reduction = FixedMul(reduction, PowerBeserkCurseModifier[j-1]+0.01);
		}

		If(CheckInventory("PowerRallyDefense"))
			reduction = FixedMul(reduction, 0.85+0.01);				
		If(CheckInventory("PowerProtectInquisitor"))
			reduction = FixedMul(reduction, 0.9+0.01);
		If(CheckInventory("BruiserWeapon"))
			reduction = FixedMul(reduction, 0.5+0.01);
		If(CheckInventory("PolymorphProtectionRuneTracker"))
			reduction = FixedMul(reduction, 0.9+0.01);
		If(CheckInventory("PowerIcebornArmor"))
			reduction = FixedMul(reduction, 0.9+0.01);
		If(CheckInventory("PowerGhoulProtection"))
			reduction = FixedMul(reduction, 0.85+0.01);
		If(CheckInventory("PowerInterventionProtect"))
			reduction = FixedMul(reduction, 0.5+0.01);
			
		reduction = (reduction*100) >> 16;
		int healthregen = (CheckInventory("CurrentMaxHealth")*100)/5000 + (CheckInventory("CharmOfSpiritTracker")*((CheckInventory("CurrentMaxHealth")*100)/5000/2));
		if(healthregen < 1)
			healthregen = 1;
		If(CheckInventory("IsVanguard"))
			healthregen = healthregen+healthregen*(CheckInventory("CurrentMaxHealth")-GetActorProperty(0, APROP_Health))/(CheckInventory("CurrentMaxHealth")/2);
		int magickregen = (GetAmmoCapacity("MP")*100)/5000 + (CheckInventory("CharmOfSpiritTracker")*((GetAmmoCapacity("MP")*100)/5000/2));
		if(magickregen < 1)
			magickregen = 1;
		Hudmessage (s:DescriptionArrayStat[SelectedAtt];HUDMSG_PLAIN, 726, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		
		HudMessage (s:"Damage Reduction: ", i:(100 - reduction),s:"%";
				   HUDMSG_PLAIN,731,CR_GREY, 425.1, 270.0,1.0 / 35 + 1);
		HudMessage (s:"Health Regeneration: ",i: healthregen, s:" every 5 seconds";
				   HUDMSG_PLAIN,727,CR_GREY, 425.1, 300.0,1.0 / 35 + 1);
		HudMessage (s:"Magick Regeneration: ",i: magickregen, s:" every 5 seconds";
				   HUDMSG_PLAIN,728,CR_GREY, 425.1, 330.0,1.0 / 35 + 1);
		HudMessage (s:"Movement Speed: ",f: (GetActorProperty(0, APROP_SPEED));
				   HUDMSG_PLAIN,729,CR_GREY, 425.1, 360.0,1.0 / 35 + 1);
		HudMessage (s:"Jump Height: ",f: (GetActorProperty(0, APROP_JUMPZ));
				   HUDMSG_PLAIN,730,CR_GREY, 425.1, 390.0,1.0 / 35 + 1);
		
		setfont("LargeFont");
		if(CheckInventory("LvlUpPoints")>0)
		{
			setfont("LargeFont");
			HudMessage (s:"Points remaining: ",i: CheckInventory("LvlUpPoints");
					   HUDMSG_PLAIN,700, CR_WHITE, 400.2, 510.0, 1.0 / 35 + 1);
		}
		//----Strength
		if(SelectedAtt==0)
		{
			HudMessage (s:"Strength: ",i: CheckInventory("Strength");
					   HUDMSG_PLAIN,701,CR_GOLD, 400.2, 330.0,1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Strength: ",i: CheckInventory("Strength");
					   HUDMSG_PLAIN,701,CR_GREY, 400.2, 330.0,1.0 / 35 + 1);
		};
		//----Agility
		if(SelectedAtt==1)
		{
			HudMessage (s:"Agility: ",i: CheckInventory("Agility");
					   HUDMSG_PLAIN,702,CR_GOLD,400.2,360.0,1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Agility: ",i: CheckInventory("Agility");
					   HUDMSG_PLAIN,702,CR_GREY,400.2,360.0,1.0 / 35 + 1);
		};
		//----Constitution
		if(SelectedAtt==2)
		{
			HudMessage (s:"Constitution: ",i: CheckInventory("Constitution");
					   HUDMSG_PLAIN,703,CR_GOLD,400.2,390.0,1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Constitution: ",i: CheckInventory("Constitution");
					   HUDMSG_PLAIN,703,CR_GREY,400.2,390.0,1.0 / 35 + 1);
		};
		//----Wisdom
		if(SelectedAtt==3)
		{
			HudMessage (s:"Wisdom: ",i: CheckInventory("Wisdom");
					   HUDMSG_PLAIN,704,CR_GOLD,400.2,420.0,1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Wisdom: ",i: CheckInventory("Wisdom");
					   HUDMSG_PLAIN,704,CR_GREY,400.2,420.0,1.0 / 35 + 1);
		};
		//----Intellect
		if(SelectedAtt==4)
		{
			HudMessage (s:"Intellect: ",i: CheckInventory("Intellect");
					   HUDMSG_PLAIN,705,CR_GOLD,400.2,450.0,1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Intellect: ",i: CheckInventory("Intellect");
					   HUDMSG_PLAIN,705,CR_GREY,400.2,450.0,1.0 / 35 + 1);
		};
		
		if(SelectedAtt==5)
		{
			HudMessage (s:"Charisma: ",i: CheckInventory("Charisma");
					   HUDMSG_PLAIN,706,CR_GOLD,400.2,480.0,1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:"Charisma: ",i: CheckInventory("Charisma");
					   HUDMSG_PLAIN,706,CR_GREY,400.2,480.0,1.0 / 35 + 1);
		};
		//----Max Health at bottom of hud
		HudMessage (s:"Health: ",i: GetActorProperty(0, APROP_Health), s:" / ", i:CheckInventory("CurrentMaxHealth");//,s:"/" ,i: CheckInventory("CurrentMaxHealth");
					   HUDMSG_PLAIN,707,CR_GREY,400.2,180.0,1.0 / 35 + 1);
		HudMessage (s:"Blue Mana: ",i: CheckInventory("Mana1"), s:" / ", i:GetAmmoCapacity("Mana1");
					   HUDMSG_PLAIN,710,CR_GREY,400.2,240.0,1.0 / 35 + 1);
		HudMessage (s:"Green Mana: ",i: CheckInventory("Mana2"), s:" / ", i:GetAmmoCapacity("Mana2");//,s:"/" ,i: GetAmmoCapacity("MP");
					   HUDMSG_PLAIN,711,CR_GREY,400.2,270.0,1.0 / 35 + 1);
		HudMessage (s:"Magick: ",i: CheckInventory("MP"), s:" / ", i:GetAmmoCapacity("MP");
					   HUDMSG_PLAIN,712,CR_GREY,400.2,300.0,1.0 / 35 + 1);
		int lowglvl = -5-(Checklevelaverage())/10;
		if(lowglvl<1)
			lowglvl = 1;
			
		str path = "no";
		If(CheckInventory("IsDestroyer"))
			path = "the \crDestroyer";
		If(CheckInventory("IsVanguard"))
			path = "the \csVanguard";
		If(CheckInventory("IsCommander"))
			path = "the \ciCommander";
		If(CheckInventory("IsPurifier"))
			path = "the \cfPurifier";
		If(CheckInventory("IsOracle"))
			path = "the \cjOracle";
		If(CheckInventory("IsInquisitor"))
			path = "the \ckInquisitor";
		If(CheckInventory("IsPyro"))
			path = "the \cgPyro";
		If(CheckInventory("IsIceborn"))
			path = "the \cnIceborn";
		If(CheckInventory("IsArchon"))
			path = "the \chArchon";
		If(CheckInventory("IsMarksman"))
			path = "the \cbMarksman";
		If(CheckInventory("IsDuelist"))
			path = "the \cuDuelist";
		If(CheckInventory("IsSurvivalist"))
			path = "the \cdSurvivalist";
		If(CheckInventory("IsPlaguebringer"))
			path = "the \cqPlaguebringer";
		If(CheckInventory("IsHarvester"))
			path = "the \cmHarvester";
		If(CheckInventory("IsConjuror"))
			path = "the \ctConjuror";		
		hudmessage (s:"under ",s:path,s:"\cj path"; 0, 725, CR_WHITE, 400.0, 90.0, 1.0 / 35 + 1);
		
		if(CheckInventory("ImAFighter")==1)
		{	
		HudMessage (s:"you are a level  \ca",i: CheckInventory("Level"),s:"  \cdFighter";
					   HUDMSG_PLAIN,713,CR_WHITE, 400.0, 60.0,1.0 / 35 + 1);
		HudMessage (s:"Armor Class: ",i: CheckInventory("ArmourCount"), s:" / 140";//,s:"/" ,i: CheckInventory("CurrentMaxHealth");
					   HUDMSG_PLAIN,709,CR_GREY,400.2,210.0,1.0 / 35 + 1);
		}
		else if(CheckInventory("ImACleric")==1)
		{	
		HudMessage (s:"you are a level  \ca",i: CheckInventory("Level"),s:"  \chCleric";
					   HUDMSG_PLAIN,713,CR_WHITE, 400.0, 60.0,1.0 / 35 + 1);
		HudMessage (s:"Armor Class: ",i: CheckInventory("ArmourCount"), s:" / 130";//,s:"/" ,i: CheckInventory("CurrentMaxHealth");
					   HUDMSG_PLAIN,709,CR_GREY,400.2,210.0,1.0 / 35 + 1);
		}
		else if(CheckInventory("ImAMage")==1)
		{	
		HudMessage (s:"you are a level  \ca",i: CheckInventory("Level"),s:"  \cgMage";
					   HUDMSG_PLAIN,713,CR_WHITE, 400.0, 60.0, 1.0 / 35 + 1);
		HudMessage (s:"Armor Class: ",i: CheckInventory("ArmourCount"), s:" / 100";//,s:"/" ,i: CheckInventory("CurrentMaxHealth");
					   HUDMSG_PLAIN,709,CR_GREY,400.2,210.0,1.0 / 35 + 1);
		}
		else if(CheckInventory("ImAHunter")==1)
		{	
		HudMessage (s:"you are a level  \ca",i: CheckInventory("Level"),s:"  \ckHunter";
					   HUDMSG_PLAIN,713,CR_WHITE, 400.0, 60.0, 1.0 / 35 + 1);
		HudMessage (s:"Armor Class: ",i: CheckInventory("ArmourCount"), s:" / 125";//,s:"/" ,i: CheckInventory("CurrentMaxHealth");
					   HUDMSG_PLAIN,709,CR_GREY,400.2,210.0,1.0 / 35 + 1);
		}
		else if(CheckInventory("ImAWarlock")==1)
		{	
		HudMessage (s:"you are a level  \ca",i: CheckInventory("Level"),s:"  \ctNecromancer";
					   HUDMSG_PLAIN,713,CR_WHITE, 400.0, 60.0, 1.0 / 35 + 1);
		HudMessage (s:"Armor Class: ",i: CheckInventory("ArmourCount"), s:" / 105";//,s:"/" ,i: CheckInventory("CurrentMaxHealth");
					   HUDMSG_PLAIN,709,CR_GREY,400.2,210.0,1.0 / 35 + 1);
		}
		Delay(1);
	}
		
	//---------------------------SKILL SELECTION SCREEN
	while(CheckInventory("ShowingSkillMenu")==1)
	{
		SetFont("LargeFont");
		sethudsize (800, 600, 1);
		
		setfont("HBARFONT");
		hudmessage (s:"press ",k:"+forward",s:" or ",k:"+back",s:" to change skill slots, press ",k:"+moveleft",s:" or ",k:"+moveright", s:" to change the skill,"; 0, 714, CR_WHITE, 400.0, 18.0, 1.0 / 35 + 1);
		hudmessage (s:"press ",k:"+use",s:" to rank up the skill and press ",k:"viewstats",s:" to return to the game."; 0, 715, CR_WHITE, 400.0, 30.0, 1.0 / 35 + 1);
		setfont("LargeFont");
		int Skill1;
		skill1 = CheckInventory("SkillSlot1");
		int Skill2;
		skill2 = CheckInventory("SkillSlot2");
		int Skill3;
		skill3 = CheckInventory("SkillSlot3");
		int Skill4;
		skill4 = CheckInventory("SkillSlot4");

		SelectedAtt = CheckInventory("SkillMenuItem");


		//----Skill1
		If(CheckInventory("ImAFighter"))
		{
		SetFont("FITETREE");
		HudMessage (s:"A";
					   HUDMSG_PLAIN,727,CR_UNTRANSLATED, 450.1, 210.1,1.0 / 35 + 1);
		if(SelectedAtt==0)
		{
			//SetInventory("SkillSlot1", Skill1);
			SetFont(FighterIcons[Skill1]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.2, 240.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot One: ", s:FighterAbilities[Skill1], s:": ", i:CheckInventory(FighterItemNames[Skill1]);
					   HUDMSG_PLAIN,701,CR_GOLD, 400.2, 210.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayF[Skill1];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			SetFont(FighterIcons[Skill1]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.2, 240.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot One: ", s:FighterAbilities[Skill1], s:": ", i:CheckInventory(FighterItemNames[Skill1]);
					   HUDMSG_PLAIN,701,CR_GREY, 400.2, 210.0,1.0 / 35 + 1);
		}
		//----Skill2
		if(SelectedAtt==1)
		{
			//SetInventory("SkillSlot2", Skill2);
			SetFont(FighterIcons[Skill2]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.2, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Two: ", s:FighterAbilities[Skill2], s:": ", i:CheckInventory(FighterItemNames[Skill2]);
					   HUDMSG_PLAIN,702,CR_GOLD, 400.2, 270.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayF[Skill2];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);		   
		}
		else
		{
			SetFont(FighterIcons[Skill2]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.2, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Two: ", s:FighterAbilities[Skill2], s:": ", i:CheckInventory(FighterItemNames[Skill2]);
					   HUDMSG_PLAIN,702,CR_GREY, 400.2, 270.0,1.0 / 35 + 1);
		};
		//----Skill3
		if(SelectedAtt==2)
		{
			//SetInventory("SkillSlot3", Skill3);
			SetFont(FighterIcons[Skill3]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.2, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Three: ", s:FighterAbilities[Skill3], s:": ", i:CheckInventory(FighterItemNames[Skill3]);
					   HUDMSG_PLAIN,703,CR_GOLD, 400.2, 330.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayF[Skill3];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);	
		}
		else
		{
			SetFont(FighterIcons[Skill3]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.2, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Three: ", s:FighterAbilities[Skill3], s:": ", i:CheckInventory(FighterItemNames[Skill3]);
					   HUDMSG_PLAIN,703,CR_GREY, 400.2, 330.0,1.0 / 35 + 1);
		}
		//----Skill4
		if(SelectedAtt==3)
		{
			//SetInventory("SkillSlot4", Skill4);
			SetFont(FighterIcons[Skill4]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,726,CR_UNTRANSLATED, 400.2, 420.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Four: ", s:FighterAbilities[Skill4], s:": ", i:CheckInventory(FighterItemNames[Skill4]);
					   HUDMSG_PLAIN,704,CR_GOLD, 400.2, 390.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayF[Skill4];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);	
		}
		else
		{
			SetFont(FighterIcons[Skill4]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,726,CR_UNTRANSLATED, 400.2, 420.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Four: ", s:FighterAbilities[Skill4], s:": ", i:CheckInventory(FighterItemNames[Skill4]);
					   HUDMSG_PLAIN,704,CR_GREY, 400.2, 390.0,1.0 / 35 + 1);
		}
		}
		
		//----Skill1
		If(CheckInventory("ImACleric"))
		{
		SetFont("CLERTREE");
		HudMessage (s:"A";
					   HUDMSG_PLAIN,727,CR_UNTRANSLATED, 450.1, 225.1,1.0 / 35 + 1);
		if(SelectedAtt==0)
		{
			SetFont(ClericIcons[Skill1]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.2, 240.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot One: ", s:ClericAbilities[Skill1], s:": ", i:CheckInventory(ClericItemNames[Skill1]);
					   HUDMSG_PLAIN,701,CR_GOLD, 400.2, 210.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayC[Skill1];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);	
		}
		else
		{
			SetFont(ClericIcons[Skill1]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.2, 240.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot One: ", s:ClericAbilities[Skill1], s:": ", i:CheckInventory(ClericItemNames[Skill1]);
					   HUDMSG_PLAIN,701,CR_GREY, 400.2, 210.0,1.0 / 35 + 1);
		}
		//----Skill2
		if(SelectedAtt==1)
		{
			//SetInventory("SkillSlot2", Skill2);
			SetFont(ClericIcons[Skill2]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.2, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Two: ", s:ClericAbilities[Skill2], s:": ", i:CheckInventory(ClericItemNames[Skill2]);
					   HUDMSG_PLAIN,702,CR_GOLD, 400.2, 270.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayC[Skill2];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			SetFont(ClericIcons[Skill2]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.2, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Two: ", s:ClericAbilities[Skill2], s:": ", i:CheckInventory(ClericItemNames[Skill2]);
					   HUDMSG_PLAIN,702,CR_GREY, 400.2, 270.0,1.0 / 35 + 1);
		}
		//----Skill3
		if(SelectedAtt==2)
		{
			//SetInventory("SkillSlot3", Skill3);
			SetFont(ClericIcons[Skill3]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.2, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Three: ", s:ClericAbilities[Skill3], s:": ", i:CheckInventory(ClericItemNames[Skill3]);
					   HUDMSG_PLAIN,703,CR_GOLD, 400.2, 330.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayC[Skill3];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			SetFont(ClericIcons[Skill3]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.2, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Three: ", s:ClericAbilities[Skill3], s:": ", i:CheckInventory(ClericItemNames[Skill3]);
					   HUDMSG_PLAIN,703,CR_GREY, 400.2, 330.0,1.0 / 35 + 1);
		}
		//----Skill4
		if(SelectedAtt==3)
		{
			//SetInventory("SkillSlot4", Skill4);
			SetFont(ClericIcons[Skill4]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,726,CR_UNTRANSLATED, 400.2, 420.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Four: ", s:ClericAbilities[Skill4], s:": ", i:CheckInventory(ClericItemNames[Skill4]);
					   HUDMSG_PLAIN,704,CR_GOLD, 400.2, 390.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayC[Skill4];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);	
		}
		else
		{
			SetFont(ClericIcons[Skill4]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,726,CR_UNTRANSLATED, 400.2, 420.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Four: ", s:ClericAbilities[Skill4], s:": ", i:CheckInventory(ClericItemNames[Skill4]);
					   HUDMSG_PLAIN,704,CR_GREY, 400.2, 390.0,1.0 / 35 + 1);
		}
		}
		
		//----Skill1
		If(CheckInventory("ImAMage"))
		{
		SetFont("MAGETREE");
		HudMessage (s:"A";
					   HUDMSG_PLAIN,727,CR_UNTRANSLATED, 450.1, 210.1,1.0 / 35 + 1);
		if(SelectedAtt==0)
		{
			//SetInventory("SkillSlot1", Skill1);
			SetFont(MageIcons[Skill1]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.2, 240.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot One: ", s:MageAbilities[Skill1], s:": ", i:CheckInventory(MageItemNames[Skill1]);
					   HUDMSG_PLAIN,701,CR_GOLD, 400.2, 210.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayM[Skill1];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			SetFont(MageIcons[Skill1]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.2, 240.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot One: ", s:MageAbilities[Skill1], s:": ", i:CheckInventory(MageItemNames[Skill1]);
					   HUDMSG_PLAIN,701,CR_GREY, 400.2, 210.0,1.0 / 35 + 1);
		}
		//----Skill2
		if(SelectedAtt==1)
		{
			//SetInventory("SkillSlot2", Skill2);
			SetFont(MageIcons[Skill2]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.2, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Two: ", s:MageAbilities[Skill2], s:": ", i:CheckInventory(MageItemNames[Skill2]);
					   HUDMSG_PLAIN,702,CR_GOLD, 400.2, 270.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayM[Skill2];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			SetFont(MageIcons[Skill2]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.2, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Two: ", s:MageAbilities[Skill2], s:": ", i:CheckInventory(MageItemNames[Skill2]);
					   HUDMSG_PLAIN,702,CR_GREY, 400.2, 270.0,1.0 / 35 + 1);
		}
		//----Skill3
		if(SelectedAtt==2)
		{
			//SetInventory("SkillSlot3", Skill3);
			SetFont(MageIcons[Skill3]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.2, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Three: ", s:MageAbilities[Skill3], s:": ", i:CheckInventory(MageItemNames[Skill3]);
					   HUDMSG_PLAIN,703,CR_GOLD, 400.2, 330.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayM[Skill3];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			SetFont(MageIcons[Skill3]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.2, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Three: ", s:MageAbilities[Skill3], s:": ", i:CheckInventory(MageItemNames[Skill3]);
					   HUDMSG_PLAIN,703,CR_GREY, 400.2, 330.0,1.0 / 35 + 1);
		}
		//----Skill4
		if(SelectedAtt==3)
		{
			//SetInventory("SkillSlot4", Skill4);
			SetFont(MageIcons[Skill4]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,726,CR_UNTRANSLATED, 400.2, 420.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Four: ", s:MageAbilities[Skill4], s:": ", i:CheckInventory(MageItemNames[Skill4]);
					   HUDMSG_PLAIN,704,CR_GOLD, 400.2, 390.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayM[Skill4];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);	
		}
		else
		{
			SetFont(MageIcons[Skill4]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,726,CR_UNTRANSLATED, 400.2, 420.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Four: ", s:MageAbilities[Skill4], s:": ", i:CheckInventory(MageItemNames[Skill4]);
					   HUDMSG_PLAIN,704,CR_GREY, 400.2, 390.0,1.0 / 35 + 1);
		}
		}
		
		//----Skill1
		If(CheckInventory("ImAHunter"))
		{
		SetFont("HUNTTREE");
		HudMessage (s:"A";
					   HUDMSG_PLAIN,727,CR_UNTRANSLATED, 450.1, 195.1,1.0 / 35 + 1);
		if(SelectedAtt==0)
		{
			//SetInventory("SkillSlot1", Skill1);
			SetFont(HunterIcons[Skill1]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.2, 240.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot One: ", s:HunterAbilities[Skill1], s:": ", i:CheckInventory(HunterItemNames[Skill1]);
					   HUDMSG_PLAIN,701,CR_GOLD, 400.2, 210.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayH[Skill1];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			SetFont(HunterIcons[Skill1]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.2, 240.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot One: ", s:HunterAbilities[Skill1], s:": ", i:CheckInventory(HunterItemNames[Skill1]);
					   HUDMSG_PLAIN,701,CR_GREY, 400.2, 210.0,1.0 / 35 + 1);
		}
		//----Skill2
		if(SelectedAtt==1)
		{
			//SetInventory("SkillSlot2", Skill2);
			SetFont(HunterIcons[Skill2]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.2, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Two: ", s:HunterAbilities[Skill2], s:": ", i:CheckInventory(HunterItemNames[Skill2]);
					   HUDMSG_PLAIN,702,CR_GOLD, 400.2, 270.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayH[Skill2];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			SetFont(HunterIcons[Skill2]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.2, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Two: ", s:HunterAbilities[Skill2], s:": ", i:CheckInventory(HunterItemNames[Skill2]);
					   HUDMSG_PLAIN,702,CR_GREY, 400.2, 270.0,1.0 / 35 + 1);
		}
		//----Skill3
		if(SelectedAtt==2)
		{
			//SetInventory("SkillSlot3", Skill3);
			SetFont(HunterIcons[Skill3]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.2, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Three: ", s:HunterAbilities[Skill3], s:": ", i:CheckInventory(HunterItemNames[Skill3]);
					   HUDMSG_PLAIN,703,CR_GOLD, 400.2, 330.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayH[Skill3];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			SetFont(HunterIcons[Skill3]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.2, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Three: ", s:HunterAbilities[Skill3], s:": ", i:CheckInventory(HunterItemNames[Skill3]);
					   HUDMSG_PLAIN,703,CR_GREY, 400.2, 330.0,1.0 / 35 + 1);
		}
		//----Skill4
		if(SelectedAtt==3)
		{
			//SetInventory("SkillSlot4", Skill4);
			SetFont(HunterIcons[Skill4]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,726,CR_UNTRANSLATED, 400.2, 420.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Four: ", s:HunterAbilities[Skill4], s:": ", i:CheckInventory(HunterItemNames[Skill4]);
					   HUDMSG_PLAIN,704,CR_GOLD, 400.2, 390.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayH[Skill4];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);	
		}
		else
		{
			SetFont(HunterIcons[Skill4]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,726,CR_UNTRANSLATED, 400.2, 420.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Four: ", s:HunterAbilities[Skill4], s:": ", i:CheckInventory(HunterItemNames[Skill4]);
					   HUDMSG_PLAIN,704,CR_GREY, 400.2, 390.0,1.0 / 35 + 1);
		}
		}
		If(CheckInventory("ImAWarlock"))
		{
		SetFont("NECRTREE");
		HudMessage (s:"A";
					   HUDMSG_PLAIN,727,CR_UNTRANSLATED, 450.1, 225.1,1.0 / 35 + 1);
		if(SelectedAtt==0)
		{
			//SetInventory("SkillSlot1", Skill1);
			SetFont(NecromancerIcons[Skill1]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.2, 240.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot One: ", s:NecromancerAbilities[Skill1], s:": ", i:CheckInventory(NecromancerItemNames[Skill1]);
					   HUDMSG_PLAIN,701,CR_GOLD, 400.2, 210.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayN[Skill1];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			SetFont(NecromancerIcons[Skill1]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.2, 240.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot One: ", s:NecromancerAbilities[Skill1], s:": ", i:CheckInventory(NecromancerItemNames[Skill1]);
					   HUDMSG_PLAIN,701,CR_GREY, 400.2, 210.0,1.0 / 35 + 1);
		}
		//----Skill2
		if(SelectedAtt==1)
		{
			//SetInventory("SkillSlot2", Skill2);
			SetFont(NecromancerIcons[Skill2]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.2, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Two: ", s:NecromancerAbilities[Skill2], s:": ", i:CheckInventory(NecromancerItemNames[Skill2]);
					   HUDMSG_PLAIN,702,CR_GOLD, 400.2, 270.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayN[Skill2];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);		   
		}
		else
		{
			SetFont(NecromancerIcons[Skill2]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.2, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Two: ", s:NecromancerAbilities[Skill2], s:": ", i:CheckInventory(NecromancerItemNames[Skill2]);
					   HUDMSG_PLAIN,702,CR_GREY, 400.2, 270.0,1.0 / 35 + 1);
		}
		//----Skill3
		if(SelectedAtt==2)
		{
			//SetInventory("SkillSlot3", Skill3);
			SetFont(NecromancerIcons[Skill3]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.2, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Three: ", s:NecromancerAbilities[Skill3], s:": ", i:CheckInventory(NecromancerItemNames[Skill3]);
					   HUDMSG_PLAIN,703,CR_GOLD, 400.2, 330.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayN[Skill3];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);	
		}
		else
		{
			SetFont(NecromancerIcons[Skill3]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.2, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Three: ", s:NecromancerAbilities[Skill3], s:": ", i:CheckInventory(NecromancerItemNames[Skill3]);
					   HUDMSG_PLAIN,703,CR_GREY, 400.2, 330.0,1.0 / 35 + 1);
		}
		//----Skill4
		if(SelectedAtt==3)
		{
			//SetInventory("SkillSlot4", Skill4);
			SetFont(NecromancerIcons[Skill4]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,726,CR_UNTRANSLATED, 400.2, 420.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Four: ", s:NecromancerAbilities[Skill4], s:": ", i:CheckInventory(NecromancerItemNames[Skill4]);
					   HUDMSG_PLAIN,704,CR_GOLD, 400.2, 390.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:DescriptionArrayN[Skill4];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);	
		}
		else
		{
			SetFont(NecromancerIcons[Skill4]);
			HudMessage (s:"A";
					   HUDMSG_PLAIN,726,CR_UNTRANSLATED, 400.2, 420.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Skill Slot Four: ", s:NecromancerAbilities[Skill4], s:": ", i:CheckInventory(NecromancerItemNames[Skill4]);
					   HUDMSG_PLAIN,704,CR_GREY, 400.2, 390.0,1.0 / 35 + 1);
		}
		}
		/*if(CheckInventory("LvlUp")>0)
		{
			SetFont("LargeFont");
			HudMessage (s:"Points remaining: ",i: CheckInventory("LvlUp");
					   HUDMSG_PLAIN,700, CR_WHITE, 400.2, 480.0, 1.0 / 35 + 1);
		}*/
		SetFont("LargeFont");
			HudMessage (s:"Points remaining: ",i: CheckInventory("LvlUp"),s:" / Skill Points Spent: ",i: CheckInventory("SkillPoint");
					   HUDMSG_PLAIN,700, CR_WHITE, 400.0, 480.0, 1.0 / 35 + 1);
		Delay(1);
	}
		
	//---------------------------ACCESSORY SELECTION SCREEN
	while(CheckInventory("ShowingAccessoryMenu")==1)
	{
		SetFont("LargeFont");
		sethudsize (800, 600, 1);

		setfont("HBARFONT");
		hudmessage (s:"press ",k:"+forward",s:" or ",k:"+back",s:" to change accessory slots, press ",k:"+moveleft",s:" or ",k:"+moveright", s:" to change the accessory,"; 0, 714, CR_WHITE, 400.0, 18.0, 1.0 / 35 + 1);
		hudmessage (s:"press ",k:"viewstats",s:" to return to the game."; 0, 715, CR_WHITE, 400.0, 30.0, 1.0 / 35 + 1);
		setfont("LargeFont");
		int Slot1;
		slot1 = CheckInventory("AccessoryTypesItem");
		int Slot2;
		slot2 = CheckInventory("AccessoryTypes2Item");

		SelectedAtt = CheckInventory("AccessorySlot");


		//----Slot1
		if(SelectedAtt==0)
		{
			If(CheckInventory(AccessoryItemNames[Slot1]))
			{
			SetFont(AccessoryImages[Slot1]);
			}
			else
			{
			SetFont(AccessoryImagesGrey[Slot1]);
			}
			HudMessage (s:"A";
					   HUDMSG_PLAIN,703,CR_UNTRANSLATED, 400.1, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Accessory One: ", s:AccessoryNames[Slot1];
					   HUDMSG_PLAIN,701,CR_GOLD, 400.0, 270.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:AccessoryDescriptions[Slot1];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
		}
		else
		{
			If(CheckInventory(AccessoryItemNames[Slot1]))
			{
			SetFont(AccessoryImages[Slot1]);
			}
			else
			{
			SetFont(AccessoryImagesGrey[Slot1]);
			}
			HudMessage (s:"A";
					   HUDMSG_PLAIN,703,CR_UNTRANSLATED, 400.1, 300.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Accessory One: ", s:AccessoryNames[Slot1];
					   HUDMSG_PLAIN,701,CR_GREY, 400.0, 270.0,1.0 / 35 + 1);
		}
		//----Slot2
		if(SelectedAtt==1)
		{
			If(CheckInventory(AccessoryItemNames[Slot2]))
			{
			SetFont(AccessoryImages[Slot2]);
			}
			else
			{
			SetFont(AccessoryImagesGrey[Slot2]);
			}
			HudMessage (s:"A";
					   HUDMSG_PLAIN,704,CR_UNTRANSLATED, 400.1, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Accessory Two: ", s:AccessoryNames[Slot2];
					   HUDMSG_PLAIN,702,CR_GOLD, 400.0, 330.0,1.0 / 35 + 1);
			SetFont("HBARFONT");
			hudmessage (s:AccessoryDescriptions[Slot2];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);		   
		}
		else
		{
			If(CheckInventory(AccessoryItemNames[Slot2]))
			{
			SetFont(AccessoryImages[Slot2]);
			}
			else
			{
			SetFont(AccessoryImagesGrey[Slot2]);
			}
			HudMessage (s:"A";
					   HUDMSG_PLAIN,704,CR_UNTRANSLATED, 400.1, 360.0,1.0 / 35 + 1);
			SetFont("LargeFont");
			HudMessage (s:"Accessory Two: ", s:AccessoryNames[Slot2];
					   HUDMSG_PLAIN,702,CR_GREY, 400.0, 330.0,1.0 / 35 + 1);
		}
		Delay(1);
	}
	
	while(CheckInventory("ShowingAlch") == 1)
	{
		if(CheckInventory("AlchemyD")==1) //Open Mixing menu
		{
				DrawMixHud(0, 0, CheckInventory("AlchemyMix"));
				SetHudSize(800, 600, 0);
				hudmessage (s:"press ",k:"+moveleft",s:" or ",k:"+moveright",s:" to switch flasks, press ",k:"+use",s:" to select flask"; 0, 714, CR_WHITE, 400.0, 18.0, 1.0 / 35 + 1);
				hudmessage (s:"or press ",k:"viewStats",s:" to return to the game."; 0, 715, CR_WHITE, 400.0, 30.0, 1.0 / 35 + 1);
				SetHudSize(0, 0, 0);
		}
		if(CheckInventory("AlchemyD") == 2) //verify 1st flask
		{	
				DrawMixHud(0, 0, CheckInventory("AlchemyMix"));
				DrawMixHud(0, 1, CheckInventory("AlchemyMix2"));
				SetHudSize(800, 600, 0);
				hudmessage (s:"press ",k:"+moveleft",s:" or ",k:"+moveright",s:" to switch flasks, press ",k:"+use",s:" to select and mix flasks"; 0, 714, CR_WHITE, 400.0, 18.0, 1.0 / 35 + 1);
				hudmessage (s:"or press ",k:"viewStats",s:" to return to the game."; 0, 715, CR_WHITE, 400.0, 30.0, 1.0 / 35 + 1);
				SetHudSize(0, 0, 0);
		}
		Delay(1);
	}
	
	while(CheckInventory("ShowingSpecMenu")==1)
	{
		SetFont("LargeFont");
		sethudsize (800, 600, 1);
		
		setfont("HBARFONT");
		hudmessage (s:"press ",k:"+forward",s:" or ",k:"+back",s:" to scroll the menu, press ",k:"+moveleft",s:" or ",k:"+moveright", s:" to view paths,"; 0, 714, CR_WHITE, 400.0, 18.0, 1.0 / 35 + 1);
		hudmessage (s:"press ",k:"+use",s:" to select your path on the bottom and press ",k:"viewstats",s:" to return to the game."; 0, 715, CR_WHITE, 400.0, 30.0, 1.0 / 35 + 1);
		setfont("LargeFont");
		int spec;
		spec = CheckInventory("SpecSideItem");

		SelectedAtt = CheckInventory("SpecMenuItem");
		
		str Subclass = "no";
		If(CheckInventory("IsDestroyer"))
			Subclass = "the \crDestroyer";
		If(CheckInventory("IsVanguard"))
			Subclass = "the \csVanguard";
		If(CheckInventory("IsCommander"))
			Subclass = "the \ciCommander";
		If(CheckInventory("IsPurifier"))
			Subclass = "the \cfPurifier";
		If(CheckInventory("IsOracle"))
			Subclass = "the \cjOracle";
		If(CheckInventory("IsInquisitor"))
			Subclass = "the \ckInquisitor";
		If(CheckInventory("IsPyro"))
			Subclass = "the \cgPyro";
		If(CheckInventory("IsIceborn"))
			Subclass = "the \cnIceborn";
		If(CheckInventory("IsArchon"))
			Subclass = "the \chArchon";
		If(CheckInventory("IsMarksman"))
			Subclass = "the \cbMarksman";
		If(CheckInventory("IsDuelist"))
			Subclass = "the \cuDuelist";
		If(CheckInventory("IsSurvivalist"))
			Subclass = "the \cdSurvivalist";
		If(CheckInventory("IsPlaguebringer"))
			Subclass = "the \cqPlaguebringer";
		If(CheckInventory("IsHarvester"))
			Subclass = "the \cmHarvester";
		If(CheckInventory("IsConjuror"))
			Subclass = "the \ctConjuror";		
		hudmessage (s:"under ",s:Subclass,s:"\cj path"; 0, 719, CR_WHITE, 400.0, 90.0, 1.0 / 35 + 1);
		
		If(CheckInventory("ImAFighter"))
		{
			SetFont("LargeFont");
			HudMessage (s:"you are a level  \ca",i: CheckInventory("Level"),s:"  \cdFighter";
					   HUDMSG_PLAIN,713,CR_WHITE, 400.0, 60.0,1.0 / 35 + 1);
			if(SelectedAtt==0)
			{
				SetFont("LargeFont");
				HudMessage (s:"Path: ", s:FighterSpec[Spec];
						   HUDMSG_PLAIN,701,CR_GOLD, 400.0, 210.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:FighterSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont("LargeFont");
				HudMessage (s:"Path: ", s:FighterSpec[Spec];
						   HUDMSG_PLAIN,701,CR_GREY, 400.0, 210.0,1.0 / 35 + 1);
			}
			if(SelectedAtt==1)
			{
				SetFont(FighterSpecIcons[Spec][0]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.0, 300.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:FighterSpecNames[Spec][0];
						   HUDMSG_PLAIN,702,CR_GOLD, 400.0, 270.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:FighterSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(FighterSpecIcons[Spec][0]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.0, 300.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:FighterSpecNames[Spec][0];
						   HUDMSG_PLAIN,702,CR_GREY, 400.0, 270.0,1.0 / 35 + 1);
			}
			//----Skill2
			if(SelectedAtt==2)
			{
				SetFont(FighterSpecIcons[Spec][1]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.0, 360.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:FighterSpecNames[Spec][1];
						   HUDMSG_PLAIN,703,CR_GOLD, 400.0, 330.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:FighterSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(FighterSpecIcons[Spec][1]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.0, 360.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:FighterSpecNames[Spec][1];
						   HUDMSG_PLAIN,703,CR_GREY, 400.0, 330.0,1.0 / 35 + 1);
			}
			//----Skill3
			if(SelectedAtt==3)
			{
				SetFont(FighterSpecIcons[Spec][2]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.0, 420.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:FighterSpecNames[Spec][2];
						   HUDMSG_PLAIN,704,CR_GOLD, 400.0, 390.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:FighterSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(FighterSpecIcons[Spec][2]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.0, 420.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:FighterSpecNames[Spec][2];
						   HUDMSG_PLAIN,704,CR_GREY, 400.0, 390.0,1.0 / 35 + 1);
			}
		}
		
		If(CheckInventory("ImACleric"))
		{
			HudMessage (s:"you are a level  \ca",i: CheckInventory("Level"),s:"  \chCleric";
					   HUDMSG_PLAIN,713,CR_WHITE, 400.0, 60.0,1.0 / 35 + 1);
			if(SelectedAtt==0)
			{
				SetFont("LargeFont");
				HudMessage (s:"Path: ", s:ClericSpec[Spec];
						   HUDMSG_PLAIN,701,CR_GOLD, 400.0, 210.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:ClericSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont("LargeFont");
				HudMessage (s:"Path: ", s:ClericSpec[Spec];
						   HUDMSG_PLAIN,701,CR_GREY, 400.0, 210.0,1.0 / 35 + 1);
			}
			if(SelectedAtt==1)
			{
				SetFont(ClericSpecIcons[Spec][0]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.0, 300.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:ClericSpecNames[Spec][0];
						   HUDMSG_PLAIN,702,CR_GOLD, 400.0, 270.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:ClericSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(ClericSpecIcons[Spec][0]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.0, 300.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:ClericSpecNames[Spec][0];
						   HUDMSG_PLAIN,702,CR_GREY, 400.0, 270.0,1.0 / 35 + 1);
			}
			//----Skill2
			if(SelectedAtt==2)
			{
				SetFont(ClericSpecIcons[Spec][1]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.0, 360.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:ClericSpecNames[Spec][1];
						   HUDMSG_PLAIN,703,CR_GOLD, 400.0, 330.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:ClericSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(ClericSpecIcons[Spec][1]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.0, 360.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:ClericSpecNames[Spec][1];
						   HUDMSG_PLAIN,703,CR_GREY, 400.0, 330.0,1.0 / 35 + 1);
			}
			//----Skill3
			if(SelectedAtt==3)
			{
				SetFont(ClericSpecIcons[Spec][2]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.0, 420.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:ClericSpecNames[Spec][2];
						   HUDMSG_PLAIN,704,CR_GOLD, 400.0, 390.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:ClericSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(ClericSpecIcons[Spec][2]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.0, 420.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:ClericSpecNames[Spec][2];
						   HUDMSG_PLAIN,704,CR_GREY, 400.0, 390.0,1.0 / 35 + 1);
			}
		}
		
		If(CheckInventory("ImAMage"))
		{
			HudMessage (s:"you are a level  \ca",i: CheckInventory("Level"),s:"  \cgMage";
					   HUDMSG_PLAIN,713,CR_WHITE, 400.0, 60.0, 1.0 / 35 + 1);
			if(SelectedAtt==0)
			{
				SetFont("LargeFont");
				HudMessage (s:"Path: ", s:MageSpec[Spec];
						   HUDMSG_PLAIN,701,CR_GOLD, 400.0, 210.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:MageSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont("LargeFont");
				HudMessage (s:"Path: ", s:MageSpec[Spec];
						   HUDMSG_PLAIN,701,CR_GREY, 400.0, 210.0,1.0 / 35 + 1);
			}
			if(SelectedAtt==1)
			{
				SetFont(MageSpecIcons[Spec][0]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.0, 300.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:MageSpecNames[Spec][0];
						   HUDMSG_PLAIN,702,CR_GOLD, 400.0, 270.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:MageSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(MageSpecIcons[Spec][0]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.0, 300.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:MageSpecNames[Spec][0];
						   HUDMSG_PLAIN,702,CR_GREY, 400.0, 270.0,1.0 / 35 + 1);
			}
			//----Skill2
			if(SelectedAtt==2)
			{
				SetFont(MageSpecIcons[Spec][1]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.0, 360.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:MageSpecNames[Spec][1];
						   HUDMSG_PLAIN,703,CR_GOLD, 400.0, 330.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:MageSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(MageSpecIcons[Spec][1]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.0, 360.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:MageSpecNames[Spec][1];
						   HUDMSG_PLAIN,703,CR_GREY, 400.0, 330.0,1.0 / 35 + 1);
			}
			//----Skill3
			if(SelectedAtt==3)
			{
				SetFont(MageSpecIcons[Spec][2]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.0, 420.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:MageSpecNames[Spec][2];
						   HUDMSG_PLAIN,704,CR_GOLD, 400.0, 390.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:MageSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(MageSpecIcons[Spec][2]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.0, 420.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:MageSpecNames[Spec][2];
						   HUDMSG_PLAIN,704,CR_GREY, 400.0, 390.0,1.0 / 35 + 1);
			}
		}
		
		If(CheckInventory("ImAHunter"))
		{
			HudMessage (s:"you are a level  \ca",i: CheckInventory("Level"),s:"  \ckHunter";
					   HUDMSG_PLAIN,713,CR_WHITE, 400.0, 60.0, 1.0 / 35 + 1);
			if(SelectedAtt==0)
			{
				SetFont("LargeFont");
				HudMessage (s:"Path: ", s:HunterSpec[Spec];
						   HUDMSG_PLAIN,701,CR_GOLD, 400.0, 210.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:HunterSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont("LargeFont");
				HudMessage (s:"Path: ", s:HunterSpec[Spec];
						   HUDMSG_PLAIN,701,CR_GREY, 400.0, 210.0,1.0 / 35 + 1);
			}
			if(SelectedAtt==1)
			{
				SetFont(HunterSpecIcons[Spec][0]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.0, 300.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:HunterSpecNames[Spec][0];
						   HUDMSG_PLAIN,702,CR_GOLD, 400.0, 270.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:HunterSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(HunterSpecIcons[Spec][0]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.0, 300.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:HunterSpecNames[Spec][0];
						   HUDMSG_PLAIN,702,CR_GREY, 400.0, 270.0,1.0 / 35 + 1);
			}
			//----Skill2
			if(SelectedAtt==2)
			{
				SetFont(HunterSpecIcons[Spec][1]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.0, 360.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:HunterSpecNames[Spec][1];
						   HUDMSG_PLAIN,703,CR_GOLD, 400.0, 330.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:HunterSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(HunterSpecIcons[Spec][1]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.0, 360.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:HunterSpecNames[Spec][1];
						   HUDMSG_PLAIN,703,CR_GREY, 400.0, 330.0,1.0 / 35 + 1);
			}
			//----Skill3
			if(SelectedAtt==3)
			{
				SetFont(HunterSpecIcons[Spec][2]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.0, 420.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:HunterSpecNames[Spec][2];
						   HUDMSG_PLAIN,704,CR_GOLD, 400.0, 390.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:HunterSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(HunterSpecIcons[Spec][2]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.0, 420.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:HunterSpecNames[Spec][2];
						   HUDMSG_PLAIN,704,CR_GREY, 400.0, 390.0,1.0 / 35 + 1);
			}
		}
		
		If(CheckInventory("ImAWarlock"))
		{
			HudMessage (s:"you are a level  \ca",i: CheckInventory("Level"),s:"  \ctNecromancer";
					   HUDMSG_PLAIN,713,CR_WHITE, 400.0, 60.0, 1.0 / 35 + 1);
			if(SelectedAtt==0)
			{
				SetFont("LargeFont");
				HudMessage (s:"Path: ", s:NecromancerSpec[Spec];
						   HUDMSG_PLAIN,701,CR_GOLD, 400.0, 210.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:NecromancerSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont("LargeFont");
				HudMessage (s:"Path: ", s:NecromancerSpec[Spec];
						   HUDMSG_PLAIN,701,CR_GREY, 400.0, 210.0,1.0 / 35 + 1);
			}
			if(SelectedAtt==1)
			{
				SetFont(NecromancerSpecIcons[Spec][0]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.0, 300.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:NecromancerSpecNames[Spec][0];
						   HUDMSG_PLAIN,702,CR_GOLD, 400.0, 270.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:NecromancerSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(NecromancerSpecIcons[Spec][0]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,723,CR_UNTRANSLATED, 400.0, 300.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:NecromancerSpecNames[Spec][0];
						   HUDMSG_PLAIN,702,CR_GREY, 400.0, 270.0,1.0 / 35 + 1);
			}
			//----Skill2
			if(SelectedAtt==2)
			{
				SetFont(NecromancerSpecIcons[Spec][1]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.0, 360.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:NecromancerSpecNames[Spec][1];
						   HUDMSG_PLAIN,703,CR_GOLD, 400.0, 330.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:NecromancerSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(NecromancerSpecIcons[Spec][1]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,724,CR_UNTRANSLATED, 400.0, 360.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:NecromancerSpecNames[Spec][1];
						   HUDMSG_PLAIN,703,CR_GREY, 400.0, 330.0,1.0 / 35 + 1);
			}
			//----Skill3
			if(SelectedAtt==3)
			{
				SetFont(NecromancerSpecIcons[Spec][2]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.0, 420.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:NecromancerSpecNames[Spec][2];
						   HUDMSG_PLAIN,704,CR_GOLD, 400.0, 390.0,1.0 / 35 + 1);
				SetFont("HBARFONT");
				hudmessage (s:NecromancerSpecDescriptions[Spec][SelectedAtt];HUDMSG_PLAIN, 716, CR_GOLD, 400.0, 540.0, 1.0 / 35 + 1);
			}
			else
			{
				SetFont(NecromancerSpecIcons[Spec][2]);
				HudMessage (s:"A";
						   HUDMSG_PLAIN,725,CR_UNTRANSLATED, 400.0, 420.0,1.0 / 35 + 1);
				SetFont("LargeFont");
				HudMessage (s:"Passive: ", s:NecromancerSpecNames[Spec][2];
						   HUDMSG_PLAIN,704,CR_GREY, 400.0, 390.0,1.0 / 35 + 1);
			}
		}
		
		If(SelectedAtt==4 && CheckInventory("Level")>=15 && !CheckInventory("SpecChosen"))
		{
			SetFont("LargeFont");
			HudMessage (s:"Confirm Specialization";
						   HUDMSG_PLAIN,705,CR_GOLD, 400.0, 450.0,1.0 / 35 + 1);
		}
		Else If(CheckInventory("Level")>=15 && !CheckInventory("SpecChosen"))
		{
			SetFont("LargeFont");
			HudMessage (s:"Confirm Specialization";
						   HUDMSG_PLAIN,705,CR_GREY, 400.0, 450.0,1.0 / 35 + 1);
		}
		Delay(1);
	}
}

script 553(int HealType)
{//return maximum amount of health
	if(HealType<1)SetResultValue(CheckInventory("CurrentMaxHealth"));
	if(HealType==1)
	{//quartz flask
		SetResultValue(CheckInventory("CurrentMaxHealth")/6);
	}
}



script WOC_HEALTARGET(int HealAmount)
{//this will heal a player until the healing ability of the item is gone, or their max health is reached
	SetActivatorToTarget(0);
	int Damage = CheckInventory("CurrentMaxHealth")-CheckInventory("Health");//amount of damage we've taken
	int OverFlow = CheckInventory("CurrentMaxHealth")-CheckInventory("Health")-HealAmount;//(the negative of)The amount by which healing by the desired amount will put us over our max health
	int H = HealAmount;
	//H = 10;
	if(OverFlow<0)H -= -OverFlow; //this will heal us by the desired amount, or up to our maximum
	//GiveInventory("NewHealth",H);
	//HealThing(H);
	SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+H);
}

function int pow (int x, int n)
{
	int y = 1;
	while (n-- > 0) y *= x;
	return y;
}

function int GetDigit(int Num, int Digit)
{
	return (Num / pow(10, Digit)) % 10 ;
}

str hps[33] = {"HP00", "HP01", "HP02", "HP03", "HP04", "HP05", "HP06", "HP07", "HP08", "HP09", "HP10", "HP11", "HP12", "HP13", "HP14", "HP15", "HP16", 
      "HP17", "HP18", "HP19", "HP20", "HP21", "HP22", "HP23", "HP24", "HP25", "HP26", "HP27", "HP28", "HP29", "HP30", "HP31", "HP32"};



script 900 (int height) //Constant Monster Scripts
{
	int hp;
	int lvl;
	int ticked;
	If(Height == 0)
		Height = GetActorProperty(0,APROP_Height);
	Else
		Height = Height*1.0;
	int x, y, z, angle, barheight, x1, y1, ceiling;
	
	
	int id = (++pool)+9000;
	

	int state;
	
	barheight = getactorz(0) + (height);
	ceiling = GetActorCeilingZ(0)-4.5;
	if(barheight > ceiling)
		barheight = ceiling;
	If(CheckInventory("EnemyInDisguise")==0 && CheckActorProperty(0, APROP_Friendly, 0) || CheckInventory("FriendlyInDisguise")>0 )
		Spawn("HPBAR", getactorx(0), getactory(0), barheight, id);
	Else If(CheckActorProperty(0, APROP_Friendly, 1) || CheckInventory("EnemyInDisguise")>0)
		Spawn("HPBAR2", getactorx(0), getactory(0), barheight, id);
	If(GameType() == 0)
		ACS_ExecuteAlways(706,0,id,0,0);
	while(GetActorProperty(0,APROP_Health) > 0)
	{
		//Floating Health Bars
		barheight = getactorz(0) + (Height);
		ceiling = GetActorCeilingZ(0)-4.5;
		if(barheight > ceiling)
			barheight = ceiling;
		
		if(GetActorProperty(0, APROP_Health) != CheckInventory("CurrentMaxHealth"))
			state = (GetActorProperty(0, APROP_Health) * fixeddiv(32.0, (CheckInventory("CurrentMaxHealth")<<16)))>>16;
		else
			state = 32;
		If(state == 0)
			state = 1;
		x1 = GetActorX(0);
		y1 = GetActorY(0);
		setactorposition(id, x1, y1, barheight, 0);
		setactorstate(id, hps[state], 0);
		
		If(CheckInventory("EnemyInDisguise")==0 && CheckActorProperty(0, APROP_Friendly, 0) || CheckInventory("FriendlyInDisguise")>0 )
		{
			If(GetActorProperty(0, APROP_Renderstyle) == STYLE_None || CheckFlag(0, "SHOOTABLE") == 0)
				SetActorProperty(id, APROP_Alpha, 0.0);
			Else
				SetActorProperty(id, APROP_Alpha, GetActorProperty(0, APROP_Alpha));
		}
		//Damage Indicator
		hp = GetActorProperty(0,APROP_Health);
		lvl = CheckInventory("Level");
		int NumberID = Random(7000, 7500);
		delay(1);
		If(GetActorProperty(0,APROP_Health)!=hp && lvl==CheckInventory("Level"));
		{
			int DNewHealth = (hp - GetActorProperty(0,APROP_Health));
			
			angle = GetActorAngle(0) + Random(-0.25, 0.25);
			x = GetActorX(0) + cos(angle) * random(10,14);
			y = GetActorY(0) + sin(angle) * random(10,14);
			z = GetActorZ(0) + Random(height, height+6.0);
			If(z > GetActorCeilingZ(0)-10.0)
				z = GetActorCeilingZ(0)-10.0;
			
			If(DNewHealth>0)
			{
				int Digit1 = GetDigit(DNewHealth, 0);
				int Digit2 = GetDigit(DNewHealth, 1);
				int Digit3 = GetDigit(DNewHealth, 2);
				int Digit4 = GetDigit(DNewHealth, 3);
				int Digit5 = GetDigit(DNewHealth, 4);
				int Digit6 = GetDigit(DNewHealth, 5);
				int Digit7 = GetDigit(DNewHealth, 6);
			
				
			
				if(Digit1 == 0) { Spawn("SDigit1Num0", x, y, z, NumberID, 0); }
				else if(Digit1 == 1) { Spawn("SDigit1Num1", x, y, z, NumberID, 0); }
				else if(Digit1 == 2) { Spawn("SDigit1Num2", x, y, z, NumberID, 0); }
				else if(Digit1 == 3) { Spawn("SDigit1Num3", x, y, z, NumberID, 0); }
				else if(Digit1 == 4) { Spawn("SDigit1Num4", x, y, z, NumberID, 0); }
				else if(Digit1 == 5) { Spawn("SDigit1Num5", x, y, z, NumberID, 0); }
				else if(Digit1 == 6) { Spawn("SDigit1Num6", x, y, z, NumberID, 0); }
				else if(Digit1 == 7) { Spawn("SDigit1Num7", x, y, z, NumberID, 0); }
				else if(Digit1 == 8) { Spawn("SDigit1Num8", x, y, z, NumberID, 0); }
				else if(Digit1 == 9) { Spawn("SDigit1Num9", x, y, z, NumberID, 0); }
			
				if(DNewHealth >= 10)
				{
					if(Digit2 == 0) { Spawn("SDigit2Num0", x, y, z, NumberID, 0); }
					else if(Digit2 == 1) { Spawn("SDigit2Num1", x, y, z, NumberID, 0); }
					else if(Digit2 == 2) { Spawn("SDigit2Num2", x, y, z, NumberID, 0); }
					else if(Digit2 == 3) { Spawn("SDigit2Num3", x, y, z, NumberID, 0); }
					else if(Digit2 == 4) { Spawn("SDigit2Num4", x, y, z, NumberID, 0); }
					else if(Digit2 == 5) { Spawn("SDigit2Num5", x, y, z, NumberID, 0); }
					else if(Digit2 == 6) { Spawn("SDigit2Num6", x, y, z, NumberID, 0); }
					else if(Digit2 == 7) { Spawn("SDigit2Num7", x, y, z, NumberID, 0); }
					else if(Digit2 == 8) { Spawn("SDigit2Num8", x, y, z, NumberID, 0); }
					else if(Digit2 == 9) { Spawn("SDigit2Num9", x, y, z, NumberID, 0); }
				}
			
				if(DNewHealth >= 100)
				{
					if(Digit3 == 0) { Spawn("SDigit3Num0", x, y, z, NumberID, 0); }
					else if(Digit3 == 1) { Spawn("SDigit3Num1", x, y, z, NumberID, 0); }
					else if(Digit3 == 2) { Spawn("SDigit3Num2", x, y, z, NumberID, 0); }
					else if(Digit3 == 3) { Spawn("SDigit3Num3", x, y, z, NumberID, 0); }
					else if(Digit3 == 4) { Spawn("SDigit3Num4", x, y, z, NumberID, 0); }
					else if(Digit3 == 5) { Spawn("SDigit3Num5", x, y, z, NumberID, 0); }
					else if(Digit3 == 6) { Spawn("SDigit3Num6", x, y, z, NumberID, 0); }
					else if(Digit3 == 7) { Spawn("SDigit3Num7", x, y, z, NumberID, 0); }
					else if(Digit3 == 8) { Spawn("SDigit3Num8", x, y, z, NumberID, 0); }
					else if(Digit3 == 9) { Spawn("SDigit3Num9", x, y, z, NumberID, 0); }
				}
			
				if(DNewHealth >= 1000)
				{
					if(Digit4 == 0) { Spawn("SDigit4Num0", x, y, z, NumberID, 0); }
					else if(Digit4 == 1) { Spawn("SDigit4Num1", x, y, z, NumberID, 0); }
					else if(Digit4 == 2) { Spawn("SDigit4Num2", x, y, z, NumberID, 0); }
					else if(Digit4 == 3) { Spawn("SDigit4Num3", x, y, z, NumberID, 0); }
					else if(Digit4 == 4) { Spawn("SDigit4Num4", x, y, z, NumberID, 0); }
					else if(Digit4 == 5) { Spawn("SDigit4Num5", x, y, z, NumberID, 0); }
					else if(Digit4 == 6) { Spawn("SDigit4Num6", x, y, z, NumberID, 0); }
					else if(Digit4 == 7) { Spawn("SDigit4Num7", x, y, z, NumberID, 0); }
					else if(Digit4 == 8) { Spawn("SDigit4Num8", x, y, z, NumberID, 0); }
					else if(Digit4 == 9) { Spawn("SDigit4Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 10000)
				{
					if(Digit5 == 0) { Spawn("SDigit5Num0", x, y, z, NumberID, 0); }
					else if(Digit5 == 1) { Spawn("SDigit5Num1", x, y, z, NumberID, 0); }
					else if(Digit5 == 2) { Spawn("SDigit5Num2", x, y, z, NumberID, 0); }
					else if(Digit5 == 3) { Spawn("SDigit5Num3", x, y, z, NumberID, 0); }
					else if(Digit5 == 4) { Spawn("SDigit5Num4", x, y, z, NumberID, 0); }
					else if(Digit5 == 5) { Spawn("SDigit5Num5", x, y, z, NumberID, 0); }
					else if(Digit5 == 6) { Spawn("SDigit5Num6", x, y, z, NumberID, 0); }
					else if(Digit5 == 7) { Spawn("SDigit5Num7", x, y, z, NumberID, 0); }
					else if(Digit5 == 8) { Spawn("SDigit5Num8", x, y, z, NumberID, 0); }
					else if(Digit5 == 9) { Spawn("SDigit5Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 100000)
				{
					if(Digit6 == 0) { Spawn("SDigit6Num0", x, y, z, NumberID, 0); }
					else if(Digit6 == 1) { Spawn("SDigit6Num1", x, y, z, NumberID, 0); }
					else if(Digit6 == 2) { Spawn("SDigit6Num2", x, y, z, NumberID, 0); }
					else if(Digit6 == 3) { Spawn("SDigit6Num3", x, y, z, NumberID, 0); }
					else if(Digit6 == 4) { Spawn("SDigit6Num4", x, y, z, NumberID, 0); }
					else if(Digit6 == 5) { Spawn("SDigit6Num5", x, y, z, NumberID, 0); }
					else if(Digit6 == 6) { Spawn("SDigit6Num6", x, y, z, NumberID, 0); }
					else if(Digit6 == 7) { Spawn("SDigit6Num7", x, y, z, NumberID, 0); }
					else if(Digit6 == 8) { Spawn("SDigit6Num8", x, y, z, NumberID, 0); }
					else if(Digit6 == 9) { Spawn("SDigit6Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 1000000)
				{
					if(Digit7 == 0) { Spawn("SDigit7Num0", x, y, z, NumberID, 0); }
					else if(Digit7 == 1) { Spawn("SDigit7Num1", x, y, z, NumberID, 0); }
					else if(Digit7 == 2) { Spawn("SDigit7Num2", x, y, z, NumberID, 0); }
					else if(Digit7 == 3) { Spawn("SDigit7Num3", x, y, z, NumberID, 0); }
					else if(Digit7 == 4) { Spawn("SDigit7Num4", x, y, z, NumberID, 0); }
					else if(Digit7 == 5) { Spawn("SDigit7Num5", x, y, z, NumberID, 0); }
					else if(Digit7 == 6) { Spawn("SDigit7Num6", x, y, z, NumberID, 0); }
					else if(Digit7 == 7) { Spawn("SDigit7Num7", x, y, z, NumberID, 0); }
					else if(Digit7 == 8) { Spawn("SDigit7Num8", x, y, z, NumberID, 0); }
					else if(Digit7 == 9) { Spawn("SDigit7Num9", x, y, z, NumberID, 0); }
				}
				
			}
			If(DNewHealth<0)
			{

				DNewHealth *= (-1);
				int HDigit1 = GetDigit(DNewHealth, 0);
				int HDigit2 = GetDigit(DNewHealth, 1);
				int HDigit3 = GetDigit(DNewHealth, 2);
				int HDigit4 = GetDigit(DNewHealth, 3);
				int HDigit5 = GetDigit(DNewHealth, 4);
				int HDigit6 = GetDigit(DNewHealth, 5);
				int HDigit7 = GetDigit(DNewHealth, 6);
			
				if(HDigit1 == 0) { Spawn("HSDigit1Num0", x, y, z, NumberID, 0); }
				else if(HDigit1 == 1) { Spawn("HSDigit1Num1", x, y, z, NumberID, 0); }
				else if(HDigit1 == 2) { Spawn("HSDigit1Num2", x, y, z, NumberID, 0); }
				else if(HDigit1 == 3) { Spawn("HSDigit1Num3", x, y, z, NumberID, 0); }
				else if(HDigit1 == 4) { Spawn("HSDigit1Num4", x, y, z, NumberID, 0); }
				else if(HDigit1 == 5) { Spawn("HSDigit1Num5", x, y, z, NumberID, 0); }
				else if(HDigit1 == 6) { Spawn("HSDigit1Num6", x, y, z, NumberID, 0); }
				else if(HDigit1 == 7) { Spawn("HSDigit1Num7", x, y, z, NumberID, 0); }
				else if(HDigit1 == 8) { Spawn("HSDigit1Num8", x, y, z, NumberID, 0); }
				else if(HDigit1 == 9) { Spawn("HSDigit1Num9", x, y, z, NumberID, 0); }
			
				if(DNewHealth >= 10)
				{
					if(HDigit2 == 0) { Spawn("HSDigit2Num0", x, y, z, NumberID, 0); }
					else if(HDigit2 == 1) { Spawn("HSDigit2Num1", x, y, z, NumberID, 0); }
					else if(HDigit2 == 2) { Spawn("HSDigit2Num2", x, y, z, NumberID, 0); }
					else if(HDigit2 == 3) { Spawn("HSDigit2Num3", x, y, z, NumberID, 0); }
					else if(HDigit2 == 4) { Spawn("HSDigit2Num4", x, y, z, NumberID, 0); }
					else if(HDigit2 == 5) { Spawn("HSDigit2Num5", x, y, z, NumberID, 0); }
					else if(HDigit2 == 6) { Spawn("HSDigit2Num6", x, y, z, NumberID, 0); }
					else if(HDigit2 == 7) { Spawn("HSDigit2Num7", x, y, z, NumberID, 0); }
					else if(HDigit2 == 8) { Spawn("HSDigit2Num8", x, y, z, NumberID, 0); }
					else if(HDigit2 == 9) { Spawn("HSDigit2Num9", x, y, z, NumberID, 0); }
				}
			
				if(DNewHealth >= 100)
				{
					if(HDigit3 == 0) { Spawn("HSDigit3Num0", x, y, z, NumberID, 0); }
					else if(HDigit3 == 1) { Spawn("HSDigit3Num1", x, y, z, NumberID, 0); }
					else if(HDigit3 == 2) { Spawn("HSDigit3Num2", x, y, z, NumberID, 0); }
					else if(HDigit3 == 3) { Spawn("HSDigit3Num3", x, y, z, NumberID, 0); }
					else if(HDigit3 == 4) { Spawn("HSDigit3Num4", x, y, z, NumberID, 0); }
					else if(HDigit3 == 5) { Spawn("HSDigit3Num5", x, y, z, NumberID, 0); }
					else if(HDigit3 == 6) { Spawn("HSDigit3Num6", x, y, z, NumberID, 0); }
					else if(HDigit3 == 7) { Spawn("HSDigit3Num7", x, y, z, NumberID, 0); }
					else if(HDigit3 == 8) { Spawn("HSDigit3Num8", x, y, z, NumberID, 0); }
					else if(HDigit3 == 9) { Spawn("HSDigit3Num9", x, y, z, NumberID, 0); }
				}
			
				if(DNewHealth >= 1000)
				{
					if(HDigit4 == 0) { Spawn("HSDigit4Num0", x, y, z, NumberID, 0); }
					else if(HDigit4 == 1) { Spawn("HSDigit4Num1", x, y, z, NumberID, 0); }
					else if(HDigit4 == 2) { Spawn("HSDigit4Num2", x, y, z, NumberID, 0); }
					else if(HDigit4 == 3) { Spawn("HSDigit4Num3", x, y, z, NumberID, 0); }
					else if(HDigit4 == 4) { Spawn("HSDigit4Num4", x, y, z, NumberID, 0); }
					else if(HDigit4 == 5) { Spawn("HSDigit4Num5", x, y, z, NumberID, 0); }
					else if(HDigit4 == 6) { Spawn("HSDigit4Num6", x, y, z, NumberID, 0); }
					else if(HDigit4 == 7) { Spawn("HSDigit4Num7", x, y, z, NumberID, 0); }
					else if(HDigit4 == 8) { Spawn("HSDigit4Num8", x, y, z, NumberID, 0); }
					else if(HDigit4 == 9) { Spawn("HSDigit4Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 10000)
				{
					if(HDigit5 == 0) { Spawn("HSDigit5Num0", x, y, z, NumberID, 0); }
					else if(HDigit5 == 1) { Spawn("HSDigit5Num1", x, y, z, NumberID, 0); }
					else if(HDigit5 == 2) { Spawn("HSDigit5Num2", x, y, z, NumberID, 0); }
					else if(HDigit5 == 3) { Spawn("HSDigit5Num3", x, y, z, NumberID, 0); }
					else if(HDigit5 == 4) { Spawn("HSDigit5Num4", x, y, z, NumberID, 0); }
					else if(HDigit5 == 5) { Spawn("HSDigit5Num5", x, y, z, NumberID, 0); }
					else if(HDigit5 == 6) { Spawn("HSDigit5Num6", x, y, z, NumberID, 0); }
					else if(HDigit5 == 7) { Spawn("HSDigit5Num7", x, y, z, NumberID, 0); }
					else if(HDigit5 == 8) { Spawn("HSDigit5Num8", x, y, z, NumberID, 0); }
					else if(HDigit5 == 9) { Spawn("HSDigit5Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 100000)
				{
					if(HDigit6 == 0) { Spawn("HSDigit6Num0", x, y, z, NumberID, 0); }
					else if(HDigit6 == 1) { Spawn("HSDigit6Num1", x, y, z, NumberID, 0); }
					else if(HDigit6 == 2) { Spawn("HSDigit6Num2", x, y, z, NumberID, 0); }
					else if(HDigit6 == 3) { Spawn("HSDigit6Num3", x, y, z, NumberID, 0); }
					else if(HDigit6 == 4) { Spawn("HSDigit6Num4", x, y, z, NumberID, 0); }
					else if(HDigit6 == 5) { Spawn("HSDigit6Num5", x, y, z, NumberID, 0); }
					else if(HDigit6 == 6) { Spawn("HSDigit6Num6", x, y, z, NumberID, 0); }
					else if(HDigit6 == 7) { Spawn("HSDigit6Num7", x, y, z, NumberID, 0); }
					else if(HDigit6 == 8) { Spawn("HSDigit6Num8", x, y, z, NumberID, 0); }
					else if(HDigit6 == 9) { Spawn("HSDigit6Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 1000000)
				{
					if(HDigit7 == 0) { Spawn("HSDigit7Num0", x, y, z, NumberID, 0); }
					else if(HDigit7 == 1) { Spawn("HSDigit7Num1", x, y, z, NumberID, 0); }
					else if(HDigit7 == 2) { Spawn("HSDigit7Num2", x, y, z, NumberID, 0); }
					else if(HDigit7 == 3) { Spawn("HSDigit7Num3", x, y, z, NumberID, 0); }
					else if(HDigit7 == 4) { Spawn("HSDigit7Num4", x, y, z, NumberID, 0); }
					else if(HDigit7 == 5) { Spawn("HSDigit7Num5", x, y, z, NumberID, 0); }
					else if(HDigit7 == 6) { Spawn("HSDigit7Num6", x, y, z, NumberID, 0); }
					else if(HDigit7 == 7) { Spawn("HSDigit7Num7", x, y, z, NumberID, 0); }
					else if(HDigit7 == 8) { Spawn("HSDigit7Num8", x, y, z, NumberID, 0); }
					else if(HDigit7 == 9) { Spawn("HSDigit7Num9", x, y, z, NumberID, 0); }
				}

				
			}
			if(z >= GetActorCeilingZ(0)-10.0)
					SetActorVelocity(NumberID, 0, random((-1.0),(1.0)), -0.5, 0, 0);
				else
					SetActorVelocity(NumberID, 0, random((-1.0),(1.0)), random(0.0,0.5), 0, 0);
		}
	}
	setactorstate(id, hps[0], 0);
	SetActorProperty(id, APROP_Health, 0);
	delay(35);
	thing_remove(id);
}

script 901 Enter
{
	int x, y, z, angle, prevhp;
	while(GetActorProperty(0,APROP_Health) > 0 && (GetCVar("WoC_DamageIndicator")>0))
	{
		prevhp = GetActorProperty(0,APROP_Health);
		int NumberID = Random(7000, 7500);
		delay(1);
		angle = GetActorAngle(0) + Random(-0.25, 0.25);
		x = GetActorX(0) + cos(angle) * random(10,14);
		y = GetActorY(0) + sin(angle) * random(10,14);
		z = GetActorZ(0) + GetActorProperty(0,APROP_Height) + Random(0.0, 6.0);
		If(z > GetActorCeilingZ(0)-10.0)
			z = GetActorCeilingZ(0)-10.0;
		If(GetActorProperty(0,APROP_Health)!=prevhp);
		{
			int DNewHealth = (prevhp - GetActorProperty(0,APROP_Health));
			If(DNewHealth>0)
			{
				int Digit1 = GetDigit(DNewHealth, 0);
				int Digit2 = GetDigit(DNewHealth, 1);
				int Digit3 = GetDigit(DNewHealth, 2);
				int Digit4 = GetDigit(DNewHealth, 3);
				int Digit5 = GetDigit(DNewHealth, 4);
				int Digit6 = GetDigit(DNewHealth, 5);
				int Digit7 = GetDigit(DNewHealth, 6);
			
				
			
			
				if(Digit1 == 0) { Spawn("PSDigit1Num0", x, y, z, NumberID, 0); }
				else if(Digit1 == 1) { Spawn("PSDigit1Num1", x, y, z, NumberID, 0); }
				else if(Digit1 == 2) { Spawn("PSDigit1Num2", x, y, z, NumberID, 0); }
				else if(Digit1 == 3) { Spawn("PSDigit1Num3", x, y, z, NumberID, 0); }
				else if(Digit1 == 4) { Spawn("PSDigit1Num4", x, y, z, NumberID, 0); }
				else if(Digit1 == 5) { Spawn("PSDigit1Num5", x, y, z, NumberID, 0); }
				else if(Digit1 == 6) { Spawn("PSDigit1Num6", x, y, z, NumberID, 0); }
				else if(Digit1 == 7) { Spawn("PSDigit1Num7", x, y, z, NumberID, 0); }
				else if(Digit1 == 8) { Spawn("PSDigit1Num8", x, y, z, NumberID, 0); }
				else if(Digit1 == 9) { Spawn("PSDigit1Num9", x, y, z, NumberID, 0); }
			
				if(DNewHealth >= 10)
				{
					if(Digit2 == 0) { Spawn("PSDigit2Num0", x, y, z, NumberID, 0); }
					else if(Digit2 == 1) { Spawn("PSDigit2Num1", x, y, z, NumberID, 0); }
					else if(Digit2 == 2) { Spawn("PSDigit2Num2", x, y, z, NumberID, 0); }
					else if(Digit2 == 3) { Spawn("PSDigit2Num3", x, y, z, NumberID, 0); }
					else if(Digit2 == 4) { Spawn("PSDigit2Num4", x, y, z, NumberID, 0); }
					else if(Digit2 == 5) { Spawn("PSDigit2Num5", x, y, z, NumberID, 0); }
					else if(Digit2 == 6) { Spawn("PSDigit2Num6", x, y, z, NumberID, 0); }
					else if(Digit2 == 7) { Spawn("PSDigit2Num7", x, y, z, NumberID, 0); }
					else if(Digit2 == 8) { Spawn("PSDigit2Num8", x, y, z, NumberID, 0); }
					else if(Digit2 == 9) { Spawn("PSDigit2Num9", x, y, z, NumberID, 0); }
				}
			
				if(DNewHealth >= 100)
				{
					if(Digit3 == 0) { Spawn("PSDigit3Num0", x, y, z, NumberID, 0); }
					else if(Digit3 == 1) { Spawn("PSDigit3Num1", x, y, z, NumberID, 0); }
					else if(Digit3 == 2) { Spawn("PSDigit3Num2", x, y, z, NumberID, 0); }
					else if(Digit3 == 3) { Spawn("PSDigit3Num3", x, y, z, NumberID, 0); }
					else if(Digit3 == 4) { Spawn("PSDigit3Num4", x, y, z, NumberID, 0); }
					else if(Digit3 == 5) { Spawn("PSDigit3Num5", x, y, z, NumberID, 0); }
					else if(Digit3 == 6) { Spawn("PSDigit3Num6", x, y, z, NumberID, 0); }
					else if(Digit3 == 7) { Spawn("PSDigit3Num7", x, y, z, NumberID, 0); }
					else if(Digit3 == 8) { Spawn("PSDigit3Num8", x, y, z, NumberID, 0); }
					else if(Digit3 == 9) { Spawn("PSDigit3Num9", x, y, z, NumberID, 0); }
				}
			
				if(DNewHealth >= 1000)
				{
					if(Digit4 == 0) { Spawn("PSDigit4Num0", x, y, z, NumberID, 0); }
					else if(Digit4 == 1) { Spawn("PSDigit4Num1", x, y, z, NumberID, 0); }
					else if(Digit4 == 2) { Spawn("PSDigit4Num2", x, y, z, NumberID, 0); }
					else if(Digit4 == 3) { Spawn("PSDigit4Num3", x, y, z, NumberID, 0); }
					else if(Digit4 == 4) { Spawn("PSDigit4Num4", x, y, z, NumberID, 0); }
					else if(Digit4 == 5) { Spawn("PSDigit4Num5", x, y, z, NumberID, 0); }
					else if(Digit4 == 6) { Spawn("PSDigit4Num6", x, y, z, NumberID, 0); }
					else if(Digit4 == 7) { Spawn("PSDigit4Num7", x, y, z, NumberID, 0); }
					else if(Digit4 == 8) { Spawn("PSDigit4Num8", x, y, z, NumberID, 0); }
					else if(Digit4 == 9) { Spawn("PSDigit4Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 10000)
				{
					if(Digit5 == 0) { Spawn("PSDigit5Num0", x, y, z, NumberID, 0); }
					else if(Digit5 == 1) { Spawn("PSDigit5Num1", x, y, z, NumberID, 0); }
					else if(Digit5 == 2) { Spawn("PSDigit5Num2", x, y, z, NumberID, 0); }
					else if(Digit5 == 3) { Spawn("PSDigit5Num3", x, y, z, NumberID, 0); }
					else if(Digit5 == 4) { Spawn("PSDigit5Num4", x, y, z, NumberID, 0); }
					else if(Digit5 == 5) { Spawn("PSDigit5Num5", x, y, z, NumberID, 0); }
					else if(Digit5 == 6) { Spawn("PSDigit5Num6", x, y, z, NumberID, 0); }
					else if(Digit5 == 7) { Spawn("PSDigit5Num7", x, y, z, NumberID, 0); }
					else if(Digit5 == 8) { Spawn("PSDigit5Num8", x, y, z, NumberID, 0); }
					else if(Digit5 == 9) { Spawn("PSDigit5Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 100000)
				{
					if(Digit6 == 0) { Spawn("PSDigit6Num0", x, y, z, NumberID, 0); }
					else if(Digit6 == 1) { Spawn("PSDigit6Num1", x, y, z, NumberID, 0); }
					else if(Digit6 == 2) { Spawn("PSDigit6Num2", x, y, z, NumberID, 0); }
					else if(Digit6 == 3) { Spawn("PSDigit6Num3", x, y, z, NumberID, 0); }
					else if(Digit6 == 4) { Spawn("PSDigit6Num4", x, y, z, NumberID, 0); }
					else if(Digit6 == 5) { Spawn("PSDigit6Num5", x, y, z, NumberID, 0); }
					else if(Digit6 == 6) { Spawn("PSDigit6Num6", x, y, z, NumberID, 0); }
					else if(Digit6 == 7) { Spawn("PSDigit6Num7", x, y, z, NumberID, 0); }
					else if(Digit6 == 8) { Spawn("PSDigit6Num8", x, y, z, NumberID, 0); }
					else if(Digit6 == 9) { Spawn("PSDigit6Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 1000000)
				{
					if(Digit7 == 0) { Spawn("PSDigit7Num0", x, y, z, NumberID, 0); }
					else if(Digit7 == 1) { Spawn("PSDigit7Num1", x, y, z, NumberID, 0); }
					else if(Digit7 == 2) { Spawn("PSDigit7Num2", x, y, z, NumberID, 0); }
					else if(Digit7 == 3) { Spawn("PSDigit7Num3", x, y, z, NumberID, 0); }
					else if(Digit7 == 4) { Spawn("PSDigit7Num4", x, y, z, NumberID, 0); }
					else if(Digit7 == 5) { Spawn("PSDigit7Num5", x, y, z, NumberID, 0); }
					else if(Digit7 == 6) { Spawn("PSDigit7Num6", x, y, z, NumberID, 0); }
					else if(Digit7 == 7) { Spawn("PSDigit7Num7", x, y, z, NumberID, 0); }
					else if(Digit7 == 8) { Spawn("PSDigit7Num8", x, y, z, NumberID, 0); }
					else if(Digit7 == 9) { Spawn("PSDigit7Num9", x, y, z, NumberID, 0); }
				}
			}
			If(DNewHealth<0)
			{
				DNewHealth *= (-1);
				int HDigit1 = GetDigit(DNewHealth, 0);
				int HDigit2 = GetDigit(DNewHealth, 1);
				int HDigit3 = GetDigit(DNewHealth, 2);
				int HDigit4 = GetDigit(DNewHealth, 3);
				int HDigit5 = GetDigit(DNewHealth, 4);
				int HDigit6 = GetDigit(DNewHealth, 5);
				int HDigit7 = GetDigit(DNewHealth, 6);

				if(HDigit1 == 0) { Spawn("HSDigit1Num0", x, y, z, NumberID, 0); }
				else if(HDigit1 == 1) { Spawn("HSDigit1Num1", x, y, z, NumberID, 0); }
				else if(HDigit1 == 2) { Spawn("HSDigit1Num2", x, y, z, NumberID, 0); }
				else if(HDigit1 == 3) { Spawn("HSDigit1Num3", x, y, z, NumberID, 0); }
				else if(HDigit1 == 4) { Spawn("HSDigit1Num4", x, y, z, NumberID, 0); }
				else if(HDigit1 == 5) { Spawn("HSDigit1Num5", x, y, z, NumberID, 0); }
				else if(HDigit1 == 6) { Spawn("HSDigit1Num6", x, y, z, NumberID, 0); }
				else if(HDigit1 == 7) { Spawn("HSDigit1Num7", x, y, z, NumberID, 0); }
				else if(HDigit1 == 8) { Spawn("HSDigit1Num8", x, y, z, NumberID, 0); }
				else if(HDigit1 == 9) { Spawn("HSDigit1Num9", x, y, z, NumberID, 0); }
			
				if(DNewHealth >= 10)
				{
					if(HDigit2 == 0) { Spawn("HSDigit2Num0", x, y, z, NumberID, 0); }
					else if(HDigit2 == 1) { Spawn("HSDigit2Num1", x, y, z, NumberID, 0); }
					else if(HDigit2 == 2) { Spawn("HSDigit2Num2", x, y, z, NumberID, 0); }
					else if(HDigit2 == 3) { Spawn("HSDigit2Num3", x, y, z, NumberID, 0); }
					else if(HDigit2 == 4) { Spawn("HSDigit2Num4", x, y, z, NumberID, 0); }
					else if(HDigit2 == 5) { Spawn("HSDigit2Num5", x, y, z, NumberID, 0); }
					else if(HDigit2 == 6) { Spawn("HSDigit2Num6", x, y, z, NumberID, 0); }
					else if(HDigit2 == 7) { Spawn("HSDigit2Num7", x, y, z, NumberID, 0); }
					else if(HDigit2 == 8) { Spawn("HSDigit2Num8", x, y, z, NumberID, 0); }
					else if(HDigit2 == 9) { Spawn("HSDigit2Num9", x, y, z, NumberID, 0); }
				}
			
				if(DNewHealth >= 100)
				{
					if(HDigit3 == 0) { Spawn("HSDigit3Num0", x, y, z, NumberID, 0); }
					else if(HDigit3 == 1) { Spawn("HSDigit3Num1", x, y, z, NumberID, 0); }
					else if(HDigit3 == 2) { Spawn("HSDigit3Num2", x, y, z, NumberID, 0); }
					else if(HDigit3 == 3) { Spawn("HSDigit3Num3", x, y, z, NumberID, 0); }
					else if(HDigit3 == 4) { Spawn("HSDigit3Num4", x, y, z, NumberID, 0); }
					else if(HDigit3 == 5) { Spawn("HSDigit3Num5", x, y, z, NumberID, 0); }
					else if(HDigit3 == 6) { Spawn("HSDigit3Num6", x, y, z, NumberID, 0); }
					else if(HDigit3 == 7) { Spawn("HSDigit3Num7", x, y, z, NumberID, 0); }
					else if(HDigit3 == 8) { Spawn("HSDigit3Num8", x, y, z, NumberID, 0); }
					else if(HDigit3 == 9) { Spawn("HSDigit3Num9", x, y, z, NumberID, 0); }
				}
			
				if(DNewHealth >= 1000)
				{
					if(HDigit4 == 0) { Spawn("HSDigit4Num0", x, y, z, NumberID, 0); }
					else if(HDigit4 == 1) { Spawn("HSDigit4Num1", x, y, z, NumberID, 0); }
					else if(HDigit4 == 2) { Spawn("HSDigit4Num2", x, y, z, NumberID, 0); }
					else if(HDigit4 == 3) { Spawn("HSDigit4Num3", x, y, z, NumberID, 0); }
					else if(HDigit4 == 4) { Spawn("HSDigit4Num4", x, y, z, NumberID, 0); }
					else if(HDigit4 == 5) { Spawn("HSDigit4Num5", x, y, z, NumberID, 0); }
					else if(HDigit4 == 6) { Spawn("HSDigit4Num6", x, y, z, NumberID, 0); }
					else if(HDigit4 == 7) { Spawn("HSDigit4Num7", x, y, z, NumberID, 0); }
					else if(HDigit4 == 8) { Spawn("HSDigit4Num8", x, y, z, NumberID, 0); }
					else if(HDigit4 == 9) { Spawn("HSDigit4Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 10000)
				{
					if(HDigit5 == 0) { Spawn("HSDigit5Num0", x, y, z, NumberID, 0); }
					else if(HDigit5 == 1) { Spawn("HSDigit5Num1", x, y, z, NumberID, 0); }
					else if(HDigit5 == 2) { Spawn("HSDigit5Num2", x, y, z, NumberID, 0); }
					else if(HDigit5 == 3) { Spawn("HSDigit5Num3", x, y, z, NumberID, 0); }
					else if(HDigit5 == 4) { Spawn("HSDigit5Num4", x, y, z, NumberID, 0); }
					else if(HDigit5 == 5) { Spawn("HSDigit5Num5", x, y, z, NumberID, 0); }
					else if(HDigit5 == 6) { Spawn("HSDigit5Num6", x, y, z, NumberID, 0); }
					else if(HDigit5 == 7) { Spawn("HSDigit5Num7", x, y, z, NumberID, 0); }
					else if(HDigit5 == 8) { Spawn("HSDigit5Num8", x, y, z, NumberID, 0); }
					else if(HDigit5 == 9) { Spawn("HSDigit5Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 100000)
				{
					if(HDigit6 == 0) { Spawn("HSDigit6Num0", x, y, z, NumberID, 0); }
					else if(HDigit6 == 1) { Spawn("HSDigit6Num1", x, y, z, NumberID, 0); }
					else if(HDigit6 == 2) { Spawn("HSDigit6Num2", x, y, z, NumberID, 0); }
					else if(HDigit6 == 3) { Spawn("HSDigit6Num3", x, y, z, NumberID, 0); }
					else if(HDigit6 == 4) { Spawn("HSDigit6Num4", x, y, z, NumberID, 0); }
					else if(HDigit6 == 5) { Spawn("HSDigit6Num5", x, y, z, NumberID, 0); }
					else if(HDigit6 == 6) { Spawn("HSDigit6Num6", x, y, z, NumberID, 0); }
					else if(HDigit6 == 7) { Spawn("HSDigit6Num7", x, y, z, NumberID, 0); }
					else if(HDigit6 == 8) { Spawn("HSDigit6Num8", x, y, z, NumberID, 0); }
					else if(HDigit6 == 9) { Spawn("HSDigit6Num9", x, y, z, NumberID, 0); }
				}
				
				if(DNewHealth >= 1000000)
				{
					if(HDigit7 == 0) { Spawn("HSDigit7Num0", x, y, z, NumberID, 0); }
					else if(HDigit7 == 1) { Spawn("HSDigit7Num1", x, y, z, NumberID, 0); }
					else if(HDigit7 == 2) { Spawn("HSDigit7Num2", x, y, z, NumberID, 0); }
					else if(HDigit7 == 3) { Spawn("HSDigit7Num3", x, y, z, NumberID, 0); }
					else if(HDigit7 == 4) { Spawn("HSDigit7Num4", x, y, z, NumberID, 0); }
					else if(HDigit7 == 5) { Spawn("HSDigit7Num5", x, y, z, NumberID, 0); }
					else if(HDigit7 == 6) { Spawn("HSDigit7Num6", x, y, z, NumberID, 0); }
					else if(HDigit7 == 7) { Spawn("HSDigit7Num7", x, y, z, NumberID, 0); }
					else if(HDigit7 == 8) { Spawn("HSDigit7Num8", x, y, z, NumberID, 0); }
					else if(HDigit7 == 9) { Spawn("HSDigit7Num9", x, y, z, NumberID, 0); }
				}
				
			}
			if(z >= GetActorCeilingZ(0)-10.0)
					SetActorVelocity(NumberID, 0, random((-1.0),(1.0)), -0.5, 0, 0);
				else
					SetActorVelocity(NumberID, 0, random((-1.0),(1.0)), random(0.0,0.5), 0, 0);
		}
	}
}

script 902 RESPAWN
{
	ACS_ExecuteAlways(901,0,0,0,0);
	ACS_ExecuteAlways(WOC_FLOATINGBARS,0,0,0,0);
}

function int GiveXP (int tid, int Exp)
{
	Int Experiance;
	If(Tid == 0)
	{
		Experiance = FixedMul((EXP*1.0) + ((EXP*(CheckInventory("Wisdom")))*0.01), GetCvar("WoC_ExpMult")) >> 16;
		GiveInventory("XP", Experiance);
		GiveInventory("XPTracker", Experiance);
	}
	Else If(Tid)
	{
		Experiance = FixedMul((EXP*1.0) + ((EXP*(CheckActorInventory(tid,"Wisdom")))*0.01), GetCvar("WoC_ExpMult")) >> 16;
		GiveActorInventory(tid, "XP", Experiance);
		GiveActorInventory(tid, "XPTracker", Experiance);
	}
	Return Experiance;
}

script 916 (void)
{
	SetResultValue(CheckInventory("CurrentMaxArmor"));
}


function bool CheckAccessory(int number)
{
	int success;
	If(CheckInventory(AccessoryItemNames[number]) == 1 && (((CheckInventory("AccessoryTypesItem") == number) || (CheckInventory("AccessoryTypes2Item") == number))) )
	Success = TRUE;
	return success;

}

script WOC_ACCESSORYSCRIPT enter
{
	If(((CheckInventory("AccessoryTypesItem")!=0) && (CheckInventory("AccessoryTypes2Item")!=0)) && (CheckInventory("AccessoryTypesItem") == CheckInventory("AccessoryTypes2Item")))
	{
		If(CheckInventory("AccessoryTypes2Item")<ACCESSORY_LIMIT)
		{
			GiveInventory("AccessoryTypes2Item",1);
		}
		else If(CheckInventory("AccessoryTypes2Item")>=ACCESSORY_LIMIT)
		{
			TakeInventory("AccessoryTypes2Item",1);
		}
	}
	int LivingSteelTimer;
	int LichSkullTimer;
	int MaskOfFearTimer;
	While(True)
	{
		If(CheckAccessory(1))
			SetInventory("QuickSilverTreadsTracker",1);
		else
			SetInventory("QuickSilverTreadsTracker",0);
		
		If(CheckAccessory(2))
		{
			SetInventory("LivingSteelAmuletTracker",1);
			LivingSteelTimer++;
			If(LivingSteelTimer >= 35*10)
			{
				If(CheckInventory("armourcount")<20)
				{
					int armorgive = 1;
					while(armorgive>0)
					{
						int randomness = random(0,7);
						if(CheckInventory("ImAFighter"))
							if(CheckInventory(armorcount[randomness])<FighterArmor[randomness])
							{
								GiveInventory(ArmorCount[randomness],1);
								armorgive = 0;
								break;
							}
							else
								randomness = random(0,7);
						if(CheckInventory("ImACleric"))
							if(CheckInventory(armorcount[randomness])<ClericArmor[randomness])
							{
								GiveInventory(ArmorCount[randomness],1);
								armorgive = 0;
								break;
							}
							else
								randomness = random(0,7);
						if(CheckInventory("ImAMage"))
							if(CheckInventory(armorcount[randomness])<MageArmor[randomness])
							{
								GiveInventory(ArmorCount[randomness],1);
								armorgive = 0;
								break;
							}
							else
								randomness = random(0,7);
						if(CheckInventory("ImAHunter"))
							if(CheckInventory(armorcount[randomness])<HunterArmor[randomness])
							{
								GiveInventory(ArmorCount[randomness],1);
								armorgive = 0;
								break;
							}
							else
								randomness = random(0,7);
						if(CheckInventory("ImAWarlock"))
							if(CheckInventory(armorcount[randomness])<NecroArmor[randomness])
							{
								GiveInventory(ArmorCount[randomness],1);
								armorgive = 0;
								break;
							}
							else
								randomness = random(0,7);
						
					}
				}
				LivingSteelTimer = 0;
			}
		}
		else
		{
		SetInventory("LivingSteelAmuletTracker",0);
		LivingSteelTimer = 0;
		}
		
		If(CheckAccessory(3))
		{
			SetInventory("LichSkullTracker",1);
			LichSkullTimer = random(0,24);
			If(LichSkullTimer == 1)
				GiveInventory("LichSkullDrainGiver",1);
		}
		else
		{
			SetInventory("LichSkullTracker",0);
			if(GetActorProperty(0,APROP_Health>0))
				TakeInventory("PowerLichDrain",1);
			LichSkullTimer = 0;
		}
		
		If(CheckAccessory(4))
		{
			SetInventory("MaskOfTerrorTracker",1);
			MaskOfFearTimer = random(0,100);
			If(MaskOfFearTimer == 40 && !CheckInventory("PowerMaskOfTerrorFrightener"))
			{
				GiveInventory("MaskOfTerrorFearGiver",1);
				MaskOfFearTimer = 0;
			}
		}
		else
		{
			SetInventory("MaskOfTerrorTracker",0);
			TakeInventory("PowerMaskOfTerrorFrightener",1);
			MaskOfFearTimer = 0;
		}
		
		If(CheckAccessory(5))
		{
			SetInventory("PolymorphProtectionRuneTracker",1);
			GiveInventory("PolymorphProtectionRuneON",1);
			GiveInventory("PolymorphProtectionRuneGiver",1);
		}
		else
		{
			SetInventory("PolymorphProtectionRuneTracker",0);
			GiveInventory("PolymorphProtectionRuneOFF",1);
			TakeInventory("PowerPolymorphProtectionRune",1);
		}
		
		If(CheckAccessory(6))
		{
			SetInventory("TalismanOfTheDepthsTracker",1);
			GiveInventory("TalismanOfTheDepthsGiver",1);
		}
		else
		{
			SetInventory("TalismanOfTheDepthsTracker",0);
			TakeInventory("PowerTalismanOfTheDepths",1);
		}
		
		If(CheckAccessory(7))
			SetInventory("RingOfFocusTracker",1);
		else
			SetInventory("RingOfFocusTracker",0);
		
		If(CheckAccessory(8))
			SetInventory("CharmOfSpiritTracker",1);
		else
			SetInventory("CharmOfSpiritTracker",0);
		
		If(CheckAccessory(9))
			SetInventory("BracersOfForceTracker",1);
		else
			SetInventory("BracersOfForceTracker",0);
		
		If(CheckAccessory(10))
		{
			SetInventory("CloakOfShadowsTracker",1);
			If(GetActorLightLevel(0)<=100)
				GiveInventory("CloakOfShadowsInvisibility",1);
			else
			{
				TakeInventory("PowerCloakOfShadowsInvisibility",1);
				GiveInventory("CloakOfShadowsClearNoSeek",1);
			}
		}
		else
		{
			SetInventory("CloakOfShadowsTracker",0);
			TakeInventory("PowerCloakOfShadowsInvisibility",1);
		}
		
		If(CheckAccessory(11))
		{
			SetInventory("BloodAmuletTracker",1);
			If(GetActorProperty(0,APROP_Health)<=CheckInventory("CurrentMaxHealth")/2)
				GiveInventory("BloodAmuletDamage",1);
			else
				TakeInventory("PowerBloodAmuletDamage",1);
		}
		else
		{
			SetInventory("BloodAmuletTracker",0);
			TakeInventory("PowerBloodAmuletDamage",1);
		}
		
		If(CheckAccessory(12))
			SetInventory("PhilosopherStoneTracker",1);
		else
			SetInventory("PhilosopherStoneTracker",0);
		
		If(CheckAccessory(13))
			SetInventory("OrbOfClarityTracker",1);
		else
			SetInventory("OrbOfClarityTracker",0);
		
		Delay(1);
		if(GetActorProperty(0,APROP_Health>0))
			TakeInventory("PowerLichDrain",1);
	}
}

script 923 (int SkillSlot) NET
{//Use ability 1
	if(GetActorProperty(0, APROP_HEALTH)>0 && CheckInventory("PowerGlobalCooldown")<1 && CheckInventory("PowerGlobalCooldownShort")<1)
	{
	If(CheckInventory("RingOfFocusTracker"))
	{
	GiveInventory("SpellGlobalCooldownShort",1);
	}
	else
	{
	GiveInventory("SpellGlobalCooldown",1);
	}
	if(CheckInventory("ImAFighter"))
	{//fighter abilities
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_MIGHTYBLOW)
		{
			If(!CheckInventory("MightyBlowing"))
				if(CheckInfo(2+CheckInventory("MightyBlow")/4,"MightyBlow"))
					GiveInventory("MightyBlowing",1);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_STOMP)
		{
			if(CheckInfo(10,"Stomp"))
			{
				ActivatorSound("Fighter/Stomp",127);
				ACS_ExecuteAlways(WOC_CASTSTOMP,0,0,0,0);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_CRITICALSTRIKE)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_WARCRY)
		{
			if(CheckInfo(10,"Warcry"))
				GiveInventory("UseWarCry",1);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_AXEMASTERY)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_BESERK)
		{
			if(CheckInventory("Beserking"))
			{
				Print(s:"Berserk deactivated");
				TakeInventory("Beserking",1);
			}
			else if(CheckInfo(2,"Beserk"))
			{
				Print(s:"Berserk activated");
				ACS_ExecuteAlways(WOC_CASTBERSERK,0,0,0,0);
			}	
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_CONCENTRATION)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_HAMMERMASTERY)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_SWORDMASTERY)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_VENGEANCE)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_CHARGE)
		{
			if(CheckInfo(4,"Charge"))
			{
				GiveInventory("Chargeing",1);
				ACS_ExecuteAlways(WOC_CASTCHARGE,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_HOOKSHOT)
		{
			if(CheckInfo(14,"HookShot"))
			{
				GiveInventory("UseHookShot",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_BLOODRUSH && CheckInventory("PowerBloodRush")<1)
		{
			if(CheckInfo(15+CheckInventory("BloodRush")/2,"BloodRush"))
			{
				GiveInventory("PowerBloodRush",1);
				ActivatorSound("Ability/BloodRush",127);
				ACS_ExecuteAlways(WOC_CASTBLOODRUSH,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_DEFLECTION && CheckInventory("PowerDeflectionIcon")<1)
		{
			If(!CheckInventory("PowerDeflectionIcon"))
				if(CheckInfo(12,"Deflection"))
				{
					ActivatorSound("ability/deflect",127);
					ACS_ExecuteAlways(WOC_CASTDEFLECTION,0,0,0,0);
				}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_BATTLESHOUT)
		{
			if(CheckInfo(10,"BattleShout"))
			{
				ACS_ExecuteAlways(WOC_CASTBATTLESHOUT,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_DEATHBLOW)
		{
			If(!CheckInventory("DeathBlowing"))
				if(CheckInfo(15,"DeathBlow"))
					GiveInventory("DeathBlowing",1);
		}
	}
	else if(CheckInventory("ImACleric"))
	{//Cleric Abilities
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_BLESSING)
		{
			if(CheckInfo(10+CheckInventory("Blessing")/2,"Blessing"))
			{
				Acs_executealways(WOC_CASTBLESSING,0,0,0,0);
				ActivatorSound("ability/blessing",127);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_CURSE)
		{
			if(CheckInfo(5,"Curse"))
			{
				GiveInventory("UseCurse",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_PROTECTAURA)
		{
			if(CheckInventory("IHaveProtect"))
			{
				TakeInventory("IHaveProtect",1);
				Print(s:"Protect Aura Deactivated");
			}
			else if(CheckInfo(0,"ProtectAura"))
			{
				TakeInventory("IHaveFury",1);
				TakeInventory("IHavePreserverance",1);
				GiveInventory("IHaveProtect",1);
				Print(s:"Protect Aura Activated");
				ACS_ExecuteAlways(WOC_CASTPROTECTAURA,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_WRAITHS)
		{
			if(CheckInfo(10,"SummonAncestors"))
			{
				GiveInventory("UseSummonAncestors",1);
				//ACS_ExecuteAlways(WOC_WRAITHSSCRIPT,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_SACRIFICE && CheckInventory("Sacrificeing")<1 && GetActorProperty(0,APROP_Health)>(CheckInventory("CurrentMaxHealth")/(1+CheckInventory("Sacrifice"))))
		{
			if(CheckInfo(10,"Sacrifice"))
			{
				GiveInventory("SacrificeSplash",1);
				ACS_ExecuteAlways(WOC_CASTSACRIFICE,0,0,0,0);
				//SetActorState (0, "Pain");
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_HOLYBOLT)
		{
			if(CheckInfo(12+CheckInventory("HolyBolt"),"HolyBolt"))
			{
				GiveInventory("UseHolyBolt",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_SUMMONLEGEND)
		{
			if(CheckInfo(15,"SummonLegend"))
				ACS_ExecuteAlways(WOC_CASTSUMMONLEGEND,0,0,0,0);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_FURYAURA)
		{
			if(CheckInventory("IHaveFury"))
			{
				TakeInventory("IHaveFury",1);
				Print(s:"Fury Aura Deactivated");
			}
			else if(CheckInfo(0,"FuryAura"))
			{
				TakeInventory("IHavePreserverance",1);
				TakeInventory("IHaveProtect",1);
				GiveInventory("IHaveFury",1);
				Print(s:"Fury Aura Activated");
				ACS_ExecuteAlways(WOC_CASTFURYAURA,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_DIVINELIGHT && CheckInventory("Punishmenting")<1)
		{
			if(CheckInfo(40+CheckInventory("DivineLight")*3/2,"DivineLight"))
			{
				GiveInventory("UseDivineLight",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_VISIONS)
		{
			if(CheckInfo(15,"Visions"))
			{
				GiveInventory("UseVisions",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_BluntMastery)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_HOLYSHIELD && CheckInventory("PowerUseHolyShield")<1)
		{
			if(CheckInfo(7,"HolyShield"))
			{
				GiveInventory("UseHolyShield",1);
				ActivatorSound("holyshield/start",127);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_CONSECRATION && CheckInventory("ConsecrationTimer")<1)
		{
			if(CheckInfo(20+CheckInventory("Consecration"),"Consecration"))
			{
				GiveInventory("ConsecrationTimer",1);
				GiveInventory("UseConsecration",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_RETRIBUTION)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_PRESERVERANCEAURA)
		{
			if(CheckInventory("IHavePreserverance"))
			{
				TakeInventory("IHavePreserverance",1);
				Print(s:"Preserverance Aura Deactivated");
			}
			else if(CheckInfo(0,"PreserveranceAura"))
			{
				TakeInventory("IHaveFury",1);
				TakeInventory("IHaveProtect",1);
				GiveInventory("IHavePreserverance",1);
				Print(s:"Preserverance Aura Activated");
				ACS_ExecuteAlways(WOC_CASTPRESERVERANCEAURA,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_INTERVENTION)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
	}
	else if(CheckInventory("ImAMage"))
	{//Mage Abilities
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_TELEKINESIS)
		{
			if(CheckInfo(4,"Telekinesis"))
				GiveInventory("Teleblast",1);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_FIRETRAP)
		{
			if(CheckInfo(10+CheckInventory("FireTrap"),"FireTrap"))//if(CheckInventory("MP")>=ManaRequired)
			{
				GiveInventory("UseFireTrap",1);
				ActivatorSound("Mage/Firetrap/Summon",127);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_MANACHARGE)
		{
			if(CheckInventory("ManaChargeing"))
			{
				TakeInventory("ManaChargeing",1);
				Print(s:"Mana Charge Deactivated");
			}
			else if(CheckInfo(1,"ManaCharge"))
			{
				ACS_ExecuteAlways(WOC_CASTMANACHARGE,0,0,0,0);
				Print(s:"Mana Charge Activated");
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_ICEBOLT)
		{
			if(CheckInfo(3+(CheckInventory("IceBolt")/2),"IceBolt"))
			{
				GiveInventory("UseIceBolt",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_SPARK)
		{
			if(CheckInfo(5+CheckInventory("MSpark")/2,"MSpark"))
			{
				GiveInventory("Sparking",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_DEEPFREEZE)
		{
			if(CheckInfo(15+CheckInventory("DeepFreeze"),"DeepFreeze"))
			{
				GiveInventory("UseDeepFreeze",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_POLYMORPH)
		{
			if(CheckInfo(15+CheckInventory("PolyMorph"),"PolyMorph"))
			{
				GiveInventory("UsePolyMorph",1);
				ActivatorSound("PigActive1",127);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_FIREBALL)
		{
			if(CheckInfo(7+CheckInventory("MFireBall")/2,"MFireBall"))
			{
				GiveInventory("UseMFireBall",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_METEOR)
		{
			if(CheckInfo(35+CheckInventory("Meteor")*3/2,"Meteor"))
			{
				GiveInventory("UseMeteor",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_ENERGYABSORB)
		{
			if(CheckInventory("EnergyAbsorbing")==100)
				Print(s:"\cjEnergy Absorb Charge Strength is 100/100.");
			else if(CheckInfo(7,"EnergyAbsorb"))
			{
				GiveInventory("EnergyAbsorbing",8+CheckInventory("EnergyAbsorb"));
				Print(s:"\cjEnergy Absorb Charge Strength is now: ", d:CheckInventory("EnergyAbsorbing"), s:"/100");
				ActivatorSound("MageLightningContinuous",127);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_BLIZZARD)
		{
			if(CheckInfo(30+(CheckInventory("Blizzard"))*3/2,"Blizzard"))
			{
				GiveInventory("UseBlizzard",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_THUNDERSTORM)
		{
			if(CheckInventory("Thunderstorming"))
			{
				TakeInventory("Thunderstorming",1);
				Print(s:"Thunderstorm Deactivated");
			}
			else if(CheckInfo(CheckInventory("ThunderStorm")/5+6,"ThunderStorm"))
			{
				GiveInventory("Thunderstorming",1);
				Print(s:"Thunderstorm Activated");
				ACS_ExecuteAlways(WOC_CASTTHUNDERSTORM,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_ARCANEBARRIER)
		{
			if(CheckInfo(GetAmmoCapacity("MP")/4,"ArcaneBarrier"))
				ACS_ExecuteAlways(WOC_CASTARCANEBARRIER,0,0,0,0);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_PILLAROFFLAME)
		{
			if(CheckInfo(70+CheckInventory("PillarOfFlame")*2,"PillarOfFlame"))
			{
				GiveInventory("UsePillarOfFlame",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_ARTICGLACIER && CheckInventory("PowerArticGlacierCooldown")<1)
		{
			if(CheckInfo(60+CheckInventory("ArticGlacier")*2,"ArticGlacier"))
			{
				GiveInventory("UseArticGlacier",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_LIGHTNINGSURGE && CheckInventory("PowerLightningSurgeCounter")<1)
		{
			if(CheckInfo(65+CheckInventory("LightningSurge")*2,"LightningSurge"))
			{
				GiveInventory(LightningSurgeCounter[CheckInventory("LightningSurge")-1],1);
				GiveInventory("UseLightningSurge",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
	}
	else if(CheckInventory("ImAHunter") && CheckInventory("MacheteAttack")<7)
	{//Hunter abilities
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_RANGEDMASTERY)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_MELEEMASTERY)
		{
			//UseInventory("Stomp");
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_BEARTRAP)
		{
			if(CheckInfo(8,"BearTrapSkill"))
				GiveInventory("BearTrapItemLayer",1);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_FIREARROW)
		{
			if(CheckInventory("FireSpellInv"))
				TakeInventory("FireSpellInv",1);
			else if(CheckInfo(0,"FireArrowSkill"))
			{
				TakeInventory("IceSpellInv",1);
				TakeInventory("ThunderSpellInv",1);
				GiveInventory("FireSpellInv",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_PRECISION)
		{
			if(CheckInventory("Precisioning"))
			{
				TakeInventory("Precisioning",1);
				Print(s:"Precision Deactivated");
			}
			else if(CheckInfo(2,"Precision"))
			{
				Print(s:"Precision Activated");
				ACS_ExecuteAlways(WOC_CASTPRECISION,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_INVIGORATION)
		{
			Print(s:"This is a passive ability, it cannot be activated and does not need to be selected to function");
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_SPIKETRAP)
		{
			if(CheckInfo(12,"SpikeTrapSkill"))
				GiveInventory("SpikeTrapItemLayer",1);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_ICEARROW)
		{
			if(CheckInventory("IceSpellInv"))
				TakeInventory("IceSpellInv",1);
			else if(CheckInfo(0,"IceArrowSkill"))
			{
				TakeInventory("FireSpellInv",1);
				TakeInventory("ThunderSpellInv",1);
				GiveInventory("IceSpellInv",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_NOXIOUSTRAP)
		{
			if(CheckInfo(16+CheckInventory("NoxiousTrap"),"NoxiousTrapSkill"))
				GiveInventory("NoxiousTrapItemLayer",1);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_LIGHTNINGARROW)
		{
			if(CheckInventory("ThunderSpellInv"))
				TakeInventory("ThunderSpellInv",1);
			else if(CheckInfo(0,"LightningArrow"))
			{
				TakeInventory("FireSpellInv",1);
				TakeInventory("IceSpellInv",1);
				GiveInventory("ThunderSpellInv",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_TRIPBOMB)
		{
			if(CheckInfo(12+CheckInventory("TripBomb")/2,"TripBomb"))
				GiveInventory("UseTripBomb",1);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_CAMOFLAUGE)
		{
			if(CheckInventory("Stealthing"))
			{
				TakeInventory("Stealthing",1);
				Print(s:"Camoflauge Deactivated");
			}
			else if(CheckInfo(1,"Camoflauge"))
			{
				Print(s:"Camoflauge Activated");
				ACS_ExecuteAlways(WOC_CASTCAMOFLAUGE,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_SPRINT)
		{
			if(CheckInventory("Sprinting"))
			{
				TakeInventory("Sprinting",1);
				Print(s:"Sprint Deactivated");
			}
			else if(CheckInfo(1,"Sprint"))
			{
				Print(s:"Sprint Activated");
				ACS_ExecuteAlways(WOC_CASTSPRINT,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_RAVENCOMPANION)
		{
			if(CheckInventory("RavenCompanionCheck")==0 && CheckInventory("RavenCompanion"))
			{
				If(CheckInventory("MP")>=14)
				{
					ACS_ExecuteAlways(WOC_CASTRAVENCOMPANION,0,0,0,0);
					TakeInventory("MP", 14);
				}
				else
				{
					Print(s:"Not Enough Magick!");
					LocalAmbientSound("misc/invuse",108);
				}
			}
			else if(CheckInventory("RavenCompanionCheck")>0 && CheckInventory("RavenCompanion")>0 && !CheckInventory("NecromancerPetCooldown"))
			{
				GiveInventory("NecromancerPetCooldown",1);
				ACS_ExecuteAlways(WOC_MOVEMINION,0,1,0,0);
				ACS_ExecuteAlways(WOC_MOVEMINION,0,2,0,0);
				ACS_ExecuteAlways(WOC_MOVEMINION,0,3,0,0);
				TakeInventory("PowerGlobalCooldown", 15);
				TakeInventory("PowerGlobalCooldownShort", 10);
			}
			else if(CheckInventory("NecromancerPetCooldown"))
				ACS_ExecuteAlways(WOC_CASTRAVENCOMPANION,0,0,0,0);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_FANOFKNIVES)
		{
			if(CheckInfo(15,"FanOfKnives"))
			{
				GiveInventory("UseFanOfKnives",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_NATURESSALVE)
		{
			if(CheckInfo(14+CheckInventory("NaturesSalve")/2,"NaturesSalve"))
				GiveInventory("NaturesSalveLayer",1);
		}
	}
	else if(CheckInventory("ImaWarlock") && CheckInventory("Metamorphing")<1)
	{
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_ENFEEBLE)
		{
			if(CheckInfo(5,"Enfeeble"))
			{
				GiveInventory("UseEnfeeble",1);
				ActivatorSound("ability/enfeeble",127);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_SUMMONSHADOW)
		{
			if(CheckInventory("NecromancerPetCheck")==0 && CheckInventory("SummonShadow"))
			{
				If(CheckInventory("MP")>=10)
				{
					ACS_ExecuteAlways(WOC_CASTSUMMONSHADOW,0,0,0,0);
					TakeInventory("MP", 10);
				}
				else
				{
					Print(s:"Not Enough Magick!");
					LocalAmbientSound("misc/invuse",108);
				}
			}
			else if(CheckInventory("NecromancerPetCheck")>0 && CheckInventory("SummonShadow")>0 && !CheckInventory("NecromancerPetCooldown"))
			{
				GiveInventory("NecromancerPetCooldown",1);
				ACS_ExecuteAlways(WOC_MOVEMINION,0,1,0,0);
				TakeInventory("PowerGlobalCooldown", 15);
				TakeInventory("PowerGlobalCooldownShort", 10);
			}
			else if(CheckInventory("NecromancerPetCooldown"))
				ACS_ExecuteAlways(WOC_CASTSUMMONSHADOW,0,0,0,0);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_BLIGHT)
		{
			if(CheckInfo(6+CheckInventory("Blight")/2,"Blight"))
			{
				GiveInventory("UseBlight",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_TERRIFY)
		{
			if(CheckInfo(8,"Terrify"))
			{
				GiveInventory("UseTerrify",1);
				ActivatorSound("whiteballbsee",127);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_SUMMONGHOUL)
		{	
			if(CheckInventory("NecromancerPet2Check")==0 && CheckInventory("SummonGhoul"))
			{
				If(CheckInventory("MP")>=20)
				{
					ACS_ExecuteAlways(WOC_CASTSUMMONGHOUL,0,0,0,0);
					TakeInventory("MP", 20);
				}
				else
				{
					Print(s:"Not Enough Magick!");
					LocalAmbientSound("misc/invuse",108);
				}
			}
			else if(CheckInventory("NecromancerPet2Check")>0 && CheckInventory("SummonGhoul")>0 && !CheckInventory("NecromancerPet2Cooldown"))
			{
				GiveInventory("NecromancerPet2Cooldown",1);
				ACS_ExecuteAlways(WOC_MOVEMINION,0,2,0,0);
				TakeInventory("PowerGlobalCooldown", 15);
				TakeInventory("PowerGlobalCooldownShort", 10);
			}
			else if(CheckInventory("NecromancerPet2Cooldown"))
				ACS_ExecuteAlways(WOC_CASTSUMMONGHOUL,0,0,0,0);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_DARKNESS)
		{
			if(CheckInfo(8+CheckInventory("Darkness")/2,"Darkness"))
			{
				GiveInventory("UseDarkness",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_POISONBLAST)
		{
			if(CheckInfo(12+CheckInventory("PoisonBlast"),"PoisonBlast"))
			{
				GiveInventory("UsePoisonBlast",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_CHAOS)
		{
			if(CheckInfo(10,"Chaos"))
			{
				GiveInventory("UseChaos",1);
				ActivatorSound("ability/chaos",127);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_SUMMONREVENANT)
		{
			if(CheckInventory("NecromancerPet3Check")==0 && CheckInventory("SummonRevenant"))
			{
				If(CheckInventory("MP")>=30)
				{
					ACS_ExecuteAlways(WOC_CASTSUMMONREVENANT,0,0,0,0);
					TakeInventory("MP", 30);
				}
				else
				{
					Print(s:"Not Enough Magick!");
					LocalAmbientSound("misc/invuse",108);
				}
			}
			else if(CheckInventory("NecromancerPet3Check")>0 && CheckInventory("SummonRevenant")>0 && !CheckInventory("NecromancerPet3Cooldown"))
			{
				GiveInventory("NecromancerPet3Cooldown",1);
				ACS_ExecuteAlways(WOC_MOVEMINION,0,3,0,0);
				TakeInventory("PowerGlobalCooldown", 15);
				TakeInventory("PowerGlobalCooldownShort", 10);
			}
			else if(CheckInventory("NecromancerPet3Cooldown"))
				ACS_ExecuteAlways(WOC_CASTSUMMONREVENANT,0,0,0,0);
			
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_POISONNOVA)
		{
			if(CheckInfo(15+CheckInventory("PoisonNova"),"PoisonNova"))
			{
				GiveInventory("UsePoisonNova",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_MIASMA)
		{
			If(CheckInventory("Miasmaing"))
			{
				Print(s:"Miasma Dectivated");
				TakeInventory("Miasmaing",1);
			}
			else if(CheckInfo(2,"Miasma"))
			{
				GiveInventory("Miasmaing",1);
				Print(s:"Miasma Activated");
				ACS_ExecuteAlways(WOC_CASTMIASMA,0,0,0,0);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_DRAIN)
		{
			if(CheckInfo(12+CheckInventory("Drain")/2,"Drain"))
			{
				GiveInventory("UseDrain",1);
				ActivatorSound("ability/drain",127);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_SUMMONDEATHKNIGHT)
		{
			if(CheckInventory("NecromancerPet4Check")==0 && CheckInventory("SummonDeathKnight"))
			{
				If(CheckInventory("MP")>=40)
				{
					ACS_ExecuteAlways(WOC_CASTSUMMONDEATHKNIGHT,0,0,0,0);
					TakeInventory("MP", 40);
				}
				else
				{
					Print(s:"Not Enough Magick!");
					LocalAmbientSound("misc/invuse",108);
				}
			}
			else if(CheckInventory("NecromancerPet4Check")>0 && CheckInventory("SummonDeathKnight")>0 && !CheckInventory("NecromancerPet4Cooldown"))
			{
				GiveInventory("NecromancerPet4Cooldown",1);
				ACS_ExecuteAlways(WOC_MOVEMINION,0,4,0,0);
				TakeInventory("PowerGlobalCooldown", 15);
				TakeInventory("PowerGlobalCooldownShort", 10);
			}
			else if(CheckInventory("NecromancerPet4Cooldown"))
				ACS_ExecuteAlways(WOC_CASTSUMMONDEATHKNIGHT,0,0,0,0);
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_BONESHOWER)
		{
			if(CheckInfo(25+CheckInventory("BoneShower")*2,"BoneShower"))
			{
				GiveInventory("UseBoneShower",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_RAISEDEAD)
		{
			if(CheckInfo(25,"RaiseDead"))
			{
				GiveInventory("UseRaiseDead",1);
				GiveInventory("PlayerAlertMonsters",1);
			}
		}
		if(CheckInventory(SlotType[SkillSlot]) == ABIL_METAMORPH && CheckInventory("ImAMorph")<1)
		{
			if(CheckInfo(25,"MetaMorph"))
				ACS_ExecuteAlways(WOC_CASTMETAMORPH,0,0,0,0);
		}
	}
	}
}

script 943 (void)
{
	If (PlayerCount() == 1 && GameType() == GAME_SINGLE_PLAYER)
		SetResultValue(PlayerClass(0)+1);
	else
		SetResultValue(0);
}

script 921 (int PlayerNumb, int Amount)//EXP AMOUNTS
{
	int skilltype0;
	int skilltype1;
	int skilltype2;
	int skilltype3;
	int skilltype4;
	int skilltype5;
	int skilltype6;
	int skilltype7;
	int skilltype8;
	int skilltype9;
	int skilltype10;
	int skilltype11;
	int skilltype12;
	int skilltype13;
	int skilltype14;
	int skilltype15;
	SetActivator(PlayerNumb+PLAYERTID);
	int OldLevel = CheckInventory("Level");
	If(playeringame (PlayerNumber()))
		{
		GiveInventory("Level",Amount);//level up
		SetManaCapacity();
		SetMagickCapacity();
		ActivatorSound("Level/Up", 256);
		If(OldLevel < MAXSKILLPOINTS)
		{
			If(OldLevel + Amount <= MAXSKILLPOINTS)
				GiveInventory("LvlUp",Amount);//level up indicator, for leveling up abilities
			else If(OldLevel + Amount > MAXSKILLPOINTS)
				GiveInventory("LvlUp",MAXSKILLPOINTS-OldLevel);//level up indicator, for leveling up abilities
			if(GetUserCVar(PlayerNumber(),"WoC_RandomSkills"))
			{
			while(CheckInventory("Lvlup"))
			{
				int randomskill = random(0,ABIL_MAX);
				int skilltypegive;
				if(UpgradeSkill(randomskill)==1)
					skilltypegive = randomskill;
				else 
					skilltypegive = 200;
				switch (skilltypegive)
				{
				case 0:
					skilltype0++;
					break;
				case 1:
					skilltype1++;
					break;
				case 2:
					skilltype2++;
					break;
				case 3:
					skilltype3++;
					break;
				case 4:
					skilltype4++;
					break;
				case 5:
					skilltype5++;
					break;
				case 6:
					skilltype6++;
					break;
				case 7:
					skilltype7++;
					break;
				case 8:
					skilltype8++;
					break;
				case 9:
					skilltype9++;
					break;
				case 10:
					skilltype10++;
					break;
				case 11:
					skilltype11++;
					break;
				case 12:
					skilltype12++;
					break;
				case 13:
					skilltype13++;
					break;
				case 14:
					skilltype14++;
					break;
				case 15:
					skilltype15++;
					break;
				}			
			}
			sethudsize (800, 600, 1);
			SetFont("HBARFONT");
			if(CheckInventory("ImAFighter"))
			{
				HudMessage(s:"+",i:skilltype0,s:" ",s:FighterAbilities[0],
				s:"\n+",i:skilltype1,s:" ",s:FighterAbilities[1],
				s:"\n+",i:skilltype2,s:" ",s:FighterAbilities[2],
				s:"\n+",i:skilltype3,s:" ",s:FighterAbilities[3],
				s:"\n+",i:skilltype4,s:" ",s:FighterAbilities[4],
				s:"\n+",i:skilltype5,s:" ",s:FighterAbilities[5],
				s:"\n+",i:skilltype6,s:" ",s:FighterAbilities[6],
				s:"\n+",i:skilltype7,s:" ",s:FighterAbilities[7],
				s:"\n+",i:skilltype8,s:" ",s:FighterAbilities[8],
				s:"\n+",i:skilltype9,s:" ",s:FighterAbilities[9],
				s:"\n+",i:skilltype10,s:" ",s:FighterAbilities[10],
				s:"\n+",i:skilltype11,s:" ",s:FighterAbilities[11],
				s:"\n+",i:skilltype12,s:" ",s:FighterAbilities[12],
				s:"\n+",i:skilltype13,s:" ",s:FighterAbilities[13],
				s:"\n+",i:skilltype14,s:" ",s:FighterAbilities[14],
				s:"\n+",i:skilltype15,s:" ",s:FighterAbilities[15];HUDMSG_FADEOUT, 4002, CR_GOLD, 640.1, 180.1, 10.0);
			}
			else if(CheckInventory("ImACleric"))
			{
				HudMessage(s:"+",i:skilltype0,s:" ",s:ClericAbilities[0],
				s:"\n+",i:skilltype1,s:" ",s:ClericAbilities[1],
				s:"\n+",i:skilltype2,s:" ",s:ClericAbilities[2],
				s:"\n+",i:skilltype3,s:" ",s:ClericAbilities[3],
				s:"\n+",i:skilltype4,s:" ",s:ClericAbilities[4],
				s:"\n+",i:skilltype5,s:" ",s:ClericAbilities[5],
				s:"\n+",i:skilltype6,s:" ",s:ClericAbilities[6],
				s:"\n+",i:skilltype7,s:" ",s:ClericAbilities[7],
				s:"\n+",i:skilltype8,s:" ",s:ClericAbilities[8],
				s:"\n+",i:skilltype9,s:" ",s:ClericAbilities[9],
				s:"\n+",i:skilltype10,s:" ",s:ClericAbilities[10],
				s:"\n+",i:skilltype11,s:" ",s:ClericAbilities[11],
				s:"\n+",i:skilltype12,s:" ",s:ClericAbilities[12],
				s:"\n+",i:skilltype13,s:" ",s:ClericAbilities[13],
				s:"\n+",i:skilltype14,s:" ",s:ClericAbilities[14],
				s:"\n+",i:skilltype15,s:" ",s:ClericAbilities[15];HUDMSG_FADEOUT, 4002, CR_GOLD, 640.1, 180.1, 10.0);
			}
			else if(CheckInventory("ImAMage"))
			{
				HudMessage(s:"+",i:skilltype0,s:" ",s:MageAbilities[0],
				s:"\n+",i:skilltype1,s:" ",s:MageAbilities[1],
				s:"\n+",i:skilltype2,s:" ",s:MageAbilities[2],
				s:"\n+",i:skilltype3,s:" ",s:MageAbilities[3],
				s:"\n+",i:skilltype4,s:" ",s:MageAbilities[4],
				s:"\n+",i:skilltype5,s:" ",s:MageAbilities[5],
				s:"\n+",i:skilltype6,s:" ",s:MageAbilities[6],
				s:"\n+",i:skilltype7,s:" ",s:MageAbilities[7],
				s:"\n+",i:skilltype8,s:" ",s:MageAbilities[8],
				s:"\n+",i:skilltype9,s:" ",s:MageAbilities[9],
				s:"\n+",i:skilltype10,s:" ",s:MageAbilities[10],
				s:"\n+",i:skilltype11,s:" ",s:MageAbilities[11],
				s:"\n+",i:skilltype12,s:" ",s:MageAbilities[12],
				s:"\n+",i:skilltype13,s:" ",s:MageAbilities[13],
				s:"\n+",i:skilltype14,s:" ",s:MageAbilities[14],
				s:"\n+",i:skilltype15,s:" ",s:MageAbilities[15];HUDMSG_FADEOUT, 4002, CR_GOLD, 640.1, 180.1, 10.0);
			}
			else if(CheckInventory("ImAHunter"))
			{
				HudMessage(s:"+",i:skilltype0,s:" ",s:HunterAbilities[0],
				s:"\n+",i:skilltype1,s:" ",s:HunterAbilities[1],
				s:"\n+",i:skilltype2,s:" ",s:HunterAbilities[2],
				s:"\n+",i:skilltype3,s:" ",s:HunterAbilities[3],
				s:"\n+",i:skilltype4,s:" ",s:HunterAbilities[4],
				s:"\n+",i:skilltype5,s:" ",s:HunterAbilities[5],
				s:"\n+",i:skilltype6,s:" ",s:HunterAbilities[6],
				s:"\n+",i:skilltype7,s:" ",s:HunterAbilities[7],
				s:"\n+",i:skilltype8,s:" ",s:HunterAbilities[8],
				s:"\n+",i:skilltype9,s:" ",s:HunterAbilities[9],
				s:"\n+",i:skilltype10,s:" ",s:HunterAbilities[10],
				s:"\n+",i:skilltype11,s:" ",s:HunterAbilities[11],
				s:"\n+",i:skilltype12,s:" ",s:HunterAbilities[12],
				s:"\n+",i:skilltype13,s:" ",s:HunterAbilities[13],
				s:"\n+",i:skilltype14,s:" ",s:HunterAbilities[14],
				s:"\n+",i:skilltype15,s:" ",s:HunterAbilities[15];HUDMSG_FADEOUT, 4002, CR_GOLD, 640.1, 180.1, 10.0);
			}
			else if(CheckInventory("ImAWarlock"))
			{
				HudMessage(s:"+",i:skilltype0,s:" ",s:NecromancerAbilities[0],
				s:"\n+",i:skilltype1,s:" ",s:NecromancerAbilities[1],
				s:"\n+",i:skilltype2,s:" ",s:NecromancerAbilities[2],
				s:"\n+",i:skilltype3,s:" ",s:NecromancerAbilities[3],
				s:"\n+",i:skilltype4,s:" ",s:NecromancerAbilities[4],
				s:"\n+",i:skilltype5,s:" ",s:NecromancerAbilities[5],
				s:"\n+",i:skilltype6,s:" ",s:NecromancerAbilities[6],
				s:"\n+",i:skilltype7,s:" ",s:NecromancerAbilities[7],
				s:"\n+",i:skilltype8,s:" ",s:NecromancerAbilities[8],
				s:"\n+",i:skilltype9,s:" ",s:NecromancerAbilities[9],
				s:"\n+",i:skilltype10,s:" ",s:NecromancerAbilities[10],
				s:"\n+",i:skilltype11,s:" ",s:NecromancerAbilities[11],
				s:"\n+",i:skilltype12,s:" ",s:NecromancerAbilities[12],
				s:"\n+",i:skilltype13,s:" ",s:NecromancerAbilities[13],
				s:"\n+",i:skilltype14,s:" ",s:NecromancerAbilities[14],
				s:"\n+",i:skilltype15,s:" ",s:NecromancerAbilities[15];HUDMSG_FADEOUT, 4002, CR_GOLD, 640.1, 180.1, 10.0);
			}
			sethudsize (0, 0, 1);
			}
		}
		
		GiveInventory("LvlUpPoints",3*Amount);
		
		if(GetUserCVar(PlayerNumber(),"WoC_RandomStats"))
		{
		int strengthcount;
		int agilitycount;
		int constitutioncount;
		int charismacount;
		int wisdomcount;
		int intellectcount;
		for(int I = CheckInventory("LvlUpPoints"); I>0; I--)
		{
		int choosestat = random(0,5);
		switch (choosestat)
		{
		case 0:
			GiveInventory("Strength", 1);
			strengthcount++;
			TakeInventory("LvlUpPoints",1);
			break;
		case 1:
			GiveInventory("Agility", 1);
			agilitycount++;
			TakeInventory("LvlUpPoints",1);
			break;
		case 2:
			GiveInventory("Constitution", 1);
			constitutioncount++;
			SetMaximumHealth();
			if(CheckInventory("ImAFighter")==1 && GetActorProperty(0, APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+6);
			else if(CheckInventory("ImACleric")==1 && GetActorProperty(0, APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+5);
			else if(CheckInventory("ImAMage")==1 && GetActorProperty(0, APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+2);
			else if(CheckInventory("ImAHunter")==1 && GetActorProperty(0, APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+4);
			else if(CheckInventory("ImAWarlock")==1 && GetActorProperty(0, APROP_Health) > 0)
				SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+3);
			TakeInventory("LvlUpPoints",1);
			break;
		
		case 3:
			GiveInventory("Wisdom", 1);
			wisdomcount++;
			TakeInventory("LvlUpPoints",1);
			if(CheckInventory("ImAFighter")==1)
				GiveInventory("MP",2);
			else if(CheckInventory("ImACleric")==1)
				GiveInventory("MP",3);
			else if(CheckInventory("ImAMage")==1)
				GiveInventory("MP",6);
			else if(CheckInventory("ImAHunter")==1)
				GiveInventory("MP",4);
			else if(CheckInventory("ImAWarlock")==1)
				GiveInventory("MP",5);
			break;
		case 4:
			GiveInventory("Intellect", 1);
			intellectcount++;
			TakeInventory("LvlUpPoints",1);
			break;
		case 5:
			GiveInventory("Charisma", 1);
			charismacount++;
			TakeInventory("LvlUpPoints",1);
			break;
			}
		}
		SetFont("HBARFONT");
		sethudsize (800, 600, 1);
		//s:"\n+",i:willpowercount,s:" willpower",
		HudMessage(s:"+",i:strengthcount,s:" strength",
		s:"\n+",i:agilitycount,s:" agility",
		s:"\n+",i:constitutioncount,s:" constitution",
		s:"\n+",i:wisdomcount,s:" wisdom",
		s:"\n+",i:intellectcount,s:" intellect",
		s:"\n+",i:charismacount,s:" charisma";HUDMSG_FADEOUT, 4001, CR_GOLD, 640.1, 60.1, 10.0);
		sethudsize (0, 0, 1);
		/*strengthcount = 0;
		agilitycount = 0;
		constitutioncount = 0;
		willpowercount = 0;
		wisdomcount = 0;
		intellectcount = 0;*/
		}
		SetManaCapacity();
		SetMagickCapacity();
		SetMaximumHealth();
		for(int a = amount; a > 0; a--)
		{
			if(CheckInventory("ImAFighter")==1)
			{
				If(GetActorProperty(0, APROP_Health) > 0)
				{
					GiveInventory("MP",2);
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+6);
				}
			}
			else if(CheckInventory("ImACleric")==1)
			{
				If(GetActorProperty(0, APROP_Health) > 0)
				{
					GiveInventory("MP",3);
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+5);
				}
			}
			else if(CheckInventory("ImAMage")==1)
			{
				If(GetActorProperty(0, APROP_Health) > 0)
				{
					GiveInventory("MP",6);
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+2);
				}
			}
			else if(CheckInventory("ImAHunter")==1)
			{
				If(GetActorProperty(0, APROP_Health) > 0)
				{
					GiveInventory("MP",4);
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+4);
				}
			}
			else if(CheckInventory("ImAWarlock")==1)
			{
				If(GetActorProperty(0, APROP_Health) > 0)
				{
					GiveInventory("MP",5);
					SetActorProperty(0,APROP_Health,GetActorProperty(0,APROP_Health)+3);
				}
			}
		}
		SetXPRequired();
		sethudsize (800, 600, 1);
		SetFont("HBARFONT");
		HudMessageBold (n:0,s:" \cdleveled up to level ", i:CheckInventory("Level");HUDMSG_FADEOUT,966,CR_WHITE, 400.0, 500.0, 10.0);
		SetFont("LargeFont");
		hudmessage (s:"you have reached level ",i:CheckInventory("Level"); HUDMSG_FADEOUT, 966, CR_WHITE, 400.0, 500.0, 10.0);
		//SetFont("SMALLFONT");
		sethudsize (0, 0, 1);
	}
}

//Alchemy Table

int playerMixP[32]; //MixPositions (which potion is selected)
int playerMixD[32]; //MixButton (which mixing menu)
int playerMixT[32][2]; //MixTypes (which potions are going to be mixed)

#define FLASK_NUM 10
#define _M -1 //This will have its value mirrored

/** flask types:
*
*0  FLA1 Green
*1  FLA2 Red
*2  FLA3 Yellow
*3  FLA4 Blue
*4  FLA5 White
*5  FLA6 Black
*6  FLA7 Purple
*7  FLA8 Aqua
*8  FLA9 Coral
*9  FL10 Tan
*10 FL11 Orange
*
**/

str flaskSprites[FLASK_NUM+1] = {
	"FLA1A0", //0
	"FLA2A0", //1
	"FLA3A0", //2
	"FLA4A0", //3
	"FLA5A0", //4
	"FLA6A0", //5
	"FLA7A0", //6
	"FLA8A0", //7
	"FLA9A0", //8
	"FL10A0", //9
	"FL11A0", //10
	};

str flaskNames[FLASK_NUM+1] = {
	"Green", //0
	"Red", //1
	"Yellow", //2
	"Blue", //3
	"White", //4
	"Black", //5
	"Purple", //6
	"Aqua", //7
	"Maroon", //8
	"Tan", //9
	"Orange"}; //10

str flaskTypes[FLASK_NUM+1] = {
	"ArtiGreenFlask", //0
	"ArtiRedFlask", //1
	"ArtiYellowFlask", //2 //0+1=2
	"ArtiBlueFlask", //3
	"ArtiWhiteFlask", //4 3+10=4
	"ArtiBlackFlask", //5 0+6=5
	"ArtiPurpleFlask", //6 7+8=6
	"ArtiAquaFlask", //7 3+4=7
	"ArtiMaroonFlask", //8 1+9=8
	"ArtiTanFlask", //9
	"ArtiOrangeFlask"}; //10 1+2=10

//Flask Type + Flask Type => New Flask Type
int flaskMixes[FLASK_NUM+1][FLASK_NUM+1] = { 
    //   0   1   2   3   4   5   6   7   8   9  10
   //						   
 /*0*/ { 0,  5,  0,  0,  0,  4,  0,  0,  0,  0,  0},
   //						     
 /*1*/ { 5,  0, 10,  6,  0,  4,  0,  0,  0,  8,  0},

 /*2*/ {_M, 10,  0,  0,  0,  4,  5,  0,  0,  0,  0},
   //						       
 /*3*/ {_M,  6,  0,  0,  7,  4,  0,  0,  0,  0,  5},

 /*4*/ {_M, _M, _M,  7,  0,  4,  0,  0,  0,  0,  0},

 /*5*/ { 4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},

 /*6*/ {_M, _M,  5, _M, _M,  4,  0,  0,  0,  0,  0},
   //						      purple
 /*7*/ {_M, _M, _M, _M, _M,  4, _M,  0,  0,  0,  0},

 /*8*/ {_M, _M, _M, _M, _M,  4, _M, _M,  0,  0,  0},

 /*9*/ {_M,  8, _M, _M, _M,  4, _M, _M, _M,  0,  0},

/*10*/ {_M, _M, _M,  5, _M,  4, _M, _M, _M, _M,  0}};

//Chance of Mix working (100 always)
int flaskChance[FLASK_NUM+1][FLASK_NUM+1] = { 
    //   0   1   2   3   4   5   6   7   8   9  10
   //						   
 /*0*/ { 0, 30,  0,  0,  0, 15,  0,  0,  0,  0,  0},
   //						     
 /*1*/ {30,  0, 60, 20,  0, 15,  0,  0,  0, 90,  0},

 /*2*/ {_M, 60,  0, 85,  0, 15, 30,  0,  0,  0,  0},
   //						       
 /*3*/ {_M, 20, 85,  0, 40, 15,  0,  0,  0,  0, 30},

 /*4*/ {_M, _M, _M, 40,  0, 15,  0,  0,  0,  0,  0},

 /*5*/ {15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  15},

 /*6*/ {_M, _M, 30, _M, _M, 15,  0,  0,  0,  0,  0},
   //						      purple
 /*7*/ {_M, _M, _M, _M, _M, 15, _M,  0,  0,  0,  0},

 /*8*/ {_M, _M, _M, _M, _M, 15, _M, _M,  0,  0,  0},

 /*9*/ {_M, 90, _M, _M, _M, 15, _M, _M, _M,  0,  0},

/*10*/ {_M, _M, _M, 30, _M, 15, _M, _M, _M, _M,  0}};

function void DrawMixHud (int pnum, int menu, int flask) //Function for drawing the mixing hud
{
	int x;
	if(menu == 0) x = 360.2;
	if(menu == 1) x = 440.2;

	SetHudSize(800, 600, 0);
	SetFont(flaskSprites[flask]);
	HudMessage(s:"A"; HUDMSG_PLAIN, 20+menu, 0, (x + 16.0), 300.0, 1.0 / 35 + 1);
	SetFont("HBARFONT");
	if(menu == 0) HudMessage(s:"mix: ", s:flaskNames[flask]; HUDMSG_PLAIN, 22+menu, 0, x, 240.0, 1.0 / 35 + 1);
	if(menu == 1) HudMessage(s:"with ", s:flaskNames[flask]; HUDMSG_PLAIN, 22+menu, 0, x, 240.0, 1.0 / 35 + 1);
	SetHudSize(0, 0, 0);
}


script 400 (int type1, int type2) //This script tries to mix the flasks
{
	int success, result, chance;
	chance = flaskChance[type1][type2];

	//find out wether mix worked

	result = random(0,99);

        //result = result << 16; //To fixed point
        //chance = chance << 16; //To fixed point

		result -= (random(0,CheckInventory("Wisdom")+15*(CheckInventory("PhilosopherStoneTracker"))-15));

	if(result < chance && chance > 0) success = TRUE;
	else success = FALSE;

	
	//results of mix
	TakeInventory(flaskTypes[type1], 1);
	TakeInventory(flaskTypes[type2], 1);

	if(success == TRUE && chance > 0)
	{
		int newFlask;

		newFlask = flaskMixes[type1][type2];

		GiveInventory(flaskTypes[newFlask],1);
		GiveInventory("ArtiEmptyFlask",1);
		GiveXP(0, 100-chance);
		print(s:flaskNames[newFlask], s:" Flask Created!");
	}
	if(success == FALSE)
		print(s:"Mix failed!");
}

script WOC_ALCHEMYMIXTEST (int flask1, int flask2) //Check if mix is possible first.
{
	  //TakeInventory("ShowedMenu", 1);
      //TakeInventory("ShowingMenu", 1);
	  //TakeInventory("ShowingStatMenu", 1);
	  //TakeInventory("ShowingSkillMenu", 1);
	//SetPlayerProperty (0, 0, 4);
	int canMix;
	canMix = 1;

	if (flask1 < 0) canMix = 0;
	if (flask2 < 0) canMix = 0;
	if (flask1 > FLASK_NUM) canMix = 0;
	if (flask2 > FLASK_NUM) canMix = 0;
	if ((flask1 == flask2) && (CheckInventory(flaskTypes[flask1]) < 2)) canMix = 0;

	if(CheckInventory(flaskTypes[flask1]) == 0) canMix = 0;
	if(CheckInventory(flaskTypes[flask2]) == 0) canMix = 0;
	
	if(Flask1==20)
	{
		
		int pnum;
		pnum = PlayerNumber();
		
		playerMixD[pnum] = 0;
		playerMixT[pnum][1] = playerMixP[pnum];
		
		terminate;
		
	}
	if(canMix) 
		Acs_ExecuteAlways(400, 0, flask1, flask2, 0);		
	else 
		print(s:"you dont have enough flasks for this mix!");
}

script WoC_ClientCVar (int cvar) CLIENTSIDE
{
	if(cvar==WoC_DamageIndicator)
		SetResultValue(GetUserCVar(consoleplayernumber(),"WoC_DamageIndicator"));
	if(cvar==WoC_GoreLevel)
		SetResultValue(GetUserCVar(consoleplayernumber(),"WoC_GoreLevel"));
	if(cvar==WoC_FloatingHealthBar)
		SetResultValue(GetUserCVar(consoleplayernumber(),"WoC_FloatingHealthBar"));
}

/*script 413 ENTER //Give flask mixing inventory items
{
	int pnum;
	pnum = PlayerNumber();
	playerMixD[pnum] = 0;
	playerMixP[pnum] = 0;
	SetInventory("AlchemyMix",0);
	SetInventory("AlchemyMix2",0);
}

script 414 RETURN //Give flask mixing inventory items
{
	int pnum;
	pnum = PlayerNumber();
	playerMixD[pnum] = 0;
	playerMixP[pnum] = 0;
	SetInventory("AlchemyMix",0);
	SetInventory("AlchemyMix2",0);
}

script 415 OPEN //Mirror flask mixes
{
  for(int i = 0; i < FLASK_NUM+1; i++)
  {
    for(int j = 0; j < FLASK_NUM+1; j++)
    {
      if( flaskMixes[i][j] == _M)
      {
        flaskMixes[i][j] = flaskMixes[j][i];
      }
      if( flaskChance[i][j] == _M)
      {
        flaskChance[i][j] = flaskChance[j][i];
      }
    }
  }
}*/

int EnemyStatPool[60];
int NameTagPool[60];

Script 986 (void)//Enter
{
	int Activators;
	int PlayerN;
	PlayerN = PlayerNumber();
	int ste, agi, con, wis, ine, cha;
	str String1, String2;
	Activators = ActivatorTid();
	While(TRUE)
	{
		SetActivatorToTarget(Activators);
		int mmaxhp = CheckInventory("CurrentMaxHealth");
		int hdisp;
		int monhp = GetActorProperty (0, APROP_Health);
		int monlvl = CheckInventory("Level");
		int isboss = CheckInventory("ImAWhat");
		str monname = Strparam(n:0);
		if(CheckIfPlayer(0) && !CheckInventory("ImAPet"))
		{
			ste = CheckInventory("Strength");
			agi = CheckInventory("Agility");
			con = CheckInventory("Constitution");
			wis = CheckInventory("Wisdom");
			ine = CheckInventory("Intellect");
			cha = CheckInventory("Charisma");
		}
		else
		{
			ste = 0;
			agi = 0;
			con = 0;
			wis = 0;
			ine = 0;
			cha = 0;
		}
		int healthbarcolor;
		If(CheckInventory("EnemyInDisguise")==0 && CheckActorProperty(0, APROP_Friendly, 0) || CheckInventory("FriendlyInDisguise")>0 )
			healthbarcolor=1;
		else If(CheckActorProperty(0, APROP_Friendly, 1) || CheckInventory("EnemyInDisguise")>0)
			healthbarcolor=0;
		If(ActivatorTID() == Activators)//CheckInventory("ImAFighter") != 1 && Checkinventory("ImACleric") != 1 && Checkinventory("ImAMage") != 1 && Checkinventory("ImAHunter") != 1)
		{
			SetInventory("TargetMaximumHealth", 0);
			SetInventory("TargetCurrentHealth", 0);
			SetInventory("TargetLevel",0);
			SetInventory("TargetIsWhat",0);
			SetInventory("TargetHP",0);
			SetInventory("TargetHPPercent",0);
			SetInventory("TargetStrength",0);
			SetInventory("TargetAgility",0);
			SetInventory("TargetConstitution",0);
			SetInventory("TargetWisdom",0);
			SetInventory("TargetIntellect",0);
			//Delay(1);
		}
		else
		{
			String1 = Strparam(s:"Lvl: ",i:monlvl,s:"  ",i:monhp,s:"/",i:mmaxhp);
			String2 = GetActorProperty(0, APROP_NameTag);

			if(CheckIfPlayer(0))
				String2 = Strparam(n:0);
			if(isboss)
				String1 = Strparam(s:"Boss:  ",i:monhp,s:"/",i:mmaxhp);
			
			SetActivator(Activators);
			SetAmmoCapacity("TargetHP",mmaxhp);
			If(!GetUserCVar(PlayerN,"WoC_EnemyHealthBar"))
				MmaxHP = 0;
			SetInventory("TargetMaximumHealth", mmaxhp);
			
			SetInventory("TargetCurrentHealth", monhp);
			SetInventory("TargetHealthBarColor",healthbarcolor);
			SetInventory("TargetLevel",monlvl);
			SetInventory("TargetIsWhat",isboss);
			If(MmaxHP>0)
			{
				SetInventory("TargetHP",monhp);
				SetInventory("TargetHPPercent",monhp*100/mmaxhp);
			}
			SetInventory("TargetStrength",ste);
			SetInventory("TargetAgility",agi);
			SetInventory("TargetConstitution",con);
			SetInventory("TargetWisdom",wis);
			SetInventory("TargetIntellect",ine);
			SetInventory("TargetCharisma",cha);
			SetCVarString(Strparam(s:"WOC_HEALTHNUMBERS",i:PlayerN), String1);
			SetCVarString(Strparam(s:"WOC_NAMETAGS",i:PlayerN), String2);
			
		}
		delay(1);
	}
}



script WOC_READENEMYVALUES (Int Which, int PlayerN) clientside
{
	If(Which == 0)
		EnemyStatPool[PlayerN] = GetCVarString("WOC_HEALTHNUMBERS");
	If(Which == 1)
		NameTagPool[PlayerN] = GetCVarString("WOC_NAMETAGS");
}

Script 989 Enter Clientside //Constant Clientside scripts
{
	//Visible Floating Health Bars
	If(GetUserCVar(consoleplayernumber(),"WoC_FloatingHealthBar") == 1)
		SetActorProperty(ActivatorTID()+HPBARID, APROP_Renderstyle, STYLE_Translucent);
	Else If(GetUserCVar(consoleplayernumber(),"WoC_FloatingHealthBar") == 0)
		SetActorProperty(ActivatorTID()+HPBARID, APROP_Renderstyle, 0);
		
	SetActorProperty(ConsolePlayerNumber()+PLAYERTID+HPBARID, APROP_Renderstyle, 0);
	
	If(ConsolePlayerNumber() != 0 && GetUserCVar(consoleplayernumber(),"WoC_FloatingHealthBar") == 0)
		SetActorProperty(HPBARID+PLAYERTID, APROP_Renderstyle, 0);
	Else If(ConsolePlayerNumber() != 0 && GetUserCVar(consoleplayernumber(),"WoC_FloatingHealthBar") == 1)
		SetActorProperty(HPBARID+PLAYERTID, APROP_Renderstyle, STYLE_Translucent);
	
	int mmaxhp, height, width, hp, DNewHealth;
	mmaxhp = CheckInventory("TargetHP");
	hp = GetActorProperty(0,APROP_Health);
	//Target Health Bars
	if(GetCVAR("hud_scale")==0)
	{
		height = GetCVar("vid_defheight");
		width = GetCVar("vid_defwidth");
	}
	else
	{
		height = 400;
		width = 640;
	}
	if(CheckInventory("LvlUp"))
	{
		SetFont("LargeFont");
		sethudsize (800, 600, 1);
		HudMessage(s:"Select a skill to level up";HUDMSG_PLAIN, 899, CR_GOLD, 700.0, 90.0, 1.0 / 35 + 1);
		sethudsize (0, 0, 1);
	}
	if(CheckInventory("LvlUpPoints"))
	{
		SetFont("LargeFont");
		sethudsize (800, 600, 1);
		HudMessage(s:"Select a stat to level up";HUDMSG_PLAIN, 965, CR_GOLD, 700.0, 60.0, 1.0 / 35 + 1);
		sethudsize (0, 0, 1);
	}
	If(CheckInventory("TargetMaximumHealth"))
	{
		If(GameType() == GAME_SINGLE_PLAYER)
			Delay(1);
		SetHudSize (width, height,0);
		SetFont ("HBARFONT");
		if(GetCVAR("hud_scale")==0)
		{
			HudMessage (s:GetCVarString(StrParam(s:"WOC_HEALTHNUMBERS",i:ConsolePlayerNumber())); 0, 999, CR_WHITE, 1.0*(width/2), 47.1, 1.0 / 35 + 1);
			HudMessage (s:GetCVarString(StrParam(s:"WOC_NAMETAGS",i:ConsolePlayerNumber())); 0, 998, CR_WHITE, 1.0*(width/2), 62.1, 1.0 / 35 + 1);
			If(CheckInventory("TargetStrength"))
			HudMessage (s:"\nStr: ",d:CheckInventory("TargetStrength"),s:"  Agi: ",d:CheckInventory("TargetAgility"),s:"  Con: ", d:CheckInventory("TargetConstitution"),
			s:"\nWis: ",d:CheckInventory("TargetWisdom"),s:"  Int: ",d:CheckInventory("TargetIntellect"),s:"  Cha: ", d:CheckInventory("TargetCharisma"); 0, 997, CR_WHITE, 1.0*(width/2), 62.1, 1.0 / 35 + 1);
		}
		else
		{
			HudMessage (s:GetCVarString(StrParam(s:"WOC_HEALTHNUMBERS",i:ConsolePlayerNumber())); 0, 999, CR_WHITE, 1.0*(width/2), 33.1, 1.0 / 35 + 1);
			HudMessage (s:GetCVarString(StrParam(s:"WOC_NAMETAGS",i:ConsolePlayerNumber())); 0, 998, CR_WHITE, 1.0*(width/2), 47.1, 1.0 / 35 + 1);
			If(CheckInventory("TargetStrength"))
			HudMessage (s:"\nStr: ",d:CheckInventory("TargetStrength"),s:"  Agi: ",d:CheckInventory("TargetAgility"),s:"  Con: ", d:CheckInventory("TargetConstitution"),
			s:"\nWis: ",d:CheckInventory("TargetWisdom"),s:"  Int: ",d:CheckInventory("TargetIntellect"),s:"  Cha: ", d:CheckInventory("TargetCharisma"); 0, 997, CR_WHITE, 1.0*(width/2), 47.1, 1.0 / 35 + 1);
		}
		If(GameType() != GAME_SINGLE_PLAYER)
			Delay(1);
	}
	else
		Delay (1);
	
	DNewHealth = (hp - GetActorProperty(0,APROP_Health));
	If(CheckInventory("CurrentMaxHealth"))
	{
		If(DNewHealth>0)
		{
			SetHudSize (width, height,0);
			SetFont("HBARFONT");
			HudMessage(i:-DNewHealth,s:" (",f:-((DNewHealth*100.0)/(CheckInventory("CurrentMaxHealth"))),s:"%)";HUDMSG_FADEOUT, 6100, CR_RED,1.0*(width/2),1.0*(height*9/10),0.0,0.75);
		}
		else If(DNewHealth<0)
		{
			DNewHealth *= (-1);
			SetHudSize (width, height,0);
			SetFont("HBARFONT");
			HudMessage(s:"+",i:DNewHealth,s:" (+",f:(DNewHealth*100.0)/(CheckInventory("CurrentMaxHealth")),s:"%)";HUDMSG_FADEOUT, 6101, CR_GREEN,1.0*(width/2),1.0*(height*9/10),0.0,0.75);
		}
	}
	Restart;
}

script 904 (int gone) DISCONNECT
{
	Thing_Remove(PET1TID+gone);
	Thing_Remove(PET2TID+gone);
	Thing_Remove(PET3TID+gone);
	Thing_Remove(PET4TID+gone);
	Thing_Remove(HPBARID+PLAYERTID+gone);
}

script 924 (void) NET CLIENTSIDE
{
Log(s:"FROM 2B TO 2C.");
Log(s:"========================");
Log(s:"\caMajor Changes:");
Log(s:"* Added CVar WoC_ExpMult, multiplying any XP gain by the CVar.");
Log(s:"* Path system added, each class is given 3 paths to choose from at level 15 that enhances certain playstyles.");
Log(s:"* Scroll of Reversion added which refunds all stat and skill points spent and unsets the path chosen.");
Log(s:"\caClasses:");
Log(s:"\cd- Fighter");
Log(s:"* The Fighter is given the Destroyer, Vanguard, and Commander paths.");
Log(s:"* Battle Shout can no longer affect allies through walls.");
Log(s:"\ch- Cleric");
Log(s:"* The Cleric is given the Purifier, Oracle, and Inquisitor paths.");
Log(s:"* Blessing, Holy Bolt, Protect Aura, Perserverance Aura, and Fury Aura can no longer affect allies through walls.");
Log(s:"\cg- Mage");
Log(s:"* The Mage is given the Pyro, Iceborn, and Archon paths.");
Log(s:"* Mana Charge can no longer affect allies through walls.");
Log(s:"\cf- Hunter");
Log(s:"* The Hunter is given the Marksman, Duelist, and Survivalist paths.");
Log(s:"* Nature's Salve now heals based on the Hunter's wisdom, instead of the maximum health of whoever picks it up.");
Log(s:"\ct- Necromancer");
Log(s:"* The Necromancer is given the Plaguebringer, Harvester, and Conjuror paths.");
Log(s:"* Enfeeble now longer stacks with different ranks.");
Log(s:"* Enfeeble, Terrify, Chaos, and Lifetap are now projectiles.");
Log(s:"* Life Tap can no longer heal allies through walls.");
Log(s:"* Summons will now alert monsters upon attacking.");
Log(s:"\caMisc:");
Log(s:"* Some code optimizations.");
Log(s:"* Bosses will now look all around.");
Log(s:"* The Mystic Ambit Incant can no longer affect allies through walls.");
Log(s:"* Menus scrolling can now loop around.");
Log(s:"* Monster health increase per player increased from 10% to 20%.");
}

script 925 (int PlayerN) NET
{
	int ManaCapacity, MagickCapacity;
	int WhichPlayer = PLAYERTID + PlayerN;
	if(CheckActorInventory(WhichPlayer, "ImAFighter"))
	{
		ManaCapacity = (50+2*CheckActorInventory(WhichPlayer, "Intellect")+(CheckActorInventory(WhichPlayer, "Level")*2));
		MagickCapacity = (10+2*CheckActorInventory(WhichPlayer, "Intellect")+(CheckActorInventory(WhichPlayer, "Level")*2));
	}
	else if(CheckActorInventory(WhichPlayer, "ImACleric"))
	{
		ManaCapacity = (50+3*CheckActorInventory(WhichPlayer, "Intellect")+(CheckActorInventory(WhichPlayer, "Level")*3));
		MagickCapacity = (10+3*CheckActorInventory(WhichPlayer, "Intellect")+(CheckActorInventory(WhichPlayer, "Level")*3));
	}
	else if(CheckActorInventory(WhichPlayer, "ImAMage"))
	{
		ManaCapacity = (50+6*CheckActorInventory(WhichPlayer, "Intellect")+(CheckActorInventory(WhichPlayer, "Level")*6));
		MagickCapacity = (10+6*CheckActorInventory(WhichPlayer, "Intellect")+(CheckActorInventory(WhichPlayer, "Level")*6));
	}
	else if(CheckActorInventory(WhichPlayer, "ImAHunter"))
	{
		ManaCapacity = (50+4*CheckActorInventory(WhichPlayer, "Intellect")+(CheckActorInventory(WhichPlayer, "Level")*4));
		MagickCapacity = (10+4*CheckActorInventory(WhichPlayer, "Intellect")+(CheckActorInventory(WhichPlayer, "Level")*4));
	}
	else if(CheckActorInventory(WhichPlayer, "ImAWarlock"))
	{
		ManaCapacity = (50+5*CheckActorInventory(WhichPlayer, "Intellect")+(CheckActorInventory(WhichPlayer, "Level")*5));
		MagickCapacity = (10+5*CheckActorInventory(WhichPlayer, "Intellect")+(CheckActorInventory(WhichPlayer, "Level")*5));
	}
	SetHudSize(800,600,0);
	SetFont("HBARFONT");
	HudMessage(n:PlayerN,
			   s:"\nLevel: ", d:CheckActorInventory(WhichPlayer, "Level"),
			   s:"\nHealth: ", d:GetActorProperty(WhichPlayer, APROP_Health), s:"/", d:CheckActorInventory(WhichPlayer, "CurrentMaxHealth"),
			   s:"\nMana: \ch", d:CheckActorInventory(WhichPlayer, "Mana1"), s:"\cd/", d:CheckActorInventory(WhichPlayer, "Mana2"), s:"\cl (", d:ManaCapacity, s:")",
			   s:"\nMana: ", d:CheckActorInventory(WhichPlayer, "MP"), s:"/", d:MagickCapacity,
			   s:"\nStrength: ", d:CheckActorInventory(WhichPlayer, "Strength"),
			   s:"\nAgility: ", d:CheckActorInventory(WhichPlayer, "Agility"),
			   s:"\nConstitution: ", d:CheckActorInventory(WhichPlayer, "Constitution"),
			   s:"\nWisdom: ", d:CheckActorInventory(WhichPlayer, "Wisdom"),
			   s:"\nIntellect: ", d:CheckActorInventory(WhichPlayer, "Intellect");
			   HUDMSG_PLAIN, 3499, CR_WHITE,
			   640.1, 150.1, 10.0);
}

#DEFINE SHOPCATEGORIES 6
#DEFINE SHOPITEMS 100
#DEFINE SHOPVALUES 2

#DEFINE MANAITEMCOUNT 3
#DEFINE ARMOURITEMCOUNT 8
#DEFINE POTIONITEMCOUNT 4
#DEFINE ARTIFACTITEMCOUNT 16
#DEFINE ACCESSORYITEMCOUNT2 13
#DEFINE FLASKITEMCOUNT 12

int ShopNamesLimit [SHOPCATEGORIES] =
{
	MANAITEMCOUNT,
	ARMOURITEMCOUNT,
	POTIONITEMCOUNT,
	ARTIFACTITEMCOUNT,
	ACCESSORYITEMCOUNT2,
	FLASKITEMCOUNT,
};

str ShopNames [SHOPCATEGORIES] =
{
	"Mana",
	"Armour",
	"Potions",
	"Artifacts",
	"Accessories",
	"Flasks",
};



str ShopStrings [SHOPCATEGORIES][SHOPITEMS][SHOPVALUES]  =
{
	//Mana
	{
		{ "Mana1", "Blue Mana" },
		{ "Mana2", "Green Mana" },
		{ "Mana3", "Combined Mana" },
	},
					   
	//Armour
	{
		{ "Armour1", "Mesh Armor" },
		{ "Armour2", "Falcon Shield" },
		{ "Armour3", "Platinum Helmet" },
		{ "Armour4", "Amulet of Warding" },
		{ "Armour5", "Dragonskin Bracers" },
		{ "Armour6", "Elven Boots" },
		{ "Armour7", "Leather Greaves" },
		{ "Armour8", "Ring of Protection" },
	},
							 
	//Potions
	{
		{ "PurplePotionVial", "Minor Quartz Potion" },
		{ "PurplePotionPentagon", "Quartz Potion" },
		{ "PurplePotionHexagon", "Major Quartz Potion" },
		{ "PurplePotionRound", "Supreme Quartz Potion" },
	},

	//Artifacts
	{
		{ "NewArtiSuperHealth", "Mystic Urn" },
		{ "NewArtiHealingRadius", "Mystic Ambit Incant" },
		{ "NewArtiTeleport", "Chaos Device" },
		{ "NewArtiPork", "Porkalator" },
		{ "NewArtiEgg", "Morph Ovum" },
		{ "NewArtiInvisibility", "Shadowsphere" },
		{ "NewArtiSpeedBoots", "Boots of Speed" },
		{ "ForceCube", "Force Cube" },
		{ "NewArtiDarkServant", "Dark Servant" },
		{ "NewArtiBlastRadius", "Disc of Repulsion" },
		{ "NewArtiBoostMana", "Krater of Might" },
		{ "NewArtiInvulnerability2", "Icon of Defender" },
		{ "NewArtiTorch", "Torch" }, 
		{ "AntiRadiationBoots", "Anti Radiation Boots" },
		{ "MapScroll", "Map Scroll" },
		{ "ScrollOfReversion", "Scroll of Reversion" },
	},

	//Accessories
	{
		{ "QuickSilverTreadsItem", "Quick Silver Treads" },
		{ "LivingSteelAmuletItem", "Living Steel Amulet" },
		{ "LichSkullItem", "Lich Skull" },
		{ "MaskOfTerrorItem", "Mask of Terror" },
		{ "PolymorphProtectionRuneItem", "Polymorph Protection Rune" },
		{ "TalismanOfTheDepthsItem", "Talisman of the Depths" },
		{ "RingOfFocusItem", "Ring of Focus" },
		{ "CharmOfSpiritItem", "Charm of Spirit" },
		{ "BracersOfForceItem", "Bracers of Force" },
		{ "CloakOfShadowsItem", "Cloak of Shadows" },
		{ "BloodAmuletItem", "Blood Amulet" },
		{ "PhilosopherStoneItem", "Philosopher Stone" },
		{ "OrbOfClarityItem", "Orb of Clarity" },
	},

	//Flasks
	{
		{ "ArtiEmptyFlask", "Empty Flask" },
		{ "ArtiGreenFlask", "Green Flask" }, //0
		{ "ArtiRedFlask", "Red Flask" }, //1
		{ "ArtiYellowFlask", "Yellow Flask" }, //2
		{ "ArtiBlueFlask", "Blue Flask" }, //3
		{ "ArtiWhiteFlask", "White Flask" },
		{ "ArtiBlackFlask", "Black Flask" },
		{ "ArtiPurpleFlask", "Purple Flask" },
		{ "ArtiAquaFlask", "Aqua Flask" },
		{ "ArtiMaroonFlask", "Maroon Flask" },
		{ "ArtiTanFlask", "Tan Flask" },
		{ "ArtiOrangeFlask", "Orange Flask" },
	},
};

str ShopDescription [SHOPCATEGORIES][SHOPITEMS]  =
{
	//Mana
	{
		 "Blue Mana: Restores blue mana.",
		 "Green Mana: Restores green mana.",
		 "Combined Mana: Restores blue and green mana.",
	},
					   
	//Armour
	{
		 "Mesh Armor\nFighter: Grants 25 armor.\nCleric: Grants 20 armor.\nMage: Grants 5 armor.\nHunter: Grants 15 armor.\nNecromancer: Grants 10 armor.",
		 "Falcon Shield\nFighter: Grants 20 armor.\nCleric: Grants 25 armor.\nMage: Grants 10 armor.\nHunter: Grants 15 armor.\nNecromancer: Grants 5 armor.",
		 "Platinum Helmet\nFighter: Grants 25 armor.\nCleric: Grants 20 armor.\nMage: Grants 5 armor.\nHunter: Grants 10 armor.\nNecromancer: Grants 15 armor.",
		 "Amulet of Warding\nFighter: Grants 5 armor.\nCleric: Grants 15 armor.\nMage: Grants 25 armor.\nHunter: Grants 10 armor.\nNecromancer: Grants 20 armor.",
		 "Dragonskin Bracers\nFighter: Grants 25 armor.\nCleric: Grants 5 armor.\nMage: Grants 10 armor.\nHunter: Grants 20 armor.\nNecromancer: Grants 15 armor.",
		 "Elven Boots\nFighter: Grants 15 armor.\nCleric: Grants 10 armor.\nMage: Grants 20 armor.\nHunter: Grants 25 armor.\nNecromancer: Grants 5 armor.",
		 "Leather Greaves\nFighter: Grants 15 armor.\nCleric: Grants 20 armor.\nMage: Grants 5 armor.\nHunter: Grants 25 armor.\nNecromancer: Grants 10 armor.",
		 "Ring of Protection\nFighter: Grants 10 armor.\nCleric: Grants 15 armor.\nMage: Grants 20 armor.\nHunter: Grants 5 armor.\nNecromancer: Grants 25 armor.",
	},
							 
	//Potions
	{
		 "Minor Quartz Potion: Restores 10% of your health.",
		 "Quartz Potion: Restores 25% of your health.",
		 "Major Quartz Potion: Restores 33% of your health.",
		 "Supreme Quartz Potion: Restores 50% of your health.",
	},

	//Artifacts
	{
		 "Mystic Urn: Restores all of your Health.",
		 "Mystic Ambit Incant\nFighter: Grants armor to you and nearby allies.\nCleric: Heals you and nearby allies.\nMage: Grants mana and magick to you and nearby allies.\nHunter: Grants a speed boost to you and nearby allies for 30 seconds.\nNecromancer: Enemy monsters become frightened by you and nearby allies for 30 seconds.",
		 "Chaos Device: Teleports you to the start of the map.",
		 "Porkalator: Fires 5 projectiles that turn all but the strongest monsters into pigs.",
		 "Morph Ovum: Fires 5 projectiles that turn all but the strongest monsters into chickens.",
		 "Shadowsphere: Become invisible and immune to physical projectiles for one minute.",
		 "Boots of Speed: Increase your movement speed by 50% for 45 seconds.",
		 "Force Cube: Summons a cube that fires lasers at nearby enemies for one minute.",
		 "Dark Servant: Summons a friendly maulotaur.",
		 "Disc of Repulsion: Deflects nearby projectiles and monsters away from you.",
		 "Krater of Might: Restores all of your blue mana, green mana, and Magick.",
		 "Icon of Defender: Become invulnerable for 30 seconds.",
		 "Torch: Illuminates the area for two minutes.",
		 "Anti Radiation Boots: Become immune to radioactive floor damage for one minute.",
		 "Map Scroll: Fully reveals the current map.",
		 "Scroll of Reversion: Refunds all skill and stat points spent and unsets your path.",
	},

	//Accessories
	{
		"QuickSilver Treads: Increases your movement speed and jump height by 20%.",
		"Living Steel Amulet: You regenerate a point of Armor every 10 seconds, up to 20 points.",
		"Lich Skull: Your attacks have a chance to restore health equal to 50% of the damage dealt.",
		"Mask of Terror: You cause monsters to run away from you in fear in random intervals.",
		"Polymorph Protection Rune: You become immune to polymorph effects and reduces all damage by 10%.",
		"Talisman of the Depths: You can breathe endlessly underwater and reduce ice damage taken by 25%.",
		"Ring Of Focus: Reduces the delay between spells by 10 tics.",
		"Charm of Spirit: Increases your health and magick regeneration by 50%.",
		"Bracers of Force: Every 10 seconds, your weapon fires an extra magical projectile.",
		"Cloak of Shadows: You become invisible and ghostlike in low light areas.",
		"Blood Amulet: Increases your damage by 50% when below 50% health.",
		"Philosopher's Stone: Increases success rate of alchemy, increases health gained from potions by 50%, and increases damage of flasks by 25%.",
		"Orb Of Clarity: Killing monsters grants you a chance to restore your mana.",
	},

	//Flasks
	{
		 "Empty Flask: Fill these up with reagents.",
		 "Green Flask: Creates a lingering gas cloud.",
		 "Red Flask: Sets a bomb that detonates shortly after.",
		 "Yellow Flask: Throws an explosive grenade.",
		 "Blue Flask: Creates a cloud that rains down ice shards.",
		 "White Flask: Creates a cloud that solidifies and blocks projectiles.",
		 "Black Flask: Creates a cloud that summons a friendly Knight Archer.",
		 "Purple Flask: Creates a cloud that shoots out magical shots all around it.",
		 "Aqua Flask: Throws a grenade that explodes to create damaging water.",
		 "Maroon Flask: Sets a bomb that can be shot at.",
		 "Tan Flask: Throws a flask that shatters into several shards.",
		 "Orange Flask: Throws a grenade that creates a ring of fireballs.",
	},
};

int ShopCosts [SHOPCATEGORIES][SHOPITEMS]  =
{
	//Mana
	{
		25,
		25,
		50,
	},
	
	//Armour
	{
		100,
		100,
		100,
		100,
		100,
		100,
		100,
		100,
	},
	
	//Potions
	{
		20,
		30,
		50,
		75,
	},
	
	//Artifacts
	{
		100,
		100,
		100,
		400,
		400,
		100,
		100,
		500,
		1000,
		25,
		500,
		1500,
		75, 
		100,
		200,
		5000,
	},
	
	//Accessories
	{
		5000,
		5000,
		5000,
		5000,
		5000,
		5000,
		5000,
		5000,
		5000,
		5000,
		5000,
		5000,
		5000,
	},
	
	//Flasks
	{
		25,
		50,
		50,
		50,
		50,
		200,
		200,
		125,
		300,
		125,
		50,
		125,
	},
};

Script WOC_SHOPSTART (void)
{
	If(!CheckInventory("ShowedMenu") && !CheckInventory("InShop"))
	{
		GiveInventory("InShop", 1);
		SetPlayerProperty (0, 1, 4);
		Thing_Stop(0);
		ACS_ExecuteAlways(WOC_SHOPMENU,0,0,0,0);
		ACS_ExecuteAlways(WOC_SHOPMENUTEXT,0,0,0,0);
	}
}

Script WOC_SHOPMENU (void)
{
	int ShopCategory = 0;
	int ShopPage = 0; //Left-Right
	int ShopItem = 0; //Up-Down
	int Cost = 0;
	int buttons;
	int oldbuttons;
	int MenuSelect;
	while(CheckInventory("InShop"))
	{
		buttons = GetPlayerInput (-1, INPUT_BUTTONS);
		oldbuttons = GetPlayerInput (-1, INPUT_OLDBUTTONS);
		if (buttons & BT_FORWARD && !(OldButtons & BT_FORWARD))
		{
			If(ShopPage==0 && ShopCategory>0)
				ShopCategory--;
			If(ShopPage==1 && ShopItem>0)
				ShopItem--;
		}
		if (buttons & BT_BACK && !(OldButtons & BT_BACK))
		{
			If(ShopPage==0 && ShopCategory < SHOPCATEGORIES-1)
				ShopCategory++;
			If(ShopPage==1 && ShopItem < ShopNamesLimit[ShopCategory]-1)
				ShopItem++;
		}
		if (buttons & BT_MOVERIGHT && !(OldButtons & BT_MOVERIGHT))
		{
			If(ShopPage<1)
			{
				ShopPage++;
				ShopItem=0;
			}
		}
		if (buttons & BT_MOVELEFT && !(OldButtons & BT_MOVELEFT))
		{
			If(ShopPage==0)
			{
				TakeInventory("InShop",1);
				SetPlayerProperty (0, 0, 4);
			}
			If(ShopPage>0)
			{
				ShopPage=0;
				ShopItem=0;
			}
		}
		
		if (buttons & BT_USE && !(OldButtons & BT_USE) && (ShopPage == 1))
		{
			Cost = ShopCosts[ShopCategory][ShopItem]-CheckInventory("Charisma")*2+20;
			If(Cost < ShopCosts[ShopCategory][ShopItem]/2)
				Cost = ShopCosts[ShopCategory][ShopItem]/2;
			BuyItem(ShopStrings[ShopCategory][ShopItem][0], Cost);
		}
		if (buttons & BT_ATTACK && !(OldButtons & BT_ATTACK) && (ShopPage == 1))
		{
			Cost = ShopCosts[ShopCategory][ShopItem]/4+CheckInventory("Charisma")-10;
			If(Cost > ShopCosts[ShopCategory][ShopItem]/2)
				Cost = ShopCosts[ShopCategory][ShopItem]/2;
			SellItem(ShopStrings[ShopCategory][ShopItem][0], Cost, 0);
		}
		if (buttons & BT_ALTATTACK && !(OldButtons & BT_ALTATTACK) && (ShopPage == 1))
		{
			Cost = ShopCosts[ShopCategory][ShopItem]/4+CheckInventory("Charisma")-10;
			If(Cost > ShopCosts[ShopCategory][ShopItem]/2)
				Cost = ShopCosts[ShopCategory][ShopItem]/2;
			SellItem(ShopStrings[ShopCategory][ShopItem][0], Cost, 1);
		}
		SetInventory("ShopItem", ShopItem);
		SetInventory("ShopPage", ShopPage);
		SetInventory("ShopCatagory", ShopCategory);
		Delay(1);
	}
}

function void BuyItem(str Item, int Cost)
{
	str Buy = Item;
	if(CheckInventory("Money")>=Cost)
	{
		if(StrCmp(Buy,ShopStrings [0][0][0])==0)
		{
			int origmana = CheckInventory(Buy);
			GiveInventory(Buy,15);
			If(CheckInventory(Buy)!=origmana)
			{
				ActivatorSound("shop/buy", 127);
				TakeInventory("Money", Cost);
				Print(s:"Purchased!");
			}
			else
			{
				ActivatorSound("shop/fail", 127);
				Print(s:"You have too much!");
			}
		}
		else if(StrCmp(Buy,ShopStrings [0][1][0])==0)
		{
			int origmanag = CheckInventory(Buy);
			GiveInventory(Buy,15);
			If(CheckInventory(Buy)!=origmanag)
			{
				ActivatorSound("shop/buy", 127);
				TakeInventory("Money", Cost);
				Print(s:"Purchased!");
			}
			else
			{
				ActivatorSound("shop/fail", 127);
				Print(s:"You have too much!");
			}
		}
		else if(StrCmp(Buy,ShopStrings [0][2][0])==0)
		{
			int origamount1 = CheckInventory("Mana1");
			int origamount2 = CheckInventory("Mana2");
			GiveInventory(Buy,1);
			If(origamount1==CheckInventory("Mana1") && origamount2==CheckInventory("Mana2"))
			{
				ActivatorSound("shop/fail", 127);
				Print(s:"You have too much!");
				Print(s:"Purchased!");
			}
			else
			{
				ActivatorSound("shop/buy", 127);
				TakeInventory("Money", Cost);
			}
		}
		else if((StrCmp(Buy,ShopStrings [1][0][0]) == 0) || (StrCmp(Buy,ShopStrings [1][1][0]) == 0) || (StrCmp(Buy,ShopStrings [1][2][0]) == 0) || (StrCmp(Buy,ShopStrings [1][3][0]) == 0) || (StrCmp(Buy,ShopStrings [1][4][0]) == 0) || (StrCmp(Buy,ShopStrings [1][5][0]) == 0) || (StrCmp(Buy,ShopStrings [1][6][0]) == 0) || (StrCmp(Buy,ShopStrings [1][7][0]) == 0))
		{
			int origarmour = CheckInventory(Buy);
			GiveInventory(Buy,1);
			If(origarmour!=CheckInventory(Buy) || CheckInventory(Buy)==0)
			{
				ActivatorSound("shop/buy", 127);
				TakeInventory("Money", Cost);
				Print(s:"Purchased!");
			}
			else
			{
				ActivatorSound("shop/fail", 127);
				Print(s:"You have too much");
			}
		}
		else if(StrCmp(Buy,ShopStrings [3][ARTIFACTITEMCOUNT-1][0]) == 0)
		{
			GiveInventory(Buy,1);
			ActivatorSound("shop/buy", 127);
			TakeInventory("Money", Cost);
			Print(s:"Purchased!");
		}
		else
		{
			int origamount = CheckInventory(Buy);
			GiveInventory(Buy,1);
			If(origamount!=CheckInventory(Buy))
			{
				ActivatorSound("shop/buy", 127);
				TakeInventory("Money", Cost);
				Print(s:"Purchased!");
			}
			else
			{
				ActivatorSound("shop/fail", 127);
				Print(s:"You have too much");
			}
		}
	}
	else
	{
		ActivatorSound("shop/fail", 127);
		Print(s:"Not enough Gold!");
	}
}

function void SellItem(str Item, int Cost, int SellAll)
{
	if((StrCmp(Item,ShopStrings [0][0][0])==0) || (StrCmp(Item,ShopStrings [0][1][0])==0) || (StrCmp(Item,ShopStrings [0][2][0])==0))
	{
		ActivatorSound("shop/fail", 127);
		Print(s:"Can\'t sell mana!");
	}
	/*else if((StrCmp(Item,ShopStrings [1][0][0]) == 0) || (StrCmp(Item,ShopStrings [1][1][0]) == 0) || (StrCmp(Item,ShopStrings [1][2][0]) == 0) || (StrCmp(Item,ShopStrings [1][3][0]) == 0) || (StrCmp(Item,ShopStrings [1][4][0]) == 0) || (StrCmp(Item,ShopStrings [1][5][0]) == 0) || (StrCmp(Item,ShopStrings [1][6][0]) == 0) || (StrCmp(Item,ShopStrings [1][7][0]) == 0))
	{
		ActivatorSound("shop/fail", 127);
		Print(s:"Can\'t sell armor!");
	}*/
	else if(StrCmp(Item,ShopStrings [3][ARTIFACTITEMCOUNT-1][0])==0)
	{
		ActivatorSound("shop/fail", 127);
		Print(s:"Can\'t sell the map!");
	}
	else
	{
		If(CheckInventory(Item))
		{
			ActivatorSound("shop/sell", 127);
			If(SellAll==0)
			{
				TakeInventory(Item, 1);
				GiveInventory("Money", Cost);
			}
			else
			{
				GiveInventory("Money", Cost*CheckInventory(Item));
				TakeInventory(Item, CheckInventory(Item));
			}
			Print(s:"Sold!");
		}
		else
		{
			ActivatorSound("shop/fail", 127);
			Print(s:"You don't have this item!");
		}
	}
}


Script WOC_SHOPMENUTEXT (void) CLIENTSIDE
{
	while(CheckInventory("InShop"))
	{
		int ShopCategory = CheckInventory("ShopCatagory");
		int ShopPage = CheckInventory("ShopPage");
		int ShopItem = CheckInventory("ShopItem");
		SetHudSize(800,600,0);
		SetFont("HBARFONT");
		hudmessage (s:"press ",k:"+forward",s:" or ",k:"+back",s:" to scroll the menu, press ",k:"+moveleft",s:" to close sub menu, press ",k:"+moveright", s:" to change sub menu,"; HUDMSG_NOWRAP, 714, CR_WHITE, 400.0, 18.0, 1.0 / 35 + 1);
		hudmessage (s:"press ",k:"+use",s:" to purchase, ",s:"press ",k:"+attack",s:" to sell, ",s:"press ",k:"+altattack",s:" to sell all, ", s:"press ",k:"viewstats",s:" to return to the game."; 0, 715, CR_WHITE, 400.0, 30.0, 1.0 / 35 + 1);
		
		for (int j = 0; j < SHOPCATEGORIES; j++)
		{
			if (j == ShopCategory)
				HudMessage(s:"\n",
						   s:ShopNames[j];
						   HUDMSG_PLAIN, 3501 + j, CR_GOLD,
						   119.2, 150.0 + 15.0 * j, 1.0 / 35 + 1);
			else
				HudMessage(s:"\n",
						   s:ShopNames[j];
						   HUDMSG_PLAIN, 3501 + j, CR_WHITE,
						   119.2, 150.0 + 15.0 * j, 1.0 / 35 + 1);
		}
		
		HudMessage(s:"\n\cfGold: \cj",
						   d:CheckInventory("Money");
						   HUDMSG_PLAIN, 3501 + (j+1), CR_WHITE,
						   119.2, 150.0 + 15.0 * (j+1), 1.0 / 35 + 1);
						   
		if(ShopPage == 1)
		{
			Int Buy = ShopCosts[ShopCategory][ShopItem]-CheckInventory("Charisma")*2+20;
			If(Buy < ShopCosts[ShopCategory][ShopItem]/2)
				Buy = ShopCosts[ShopCategory][ShopItem]/2;
			Int Sell = ShopCosts[ShopCategory][ShopItem]/4+CheckInventory("Charisma")-10;
			If(Sell > ShopCosts[ShopCategory][ShopItem]/2)
				Sell = ShopCosts[ShopCategory][ShopItem]/2;
			
			if (CheckInventory("Money") >= Buy)
				HudMessage(s:"\n\cfCost: \cj",
								   d:Buy;
								   HUDMSG_PLAIN, 3501 + (j+2), CR_WHITE,
								   119.2, 150.0 + 15.0 * (j+2), 1.0 / 35 + 1);
			else
				HudMessage(s:"\n\cgCost: \cm",
								   d:Buy;
								   HUDMSG_PLAIN, 3501 + (j+2), CR_WHITE,
								   119.2, 150.0 + 15.0 * (j+2), 1.0 / 35 + 1);
			if(
			(!(ShopCategory == 3 && ShopItem == 14)) &&
			(!(ShopCategory == 0)))
			{	
				if(ShopCategory == 0 && ShopItem < 2)
					HudMessage(s:"\n\cfSell: \cj",
									   d:Sell, s:" (", 
									   d:Sell*
									   CheckInventory(ShopStrings[ShopCategory][ShopItem][0])/15, s:")";
									   HUDMSG_PLAIN, 3501 + (j+4), CR_WHITE,
									   119.2, 150.0 + 15.0 * (j+4), 1.0 / 35 + 1);
				else
					HudMessage(s:"\n\cfSell: \cj",
									   d:Sell, s:" (", 
									   d:Sell*
									   CheckInventory(ShopStrings[ShopCategory][ShopItem][0]), s:")";
									   HUDMSG_PLAIN, 3501 + (j+4), CR_WHITE,
									   119.2, 150.0 + 15.0 * (j+4), 1.0 / 35 + 1);
								   
				if(CheckInventory(ShopStrings[ShopCategory][ShopItem][0]) > 0)
					HudMessage(s:"\n\cfInventory: \cj",
									   d:CheckInventory(ShopStrings[ShopCategory][ShopItem][0]);
									   HUDMSG_PLAIN, 3501 + (j+5), CR_WHITE,
									   119.2, 150.0 + 15.0 * (j+5), 1.0 / 35 + 1);
				else
					HudMessage(s:"\n\cgInventory: \cm0";
									   HUDMSG_PLAIN, 3501 + (j+5), CR_WHITE,
									   119.2, 150.0 + 15.0 * (j+5), 1.0 / 35 + 1);
			}
			else
				HudMessage(s:"\nCan\'t Sell!";
							   HUDMSG_PLAIN, 3501 + (j+4), CR_RED,
							   119.2, 150.0 + 15.0 * (j+4), 1.0 / 35 + 1);
							   
			HudMessage(s:ShopDescription[ShopCategory][ShopItem];
						   HUDMSG_PLAIN, 716, CR_WHITE,
						   124.1, 150.1 + 15.0 * (ShopNamesLimit[ShopCategory] + 1), 1.0 / 35 + 1);
		
			for (int i = 0; i < ShopNamesLimit[ShopCategory]; i++)
			{
				Int Buyi = ShopCosts[ShopCategory][i]-CheckInventory("Charisma")*2+20;
				If(Buyi < ShopCosts[ShopCategory][i]/2)
					Buyi = ShopCosts[ShopCategory][i]/2;
				if(i == ShopItem)
					if (CheckInventory("Money") >= Buyi)
						if (CheckInventory(ShopStrings[ShopCategory][i][0]) > 0)
							HudMessage(s:"\n",
									   s:ShopStrings[ShopCategory][i][1], s:" (",d:CheckInventory(ShopStrings[ShopCategory][i][0]),s:")";
									   HUDMSG_PLAIN, 7001 + i, CR_GOLD,
									   124.1, 150.0 + 15.0 * i, 1.0 / 35 + 1);
						else
							HudMessage(s:"\n",
									   s:ShopStrings[ShopCategory][i][1];
									   HUDMSG_PLAIN, 7001 + i, CR_GOLD,
									   124.1, 150.0 + 15.0 * i, 1.0 / 35 + 1);
					else
						if (CheckInventory(ShopStrings[ShopCategory][i][0]) > 0)
							HudMessage(s:"\n",
									   s:ShopStrings[ShopCategory][i][1], s:" (",d:CheckInventory(ShopStrings[ShopCategory][i][0]),s:")";
									   HUDMSG_PLAIN, 7001 + i, CR_RED,
									   124.1, 150.0 + 15.0 * i, 1.0 / 35 + 1);
						else
							HudMessage(s:"\n",
									   s:ShopStrings[ShopCategory][i][1];
									   HUDMSG_PLAIN, 7001 + i, CR_RED,
									   124.1, 150.0 + 15.0 * i, 1.0 / 35 + 1);
				else
					if (CheckInventory("Money") >= Buyi)
						if (CheckInventory(ShopStrings[ShopCategory][i][0]) > 0)
							HudMessage(s:"\n",
									   s:ShopStrings[ShopCategory][i][1], s:" (",d:CheckInventory(ShopStrings[ShopCategory][i][0]),s:")";
									   HUDMSG_PLAIN, 7001 + i, CR_WHITE,
									   124.1, 150.0 + 15.0 * i, 1.0 / 35 + 1);
						else
							HudMessage(s:"\n",
									   s:ShopStrings[ShopCategory][i][1];
									   HUDMSG_PLAIN, 7001 + i, CR_WHITE,
									   124.1, 150.0 + 15.0 * i, 1.0 / 35 + 1);
					else
						if (CheckInventory(ShopStrings[ShopCategory][i][0]) > 0)
							HudMessage(s:"\n",
									   s:ShopStrings[ShopCategory][i][1], s:" (",d:CheckInventory(ShopStrings[ShopCategory][i][0]),s:")";
									   HUDMSG_PLAIN, 7001 + i, CR_BLACK,
									   124.1, 150.0 + 15.0 * i, 1.0 / 35 + 1);
						else
							HudMessage(s:"\n",
									   s:ShopStrings[ShopCategory][i][1];
									   HUDMSG_PLAIN, 7001 + i, CR_BLACK,
									   124.1, 150.0 + 15.0 * i, 1.0 / 35 + 1);
			}
		}
		Delay(1);
	}
}

Script WOC_SHOPDEAD (void)
{
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
		if (!playeringame (i))
			continue;
		if(distance(0,I+PLAYERTID) < 64)
		{
			If(CheckInventory("InShop"))
			{
				GiveActorInventory(I+PLAYERTID, "ShopUnfreezer", 1);
				TakeActorInventory(I+PLAYERTID, "InShop", 1);
			}
		}
	}
}

Script WOC_ARMORCHECK (void)
{
	If(CheckInventory("PreviousHP")>GetActorProperty(0, APROP_Health))
		for(int count = 0; count < 8; count++)
			If(CheckInventory(ArmorCount[count])>0 && random(1,8)==1)
				TakeInventory(ArmorCount[count],1);
}

str PickUpStates[5] = {
"Fighter",
"Cleric",
"Mage",
"Hunter",
"Necromancer",
};

function int GetClassNumber (void)
{
	int ClassNumber = 0;
	If(CheckInventory("ImAFighter"))
		ClassNumber = 1;
    If(CheckInventory("ImACleric"))
		ClassNumber = 2;
	If(CheckInventory("ImAMage"))
		ClassNumber = 3;
	If(CheckInventory("ImAHunter"))
		ClassNumber = 4;
	If(CheckInventory("ImAWarlock"))
		ClassNumber = 5;
	return ClassNumber;
}

script WOC_CLIENT_CLASS (void) clientside
{
	SetActorState(0,PickUpStates[PlayerClass(ConsolePlayerNumber ())]);
}

str WOC_WEAPONNAMES[6][6] = 
{
    {"SpikedGauntlets", "Timon'sAxe", "HammerOfRetribution", "Quietus", "DragonClaw", "VorpalBlade"},
    {"MaceOfContrition", "SerpentStaff", "FireStorm", "Wraithverge", "MorningStar", "Lightbringer"},
	{"SapphireWand", "FrostShards", "ArcOfDeath", "Bloodscourge", "JadeWand", "Skullstaff"},
	{"Machete", "EnchantedBow", "EtherealCrossbow", "HellforgeCannon", "GlacialCrossbow", "Blunderbuss"},
	{"Sickle", "HeartOfYorick", "LichStaff", "RavenStaff", "GauntletsOfTheNecromancer", "Bloodscepter"},
};

str WOC_WEAPONPICKUP[6][6] = 
{
    {"Spiked Gauntlets", "Timon's Axe", "Hammer Of Retribution", "Quietus", "Dragon Claw", "Vorpal Blade"},
    {"Mace Of Contrition", "Serpent Staff", "FireStorm", "Wraithverge", "Morning Star", "Lightbringer"},
	{"Sapphire Wand", "Frost Shards", "Arc Of Death", "Bloodscourge", "Jade Wand", "Skullstaff"},
	{"Machete", "Enchanted Bow", "Ethereal Crossbow", "Hellforge Cannon", "Glacial Crossbow", "Blunderbuss"},
	{"Sickle", "Heart Of Yorick", "Lich Staff", "Raven Staff", "Gauntlets Of The Necromancer", "Bloodscepter"},
};

script WOC_GIVEWEAPON (int slot)
{   
	int Success = 0;
	int ClassNumber = GetClassNumber()-1;
    int sv_weaponstay = !!GetCVar("sv_weaponstay");
	int AmmoFull = 0;
	If((slot == 2 || slot == 5) && (CheckInventory("Mana1") == GetAmmoCapacity("Mana1")))
			AmmoFull = 1;
	Else If((slot == 3 || slot == 6) && (CheckInventory("Mana2") == GetAmmoCapacity("Mana2")))
			AmmoFull = 1;
	Else If((slot == 4) && ((CheckInventory("Mana1") == GetAmmoCapacity("Mana1")) && (CheckInventory("Mana2") == GetAmmoCapacity("Mana2"))))
			AmmoFull = 1;
	Else If(slot == 1)
			AmmoFull = 1;
			
    
    
	//If you do have the weapon and your ammo is full, set success to 1
    if ((CheckInventory(WOC_WEAPONNAMES[ClassNumber][Slot-1]) && !AmmoFull && !GetCVar("sv_weaponstay")) || (!CheckInventory(WOC_WEAPONNAMES[ClassNumber][Slot-1])) || (!AmmoFull && GetCVar("WoC_FullRefill")))
	{
        Success = 1;
		Spawn("WoCDummyPickup", GetActorX(0), GetActorY(0), GetActorZ(0));
		ACS_ExecuteAlways(WOC_WEAPONMESSAGE, 0, ClassNumber, Slot-1);
		GiveInventory(WOC_WEAPONNAMES[ClassNumber][Slot-1], 1);
		If(slot == 2 || slot == 5)
		{
			If(GetCVar("WoC_FullRefill"))
				SetInventory("Mana1", GetAmmoCapacity("Mana1"));
			Else
				GiveInventory("Mana1Weapon",1);
		}
		Else If(slot == 3 || slot == 6)
		{
			If(GetCVar("WoC_FullRefill"))
				SetInventory("Mana2", GetAmmoCapacity("Mana2"));
			Else
				GiveInventory("Mana2Weapon",1);
		}
		Else If(slot == 4)
		{
			If(GetCVar("WoC_FullRefill"))
			{
				SetInventory("Mana1", GetAmmoCapacity("Mana1"));
				SetInventory("Mana2", GetAmmoCapacity("Mana2"));
			}
			Else
				GiveInventory("NewMana3",1);
		}
	}
    SetResultValue((success * 1) + (sv_weaponstay * 2));
}

str msgColors[22] = 
{
    "\ca", "\cb", "\cc", "\cd", "\ce", "\cf", "\cg", "\ch", "\ci", "\cj", "\ck",
    "\cl", "\cm", "\cn", "\co", "\cp", "\cq", "\cr", "\cs", "\ct", "\cu", "\cv"
};

script WOC_WEAPONMESSAGE (Int Class, Int Slot) clientside
{
	if(PlayerNumber() != ConsolePlayerNumber()) Terminate;
	Log(s:msgColors[GetCVar("msg0color")], s:WOC_WEAPONPICKUP[Class][Slot]);
}

Script WOC_FLOATINGBARS (void)
{
	int height, id, z;
	id = ActivatorTID()+HPBARID;
	thing_remove(id);
	height = GetActorProperty(0, APROP_Height);
	
	//int mul = fixeddiv(32.0, (CheckInventory("CurrentMaxHealth")<<16));
	int hp;
	z = getactorz(0) + (height);
	if(z > GetActorCeilingZ(0)-4.5)
			z = GetActorCeilingZ(0)-4.5;
	Spawn("HPBAR3", getactorx(0), getactory(0), getactorz(0) + (height) - 1.0, id);
	SetUserVariable(id, "user_number", PlayerNumber()+1);
	while(GetActorProperty(0, APROP_Health) > 0)
	{
		z = getactorz(0) + (height);
		if(z > GetActorCeilingZ(0)-4.5)
			z = GetActorCeilingZ(0)-4.5;
		if(GetActorProperty(0, APROP_Health) != CheckInventory("CurrentMaxHealth"))
			hp = (GetActorProperty(0, APROP_Health) * fixeddiv(32.0, (CheckInventory("CurrentMaxHealth")<<16)))>>16;
		else
			hp = 32;
		if(hp == 0)
			hp = 1;
		setactorvelocity(id, getactorvelx(0), getactorvely(0), getactorvelz(0), 0, 0);
		setactorposition(id, getactorx(0), getactory(0), z, 0);
		setactorstate(id, hps[hp], 0);
		delay(1);
	}
	thing_remove(id);
}

script 705 (int mode) clientside
{
	If(GameType() != 0)
	{
		If(Mode == 0)
		{
			While(GetActorProperty(0,APROP_Health))
			{
				If((GetUserCVar(consoleplayernumber(),"WoC_EnemyFloatingHealthBar") == 0))
					SetActorProperty(0, APROP_Renderstyle, 0);
				Else
					SetActorProperty(0, APROP_Renderstyle, STYLE_Translucent);
				Delay(35);
			}
		}
		Else If(Mode == 1)
		{
			While(GetActorProperty(0,APROP_Health))
			{
				If((GetUserCVar(consoleplayernumber(),"WoC_FloatingHealthBar") == 0))
					SetActorProperty(0, APROP_Renderstyle, 0);
				Else
					SetActorProperty(0, APROP_Renderstyle, STYLE_Translucent);
				Delay(35);
			}
		}
		Else If(Mode == 2)
		{
			While(GetActorProperty(0,APROP_Health))
			{
				If(GetUserVariable(0, "user_number" != consoleplayernumber()+1))
				{
					If((GetUserCVar(consoleplayernumber(),"WoC_FloatingHealthBar") == 0))
						SetActorProperty(0, APROP_Renderstyle, 0);
					Else
						SetActorProperty(0, APROP_Renderstyle, STYLE_Translucent);
				}
				Else
					SetActorProperty(0, APROP_Renderstyle, 0);
				Delay(35);
			}
		}
	}
}

script 706 (int tid) clientside
{
	While(GetActorProperty(0,APROP_Health) > 0)
	{
		If(CheckInventory("EnemyInDisguise")==0 && CheckActorProperty(0, APROP_Friendly, 0) || CheckInventory("FriendlyInDisguise")>0 )
		{
			If((GetUserCVar(consoleplayernumber(),"WoC_EnemyFloatingHealthBar") == 1))
				SetActorProperty(tid, APROP_Renderstyle, STYLE_Translucent);
			Else
				SetActorProperty(tid, APROP_Renderstyle, 0);
		}
		Else If(CheckActorProperty(0, APROP_Friendly, 1) || CheckInventory("EnemyInDisguise")>0)
		{
			If((GetUserCVar(consoleplayernumber(),"WoC_FloatingHealthBar") == 0))
				SetActorProperty(tid, APROP_Renderstyle, 0);
			Else
				SetActorProperty(tid, APROP_Renderstyle, STYLE_Translucent);
		}
		Delay(35);
	}
}

script WOC_INSPIRE (void)
{
	int BlessingHealAmount = CheckInventory("Wisdom")+15;
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
		if (!playeringame (i))
			continue;
		if(distance(0,I+PLAYERTID) < 512 && CheckSight(0,I+PLAYERTID,0))
		{
			GiveActorInventory(I+PLAYERTID, "InspireFlash", 1);
			HealingActor(I+PLAYERTID, BlessingHealAmount);
			HealingActor(I+PET1TID, BlessingHealAmount);
			HealingActor(I+PET2TID, BlessingHealAmount);
			HealingActor(I+PET3TID, BlessingHealAmount);
			HealingActor(I+PET4TID, BlessingHealAmount);
		}
	}
}

script WOC_BLESSEDGROUND (int HolyMissileHealingAmount)
{
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
		if (!playeringame (i))
			continue;
		if(distance(0,I+PLAYERTID) < 256 && CheckSight(0,I+PLAYERTID,0))
		{
			HealingActor(I+PLAYERTID, HolyMissileHealingAmount+HolyMissileHealingAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
			HealingActor(I+PET1TID, HolyMissileHealingAmount+HolyMissileHealingAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
			HealingActor(I+PET2TID, HolyMissileHealingAmount+HolyMissileHealingAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
			HealingActor(I+PET3TID, HolyMissileHealingAmount+HolyMissileHealingAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
			HealingActor(I+PET4TID, HolyMissileHealingAmount+HolyMissileHealingAmount*(CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")-GetActorProperty(I+PLAYERTID, APROP_Health))/(2*CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")));
		}
	}
}

script WOC_HARVESTERSOUL (void)
{
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
		if (!playeringame (i))
			continue;
		if(distance(0,I+PLAYERTID) < 2056 && CheckSight(0,I+PLAYERTID,0))
		{
			
			HealingActor(I+PLAYERTID, CheckActorInventory(I+PLAYERTID, "CurrentMaxHealth")/10);
			HealingActor(I+PET1TID, CheckActorInventory(I+PET1TID, "CurrentMaxHealth")/10);
			HealingActor(I+PET2TID, CheckActorInventory(I+PET2TID, "CurrentMaxHealth")/10);
			HealingActor(I+PET3TID, CheckActorInventory(I+PET3TID, "CurrentMaxHealth")/10);
			HealingActor(I+PET4TID, CheckActorInventory(I+PET4TID, "CurrentMaxHealth")/10);
			GiveActorInventory(I+PLAYERTID,"HarvesterSoulMana",1);
		}
	}
}

script WOC_AREAHEAL (int heal, int dist)
{
	int healamount = heal/4;
	for (int i = 0; i < MAXPLAYERS; i++) 
	{
		if (!playeringame (i) || i == PlayerNumber())
			continue;
		if(distance(0,I+PLAYERTID) < dist && !CheckInventory("NecromancerHealed") && CheckSight(0,I+PLAYERTID,0))
		{
			GiveActorInventory(I+PLAYERTID, "NecromancerHealed", 1);
			HealingActor(I+PLAYERTID, healamount);
			HealingActor(I+PET1TID, healamount);
			HealingActor(I+PET2TID, healamount);
			HealingActor(I+PET3TID, healamount);
			HealingActor(I+PET4TID, healamount);
		}
	}
}
//						 S	 A	 C	 W	 I	 C
int FighterStats[6] = { 15, 12, 15,  5,  5, 10};
int ClericStats[6] =  { 12,  8, 13,  8,  7, 14};
int MageStats[6] =    {  7,  7,  7, 14, 15, 10};
int HunterStats[6] =  { 10, 14, 10, 10,  8, 10};
int NecroStats[6] =   {  8, 10,  8, 12, 14, 10};
str StatNames[6] = {"Strength", "Agility", "Constitution", "Wisdom", "Intellect", "Charisma"};

script WOC_RESPECSCRIPT (int n)
{
	int points = 0;
	int skills = 0;
	For(int i = 0; i < 6; i++)
		If(CheckInventory("ImAFighter"))
		{
			points += CheckInventory(StatNames[i]) - FighterStats[i];
			SetInventory(StatNames[i],FighterStats[i]);
		}
		else If(CheckInventory("ImACleric"))
		{
			points += CheckInventory(StatNames[i]) - ClericStats[i];
			SetInventory(StatNames[i],ClericStats[i]);
		}
		else If(CheckInventory("ImAMage"))
		{
			points += CheckInventory(StatNames[i]) - MageStats[i];
			SetInventory(StatNames[i],MageStats[i]);
		}
		else If(CheckInventory("ImAHunter"))
		{
			points += CheckInventory(StatNames[i]) - HunterStats[i];
			SetInventory(StatNames[i],HunterStats[i]);
		}
		else If(CheckInventory("ImAWarlock"))
		{
			points += CheckInventory(StatNames[i]) - NecroStats[i];
			SetInventory(StatNames[i],NecroStats[i]);
		}
	
	
	
	For(int j = 0; j < ABIl_ARRAYMAX; j++)
		If(CheckInventory("ImAFighter"))
		{
			skills += CheckInventory(FighterItemNames[j]);
			SetInventory(FighterItemNames[j],0);
		}
		else If(CheckInventory("ImACleric"))
		{
			skills += CheckInventory(ClericItemNames[j]);
			SetInventory(ClericItemNames[j],0);
		}
		else If(CheckInventory("ImAMage"))
		{
			skills += CheckInventory(MageItemNames[j]);
			SetInventory(MageItemNames[j],0);
		}
		else If(CheckInventory("ImAHunter"))
		{
			skills += CheckInventory(HunterItemNames[j]);
			SetInventory(HunterItemNames[j],0);
		}
		else If(CheckInventory("ImAWarlock"))
		{
			skills += CheckInventory(NecromancerItemNames[j]);
			SetInventory(NecromancerItemNames[j],0);
		}
	
	SetManaCapacity();
	SetMagickCapacity();
	SetMaximumHealth();
	
	If(GetActorProperty(0, APROP_Health) > CheckInventory("CurrentMaxHealth"))
		SetActorProperty(0, APROP_Health, CheckInventory("CurrentMaxHealth"));
	
	If(CheckInventory("MP")>GetAmmoCapacity("MP"))
		SetInventory("MP", GetAmmoCapacity("MP"));
		
	If(CheckInventory("Mana1")>GetAmmoCapacity("Mana1"))
		SetInventory("Mana1", GetAmmoCapacity("Mana1"));
		
	If(CheckInventory("Mana2")>GetAmmoCapacity("Mana2"))
		SetInventory("Mana2", GetAmmoCapacity("Mana2"));
	
	If(CheckInventory("SpecChosen"))
	{
		TakeInventory("IsDestroyer",1);
		TakeInventory("IsVanguard",1);
		TakeInventory("IsCommander",1);
		TakeInventory("IsPurifier",1);
		TakeInventory("IsOracle",1);
		TakeInventory("IsInquisitor",1);
		TakeInventory("IsPyro",1);
		TakeInventory("IsIceborn",1);
		TakeInventory("IsArchon",1);
		TakeInventory("IsMarksman",1);
		TakeInventory("IsDuelist",1);
		TakeInventory("IsSurvivalist",1);
		TakeInventory("IsPlaguebringer",1);
		TakeInventory("IsHarvester",1);
		TakeInventory("IsConjuror",1);
		TakeInventory("SpecChosen",1);
	}
	
	GiveInventory("LvlUpPoints", points);
	GiveInventory("LvlUp", skills);
}