//****************************************************************************
//SPHERE by : Menasoft ©1997-2004
//www.sphereserver.com
// All SPHERE script files and formats are copyright Menasoft & Partners.
// This file may be freely edited for personal use, but may not be distributed
// in whole or in part, in any format without express written permission from
// Menasoft & Partners.  All donations and contributions
// become the property of Menasoft & Partners.
//****************************************************************************
// FILE LAST UPDATED: 08-Nov-2004
VERSION=0.55i

[TYPEDEF T_WINDGATE]
ON=@STEP
	IF <SRC.MAGERY> > 70.0
		SRC.MESSAGE Welcome to Wind!
		SRC.GO Wind	// or proper x,y,z address for Wind
	ELSE
		SRC.MESSAGE You are not a worthy mage to enter Wind!
	ENDIF
	RETURN 1

[ITEMDEF I_BLOOD]
// This trigger works on the blood pools left by carving corpses. When the player dclicks the blood, it checks to see if the players skin color matches that of a vampire, in this example I used 038a as the vampire skin // color. It then makes a backpack check for a empty bottle, if there is a bottle, it creates a blood bottle in the players pack. When the vampire dclicks it, it heals him.
//blood
CATEGORY=Decoration - Dungeons and The Dead
SUBSECTION=Blood
DESCRIPTION=@
DUPELIST=0122b,0122c,0122d,0122e

ON=@Timer
REMOVE
RETURN 1

[ITEMDEF i_bottle_blood]
Name=bottle of blood
ID=i_bottle_black
WEIGHT=1

ON=@Create
	COLOR=020

ON=@DCLICK
	IF ! (<SRC.OSKIN>==038a) // this line checks for Xskin color. Color is 038a
		SRC.MESSAGE Only vampires may drink this blood.
		RETURN 1
	ELSEIF <SRC.HITS> >= <SRC.STR>
		SRC.MESSAGE You are already fully healed.
		RETURN 1
	ELSE
		SRC.SOUND=30
		SRC.SOUND=31
		SRC.HITS += { 10 1 15 5 20 1 } // This line will heal a player between 10 and 20 hits.
		REMOVE
		SRC.NEWITEM=i_bottle_empty
		SRC.ACT.BOUNCE
		SRC.MESSAGE Blood refresh you.
		RETURN 1
	ENDIF

CATEGORY=Custom Items
SUBSECTION=Race Items
DESCRIPTION=Bottle of Blood

[ITEMDEF I_HAIR_TIE]
//HAIR TIE
NAME=ponytail hair tie
ID=i_fishing_weight
TYPE=0

ON=@Create
	COLOR=038a // grey color

ON=@DCLICK
	IF <SRC.FINDLAYER(11).ID>==i_hair_LONG
		SRC.FINDLAYER(11).ID=i_hair_PONYTAIL
	ELSEIF <SRC.FINDLAYER(11).ID>==i_hair_PONYTAIL
		SRC.FINDLAYER(11).ID=i_hair_LONG
	ENDIF

//Invasion Spawns
//First add the following to your TUStrig,scp

[TYPEDEF T_INVADE_1]
//triger for easy monster invasions
ON=@DCLICK
	SRC.NEWITEM=I_SPAWN_INVADE
	SRC.ACT.P=<LINK.P>
	RETURN 1

[ITEMDEF I_SPAWN_INVADE]
//Invasion Spawn
ID=i_hole
TYPE=T_SPAWN_CHAR

ON=@Create
	TIMER=0
	MOREP=0,1,3
	MORE2=0
	ATTR=attr_move_never|attr_invis
	MORE={C_M_SKELETONARCHER 1 C_M_MUMMY 1 C_M_LICHE_LORD}

ON=@TIMER
	IF <AMOUNT>==0
		REMOVE
		RETURN 1
	ENDIF
	IF <MORE2>==1
		MOREP=1,1,3
		AMOUNT=0
		RETURN 0
	ENDIF

