[DIALOG D_GREEDY_HEALER_RESS]
280,190
SRC.CLOSEALLDIALOGS
SAY @,,2 1060017
PAGE 0
gumppictiled 65 33 320 44 201
gumppic 22 33 206
gumppic 380 33 207
gumppictiled 22 77 44 280 202
gumppictiled 380 77 44 280 203
gumppictiled 65 355 320 44 233
gumppic 380 355 205
gumppic 22 355 204
gumppictiled 66 77 320 300 200

xmfhtmlgump 180 60 70 25 1015222 0 0

xmfhtmlgump 75 100 290 150 1060018 1 1

button 90 285 4005 4006 1 0 1
xmfhtmlgump 125 288 150 25 1060015 0 0
button 90 315 4005 4006 1 0 0
xmfhtmlgump 125 318 250 25 1060016 0 0

[DIALOG D_GREEDY_HEALER_RESS BUTTON]
ON=1
IF (!(<CANSEELOS>))
MESSAGE @,,2 502390
ELIF (<SRC.GOLD> < 5000)
SAY @,,2 1060020
ELSE
SRC.SPELLEFFECT s_resurrection,1200,<UID>
SRC.SYSMESSAGE @,,2 1060021,5000
SRC.GOLD -= 5000
ENDIF

ON=0
SRC.SYSMESSAGE @,,2 1060019

[CHARDEF c_greedy_healer]
ID=c_man
NAME=Rowland the healer
CAN=MT_NONMOVER
CATEGORY=Addon
SUBSECTION=Doom
DESCRIPTION=Greedy Healer

on=@create
NPC=Brain_human
FLAGS |= statf_invul
str=100
dex=100
int=100
color=03fa
SPIRITSPEAK=1200
MAGERY=1200
HEALING=1200
KARMA=10000
FAME=9000
ITEMNEWBIE=i_robe
COLOR=colors_all
ITEMNEWBIE=i_hair_long
ITEMNEWBIE=i_lantern

ON=@NPCLookAtChar
IF (<SRC.ISPLAYER>)
	IF (<SRC.FLAGS>&STATF_DEAD)
		IF (!(<SRC.ISDIALOGOPEN D_GREEDY_HEALER_RESS>)) && (!(<SRC.ISDIALOGOPEN d_RESURRECT_CONFIRM>))
		SDIALOG D_GREEDY_HEALER_RESS
		ENDIF
	ENDIF
ENDIF
RETURN 1

[CHARDEF c_sylvana_sorceress]
ID=c_woman
NAME=Victoria The Sorceress
CAN=MT_NONMOVER
CATEGORY=Addon
SUBSECTION=Doom
DESCRIPTION=Sylvana
DESIRES=i_reag_daemon_bone

on=@create
FLAGS |= statf_invul
title=the sorceress
str=100
dex=100
int=100
color=00
ITEMNEWBIE=i_robe
COLOR=01
ITEMNEWBIE=i_hair_long

on=@gethit
return 1

on=@spelleffect
return 1

[ITEMDEF i_doom_bone_daemon_remover]
ID=i_memory
TYPE=T_EQ_SCRIPT
NAME=bone daemon remover

ON=@Timer
CONT.REMOVE
RETURN 1

[EVENTS e_questsylvana_daemon]
ON=@Death
NEWLOOT i_golden_skull
REGION.ALLCLIENTS sysmessageloc -1,1050035

[ITEMDEF i_golden_skull]
ID=i_bone_skull
NAME=golden skull
TYPE=T_NORMAL
TAG.NOVENDOR=1

ON=@Create
COLOR=084d

[ITEMDEF i_bell_doom]
ID=i_beehive
TYPE=T_NORMAL
NAME=bell of the dead
TAG.NOVENDOR=1
CAN=CAN_I_DCIGNORELOS

ON=@Timer
IF (<MORE1>)
MORE1=0
MORE2=0
ENDIF
RETURN 1

