Skip to content

Commit

Permalink
Rearrange UI and update center point for unstuck, movement spells is …
Browse files Browse the repository at this point in the history
…now a selection that can be disabled/enabled
  • Loading branch information
Letrico committed Nov 17, 2024
1 parent aa1aa02 commit 5911feb
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 41 deletions.
54 changes: 42 additions & 12 deletions core/explorer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -576,19 +576,40 @@ function explorer:movement_spell_to_target(target)
local local_player = get_local_player()
if not local_player then return end

local movement_spell_id = {
288106, -- Sorcerer teleport
959728, -- Sorcerer teleport enchant
358761, -- Rogue dash
355606, -- Rogue shadow step
1663206, -- spiritborn hunter
1871821, -- spiritborn soar
}
local movement_spell_id = {}

if settings.use_evade_as_movement_spell then
table.insert(movement_spell_id, 337031) -- General Evade
end

if settings.use_teleport then
table.insert(movement_spell_id, 288106) -- Sorceror Teleport
end

if settings.use_teleport_enchanted then
table.insert(movement_spell_id, 959728) -- Sorceror Teleport Enchanted
end

if settings.use_dash then
table.insert(movement_spell_id, 358761) -- Rogue Dash
end

if settings.use_shadow_step then
table.insert(movement_spell_id, 355606) -- Rogue Shadow Step
end

if settings.use_the_hunter then
table.insert(movement_spell_id, 1663206) -- Spiritborn The Hunter
end

if settings.use_soar then
table.insert(movement_spell_id, 1871821) -- Spiritborn Soar
end

if settings.use_rushing_claw then
table.insert(movement_spell_id, 1871761) -- Spiritborn Rushing Claw
end

-- Check if the dash spell is off cooldown and ready to cast
for _, spell_id in ipairs(movement_spell_id) do
if local_player:is_spell_ready(spell_id) then
Expand All @@ -605,6 +626,16 @@ function explorer:movement_spell_to_target(target)
end
end

local function get_closest_center_position()
local horde_boss_room_position = vec3:new(-36.17675, -36.3222, 2.200)
local horde_center_position = vec3:new(9.204102, 8.915039, 0.000000)
if calculate_distance(get_player_position(), horde_center_position) < calculate_distance(get_player_position(), horde_boss_room_position) then
return horde_center_position
else
return horde_boss_room_position
end
end

local function move_to_target()
if explorer.is_task_running then
return -- Do not set a path if a task is running
Expand Down Expand Up @@ -656,7 +687,7 @@ local function move_to_target()
else
-- Move to center if no target
console.print("No target found. Moving to center.")
pathfinder.force_move_raw(vec3:new(9.204102, 8.915039, 0.000000))
pathfinder.force_move_raw(get_closest_center_position())
end
end

Expand All @@ -666,7 +697,7 @@ local function move_to_target_aggresive()
else
-- Move to center if no target
console.print("No target found. Moving to center.")
pathfinder.force_move_raw(vec3:new(9.204102, 8.915039, 0.000000))
pathfinder.force_move_raw(get_closest_center_position())
end
end

Expand Down Expand Up @@ -696,7 +727,6 @@ function explorer:move_to_target_safely()
move_to_target()
end


