[itemdef 8901] //8901
DEFNAME=i_runebook
NAME=Runebook
TYPE=t_normal
VALUE=1200
RESOURCES=8 i_scroll_blank,1 i_scroll_recall,1 i_scroll_gate_travel,1 i_rune_marker
SKILLMAKE=SKILL_INSCRIPTION 55.0
DYE=1

on=@create
attr=attr_newbie
color=021e

ON=@ClientToolTip
IF (!(<ISEMPTY <TAG.DESCRIPTION>>))
SRC.ADDCLILOC 1072305,<TAG0.DESCRIPTION>
ENDIF

on=@dclick
IF (<src.findid.i_recall_timer>) || (<src.findid.i_gate_timer>)
src.sysmessageloc 04ac,502165
ELIF (<src.flags>&statf_freeze)
src.sysmessageloc 04ac,1005213
ELSE
src.sound 85
sDIALOG d_runebook
ENDIF
return 1

on=@targon_char
SRC.sysmessageloc 04ac,502422
return 1

on=@targon_item
IF (<SRC.TARG.BASEID> != i_rune_marker)
SRC.sysmessageloc 04ac,502422
ELIF (<src.targ.topobj.uid> != <src>)
src.sysmessageloc 04ac,1062422
ELIF !(<SRC.TARG.MOREP>)
SRC.sysmessageloc 04ac,502409
ELSE
	FOR 16
		IF !(<tag0.runa<dlocal._for>>)
		try tag.runa<dlocal._for>=<src.targ.morep>
			IF (STRMATCH(Rune to:*,<SRC.TARG.NAME>))
			LOCAL.NAME=<SRC.TARG.NAME>
			SRC.TARG.NAME=<STRSUB 8 <HVAL STRLEN(<LOCAL.NAME>)> <LOCAL.NAME>>
			ENDIF
		try tag.runanome<dlocal._for>=<src.targ.name>
		src.targ.remove
		return 1
		ENDIF
	ENDFOR
src.sysmessageloc 04ac,502401
ENDIF
return 1

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

[DIALOG d_runebook]
100, 0
src.closealldialogs
PAGE 0
gumppic 72 115 500
gumppic 460 350 028ac
gumppic 460 200 028ab
gumppic 460 50 028aa
FOR 1 8
button 105 <EVAL (<LOCAL._FOR>*20)+125> 093A 0939 1 0 <dLOCAL._FOR>
button 125 <EVAL (<LOCAL._FOR>*20)+125> 093A 0939 1 0 <EVAL <LOCAL._FOR>+16>
dcroppedtext 145 <EVAL (<LOCAL._FOR>*20)+120> 100 20 1152 <QVAL <ISEMPTY <TAG.RUNA<dLOCAL._FOR>>> ? Empty:<TAG0.RUNANOME<dLOCAL._FOR>>>
button 260 <EVAL (<LOCAL._FOR>*20)+125> 093A 0939 1 0 <EVAL <LOCAL._FOR>+32>
ENDFOR
FOR 9 16
button 305 <EVAL ((<LOCAL._FOR>-8)*20)+125> 093A 0939 1 0 <dLOCAL._FOR>
button 325 <EVAL ((<LOCAL._FOR>-8)*20)+125> 093A 0939 1 0 <EVAL <LOCAL._FOR>+16>
dcroppedtext 345 <EVAL ((<LOCAL._FOR>-8)*20)+120> 100 20 1152 <QVAL <ISEMPTY <TAG.RUNA<dLOCAL._FOR>>> ? Empty:<TAG0.RUNANOME<dLOCAL._FOR>>>
button 450 <EVAL ((<LOCAL._FOR>-8)*20)+125> 093A 0939 1 0 <EVAL <LOCAL._FOR>+32>
ENDFOR
button 312 122 01523 01523 1 0 49
dtext 332 122 2010 Add Rune
button 312 312 037 038 1 0 50
dtext 328 310 2010 Change Description
dtext 108 304 0 --Recall
dtext 108 295 0 |
dtext 128 295 0 |____Gate
dtext 258 295 0 |
dtext 226 310 0 Remove

