From 09ee6feaedd9392150ca6372d4f47c0309a39699 Mon Sep 17 00:00:00 2001 From: Kara Alexandra Date: Tue, 7 Oct 2025 08:39:41 -0500 Subject: [PATCH] Initial commit --- .gitignore | 3 ++ .python-version | 1 + basic_symbols.rc | 5 +++ color_glyphs.rc | 22 ++++++++++ hdf-37.rc | 14 ++++++ hdf-tnnt.rc | 9 ++++ justfile | 22 ++++++++++ main.rc | 57 ++++++++++++++++++++++++ menucolor.rc | 83 +++++++++++++++++++++++++++++++++++ msgtypes.rc | 106 +++++++++++++++++++++++++++++++++++++++++++++ pergame.rc | 4 ++ pyproject.toml | 11 +++++ statusbar.rc | 52 ++++++++++++++++++++++ unicode_symbols.rc | 19 ++++++++ upload.py | 53 +++++++++++++++++++++++ 15 files changed, 461 insertions(+) create mode 100644 .gitignore create mode 100644 .python-version create mode 100644 basic_symbols.rc create mode 100644 color_glyphs.rc create mode 100644 hdf-37.rc create mode 100644 hdf-tnnt.rc create mode 100644 justfile create mode 100644 main.rc create mode 100644 menucolor.rc create mode 100644 msgtypes.rc create mode 100644 pergame.rc create mode 100644 pyproject.toml create mode 100644 statusbar.rc create mode 100644 unicode_symbols.rc create mode 100644 upload.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4547ee9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.env +.venv/ +uv.lock diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..24ee5b1 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.13 diff --git a/basic_symbols.rc b/basic_symbols.rc new file mode 100644 index 0000000..0590f1a --- /dev/null +++ b/basic_symbols.rc @@ -0,0 +1,5 @@ +SYMBOLS=S_magic_portal:\x38 +SYMBOLS=S_rust_trap:\x38 +SYMBOLS=S_water:\x7E +SYMBOLS=S_pool:\x7E +SYMBOLS=S_lava:\x7E diff --git a/color_glyphs.rc b/color_glyphs.rc new file mode 100644 index 0000000..26999e4 --- /dev/null +++ b/color_glyphs.rc @@ -0,0 +1,22 @@ +OPTIONS=glyph:G_vwall_mines/U+2502/brown +OPTIONS=glyph:G_hwall_mines/U+2500/brown +OPTIONS=glyph:G_tlcorn_mines/U+250c/brown +OPTIONS=glyph:G_trcorn_mines/U+2510/brown +OPTIONS=glyph:G_blcorn_mines/U+2514/brown +OPTIONS=glyph:G_brcorn_mines/U+2518/brown +OPTIONS=glyph:G_crwall_mines/U+253C/brown +OPTIONS=glyph:G_tuwall_mines/U+2534/brown +OPTIONS=glyph:G_tdwall_mines/U+252C/brown +OPTIONS=glyph:G_tlwall_mines/U+2524/brown +OPTIONS=glyph:G_trwall_mines/U+251C/brown +OPTIONS=glyph:G_vwall_knox/U+2502/yellow +OPTIONS=glyph:G_hwall_knox/U+2500/yellow +OPTIONS=glyph:G_tlcorn_knox/U+250c/yellow +OPTIONS=glyph:G_trcorn_knox/U+2510/yellow +OPTIONS=glyph:G_blcorn_knox/U+2514/yellow +OPTIONS=glyph:G_brcorn_knox/U+2518/yellow +OPTIONS=glyph:G_crwall_knox/U+253C/yellow +OPTIONS=glyph:G_tuwall_knox/U+2534/yellow +OPTIONS=glyph:G_tdwall_knox/U+252C/yellow +OPTIONS=glyph:G_tlwall_knox/U+2524/yellow +OPTIONS=glyph:G_trwall_knox/U+251C/yellow diff --git a/hdf-37.rc b/hdf-37.rc new file mode 100644 index 0000000..518d84c --- /dev/null +++ b/hdf-37.rc @@ -0,0 +1,14 @@ +{% include "main.rc" %} + +{% include "unicode_symbols.rc" %} + +{% include "color_glyphs.rc" %} + +OPTIONS=!tutorial,!safe_wait,!tips +OPTIONS=showdamage +OPTIONS=cond_held,cond_ice,cond_lava,cond_woundedlegs +OPTIONS=paranoid_confirmation:pray Remove trap swim + +BIND=O:optionsfull + +{% include "pergame.rc" %} diff --git a/hdf-tnnt.rc b/hdf-tnnt.rc new file mode 100644 index 0000000..aefa1b7 --- /dev/null +++ b/hdf-tnnt.rc @@ -0,0 +1,9 @@ +{% include "main.rc" %} + +{% include "basic_symbols.rc" %} + +OPTIONS=cond_held,cond_ice,cond_lava,cond_woundedlegs +OPTIONS=paranoid_confirmation:pray trap A Remove +OPTIONS=realtime:p,realtime_format:f + +{% include "pergame.rc" %} diff --git a/justfile b/justfile new file mode 100644 index 0000000..da38fef --- /dev/null +++ b/justfile @@ -0,0 +1,22 @@ +[private] +@list: + just --list + +[group("show")] +@show_37 *FLAGS: + uv run upload.py hdf-37.rc {{FLAGS}} + +[group("show")] +@show_tnnt *FLAGS: + uv run upload.py hdf-tnnt.rc {{FLAGS}} + +[group("upload")] +@v37 *FLAGS: + uv run upload.py hdf-37.rc -v nethack {{FLAGS}} + +[group("upload")] +@tnnt *FLAGS: + uv run upload.py hdf-tnnt.rc -v tnnt {{FLAGS}} + +[group("upload")] +all *FLAGS: (v37 FLAGS) (tnnt FLAGS) diff --git a/main.rc b/main.rc new file mode 100644 index 0000000..5722caf --- /dev/null +++ b/main.rc @@ -0,0 +1,57 @@ +# junethack karafruit + +OPTIONS=symset:Enhanced1,roguesymset:plain + +OPTIONS=!force_invmenu +OPTIONS=suppress_alert:3.3.1 +OPTIONS=map_mode:tiles,scroll_margin:10 + +OPTIONS=font_message:Consolas,font_size_message:14,align_message:top +OPTIONS=font_menu:Consolas,font_size_menu:14 +OPTIONS=font_text:Courier New,font_size_text:14 +OPTIONS=font_status:Courier New,font_size_status:14 +OPTIONS=hilite_pet,hilite_pile,!toptenwin +#OPTIONS=!splash_screen,player_selection:prompts + +AUTOCOMPLETE=twoweapon + +{% include "menucolor.rc" %} + +{% include "statusbar.rc" %} + +{% include "msgtypes.rc" %} + +OPTIONS=dogname:Athena +OPTIONS=catname:Moldorm +OPTIONS=horsename:Horse +OPTIONS=fruitname:word + +OPTIONS=autopickup,pickup_types:$ +autopickup_exception=">.*iron chain.*" +autopickup_exception=">.*heavy iron ball.*" + +OPTIONS=scores:10 top/2 around/own + +OPTIONS=time,showexp,number_pad:2,lit_corridor + +OPTIONS=msg_window:reversed,sortloot:full +OPTIONS=autoquiver +# OPTIONS=invweight,showdmg,showweight +OPTIONS=!cmdassist +OPTIONS=boulder:0,travel +OPTIONS=disclose:yi ya nv ng yc no +OPTIONS=altmeta +OPTIONS=!autodig +OPTIONS=statuslines:3 +OPTIONS=pickup_burden=B +OPTIONS=paranoid_confirmation:p t A s +# OPTIONS=realtime:p,realtime_format:f + +OPTIONS=runmode:teleport +OPTIONS=quick_farsight +OPTIONS=whatis_coord:c +OPTIONS=!implicit_uncursed + +BIND=M-m:terrain +BIND=C:conduct +BIND=!:annotate diff --git a/menucolor.rc b/menucolor.rc new file mode 100644 index 0000000..bc7f487 --- /dev/null +++ b/menucolor.rc @@ -0,0 +1,83 @@ +OPTIONS=menucolors,menu_objsyms + +### Item Status (BUC/worn) +MENUCOLOR=""=white +MENUCOLOR="gold pieces?"=yellow + +MENUCOLOR="[Bb]lessed"=green +MENUCOLOR="[Hh]oly"=green + +MENUCOLOR="[Cc]ursed"=red +MENUCOLOR="[Uu]nholy"=red + +MENUCOLOR="[Uu]ncursed"=gray + +MENUCOLOR=".*(being worn|\(wielded|weapon in|lit\)|\(on (left|right)|at the ready|in quiver)"=white&inverse +MENUCOLOR="[Cc]ursed.*(being worn|\(wielded|weapon in|lit\)|\(on (left|right)|at the ready|in quiver)"=red&inverse +MENUCOLOR="[Uu]ncursed.*(being worn|\(wielded|weapon in|lit\)|\(on (left|right)|at the ready|in quiver)"=gray&inverse +MENUCOLOR="[Bb]lessed.*(being worn|\(wielded|weapon in|lit\)|\(on (left|right)|at the ready|in quiver)"=green&inverse + +### Items +## Gray Stones +MENUCOLOR="luckstone|called luck"=bright blue +MENUCOLOR="touchstone|called touch"=bright blue +MENUCOLOR=" [Cc]ursed luckstone|[Cc]usred.*called luck"=red +MENUCOLOR="loadstone|called load"=red +MENUCOLOR="gray stone"=red + +MENUCOLOR="doppelganger corpse"=red +MENUCOLOR="were.* corpse"=red + +## Gemstones +MENUCOLOR="dilithium crystal"=yellow +MENUCOLOR="diamond"=yellow +MENUCOLOR="rub(y|ies)"=yellow +MENUCOLOR="jacinth stone"=yellow +MENUCOLOR="sapphire"=yellow +MENUCOLOR="black opal"=yellow +MENUCOLOR="emerald"=yellow +MENUCOLOR="turquoise stone"=yellow +MENUCOLOR="citrine"=yellow +MENUCOLOR="aquamarine"=yellow +MENUCOLOR="amber stone"=yellow +MENUCOLOR="topaz stone"=yellow +MENUCOLOR="jet stone"=yellow +MENUCOLOR="opals"=yellow +MENUCOLOR="chrysoberyl"=yellow +MENUCOLOR="garnet stone"=yellow +MENUCOLOR="amethyst"=yellow +MENUCOLOR="jasper stone"=yellow +MENUCOLOR="fluorite"=yellow +MENUCOLOR="jade stone"=yellow +MENUCOLOR="obsidian"=yellow +MENUCOLOR="agate stone"=yellow + +MENUCOLOR="Amulet of Yendor named"=blue +MENUCOLOR="Amulet of Yendor named.*(being worn|\(wielded|weapon in|lit\)|\(on (left|right)|at the ready|in quiver)"=blue&inverse + +MENUCOLOR="wand (of|called) cancellation"=cyan +MENUCOLOR="bag (of|called) tricks"=cyan + +## Branches +MENUCOLOR="The Dungeons of Doom:"=bright blue&reverse +MENUCOLOR="The Gnomish Mines:"=bright blue&reverse +MENUCOLOR="Sokoban:"=bright blue&reverse +MENUCOLOR="The Quest:"=bright blue&reverse +MENUCOLOR="Fort Ludios:"=bright blue&reverse +MENUCOLOR="Gehennom:"=bright blue&reverse +MENUCOLOR="Vlad.s Tower:"=bright blue&reverse +MENUCOLOR="The Elemental Planes:"=bright blue&reverse +MENUCOLOR="The Tutorial:"=bright blue&reverse +MENUCOLOR="Portal to The Quest"=bright blue&underline +MENUCOLOR="Portal to Fort Ludios"=bright blue&underline + +## |TNNT| +MENUCOLOR="DevTeam Office:"=bright blue&reverse +MENUCOLOR="Deathmatch Arena:"=bright blue&reverse +MENUCOLOR="robotfindskitten:"=bright blue&reverse + +## Spells +MENUCOLOR="100%.*%"=red +MENUCOLOR="%.*\(gone\)"=orange + +MENUCOLOR="implicit_uncursed"=gray diff --git a/msgtypes.rc b/msgtypes.rc new file mode 100644 index 0000000..d8c7f9f --- /dev/null +++ b/msgtypes.rc @@ -0,0 +1,106 @@ +MSGTYPE=hide "Unknown command '.*'." + +MSGTYPE=hide "You swap places with .*" + +MSGTYPE=hide "attack passes harmlessly through the shade" +# MSGTYPE=hide "(It|The .*|.*'s ghost) (misses|touches|bites|hits) (it|the .*|.*'s ghost)" +MSGTYPE=hide "The fire doesn't seem to burn (it|the .*|.*'s ghost)" +MSGTYPE=hide "(It|The .*|.*'s ghost) is mildly warmed" +MSGTYPE=hide "(It|The .*|.*'s ghost) is uninjured" +MSGTYPE=hide "\(I hope you don't mind\.\)" +MSGTYPE=hide "Most likely all your gold was stolen from this" +MSGTYPE=hide "is not affected by oxidation" + +MSGTYPE=norep "A mysterious force prevents the .* from teleporting" + +MSGTYPE=show "magic missile (hits|misses)" +MSGTYPE=show "spell (hits|misses)" +MSGTYPE=show "wand (hits|misses)" +MSGTYPE=show "dagger (hits|misses)" +MSGTYPE=show "dart (hits|misses)" +MSGTYPE=show "ray (hits|misses)" +MSGTYPE=show "death ray" +MSGTYPE=show "water flow" + +## Danger +MSGTYPE=stop "You are slowing down" +MSGTYPE=stop "Your limbs are .*" +MSGTYPE=stop ".* swings itself around you.*" +MSGTYPE=stop "You find it hard to breathe" +MSGTYPE=stop "You are turning a little .*" +MSGTYPE=stop "You feel feverish" +MSGTYPE=stop "steals? |stole" +MSGTYPE=stop "The Wizard of Yendor steals .*" +MSGTYPE=stop "flicks a bullwhip towards your" +MSGTYPE=stop "wraps around the" +MSGTYPE=stop "yanks the" +MSGTYPE=stop "hand spasms" +MSGTYPE=stop "disintegration" +MSGTYPE=stop "wields .*Vorpal Blade" +MSGTYPE=stop "swings .*Vorpal Blade" +MSGTYPE=stop "zaps .* with wand of teleportation" +MSGTYPE=stop "You feel a malgnant aura surround you." +MSGTYPE=stop "(thoroughly|utterly|totally) digest" +MSGTYPE=stop "(feel sad|have a (peculiarly)? (sad|melancholy) feeling) for a moment" +MSGTYPE=stop ".* starves" +MSGTYPE=stop "Run away! Run away!" +MSGTYPE=stop "Watch out! Bad things can happen on Friday the 13th." + +## Draining +MSGTYPE=stop "Goodbye level .*." # Default +MSGTYPE=stop "Fare thee well level .*." # Knight +MSGTYPE=stop "Sayonara level .*." # Samurai +MSGTYPE=stop "Aloha level .*." # Tourist +MSGTYPE=stop "Farvel level .*." # Valkyrie + +## Good Things +MSGTYPE=stop "You feel a strange mental acuity" +MSGTYPE=stop "You feel (especially)? healthy" +MSGTYPE=stop "You feel hardy" +MSGTYPE=stop "You feel wide awake" +MSGTYPE=stop "You feel a momentary chill" +MSGTYPE=stop "You feel full of hot air" +MSGTYPE=stop "You feel very firm" +MSGTYPE=stop "Your health currently feels amplified" +MSGTYPE=stop "Magic spreads through your body as you digest" +MSGTYPE=stop "You have a feeling of reconciliation" +MSGTYPE=stop "You feel more confident" +MSGTYPE=stop "grows up" + +## Vault +MSGTYPE=stop "You (dream that you )?hear the footsteps of a guard on patrol" +MSGTYPE=stop "You (dream that you )?hear someone counting" + +## Excalibur +MSGTYPE=stop "From the murky depths, a hand reaches up to bless the sword" + +## Amulet of Yendor +MSGTYPE=stop "Amulet of Yendor named" + +MSGTYPE=stop "You don't have anything to eat." +MSGTYPE=stop "You cannot eat that" +MSGTYPE=stop "You don't have that object" + +MSGTYPE=stop "won't move|still eating" +MSGTYPE=stop "Closed for inventory" + +MSGTYPE=stop "You wrest .*" + +MSGTYPE=stop "You feel a strange vibration" + +## Gremlin stealing your intrinsic at night +MSGTYPE=stop "The gremlin chuckles." +MSGTYPE=stop "You hear laughter." +MSGTYPE=stop "Some writing vanishes from.*head!" +MSGTYPE=stop "You feel warmer." +MSGTYPE=stop "You feel less jumpy." +MSGTYPE=stop "You feel a little sick!" +MSGTYPE=stop "Your senses fail!" +MSGTYPE=stop "You feel cooler." +MSGTYPE=stop "You feel paranoid." +MSGTYPE=stop "You thought you saw something!" +MSGTYPE=stop "You tawt you taw a puttie tat!" +MSGTYPE=stop "You feel slower." +MSGTYPE=stop "You feel clumsy." +MSGTYPE=stop "You feel vulnerable." +MSGTYPE=stop "You feel less attractive." diff --git a/pergame.rc b/pergame.rc new file mode 100644 index 0000000..fa266c3 --- /dev/null +++ b/pergame.rc @@ -0,0 +1,4 @@ +{{ "# " if not nobones }}OPTIONS=nobones +{{ "# " if not nopet }}OPTIONS=nopet +{{ "# " if not pauper }}OPTIONS=pauper +{{ "# " if not nudist }}OPTIONS=nudist diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ceab83a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,11 @@ +[project] +name = "nethackrc" +version = "0.1.0" +requires-python = ">=3.13" +dependencies = [ + "argparse>=1.4.0", + "jinja2>=3.1.6", + "pyquery>=2.0.1", + "python-dotenv>=1.1.1", + "requests>=2.32.5", +] diff --git a/statusbar.rc b/statusbar.rc new file mode 100644 index 0000000..3401c0e --- /dev/null +++ b/statusbar.rc @@ -0,0 +1,52 @@ +OPTIONS=windowcolors:status white/#000000 message white/#000000 text white/#000000 menu white/#000000 +OPTIONS=vary_msgcount:4 + +# Status hilites +OPTIONS=statushilites + +## HP +OPTIONS=hitpointbar +OPTIONS=hilite_status:hitpoints/100%/gray&normal +OPTIONS=hilite_status:hitpoints/<100%/green&normal +OPTIONS=hilite_status:hitpoints/<66%/yellow&normal +OPTIONS=hilite_status:hitpoints/<50%/orange&normal +OPTIONS=hilite_status:hitpoints/<33%/red&bold +OPTIONS=hilite_status:hitpoints/<15%/red&inverse + +## Pw +OPTIONS=hilite_status:power/100%/gray&normal +OPTIONS=hilite_status:power/<100%/green&normal +OPTIONS=hilite_status:power/<66%/yellow&normal +OPTIONS=hilite_status:power/<50%/orange&normal +OPTIONS=hilite_status:power/<33%/red&bold + +## Carry +OPTIONS=hilite_status:cap/burdened/yellow/stressed/orange/strained/red&bold/overtaxed/red&inverse/overloaded/red&inverse&blink + +## Hunger +OPTIONS=hilite_status:hunger/satiated/yellow/hungry/orange/weak/red&bold/fainting/red&inverse/fainted/red&inverse&blink + +## Mental +OPTIONS=hilite_status:condition/hallu/yellow +OPTIONS=hilite_status:condition/conf/orange +OPTIONS=hilite_status:condition/stun/red&bold + +## Health +OPTIONS=hilite_status:condition/termill/red&inverse +OPTIONS=hilite_status:condition/foodpois/red&inverse +OPTIONS=hilite_status:condition/slime/red&inverse +OPTIONS=hilite_status:condition/stone/red&inverse +OPTIONS=hilite_status:condition/strngl/red&inverse + +# gold +OPTIONS=hilite_status:gold/up/yellow/down/brown + +# St, Dx, Co, In, Wi, Ch +OPTIONS=hilite_status:characteristics/up/green/down/red + +# AC +OPTIONS=hilite_status:armor-class/down/green/up/red + +# XP +OPTIONS=hilite_status:experience/up/green/down/red +OPTIONS=hilite_status:experience-level/up/green/down/red diff --git a/unicode_symbols.rc b/unicode_symbols.rc new file mode 100644 index 0000000..4b33047 --- /dev/null +++ b/unicode_symbols.rc @@ -0,0 +1,19 @@ +SYMBOLS=S_magic_portal:U+058D +SYMBOLS=S_rust_trap:U+2020 +SYMBOLS=S_ghost:U+0262 +SYMBOLS=S_throne:U+1D8B +SYMBOLS=S_altar:U+03C0 +SYMBOLS=S_fountain:U+03D4 +SYMBOLS=S_water:U+2248 +SYMBOLS=S_pool:U+2248 +SYMBOLS=S_lava:U+2248 +SYMBOLS=S_sink:U+0534 + +SYMBOLS=S_sw_ml:U+007C +SYMBOLS=S_sw_mr:U+007C +SYMBOLS=S_sw_tc:U+002D +SYMBOLS=S_sw_bc:U+002D +SYMBOLS=S_explode4:U+007C +SYMBOLS=S_explode6:U+007C +SYMBOLS=S_explode2:U+002D +SYMBOLS=S_explode8:U+002D diff --git a/upload.py b/upload.py new file mode 100644 index 0000000..2c1815d --- /dev/null +++ b/upload.py @@ -0,0 +1,53 @@ +import argparse +from dotenv import load_dotenv +from jinja2 import Environment, FileSystemLoader +from pyquery import PyQuery as pq +import os +import requests +import sys + +def render(filename, options={}): + env = Environment(loader=FileSystemLoader("."), trim_blocks=True, lstrip_blocks=True) + template = env.get_template(filename) + return template.render(options) + +def upload(rcfile, variant): + load_dotenv() + + s = requests.Session() + base_url = f"https://www.hardfought.org/nh/{variant}" + + s.post(f"{base_url}/login.php", { + "username": os.getenv("HDF_USERNAME"), + "password": os.getenv("HDF_PASSWORD"), + "submit": "Login", + }) + + get_page = s.get(f"{base_url}/rcedit.php") + csrf_token = pq(get_page.content)('input[name="csrf_token"]').attr("value") + + s.post(f"{base_url}/rcedit.php", { + "csrf_token": csrf_token, + "rctext": rcfile, + "submit": "Save+RC+File", + }) + + print(f"Uploaded variant {variant}") + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("template") + parser.add_argument("-v", "--variant") + parser.add_argument("--nudist", "-n", action="store_true") + parser.add_argument("--pauper", "-p", action="store_true") + parser.add_argument("--nobones", action="store_true") + parser.add_argument("--nopet", action="store_true") + + args = parser.parse_args() + + rcfile = render(args.template, vars(args)) + + if args.variant: + upload(rcfile, args.variant) + else: + print(rcfile)