//Now go to where ya want the spawn to appear and drop a ground tile to match the area grass to grass etc.(remember where ya put it hehe)Now set the attr to 08090 (invis,static,never move)
//Now place a switch or lever or somethin on a wall or floor in a remote location and link the switch to the ground tile.
//I then place a sign over the switch so that ya know what it controls now just do it for every town and you can have multiple forces of monsters attack at almost the exact same time.
//As always replace the X's with your own trigger and item numbers.If ya find any bugs let me know
//
// easier method for invasion spawns
// i just added invasion spawns to my shard, but as i looked at the scripts i found out, that there is an easier method for this:

[TYPEDEF T_INVADE_2]
//other kind of invasion spawn
//by: MightY
ON=@DCLICK
	IF <LINK.AMOUNT>>0
		LINK.AMOUNT=0
		RETURN 0
	ELSE
		LINK.AMOUNT=5 // whatever value you like
		LINK.TIMER=1
		RETURN 0
	ENDIF

// now you can create the spawns as usual with hog( usethesettings:amount=1;min.time=0,max.time=1;max.distance=whatever you like) and then set the amount to 0 (hog unfortunately does not support 0-spawns, it converts them to 1) now all you have to do is link an item(lever or so) with this spawn.
//  So if you want an invasion just dclick the lever and if you want to turn it of dclick it again

[TYPEDEF T_INVADE_TRIG]
// Invasion lever trigger.
// By Daegon (aka Mercury)

ON=@DCLICK

IF (<SRC.isgm>) // have gm priv?
	IF (<LINK.AMOUNT>>0) // Toggle off
		SRC.MESSAGE You toggle the spawn to <NAME> off!
		LINK.AMOUNT=0
		LINK.MOREZ=0
		RETURN 1
	ELSE // Error Handling
		IF (<MORE1><1)
			SRC.MESSAGE MORE invalidly set.
			RETURN 1
		ELSEIF (<MORE2><0)
			SRC.MESSAGE MORE2 invalidly set.
			RETURN 1
		ELSEIF !(<LINK.TYPE>==T_SPAWN_CHAR)
			SRC.MESSAGE Linked TYPE invalidly set.
			RETURN 1
		ELSEIF !(<LINK.MORE!>>0)
			SRC.MESSAGE Linked MORE invalidly set.
			RETURN 1
		ELSEIF !(<LINK.MOREY>>0)
			SRC.MESSAGE Linked MOREY invalidly set.
			RETURN 1
		ELSE
			LINK.AMOUNT=<MORE1>
			LINK.MOREZ=<MORE2>
			SRC.MESSAGE You toggle the spawn to <NAME> on!
			SRC.MESSAGE Don't forget to turn it OFF!
			LINK.TIMER=1
			RETURN 1
		ENDIF
	ENDIF
ENDIF

// Create an item and /LINK it to the spawn bit. >8000 spawns work best, that way you get different creature types. the MORE property on the trigger item is how many NPCs to spawn. Keep it reasonable for best effects. the MORE2 property on the object is how far from the spawn bit the NPCs should wander. This is to keep them in an invasion area, and if they aren't killed they won't wander off to the four corners of the world.
//
// The rest is debugging to check if you linked it to an invalid spawn bit. :)
//
// Mercury,

[TYPEDEF T_TRAPPED]// Item Trap
// I have no idea why I made this, but you might want to fool with it
ON=@EQUIP
	SRC.SOUND=snd_SPELL_EXPLOSION
	SRC.DAMAGE={100 500}
	SRC.MESSAGE=The Item Was Trapped!

[TYPEDEF T_GATE_WEREWOLF]

ON=@DCLICK
//I would add more checks in here
IF <TIMER>>0
	//stop people from using last object to remorph
	SRC.ACT.MESSAGE You must have it in your pack to use it.
	RETURN 1