[DIALOG d_runebook BUTTON]
ON=1 16
IF !(<TAG0.RUNA<ARGN>>)
src.sysmessageloc 04ac,502424
ELIF (<src.findid.i_recall_timer>) || (<src.findid.i_gate_timer>)
src.sysmessageloc 04ac,502165
ELIF (<src.flags>&statf_freeze)
src.sysmessageloc 04ac,502643
ELIF !(STRCMPI(<SRC.REGION.NAME>,Destroyer Arena)) || (<SRC.FINDID.i_pvp_time>) || (<SRC.TAG0.EVENT.ID>)
src.sysmessageloc 04ac,502629
ELIF (!(<SRC.MAGERY>)) && (!(<SRC.CHIVALRY>))
src.sysmessageloc -1,1063013,0.1,Magery or Chivalry
ELSE
MOREP=<TAG0.RUNA<ARGN>>
	IF (0<SERV.MAP(<MOREX>,<MOREY>,<MOREM>).REGION.FLAGS>&region_antimagic_recall_in) || (0<UID.<SERV.MAP(<MOREX>,<MOREY>,<MOREM>).REGION.UID>.ISAMULTI>) || (<MOREM> == 2)
	SRC.sysmessageloc 04ac,501942
	ELIF (<SRC.REGION.FLAGS>&region_antimagic_recall_out)
	src.sysmessageloc 04ac,501802
	ELSE
	SRC.EVENTS +e_runadano
	SERV.NEWITEM i_recall_timer,1,<SRC>
	NEW.TIMERD=<EVAL <SERV.SPELL.s_recall.CAST_TIME>+5>
	NEW.MOREP=<MOREP>
	src.sound snd_spell_recall
		IF (<SRC.MAGERY> > <SRC.CHIVALRY>)
		trysrc <SRC> src.say @,,2 1042314
		ENDIF
	src.anim 17
	ENDIF
ENDIF

ON=17 32
IF !(<TAG0.RUNA<EVAL <ARGN>-16>>)
src.sysmessageloc 04ac,502424
ELIF (<src.findid.i_recall_timer>) || (<src.findid.i_gate_timer>)
src.sysmessageloc 04ac,502165
ELIF (<src.flags>&statf_freeze)
src.sysmessageloc 04ac,502643
ELIF !(STRCMPI(<SRC.REGION.NAME>,Destroyer Arena)) || (<SRC.FINDID.i_pvp_time>) || (<SRC.TAG0.EVENT.ID>)
src.sysmessageloc 04ac,502629
ELIF (<SRC.MAGERY> < 70.0)
src.sysmessageloc -1,1063013,70,Magery
ELSE
MOREP=<TAG0.RUNA<EVAL <ARGN>-16>>
	IF (0<SERV.MAP(<MOREX>,<MOREY>,<MOREM>).REGION.FLAGS>&region_antimagic_gate) || (0<UID.<SERV.MAP(<MOREX>,<MOREY>,<MOREM>).REGION.UID>.ISAMULTI>) || (<MOREM> == 2)
	SRC.sysmessageloc 04ac,501942
	ELIF (<SRC.REGION.FLAGS>&region_antimagic_recall_out) || (<SRC.REGION.FLAGS>&region_antimagic_gate)
	src.sysmessageloc 04ac,501802
	ELSE
	SRC.EVENTS +e_runadano
	SERV.NEWITEM i_gate_timer,1,<SRC>
	NEW.TIMERD=<SERV.SPELL.s_gate_travel.CAST_TIME>
	NEW.MOREP=<MOREP>
	src.sound snd_spell_recall
	src.say Vas Rel Por
	src.anim 17
	ENDIF
ENDIF

ON=33 48
IF !(<TAG0.RUNA<EVAL <ARGN>-32>>)
src.sysmessageloc 04ac,502424
ELSE
serv.newitem=i_rune_marker
new.name=<tag0.runanome<eval <argn>-32>>
new.morep=<tag0.runa<eval <argn>-32>>
new.more1=10
try tag.runa<eval <argn>-32>
try tag.runanome<eval <argn>-32>
new.bounce
sDIALOG d_runebook
ENDIF

ON=49
IF (<TOPOBJ.UID> == <SRC>)
target @04ac,3,1 Target a rune.
ELSE
src.sysmessageloc 04ac,1042001
ENDIF

ON=50
IF (<TOPOBJ.UID> == <SRC>)
SDIALOG d_runebook_mudarnome
ENDIF

[ITEMDEF i_recall_timer]
ID=i_memory
NAME=Recall Timer
TYPE=t_eq_script

ON=@Timer
IF (0<SERV.MAP(<MOREX>,<MOREY>,<MOREM>).REGION.FLAGS>&region_antimagic_recall_in) || (0<UID.<SERV.MAP(<MOREX>,<MOREY>,<MOREM>).REGION.UID>.ISAMULTI>) || (<MOREM> == 2)
CONT.sysmessageloc 04ac,501942
CONT.EFFECT 3,i_fx_smoke,20,20
ELIF (<CONT.REGION.FLAGS>&region_antimagic_recall_out)
CONT.sysmessageloc 04ac,501802
CONT.EFFECT 3,i_fx_smoke,20,20
ELIF (<cont.flags>&statf_freeze)
cont.sysmessageloc 04ac,502643
CONT.EFFECT 3,i_fx_smoke,20,20
ELIF !(STRCMPI(<CONT.REGION.NAME>,Destroyer Arena)) || (<CONT.FINDID.i_pvp_time>) || (<CONT.TAG0.EVENT.ID>)
cont.sysmessageloc 04ac,502629
CONT.EFFECT 3,i_fx_smoke,20,20
ELSE
CONT.GO <MOREP>
ENDIF
CONT.EVENTS -e_runadano
REMOVE
RETURN 1

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