ON=@Dclick
IF (((<TIMER> > -1) || (<MORE2>)) && !(<MORE1>))
MESSAGE @,,2 1050010
ELIF (<TIMER> > -1)
MESSAGE @,,2 1050017
ELIF !(<SRC.FINDID.i_golden_skull>)
SERV.NEWNPC=C_CHYLOTH
NEW.GO=417,247,4,3
NEW.FLAGS |= statf_invul
	DORAND 5
	NEW.SAY @38,,2 1050011
	NEW.SAY @38,,2 1050013,<SRC.NAME>
	NEW.SAY @38,,2 1050012
	NEW.SAY @38,,2 1050014
	NEW.SAY @38,,2 1050015
	ENDDO
NEW.TIMERF 60,REMOVE
TIMER=60
SERV.NEWNPC c_skeletal_dragon
NEW.P=420,252,0,3
NEW.HOME=420,252,0,3
NEW.HOMEDIST=10
NEW.REMOVETIMER=<EVAL 60*20>
NEW.UPDATE
ELSE
SERV.NEWNPC=C_CHYLOTH
NEW.GO=417,247,4,3
NEW.FLAGS |= statf_invul
	IF (<SRC.ISINPARTY>)
		FOR 0 <EVAL <SRC.PARTY.MEMBERS>-1>
		REF2=<SRC.PARTY.MEMBER.<LOCAL._FOR>.UID>
			IF (<REF2.DISTANCE <SRC>> <= 15) && (<REF2> != <SRC>)
			TRYSRC <REF2.UID> SRC.DIALOG D_FERRY_PASS
			ENDIF
		ENDFOR
	ENDIF
SRC.GO 424,329,0,3
NEW.SAY @55,,2 1050016
NEW.LEVEL=<UID>
NEW.TIMERF 60,REMOVE
SRC.CONSUME i_golden_skull
MORE2=1
MORE1=1
TIMER=60
ENDIF
RETURN 1

[CHARDEF C_CHYLOTH]
ID=C_MAN
CAN=MT_NONMOVER|MT_EQUIP|MT_USEHANDS
NAME=Chyloth
CATEGORY=Doom
SUBSECTION=Chyloth
DESCRIPTION=Chyloth

ON=@Create
STR=1
INT=1
STR=1
COLOR=01
ITEMNEWBIE=i_deathshroud
COLOR=36

[DIALOG D_FERRY_PASS]
150,50
noclose

src.closealldialogs
PAGE 0
gumppic 0 0 3600

gumppictiled 0 14 15 200 3603
gumppictiled 380 14 14 200 3605
gumppic 0 201 3606
gumppictiled 15 201 370 16 3607
gumppictiled 15 0 370 16 3601
gumppic 380 0 3602
gumppic 380 201 3608
gumppictiled 15 15 365 190 2624

radio 30 140 9727 9730 1 1
xmfhtmlgumpcolor 65 145 300 25 1050050 0 0 32767 // Yes, let's go!

radio 30 175 9727 9730 0 0
xmfhtmlgumpcolor 65 178 300 25 1050049 0 0 32767 // No thanks, I'd rather stay here.

xmfhtmlgumpcolor 30 20 360 35 1050047 0 0 32767 // Another player has paid Chyloth for your passage across lake Mortis:
xmfhtmlgumpcolor 30 105 345 40 1050048 0 0 32767 // Do you wish to accept their invitation at this time?

gumppic 65 72 5605
gumppictiled 80 90 200 1 9107
gumppictiled 95 92 200 1 9157

IF (<SRC.ISINPARTY>)
dtext 90 70 1645 <SRC.PARTY.MASTER.NAME>
ENDIF

button 290 175 247 248 1 0 2

gumppictiled 15 14 365 1 9107
gumppictiled 380 14 1 190 9105
gumppictiled 15 205 365 1 9107
gumppictiled 15 14 1 190 9105
gumppictiled 0 0 395 1 9157
gumppictiled 394 0 1 217 9155
gumppictiled 0 216 395 1 9157
gumppictiled 0 0 1 217 9155

