[EVENTS e_Horses]
ON=@ClientToolTip
IF (<FLAGS>&statf_pet)
SRC.ADDCLILOC 502006
ENDIF

ON=@ReceiveItem
IF (<ARGO.ISFOOD>)
FOOD=<MAXFOOD>
EMOTE eats <ARGO.NAME>
ARGO.REMOVE
ENDIF

ON=@NPCLOSTTELEPORT
RETURN 1

ON=@Hunger
IF (!(<TAG0.DONO>))
TAG.DONO=<OWNER>
ENDIF
REF1=<TAG0.DONO>
IF (<REF1>)
	IF (<DISTANCE <REF1>> >= 40) && (!(<FLAGS>&statf_ridden))
	GO <REF1.P>
	ENDIF
ENDIF
food=<maxfood>
return 1

ON=@SpellEffect
REF1=<TAG0.DONO>
IF (!(<REF1>))
REF1=<OWNER>
ENDIF
IF (<REF1> == <SRC>)
	IF (<SERV.SPELL.<ARGN1>.FLAGS>&SPELLFLAG_HARM)
	RETURN 1
	ENDIF
ENDIF

ON=@Kill
IF (!(<TAG0.DONO>))
TAG.DONO=<OWNER>
ENDIF
REF1=<TAG0.DONO>
IF (<REF1>)
	IF (<DISTANCE <REF1>> >= 40) && (!(<FLAGS>&statf_ridden))
	GO <REF1.P>
	ENDIF
ENDIF
IF (!(<FLAGS>&STATF_CONJURED))
	IF (<TAG0.CANTRAINSTRTO>)
		IF (<OSTR> < <TAG0.CANTRAINSTRTO>)
		OSTR ++
		MAXHITS ++
		ENDIF
	ENDIF
	IF (<TACTICS> < 100.0)
	TACTICS += 0.1
	ENDIF
	IF (<WRESTLING> < 100.0)
	WRESTLING += 0.1
	ENDIF
	IF (<ANATOMY> < 100.0)
	ANATOMY += 0.1
	ENDIF
	IF (<MAGICRESISTANCE> < 110.0)
	ANATOMY += 0.1
	ENDIF
	IF (<MAGERY>)
		IF (<MAGERY> < 100.0)
		MAGERY += 0.1
		ENDIF
	ENDIF
	IF (<EVALUATINGINTEL>)
		IF (<EVALUATINGINTEL> < 100.0)
		EVALUATINGINTEL += 0.1
		ENDIF
	ENDIF
ENDIF

ON=@PetDesert
IF (!(<FLAGS>&STATF_CONJURED))
	IF (!(<TAG0.DONO>))
	REF1=<OWNER> //owner
	ELSE
	REF1=<TAG0.DONO>
	ENDIF
	IF (<REF1>)
		IF (!(<TAG0.FOLLOWERCONSUME>))
		REF1.CURFOLLOWER --
		ELSE
		REF1.CURFOLLOWER -= <TAG0.FOLLOWERCONSUME>
		ENDIF
	ENDIF
FINDID.i_owner_check.REMOVE
	IF !(<FINDID.i_released_remove_timer>)
	SERV.NEWITEM i_released_remove_timer
	NEW.CONT=<UID>
	NEW.TIMER=<DEF.TAMING_RELEASED_REMOVETIME>
	ENDIF
	IF (<TAG0.BONDEDTIME>)
	TAG.BONDEDTIME
	ENDIF
	IF (<ISEVENT.e_bonded>)
	TAG.BONDED=
	EVENTS -e_bonded
	ENDIF
TAG.DONO=
TIMERF 1,RESENDTOOLTIP 1
ENDIF
RETURN 1

