# this rc is based off of simm's!! thank you
# if you run it as a python2 script, it uploads itself to various servers.
# it needs ssh and pexpect.
{
--[[0] ][0][0]
}; # START PYTHON
import sys
import pexpect
import time
from threading import Thread
# format: (command, user, local file containing password, versions to update)
key_path = '/home/mauris/.cao_key'
servers = [
('telnet crawl.develz.org 345',
'mauris', '/home/mauris/.crawlpass', 'T'),
('ssh -i ' + key_path + ' crawl@crawl.xtahua.com',
'mauris', '/home/mauris/.crawlpass', 'T6'),
('ssh -i ' + key_path + ' crawl@crawl.s-z.org',
'mauris', '/home/mauris/.crawlpass', 'T'),
]
rcfile = open(sys.argv[0]).read().replace('\n', '\r')
def connect(server, username, pwfile, version):
p = pexpect.spawn(server)
p.delaybeforesend = 0.2
# p.logfile_read = sys.stdout
password = open(pwfile).read().strip()
print server
p.expect('=>'); p.send('l' + username + '\r' + password + '\r')
print 1
p.expect('=>'); p.send(version + 'O')
print 2
p.expect('%--'); p.send(':1,$d\nZZ')
print 3
p.expect('=>'); p.send('o' + rcfile + '\x1B')
print 4
p.interact()
p.expect('leave'); p.send('a')
print 5
p.expect('save'); p.send('a')
print 6
p.expect('=>'); p.send('q')
print 7
p.expect('=>'); p.send('q')
print 8
p.close()
ts = [Thread(target=connect, args=(server, username, password, version))
for (server, username, password, versions) in servers
for version in versions]
for t in ts:
t.start()
t.join()
#[t.start() and t.join() for t in ts]
#[t.join() for t in ts]
updates = sum(len(s[3]) for s in servers)
print '\x1B[2J\x1B[HReplaced %d rcfile%s.' % (updates, 's' * (updates != 1))
""" ]] -- START LUA
-- from hugedmg.rc
local dmg_old_hp = 0
function DamageTrack()
local bot_hp, bot_mhp = you.hp()
local dmg_inturn = 0
local huge_int = 0
local percent_hp = 0
local percent_old_hp = 0
local percent_hp_txt = "--%"
if dmg_old_hp > 0 then
if bot_hp < dmg_old_hp then
dmg_inturn = dmg_old_hp - bot_hp
percent_old_hp = math.ceil((dmg_old_hp*100)/bot_mhp)
percent_hp = math.ceil((bot_hp*100)/bot_mhp)
percent_hp_txt = percent_hp .. "%"
if percent_hp < 30 then
percent_hp_txt = "" .. percent_hp_txt .. ""
elseif percent_hp < 55 then
percent_hp_txt = "" .. percent_hp_txt .. ""
elseif percent_hp < 75 then
percent_hp_txt = "" .. percent_hp_txt .. ""
end
percent_hp_txt = percent_hp_txt .. "(" .. bot_hp
.. "hp)"
if dmg_inturn > (bot_hp*0.25) then
huge_dmg_note(dmg_inturn)
crawl.mpr("Huge Dmg: -" ..
(percent_old_hp-percent_hp) .. "%(-" .. dmg_inturn ..
"hp)" .. " hp: " .. percent_hp_txt)
dmg_old_hp = bot_hp
crawl.flush_prev_message()
crawl.more()
crawl.more_autoclear(true)
else
if dmg_inturn > (bot_hp*0.15) then
crawl.mpr("Damage: -" ..
(percent_old_hp-percent_hp).."%(-" .. dmg_inturn ..
"hp)" .. " hp: " .. percent_hp_txt)
else
crawl.mpr("Damage: -".. (percent_old_hp-percent_hp)
.. "%(-" .. dmg_inturn .. "hp)" ..
" hp: " .. percent_hp_txt)
end
end
crawl.flush_prev_message()
end
end
dmg_old_hp = bot_hp
end
function huge_dmg_note(x)
crawl.take_note("Huge Dmg: " .. x .. " dmg")
end
function paranoid_rest() -- macro '5' to this
local hp, mhp = you.hp()
local mp, mmp = you.mp()
local can_heal = hp < mhp and you.race() ~= 'Deep Dwarf'
if can_heal or mp < mmp or you.confused() or you.slowed() or you.exhausted()
or you.teleporting() or you.anchored() or you.rooted() or you.poisoned()
or you.on_fire() or you.petrifying() or you.silencing() or
you.breath_timeout() or you.contaminated() > 0 or not you.feel_safe()
or crawl.yesno('Really rest?', false, 'n') then
crawl.sendkeys('5')
end
end
function search() -- macro '\{6}' (Ctrl-F) to this
local ctrlf = string.char(6)
local enter = string.char(13)
local esc = string.char(27)
local shortcuts = {
'armour', 'book', 'manual', 'altar', 'ego', 'dropped',
'blowgun|needle', 'cure mut|res.*abil', 'scroll.*ench',
'@corpse$&&!!rot|skel', 'artifact',
'short bl', 'long bl', 'axe', 'mace', 'polearm', 'stave',
'\\bbow', 'crossbow', 'throwable',
'rF\\+|ring.*fire', 'rC\\+|ring.*(cold|ice)',
'rPois|poison res', 'MR\\+|from magic',
'rCorr|resist corr', 'rMut|resist mut'
}--
local function print_header()
local function hilite(line)
return '' ..
line:gsub('(%w)=', '%1=') .. ''
end
crawl.clear_messages(true)
local line = ''
local sep = ' '
for i = 1, 26 do
local k = string.char(64 + i)
local v = shortcuts[i]
if v then
-- alias Ctrl-A and Shift-A, etc.
shortcuts[string.char(i)] = v
shortcuts[k] = v
local entry = k .. '=' .. v
if line == '' then
line = entry
elseif #(line .. sep .. entry) >= 79 then
crawl.mpr(hilite(line), 'prompt')
line = entry
else
line = line .. sep .. entry
end
end
end
if line then
crawl.mpr(hilite(line), 'prompt')
end
end
print_header()
crawl.mpr('Search for what [? for help]? ', 'prompt')
local letter = string.char(crawl.getch())
print_header()
shortcuts[string.char(13)] = nil
local sc = shortcuts[letter]
crawl.sendkeys(ctrlf .. (sc and sc .. enter or letter))
end
_ready = ready
function ready()
if _ready then _ready() end
DamageTrack()
if crawl.messages(1):match('Enter note: hi') then
crawl.mpr('\226\128\139hi ' .. you.name() .. '...')
end
end
-- armour autopickup by medar, slightly tweaked by simmarine and mauris
local function armour_plus(it)
local plus = string.gsub(it.name(), '+', '', 1)
local s, _ = string.gsub(plus, '[^-%d]', '')
return tonumber(s)
end
local function autopickup(it, name)
if it.is_useless then return end
local class = it.class(true)
if class ~= 'armour' then return end
st, _ = it.subtype()
local good_slots = {cloak='Cloak', helmet='Helmet',
gloves='Gloves', boots='Boots'}
local cur
if good_slots[st] ~= nil then
if it.branded or it.artifact then return true end
cur = items.equipped_at(good_slots[st])
if not cur then return true end
if cur.branded or cur.artefact then return end
elseif st == 'body' then
cur = items.equipped_at('armour')
if not (cur and cur.name('qual') == it.name('qual')) then return end
if it.branded then return true end
if cur.branded or cur.artefact then return end
else
return
end
if cur then
local xi = armour_plus(it)
local xc = armour_plus(cur)
if xi and xi > xc or xc < 0 then return true end
end
end
add_autopickup_func(autopickup)
}
#####
# aliases !!!
#####
ae := autopickup_exceptions
stop := runrest_stop_message
ignore := runrest_ignore_message
more := force_more_message
menu := menu_colour
ai := autoinscribe
spell := spell_slot
item := item_glyph
msg := message_colour
: if you.god() == "Jiyva" then
msg ^= mute:You hear a distant slurping noise.
msg ^= mute:You hear a squelching noise.
msg ^= mute:You feel a little less hungry.
msg ^= mute:You feel a little better.
msg ^= mute:You feel your power returning.
: end
# autopickup
ae += potions? of (berserk rage|blood|flight|invisibility|mutation)
ae += scrolls? of (amnesia|brand|holy word|vulnerability)
ae += wand of (confusion|digging|disintegration|draining|enslavement)
ae += wand of (fireball|flame|frost|invisibility|lightning|magic darts)
ae += wand of (paralysis|polymorph|random effects|slowing)
ae += ring of (fire|flight|ice|magical power|positive energy|protection )
ae += ring of (regeneration|stealth|sustain abilities|sustenance|teleport)
ae += ring of wizardry
: if you.god() == 'Nemelex Xobeh' then
ae +=
small_more = true
# menu and message colours
menu += cyan:potions? of.*(agility|brilliance|might)
menu += cyan:scrolls? of (enchant|recharging)
menu += cyan:scrolls? of enchant
menu -= cyan:.*misc.*[lL]antern
# inscriptions
ai += (bad|dangerous)_item.*potion:!q
ai += (bad|dangerous)_item.*scroll:!r
ai += potion.*berserk rage:!q
ai += scroll.*silence:!r
ai += distortion:!w
ai += of faith:!P
ai += of stasis:!P
ai += staff of (conjuration|energy|power|wizardry|Wucad Mu):!a
ai += rod:!a
ai += blowgun:@w1
ai += (curare|dispersal):!f
: if you.race() == 'Vampire' then
ai += potions? of.*blood:@q4
: end
: if you.god() == 'Fedhas' then
ai += fruit:!e
: end
# body armour ac/intrinsics
ai += (robe|animal skin):2
ai += [^l] leather armour:3
ai += ring mail:5
ai += scale mail:6
ai += chain mail:8
ai += [^l] plate armour:10
ai += crystal plate armour:14
ai += troll leather armour:4 +Regen
ai += steam dragon armour:5 rSteam
ai += mottled dragon armour:6 rNapalm
ai += swamp dragon armour:7 rPois
ai += fire dragon armour:8 rF++ rC-
ai += ice dragon armour:9 rC++ rF-
ai += storm dragon armour:10 rElec
ai += shadow dragon armour:10 Stlth+4
ai += quicksilver dragon armour:10 MR+
ai += pearl dragon armour:10 rN+
ai += gold dragon armour:12 rF+ rC+ rPois
# max charge inscriptions
ai += wand of (invisibility|heal wounds|hasting|fireball|teleportation):9
ai += wand of (lightning|draining):24
ai += wand of (fire$|cold):30
ai += wand of (confusion|digging|disintegration|enslavement|flame|frost):48
ai += wand of (magic darts|paralysis|polymorph|random effects|slowing):48
# color some useful/useless stuff
item += potions? of.*(agility|brilliance|might):cyan
item += wand of (heal wounds|hasting|teleportation):yellow
item += corpse:lightgrey
item += mutagenic.*corpse:magenta
item += forbidden.*corpse:darkgrey
item += putrefying.*corpse:lightred
item += poisonous.*corpse:lightgreen
# spell slots
spell += Ozocubu's Armour:o
spell += Stoneskin:s
spell += Phase Shift:p
spell += Swiftness:w
spell += Repel Missiles:r
spell += Deflect Missiles:d
spell += Regeneration:R
spell += Control Teleport:t
spell += Condensation Shield:c
spell += Invisibility:i
spell += Apportation:A
spell += Haste:H
spell += Blink:B
spell += Controlled Blink:C
spell += Flight:l
spell += Sublimation of Blood:m
spell += Mephitic Cloud:m
spell += Shroud of Golubria:g
spell += Death's Door:PO
spell += Borgnjor's Revivification:PO
spell += .*:abcdefqwrvtgb
# Light cyan is hard for me to see in light grey g packs.
mon_glyph += Robin : cyan
# I don't like their flashy colours.
mon_glyph += Killer Klown : magenta
mon_glyph += chaos spawn : lightblue
mon_glyph += butterfly : white
# I don't like & as a monster glyph.
mon_glyph += Mnoleg : U
mon_glyph += Lom Lobon : U
mon_glyph += Cerebov : U
mon_glyph += Gloorx Vloq : U
mon_glyph += Dispater : U
mon_glyph += Asmodeus : U
mon_glyph += Ereshkigal : U
mon_glyph += pandemonium lord : U
# These spells are useful
# Oops, this doesn't work yet: /mantis/view.php?id=9607
# menu += any:green:.*Summon Butterflies.*
travel_key_stop = false
interrupt_travel -= keypress
#"""