Mercurial > hg > batmud > ggrtf
changeset 586:a0bb7ca6158b
Some macro and variable namespace cleanups; Added (heavily modified before committing, tho) reagent pouch helper/beautifier from Jeskko.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 24 Dec 2006 20:09:54 +0000 |
parents | b608f35b7478 |
children | 81189696e27b |
files | ggrtf-misc.tf |
diffstat | 1 files changed, 63 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/ggrtf-misc.tf Sun Dec 24 20:07:33 2006 +0000 +++ b/ggrtf-misc.tf Sun Dec 24 20:09:54 2006 +0000 @@ -199,42 +199,77 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Manglers/calculators for some generic containers +;; Helper for money purse ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -/def -i prmatchadd =\ - /if (regmatch(strcat("([0-9]+) ",{1}),mcont_match))\ - /set mcont_total=$[mcont_total + ({P1} * {2})]%;\ +/def -i gpurse_add =\ + /if (regmatch(strcat("([0-9]+) ",{1}),gpursec_match))\ + /set gpursec_total=$[gpursec_total + ({P1} * {2})]%;\ /let mptmp=@{BCwhite}$[prprettyvalstr({P1})]@{n} @{%{3}}%{1}@{n}%;\ - /if (mcont_str!~"")\ - /set mcont_str=%{mcont_str}, %{mptmp}%;\ + /if (gpursec_str!~"")\ + /set gpursec_str=%{gpursec_str}, %{mptmp}%;\ /else \ - /set mcont_str=%{mptmp}%;\ + /set gpursec_str=%{mptmp}%;\ /endif%;\ /endif -/def -i gmisc_cpurse =\ - /set mcont_str=%;/set mcont_total=0%;\ - /test prmatchadd("mithril", 500, "BCgreen")%;\ - /test prmatchadd("batium", 100, "Cgreen")%;\ - /test prmatchadd("anipium", 50, "BCyellow")%;\ - /test prmatchadd("platinum", 10, "Cyellow")%;\ - /test prmatchadd("gold", 1, "Cwhite")%;\ - /test prmatchadd("silver", 0.6, "BCcyan")%;\ - /test prmatchadd("bronze", 0.4, "Ccyan")%;\ - /test prmatchadd("copper", 0.2, "BCmagenta")%;\ - /test prmatchadd("tin", 0.1, "Cmagenta")%;\ - /test prmatchadd("zinc", 0.05, "Cred")%;\ - /test prmatchadd("mowgles", 0.01, "BCred")%;\ - /msw It contains %{mcont_str} (Total: @{BCwhite}$[prprettyvalstr(mcont_total)]@{n} in @{BCyellow}gold@{n}) +/def -i gpurse_report =\ + /set gpursec_str=%;/set gpursec_total=0%;\ + /test gpurse_add("mithril", 500, "BCgreen")%;\ + /test gpurse_add("batium", 100, "Cgreen")%;\ + /test gpurse_add("anipium", 50, "BCyellow")%;\ + /test gpurse_add("platinum", 10, "Cyellow")%;\ + /test gpurse_add("gold", 1, "Cwhite")%;\ + /test gpurse_add("silver", 0.6, "BCcyan")%;\ + /test gpurse_add("bronze", 0.4, "Ccyan")%;\ + /test gpurse_add("copper", 0.2, "BCmagenta")%;\ + /test gpurse_add("tin", 0.1, "Cmagenta")%;\ + /test gpurse_add("zinc", 0.05, "Cred")%;\ + /test gpurse_add("mowgles", 0.01, "BCred")%;\ + /msw It contains %{gpursec_str} (Total: @{BCwhite}$[prprettyvalstr(gpursec_total)]@{n} in @{BCyellow}gold@{n}) + +/def -i -ag -mregexp -t"^It contains ([a-z0-9 ,]+) coins\.$" gpurse_rep1 =\ + /set gpursec_match=%{P1}%;/gpurse_report + +/def -i -ag -mregexp -t"^It contains ([a-z0-9 ,]+)$" gpurse_rep2 =\ + /set gpursec_st=1%;/set gpursec_match=%{P1} + +/def -i -ag -E(gpursec_st==1) -mregexp -t"^([a-z0-9 ,]*)coins\.$" gpurse_rep3 =\ + /set gpursec_st=0%;/set gpursec_match=%{gpursec_match} %{P1}%;/gpurse_report + -/def -i -ag -mregexp -t"^It contains ([a-z0-9 ,]+) coins\.$" gmisc_cpurse1 =\ - /set mcont_match=%{P1}%;/gmisc_cpurse +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Helper for reagent pouch +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +/def -i grpouch_report =\ + /substitute -p @{BCyellow}$[pad({1},5)]@{n} | @{BCgreen}$[pad({6},-25)]@{n} (@{BCred}$[pad({2},4)]@{n},@{Cgreen}$[pad({3},4)]@{n},@{Cyellow}$[pad({4},4)]@{n}) @{BCgray}(%{5})@{n} + +/def -i grpouch_def =\ + /let _tmps=$[replace(" ","_",tolower({2}))]%;\ + /def -mregexp -t"^(One|Two|Three|Four|Five|Six|Seven|Eight|Nine|[0-9]+) (%{1}) \\(([0-9]+) power, ([0-9]+) standard, ([0-9]+) poor\\)$$" grpouch_%{_tmps} =\ + /test grpouch_report({P1},{P3},{P4},{P5},{P2},"%{2}") + -/def -i -ag -mregexp -t"^It contains ([a-z0-9 ,]+)$" gmisc_cpurse2 =\ - /set mcont_st=1%;/set mcont_match=%{P1} - -/def -i -ag -E(mcont_st==1) -mregexp -t"^([a-z0-9 ,]*)coins\.$" gmisc_cpurse3 =\ - /set mcont_st=0%;/set mcont_match=%{mcont_match} %{P1}%;/gmisc_cpurse +/test grpouch_def("handfuls? of olivine powder", "Acid Blast") +/test grpouch_def("stone cubes?", "Acid Shield") +/test grpouch_def("pairs? of interlocked bloodstone rings", "Acid Storm") +/test grpouch_def("small highsteel discs?", "Armour of Aether") +/test grpouch_def("tiny leather bags? \(empty\)", "Aura of Wind") +/test grpouch_def("bronze marbles?", "Blast Vacuum") +/test grpouch_def("steel arrowheads?", "Cold Ray") +/test grpouch_def("small pieces? of electrum wire", "Electrocution") +/test grpouch_def("small glass cones?", "Flame Shield") +/test grpouch_def("grey fur triangles?", "Frost Shield") +/test grpouch_def("copper rods?", "Golden Arrow") +/test grpouch_def("handfuls? of onyx gravel", "Hailstorm") +/test grpouch_def("ebony tubes?", "Killing Cloud") +/test grpouch_def("granite spheres?", "Lava Blast") +/test grpouch_def("blue cobalt cups?", "Lava Storm") +/test grpouch_def("small iron rods?", "Lightning Shield") +/test grpouch_def("clusters? of tungsten wires", "Lightning Storm") +/test grpouch_def("tiny platinum hammers?", "Magic Eruption") +/test grpouch_def("quartz prisms?", "Repulsor Aura") +/test grpouch_def("tiny amethyst crystals?", "Shield of Detoxification") +/test grpouch_def("silvery bark chips?", "Summon Carnal Spores") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;