view ggrtf-rais.tf @ 684:6f0452997253

Fixed expiration.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 05 Oct 2007 17:28:52 +0000
parents 4bc4bc602eaf
children 3c0c84672043
line wrap: on
line source

;;
;; GgrTF::Raise - Support for rais/ress/body/reinc spells
;; (C) Copyright 2006 Matti Hämäläinen (Ggr)
;;
;; This file (triggerset) is Free Software distributed under
;; GNU General Public License version 2.
;;
;; NOTICE! This file requires GgrTF (version 0.6.0 or later) to be loaded.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Bindings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/if (opt_bindings=~"on")\
	/prdefgbind -s"cclear"	-c"/acclear"%;\
	/prdefgbind -s"acc"	-c"/aclist"%;\
	/prdefgbind -s"clast"	-c"/accast"%;\
/endif


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Helper functions and initialization
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/set lst_accepted=

/def -i gacpt_list_ins =\
	/gacpt_list_del_do $[prconvto({1})] %{lst_accepted}%;\
	/msq @{BCyellow}%{1}@{n} accepted @{BCgreen}%{2}@{n}!%;\
	/set lst_accepted=$[prconvto({1})] $[prconvto({2})] $[time()] %{lst_accepted}

/def -i gacpt_list_del_do =\
	/let _atmp=%{1}%;/shift%;\
	/set lst_accepted=%;\
	/while ({#})\
		/if ({1}!~_atmp)\
			/set lst_accepted=%{1} %{2} %{3} %{lst_accepted}%;\
		/endif%;\
		/shift%;/shift%;/shift%;\
	/done

/def -i gacpt_list_del =\
	/msq Removing @{BCyellow}%{1}@{n} from list ...%;\
	/gacpt_list_del_do $[prconvto({1})] %{lst_accepted}


/def -i gacpt_list_get =\
	/let _atmp=$[tolower({1})]%;/shift%;\
	/set acc_name=%;/set acc_method=%;/set acc_time=%;\
	/while ({#})\
		/if ({1}=~_atmp)\
			/set acc_name=$[prconvfrom({1})]%;\
			/set acc_method=$[prconvpm({2})]%;\
			/set acc_time=%{3}%;\
			/break%;\
		/endif%;\
		/shift%;/shift%;/shift%;\
	/done


/def -i gacpt_list_getfirst =\
	/if ({#})\
		/set acc_name=$[prconvfrom({1})]%;\
		/set acc_method=$[prconvpm({2})]%;\
		/set acc_time=%{3}%;\
	/else \
		/set acc_name=%;\
		/set acc_method=%;\
		/set acc_time=%;\
	/endif


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Implement actual commands
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/def acclear =\
	/msq Clearing accepted list ...%;\
	/set lst_accepted=


/def -i gacpt_list_print =\
	/while ({#})\
		/msw | @{BCyellow}$[prsubipad(prconvfrom({1}),15)]@{n} | @{BCgreen}$[prsubpad(prconvpm({2}),20)]@{n} | $[prsubpad(prgetstime({3}),10)] |%;\
		/shift%;/shift%;/shift%;\
	/done

/def aclist =\
	/if (lst_accepted!~"")\
		/msw ,-----------------.%;\
		/msw | Latest accepted |%;\
		/msw +-----------------+-----------------------------------.%;\
		/gacpt_list_print %{lst_accepted}%;\
		/msw `-----------------------------------------------------'%;\
	/else \
		/msq Nobody has accepted from you!%;\
	/endif


/def accast =\
	/if (lst_accepted!~"")\
		/if ({#} > 0)\
			/gacpt_list_get %{1} %{lst_accepted}%;\
		/else \
			/gacpt_list_getfirst %{lst_accepted}%;\
		/endif%;\
		/if (acc_name!~"")\
			/msq Casting @{BCgreen}%{acc_method}@{n} at @{BCyellow}%{acc_name}@{n}.%;\
			@tell %{acc_name} Casting %{acc_method} ...%;\
			@cast %{acc_method} at %{acc_name}%;\
		/else \
			/msq Internal error! (lst_accepted not empty, but could not get name for last anyway)%;\
		/endif%;\
	/else \
		/msq Nobody has accepted from you!%;\
	/endif


/def -i -p9999 -mregexp -t"^You resurrect ([A-Z][a-z]+)\.$" gacpt_succ1 =\
	/test gacpt_list_del({P1})

/def -i -p9999 -mregexp -t"^You raise ([A-Z][a-z]+) from the dead\.$" gacpt_succ2 =\
	/test gacpt_list_del({P1})

/def -i -p9999 -mregexp -t"^You create a new body for ([A-Z][a-z]+)\.$" gacpt_succ3 =\
	/test gacpt_list_del({P1})

/def -i -mregexp -t"^You trace misty green runes on a water lily flower " gacpt_succA =\
	/set gacpt_st=1

/def -i -E(acpt_st==1) -msimple -t"With a green shimmering flash, the water lily flower disappears." gacpt_succB =\
	/set gacpt_st=0%;/test gacpt_list_del(cast_info_t)

/def -i -p9999 -ag -mregexp -t"^([A-Z][a-z]+) accepts (raise dead|resurrect|new body|reincarnation|reanimation) from you\.$" gacpt_you =\
	/test gacpt_list_ins({P1},{P2})

/def -i -p9999 -ag -mregexp -t"^([A-Z][a-z]+) accepted from someone else\.$" gacpt_off =\
	/msq @{BCgreen}%{P1}@{n} @{BCwhite}accepted from someone else!@{n}%;\
	/test gacpt_list_del({P1})