ELSE
	ATTR=attr_invis|attr_move_never|attr_decay
	MORE=<SRC.BODY>
	TIMER=300
	LINK=<SRC.SERIAL>
	P=<SRC.P>

	VAR.DEX1=<SRC.DEX>
	VAR.INT1=<SRC.INT>
	VAR.STR1=<SRC.STR>
	//set body to wolf, then change stats
	SRC.BODY=c_wolf //must go first, to ensure that the wolf's stats aren't used
	SRC.INT=<VAR.STR1>
	SRC.STR=<VAR.INT1>+25
	SRC.DEX=<eval <VAR.DEX1>+25>
	SRC.MANA=10
	SRC.HITS=<eval <VAR.INT1>+25>
	SRC.STAM=<eval <VAR.DEX1>+25>
	SRC.FIX

	SRC.MESSAGE Your body flows into the form of a werewolf!
	RETURN 0
ENDIF

ON=@TIMER
	VAR.DEX1=<LINK.DEX>
	VAR.INT1=<LINK.INT>
	VAR.STR1=<LINK.STR>
	LINK.BODY=<MORE1>
	LINK.STR=<VAR.INT1>
	LINK.INT=<eval <VAR.STR1>-25>
	LINK.DEX=<eval <VAR.DEX1>-25>
	LINK.MANA=<eval <VAR.STR1>-25>
	LINK.HITS=<VAR.INT1>
	LINK.STAM=<eval <VAR.DEX1>-25>
	LINK.FIX
	LINK.MESSAGE Your body returns to its original form.
	RETURN 1

[ITEMDEF i_key_witch_castle]
NAME=Witch's Castle Key
ID=i_key_iron

[ITEMDEF i_door_witch_castle]
// Witch's Castle Door

NAME=Witch's Castle Door
ID=i_door_metal
TYPE=T_DOOR_LOCKED
CATEGORY=Quest Items
SUBSECTION=Wizard of Oz
DESCRIPTION=Metal Door 1 (n / sw)

ON=@DCLICK
	IF (<SRC.RESTEST 1 i_key_witch_castle> == 0)
		SRC.MESSAGE Your entry is blocked
		RETURN 1
	ELSE
		TYPE=T_DOOR
		TIMER=30
	ENDIF
	RETURN 0

ON=@TIMER
	TYPE=T_DOOR
	RETURN 1

[TYPEDEF T_CHEST_LOCKED]

//This is how you make a chest with a lock. Add any item, then give it this trigger. Double click on the trigger to get a chest with 2 keys.
//It should be easy to add to the skills section.


// How do you give or set a trigger to an item?
// /set type T_CHEST_TRAP
// How to make a trapped chest #1
// /add I_CHEST_TRAP
// /set type T_CHEST_TRAP

// A player needs tinkering and gears to open this chest. You can set the following commands:
// /set more min // the min damage the trap will do.
// /set more2 max // the max damage the trap will do.
// /set morex amount // refers to the min amount a players tinkering has to be to disarm the chest.

// for the chests + locks use (/set type 8001)


// might not work!!!!!

// I have an item that used to function properly, where when you would double click it it would open a menu via the following command

[TYPEDEF T_GOSHRINE]
ON=@DCLICK
	SRC.MENU M_GOSHRINE

[MENU M_GOSHRINE]
Where would you like to go?
0 Shrine of Compassion
go 1856 876 0
0 Shrine of Honesty
go 4216 563 36
0 Shrine of Honor
go 1729 3527 3
0 Shrine of Humility
go 4274 3699 0
0 Shrine of Justice
go 1301 632 16
0 Shrine of Sacrifice
go 3354 287 4
0 Shrine of Spirituality
go 1600 2490 10
0 Shrine of Valor
go 2495 3931 0

[TYPEDEF T_JEDI_MORPH]
// Jedi Morph
// I don't know if it's my code, all I know is I made this one ;)
ON=@STEP
	SRC.TITLE=Jedi Knight
	SRC.STR=40
	SRC.DEX=60
	SRC.INT=50
	SRC.SYSMESSAGE=You are now a Jedi apprentice!
	SRC.GO=5605 1437 0