[DIALOG D_FERRY_PASS BUTTON]
ON=2
IF (<ARGCHK[1]>)
	IF (!(STRCMPI(Doom,<SRC.REGION.NAME>)))
	SYSMESSAGELOC -1,1050054,<NAME> // ~1_NAME~ has accepted your invitation to cross lake Mortis.
	SRC.GO 424,329,0,3
	ELSE
	SRC.SYSMESSAGELOC -1,1050051 // The invitation has been revoked.
	ENDIF
ELSE
SRC.SYSMESSAGELOC -1,1050052 // You have declined their invitation.
SYSMESSAGELOC -1,1050053,<NAME> // ~1_NAME~ has declined your invitation to cross lake Mortis.
ENDIF

////////////////////////////////////
//////////Dark Guardians///////////

/////////////////////////////

[CHARDEF C_DARK_GUARDIAN]
ID=c_liche
DEFNAME=C_DARK_GUARDIAN
NAME=Dark Guardian
DAM=24,26
ARMOR=40
CAN=MT_WALK|MT_USEHANDS
TAG.TREASUREMAP.LEVEL=3
TEVENTS=e_npc_necromancer_paladin
CATEGORY=Doom
SUBSECTION=Dark Guardians
DESCRIPTION=Dark Guardian

ON=@Create
NPC=BRAIN_MONSTER
STR={126 150}
MAXHITS={153 179}
INT={201 235}
DEX={101 120}
TACTICS={500 700}
MAGERY={500 600}
MAGICRESISTANCE={500 700}
EVALUATINGINTEL={400 500}
MEDITATION=80.0
NECROMANCY=100.0
SPIRITSPEAK=110.0
FAME={5000 6000} 
KARMA={-7000 -8000}

[ITEMDEF i_poison_fog_creator]
ID=i_worldgem_bit
NAME=Poison Fog Creator
TYPE=T_NORMAL

ON=@Create
ATTR=ATTR_INVIS|ATTR_MOVE_NEVER

ON=@Timer
FOR 17
SERV.NEWITEM i_poison_gas_darkguard
NEW.P=<P>
NEW.MOVE <EVAL {-9 9}> <EVAL {-9 9}>
NEW.MORE1=<MORE1>
NEW.ATTR=ATTR_DECAY|ATTR_MOVE_NEVER|ATTR_CAN_DECAY
NEW.TIMER=25
NEW.FIX
ENDFOR
TIMER=26
MORE1 += 100
RETURN 1

[ITEMDEF i_poison_gas_darkguard]
ID=i_trap_gas_3
TYPE=T_FLOOR
NAME=poison gas

ON=@Step
IF (<SRC.ISPLAYER>)
SRC.SPELLEFFECT S_POISON,<MORE1>,<UID>
ENDIF

[REGIONTYPE R_DARKGUARDIAN_ROOM]
ON=@Enter
IF (<SRC.ISPLAYER>)
	IF !(<SRC.ISGM>)
		IF !(<VAR0.DARKGUARDIANS>) && !(<VAR0.DARKGUARDIANCONTROLER>)
		SRC.REGION.ALLCLIENTS DARK_GUARDIAN_ROOM_SET
		UID.0400209a0.TIMER
		UID.0400209a1.TIMER
		SRC.TIMERF 1,UID.0400209a0.TIMER -1
		SRC.TIMERF 2,UID.0400209a1.TIMER -1
		SERV.NEWITEM i_poison_fog_creator
		NEW.P=365,15,-1,3
		NEW.MORE1=300
		NEW.TIMER
		ENDIF
	ENDIF
ENDIF

[REGIONTYPE R_DARKGUARDIAN_ROOM_BLOCK]
ON=@Enter
IF (<SRC.ISPLAYER>)
	IF !(<SRC.ISGM>)
		IF (<VAR0.DARKGUARDIANCONTROLER>) || (<SRC.FLAGS>&statf_dead)
			IF !(<SRC.TAG0.EVENT.ID>)
			SRC.UPDATE
			RETURN 1
			ENDIF
		ENDIF
	ENDIF
ELIF !(<SRC.MEMORYFINDTYPE.memory_ipet.LINK.ISPLAYER>)
SRC.UPDATE
RETURN 1
ENDIF