ON=@Death
IF (!(<TAG0.DONO>))
TAG.DONO=<OWNER> //owner
ENDIF
IF (!(<ISEVENT.e_bonded>)
TAG.BONDEDTIME=
ENDIF

ON=@Destroy
TIMERF CLEAR
IF (!(<FLAGS>&STATF_CONJURED)) && (!(<FINDID.i_released_remove_timer>)) && (!(<TAG0.DESTROYED>))
	IF (!(<TAG0.DONO>))
	REF1=<OWNER> //owner
	ELSE
	REF1=<TAG0.DONO>
	ENDIF
	IF (<REF1>)
		IF (!(<TAG0.FOLLOWERCONSUME>))
		REF1.CURFOLLOWER --
		ELSE
		REF1.CURFOLLOWER -= <TAG0.FOLLOWERCONSUME>
		ENDIF
	TAG.DONO=
	TAG.DESTROYED=1
		IF (<TAG0.BONDEDTIME>)
		TAG.BONDEDTIME
		ENDIF
	ENDIF
ENDIF

ON=@Attack
IF (!(<FLAGS>&STATF_CONJURED)) && (<FLAGS>&STATF_PET)
REF1=<OWNER>
	IF (<SRC.ISPLAYER>) && (<OWNER.ISPLAYER>)
	RETURN 1
	ELIF (<SRC.FLAGS>&STATF_PET)
		IF (<REF1> == <SRC.OWNER>) || (<SRC.OWNER.ISBENEFICIAL <REF1.UID>>)
		RETURN 1
		ENDIF
	ENDIF
FLOAT.CONTROLCHANCE=<FLOATVAL (<F_PETCONTROL <REF1>>/100)>
	IF (<REF1.FLAGS>&STATF_DEAD)
	FLOAT.CONTROLCHANCE=1.000000
	ENDIF
	IF (<FLOAT.CONTROLCHANCE> <= <RANDOMDOUBLE>) && (5 > <R100>)
	MESSAGE @,,2 1043255,<NAME>
	TRIGGER @PetDesert
	RELEASE
	RETURN 1
	ENDIF
ENDIF

ON=@GetHit
IF ((<SRC.ISPLAYER>) && (<REGION.FLAGS>&REGION_FLAG_NO_PVP)) && (<OWNER.ISPLAYER>)
RETURN 1
ENDIF
IF (!(<FLAGS>&STATF_CONJURED)) && (<FLAGS>&STATF_PET)
REF1=<TAG0.DONO>
	IF (!(<REF1>))
	REF1=<OWNER>
	ENDIF
	IF (<REF1> == <SRC>)
	RETURN 1
	ENDIF
	IF (<SRC.FLAGS>&STATF_PET)
		IF (<REF1> == <SRC.OWNER>)
		RETURN 1
		ELIF (<SRC.OWNER.ISINPARTY>) && (<REF1.ISINPARTY>)
			IF (<SRC.OWNER.PARTY.ISSAMEPARTYOF <REF1>>)
			RETURN 1
			ENDIF
		ENDIF
	ENDIF
ENDIF

ON=@FameChange
RETURN 1

ON=@KarmaChange
RETURN 1

ON=@NPCLookAtChar
IF (<OWNER>)
IF (<MAGERY>) && ((<NPC> == brain_monster) || (<NPC> == brain_dragon) || (<NPC> == brain_human) || (<NPC> == brain_berserk))
	IF (<FLOATVAL 0.03> > <RANDOMDOUBLE>)
		IF (!(<SRC.FLAGS>&STATF_DEAD)) && (!(<SRC.FLAGS>&STATF_INVUL))
			IF (<SRC.ISBENEFICIAL <OWNER>>) && (!(<SRC.FLAGS>&STATF_DEAD)) && (!(<SRC.FLAGS>&STATF_INVUL))
				WHILE (!(<LOCAL.SPELL>))
					DORAND 3
						BEGIN
							IF (!(<SRC.FINDID.i_rune_bless>))
							LOCAL.SPELL=s_bless
							ENDIF
						END
					LOCAL.SPELL=s_greater_heal
						BEGIN
							IF (<SRC.FLAGS>&STATF_POISONED)
							LOCAL.SPELL=s_cure
							ENDIF
						END
					ENDDO
				ENDWHILE
			SRC.SPELLEFFECT <LOCAL.SPELL>,<MAGERY>,<UID>
			ENDIF
		ENDIF
	ENDIF
	IF (<SRC.ISBENEFICIAL <OWNER>>) && (<SRC.FLAGS>&STATF_DEAD) && (<FLOATVAL 0.5> > <RANDOMDOUBLE>)
	SRC.SPELLEFFECT S_resurrection,100.0,<UID>
	ENDIF
ENDIF
ENDIF

[EOF]