# TEAMCAPTAIN zkyp sort_menus = true : equipped, identified, basename, qualname, curse, qty default_manual_training = true show_more = false tile_map_pixels = 3 view_delay = 50 easy_door = false jewellery_prompt = true #warn_hatches = true autofight_stop = 50 automagic_enable = true automagic_slot = x autofight_throw_nomove = false confirm_butcher = never easy_eat_chunks = true auto_eat_chunks = true auto_sacrifice = before_explore autopickup = $?!+"/%|\ autopickup_exceptions += 0 and you.base_skill(sk) < (maxlev or 27) then table.insert(c_persist.current_skills, sk) end end end function check_skills() if not c_persist.current_skills or not c_persist.target_skill then return end for _,sk in ipairs(c_persist.current_skills) do if you.base_skill(sk) >= c_persist.target_skill then crawl.formatted_mpr(sk .. " reached " .. c_persist.target_skill .. ".", "prompt") crawl.more() set_new_skill_training() break end end end function init_target_skill() c_persist.target_skill = nil c_persist.current_skills = { } need_target_skill = true end function set_new_skill_training() init_target_skill() c_persist.target_skill = 0 crawl.sendkeys("m") end function set_target_skill() record_current_skills() local str = "Currently training: " local first_skill = true for _,sk in ipairs(c_persist.current_skills) do val = you.base_skill(sk) if first_skill then str = str .. sk .. "(" .. val .. ")" else str = str .. ", " .. sk .. "(" .. val .. ")" end first_skill = false end str = str .. "." crawl.formatted_mpr(str, "prompt") crawl.formatted_mpr("Choose a target skill level: ", "prompt") c_persist.target_skill = tonumber(crawl.c_input_line()) record_current_skills(c_persist.target_skill) -- Update the target skill for char_defaults if necessary. if save_default_target_skill and you.turns() == 0 then save_default_target_skill() end end function control(c) return string.char(string.byte(c) - string.byte('a') + 1) end -- Moved this to its own function to clean up ready() -gammafunk function target_skill() prev_need_target = need_target_skill -- Need to look at skills and then set a target skill if our -- need_target_skill variable is uninitialized and we're either at turn 0 or -- c_persist.target_skill also uninitialized. if prev_need_target == nil and (you.turns() == 0 or c_persist.target_skill == nil) then set_new_skill_training() end if prev_need_target then set_target_skill() need_target_skill = false elseif not need_target_skill then check_skills() end end -------------------------- ---- End target_skill ---- -------------------------- } { local function pickup_artefacts(item, name) if not item.is_useless and item.artefact then return true end end add_autopickup_func(pickup_artefacts) } { -- Autopickup single one of an item based on subtype or basename. -- (aux armours, buckler/shield, blowgun etc.) -- Smart needle pickup. (Until blowgun is found, and while kept in inventory.) -- Doesn't work if item's name/subtype isn't known before picking it up. -- Ignores useless items. -- -- Config local pickup_one_subtypes = { "cloak", "boots", "helmet", "gloves" } local pickup_one_basenames = { "blowgun", "buckler" } local pickup_needles_smart = true if you.genus() == "troll" or you.genus() == "ogre" then table.insert(pickup_one_basenames, "shield") end -- -- Helper functions local function Set(list) local set = {} for _, l in ipairs(list) do set[l] = true end return set end local function get_subtype(item) local subtype, _ = item.subtype() return subtype end local function get_basename(item) if item.artefact then local name = item.name("base") return name:gsub(" \".-\"$", "") else return item.name("base") end end local function inventory_match(item_func, value) for item in iter.invent_iterator:new(items.inventory()) do if item_func(item) == value then return item end end return nil end local function check_item(item) if pickup_one_subtypes[get_subtype(item)] then c_persist.pickup_one.got_subtype[get_subtype(item)] = true end if get_basename(item) == "blowgun" or pickup_one_basenames[get_basename(item)] then c_persist.pickup_one.got_basename[get_basename(item)] = true end end -- -- Interfacing with the game local initialized = false local function pickup_one(item, name) if not initialized then return end if item.is_useless then return false end if pickup_one_subtypes[get_subtype(item)] and not c_persist.pickup_one.got_subtype[get_subtype(item)] then return true end if pickup_one_basenames[get_basename(item)] and not c_persist.pickup_one.got_basename[get_basename(item)] then return true end if pickup_needles_smart and name:find("needle") then if not c_persist.pickup_one.got_basename["blowgun"] or inventory_match(get_basename, "blowgun") then return true end end end add_autopickup_func(pickup_one) function c_assign_invletter(item) check_item(item) end function ready() if not initialized then pickup_one_subtypes = Set(pickup_one_subtypes) pickup_one_basenames = Set(pickup_one_basenames) if you.turns() == 0 or c_persist.pickup_one == nil then c_persist.pickup_one = {} c_persist.pickup_one.got_subtype = {} c_persist.pickup_one.got_basename = {} for item in iter.invent_iterator:new(items.inventory()) do check_item(item) end end initialized = true end target_skill() end local function repel_and_go(command) local letter = nil local spell = nil for l, s in pairs(you.spell_table()) do if s == "Deflect Missiles" then letter = l spell = s break end if spell == "Repel Missiles" then letter = l spell = s end end if spell and not you.status(spell:lower()) then if not you.feel_safe() then crawl.mpr(spell .. " is not up.") else crawl.process_keys("z" .. letter .. command) end else crawl.process_keys(command) end end function repel_and_explore() repel_and_go("o") end }