ON=@Exit
IF (<SRC.ISPLAYER>)
	IF !(<SRC.ISGM>)
		IF (<SRC.TAG0.EVENT.ID>)
			IF !(<VAR0.DARKGUARDIANS>)
			SRC.SAIRDARKGUARDIAN
			ENDIF
		ENDIF
	ENDIF
ENDIF

[FUNCTION DARK_GUARDIAN_ROOM_SET]
FOR 2
SERV.NEWNPC C_DARK_GUARDIAN
DORAND 4
NEW.P=365,9,-1,3
NEW.P=369,14,-1,3
NEW.P=366,22,-2,3
NEW.P=358,22,-1,3
ENDDO
NEW.EVENTS +e_dark_guardian_room_npc
NEW.UPDATE
NEW.ATTACK <UID>
VAR0.DARKGUARDIANS ++
ENDFOR
TAG.EVENT.ID=200
EVENTS +e_darkguard_player
VAR0.DARKGUARDIANPLAYERS ++

[EVENTS e_dark_guardian_room_npc]
ON=@Death
VAR0.DARKGUARDIANS --
IF !(<VAR0.DARKGUARDIANS>)
VAR.DARKGUARDIANS
SERV.NEWITEM i_chest_metal
NEW.P=365,15,-1,3
NEW.ATTR=ATTR_DECAY|ATTR_MOVE_NEVER|ATTR_CAN_DECAY
NEW.TIMER=59
LOCAL.CHEST=<NEW>
SERV.NEWITEM i_gold,{500 700},<LOCAL.CHEST>
	FOR <R1,3>
		DORAND 2
		SERV.NEWITEM {i_double_blade 1 i_lance 1 i_scyth 1 i_bone_harvester 1 i_scepter 1 i_bladed_staff 1 i_pike 1 i_double_bladed_staff 1 i_nodachi 1 i_daicho 1 i_sai 1 i_tekagi 1 i_horseman_bow 1 i_composite_bow 1 i_yumi 1}
		SERV.NEWITEM {i_sword_viking 1 i_dagger 1 i_mace 1 i_maul 1 i_kryss 1 i_bow 1 i_bracelet_gold 1 i_spear 1 i_spear_short 1}
		ENDDO
	NEW.GIVEITEMEVENT T_PROPRIEDADES
		IF (STRMATCH(*t_weapon*,<NEW.TYPE>))
		NEW.TAG.DAMINCREASE=<R3,11>
			IF !(<R2>)
			NEW.TAG.SWINGINCREASE=<R3,11>
			ENDIF
			IF !(<R2>)
			NEW.TAG.HITCHANCEINCREASE=<R2,11>
			ENDIF
		ENDIF
		IF !(<R5>) || (<NEW.TYPE>==t_jewelry)
		NEW.EVENTS +T_LUCK_ITEM
		NEW.TAG.LUCK=<R10,30>
		ENDIF
	NEW.CONT=<LOCAL.CHEST>
	ENDFOR
UID.0400209a0.TIMER
UID.0400209a1.TIMER
ACT.TIMERF 1,UID.0400209a0.TIMER -1
ACT.TIMERF 2,UID.0400209a1.TIMER -1
SERV.NEWITEM i_darkguardian_room_controler
NEW.P=365,15,-1,3
NEW.TIMER=<HVAL <SERV.CLIENTLINGER>/2>
VAR.DARKGUARDIANCONTROLER=1
SERV.NEWITEM i_darkguardian_room_controler
NEW.P=358,15,-1,3
NEW.TIMER=60
VAR.DARKGUARDIANCONTROLER=2
ENDIF

[EVENTS e_darkguard_player]
ON=@DeathCorpse
TAG.DARKGUARDBODY=<ARGO.UID>

ON=@LogOut
HITS=1
FORCHARS 20
IF (<BASEID>==C_DARK_GUARDIAN)
ATTACK <SRC>
ENDIF
ENDFOR

ON=@Death
SAIRDARKGUARDIAN 1 1

[ITEMDEF i_darkguardian_room_controler]
ID=i_worldgem_bit
NAME=Dark Guardian Room Controler
TYPE=T_NORMAL

