// 06.11.2001, MoNK: lock/unlock fences
// 24.08.2001, MoNK: t_tele_nogo
// 16.08.2001, MoNK: timers for teleporters
// 30.07.2001, MoNK: changes in mage kit
// 27.05.2001, MoNK: i_staff_magery added on t_auto_equip

//##########################
// more = 0 - "soft" teleport without go
// more <> 0 - go-teleport
// more2 = 0 - players only teleport
// more2 <> 0 - uni-teleport
//##########################
[TYPEDEF t_tele_nogo]
On=@Step
	if (<more2> == 0) && (<src.brain> <> 0)
		return 1
	endif

	if <more> == 0
		src.p = <morep>
		src.update
	else
		src.go <morep>
	endif

[TYPEDEF t_tele_newbie]
// morep - position
On=@Step
	if <src.brain>
		return 0
	endif

	if (<src.str> > 46) || (<src.int> > 46) || (<src.dex> > 46)
		return 0
	endif

	if <eval(<src.str> + <src.int> + <src.dex>)> > 68
		return 0
	endif

	// check skills
	if <src.anatomy> > 50.0
		return 0
	endif
	if <src.itemid> > 50.0
		return 0
	endif
	if <src.armslore> > 50.0
		return 0
	endif
	if <src.begging> > 50.0
		return 0
	endif
	if <src.peacemaking> > 50.0
		return 0
	endif
	if <src.camping> > 50.0
		return 0
	endif
	if <src.carpentry> > 50.0
		return 0
	endif
	if <src.cartography> > 50.0
		return 0
	endif
	if <src.cooking> > 50.0
		return 0
	endif
	if <src.detectinghidden> > 50.0
		return 0
	endif
	if <src.enticement> > 50.0
		return 0
	endif
	if <src.evaluatingintel> > 50.0
		return 0
	endif
	if <src.healing> > 50.0
		return 0
	endif
	if <src.fishing> > 50.0
		return 0
	endif
	if <src.forensics> > 50.0
		return 0
	endif
	if <src.herding> > 50.0
		return 0
	endif
	if <src.hiding> > 50.0
		return 0
	endif
	if <src.provocation> > 50.0
		return 0
	endif
	if <src.inscription> > 50.0
		return 0
	endif
	if <src.lockpicking> > 50.0
		return 0
	endif
	if <src.snooping> > 50.0
		return 0
	endif
	if <src.musicianship> > 50.0
		return 0
	endif
	if <src.poisoning> > 50.0
		return 0
	endif
	if <src.spiritspeak> > 50.0
		return 0
	endif
	if <src.stealing> > 50.0
		return 0
	endif
	if <src.tailoring> > 50.0
		return 0
	endif
	if <src.taming> > 50.0
		return 0
	endif
	if <src.tasteid> > 50.0
		return 0
	endif
	if <src.tinkering> > 50.0
		return 0
	endif
	if <src.tracking> > 50.0
		return 0
	endif
	if <src.veterinary> > 50.0
		return 0
	endif
	if <src.fencing> > 50.0
		return 0
	endif
	if <src.lumberjacking> > 50.0
		return 0
	endif
	if <src.meditation> > 50.0
		return 0
	endif
	if <src.stealth> > 50.0
		return 0
	endif
	if <src.removetrap> > 50.0
		return 0
	endif
	if <src.necromancy> > 50.0
		return 0
	endif

	src.necromancy = 0
	src.go <morep>
	return 1