[ITEMDEF I_SEW_BARB]
NAME=barbarian sewing kit
ID=i_sewing_kit
VALUE=200
TYPE=T_SEWING_KIT

ON=@Create
	COLOR=0ddd

ON=@DCLICK
	IF ! (<SRC.RESTEST 1 i_knife_skinning>)
		SRC.MESSAGE You need a skinning knife to use with this kit.
		RETURN 1
	ENDIF
	IF (<SRC.TAILORING> > 100.0)
		SRC.TAILORING=100.0
	ENDIF
	IF ((<SRC.TAG.RACE> == RACE_Barb) || (<SRC.isGM>))
		SRC.MENU=M_ARMOR_BARBARIAN
		RETURN 1
	ELSE
		SRC.MESSAGE Only barbarians can use this tool.
		RETURN 1
	ENDIF


// This first menu is the one the sewing kit takes you to.
// This is my menu branch that opens up when the tool is used.
// I left in a bunch of options to show how to more than 1 armor type to it.
// You can add or delete different armor sections from this first menu.

[COMMENT MENU M_ARMOR_BARBARIAN]
Select the armor you would like to make.
ON=0 Serpent Armor
SRC.MENU=###
ON=0 Ettin Armor
SRC.MENU=###
ON=0 Bone Armor
SRC.MENU=M_ARMOR_BONE
ON=0 Ogre Armor
SRC.MENU=###
ON=0 Troll Armor
SRC.MENU=###
ON=0 Dragon Armor
SRC.MENU=###
ON=0 Wyrm Armor
SRC.MENU=###

// This is the main menu for the armor. I only have one item in it, to add more, just duplicate from the ON= down to
// the last line. Then paste the copied section right below the end of the this section. Then just edit the resource
// checks and change the I_BONE_CHEST aer the NEWITEM= To the item you want to be created.

[MENU M_ARMOR_BONE]
Bone Armor
ON=i_bone_chest Bone Tunic (40 Bones)
	IF (<SRC.TAILORING><30.0)
		SRC.MESSAGE You are not skilled enough to make that.
		RETURN 1
	ENDIF
	IF ! (<SRC.RESTEST 40 i_reag_bone>)
		SRC.MESSAGE You do not have enough bones to make this.
		RETURN 1
	ENDIF
	IF (<SRC.TAILORING>>99.9)
		IF (RAND(3)==1) || (RAND(3)==0)
			SRC.SOUND=0248
			SRC.MESSAGE You cut and tie the bones together.
			SRC.MESSAGE You have made a bone tunic.
			SRC.CONSUME=40 i_reag_bone
			NEWITEM=I_BONE_CHEST
			SRC.ACT.NAME=bone tunic crafted by <SRC.NAME>
			SRC.ACT.BOUNCE
			SRC.TAILORING += { 0.1 5 0.2 5 0.3 4 0.4 3 0.0 2 0.0 3 }
			SRC.MESSAGE With your exceptional skill, you engrave your name onto this item.
		ELSE
			SRC.SOUND=0248
			SRC.MESSAGE You failed to make anything.
			SRC.CONSUME=5 i_reag_bone
		ENDIF
	ELSEIF (<SRC.TAILORING><100.0)
		IF (RAND(3)==1) || (RAND(3)==0)
			SRC.SOUND=0248
			SRC.MESSAGE You cut tie the bones together.
			SRC.MESSAGE You have made a bone tunic.
			SRC.CONSUME=20 i_reag_bone
			SRC.NEWITEM=i_bone_chest
			SRC.ACT.BOUNCE
			SRC.TAILORING += { 0.1 5 0.2 5 0.3 4 0.4 3 0.0 2 0.0 3 }
		ELSE
			SRC.SOUND=0248
			SRC.MESSAGE You failed to make anything.
			SRC.CONSUME=5 i_reag_bone
		ENDIF
	ENDIF

