[EVENTS E_ALLIANCE_DRAGONS]
ON=@Death
IF (<TAG0.LIFETIER> == 1)
	IF (<BASEID> == c_platinum_dragon)
	LOCAL.ALIGN=1
	ELSE
	LOCAL.ALIGN=2
	ENDIF
	FOR 0 <EVAL <ATTACKER>-1>
	REF1=<ATTACKER.<dLOCAL._FOR>>
		IF (<REF1.FLAGS>&STATF_PET)
		REF1=<REF1.MEMORYFINDTYPE.MEMORY_IPET.LINK>
		ENDIF
		IF (<REF1.ISPLAYER>)
			IF (<REF1.GUILD>)
				IF (<REF1.GUILD.ALIGN> == 1)
				LOCAL.ORDERPOINTS += <ATTACKER.<dLOCAL._FOR>.DAM>
				ELSE
				LOCAL.CHAOSPOINTS += <ATTACKER.<dLOCAL._FOR>.DAM>
				ENDIF
			ENDIF
			IF (<LOCAL.ALIGN> == 1)
				IF (<LOCAL.ORDERPOINTS> >= <LOCAL.CHAOSPOINTS>)
				TAG.SUCCESS=1
				ENDIF
			ELSE
				IF (<LOCAL.CHAOSPOINTS> >= <LOCAL.ORDERPOINTS>)
				TAG.SUCCESS=1
				ENDIF
			ENDIF
			IF (<REF1.GUILD> == <TAG0.GUILD>)
			REF1.TAG.GUILDDOM.RECEIVEPRIZE=1
			ENDIF
		ENDIF
	ENDFOR
	NEWLOOT=<HVAL <DEF.minorartis>>
	FOR 15
	RANDMAGICITEMGREAT
	ENDFOR
	NEWLOOT=<HVAL <DEF.RANDOM_ML_SETS_DROP_LIST>>
	IF (<FLOATVAL 0.33> > <RANDOMDOUBLE>)
	NEWLOOT=i_crimson_cinture
	ENDIF
	FOR 20
	NEWLOOT=<HVAL <DEF.random_peerless_reagent>>
	ENDFOR
	FOR 5
	NEWLOOT=i_sea_mapa_tesouro
	ENDFOR
ENDIF

ON=@DeathCorpse
REF1=<TAG0.GUILD> //guild that started the domination
REF2=<TAG0.PEDESTAL> //pedestal currently in town
IF (<BASEID> == c_platinum_dragon)
LOCAL.ALIGN=1
ELSE
LOCAL.ALIGN=2
ENDIF
IF (<TAG0.SUCCESS>)
	IF (<LOCAL.ALIGN> == 1)
	SERV.B @88 <REF1.NAME> (Order) successfuly dominated <DEF.GUILDDOM_TOWN_<dTAG0.TOWN>>!
	REF2.REGION.GUARDED=1
	ELSE
	SERV.B @35 <REF1.NAME> (Chaos) successfuly dominated <DEF.GUILDDOM_TOWN_<dTAG0.TOWN>>!
	REF2.REGION.GUARDED=0
	ENDIF
REF2.REGION.EVENTS +R_DOMINATED
REF2.REGION.TAG.GUILDDOM.GUILD=<REF1>
TRY VAR.GUILDDOM.<DEF.GUILDDOM_TOWN_<dTAG0.TOWN>>=2
SERV.NEWITEM i_worldgem_bit
NEW.TYPE=T_TOWNDOMINATED
NEW.ATTR=ATTR_INVIS|ATTR_MOVE_NEVER
NEW.COLOR=04ac
NEW.NAME=Town Dominated (DONT DELETE!!!!)
NEW.MORE1=<eval (60*60*24*5)>
NEW.TAG.ALIGN=<LOCAL.ALIGN>
NEW.TAG.TOWN=<TAG0.TOWN>
NEW.TIMER=1
NEW.P=<REF2.P>
REF1.ALLMEMBERS -1,F_GUILDDOM_GIVE_PRIZE <DEF.GUILDDOM_TOWN_<dTAG0.TOWN>>
ELSE
	IF (<LOCAL.ALIGN> == 1)
	SERV.B @88 <REF1.NAME> (Order) failed to dominate <DEF.GUILDDOM_TOWN_<dTAG0.TOWN>>!
	ELSE
	SERV.B @35 <REF1.NAME> (Chaos) failed to dominate <DEF.GUILDDOM_TOWN_<dTAG0.TOWN>>!
	ENDIF