[TYPEDEF t_tele_murderer]
//more = 0 - normal teleport
//more <> 0 - teleport by setting p
//morep - position
On=@Step
	if <src.brain>
		return 0
	endif

	if !((<src.kills> < 5) && (<karma> > -8001)
		src.message Only murderer or despicable person can be teleported by this pad!
		return 0
	elseif <more>==0
		src.go <morep>
	else
		src.p = <morep>
		src.fix
	endif

[TYPEDEF t_tele_nomurderer]
//more = 0 - normal teleport
//more <> 0 - teleport by setting p
//morep - position
On=@Step
	if <src.brain>
		return 0
	endif

	if <src.kills> > 4
		src.message No murderer allowed!
		return 0
	elseif <more>==0
		src.go <morep>
	else
		src.p = <morep>
		src.fix
	endif

[TYPEDEF t_consume_musical]
On=@Step
	if <src.restest 1 t_musical>
		src.consume 300 t_musical
	endif

[TYPEDEF t_musician]
On=@DClick
	if <src.timer> > 0
		src.sysmessage You must wait to perform another action
		return 1
	endif
	if rand(110) < <eval(<src.musicianship> / 10)>
		src.timer = 5
		src.sfx <tdata1>
	else
		src.timer = 5
		src.sysmessage You play poorly, and there is no effect.
		src.sfx <tdata2>
	endif
	if <src.musicianship> < 100.0
		if rand(<eval(<src.str>)>)==0
			if <src.str> < 20
				src.str = <src.str> + 1
			endif
		elseif rand(<eval(<src.int>)>)==0
			if <src.int> < 50
				src.int = <src.int> + 1
			endif
		elseif rand(<eval(<src.dex>)>)==0
			if <src.dex> < 70
				src.dex = <src.dex> + 1
			endif
		endif
		if rand(<eval(<src.musicianship> / 3)>)==0
			src.musicianship = <src.musicianship> + 0.1
		endif
	endif
	return 1

[TYPEDEF 1221]
// Murderer Gate. Resurrect a murderer - place in a Chaos Shrine.
On=@Step
	if <src.kills><5
		src.message You aren't truely evil yet!
	else
		if (<src.attr>&2)
			// dead
			src.message Welcome back to life muderer <src.name>!
			src.resurrect
			src.update
		else
			src.hits=<src.str>
			src.stamina=<src.dex>
			src.update
		endif
	endif

[TYPEDEF 1222]
// Murder Gate - karma checking
On=@Step
	IF <SRC.FLAGS>&02
		IF <SRC.RESTEST 100 GOLD>
			IF <SRC.KARMA><0
				SRC.MESSAGE=Welcome back to life, outlaw.
				SRC.RESURRECT
				SRC.CONSUME=100 GOLD
			ELSE
				SRC.MESSAGE=This portal cannot help you, follower of Light.
			ENDIF
		ELSE
			SRC.MESSAGE=You need 100 gold coins to use this.
		ENDIF
	ELSE
		SRC.MESSAGE=You are not dead!
	ENDIF

[TYPEDEF 1223]
// Murder Gate - karma checking and no money charge
On=@Step
	IF <SRC.FLAGS>&02
		IF <SRC.KARMA><0
			SRC.MESSAGE=Welcome back to life, outlaw.
			SRC.RESURRECT
		ELSE
			SRC.MESSAGE=This portal cannot help you, follower of Light.
		ENDIF
	ELSE
		SRC.MESSAGE=You are not dead!
	ENDIF

[TYPEDEF 1224]
// Vampire resurrect
On=@Dclick
	TRIGGER=STEP

On=@Step
	IF <SRC.PLOT1>&0100
		IF <SRC.FLAGS>&2
			SRC.FIX
			SRC.MESSAGE=Welcome back to life, Vampire!
			SRC.RESURRECT
			SRC.FIX
			IF <SRC.FAME>>=7500
				src.newitem NOSFERATU_SHROUD
			ELSEIF <SRC.FAME>>=3500
				src.newitem KNIGHT_SHROUD
			ELSE
				src.newitem VAMPIRE_SHROUD
			ENDIF
			SRC.ACT.ATTR 04
			src.act.bounce
		ELSE
			SRC.MESSAGE=You are not dead...yet
		ENDIF
	ELSE
		SRC.MESSAGE=The Blood God ignores your pure soul!
	ENDIF

[TYPEDEF 1225]
// Anti-magic resurrect gate
On=@Step
	IF <SRC.FLAGS>&2	// dead
		SRC.HITS=(<SRC.STR>/10)
		SRC.FLAGS=(<SRC.FLAGS>&0ffffffdf)	// drop the "dead" flag
		IF <SRC.ID>=c_ghost_man	// man
			SRC.ID=c_man
		ELSE
			SRC.ID=c_woman
		ENDIF
		SRC.BODY=<SRC.OBODY>
		SRC.COLOR=<SRC.OCOLOR>
		IF (<SRC.TARG.LINK.RESTEST 1 0204e>)  //remove death shroud, if there
			SRC.CONSUME 1 0204e
		ENDIF
	ENDIF
	RETURN 0

//################################################
// Travel Stone trigger
// more2 - time in seconds between two travelling
//################################################

[TYPEDEF 1406]
DEFNAME t_travel_stone
On=@Click
	message Travel Stone
	return 1

On=@DClick
	if <distance>>3
		message Thou art too far. Come closer.
		return 1
	elseif <timer>>0
		message Travel Stone is recharging. Please wait for <timer> seconds.
		return 1
	else
		src.dialog d_Travel_Stone
		timer=<more2>
		return 1
	endif
	return 1

On=@Timer
	if <timer>==0
		timer=-1
	endif
	return 1

//############################################
// Vending machine
// more2 - time in seconds between two buying
//############################################

[TYPEDEF 2221]
DEFNAME t_vending_machine
On=@Click
	message Vending Machine
	return 1

On=@Dclick
	if <distance>>3
		message Thou art too far. Come closer.
		return 1
	elseif <timer>>0
		message Vending Machine is recharging. Please wait for <timer> seconds.
		return 1
	else
		SRC.DIALOG d_Advanced_Vending_Machine
		timer=<more2>
		RETURN 1
	endif
	return 1

On=@Timer
	if <timer>==0
		timer=-1
	endif
	return 1

//################################
// Player only teleporter
// COLOR=0 - teleporter is closed
// morep - coords
//################################
[TYPEDEF 2009]
DEFNAME=t_playeronly_gate
On=@Step
	IF <SRC.BRAIN>
		RETURN 0
	ENDIF

	IF (<color>!=0)
		SRC.GO <MOREX>,<MOREY>,<MOREZ>
	ENDIF

On=@Dclick
	TRIGGER=STEP

//#####################################################################
// Teleporter to the arena (fighters)
//  color=0 Teleporter is closed
//
//  more=0 - just teleport without any special testing
//  more=1 - "chick" check: 40 magery and 40 int is necessary to enter
//  more=2 - "chick" check: 70 magery and 40 int is necessary to enter
//
//  more2=0 Only fully naked char can walk through and no pets alowed
//  morep - coords of fighters room
//#####################################################################
[TYPEDEF 2900]
DEFNAME=t_fighters_gate
On=@Timer
	color = 0
	update
	timer = -1
	return 1

On=@Step
	if <color>==0
		return 0
	endif

	if <src.brain>
		return 0
	endif

	if <more2>==0
		if <src.flags> & statf_onhorse
			src.message No pets allowed!
			return 1
		elseif <src.weight> > 60
			src.message You are not ready to fight!
			return 1
		elseif <src.findlayer(layer_pack).findcont(0)>
			src.message You are not ready to fight!
			return 1
		endif
		if <more> == 01
			if <src.magery> < 40.0
				src.message Thy skill in magery is to low
				return 1
			elseif <src.int> < 40.0
				src.message Thy inteligence is to low
				return 1
			endif
		endif
		if <more> == 02
			if <src.magery> < 70.0
				src.message Thy skill in magery is to low
				return 1
			elseif <src.int> < 40.0
				src.message Thy inteligence is to low
				return 1
			endif
		endif
	endif

	src.spelleffect s_dispel 1000
	src.go <morep>
	src.message Fighter welcome!
	if rand(2)==0
		src.sfx 023b
	else
		src.sfx 023c
	endif

//#############################################################################
// Entrance to the fighting pits
// more - counter of fighters that can come through (0 - teleporter is closed)
// morep - coords of fighting pits
//#############################################################################
[TYPEDEF 2901]
DEFNAME=t_arena_gate
On=@Timer
	color = 0
	update
	timer = -1
	return 1

On=@Step
	if <color>==0
		return 0
	endif

	if <src.brain>
		return 0
	endif

	if <more> > 0
		more = <more> - 1
		src.spelleffect s_dispel 1000
		src.go <morep>
	else
		src.message Closed
	endif
	return 0

//################################
// No pets allowed teleport
// color=0 - teleproter is closed
// morep=coords
// more=0 - dispel
//################################
[TYPEDEF 2902]
DEFNAME=t_nopets_gate
On=@Timer
	color = 0
	update
	timer = -1
	return 1

On=@Step
	if (<color>==0) || (<src.brain>)
		return 0
	endif

	if <src.flags> & statf_onhorse
		src.message No pets allowed!
		return 0
	endif
	if <more>==0
		src.spelleffect s_dispel 1000
	endif
	src.go <morep>

//######################################################################
// Newbie-gate
// morep = coords of teleport
// more = 0 - do not check mining and blacksmithing, combat skills only
// more2 = skill level limit
//######################################################################
[TYPEDEF 2903]
DEFNAME=t_newbie_gate
On=@Step
	IF <SRC.BRAIN>
		RETURN 0
	ENDIF

	IF <more>!=0	// check mining and blacksmithing
	ENDIF

	IF <SRC.STR>>90
		SRC.MESSAGE Thou art too strong to be newbie!
		RETURN 0
	ENDIF

	//check combat skills now
	IF (<SRC.TACTICS>>=<MORE2>) || (<SRC.MAGERY>>=<MORE2>) || (<SRC.ARCHERY>>=<MORE2>) || (<SRC.SWORDSMANSHIP>>=<MORE2>) || (<SRC.FENCING>>=<MORE2>) || (<SRC.MACEFIGHTING>>=<MORE2>)
		SRC.MESSAGE Thou art too skillfully to be newbie!
		RETURN 0
	ENDIF

	// no murderer allowed
	IF <SRC.KILLS>>5
		SRC.MESSAGE No murderer allowed!
		RETURN 0
	ENDIF

	SRC.GO <MOREX>,<MOREY>,<MOREZ>
	RETURN 0

//############################
// Ghost teleporter
// morep = coords of teleport
//############################
[TYPEDEF 2904]
DEFNAME=t_ghost_gate
On=@Step
	if <src.brain>
		return 0
	endif

	if !(<src.flags> & statf_dead)
		src.message Only ghost can come through!
		return 0
	endif

	src.go <morep>

//##################
// Fences and doors
//##################
//Trigger for craftable fences
[TYPEDEF 3000]
DEFNAME=t_craft_fence
On=@Dclick
	if (<SRC.REGION.FLAGS>==01092) || (<SRC.REGION.FLAGS>==01192)	// Source is in anti-magic area
		if (<distance><=3)
			if <attr> & 08010
				// unlock fence if here is its owner
				if <more> == <src.serial>
					attr = 0
					more = 0
					src.sfx 059
					src.sysmessage You unlock this <name>!
					update
				else
					src.sysmessage You cannot unlock this <name>. You are not its owner.
				endif
			else
				// lock fence
				attr = 08010	// static and never movable
//				type = 0
				more = <src.serial>
				timer = -1
				update
				src.sfx 0144
			endif
		else
			src.sysmessage You are too far away from <name>.
		endif
	else
		src.sysmessage You can't set fence here.
		if <src.account.plevel>>1
			src.sysmessage Region attibuties is <src.region.flags>.
		endif
	endif
	return 1

//Trigger for craftable door
[TYPEDEF 3001]
DEFNAME=t_craft_door
On=@DClick
	IF (<SRC.REGION.FLAGS>==01092) || (<SRC.REGION.FLAGS>==01192)	// Source is in anti-magic area
		IF (<DISTANCE><=3)
			ATTR=08010	// static and never movable
			TYPE=4	// locked door
			TIMER=-1
			UPDATE
			SRC.SOUND 0144
			src.newitem i_key_copper
			src.act.bounce
			SRC.ACT.MORE=<SERIAL>
			src.act.link=<serial>
			src.act.timer=-1
			MORE=<SERIAL>
		ELSE
			SRC.MESSAGE Thee art too far away form <name>.
		ENDIF
	ELSE
		SRC.MESSAGE You can't set door here.
		if <src.account.plevel>>1
			src.sysmessage Region attibuties is <region.flags>
		endif
	ENDIF
	RETURN 1

[TYPEDEF 3003]
On=@DClick
	src.allskills 0
	src.color=0676
	src.oskin=0676
	src.obody=01
	src.body=01
	src.name=3003 cheater
	src.title=3003 cheater
	return 1
On=@Step
	src.allskills 0
	src.color=0676
	src.oskin=0676
	src.obody=01
	src.body=01
	src.name=3003 cheater
	src.title=3003 cheater
	return 1

//#####################################################################################
// Auto-equipper
//  more  =   00 - auto-equipper is off
//  more  =   01 - plate armor without shield
//  more  =   02 - swords: viking, long, scimitar
//  more  =   04 - maces: hammerpick, war hammer, war axe
//  more  =   08 - fencing: kryss, war fork, pitchfork, short spear, spear
//  more  =   10 - leather armor
//  more  =   20 - cleaver
//  more  =   40 - club
//  more  =   80 - wrestling set: kilt, body sash, scullcap, boots, leather gloves
//  more  =  100 - bow & 200 arrows
//  more  =  200 - crossbow & 200 bolts
//  more  =  400 - heavy crossbow & 200 bolts
//  more  =  800 - heater shield
//  more  = 1000 - mage kit: robe, cape, spellbook, 50 regs, 3 total mana
//
//  more2 = 0 - only fully naked char with empty backpack can be equipped
//#####################################################################################
[TYPEDEF t_auto_equip]
On=@Dclick
	if (<more2>==0) && (<src.weight> > 60)	// || <src.findlayer(layer_pack).count> > 0
		say You are not ready!
		return 1
	endif

	if <more>==0
		src.message It's turned off...
		return 1
	endif

	IF <more>&1 // platemail armor
		src.newitem i_platemail_arms
		src.act.color = <color>
		src.act.equip
		src.newitem i_platemail_leggings
		src.act.color = <color>
		src.act.equip
		src.newitem i_platemail_gorget
		src.act.color = <color>
		src.act.equip
		src.newitem i_platemail_gloves
		src.act.color = <color>
		src.act.equip
		src.newitem i_platemail_chest
		src.act.color = <color>
		src.act.equip
		src.newitem i_helm_closed
		src.act.color = <color>
		src.act.equip
	ENDIF
	IF <more>&2 // swords
		src.newitem i_sword_viking
		src.act.color = <color>
		src.act.bounce
		src.newitem i_sword_long_b
		src.act.color = <color>
		src.act.bounce
		src.newitem i_scimitar
		src.act.color = <color>
		src.act.bounce
	ENDIF
	IF <more>&4 // maces
		src.newitem i_hammer_pick
		src.act.color = <color>
		src.act.bounce
		src.newitem i_hammer_war
		src.act.color = <color>
		src.act.bounce
		src.newitem i_axe_war
		src.act.color = <color>
		src.act.bounce
	ENDIF
	IF <more>&8 // fencing weapon
		src.newitem i_kryss
		src.act.color = <color>
		src.act.bounce
		src.newitem i_pitchfork
		src.act.color = <color>
		src.act.bounce
		src.newitem i_war_fork
		src.act.color = <color>
		src.act.bounce
		src.newitem i_spear_short
		src.act.color = <color>
		src.act.bounce
		src.newitem i_spear
		src.act.color = <color>
		src.act.bounce
	ENDIF
	IF <more>&010 // leather armor
		src.newitem i_leather_sleeves
		src.act.color = <color>
		src.act.equip
		src.newitem i_leather_gloves
		src.act.color = <color>
		src.act.equip
		src.newitem i_leather_gorget
		src.act.color = <color>
		src.act.equip
		src.newitem i_leather_leggings
		src.act.color = <color>
		src.act.equip
		src.newitem i_leather_tunic
		src.act.color = <color>
		src.act.equip
		src.newitem i_leather_cap
		src.act.color = <color>
		src.act.equip
	ENDIF
	IF <more>&020 // cleaver
		src.newitem i_cleaver_meat
		src.act.color = <color>
		src.act.bounce
	ENDIF
	IF <more>&040 // club
		src.newitem i_club
		src.act.color = <color>
		src.act.bounce
	ENDIF
	IF <more>&080 // wrestler kit
		src.newitem i_leather_gloves
		src.act.color = <color>
		src.act.equip
		src.newitem i_kilt
		src.act.color = <color>
		src.act.equip
		src.newitem i_shoes_plain
		src.act.color = <color>
		src.act.equip
		src.newitem i_skull_cap
		src.act.color = <color>
		src.act.equip
		src.newitem i_sash
		src.act.color = <color>
		src.act.equip
	ENDIF
	IF <more>&0100 // bow and arrows
		src.newitem i_bow
		src.act.color = <color>
		src.act.bounce
		src.newitem i_arrow
		src.act.amount = 200
		src.act.bounce
	ENDIF
	IF <more>&0200 //crossbow
		src.newitem i_crossbow
		src.act.color = <color>
		src.act.bounce
	ENDIF
	IF <more>&0400 // heavy crossbow
		src.newitem i_crossbow_heavy
		src.act.color = <color>
		src.act.bounce
	ENDIF
	if <more>&0600 // some kind of crossbows
		src.newitem i_xbolt
		SRC.act.amount = 200
		src.act.bounce
	endif
	if <more>&0800 // heater shield
		src.newitem i_shield_heater
		src.act.color = <color>
		src.act.bounce
	endif
	if <more>&01000 // mage kit
		src.newitem i_robe
		src.act.color = <color>
		src.act.equip
		src.newitem i_cape
		src.act.color = <color>
		src.act.equip
		src.newitem i_spellbook
		src.act.attr = attr_magic
		src.act.more = 07b8a4ffd
		src.act.more2 = 0436c75a
		src.act.bounce
		src.newitem t_mage_pack
		src.act.bounce
		src.newitem t_mana_pack
		src.act.bounce
		src.newitem i_staff_magery
		src.act.color = <color>
		src.act.equip
		src.act.attr = attr_static | attr_move_never
	endif
	more = 0	// turn it off
	src.update
	RETURN 1

[TEMPLATE t_mana_pack]
	CONTAINER=i_bag
	COLOR=0543
	ITEM=i_potion_manatotal
	ITEM=i_potion_manatotal
	ITEM=i_potion_manatotal

[TEMPLATE t_mage_pack]
	CONTAINER=i_bag
	COLOR=0487
	ITEM=i_reag_black_pearl, 50
	ITEM=i_reag_blood_moss, 50
	ITEM=i_reag_ginseng, 50
	ITEM=i_reag_garlic, 50
	ITEM=i_reag_sulfur_ash, 50
	ITEM=i_reag_spider_silk, 50
	ITEM=i_reag_mandrake_root, 50
	ITEM=i_reag_nightshade, 50

[TYPEDEF t_arena_exit]
On=@Step
	if <color>==0
		src.message Closed
		return 1
	endif

	if (<src.flags> & statf_dead) || (<src.body>==c_ghost_man) || (<src.body>==c_ghost_woman)
		src.hits = <src.str>
		src.flags = <src.flags> & ~statf_dead
		if <src.body>==c_ghost_man
			src.id=c_man
		else
			src.id=c_woman
		endif
		src.body = <src.obody>
		src.color = <src.ocolor>
		if <src.restest 1 i_deathshroud>
			src.consume 1 i_deathshroud
		endif
	endif

	src.hits = <src.str>
	src.mana = <src.int>
	src.stamina = <src.dex>
	src.go <morep>
	return 1

//#################
// Auto-unequipper
//#################

[TYPEDEF t_auto_unequip]
On=@Step
	if <more>==0
		if <src.findlayer(layer_hand1).id> > 0
			src.findlayer(layer_hand1).remove
		endif
		if <src.findlayer(layer_hand2).id> > 0
			src.findlayer(layer_hand2).remove
		endif
		if <src.findlayer(layer_shoes).id> > 0
			src.findlayer(layer_shoes).remove
		endif
		if <src.findlayer(layer_pants).id> > 0
			src.findlayer(layer_pants).remove
		endif
		if <src.findlayer(layer_shirt).id> > 0
			src.findlayer(layer_shirt).remove
		endif
		if <src.findlayer(layer_helm).id> > 0
			src.findlayer(layer_helm).remove
		endif
		if <src.findlayer(layer_gloves).id> > 0
			src.findlayer(layer_gloves).remove
		endif
		if <src.findlayer(layer_ring).id> > 0
			src.findlayer(layer_ring).remove
		endif
		if <src.findlayer(layer_light).id> > 0
			src.findlayer(layer_light).remove
		endif
		if <src.findlayer(layer_collar).id> > 0
			src.findlayer(layer_collar).remove
		endif
		if <src.findlayer(layer_half_apron).id> > 0
			src.findlayer(layer_half_apron).remove
		endif
		if <src.findlayer(layer_chest).id> > 0
			src.findlayer(layer_chest).remove
		endif
		if <src.findlayer(layer_wrist).id> > 0
			src.findlayer(layer_wrist).remove
		endif
		if <src.findlayer(layer_tunic).id> > 0
			src.findlayer(layer_tunic).remove
		endif
		if <src.findlayer(layer_ears).id> > 0
			src.findlayer(layer_ears).remove
		endif
		if <src.findlayer(layer_arms).id> > 0
			src.findlayer(layer_arms).remove
		endif
		if <src.findlayer(layer_cape).id> > 0
			src.findlayer(layer_cape).remove
		endif
		if <src.findlayer(layer_robe).id> > 0
			src.findlayer(layer_robe).remove
		endif
		if <src.findlayer(layer_skirt).id> > 0
			src.findlayer(layer_skirt).remove
		endif
		if <src.findlayer(layer_legs).id> > 0
			src.findlayer(layer_legs).remove
		endif
	else
		if <src.findlayer(layer_hand1).id> > 0
			src.findlayer(layer_hand1).unequip
		endif
		if <src.findlayer(layer_hand2).id> > 0
			src.findlayer(layer_hand2).unequip
		endif
		if <src.findlayer(layer_shoes).id> > 0
			src.findlayer(layer_shoes).unequip
		endif
		if <src.findlayer(layer_pants).id> > 0
			src.findlayer(layer_pants).unequip
		endif
		if <src.findlayer(layer_shirt).id> > 0
			src.findlayer(layer_shirt).unequip
		endif
		if <src.findlayer(layer_helm).id> > 0
			src.findlayer(layer_helm).unequip
		endif
		if <src.findlayer(layer_gloves).id> > 0
			src.findlayer(layer_gloves).unequip
		endif
		if <src.findlayer(layer_ring).id> > 0
			src.findlayer(layer_ring).unequip
		endif
		if <src.findlayer(layer_light).id> > 0
			src.findlayer(layer_light).unequip
		endif
		if <src.findlayer(layer_collar).id> > 0
			src.findlayer(layer_collar).unequip
		endif
		if <src.findlayer(layer_half_apron).id> > 0
			src.findlayer(layer_half_apron).unequip
		endif
		if <src.findlayer(layer_chest).id> > 0
			src.findlayer(layer_chest).unequip
		endif
		if <src.findlayer(layer_wrist).id> > 0
			src.findlayer(layer_wrist).unequip
		endif
		if <src.findlayer(layer_tunic).id> > 0
			src.findlayer(layer_tunic).unequip
		endif
		if <src.findlayer(layer_ears).id> > 0
			src.findlayer(layer_ears).unequip
		endif
		if <src.findlayer(layer_arms).id> > 0
			src.findlayer(layer_arms).unequip
		endif
		if <src.findlayer(layer_cape).id> > 0
			src.findlayer(layer_cape).unequip
		endif
		if <src.findlayer(layer_robe).id> > 0
			src.findlayer(layer_robe).unequip
		endif
		if <src.findlayer(layer_skirt).id> > 0
			src.findlayer(layer_skirt).unequip
		endif
		if <src.findlayer(layer_legs).id> > 0
			src.findlayer(layer_legs).unequip
		endif
	endif
	return 0


[FUNCTION f_fixer]

	if <account.plevel> > 1
		return 1
	endif

	// check skills for skillclass 0
	if <Anatomy> > 100.0
		Anatomy = 100.0
	endif
	if <ItemID> > 100.0
		ItemID = 100.0
	endif
	if <ArmsLore> > 100.0
		ArmsLore = 100.0
	endif
	if <Begging> > 100.0
		Begging = 100.0
	endif
	if <Peacemaking> > 100.0
		Peacemaking = 100.0
	endif
	if <Camping> > 100.0
		Camping = 100.0
	endif
	if <Carpentry> > 100.0
		Carpentry = 100.0
	endif
	if <Cartography> > 100.0
		Cartography = 100.0
	endif
	if <Cooking> > 100.0
		Cooking = 100.0
	endif
	if <DetectingHidden> > 100.0
		DetectingHidden = 100.0
	endif
	if <Enticement> > 100.0
		Enticement = 100.0
	endif
	if <EvaluatingIntel> > 100.0
		EvaluatingIntel = 100.0
	endif
	if <Healing> > 100.0
		Healing = 100.0
	endif
	if <Fishing> > 100.0
		Fishing = 100.0
	endif
	if <Forensics> > 100.0
		Forensics=100.0
	endif
	if <Herding> > 100.0
		Herding=100.0
	endif
	if <Hiding> > 100.0
		Hiding=100.0
	endif
	if <Provocation> > 100.0
		Provocation=100.0
	endif
	if <Inscription> > 100.0
		Inscription=100.0
	endif
	if <LockPicking> > 100.0
		LockPicking=100.0
	endif
	if <Snooping> > 100.0
		Snooping=100.0
	endif
	if <Musicianship> > 100.0
		Musicianship=100.0
	endif
	if <Poisoning> > 100.0
		Poisoning=100.0
	endif
	if <SpiritSpeak> > 100.0
		SpiritSpeak=100.0
	endif
	if <Stealing> > 100.0
		Stealing=100.0
	endif
	if <Tailoring> > 100.0
		Tailoring=100.0
	endif
	if <Taming> > 100.0
		Taming=100.0
	endif
	if <TasteID> > 100.0
		TasteID=100.0
	endif
	if <Tinkering> > 100.0
		Tinkering=100.0
	endif
	if <Tracking> > 100.0
		Tracking=100.0
	endif
	if <Veterinary> > 100.0
		Veterinary=100.0
	endif
	if <Fencing> > 100.0
		Fencing=100.0
	endif
	if <Lumberjacking> > 100.0
		Lumberjacking=100.0
	endif
	if <Meditation> > 100.0
		Meditation=100.0
	endif
	if <Stealth> > 100.0
		Stealth=100.0
	endif
	if <RemoveTrap> > 100.0
		RemoveTrap=100.0
	endif
	if <Necromancy> > 100.0
		Necromancy=100.0
	endif

// race and class skills

	if !(<plot1> & plotmask_dwarf)

		if <Blacksmithing> > 100.0
			Blacksmithing = 100.0
		endif

		if <Mining> > 100.0
			if <findlayer(layer_hand1).id>!=wonder_hammer
				Mining = 100.0
			endif
		endif

		if <Parrying> > 100.0
			Parrying = 100.0
		endif
	else

	endif

	if !(<plot1> & plotmask_elf)

		if <Bowcraft> > 100.0
			Bowcraft = 100.0
		endif

		if <Archery> > 100.0
			if <findlayer(layer_hand2).id>!=i_bow_elven
				Archery = 100.0
			endif
		endif
	endif


	if !(<plot1> & plotmask_orc)

		if <Wrestling> > 100.0
			Wrestling = 100.0
		endif

		if <Macefighting> > 100.0
			Macefighting = 100.0
		endif
	endif

	if !(<plot1> & (plotmask_vampire | plotmask_paladin))

		if <Swordsmanship> > 100.0
			Swordsmanship = 100.0
		endif

	endif

// Other increasable skills
//	Tactics=100.0
//	Magery=100.0
//	MagicResistance=100.0

	return 1

[EOF]