[TYPEDEF T_MAGIC_STONE]
//on 2xclicking of a stone
//set INT to 60
//Can be done with any skill or stat to any amount
ON=@DCLICK
	VAR.TEMP=60
	IF <SRC.INT><60
		SRC.MESSAGE You feel a surge of magical energy go through your body.
		SRC.MESSAGE You feel a lot more intelligent then you were 2 seconds ago.
		SRC.INT=<VAR.TEMP>
		SRC.MANA=<VAR.TEMP>
	ELSE
		SRC.MESSAGE You are already to powerful for the effects of this stone to work!
	ENDIF
	RETURN 1

[ITEMDEF I_CHEST_TRAP]
// Add items I_CHEST_TRAP and put trigger T_CHEST_TRAP on it and sit back and watch the fun.
// Trapped chest #1
ID={ i_chest_metal 1 i_chest_metal_brass 1 I_CHEST_WOODEN_BRASS 1}
TYPE=T_CONTAINER

CATEGORY=Provisions - Miscellaneous
SUBSECTION=Containers
DESCRIPTION=Trapped chest 1

ON=@Create
ATTR=attr_move_never

[TYPEDEF T_CHEST_TRAP]
//Chest trigger, works with item I_CHEST_TRAP
//1. Check tinkering
//2. Check tools (no, 50% blow up)
//3. Check for gear
//4. Blow up if failed
//5. Consume gear

ON=@DCLICK
	IF <SRC.RESTEST 1 i_GEARS>
		SRC.CONSUME 1 i_GEARS
	ELSE
		SRC.MESSAGE You fail to disarm the trap.
		SRC.DAMAGE=<eval <MORE1> - <MORE2>>
		SRC.NEWITEM=i_FIRE_COLUMN
		SRC.ACT.ATTR attr_can_decay|attr_move_never
		SRC.ACT.TIMER 2
		SRC.UPDATE
		SRC.SOUND=snd_SPELL_EXPLOSION
		RETURN 0
	ENDIF
	IF <SRC.TINKERING>>=<MOREX>
		SRC.MESSAGE You attempt to disarm the trap.
		IF <SRC.RESTEST 1 i_tinker_tools>
			IF RAND(2)
				SRC.MESSAGE You disarm the trap successfully.
				TIMER=<MOREY>
				MOREZ=1
				TYPE=T_CONTAINER
				RETURN 0
			ELSE
				SRC.MESSAGE You fail to disarm the trap.
				SRC.DAMAGE=<eval <MORE1> - <MORE2>>
				SRC.NEWITEM=i_FIRE_COLUMN
				SRC.ACT.ATTR attr_can_decay|attr_move_never
				SRC.ACT.TIMER 2
				SRC.UPDATE
				SRC.SOUND=snd_SPELL_EXPLOSION
				RETURN 0
			ENDIF
		ELSE
			IF RAND(10)==5
				SRC.MESSAGE You disarm the trap successfully.
				TIMER=<MOREY>
				MOREZ=1
				TYPE=T_CONTAINER
				RETURN 0
			ELSE
				SRC.MESSAGE You fail to disarm the trap.
				SRC.DAMAGE=<eval <MORE1> - <MORE2>>
				SRC.NEWITEM i_fire_column
				SRC.ACT.ATTR attr_can_decay|attr_move_never
				SRC.ACT.TIMER 2
				SRC.UPDATE
				SRC.SOUND snd_spell_explosion
				RETURN 0
			ENDIF
		ENDIF
	ENDIF

ON=@TIMER
	MOREZ=0
	RETURN 1

//
// Here is some sample code to get it to work.
// How to make a trapped chest #1
// /add I_CHEST_TRAP
// /set type T_CHEST_TRAP
//
// A player needs tinkering and gears to open this chest. You can set the following commands:
// /set more min // the min damage the trap will do.
// /set more2 max // the max damage the trap will do.
// /set morex amount // refers to the min amount a players tinkering has to be to disarm the chest.
// ---------
//   example of a workable class script. If any of you guys hosting script archives want to touch base, I'll pass along the entire script set.

[EOF]