[ITEMDEF i_gate_timer]
ID=i_memory
NAME=Gate Timer
TYPE=t_eq_script

ON=@Timer
IF (0<SERV.MAP(<MOREX>,<MOREY>,<MOREM>).REGION.FLAGS>&region_antimagic_recall_in) || (0<UID.<SERV.MAP(<MOREX>,<MOREY>,<MOREM>).REGION.UID>.ISAMULTI>) || (<MOREM> == 2)
CONT.sysmessageloc 04ac,501942
CONT.EFFECT 3,i_fx_smoke,20,20
ELIF (<CONT.REGION.FLAGS>&region_antimagic_recall_out) || (<CONT.REGION.FLAGS>&region_antimagic_gate)
CONT.sysmessageloc 04ac,501802
CONT.EFFECT 3,i_fx_smoke,20,20
ELIF (<cont.flags>&statf_freeze)
cont.sysmessageloc 04ac,502643
CONT.EFFECT 3,i_fx_smoke,20,20
ELIF !(STRCMPI(<CONT.REGION.NAME>,Destroyer Arena)) || (<CONT.FINDID.i_pvp_time>) || (<CONT.TAG0.EVENT.ID>)
cont.sysmessageloc 04ac,502629
CONT.EFFECT 3,i_fx_smoke,20,20
ELSE
	IF (!(<CONT.ISPK>))
	serv.newitem=i_moongate_blue
	ELSE
	serv.newitem=i_moongate_red
	ENDIF
new.p=<cont.p>
new.type t_telepad
new.morep=<morep>
new.name=<serv.map(<Morex>,<morey>,<morem>).region.name> (<cont.name>)
new.attr=attr_move_never|attr_decay
new.timer=50
new.fix
	IF (!(<CONT.ISPK>))
	serv.newitem=i_moongate_blue
	ELSE
	serv.newitem=i_moongate_red
	ENDIF
new.p=<morep>
new.type t_telepad
new.morep=<cont.p>
new.name=<cont.region.name> (<cont.name>)
new.attr=attr_move_never|attr_decay
new.timer=50
new.fix
ENDIF
CONT.EVENTS -e_runadano
REMOVE
RETURN 1

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

[EVENTS e_runadano]
ON=@UserWarMode
FINDID.i_recall_timer.REMOVE
FINDID.i_gate_timer.REMOVE
sysmessageloc 04ac,501802
EFFECT 3,i_fx_smoke,20,20
EVENTS -e_runadano

ON=@GetHit
FINDID.i_recall_timer.REMOVE
FINDID.i_gate_timer.REMOVE
sysmessageloc 04ac,501802
EFFECT 3,i_fx_smoke,20,20
EVENTS -e_runadano

ON=@Hit
FINDID.i_recall_timer.REMOVE
FINDID.i_gate_timer.REMOVE
sysmessageloc 04ac,501802
EFFECT 3,i_fx_smoke,20,20
EVENTS -e_runadano

ON=@LogOut
FINDID.i_recall_timer.REMOVE
FINDID.i_gate_timer.REMOVE
sysmessageloc 04ac,501802
EFFECT 3,i_fx_smoke,20,20
EVENTS -e_runadano

ON=@SpellCast
IF (<ARGN>==32) || (<ARGN>==52)
ACTION -1
RETURN 1
ENDIF

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

[DIALOG d_runebook_mudarnome]
10,30
src.closealldialogs
page 0
resizepic 185 190 3600 340 140
resizepic 195 200 3500 320 120
dtext 230 210 0 Current desc: <QVAL <ISEMPTY <TAG.DESCRIPTION>> ? None:<TAG.DESCRIPTION>>
button 250 250 5224 5003 1 0 1
dtextentry 270 250 300 25 55 0

[DIALOG d_runebook_mudarnome BUTTON]
on=0
if (<topobj.uid>==<src>)
sDIALOG d_runebook
endif

on=1
IF (<topobj.uid>==<src>)
IF !(<ISBADSTR <ARGTXT[0]>>)
TAG.DESCRIPTION=<strsub 0 23 <argtxt[0]>>
UPDATE 1
ENDIF
ENDIF

[EOF]