Skip to content

Commit

Permalink
Fixed walking to horde and implement new feature to run pit when out …
Browse files Browse the repository at this point in the history
…of compass
  • Loading branch information
Letrico committed Nov 9, 2024
1 parent fa6ce51 commit a2dcb2b
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 42 deletions.
2 changes: 2 additions & 0 deletions core/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local settings = {
enabled = false,
use_keybind = false,
elites_only = false,
run_pit = false,
party_mode = false,
pit_level = 1,
salvage = false,
Expand All @@ -29,6 +30,7 @@ function settings:update_settings()
settings.enabled = gui.elements.main_toggle:get()
settings.use_keybind = gui.elements.use_keybind:get()
settings.salvage = gui.elements.salvage_toggle:get()
settings.run_pit = gui.elements.run_pit_toggle:get()
settings.party_mode = gui.elements.party_mode_toggle:get()
settings.aggresive_movement = gui.elements.aggresive_movement_toggle:get() -- Finn's movement logic
settings.path_angle = gui.elements.path_angle_slider:get()
Expand Down
2 changes: 1 addition & 1 deletion core/task_manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function task_manager.get_current_task()
return current_task
end

local task_files = { "walking_to_horde" , "town_salvage" , "open_chests" , "exit_horde" ,"start_dungeon", "enter_horde", "horde" }
local task_files = { "town_salvage" , "walking_to_horde", "open_chests" , "exit_horde" ,"start_dungeon", "enter_horde", "horde" }
for _, file in ipairs(task_files) do
local task = require("tasks." .. file)
task_manager.register_task(task)
Expand Down
13 changes: 13 additions & 0 deletions core/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ function utils.get_horde_portal()
end
end

function utils.get_horde_gate()
local actors = actors_manager:get_all_actors()
for _, actor in pairs(actors) do
local name = actor:get_skin_name()
local distance = utils.distance_to(actor)
if distance < 100 then
if name == enums.portal_names.horde_gate then
return actor
end
end
end
end

function utils.get_town_portal()
local actors = actors_manager:get_all_actors()
for _, actor in pairs(actors) do
Expand Down
3 changes: 2 additions & 1 deletion data/enums.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ local enums = {
pit_started = 1922713
},
portal_names = {
horde_portal = "Portal_Dungeon_Generic"
horde_portal = "Portal_Dungeon_Generic",
horde_gate = "S05_Hellgate_FX_Arrangement_SP"
},
misc = {
obelisk = "TWN_Kehj_IronWolves_PitKey_Crafter",
Expand Down
66 changes: 33 additions & 33 deletions data/filters/spiritborn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ filter.helm_affix_filter = {
{ sno_id = 1829592, affix_name = "Maximum Life" },
{ sno_id = 1829554, affix_name = "Armor" },
{ sno_id = 1829562, affix_name = "Dexterity" },
{ sno_id = 1987429, affix_name = "Aspect of Interdiction" },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension" },
{ sno_id = 1822350, affix_name = "Aspect of Duelist" },
{ sno_id = 1987429, affix_name = "Aspect of Interdiction", max_roll = true },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension", max_roll = true },
{ sno_id = 1822350, affix_name = "Aspect of Duelist", max_roll = true },
}

filter.chest_affix_filter = {
{ sno_id = 1829578, affix_name = "All Stats" }, -- For 111 All Stats
{ sno_id = 1829592, affix_name = "Maximum Life" },
{ sno_id = 1829664, affix_name = "Resource Generation" },
{ sno_id = 1987429, affix_name = "Aspect of Interdiction" },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension" },
{ sno_id = 1822350, affix_name = "Aspect of Duelist" },
{ sno_id = 1987429, affix_name = "Aspect of Interdiction", max_roll = true },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension", max_roll = true },
{ sno_id = 1822350, affix_name = "Aspect of Duelist", max_roll = true },
}

filter.gloves_affix_filter = {
Expand All @@ -26,51 +26,51 @@ filter.gloves_affix_filter = {
{ sno_id = 1928753, affix_name = "Ranks to Core Skills" },
{ sno_id = 2014537, affix_name = "Ranks to Quill Volley" },
{ sno_id = 2014518, affix_name = "Ranks to Crushing Hands" },
{ sno_id = 1858284, affix_name = "Aspect of Redirected Force" },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension" },
{ sno_id = 1822350, affix_name = "Aspect of Duelist" },
{ sno_id = 1858284, affix_name = "Aspect of Redirected Force", max_roll = true },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension", max_roll = true },
{ sno_id = 1822350, affix_name = "Aspect of Duelist", max_roll = true },
}

filter.pants_affix_filter = {
{ sno_id = 1829592, affix_name = "Maximum Life" },
{ sno_id = 1829562, affix_name = "Dexterity" },
{ sno_id = 1829554, affix_name = "Armor" },
{ sno_id = 1928751, affix_name = "Ranks to Basic Skills" },
{ sno_id = 1987429, affix_name = "Aspect of Interdiction" },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension" },
{ sno_id = 1822350, affix_name = "Aspect of Duelist" },
{ sno_id = 1987429, affix_name = "Aspect of Interdiction", max_roll = true },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension", max_roll = true },
{ sno_id = 1822350, affix_name = "Aspect of Duelist", max_roll = true },
}

filter.boots_affix_filter = {
{ sno_id = 1829592, affix_name = "Maximum Life" },
{ sno_id = 1829562, affix_name = "Dexterity" },
{ sno_id = 1829598, affix_name = "Movement Speed" },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension" },
{ sno_id = 1822350, affix_name = "Aspect of Duelist" },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension", max_roll = true },
{ sno_id = 1822350, affix_name = "Aspect of Duelist", max_roll = true },
}

filter.amulet_affix_filter = {
{ sno_id = 1829592, affix_name = "Maximum Life" },
{ sno_id = 1829600, affix_name = "Overpower Damage" },
{ sno_id = 1829556, affix_name = "Attack Speed" },
{ sno_id = 1928753, affix_name = "Ranks to Core Skills" },
{ sno_id = 1858284, affix_name = "Aspect of Redirected Force" },
{ sno_id = 1987429, affix_name = "Aspect of Interdiction" },
{ sno_id = 1966074, affix_name = "Aspect of Fell Soothsayer" },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension" },
{ sno_id = 1822350, affix_name = "Aspect of Duelist" },
{ sno_id = 1978628, affix_name = "Aspect of Plains Power" },
{ sno_id = 1822329, affix_name = "Aspect of Unyielding Hits" },
{ sno_id = 1858284, affix_name = "Aspect of Redirected Force", max_roll = true },
{ sno_id = 1987429, affix_name = "Aspect of Interdiction", max_roll = true },
{ sno_id = 1966074, affix_name = "Aspect of Fell Soothsayer", max_roll = true },
{ sno_id = 1975355, affix_name = "Aspect of Apprehension", max_roll = true },
{ sno_id = 1822350, affix_name = "Aspect of Duelist", max_roll = true },
{ sno_id = 1978628, affix_name = "Aspect of Plains Power", max_roll = true },
{ sno_id = 1822329, affix_name = "Aspect of Unyielding Hits", max_roll = true },
}

filter.ring_affix_filter = {
{ sno_id = 1915409, affix_name = "Resource Cost Reduction" }, -- Ring 1
{ sno_id = 1829592, affix_name = "Maximum Life" },
{ sno_id = 1829556, affix_name = "Attack Speed" },
{ sno_id = 1858284, affix_name = "Aspect of Redirected Force" },
{ sno_id = 1966074, affix_name = "Aspect of Fell Soothsayer" },
{ sno_id = 1978628, affix_name = "Aspect of Plains Power" },
{ sno_id = 1822329, affix_name = "Aspect of Unyielding Hits" },
{ sno_id = 1858284, affix_name = "Aspect of Redirected Force", max_roll = true },
{ sno_id = 1966074, affix_name = "Aspect of Fell Soothsayer", max_roll = true },
{ sno_id = 1978628, affix_name = "Aspect of Plains Power", max_roll = true },
{ sno_id = 1822329, affix_name = "Aspect of Unyielding Hits", max_roll = true },
{ sno_id = 1829614, affix_name = "Fire Resistance" }, -- Ring 1 Fire Resistance
{ sno_id = 1966841, affix_name = "Unique Affix" }, -- Ring of Midnight Sun
{ sno_id = 2124067, affix_name = "Ranks to Mirage" }, -- Ring of Midnight Sun
Expand All @@ -81,20 +81,20 @@ filter.one_hand_weapons_affix_filter = {
{ sno_id = 1834105, affix_name = "Maximum Vigor" }, -- Closest match for Vigor
{ sno_id = 1829582, affix_name = "Critical Strike Chance" },
{ sno_id = 1928753, affix_name = "Ranks to Core Skills" },
{ sno_id = 1858284, affix_name = "Aspect of Redirected Force" },
{ sno_id = 1966074, affix_name = "Aspect of Fell Soothsayer" },
{ sno_id = 1978628, affix_name = "Aspect of Plains Power" },
{ sno_id = 1822329, affix_name = "Aspect of Unyielding Hits" },
{ sno_id = 1858284, affix_name = "Aspect of Redirected Force", max_roll = true },
{ sno_id = 1966074, affix_name = "Aspect of Fell Soothsayer", max_roll = true },
{ sno_id = 1978628, affix_name = "Aspect of Plains Power", max_roll = true },
{ sno_id = 1822329, affix_name = "Aspect of Unyielding Hits", max_roll = true },
}

filter.two_hand_weapons_affix_filter = {
{ sno_id = 2123784, affix_name = "Ranks to Velocity" }, -- Rod of Kepeleke
{ sno_id = 2123788, affix_name = "Chance for Core Skills to Hit Twice" }, -- Rod of Kepeleke
{ sno_id = 2093164, affix_name = "Unique Affix" }, -- Rod of Kepeleke
{ sno_id = 1858284, affix_name = "Aspect of Redirected Force" },
{ sno_id = 1966074, affix_name = "Aspect of Fell Soothsayer" },
{ sno_id = 1978628, affix_name = "Aspect of Plains Power" },
{ sno_id = 1822329, affix_name = "Aspect of Unyielding Hits" },
{ sno_id = 1858284, affix_name = "Aspect of Redirected Force", max_roll = true },
{ sno_id = 1966074, affix_name = "Aspect of Fell Soothsayer", max_roll = true },
{ sno_id = 1978628, affix_name = "Aspect of Plains Power", max_roll = true },
{ sno_id = 1822329, affix_name = "Aspect of Unyielding Hits", max_roll = true },
}

filter.focus_weapons_affix_filter = {
Expand Down
4 changes: 3 additions & 1 deletion gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ 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),
run_pit_toggle = create_checkbox(false, "run_pit"),
party_mode_toggle = create_checkbox(false, "party_mode"),
salvage_toggle = create_checkbox(true, "salvage_toggle"),
aggresive_movement_toggle = create_checkbox(true, "aggresive_movement_toggle"),
Expand All @@ -48,14 +49,15 @@ gui.elements = {
}

function gui.render()
if not gui.elements.main_tree:push("Infernal Horde | Letrico | v1.2.7") then return end
if not gui.elements.main_tree:push("Infernal Horde | Letrico | v1.2.8") 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");
if gui.elements.use_keybind:get() then
gui.elements.keybind_toggle:render("Toggle Keybind", "Toggle the bot for quick enable");
end
if gui.elements.settings_tree:push("Settings") then
gui.elements.run_pit_toggle:render("Run pit when finish compasses", "Run pit when finish compasses");
gui.elements.party_mode_toggle:render("Party mode (Does not pick pylon)", "Does not activate Pylon");
gui.elements.aggresive_movement_toggle:render("Aggresive movement", "Move directly to target, will fight close to target")
if not gui.elements.aggresive_movement_toggle:get() then
Expand Down
10 changes: 10 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ local function render_pulse()
end
end

-- Set Global access for other plugins
InfernalHordesPlugin = {
enable = function ()
gui.elements.main_toggle:set(true)
end,
disable = function ()
gui.elements.main_toggle:set(false)
end,
}

on_update(function()
update_locals()
meteor.initialize()
Expand Down
15 changes: 14 additions & 1 deletion tasks/start_dungeon.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local utils = require "core.utils"
local enums = require "data.enums"
local settings = require "core.settings"
local tracker = require "core.tracker"
local open_chests_task = require "tasks.open_chests"

Expand Down Expand Up @@ -33,7 +33,19 @@ local function use_dungeon_sigil()
end
end
end

console.print("Dungeon Sigil not found in inventory.")

-- Stop script and run pit
if settings.run_pit then
if PitPlugin then
InfernalHordesPlugin.disable()
PitPlugin.enable()
else
console.print("Pit version does not support auto start")
end
end

return false
end

Expand Down Expand Up @@ -68,6 +80,7 @@ local start_dungeon_task = {
if elapsed_time >= 5 then
if not tracker.sigil_used then
console.print("Attempting to use Dungeon Sigil")
tracker.teleported_from_town = false -- reset walk to horde
reset_chest_flags() -- Reset chest flags at the start of the dungeon
use_dungeon_sigil()
else
Expand Down
11 changes: 7 additions & 4 deletions tasks/town_salvage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ local function salvage_low_greater_affix_items_with_filter()
for _, filter_entry in pairs(filter_table) do
if filter_entry.sno_id == affix.affix_name_hash then
found_affixes = found_affixes + 1
if filter_entry.max_roll then
if affix:get_roll() == affix:get_roll_max() then
found_affixes = found_affixes + 2
end
end
break
end
end
Expand Down Expand Up @@ -123,14 +128,12 @@ local town_salvage_task = {
last_portal_interaction_time = 0,

shouldExecute = function()
local player = get_local_player()
local item_count = utils.is_inventory_full()
local in_cerrigar = utils.player_in_zone("Scos_Cerrigar")
local gold_chest_exists = utils.get_chest(enums.chest_types["GOLD"]) ~= nil

-- If we're already in Cerrigar, continue the salvage process regardless of the gold chest
-- If we are in Cerrigar, salvage if flag is true
if in_cerrigar then
return settings.salvage
return settings.salvage and (tracker.needs_salvage or tracker.has_salvaged)
end

-- If we're not in Cerrigar, we need both high item count and a gold chest to start
Expand Down
29 changes: 28 additions & 1 deletion tasks/walking_to_horde.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,36 @@ local walking_to_horde_task = {
arrived_destination = false
}

local function near_horde_gate()
local gate = utils.get_horde_gate()
if gate then
if utils.distance_to(gate) < 10 then
return true
else
return false
end
else
return false
end
end

local function is_loading_or_limbo()
local current_world = world.get_current_world()
if not current_world then
return true
end
local world_name = current_world:get_name()
return world_name:find("Limbo") ~= nil or world_name:find("Loading") ~= nil
end

-- console.print("distance to gate: " .. tostring(utils.distance_to(utils.get_horde_gate())))

console.print("gate: " .. tostring(near_horde_gate()))

-- Task should execute function (without self)
function walking_to_horde_task.shouldExecute()
return not utils.player_in_zone("Scos_Cerrigar") and not walking_to_horde_task.arrived_destination
return not is_loading_or_limbo() and not (utils.player_in_zone("Kehj_Caldeum") or utils.player_in_zone("S05_BSK_Prototype02")) or
(utils.player_in_zone("Kehj_Caldeum") and not near_horde_gate())
end

-- Task execute function (without self)
Expand Down

0 comments on commit a2dcb2b

Please sign in to comment.