TRY VAR.GUILDDOM.<DEF.GUILDDOM_TOWN_<dTAG0.TOWN>>=
REF2.REGION.GUARDED=1
REF1.TAG0.ALLYPOINTS += <EVAL <DEF.GUILDDOM_TOWNVAL_<dTAG0.TOWN>>/2>
ENDIF
REF2.REMOVE
FOR 6
serv.newitem=i_fire_column
new.p=<p>
new.move <R5>,<R5>
new.attr=attr_move_never|attr_decay
new.timer=20
ENDFOR
FOR 3
serv.newitem i_osi_treasure_map
new.tag.level=6
bounce <new>
ENDFOR
serv.newitem=i_gold_champion
new.p=<p>
new.timer=1

[CHARDEF 198]
DEFNAME=c_platinum_dragon
NAME=Platinum Dragon
DAM=29,40
ARMOR=80
CAN=MT_WALK
MOVERATE=50
FOODTYPE=t_meat_raw
TAG.MANALEECH=60
RESDISPDNID=c_greater_dragon
RESLEVEL=5
RESDISPDNHUE=33
SOUND=snd_MONSTER_DRAGON1
ICON=i_pet_dragon
TAG.IAMACHAMPION=1

ON=@Create
TAG.LIFETIER=10
KARMA=-10000
FAME=10000
STR=2200
DEX=256
INT=1200
MAXHITS=16000
NPC=BRAIN_DRAGON
WRESTLING=130.0
TACTICS=130.0
MAGICRESISTANCE=120.0
ANATOMY=120.0
MAGERY=125.0
EVALUATINGINTEL=125.0

ON=@Death
TAG0.LIFETIER --
IF (<TAG0.LIFETIER>)
HITS=<MAXHITS>
ACTION -1
RETURN 1
ENDIF

ON=@Hit
IF (<R10> == 1)
SAY @,,2 1007046
ENDIF

ON=@NpcLookAtChar
IF (<SRC.FLAGS>&STATF_PET)
	IF (<SRC.NPC> == brain_dragon)
		IF (<R6> == 1)
		SRC.MESSAGE @,,2 1043255,<SRC.NAME>
		SRC.TRIGGER @PetDesert
		SRC.RELEASE
		ENDIF
	ENDIF
ENDIF

[CHARDEF 197]
DEFNAME=c_crimson_dragon
NAME=Crimson Dragon
DAM=29,40
ARMOR=80
CAN=MT_WALK
MOVERATE=50
FOODTYPE=t_meat_raw
TAG.MANALEECH=60
RESDISPDNID=c_greater_dragon
RESLEVEL=5
RESDISPDNHUE=33
SOUND=snd_MONSTER_DRAGON1
ICON=i_pet_dragon
TAG.IAMACHAMPION=1

ON=@Create
TAG.LIFETIER=10
KARMA=-10000
FAME=10000
STR=2200
DEX=256
INT=1200
MAXHITS=16000
NPC=BRAIN_DRAGON
WRESTLING=130.0
TACTICS=130.0
MAGICRESISTANCE=120.0
ANATOMY=120.0
MAGERY=125.0
EVALUATINGINTEL=125.0

ON=@Death
TAG0.LIFETIER --
IF (<TAG0.LIFETIER>)
HITS=<MAXHITS>
ACTION -1
RETURN 1
ENDIF

ON=@Hit
IF (<R10> == 1)
SAY @,,2 1007046
ENDIF

ON=@NpcLookAtChar
IF (<SRC.FLAGS>&STATF_PET)
	IF (<SRC.NPC> == brain_dragon)
		IF (<R6> == 1)
		SRC.MESSAGE @,,2 1043255,<SRC.NAME>
		SRC.TRIGGER @PetDesert
		SRC.RELEASE
		ENDIF
	ENDIF
ENDIF

[EOF]