local last_call_time = 0.0
local is_player_on_quest = false
on_update(function()
Expand Down Expand Up @@ -735,7 +765,7 @@ on_update(function()
if is_stuck then
console.print("Character was stuck. Finding new target and attempting revive")
-- Set target to center position
target_position = vec3:new(9.204102, 8.915039, 0.000000)
target_position = get_closest_center_position()
target_position = set_height_of_valid_position(target_position)
last_move_time = os.time()
current_path = {}
Expand Down
22 changes: 18 additions & 4 deletions core/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local settings = {
run_pit = false,
party_mode = false,
pit_level = 1,
salvage = false,
salvage = true,
aggresive_movement = true,
path_angle = 10,
reset_time = 1,
Expand All @@ -15,15 +15,22 @@ local settings = {
merry_go_round = true,
movement_spell_to_objective = true,
use_evade_as_movement_spell = true,
open_chest_delay = 12,
open_ga_chest_delay = 12,
use_teleport = true,
use_teleport_enchanted = true,
use_dash = true,
use_shadow_step = true,
use_the_hunter = true,
use_rushing_claw = true,
use_soar = true,
open_chest_delay = 1.5,
open_ga_chest_delay = 3,
wait_loot_delay = 10,
boss_kill_delay = 6,
chest_move_attempts = 40,
use_salvage_filter_toggle = false,
affix_salvage_count = 0,
greater_affix_count = 0,
use_alfred = false,
use_alfred = true,
}

function settings:update_settings()
Expand All @@ -39,6 +46,13 @@ function settings:update_settings()
settings.merry_go_round = gui.elements.merry_go_round:get()
settings.movement_spell_to_objective = gui.elements.movement_spell_to_objective:get()
settings.use_evade_as_movement_spell = gui.elements.use_evade_as_movement_spell:get()
settings.use_teleport = gui.elements.use_teleport:get()
settings.use_teleport_enchanted = gui.elements.use_teleport_enchanted:get()
settings.use_dash = gui.elements.use_dash:get()
settings.use_shadow_step = gui.elements.use_shadow_step:get()
settings.use_the_hunter = gui.elements.use_the_hunter:get()
settings.use_soar = gui.elements.use_soar:get()
settings.use_rushing_claw = gui.elements.use_rushing_claw:get()
settings.open_chest_delay = gui.elements.open_chest_delay:get()
settings.open_ga_chest_delay = gui.elements.open_ga_chest_delay:get()
settings.wait_loot_delay = gui.elements.wait_loot_delay:get()
Expand Down
63 changes: 45 additions & 18 deletions gui.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
local gui = {}
local plugin_label = "infernal_horde"
local version = "v1.3.0"
console.print("Lua Plugin - Infernal Hordes - Letrico - " .. version);

local function create_checkbox(value, key)
return checkbox:new(value, get_hash(plugin_label .. "_" .. key))
Expand All @@ -22,6 +24,8 @@ gui.elements = {
use_keybind = create_checkbox(false, "use_keybind"),
keybind_toggle = keybind:new(0x0A, true, get_hash(plugin_label .. "_keybind_toggle" )),
settings_tree = tree_node:new(1),
advanced_tree = tree_node:new(2),
movement_tree = tree_node:new(3),
run_pit_toggle = create_checkbox(false, "run_pit"),
party_mode_toggle = create_checkbox(false, "party_mode"),
salvage_toggle = create_checkbox(true, "salvage_toggle"),
Expand All @@ -40,11 +44,18 @@ gui.elements = {
affix_salvage_count = slider_int:new(0, 3, 1, get_hash(plugin_label .. "affix_salvage_count")), -- 0 is a default value
movement_spell_to_objective = create_checkbox(true, "movement_spell_to_objective"),
use_evade_as_movement_spell = create_checkbox(true, "use_evade_as_movement_spell"),
use_alfred = create_checkbox(false, "use_alfred")
use_teleport = create_checkbox(true, "use_teleport"),
use_teleport_enchanted = create_checkbox(true, "use_teleport_enchanted"),
use_dash = create_checkbox(true, "use_dash"),
use_shadow_step = create_checkbox(true, "use_shadow_step"),
use_the_hunter = create_checkbox(true, "use_the_hunter"),
use_soar = create_checkbox(true, "use_soar"),
use_rushing_claw = create_checkbox(true, "use_rushing_claw"),
use_alfred = create_checkbox(true, "use_alfred")
}

function gui.render()
if not gui.elements.main_tree:push("Infernal Horde | Letrico | v1.2.9c") then return end
if not gui.elements.main_tree:push("Infernal Horde | Letrico | " .. version) then return end

gui.elements.main_toggle:render("Enable", "Enable the bot")
gui.elements.use_keybind:render("Use keybind", "Keybind to quick toggle the bot");
Expand All @@ -60,33 +71,49 @@ function gui.render()
end
gui.elements.movement_spell_to_objective:render("Attempt to use movement spell for objective", "Will attempt to use movement spell towards objective")
if gui.elements.movement_spell_to_objective:get() then
gui.elements.use_evade_as_movement_spell:render("Use evade as movement spell", "Will attempt to use evade as movement spell")
if gui.elements.movement_tree:push("Movement Spells") then
gui.elements.use_evade_as_movement_spell:render("Default Evade", "Will attempt to use evade as movement spell")
gui.elements.use_teleport:render("Sorceror Teleport", "Will attempt to use Sorceror Teleport as movement spell")
gui.elements.use_teleport_enchanted:render("Sorceror Teleport Enchanted", "Will attempt to use Sorceror Teleport Enchanted as movement spell")
gui.elements.use_dash:render("Rogue Dash", "Will attempt to use Rogue Dash as movement spell")
gui.elements.use_shadow_step:render("Rogue Shadow Step", "Will attempt to use Rogue Shadow Step as movement spell")
gui.elements.use_the_hunter:render("Spiritborn The Hunter", "Will attempt to use Spiritborn The Hunter as movement spell")
gui.elements.use_soar:render("Spiritborn Soar", "Will attempt to use Spiritborn Soar as movement spell")
gui.elements.use_rushing_claw:render("Spiritborn Rushing Claw", "Will attempt to use Spiritborn Rushing Claw as movement spell")
gui.elements.movement_tree:pop()
end
end

-- Updated chest type selector to use the new enum structure
gui.elements.merry_go_round:render("Circle arena when wave completes", "Toggle to circle arene when wave completes to pick up stray Aethers")
gui.elements.always_open_ga_chest:render("Always Open GA Chest", "Toggle to always open Greater Affix chest when available")
gui.elements.chest_type_selector:render("Select Chest Type", gui.chest_types_options, "Select the type of chest to open")
gui.elements.salvage_toggle:render("Salvage", "Enable salvaging items")
if gui.elements.salvage_toggle:get() then
gui.elements.use_salvage_filter_toggle:render("Use salvage filter logic (update filter)", "Salvage based on filter logic. Update filter")
gui.elements.greater_affix_count:render("Min Greater Affixes to Keep", "Select minimum number of Greater Affixes to keep an item (0-3, 0 = off)")
if gui.elements.salvage_toggle:get() and gui.elements.use_salvage_filter_toggle:get() then
gui.elements.affix_salvage_count:render("Min No. affixes to keep", "Minimum number of matching affixes to keep")
if PLUGIN_alfred_the_butler then
local alfred_status = PLUGIN_alfred_the_butler.get_status()
if alfred_status.enabled then
gui.elements.use_alfred:render("Use alfred (salvage/sell/stash/restock)", "use alfred to manage town tasks")
end
end
end
if PLUGIN_alfred_the_butler then
local alfred_status = PLUGIN_alfred_the_butler.get_status()
if alfred_status.enabled then
gui.elements.use_alfred:render("Use alfred", "use alfred to manage town tasks")
if not gui.elements.use_alfred:get() then
gui.elements.use_salvage_filter_toggle:render("Use salvage filter logic (update filter)", "Salvage based on filter logic. Update filter")
gui.elements.greater_affix_count:render("Min Greater Affixes to Keep", "Select minimum number of Greater Affixes to keep an item (0-3, 0 = off)")
if gui.elements.salvage_toggle:get() and gui.elements.use_salvage_filter_toggle:get() then
gui.elements.affix_salvage_count:render("Min No. affixes to keep", "Minimum number of matching affixes to keep")
end
end
end
-- Updated chest type selector to use the new enum structure
gui.elements.chest_type_selector:render("Chest Type", gui.chest_types_options, "Select the type of chest to open")
gui.elements.always_open_ga_chest:render("Always Open GA Chest", "Toggle to always open Greater Affix chest when available")
gui.elements.merry_go_round:render("Circle arena when wave completes", "Toggle to circle arene when wave completes to pick up stray Aethers")
gui.elements.settings_tree:pop()
end

if gui.elements.advanced_tree:push("Advanced settings") then
gui.elements.open_ga_chest_delay:render("GA Chest open delay", "Adjust delay for the chest opening (1.0-3.0)", 1)
gui.elements.open_chest_delay:render("Chest open delay", "Adjust delay for the chest opening (1.0-3.0)", 1)
gui.elements.wait_loot_delay:render("Wait loot delay", "Adjust delay for the waiting loot (12)", 1)
gui.elements.boss_kill_delay:render("Boss kill delay", "Adjust delay after killing boss (1-15)")
gui.elements.chest_move_attempts:render("Chest move attempts", "Adjust the amount of times it tries to reach a chest (20-400)")

gui.elements.settings_tree:pop()
gui.elements.advanced_tree:pop()
end

gui.elements.main_tree:pop()
Expand Down
8 changes: 1 addition & 7 deletions main.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
-- if true then return end

local gui = require "gui"
local task_manager = require "core.task_manager"
local settings = require "core.settings"
Expand Down Expand Up @@ -49,8 +47,4 @@ on_update(function()
end)

on_render_menu(gui.render)
on_render(render_pulse)

console.print("Lua Plugin - Infernal Hordes - Letrico - v1.2.7");
console.print("Infernal Hordes: Detected class: " .. utils.get_character_class());
console.print("Infernal Hordes: If salvage filter is enabled, it will use the following filter: " .. utils.get_character_class() .. ".lua");
on_render(render_pulse)

0 comments on commit 5911feb

Please sign in to comment.