ON=@Create
ATTR=ATTR_INVIS|ATTR_MOVE_NEVER

ON=@Timer
REGION.ALLCLIENTS SAIRDARKGUARDIAN 1
REGION.ALLCHARSIDLE SAIRDARKGUARDIAN 1
VAR0.DARKGUARDIANCONTROLER --
IF (<VAR0.DARKGUARDIANCONTROLER> < 1)
VAR.DARKGUARDIANCONTROLER
ENDIF
FORCHARS 15
	IF (<FLAGS>&statf_pet)
		IF !(STRCMPI(<REGION.NAME>,<OBJ.REGION.NAME>))
		GO 354,14,-1,3
		ENDIF
	ENDIF
ENDFOR
REMOVE
RETURN 1

[FUNCTION SAIRDARKGUARDIAN]
IF (<ISPLAYER>)
	IF (<TAG0.EVENT.ID>)
	VAR0.DARKGUARDIANPLAYERS --
		IF !(<VAR0.DARKGUARDIANPLAYERS>)
			IF (<ARGN1>) && (<ARGN2>) && (<VAR0.DARKGUARDIANS>)
			UID.0400209a0.TIMER
			UID.0400209a1.TIMER
			TIMERF 1,UID.0400209a0.TIMER -1
			TIMERF 2,UID.0400209a1.TIMER -1
			VAR.DARKGUARDIANCONTROLER
			ENDIF
		VAR.DARKGUARDIANS
			FORITEMS 15
				IF (<BASEID>==i_poison_fog_creator) || (<BASEID>==i_poison_gas_darkguard)
				REMOVE
				ENDIF
			ENDFOR
			FORCHARS 20
				IF (<BASEID>==C_DARK_GUARDIAN)
				REMOVE
				ENDIF
			ENDFOR
		VAR.DARKGUARDIANPLAYERS
		ENDIF
	EVENTS -e_darkguard_player
	TAG.EVENT.ID
		IF (<ARGN1>)
			IF (<TAG0.DARKGUARDBODY>)
			UID.<TAG0.DARKGUARDBODY>.REMOVEFROMVIEW
			UID.<TAG0.DARKGUARDBODY>.P=495,51,-1,3
			UID.<TAG0.DARKGUARDBODY>.UPDATE
			ENDIF
		GO 495,51,-1,3
		ENDIF
	TAG.DARKGUARDBODY
	EVENTS -e_darkguard_player
	ENDIF
ENDIF

[AREADEF a_doom_darkguard_room]
NAME=Doom (suspicious room)
P=365,15,-1,3
Rect=355,5,376,26,3
EVENTS=R_DARKGUARDIAN_ROOM_BLOCK
FLAGS=region_flag_nobuilding|region_antimagic_recall_in|region_antimagic_gate|region_antimagic_recall_out|region_flag_underground|region_antimagic_teleport
GROUP=Malas

[AREADEF a_doom_darkguardian_room]
NAME=Dark Guardian Room
P=365,15,-1,3
Rect=360,4,376,26,3
EVENTS=R_DARKGUARDIAN_ROOM
FLAGS=region_flag_nobuilding|region_antimagic_recall_in|region_antimagic_gate|region_antimagic_recall_out|region_flag_underground|region_antimagic_teleport
GROUP=Malas

///////////////////////////////////////
/////////////Lamp Puzzle//////////////

[TYPEDEF T_LAMP_LEVER]
ON=@Dclick
IF (<LINK.TIMER> == -1)
	IF (<TIMER> == -1)
		IF (<SRC.P.X> == <MOREX>) && (<SRC.P.Y> == <MOREY>)
		LINK.TAG.ATUAL .= <dMORE1>.
		TIMER=5
		DISPID=0108e
		UPDATE
			IF (<EVAL STRLEN(<LINK.TAG0.ATUAL>)> == 8)
				IF (<LINK.dTAG0.ATUAL> != <LINK.dTAG0.CORRETO>)
				LINK.DOOMLAMPERRO
				ELSE
				LINK.DOOMLAMPCERTO
				ENDIF
			ENDIF
		ELSE
		SRC.SYSMESSAGE @55 Stay on the square.
		ENDIF
	ENDIF
