[ITEMDEF i_runebook]
ID=i_spellbook
TYPE=t_normal
NAME=Runebook
VALUE=6000
SKILLMAKE=INSCRIPTION 98.0
RESOURCES=50 I_SCROLL_BLANK , 1 I_SCROLL_GATE_TRAVEL , 1 i_scroll_recall
ON=@CREATE
COLOR=0289
ATTR=021|04
TAG.CHARGES.MAX=50
TAG.CHARGES=50
ON=@DCLICK
IF ( <CONT> != <SRC.FINDLAYER.21> )
src.SYSMESSAGE @,3,1 The item must be in your backpack.
RETURN 1
ENDIF
IF (STRMATCH("*jail*","<region.name>"))
SRC.SYSMESSAGE @,3,1 You cannot use this in here.
RETURN 1
ENDIF
IF <src.tag0.controlling>>0)
src.sysmessage @,3,1 You must wait to perform another action.
return 1
else
src.tag.controlling 1
src.timerf 10 , src.tag.controlling
endif
IF <SRC.TAG0.Recalling>
RETURN 1
ENDIF
TAG.PAGE=
SDIALOG d_runebook_dialog 1
src.sound 0501
RETURN 1
ON=@DROPON_SELF
IF <ARGO.BASEID>==i_scroll_recall
DIALOGCLOSE d_runebook_dialog
LOCAL.NEEDED=<EVAL <TAG0.Charges.Max>+-<TAG0.Charges>>
IF <ARGO.AMOUNT>><LOCAL.NEEDED>
ARGO.AMOUNT = <EVAL <ARGO.AMOUNT>+-<LOCAL.NEEDED>>
SRC.SYSMESSAGE @,3,1 You add <EVAL <LOCAL.NEEDED>> charge to the runebook.
TAG.Charges=<TAG0.Charges.Max>
RETURN 1
ELSE
SRC.SYSMESSAGE @,3,1 You add <EVAL <ARGO.AMOUNT>> charge to the runebook.
TAG.Charges=<EVAL <TAG0.Charges>+<ARGO.AMOUNT>>
ARGO.REMOVE
RETURN 1
ENDIF
ELIF <ARGO.BASEID>==i_rune_marker
DIALOGCLOSE d_runebook_dialog
IF <ARGO.MOREP>
ADD_RUNE <ARGO.UID>
RETURN 1
ELSE
SRC.SYSMESSAGE @,3,1 Rune must be marked.
RETURN 1
ENDIF
ENDIF
ON=@SPELLEFFECT
MORE1=100
IF ((<ARGN>==32) || (<ARGN>==52))
IF !<TAG0.Runebook.Location.<EVAL <TAG0.Runebook.Default>>>
SRC.SYSMESSAGE @,3,1 This book has no default location.
RETURN 1
ELSE
MOREP=<TAG0.Runebook.Location.<EVAL <TAG0.Runebook.Default>>>
ENDIF
ENDIF
IF <ARGN>==45
SRC.SYSMESSAGE @,3,1 You cannot mark this.
RETURN 1
ENDIF
[FUNCTION ADD_RUNE]
OBJ=<ARGV[0]>
LOCAL.Free_Space=0
FOR 16 1
IF <ISEMPTY <TAG.Runebook.<EVAL <LOCAL._FOR>>>>
LOCAL.Free_Space=<EVAL <LOCAL._FOR>>
ENDIF
ENDFOR
IF <LOCAL.Free_Space>
TRY TAG.Runebook.<EVAL <LOCAL.Free_Space>> = <OBJ.NAME>
TRY TAG.Runebook.Location.<EVAL <LOCAL.Free_Space>> = <OBJ.MOREP>
SRC.SYSMESSAGE @,3,1 <OBJ.NAME> has been added to the runebook.
SOUND 87
OBJ.REMOVE
ELSE
SRC.SYSMESSAGE @,3,1 No free space in the book. Remove a rune first.
ENDIF
[FUNCTION REMOVE_RUNE]
SERV.NEWITEM=i_rune_marker
NEW.MORE1=100
NEW.NAME=<TAG.Runebook.<EVAL <ARGV[0]>>>
NEW.MOREP=<TAG.Runebook.Location.<EVAL <ARGV[0]>>>
NEW.BOUNCE
TRY TAG.Runebook.<EVAL <ARGV[0]>>=
TRY TAG.Runebook.Location.<EVAL <ARGV[0]>>=
IF <ARGV[0]><16
FOR <EVAL <ARGV[0]>+1> 16
IF !<ISEMPTY <TAG.Runebook.<EVAL <LOCAL._FOR>>>>
TRY TAG.Runebook.<EVAL <LOCAL._FOR>+-1>=<TAG.Runebook.<EVAL <LOCAL._FOR>>>
TRY TAG.Runebook.Location.<EVAL <LOCAL._FOR>+-1>=<TAG.Runebook.Location.<EVAL <LOCAL._FOR>>>
TRY TAG.Runebook.<EVAL <LOCAL._FOR>>=
TRY TAG.Runebook.Location.<EVAL <LOCAL._FOR>>=
ENDIF
ENDFOR
ENDIF
[DIALOG d_runebook_dialog]
50,50
PAGE 0
gumppic 0 0 2200
gumppic 29 46 57
gumppic 49 46 58
gumppic 65 46 58
gumppic 81 46 58
gumppic 97 46 58
gumppic 113 46 58
gumppic 129 46 59
gumppic 189 46 57
gumppic 209 46 58
gumppic 225 46 58
gumppic 241 46 58
gumppic 257 46 58
gumppic 273 46 58
gumppic 289 46 59
button 30 177 2225 2225 1 0 501
button 65 177 2226 2226 1 0 503
button 100 177 2227 2227 1 0 505
button 135 177 2228 2228 1 0 507
button 200 177 2229 2229 1 0 509
button 235 177 2230 2230 1 0 511
button 270 177 2231 2231 1 0 513
button 305 177 2232 2232 1 0 515
DOSWITCH <EVAL <EVAL <TAG0.PAGE>+1>/2>
button 296 5 2236 2236 1 0 501
BEGIN
button 23 5 2235 2235 1 0 500
button 296 5 2236 2236 1 0 503
END
BEGIN
button 23 5 2235 2235 1 0 501
button 296 5 2236 2236 1 0 505
END
BEGIN
button 23 5 2235 2235 1 0 503
button 296 5 2236 2236 1 0 507
END
BEGIN
button 23 5 2235 2235 1 0 505
button 296 5 2236 2236 1 0 509
END
BEGIN
button 23 5 2235 2235 1 0 507
button 296 5 2236 2236 1 0 511
END
BEGIN
button 23 5 2235 2235 1 0 509
button 296 5 2236 2236 1 0 513
END
BEGIN
button 23 5 2235 2235 1 0 511
button 296 5 2236 2236 1 0 515
END
button 23 5 2235 2235 1 0 513
ENDDO
dtext 40 36 0 Charges: <EVAL <TAG0.Charges>>
dtext 195 36 0 Max Charges: <EVAL <TAG0.Charges.Max>>
IF !<TAG0.PAGE>
button 27 5 2472 2473 1 0 1001
dtext 58 13 0 Rename book
LOCAL.Y=60
FOR 1 8
IF !<ISEMPTY <TAG.Runebook.<EVAL <LOCAL._FOR>>>>
button 30 <LOCAL.Y> 2103 2104 1 0 <LOCAL._FOR>
dcroppedtext 45 <EVAL <LOCAL.Y>+-5> 120 18 0 <TAG.Runebook.<EVAL <LOCAL._FOR>>>
ELSE
button 30 <LOCAL.Y> 2103 2104 1 0 1000
dcroppedtext 45 <EVAL <LOCAL.Y>+-5> 120 18 0 Empty
ENDIF
LOCAL.Y += 14
ENDFOR
LOCAL.Y=60
FOR 9 16
IF !<ISEMPTY <TAG.Runebook.<EVAL <LOCAL._FOR>>>>
button 190 <LOCAL.Y> 2103 2104 1 0 <LOCAL._FOR>
dcroppedtext 205 <EVAL <LOCAL.Y>+-5> 120 18 0 <TAG.Runebook.<EVAL <LOCAL._FOR>>>
ELSE
button 190 <LOCAL.Y> 2103 2104 1 0 1000
dcroppedtext 205 <EVAL <LOCAL.Y>+-5> 120 18 0 Empty
ENDIF
LOCAL.Y += 14
ENDFOR
ELSE
/////////////////Section One///////////////////
IF <ISEMPTY <TAG.Runebook.<EVAL <TAG0.PAGE>>>>
button 30 60 2103 2104 1 0 1000
dcroppedtext 45 55 120 18 0 Empty
ELSE
button 30 60 2103 2104 1 0 <TAG0.PAGE>
dcroppedtext 45 55 120 18 0 <TAG.Runebook.<EVAL <TAG0.PAGE>>>
button 35 110 2437 2438 1 0 <EVAL <TAG0.PAGE>+100>
dtext 49 107 0 Drop rune
button 35 130 2271 2271 1 0 <EVAL <TAG0.PAGE>+200>
button 105 130 2291 2291 1 0 <EVAL <TAG0.PAGE>+300>
IF <TAG0.Runebook.Default>!=<EVAL <TAG0.PAGE>>
button 60 10 2361 2361 1 0 <EVAL <TAG0.PAGE>+600>
dtext 74 4 0 Set default
ENDIF
dcroppedtext 35 74 80 20 0 <STRARG <SEXTANTP <TAG.Runebook.Location.<EVAL <TAG0.PAGE>>>>>
dcroppedtext 35 89 80 20 0 <STREAT <SEXTANTP <TAG.Runebook.Location.<EVAL <TAG0.PAGE>>>>>
ENDIF
/////////////////Section Two///////////////////
IF <ISEMPTY <TAG.Runebook.<EVAL <TAG0.PAGE>+1>>>
button 190 60 2103 2104 1 0 1000
dcroppedtext 205 55 120 18 0 Empty
ELSE
button 190 60 2103 2104 1 0 <EVAL <TAG0.PAGE>+1>
dcroppedtext 205 55 120 18 0 <TAG.Runebook.<EVAL <TAG0.PAGE>+1>>
button 195 107 2437 2438 1 0 <EVAL <TAG0.PAGE>+101>
dtext 209 107 0 Drop rune
button 195 130 2271 2271 1 0 <EVAL <TAG0.PAGE>+201>
button 265 130 2291 2291 1 0 <EVAL <TAG0.PAGE>+301>
IF <TAG0.Runebook.Default>!=<EVAL <TAG0.PAGE>+1>
button 200 10 2361 2361 1 0 <EVAL <TAG0.PAGE>+601>
dtext 214 4 0 Set default
ENDIF
dcroppedtext 195 74 80 20 0 <STRARG <SEXTANTP <TAG.Runebook.Location.<EVAL <TAG0.PAGE>+1>>>>
dcroppedtext 195 89 80 20 0 <STREAT <SEXTANTP <TAG.Runebook.Location.<EVAL <TAG0.PAGE>+1>>>>
ENDIF
ENDIF
[DIALOG d_runebook_dialog BUTTON]
ON=601 616
TAG.Runebook.Default=<EVAL <ARGN>+-600>
SRC.SysMESSAGE @,3,1 New default location set.
TAG.PAGE=
DIALOGCLOSE d_runebook_dialog
DIALOG d_runebook_dialog
ON=500
TAG.PAGE=
DIALOGCLOSE d_runebook_dialog
DIALOG d_runebook_dialog
ON=501 515
TAG.PAGE=<EVAL <ARGN>+-500>
DIALOGCLOSE d_runebook_dialog
DIALOG d_runebook_dialog
ON=1 16
FORCHARS 100
FORCHARMEMORYTYPE memory_war_targ
IF <LINK.UID>==<SRC.UID>
IF <CONT.CANSEELOS <LINK.UID>>
SRC.sysmessage @,3,1 You cannot use this while in battle.
Return 1
ENDIF
ENDIF
ENDFOR
ENDFOR
IF <SRC.FLAGS>==<SRC.FLAGS>|02
SRC.MESSAGE @,3,1 You cannot use this while dead.
ENDIF
IF <SRC.FLAGS>==<SRC.FLAGS>|04
SRC.MESSAGE @,3,1 You cannot use this while paralyzed.
ENDIF
IF <TAG0.Charges>>0
IF !<SRC.TAG0.Recalling>
SRC.TAG.Recalling=<UID>
SRC.Runebook_Recall <TAG0.Runebook.Location.<ARGN>>
ELSE
SRC.SYSMESSAGE @,3,1 You are already recalling/gating.
ENDIF
ELSE
SRC.SYSMESSAGE @,3,1 Your book needs more charges.
ENDIF
ON=101 116
REMOVE_RUNE <EVAL <ARGN>+-100>
ON=201 216
FORCHARS 100
FORCHARMEMORYTYPE memory_war_targ
IF <LINK.UID>==<SRC.UID>
IF <CONT.CANSEELOS <LINK.UID>>
SRC.sysmessage @,3,1 You cannot use this while in battle.
Return 1
ENDIF
ENDIF
ENDFOR
ENDFOR
LOCAL.Rune=<EVAL <ARGN>+-200>
IF <SRC.FLAGS>==<SRC.FLAGS>|02
SRC.MESSAGE @,3,1 You cannot use this while dead.
ENDIF
IF <SRC.FLAGS>==<SRC.FLAGS>|04
SRC.MESSAGE @,3,1 You cannot use this while paralyzed.
ENDIF
IF <SRC.RESTEST <SERV.SPELL.32.RESOURCES>>
IF !<SRC.TAG0.Recalling>
SRC.TAG.Recalling=<UID>
SRC.Runebook_Recall_Reags <TAG0.Runebook.Location.<EVAL <LOCAL.Rune>>>
ELSE
SRC.SYSMESSAGE @,3,1 You are already recalling/gating.
ENDIF
ELSE
SRC.SYSMESSAGE @,3,1 You do not have the required reagents.
ENDIF
ON=301 316
FORCHARS 100
FORCHARMEMORYTYPE memory_war_targ
IF <LINK.UID>==<SRC.UID>
IF <CONT.CANSEELOS <LINK.UID>>
SRC.sysmessage @,3,1 You cannot use this while in battle.
Return 1
ENDIF
ENDIF
ENDFOR
ENDFOR
LOCAL.Rune=<EVAL <ARGN>+-300>
IF <SRC.FLAGS>==<SRC.FLAGS>|02
SRC.MESSAGE @,3,1 You cannot use this while dead.
ENDIF
IF <SRC.FLAGS>==<SRC.FLAGS>|04
SRC.MESSAGE @,3,1 You cannot use this while paralyzed.
ENDIF
IF <SRC.RESTEST <SERV.SPELL.52.RESOURCES>>
IF !<SRC.TAG0.Recalling>
SRC.TAG.Recalling=<UID>
SRC.Runebook_Gate_Reags <TAG0.Runebook.Location.<EVAL <LOCAL.Rune>>>
ELSE
SRC.SYSMESSAGE @,3,1 You are already recalling/gating.
ENDIF
ELSE
SRC.SYSMESSAGE @,3,1 You do not have the required reagents.
ENDIF
ON=1001
SRC.SYSMESSAGE @,3,1 Type in a new name for the runebook.
SRC.CTAG.Runebook=<UID>
SRC.PROMPTCONSOLE Rename_Runebook
[function Runebook_Recall]
if (<magery><400)
src.sysMESSAGE @,3,1 You do not know how can i cast that spell.
SRC.TAG.RECALLING 0
return 1
endif
if (<mana><12)
src.sysMESSAGE @,3,1 You lack sufficient mana for this spell.
SRC.TAG.RECALLING 0
SRC.SOUND 0108
return 1
endif
IF <SRC.REGION.FLAGS>&0E
SRC.SYSMESSAGE @,3,1 An anti-magic field blocks you.
SRC.TAG.RECALLING 0
SRC.SOUND 0108
RETURN 1
ENDIF
if (<src.hits><1)
SRC.SYSMESSAGE @,3,1 You cannot cast when you are a dead.
SRC.TAG.RECALLING 0
return 1
endif
if (<findtype.t_armor.cont.uid> == <uid>)
f_fizzle
SRC.SYSMESSAGE @,3,1 Your equipped armors fail your casting.
SRC.TAG.RECALLING 0
return 1
endif
if ((<flags>&statf_freeze) || (<flags>&statf_stone)
f_fizzle
SRC.MESSAGE @,3,1 You cannot cast when you are freeze.
SRC.TAG.RECALLING 0
return 1
endif
src.action -1
EVENTS +e_runebook_recall
spell_say [Recall]
spell_say Kal Ort Por
flags |= statf_freeze
anim 17
local.casttime=<eval <serv.spell.32.cast_time>-<tag0.fastercast>>
if (<local.casttime><20)
TIMERF 2,Runebook_Recall_Finish <ARGS>
else
TIMERF <eval <local.casttime>/10>,Runebook_Recall_Finish <ARGS>
endif
[function Runebook_Recall_Reags]
if (<magery><400)
src.sysMESSAGE @,3,1 You do not know how can i cast that spell.
SRC.TAG.RECALLING 0
return 1
endif
if (<mana><12)
src.sysMESSAGE @,3,1 You lack sufficient mana for this spell.
SRC.TAG.RECALLING 0
SRC.SOUND 0108
return 1
endif
IF <SRC.REGION.FLAGS>&0E
SRC.SYSMESSAGE @,3,1 An anti-magic field blocks you.
SRC.TAG.RECALLING 0
SRC.SOUND 0108
RETURN 1
ENDIF
if (<src.hits><1)
SRC.SYSMESSAGE @,3,1 You cannot cast when you are a dead.
SRC.TAG.RECALLING 0
return 1
endif
if (<findtype.t_armor.cont.uid> == <uid>)
f_fizzle
SRC.SYSMESSAGE @,3,1 Your equipped armors fail your casting.
SRC.TAG.RECALLING 0
return 1
endif
if ((<flags>&statf_freeze) || (<flags>&statf_stone)
f_fizzle
SRC.MESSAGE @,3,1 You cannot cast when you are freeze.
SRC.TAG.RECALLING 0
return 1
endif
src.action -1
EVENTS +e_runebook_recall
spell_say [Recall]
spell_say Kal Ort Por
flags |= statf_freeze
anim 17
local.casttime=<eval <serv.spell.32.cast_time>-<tag0.fastercast>>
if (<local.casttime><20)
TIMERF 2,Runebook_Recall_Finish_Reags <ARGS>
else
TIMERF <eval <local.casttime>/10>,Runebook_Recall_Finish <ARGS>
endif
[function Runebook_Gate_Reags]
if (<magery><700)
src.sysMESSAGE @,3,1 You do not know how can i cast that spell.
SRC.TAG.RECALLING 0
return 1
endif
if (<mana><40)
src.sysMESSAGE @,3,1 You lack sufficient mana for this spell.
SRC.TAG.RECALLING 0
SRC.SOUND 0108
return 1
endif
IF <SRC.REGION.FLAGS>&0E
SRC.SYSMESSAGE @,3,1 An anti-magic field blocks you.
SRC.TAG.RECALLING 0
SRC.SOUND 0108
RETURN 1
ENDIF
if (<src.hits><1)
SRC.SYSMESSAGE @,3,1 You cannot cast when you are a dead.
SRC.TAG.RECALLING 0
return 1
endif
if (<findtype.t_armor.cont.uid> == <uid>)
f_fizzle
SRC.SYSMESSAGE @,3,1 Your equipped armors fail your casting.
SRC.TAG.RECALLING 0
return 1
endif
if ((<flags>&statf_freeze) || (<flags>&statf_stone)
f_fizzle
SRC.MESSAGE @,3,1 You cannot cast when you are freeze.
SRC.TAG.RECALLING 0
return 1
endif
src.action -1
EVENTS +e_runebook_recall
spell_say [Gate Travel]
spell_say Vas Rel Por
flags |= statf_freeze
ANIM 17
local.casttime=<eval <serv.spell.52.cast_time>-<tag0.fastercast>>
if (<local.casttime><30)
TIMERF 3,Runebook_Gate_Finish_Reags <ARGS>
else
TIMERF <eval <local.casttime>/10>,Runebook_Gate_Finish_Reags <ARGS>
endif
[EVENTS e_runebook_recall]
ON=@GETHIT
flags &= ~statf_freeze
EVENTS -e_runebook_recall
TAG.Recalling=
Sound 92
EFFECT 3,i_fx_smoke_small,30,36,0
MESSAGE @,3,1 The spell fizzles.
ON=@USERWARMODE
flags &= ~statf_freeze
EVENTS -e_runebook_recall
TAG.Recalling=
Sound 92
EFFECT 3,i_fx_smoke_small,30,36,0
MESSAGE @,3,1 The spell fizzles.
ON=@SPELLCAST
flags &= ~statf_freeze
EVENTS -e_runebook_recall
TAG.Recalling=
Sound 92
EFFECT 3,i_fx_smoke_small,30,36,0
MESSAGE @,3,1 The spell fizzles.
[function Runebook_Recall_Finish]
if (<mana>>11)
mana -= 12
flags &= ~statf_freeze
EVENTS -e_runebook_recall
IF <SRC.TAG0.Recalling>
OBJ=<SRC.TAG0.Recalling>
SRC.TAG.Recalling=
OBJ.TAG.CHARGES = <EVAL <OBJ.TAG0.Charges>+-1>
SRC.SOUND snd_spell_recall
SRC.GO <ARGS>
ENDIF
else
src.sysMESSAGE @,3,1 You lack sufficient mana for this spell.
SRC.TAG.RECALLING 0
flags &= ~statf_freeze
SRC.SOUND 0108
endif
[function Runebook_Recall_Finish_Reags]
if (<mana>>11)
mana -= 12
flags &= ~statf_freeze
EVENTS -e_runebook_recall
IF <SRC.TAG0.Recalling>
SRC.TAG.Recalling=
SRC.CONSUME <SERV.SPELL.32.RESOURCES>
SRC.SOUND snd_spell_recall
SRC.GO <ARGS>
ENDIF
else
src.sysMESSAGE @,3,1 You lack sufficient mana for this spell.
SRC.TAG.RECALLING 0
SRC.SOUND 0108
flags &= ~statf_freeze
endif
[function Runebook_Gate_Finish_Reags]
if (<mana>>39)
mana -= 40
flags &= ~statf_freeze
EVENTS -e_runebook_recall
IF <SRC.TAG0.Recalling>
SRC.TAG.Recalling=
SRC.CONSUME <SERV.SPELL.52.RESOURCES>
SRC.SOUND snd_spell_gate_travel
SERV.NEWITEM=i_moongate_blue
NEW.NAME moongate
NEW.COLOR 021
NEW.EVENTS +e_runebook_moongate
NEW.ATTR=04032
NEW.TIMER=30
NEW.MOREP=<ARGS>
NEW.P=<SRC.P>
SERV.NEWITEM=i_moongate_blue
NEW.NAME moongate
NEW.COLOR 021
NEW.EVENTS +e_runebook_moongate
NEW.ATTR=04032
NEW.TIMER=30
NEW.MOREP=<SRC.P>
NEW.P=<ARGS>
ENDIF
else
src.sysMESSAGE @,3,1 You lack sufficient mana for this spell.
SRC.TAG.RECALLING 0
SRC.SOUND 0108
flags &= ~statf_freeze
endif
[TYPEDEF e_runebook_moongate]
ON=@DCLICK
SRC.GO <MOREP>
ON=@TIMER
REMOVE
RETURN 1
[function Rename_Runebook]
OBJ=<SRC.CTAG0.Runebook>
SRC.CTAG.Runebook=
IF !<ISNUM <ARGS>>
IF !<ISEMPTY <ARGS>>
OBJ.NAME=<ARGS>
SRC.SysMESSAGE @,3,1 Book renamed to <ARGS>.
ELSE
SRC.SysMESSAGE @,3,1 You must enter a name to rename the runebook.
ENDIF
ELSE
SRC.SysMESSAGE @,3,1 Runebook name cannot be a number.
ENDIF