tf-scripts/common/stats.tf

189 lines
6.2 KiB
HCL

; by Ingwar
/def -Fp2 -mregexp -t'Zabil.s ' _zabiles_cosik_licz = %;\
/_dodaj_do_zabitych %{PR}%;\
/substitute -p @{C%c_crit_bold}%{PL}%{P0}%{PR} (%{ownkills}/%{allkills})@{n}
/def -Fp2 -mregexp -t'( | \\(.*\\) )zabil(a|o|) ([a-zA-z ]*)\.$' _ktos_zabil_cosik_licz = \
/_dodaj_do_kto_zabil %{PL} %;\
/_dodaj_do_poleglych %{P3}
/def _dodaj_do_zabitych = \
/if (strstr({L1},".")>=0) \
/let zabity=$[substr({L1},0,strlen({L1})-1)] %;\
/else \
/let zabity=%{L1} %;\
/endif %;\
/let zabity=$[substr({zabity},0,13)] %;\
/if ($(/listvar -s allkilled_%{zabity})=~NULL) \
/set ownkilled_%{zabity}=0 %;\
/set allkilled_%{zabity}=0 %;\
/endif %;\
/test ++ownkilled_%{zabity} %;\
/test ++allkilled_%{zabity} %;\
/test ++ownkills%;\
/test ++allkills
/def _dodaj_do_poleglych = \
/if (strstr({L1},".")>=0) \
/let zabity=$[substr({L1},0,strlen({L1})-1)] %;\
/else \
/let zabity=%{L1} %;\
/endif %;\
/let zabity=$[substr({zabity},0,13)] %;\
/if ($(/listvar -s allkilled_%{zabity})=~NULL) \
/set ownkilled_%{zabity}=0 %;\
/set allkilled_%{zabity}=0 %;\
/endif %;\
/test ++allkilled_%{zabity} %;\
/test ++allkills
/def _dodaj_do_kto_zabil = \
/if (strstr({L1},".")>=0) \
/let zabity=$[substr({L1},0,strlen({L1})-1)] %;\
/else \
/let zabity=%{L1} %;\
/endif %;\
/let zabity=$[substr({zabity},0,13)] %;\
/if ($(/listvar -s killer_%{zabity})=~NULL) \
/set killer_%{zabity}=0 %;\
/endif %;\
/test ++killer_%{zabity}
/def zabici = \
/let po_ile=%{1} %;\
/if ({po_ile} < 1) \
/let po_ile=2%;\
/endif %;\
/let linia1=$[strrep("-------------------------+",po_ile-1)] %;\
/let linia= %;\
/let cc=0 %;\
/echo -p +%{linia1}-------------------------+%;\
/let zabici_lista=$(/listvar -s -mglob allkilled_*) %;\
/let zabici_lista=$[strcat(zabici_lista," end")] %;\
/while /let i=$[strstr(zabici_lista," ")]%; /@test i > 0%; /do \
/let ktory_var=$[substr(zabici_lista,0,i)] %;\
/let ktory_ile=$(/eval /listvar -v %{ktory_var}) %;\
/let ktory_nazwa=$[substr(ktory_var,strrchr(ktory_var,"_")+1)] %;\
/let ktory_ile2=$(/eval /listvar -v ownkilled_%{ktory_nazwa}) %;\
/if (cc<{po_ile}) \
/let linia=$[strcat(linia,"|",pad(ktory_nazwa,13),": (",pad(ktory_ile2,3),"/",pad(ktory_ile,4),")")] %;\
/test ++cc %;\
/let zabici_lista=$[substr(zabici_lista,i+1)] %;\
/else \
/echo -p %{linia}| @{n}%;\
/let cc=0 %;\
/let linia= %;\
/endif %;\
/done %;\
/if (cc>0) \
/echo -p $[strcat(linia,strrep("| : ( )",po_ile-cc),"|")] @{n}%;\
/endif %;\
/let linia=$[strcat(" ", decode_attr(pad(ownkills,6), {zc_info}), " |")] %;\
/if (wrapsize > {po_ile}*27+6) \
/let linia=$[strcat(linia,"@{n}")] %;\
/endif %;\
/echo -p +%{linia1}----- W sumie: %{linia} %;\
/echo -p +%{linia1}-------------------------+%;\
/let linia= %;\
/let cc=0 %;\
/let zabici_lista=$(/listvar -s -mglob killer_*) %;\
/let zabici_lista=$[strcat(zabici_lista," end")] %;\
/while /let i=$[strstr(zabici_lista," ")]%; /@test i > 0%; /do \
/let ktory_var=$[substr(zabici_lista,0,i)] %;\
/let ktory_ile=$(/eval /listvar -v %{ktory_var}) %;\
/let ktory_nazwa=$[substr(ktory_var,strrchr(ktory_var,"_")+1)] %;\
/if (cc<{po_ile}) \
/let linia=$[strcat(linia,"|",pad(ktory_nazwa,13),": ( ",pad(ktory_ile,3),")")] %;\
/test ++cc %;\
/let zabici_lista=$[substr(zabici_lista,i+1)] %;\
/else \
/echo -p %{linia}| @{n}%;\
/let cc=0 %;\
/let linia= %;\
/endif %;\
/done %;\
/if (cc>0) \
/echo -p $[strcat(linia,strrep("| : ( )",po_ile-cc),"|")] @{n}%;\
/endif %;\
/let linia=$[strcat(" ", decode_attr(pad(allkills, 6), {zc_info}), " |")] %;\
/if (wrapsize > {po_ile}*27+6) \
/let linia=$[strcat(linia," @{n}")] %;\
/endif %;\
/echo -p +%{linia1}----- W sumie: %{linia} %;\
/echo -p +%{linia1}-------------------------+@{n}
; by thornag
/def _get_index = \
/let __element=%{1}%; \
/let __list=%{2}|%; \
/let __i=-1%; \
/while ({__list}!~"") \
/let __i=$[{__i}+1]%; \
/let __p=$[strstr({__list}, "|")]%; \
/let __el=$[substr({__list},0,{__p})]%; \
/if ({__el}=~{__element}) \
/return %{__i}%; \
/endif%; \
/let __list=$[substr({__list},{__p}+1)]%; \
/done%; \
/return -1
/def _get_element = \
/let __index=%{1}%; \
/let __list=%{2}|%; \
/let __i=-1%; \
/while ({__list}!~"") \
/let __i=$[{__i}+1]%; \
/let __p=$[strstr({__list}, "|")]%; \
/let __el=$[substr({__list},0,{__p})]%; \
/if ({__i}=={__index}) \
/return strcat({__el})%; \
/endif%; \
/let __list=$[substr({__list},{__p}+1)]%; \
/done%; \
/return ""
/def _cpref = \
/return substitute(strcat(decode_attr(strcat("@{C%c_info}[", {1}, "]@{n} ", {PL}, {P0}, {PR}))))
/def -Fp2 -mregexp -t'Poczynil.s (.*) postepy, od momentu kiedy' _postepy_lap = \
/let __postep=%{P1}%;\
/let __index=$[_get_index({__postep}, {_postepy_list})]%;\
/_postepy_zanotuj %{__index}%;\
/_cpref $[{__index}-1]/%{_postepy_max}
/def _postepy_zanotuj = \
/let __postep=%{1}%; \
/if ({__postep}>{_postepy_current})\
/set _postepy_czas_%{__postep}=$[ftime("%H:%M", time())]%;\
/set _postepy_own_%{__postep}=%ownkills%;\
/set _postepy_all_%{__postep}=%allkills%;\
/set _postepy_current=%{__postep}%;\
/endif
/def postepy = \
/let __index=0%; \
/echo +--------------+-------+-----+-----+%; \
/while ({__index}<={_postepy_current}) \
/let __postep=$[_get_element({__index}, {_postepy_list})]%; \
/let __czas=$(/listvar -v _postepy_czas_$[strcat({__index})])%; \
/let __own=$(/listvar -v _postepy_own_$[strcat({__index})])%; \
/let __all=$(/listvar -v _postepy_all_$[strcat({__index})])%; \
/if ({__czas} =~ "" )\
/let __czas=?:?%;\
/endif%;\
/if ({__own} =~ "" )\
/let __own=?%;\
/endif%;\
/if ({__all} =~ "" )\
/let __all=?%;\
/endif%;\
/echo $[strcat("| ", pad({__postep},-13), "| ", pad({__czas},5), " |", pad({__own},4), " |", pad({__all},4), " |")]%; \
/let __index=$[{__index}+1]%; \
/done%; \
/if ({_postepy_current}==-1) \
/echo -p @{n}| | |%; \
/endif%; \
/echo +--------------+-------+-----+-----+