ENDIF
RETURN 1

ON=@Timer
LINK.TAG.ATUAL
LINK.DOOMLAMPRESET
RETURN 1

[FUNCTION DOOMLAMPCERTO]
REF1=<UID>
FORCLIENTS 0
	IF (<REF1.TIMER> == -1)
	LOCAL.1=<R1,4>
	LOCAL.2=<R1,4>
		WHILE (<LOCAL.2> == <LOCAL.1>)
		LOCAL.2=<R1,4>
		ENDWHILE
	LOCAL.3=<R1,4>
		WHILE ((<LOCAL.3> == <LOCAL.1>) || (<LOCAL.3> == <LOCAL.2>))
		LOCAL.3=<R1,4>
		ENDWHILE
	LOCAL.4=<R1,4>
		WHILE ((<LOCAL.4> == <LOCAL.1>) || (<LOCAL.4> == <LOCAL.2>) || (<LOCAL.4> == <LOCAL.3>))
		LOCAL.4=<R1,4>
		ENDWHILE
	REF1.TAG.CORRETO <dLOCAL.1>.<dLOCAL.2>.<dLOCAL.3>.<dLOCAL.4>
	REF1.TIMER=<EVAL 60*10>
	REF1.COLOR=33
	GO 468,96,-1,3
	EVENTS +e_lamproom
	SERV.NEWITEM=i_lamproom_sair
	EQUIP <NEW>
	NEW.TIMER=<EVAL 60*5>
	ENDIF
ENDFOR

[FUNCTION DOOMLAMPERRO]
DOOMLAMPRESET
FORCLIENTS 20
SERV.NEWITEM i_boulder
NEW.P=<P>
NEW.MOVE W
NEW.ATTR=ATTR_DECAY|ATTR_MOVE_NEVER|ATTR_CAN_DECAY
NEW.TIMER=5
DAMAGE 80 01 01
SYSMESSAGE @36 Errado!
ENDFOR

[FUNCTION DOOMLAMPRESET]
FOR 4
REF1=<TAG0.DOOM.LEVER<EVAL <LOCAL._FOR>>>
REF1.TIMER -1
REF1.DISPID=i_lever
REF1.UPDATE
ENDFOR
TAG.ATUAL

[EVENTS e_lamproom]
ON=@Death
FINDID.i_lamproom_sair.REMOVE
REMOVEFROMVIEW
MOVETO 428,233,-1,3
EVENTS -e_lamproom
UPDATE

ON=@Kill
IF !(<ARGO.ISPLAYER>)
REF1=<ARGO.UID>
REF1.GO 428,233,-1,3
FINDID.i_lamproom_sair.REMOVE
REMOVEFROMVIEW
MOVETO 428,233,-1,3
EVENTS -e_lamproom
UPDATE
ENDIF

[TYPEDEF T_CHAO_SAIRLAMPROOM]
ON=@Step
SRC.FINDID.i_lamproom_sair.REMOVE
SRC.GO 429,233,-1,3
SRC.EVENTS -e_lamproom

[TYPEDEF T_CHAO_LAMPROOM]
ON=@Timer
COLOR=0ad
RETURN 1

[TYPEDEF T_CAIXA_DOOMLAMP]
ON=@Dclick
IF (<TIMER> == -1)
SERV.NEWNPC c_wanderer_void
NEW.P=470,96,-1,3
NEW.UPDATE
NEW.ATTACK <SRC>
NEW.REMOVETIMER=<HVAL 60*5>
TIMER=<HVAL 60*5>
ENDIF
RETURN 1

ON=@Timer
RETURN 1

ON=@Dropon_Self
IF !(<SRC.ISGM>)
RETURN 1
ENDIF

[ITEMDEF i_lamproom_sair]
ID=i_memory
TYPE=T_EQ_SCRIPT
NAME=laproom sair

ON=@Timer
CONT.GO 429,233,-1,3
CONT.EVENTS -e_lamproom
REMOVE
RETURN 1
[EOF]