commit 097359246c623963aaa63690c07fdebd7fd4f332 Author: Brandon Cornejo Date: Mon Nov 12 20:56:58 2018 +0000 start diff --git a/Discworld b/Discworld new file mode 100755 index 0000000..5e3eb9d --- /dev/null +++ b/Discworld @@ -0,0 +1,14 @@ + +if [[ ! $(tmux ls -F '#S') =~ discworld ]]; then + rm logs/minimap.log && touch logs/minimap.log + rm logs/mapdoortext.log && touch logs/mapdoortext.log + rm logs/chat.log && touch logs/chat.log + + tmux new-session -d -A -D -s discworld 'tail -fs .5 logs/chat.log' + tmux select-window -t discworld:0 + tmux split-window -v -p 85 'bash' + tmux send-keys 'tt++ -G config.tin' 'C-m' + # clear && watch -n10 logs/xptimers.log +fi + +tmux -2 attach-session -t discworld -d diff --git a/config.tin b/config.tin new file mode 100644 index 0000000..272b80d --- /dev/null +++ b/config.tin @@ -0,0 +1,35 @@ +#VARIABLE {chat_file} {logs/chat.log} + +#CONFIG {SPEEDWALK} {OFF}; +#CONFIG {SPLIT}; +#CONFIG {PACKET PATCH} {5}; +#CONFIG {COLOR PATCH} {ON}; +#CONFIG {MCCP} {ON}; +#CONFIG {LOG} {RAW}; +#CONFIG {BUFFER SIZE} {2000000}; + +#SPLIT {2} {1}; + +#READ {src/channels.tin}; +#READ {src/actions.tin}; +#READ {src/aliases.tin}; +#READ {src/gmcp.tin}; + +#READ {src/prompt.tin}; +#READ {src/xpmonitor.tin}; +#READ {src/tpamonitor.tin}; +#READ {src/timers.tin}; + +#READ {src/combat.tin}; +#READ {src/deadletter.tin}; +#READ {src/quow.tin}; +#READ {src/magic.tin}; + +#SESSION {discworld} {discworld.starturtle.net} {4242}; + +#FORMAT {log_file} {logs/active/%t.log} {%Y-%m-%d}; +#LOG {APPEND} {$log_file}; + +#ACTION {Greco the Departure Gecko waves.} {#end} + +#FORMAT {start_time} {%T}; diff --git a/install b/install new file mode 100755 index 0000000..854caa8 --- /dev/null +++ b/install @@ -0,0 +1,8 @@ +sed -i "1s?^?cd "`pwd`"\n?" Discworld + +if [[ $PREFIX = *"com.termux"* ]]; then + ln -s "$(pwd)/Discworld" $PREFIX/bin/disc; +else + mkdir -p ~/bin + ln -s "$(pwd)/Discworld" ~/bin/disc; +fi diff --git a/logs/active/active.log b/logs/active/active.log new file mode 100644 index 0000000..e69de29 diff --git a/logs/chat.log b/logs/chat.log new file mode 100644 index 0000000..e69de29 diff --git a/logs/mapdoortext.log b/logs/mapdoortext.log new file mode 100644 index 0000000..e69de29 diff --git a/logs/minimap.log b/logs/minimap.log new file mode 100644 index 0000000..e69de29 diff --git a/logs/xptimers.log b/logs/xptimers.log new file mode 100644 index 0000000..e69de29 diff --git a/src/actions.tin b/src/actions.tin new file mode 100644 index 0000000..dcf01e4 --- /dev/null +++ b/src/actions.tin @@ -0,0 +1,35 @@ +#CLASS {actions} {kill}; +#CLASS {actions} {open}; + +#NOP ==[TPA Alerts]== +#HIGHLIGHT {^There is a sudden white flash. Your magical shield has broken.$} {bold red underscore}; +#HIGHLIGHT {^There is a sudden white flash around {(?!a passing wizard).+}.$} {bold red underscore}; +#ACTION {^There is a sudden white flash around {(?!a passing wizard).+}.$} { + #showme {\a}; + #line {log} {$chat_file}; +}; + +#NOP ==[T-Shop Alerts]== +#HIGHLIGHT {Greasy sparks crawl over the %1 wall, and a door silently materialises.} {bold green underscore}; +#HIGHLIGHT {There is a doorway in the %1 wall leading into a curious shop.} {bold green underscore}; + +#NOP ==[NPC Highlighting]== +#HIGHLIGHT {thug} {red}; +#HIGHLIGHT {bodyguard} {red}; +#HIGHLIGHT {hoplite} {red}; + +#NOP ==[Incident Highlighting]== +#HIGHLIGHT {^%1 grabs %2 from you. You struggle briefly but %3 wrests it from your grip and makes for a hasty retreat.$} {bold red underscore}; +#HIGHLIGHT {^As %1 dies %2 drops %3 in shock.$} {bold green underscore}; +#HIGHLIGHT {^When you open the %1 you think you can hear a faint rumbling sound from it.$} {red underscore}; +#HIGHLIGHT {^Whoops! You tried to carry too many things and fumbled %1} {red underscore}; +#HIGHLIGHT {%1 juggles around his stuff and fumbles %2} {red underscore}; + +#NOP ==[Command Color Highlighting]== +#SUB {%w %w with a total of %* item} {<148>%1 %2<099> with a total of <148>%3<099> item} + +#ACTION {Thanks for playing. See you next time.} { + #end; +} + +#CLASS {actions} {close}; diff --git a/src/aliases.tin b/src/aliases.tin new file mode 100644 index 0000000..aa1ea68 --- /dev/null +++ b/src/aliases.tin @@ -0,0 +1,23 @@ +#ALIAS {setsize} {rows 300;cols 110}; + +#ALIAS {^clear$} { + #system {tput clear}; + #split {2} {1}; + setsize; +}; + +#ALIAS {htop} { + #system {htop}; +}; + +#ALIAS {rst} { + #read {config.tin}; + setsize; + shields; +}; + +#ALIAS {wiki} { + #system {w3m https://dwwiki.mooo.com/w/index.php?search=%0}; + #split {2} {1}; + setsize; +}; diff --git a/src/channels.tin b/src/channels.tin new file mode 100644 index 0000000..cee9f1d --- /dev/null +++ b/src/channels.tin @@ -0,0 +1,13 @@ +#CLASS {channels} {kill}; +#CLASS {channels} {open}; + +#ACTION {^You {tell|ask|exclaim to} %1:%2} {#LINE {LOG} {$chat_file}}; +#ACTION {^%1 {tells|asks|exclaims to} %*you{|(?: in \w+)?}: %4} {#LINE {LOG} {$chat_file}}; +#ACTION {^[%1] %2{:|} %3} {#LINE {LOG} {$chat_file}}; +#ACTION {^(newbiehelpers)} {#LINE {LOG} {$chat_file}}; +#ACTION {^(newbie)} {#LINE {LOG} {$chat_file}}; +#ACTION {^(Playerkillers) %1 wisps:? %2} {#LINE {LOG} {$chat_file}}; +#ACTION {^(Thieves) %1 wisps:? %2} {#LINE {LOG} {$chat_file}}; +#ACTION {^(They Might Be Alts) } {#LINE {LOG} {$chat_file}}; + +#CLASS {channels} {close}; diff --git a/src/combat.tin b/src/combat.tin new file mode 100644 index 0000000..aaa429b --- /dev/null +++ b/src/combat.tin @@ -0,0 +1,40 @@ +#CLASS {combat} {kill}; +#CLASS {combat} {open}; + +#VARIABLE {my_attacks_color} {orange}; +#VARIABLE {enemy_attack_color} {red}; + +#NOP ==[Me Attacking Them]== +#HIGHLIGHT {^You {viciously |messily |barely |neatly |}{thrust|snick|fillet|poke|chop up|chop|jab|scratch|boot|kick|hit|tickle|hack|prick|shred|nick|cut|stab|perforate|pierce|impale|slice|skewer|take} {a sliver off |into |}%1{'?s?} %2 {on|with} %3} {$my_attacks_color}; +#HIGHLIGHT {^You {viciously |messily |barely |neatly |}stab %1 {deeply |}in %2 with %3} {$my_attacks_color}; +#HIGHLIGHT {^You stab %1 right through %2's %3} {$my_attacks_color}; +#HIGHLIGHT {^You {viciously |messily |barely |neatly |}{poke|kick|punch|jab|boot|tickle} %1 in %2} {$my_attacks_color}; + + +#NOP ==[My Specials]== +#HIGHLIGHT {^You attempt to prepare %1} {bold red}; +#HIGHLIGHT {^You prepare to {stab|slice|trip|shove|impale|kick|punch} %2} {bold green}; +#HIGHLIGHT {^You attempt to launch a powerful attack. %1} {bold red}; +#HIGHLIGHT {^You launch a powerful attack. %1} {bold green}; +#HIGHLIGHT {^You try to {trip|shove} %1} {bold red}; +#HIGHLIGHT {^You shove %1} {bold green}; +#HIGHLIGHT {^You trip %1} {bold green}; +#HIGHLIGHT {^You lose the moment.} {bold red}; +#HIGHLIGHT {^You {skilfully |silently|}sneak around %1 without being spotted and manage to catch %w by surprise.$} {bold green}; +#HIGHLIGHT {^You hold your cover as you {skilfully |silently|}sneak around %1 and manage to catch %w by surprise.$} {bold green}; + + + +#NOP ==[Them Attacking Me]== +#HIGHLIGHT {%1 but your %2 absorbs {some|most} of the blow.$} {$enemy_attack_color}; +#HIGHLIGHT {%1 runs you through the %2 with %3.$} {$enemy_attack_color}; +#HIGHLIGHT {%1 {viciously |messily |barely |neatly |}{poke|chop|jab|scratche|boot|kick|hit|tickle|hack|prick|shred|nick|cut|stab|perforate|pierce|impale|slice|skewer}s %w %3 into your %4.$} {$enemy_attack_color}; +#HIGHLIGHT {%1 {viciously |messily |barely |neatly |}{poke|chop|jab|scratche|boot|kick|hit|tickle|hack|prick|shred|nick|cut|stab|perforate|pierce|impale|slice|skewer}s your %2 {into pieces |}{with|on} %w %4.$} {$enemy_attack_color}; +#HIGHLIGHT {%1 {viciously |messily |barely |neatly |}{poke|chop|jab|scratche|boot|kick|hit|tickle|hack|prick|shred|nick|cut|stab|perforate|pierce|impale|slice|skewer}s into your %2 with %w %3.$} {$enemy_attack_color}; +#HIGHLIGHT {%1 {viciously |messily |barely |neatly |}{poke|chop|jab|scratche|boot|kick|hit|tickle|hack|prick|shred|nick|cut|stab|perforate|pierce|impale|slice|skewer}s you {deeply |}in the %2.$} {$enemy_attack_color}; +#HIGHLIGHT {%1 {viciously |messily |barely |neatly |}{poke|chop|jab|scratche|boot|kick|hit|tickle|hack|prick|shred|nick|cut|stab|perforate|pierce|impale|slice|skewer}s you {deeply |}in the %2 with %3.$} {$enemy_attack_color}; +#HIGHLIGHT {%1 pierces your %2 with %3.$} {$enemy_attack_color}; +#HIGHLIGHT {%1 hitting your %2.$} {$enemy_attack_color}; + + +#CLASS {combat} {close}; diff --git a/src/deadletter.tin b/src/deadletter.tin new file mode 100644 index 0000000..5c4d0f3 --- /dev/null +++ b/src/deadletter.tin @@ -0,0 +1,93 @@ +#CLASS {deadletter} {kill}; +#CLASS {deadletter} {open}; + +#VAR {distant_land_targets} { + {Boy Willie}{Boy [Willie]} + {Disembowel-Meself-Honourably Dibhala}{Disembowel-Meself-Honourably [Dibhala]} + {Glod-san}{[Glod-san]} + {Laggy-san}{[Laggy-san]} + {Lon Fah Lo}{Lon Fah [Lo]} + {Mad Hamish}{Mad [Hamish]} + {No Go Wan}{No Go [Wan]} + {Quisoda}{[Quisoda]} + {Ruto of Fish}{[Ruto] of Fish} + {Ryattenoki}{[Ryattenoki]} + {Shi Do Gai}{Shi Do [Gai]} + {Lap-lip}{[Lap-lip]} + {Lip-phon Lap-top}{Lip-phon [Lap-top]} + {Mihk-gran-bohp}{Mihk-gran-[bohp]} + {Phos-phor}{[Phos]-phor} + {Very Reverend Khepresh}{Very Reverend [Khepresh]} + {Yclept}{[Yclept]} + {Tuffy}{[Tuffy]} + {Casanunda}{[Casanunda]} + {Greig Schwitz}{Greig [Schwitz]} + {Noobie}{[Noobie]} + {Tfat Chick}{Tfat [Chick]} + {Cut Me Own Hand Off Dhblah}{Cut Me Own Hand Off [Dhblah]} + {Miss Pennie Laced}{Miss Pennie [Laced]} + {Berti Boggis}{[Berti] Boggis} + {The Proprietor}{The Proprietor} +} + +#alias {/solveletter} { + #if {&{letter_lines[1]}} { + #var {current_match_line} {^$letter_lines[1]$}; + #replace {current_match_line} {_} {%.}; + #foreach {$distant_land_targets[]} {target} { + #regex {$target} {$current_match_line} { + #format {letter_solution_line} {%c[DL] %c*%c Deliver to %c%s%c.} {bold blue} {bold yellow} {bold blue} {bold green} {$distant_land_targets[$target]} {bold blue}; + #echo {$letter_solution_line}; + }; + } + + }; +}; + + +#NOP ==[Halt Parsing Letter]== +#alias {/stopparsingletter} { + #unvar {parsing_dead_letter}; + /solveletter; +}; + +#action {^Deliver by %1.$} { + #if {&{parsing_dead_letter}} { + /stopparsingletter; + } +}; +#action {does not have anything written on it.} { + #if {&{parsing_dead_letter}} { + /stopparsingletter; + } +}; +#action {Cannot find "letter", no match.} { + #if {&{parsing_dead_letter}} { + /stopparsingletter; + } +}; +#action {You are too busy fighting to read at the moment.} { + #if {&{parsing_dead_letter}} { + /stopparsingletter; + } +}; + + +#NOP ==[Catch-all to grab letter lines, store only lines with a '_']== +#action {^%*$} { + #if {&{parsing_dead_letter}} { + #regex {%1} {%*_%*} { + #list {letter_lines} {add} {%1}; + }; + } +} {9}; + + +#NOP ==[Alias to attempt solve of letter in inventory]== +#ALIAS {sl} { + #send {read letter}; + #var {parsing_dead_letter} {0}; + #list {letter_lines} {create}; +} + +#CLASS {deadletter} {close}; diff --git a/src/gmcp.tin b/src/gmcp.tin new file mode 100644 index 0000000..036c05c --- /dev/null +++ b/src/gmcp.tin @@ -0,0 +1,78 @@ +#CLASS gmcp kill +#CLASS gmcp open + + +#FORMAT IAC %a 255 +#FORMAT DONT %a 254 +#FORMAT DO %a 253 +#FORMAT WONT %a 252 +#FORMAT WILL %a 251 +#FORMAT SB %a 250 +#FORMAT SE %a 240 + +#FORMAT GMCP %a 201 + +#ALIAS {debug {on|off}} +{ + #IF {"%1" == "on"} { #VARIABLE debug 1 }; + #ELSE { #VARIABLE debug 0 }; + #SHOWME { Debug is <139>$debug<099> }; + #NOP; +} + +#EVENT {IAC SB GMCP Char.Vitals IAC SE} +{ + #IF {$debug} { #SHOWME %1 }; + #VAR GMCP[oldvitals] {$GMCP[vitals]}; + #VAR GMCP[vitals] {%0}; + + #math {hploss} {$GMCP[vitals][hp] - $GMCP[oldvitals][hp]}; + #if {$hploss < -100} { + #echo {<139>HP IS FALLING! CAREFUL!<099>}; + #showme {\a\a}; + } + + update_prompt; +} + +#EVENT {IAC SB GMCP room.info IAC SE} +{ + #IF {$debug} { #SHOWME %1 }; + #VAR GMCP[room][info] {%0}; + #nop; +} + +#EVENT {IAC SB GMCP room.map IAC SE} +{ + #IF {$debug} { #SHOWME %1 }; + #VAR {minimap} {%0}; + #REPLACE {minimap} {u001b} {}; + #SYSTEM {rm logs/minimap.log && touch logs/minimap.log}; + + #LINE {log} {logs/minimap.log} {\n\n $minimap \n\n}; + #SYSTEM {sed -i -e 's/^/ /' logs/minimap.log}; +} + +#EVENT {IAC SB GMCP room.writtenmap IAC SE} +{ + #IF {$debug} { #SHOWME %1 }; + #VAR GMCP[room][mdt] {%0}; + #LINE {log} {logs/mapdoortext.log} {\n\n\n %0}; +} + +#EVENT {IAC WILL GMCP} +{ + #SHOWME {GMCP ENABLED}; + #SEND {$IAC$DO$GMCP\}; + #nop #SEND {$IAC$SB$GMCP Core.Hello { "client": "$CLIENT_NAME", "version": "$CLIENT_VERSION" } $IAC$SE\}; + #SEND {$IAC$SB$GMCP Core.Hello { "client": "TinTin++", "version": "2.01.2" } $IAC$SE\}; + #SEND {$IAC$SB$GMCP Core.Supports.Set ["Char.Vitals", "room.info", "room.map", "room.writtenmap"] $IAC$SE\} +} + +#EVENT {PROGRAM START} +{ + #VARIABLE CLIENT_NAME %0; + #VARIABLE CLIENT_VERSION %1; +} + +#CLASS gmcp close diff --git a/src/group.tin b/src/group.tin new file mode 100644 index 0000000..42bff04 --- /dev/null +++ b/src/group.tin @@ -0,0 +1,27 @@ +#CLASS {group} {kill}; +#CLASS {group} {open}; + +#VARIABLE {group_shields} {}; +#VARIABLE {group_shields_current} {}; + +#ACTION {^Arcane protection for %1:-} { + #var {group_shields_current} {%1}; +} + +#ACTION {^ * %1 is surrounded by a %2 impact shield.} { + #var {group_shields[$group_shields_current]} {TPA}; +} + +#ALIAS {rgs} { + #variable {group_shields} {}; + #variable {group_shields_current} {}; + #send {group shields}; +}; + +#ALIAS {sgs} { + #foreach {$group_shields[]} {name} { + #showme {$name: $group_shields[$name]}; + }; +}; + +#CLASS {group} {kill}; diff --git a/src/magic.tin b/src/magic.tin new file mode 100644 index 0000000..aebc922 --- /dev/null +++ b/src/magic.tin @@ -0,0 +1,59 @@ +#CLASS {magic} {kill}; +#CLASS {magic} {open}; + +#NOP ==[Delude Levels]== +#SUB {^It has a faint octarine shadow about it that disappears if you look at it squarely.$} {%0 <858>(1/5)<898>}; +#SUB {^It has a faint octarine shadow about it.$} {%0 <858>(2/5)<898>}; +#SUB {^It has an octarine shadow about it that flickers occasionally out of the corner of your eye.$} {%0 <858>(3/5)<898>}; +#SUB {^It has a flickering octarine shadow about it.$} {%0 <858>(4/5)<898>}; +#SUB {^It has a flickering octarine haze about it.$} {%0 <858>(5/5)<898>}; + +#HIGH {^The octarine shadow around %* deepens%*} {bold magenta} +#HIGH {^The octarine shadow around %* fades%*} {magenta} + + +#NOP ==[Item Enchantment Levels]== +#SUB {It occasionally pulses with octarine light} {%0 <858>(Lvl 1)<898>}; +#SUB {It emits a slight octarine glow} {%0 <858>(Lvl 2)<898>}; +#SUB {It softly pulses in dull octarine shades} {%0 <858>(Lvl 3)<898>}; +#SUB {It gives off a steady but dull octarine glow} {%0 <858>(Lvl 4)<898>}; +#SUB {It gives off a steady octarine glow} {%0 <858>(Lvl 5)<898>}; +#SUB {It glows an intense octarine} {%0 <858>(Lvl 6)<898>}; +#SUB {It emits a bright octarine colour} {%0 <858>(Lvl 7)<898>}; +#SUB {It brightly pulses octarine} {%0 <858>(Lvl 8)<898>}; +#SUB {It glows brilliant octarine shades} {%0 <858>(Lvl 9)<898>}; +#SUB {It radiates pure octarine brilliance} {%0 <858>(Lvl 10)<898>}; + + +#NOP ==[Background Magic Levels]== +#SUB {There is the residual taste of magic in this place} {%0 <858>(50-149 thaums)<898>}; +#SUB {This place has seen some use of magic} {%0 <858>(150-299 thaums)<898>}; +#SUB {A considerable amount of magic has been used here} {%0 <858>(300-499 thaums)<898>}; +#SUB {A very large quantity of magic has been manipulated here} {%0 <858>(500-749 thaums)<898>}; +#NOP red; +#SUB {You can feel the Dungeon Dimensions trying to push in} {%0 <818>(750-1000 thaums)<898>}; +#NOP bold red!; +#SUB {Little sparks flash in from the Dungeon Dimensions} {%0 <118>(1001-1500 thaums)<098>}; +#SUB {Apparations of things with lots of tentacles seem to be on the edge of your vision} {%0 <118>(1501-2000 thaums)<098>}; +#SUB {So much magic has been expended here that the area is in danger of dumping itself into the Dungeon Dimensions} {%0 <118>(2001-5000 thaums)<098>}; + + +#NOP ==[PFG Damage Values]== +#SUB {^{The fire singes} } {%1 <019>(<<119>15<019>%)<099> }; +#SUB {^{The fire burns} } {%1 <019>(<119>15<019>-<119>30<019>%)<099> }; +#SUB {^{The fire crisps} } {%1 <019>(<119>30<019>-<119>60<019>%)<099> }; +#SUB {^{The fire melts} } {%1 <019>(<119>60<019>-<119>75<019>%)<099> }; +#SUB {^{The fire incinerates} } {%1 <019>(<119>75<019>-<119>90<019>%)<099> }; +#SUB {^{The fire vaporises} } {%1 <019>(><119>90<019>%)<099> }; + + +#NOP ==[Replace Spell Casting]== +#ACTION {^You prepare to cast %1 {at|on} %2.$} { #showme { * <138>%1<098> -> %2}; #line gag} {3} +#ACTION {^You prepare to cast %1.$} { #showme { * <138>%1<098>}; #line gag} {4} + + +#NOP ==[Colour FCI Output]== +#SUB {The weave indicates that %1 is a %2, with %3 charges remaining.} {The weave indicates that <138>%1<098> is a <138>%2<098> with <158>%3<098> charges remaining.}; + + +#CLASS {magic} {close}; diff --git a/src/prompt.tin b/src/prompt.tin new file mode 100644 index 0000000..fa8615e --- /dev/null +++ b/src/prompt.tin @@ -0,0 +1,31 @@ +#NOP == Prompt Update Function == +#nop colors +#function {tpa_col} +{ + #if {"%0" == "invisible"} + #return <178>; + #if {"%0" == "dull red"} + #return <018>; + #if {"%0" == "bright red"} + #return <118>; + #if {"%0" == "wobbling orange"} + #return <188>; + #if {"%0" == "flickering yellow"} + #return <138>; + #return; +} + + +#ALIAS {update_prompt} { + xp_monitor; + #format {prompt_xp} {%Gxp in %s (%Gk/h)} {$session_xp} {$uptime[display]} {$xprate}; + + #var {prompt_tpa} {}; + + #if {$tpa_status == 1} { + #format {prompt_tpa} {%cTPA%c} {@tpa_col{$tpa_color}} {<098>}; + }; + + #format {prompt_line} {%+5s %+40s} {$prompt_tpa} {$prompt_xp}; + #showme {$prompt_line} {-1}; +} diff --git a/src/quow.tin b/src/quow.tin new file mode 100644 index 0000000..b6634e1 --- /dev/null +++ b/src/quow.tin @@ -0,0 +1,123 @@ +#CLASS {quow} {kill}; +#CLASS {quow} {open}; + +#VARIABLE {map_id_names} { + {1}{Ankh-Morpork} + {2}{AM Assassins} + {3}{AM Buildings} + {4}{AM Cruets} + {5}{AM Docks} + {6}{AM Guilds} + {7}{AM Isle of Gods} + {8}{Shades Maze} + {9}{Temple of Small Gods} + {10}{AM Temples} + {11}{AM Thieves} + {12}{Unseen University} + {13}{AM Warriors} + {14}{Pseudopolis Watch House} + {15}{Magpyr's Castle} + {16}{Bois} + {17}{Bes Pelargic} + {18}{BP Buildings} + {19}{BP Estates} + {20}{BP Wizards} + {21}{Brown Islands} + {22}{Death's Domain} + {23}{Djelibeybi} + {24}{IIL - DJB Wizards} + {25}{Ephebe} + {26}{Ephebe Underdocks} + {27}{Genua} + {28}{Genua Sewers} + {29}{GRFLX Caves} + {30}{Hashishim Caves} + {31}{Klatch Region} + {32}{Lancre Region} + {33}{Mano Rossa} + {34}{Monks of Cool} + {35}{Netherworld} + {37}{Pumpkin Town} + {38}{Ramtops Regions} + {39}{Sto-Lat} + {40}{Academy of Artificers} + {41}{Cabbage Warehouse} + {42}{AoA Library} + {43}{Sto-Lat Sewers} + {44}{Sprite Caves} + {45}{Sto Plains Region} + {46}{Uberwald Region} + {47}{UU Library} + {48}{Klatchian Farmsteads} + {49}{CTF Arena} + {50}{PK Arena} + {51}{AM Post Office} + {52}{Ninja Guild} + {53}{The Travelling Shop} + {54}{Slippery Hollow} + {55}{House of Magic - Creel} + {56}{Special Areas} + {57}{Skund Wolf Trail} +} + +#ALIAS {db gatherable %1} { + #unvariable {gatherable_display}; + + #format {query} {SELECT item_name, room_short, map_id, INSTR(item_name, '%s') pos FROM shop_items INNER JOIN rooms on rooms.room_id = shop_items.room_id WHERE pos > 0 AND sale_price = 'gather';} {%1}; + #format {db_command} {sqlite3 -separator ";" src/quow.db "%s"} {$query}; + + #script {gatherable_query_result} {$db_command}; + #list {gatherable_query_result} {size} {gatherable_result_size}; + + #if {$gatherable_result_size > 0} { + #foreach {$gatherable_query_result[%*]} {inner_query_result} { + #replace {inner_query_result} {\\} {}; + #list gatherable_results create {${inner_query_result}}; + + #variable {gatherable_info} { + {item_name}{$gatherable_results[1]} + {room_short}{$gatherable_results[2]} + {map_name}{$map_id_names[$gatherable_results[3]]} + }; + + #format {gatherable_display} {%cQuery Result: %c%s%c found in %c%s, %s%c} {bold blue}{green}{$gatherable_info[item_name]}{bold blue}{orange}{$gatherable_info[room_short]}{$gatherable_info[map_name]}{bold blue}; + #echo {$gatherable_display}; + } + } { + #format {gatherable_display} {%cQuery Result: %c%s%c was not found.} {bold blue}{green}{%1}{bold blue}; + #echo {$gatherable_display}; + } +} + +#ALIAS {db buyable %1} { + #unvariable {buyable_display}; + + #format {query} {SELECT item_name, sale_price, room_short, map_id, INSTR(item_name, '%s') pos FROM shop_items INNER JOIN rooms on rooms.room_id = shop_items.room_id WHERE pos > 0 AND sale_price != 'gather' LIMIT 10;} {%1}; + #format {db_command} {sqlite3 -separator ";" src/quow.db "%s"} {$query}; + + #script {buyable_query_result} {$db_command}; + #echo {RESULT: $buyable_query_result}; + #list {buyable_query_result} {size} {buyable_result_size}; + + #if {$buyable_result_size > 0} { + #foreach {$buyable_query_result[%*]} {inner_query_result} { + #replace {inner_query_result} {\\} {}; + #list buyable_results create {${inner_query_result}}; + + #variable {buyable_info} { + {item_name}{$buyable_results[1]} + {sale_price}{$buyable_results[2]} + {room_short}{$buyable_results[3]} + {map_name}{$map_id_names[$buyable_results[4]]} + }; + + #format {buyable_display} {%cQuery Result: %c%s%c (%c%s%c) found in %c%s, %s%c} {bold blue}{green}{$buyable_info[item_name]}{bold blue}{yellow}{$buyable_info[sale_price]}{bold blue}{orange}{$buyable_info[room_short]}{$buyable_info[map_name]}{bold blue}; + #echo {$buyable_display}; + } + } { + #format {buyable_display} {%cQuery Result: %c%s%c was not found.} {bold blue}{green}{%1}{bold blue}; + #echo {$buyable_display}; + } +} + +#CLASS {quow} {close}; diff --git a/src/timers.tin b/src/timers.tin new file mode 100644 index 0000000..cce79a9 --- /dev/null +++ b/src/timers.tin @@ -0,0 +1,347 @@ +#CLASS {xptimers} {kill}; +#CLASS {xptimers} {open}; + +#VARIABLE {xptimer_file} {logs/xptimers.log}; + +#VARIABLE {killtimers} { + {Delbert}{0} + {the Triad boss}{0} + {the bandit leader}{0} + {Hlakket the Bartender}{0} + {the Zoon Liar}{0} + {Slim Stevie}{0} + {the %* grflx worker}{0} + {the %* student}{0} + {the ceremonial guard}{0} + {the giant leader}{0} + {the %* rujona}{0} + {the %* lion}{0} + {Louis Accardo}{0} + {Marlon Gumboni}{0} +} + +#VARIABLE {killtimer_names} { + {Delbert}{delbert} + {the Triad boss}{medina boss} + {the bandit leader}{bandit leader} + {Hlakket the Bartender}{hlakket} + {the Zoon Liar}{zoon liar} + {Slim Stevie}{rogues} + {the %* grflx worker}{grflx} + {the %* student}{dojo} + {the ceremonial guard}{cguards} + {the giant leader}{giant leader} + {the %* rujona}{snail} + {the %* lion}{shaker lions} + {Louis Accardo}{stables} + {Marlon Gumboni}{casino} +} + +#VARIABLE {visittimers} { + {AMShades}{0} + {ebff897af2b8bb6800a9a8636143099d0714be07}{0} + {70546ec71867645ab5c51e9ce6087b75dcf4176f}{0} + {f6c60dd36ed38707eb954c3a670f2f9370a79399}{0} + {3862c5fd0fe83f4080bdb9b94519bf8da89d5015}{0} +} + +#VARIABLE {visittimer_names} { + {AMShades}{shades} + {ebff897af2b8bb6800a9a8636143099d0714be07}{smugglers} + {70546ec71867645ab5c51e9ce6087b75dcf4176f}{offler} + {f6c60dd36ed38707eb954c3a670f2f9370a79399}{black market} + {3862c5fd0fe83f4080bdb9b94519bf8da89d5015}{parades} +} + +#ALIAS {dtreset} { + #regex {%1} {all} { + #foreach {$killtimers[]} {spot} { + #format {killtimers[$spot]} {0}; + } + #foreach {$visittimers[]} {spot} { + #format {visittimers[$spot]} {0}; + } + #format {xptimer_message} {%c[XPTimer] %c*%c Resetting all spots to Unseen.} {bold blue} {bold yellow} {bold blue}; + #echo {$xptimer_message}; + #variable {dtreset_all} {1}; + }; + + #if {$dtreset_all < 1} { + #foreach {$killtimer_names[]} {spot} { + #regex {%1 %2} {$killtimer_names[$spot]} { + #format {killtimers[$spot]} {%T}; + #format {xptimer_message} {%c[XPTimer] %c*%c Resetting death timer for %c$killtimer_names[$spot]%c.} {bold blue} {bold yellow} {bold blue} {bold green} {bold blue}; + #echo {$xptimer_message}; + }; + } + #foreach {$visittimer_names[]} {spot} { + #regex {%1 %2} {$visittimer_names[$spot]} { + #format {visittimers[$spot]} {%T}; + #format {xptimer_message} {%c[XPTimer] %c*%c Resetting visit timer for %c$visittimer_names[$spot]%c.} {bold blue} {bold yellow} {bold blue} {bold green} {bold blue}; + #echo {$xptimer_message}; + }; + } + } + + #unvariable {dtreset_all}; +} + +#ACTION {%1 deals the death blow to %2.} { + #foreach {$killtimers[]} {spot} { + #regex {%2} {$spot} { + #format {killtimers[$spot]} {%T}; + }; + } +} +#ACTION {You kill %1.} { + #foreach {$killtimers[]} {spot} { + #regex {%1} {$spot} { + #format {killtimers[$spot]} {%T}; + }; + } +} + +#ALIAS {dt} { + #echo {.:: Death Timers ::.}; + #format {current_time} {%T}; + #foreach {$killtimers[]} {spot} { + #format {spotname} {$killtimer_names[$spot]}; + + #if {$killtimers[$spot] == 0} { + #format {spotstring} { - (???) %s } {$spotname}; + }; + #else { + #math {mins} { (($current_time - $killtimers[$spot]) + 0.5) / 60 }; + + #if {$mins > 99} { #var {mins} {99} }; + + #if {$mins > 10} { + #format {spotstring} { - (%dm) %s } {$mins} {$spotname}; + }; + #else { + #format {spotstring} { - (0%dm) %s } {$mins} {$spotname}; + } + } + + #echo {$spotstring}; + } + + #echo {\n}; + + #echo {.:: Visit Timers ::.}; + #format {current_time} {%T}; + #foreach {$visittimers[]} {spot} { + #format {spotname} {$visittimer_names[$spot]}; + + #if {$visittimers[$spot] == 0} { + #format {spotstring} { - (???) %s } {$spotname}; + }; + #else { + #math {mins} { (($current_time - $visittimers[$spot]) + 0.5) / 60 }; + + #if {$mins > 99} { #var {mins} {99} }; + + #if {$mins > 10} { + #format {spotstring} { - (%dm) %s } {$mins} {$spotname}; + }; + #else { + #format {spotstring} { - (0%dm) %s } {$mins} {$spotname}; + } + } + + #echo {$spotstring}; + } +} + +#ALIAS {writetimerstofile} { + #system {rm $xptimer_file && touch $xptimer_file}; + #format {current_time} {%T}; + + #line {log} {$xptimer_file} {.:: Death Timers ::. }; + + #foreach {$killtimers[]} {spot} { + #format {spotname} {$killtimer_names[$spot]}; + + #if {$killtimers[$spot] == 0} { + #format {spotstring} { - (???) %s } {$spotname}; + }; + #else { + #math {mins} { (($current_time - $killtimers[$spot]) + 0.5) / 60 }; + + #if {$mins > 99} { #var {mins} {99} }; + + #if {$mins > 10} { + #format {spotstring} { - (%dm) %s } {$mins} {$spotname}; + }; + #else { + #format {spotstring} { - (0%dm) %s } {$mins} {$spotname}; + } + } + + #line {log} {$xptimer_file} {$spotstring}; + } + + #foreach {$visittimers[]} {spot} { + #format {spotname} {$visittimer_names[$spot]}; + + #if {$visittimers[$spot] == 0} { + #format {spotstring} { - (???) %s } {$spotname}; + }; + #else { + #math {mins} { (($current_time - $visittimers[$spot]) + 0.5) / 60 }; + + #if {$mins > 99} { #var {mins} {99} }; + + #if {$mins > 10} { + #format {spotstring} { - (%dm) %s } {$mins} {$spotname}; + }; + #else { + #format {spotstring} { - (0%dm) %s } {$mins} {$spotname}; + } + } + + #line {log} {$xptimer_file} {$spotstring}; + } +} + +#EVENT {SEND OUTPUT} {writetimerstofile}; + +#FUNCTION {parse_spot} { + #var {spot_sync_raw} {%0}; + #replace {spot_sync_raw} {=} {;}; + #list {spot_sync} {create} {${spot_sync_raw}}; + #return {$spot_sync}; +} + +#ACTION {%1 tells you: ruhs_dtsync=[%2] | ruhs_vtsync=[%3]} { + #var {synccount} {0}; + #var {dtsync} {%2}; + #var {vtsync} {%3}; + + #replace {dtsync} {,} {;}; + #replace {vtsync} {,} {;}; + + #list dtsync_list create {${dtsync}}; + #list vtsync_list create {${vtsync}}; + + #foreach {$dtsync_list[]} {spot} { + #var {syncitem} {@parse_spot{$dtsync_list[$spot]}}; + #var {syncname} {$syncitem[1]}; + #var {synctime} {$syncitem[2]}; + + #foreach {$killtimer_names[]} {spotident} { + #var {spotname} {$killtimer_names[$spotident]}; + #if {"$spotname" == "$syncname"} { + #if {$killtimers[$spotident] < $synctime} { + #var {killtimers[$spotident]} {$synctime}; + #math {synccount} {$synccount + 1}; + }; + }; + } + } + + #foreach {$vtsync_list[]} {spot} { + #var {syncitem} {@parse_spot{$vtsync_list[$spot]}}; + #var {syncname} {$syncitem[1]}; + #var {synctime} {$syncitem[2]}; + + #foreach {$visittimer_names[]} {spotident} { + #var {spotname} {$visittimer_names[$spotident]}; + #if {"$spotname" == "$syncname"} { + #if {$visittimers[$spotident] < $synctime} { + #var {visittimers[$spotident]} {$synctime}; + #math {synccount} {$synccount + 1}; + }; + }; + } + } + + #format {dtsync_message} {%c[XPTimer] %c*%c Synced %c%d%c spots from %c%s%c.} {bold blue}{yellow}{bold blue}{orange}{$synccount}{bold blue}{green}{%1}{bold blue}; + #echo {$dtsync_message}; +} + +#ALIAS {dtsync %1} { + #var {dtsync_msg} {}; + #var {vtsync_msg} {}; + + #foreach {$killtimer_names[]} {spotident} { + #if {$killtimers[$spotident] > 0} { + #format {dtsync_msg} {%s,%s=%d} {$dtsync_msg}{$killtimer_names[$spotident]}{$killtimers[$spotident]}; + }; + } + #regex {$dtsync_msg} {^,{(.+)}$} { #var {dtsync_msg} {&1}; }; + + #foreach {$visittimer_names[]} {spotident} { + #if {$visittimers[$spotident] > 0} { + #format {vtsync_msg} {%s,%s=%d} {$vtsync_msg}{$visittimer_names[$spotident]}{$visittimers[$spotident]}; + }; + } + #regex {$vtsync_msg} {^,{(.+)}$} { #var {vtsync_msg} {&1}; }; + + + #format {sync_message} {tell %s ruhs_dtsync=[%s] | ruhs_vtsync=[%s]} {%1} {$dtsync_msg} {$vtsync_msg}; + #send {$sync_message}; +} + +#EVENT {IAC SB GMCP room.info IAC SE} +{ + #var {room_info} {%0}; + #foreach {$visittimers[]} {spot} { + #regex {$room_info[identifier]} {$spot} { + #format {visittimers[$spot]} {%T}; + } + } +} + +#ALIAS {gsdt} { + #var {gsdt_string} {}; + #foreach {$killtimers[]} {spot} { + #format {spotname} {$killtimer_names[$spot]}; + #var {mins} {???}; + + #if {$killtimers[$spot] == 0} { + #format {spotstring} {%s: ??? |} {$spotname}; + }; + #else { + #math {mins} { (($current_time - $killtimers[$spot]) + 0.5) / 60 }; + #if {$mins > 99} { #var {mins} {99} }; + + #if {$mins < 10} { + #format {spotstring} {%s: 0%dm |} {$spotname} {$mins} ; + }; + #else { + #format {spotstring} {%s: %dm |} {$spotname} {$mins} ; + }; + } + + #format {gsdt_string} {%s %s} {$gsdt_string} {$spotstring}; + } + + #foreach {$visittimers[]} {spot} { + #format {spotname} {$visittimer_names[$spot]}; + #var {mins} {???}; + + #if {$visittimers[$spot] == 0} { + #format {spotstring} {%s: ??? |} {$spotname}; + }; + #else { + #math {mins} { (($current_time - $visittimers[$spot]) + 0.5) / 60 }; + #if {$mins > 99} { #var {mins} {99} }; + + #if {$mins < 10} { + #format {spotstring} {%s: 0%dm |} {$spotname} {$mins} ; + }; + #else { + #format {spotstring} {%s: %dm |} {$spotname} {$mins} ; + }; + } + + #format {gsdt_string} {%s %s} {$gsdt_string} {$spotstring}; + } + + #regex {$gsdt_string} {^{(.+)} \|$} {#var {gsdt_string} {&1}; }; + + #send {group say $gsdt_string}; +} + +#CLASS {xptimers} {close}; diff --git a/src/tpamonitor.tin b/src/tpamonitor.tin new file mode 100644 index 0000000..947c4b8 --- /dev/null +++ b/src/tpamonitor.tin @@ -0,0 +1,71 @@ +#CLASS {tpamonitor} {kill}; +#CLASS {tpamonitor} {open}; + +#nop ### Turn TPA indicator on ### +#action {^ * You are surrounded by a magical impact shield.$} { + #var {tpa_status} {1}; + #var {tpa_color} {invisible}; + update_prompt; +} +#action {^ * You are surrounded by a %+ magical impact shield.$} +{ + #var {tpa_status} {1}; + #var {tpa_color} {%1}; + update_prompt; +} +#action {^With a noise that sounds like "Plink!", everything around you flashes red for a moment.$} { + #var {tpa_status} {1}; + #var {tpa_color} {invisible}; + #format {tpa_start} {%T}; + update_prompt; +} + + +#nop ### Turn TPA indicator off ### +#action {^There is a sudden white flash. Your magical shield has broken.$} { + #line {log} {$chat_file}; + #var {tpa_status} {0}; + #format {tpa_end} {%T}; + /break_tpa +} + +#nop ### Track TPA colors ### +#action {^As your shield absorbs the impact, it becomes visible as a %1 glow.$} +{ + #var {tpa_color} {%1}; + update_prompt; +} +#action {^As your shield absorbs the impact, its glow changes from a %1 to a %2.$} +{ + #var {tpa_color} {%2}; + update_prompt; +} + +#action {^Your shield changes from a %1 to a %2.$} +{ + #var {tpa_color} {%2}; + update_prompt; +} +#action {^Your shield stops glowing a %1 and lapses back into invisibility.$} +{ + #var {tpa_color} {invisible}; + update_prompt; +} + + +#nop ### When TPA breaks show some info ### +#alias {/break_tpa} { + #showme {\a\a}; + #if {&{tpa_start}} { + #math {tpa_dur} { (($tpa_end - $tpa_start) + 0.5) / 60 }; + #echo {<168>*** TPA broken! (lasted for $tpa_dur minutes) ***<099>}; + } + + #unvar {tpa_start}; + #unvar {tpa_end}; + update_prompt; +} + +#var {tpa_status} {0}; + +#CLASS {tpamonitor} {close}; diff --git a/src/xpmonitor.tin b/src/xpmonitor.tin new file mode 100644 index 0000000..c016b68 --- /dev/null +++ b/src/xpmonitor.tin @@ -0,0 +1,47 @@ +#CLASS {xpmonitor} {kill}; +#CLASS {xpmonitor} {open}; + +#ALIAS {xp_monitor} { + #var {previous_xp} {$latest_xp}; + #var {latest_xp} {$GMCP[vitals][xp]}; + + #if {$previous_xp != 0} { + #math {gained_xp} {$latest_xp - $previous_xp}; + #if {$gained_xp > 0} { + #math {session_xp} {$session_xp + $gained_xp}; + }; + }; + + #format {check_time} {%T}; + + #format {uptime[hours]} {%m} {($check_time - $start_time) / 60 / 60}; + #format {uptime[minutes]} {%m} {($check_time - $start_time) / 60 % 60}; + #format {uptime[display]} {%th %tm} {$uptime[hours]} {$uptime[minutes]}; + + #format {xprate} {%d} { ($session_xp / ($uptime[hours] + ($uptime[minutes] / 60.0))) * 0.001 }; +} + +#ALIAS {gsxp} { + #format {prompt_xp} {%Gxp in %s (%Gk/h)} {$session_xp} {$uptime[display]} {$xprate}; + #send {group say $prompt_xp}; +} + +#ALIAS {xpreset} { + #var {session_xp} {0}; + #var {previous_xp} {0} + + #var {uptime[hours]} {0}; + #var {uptime[minutes]} {0}; + #var {uptime[seconds]} {0}; + + #format {start_time} {%T}; + #format {check_time} {%T}; + #format {uptime[display]} {%th %tm} {11} {0}; +} + +#var {previous_xp} {0}; +#var {latest_xp} {0}; +#var {gained_xp} {0}; +#var {session_xp} {0}; + +#CLASS {xpmonitor} {close};