Skip to content

Commit

Permalink
update script to automatically walk to horde when starting the script…
Browse files Browse the repository at this point in the history
… when not in cerrigar and update pylon priority
  • Loading branch information
Letrico committed Nov 5, 2024
1 parent 39e74a5 commit fa6ce51
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 89 deletions.
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 = { "reset_from_town" , "town_salvage" , "open_chests" , "exit_horde" ,"start_dungeon", "enter_horde", "horde" }
local task_files = { "walking_to_horde" , "town_salvage" , "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
112 changes: 112 additions & 0 deletions data/library.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
local waypoints = {
vec3:new(100.937500, -519.644531, 26.099609),
vec3:new(102.733627, -517.781433, 26.254822),
vec3:new(104.397194, -515.858826, 26.154461),
vec3:new(104.591751, -513.348816, 26.120878),
vec3:new(102.828651, -511.517029, 26.099613),
vec3:new(100.921715, -509.820007, 26.099609),
vec3:new(99.134506, -507.988129, 26.099609),
vec3:new(97.380280, -506.128418, 26.099609),
vec3:new(95.619316, -504.267761, 26.099609),
vec3:new(93.854622, -502.422150, 26.099609),
vec3:new(92.068542, -500.569275, 26.099609),
vec3:new(90.256821, -498.763519, 26.099609),
vec3:new(88.041428, -497.518219, 26.099609),
vec3:new(85.401176, -497.491699, 26.099609),
vec3:new(83.226524, -498.772156, 26.139851),
vec3:new(81.205116, -500.308075, 26.099613),
vec3:new(79.239395, -501.918182, 26.099609),
vec3:new(77.211319, -503.450714, 25.938366),
vec3:new(74.981003, -504.657745, 24.573696),
vec3:new(72.609070, -505.560944, 22.971382),
vec3:new(70.158241, -506.135376, 21.773630),
vec3:new(67.672028, -505.672546, 20.240232),
vec3:new(65.510918, -504.344147, 18.985296),
vec3:new(63.679760, -502.555664, 18.020880),
vec3:new(62.279961, -500.441254, 16.651726),
vec3:new(61.506348, -498.017975, 15.145669),
vec3:new(61.463634, -495.470367, 13.846075),
vec3:new(62.061161, -493.003510, 12.197880),
vec3:new(63.468838, -490.890259, 10.873410),
vec3:new(65.136650, -488.971588, 9.957315),
vec3:new(66.941437, -487.177307, 9.929690),
vec3:new(68.790359, -485.411652, 9.929688),
vec3:new(70.647720, -483.684174, 9.929688),
vec3:new(72.531540, -481.983765, 10.082567),
vec3:new(74.410416, -480.287781, 9.930424),
vec3:new(76.287819, -478.593109, 9.929688),
vec3:new(78.167038, -476.896851, 9.929688),
vec3:new(80.047287, -475.199615, 9.929688),
vec3:new(81.874886, -473.440338, 9.929688),
vec3:new(83.507721, -471.493225, 9.929688),
vec3:new(84.685410, -469.273560, 9.929688),
vec3:new(84.406631, -466.786316, 10.174728),
vec3:new(82.946648, -464.701416, 10.075959),
vec3:new(81.254303, -462.792023, 9.885176),
vec3:new(79.586288, -460.841675, 9.664390),
vec3:new(78.242706, -458.697388, 9.416736),
vec3:new(76.924492, -456.517883, 9.598301),
vec3:new(75.551750, -454.365234, 9.290595),
vec3:new(74.149063, -452.229492, 8.677274),
vec3:new(72.764313, -450.096924, 7.639228),
vec3:new(71.279449, -448.024536, 7.411386),
vec3:new(69.533630, -446.168823, 7.411133),
vec3:new(67.709885, -444.381775, 7.446426),
vec3:new(65.822350, -442.653259, 7.411197),
vec3:new(63.936405, -440.950714, 7.413431),
vec3:new(61.984879, -439.319336, 7.411133),
vec3:new(59.941902, -437.796112, 7.685702),
vec3:new(57.825245, -436.373901, 7.422284),
vec3:new(55.677170, -435.007416, 7.411134),
vec3:new(53.324989, -434.065125, 7.545426),
vec3:new(50.906830, -433.254730, 7.466190),
vec3:new(48.474003, -432.498444, 7.537072),
vec3:new(46.073139, -431.714905, 7.366281),
vec3:new(43.680664, -430.972748, 5.923441),
vec3:new(41.216984, -430.412811, 4.694360),
vec3:new(38.687107, -430.042450, 3.740802),
vec3:new(36.183681, -429.576660, 2.801580),
vec3:new(33.698284, -429.031158, 1.929688),
vec3:new(31.230135, -428.421539, 1.037931),
vec3:new(28.768869, -427.723541, 0.180523),
vec3:new(26.307755, -427.049805, -0.406971),
vec3:new(23.774908, -426.742462, -0.579710),
vec3:new(21.266861, -427.576202, -0.558158),
vec3:new(19.340776, -429.181305, -0.495154),
vec3:new(18.080170, -431.366638, -1.692765),
vec3:new(17.073906, -433.699127, -2.966106),
vec3:new(16.085472, -436.039337, -4.018592),
vec3:new(15.148217, -438.389191, -4.930777),
vec3:new(14.496714, -440.832092, -5.827541),
vec3:new(14.466300, -443.357117, -6.658053),
vec3:new(15.080790, -445.801056, -6.646984),
vec3:new(17.398922, -446.943939, -7.177614),
vec3:new(19.916605, -446.670807, -7.178711),
vec3:new(22.418274, -446.996002, -7.089436),
vec3:new(24.903563, -447.366333, -7.220877),
vec3:new(27.375443, -447.834747, -8.660797),
vec3:new(29.815361, -448.519165, -9.920521),
vec3:new(32.251312, -449.223694, -10.918549),
vec3:new(34.698658, -449.860443, -11.805861),
vec3:new(37.153427, -450.466583, -12.738388),
vec3:new(39.513145, -451.403290, -13.473344),
vec3:new(41.856743, -452.326202, -14.246779),
vec3:new(44.272209, -453.068390, -14.594975),
vec3:new(46.757004, -453.530518, -14.944520),
vec3:new(49.274517, -453.907745, -14.814921),
vec3:new(51.482712, -455.265717, -15.265311),
vec3:new(50.328911, -457.517914, -15.536719),
vec3:new(48.596809, -459.345612, -16.354591),
vec3:new(47.068214, -461.372681, -18.074730),
vec3:new(45.433777, -463.308319, -19.537773),
vec3:new(43.737305, -465.187744, -20.820560),
vec3:new(42.004173, -467.050110, -21.975956),
vec3:new(40.252163, -468.891998, -23.131308),
vec3:new(38.479515, -470.731354, -24.231821),
vec3:new(36.775154, -472.626343, -24.511578),
vec3:new(34.982586, -474.409851, -24.511719),
vec3:new(33.130245, -476.162231, -24.511719),
vec3:new(31.282021, -477.916534, -24.511719),
}

return waypoints
28 changes: 14 additions & 14 deletions data/pylons.lua
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
-- List of pylons with their priorities
local pylons = {
"SurgingElites", -- Chance for Elite Doubled, Aether Fiends grant +2 Aether
"EmpoweredElites", -- Elite damage +25%, Aether Fiends grant +2 Aether
"SkulkingHellborne", -- Hellborne Hunting You, Hellborne +1 Aether
"SurgingHellborne", -- +1 Hellborne when Spawned, Hellborne Grant +1 Aether
"EmpoweredHellborne", -- Hellborne +25% Damage, Hellborne grant +1 Aether
"MeteoricHellborne", -- Hellfire now spawns Hellborne, +1 Aether
"SurgingElites", -- Chance for Elite Doubled, Aether Fiends grant +1 Aether
"BlisteringHordes", -- Normal Monster Spawn Aether Events 50% Faster
"EmpoweredElites", -- Elite damage +25%, Aether Fiends grant +1 Aether
"UnstoppableElites", -- Elites are Unstoppable, Aether Fiends grant +1 Aether
"RagingHellfire", -- Hellfire rains upon you, at the end of each wave spawn 1-3 Aether
"InvigoratingHellborne", -- Hellborne Damage +25%, Slaying Hellborne Invigorates you
"UnstoppableElites", -- Elites are Unstoppable, Aether Fiends grant +2 Aether
"RagingHellfire", -- Hellfire rains upon you, at the end of each wave spawn 3-9 Aether
"GestatingMasses", -- Masses spawn an Aether lord on Death, Aether Lords Grant +3 Aether
"ThrivingMasses", -- Masses deal unavoidable damage, Wave start, spawn an Aetheric Mass
"EmpoweredMasses", -- Aetheric Mass damage: +25%, Aetheric Mass grants +1 Aether
"InfernalStalker", -- An Infernal demon has your scent, Slay it to gain +25 Aether
"AetherRush", -- Normal Monsters Damage +25%, Gathering Aether Increases Movement Speed
"EmpoweredCouncil", -- Fell Council +50% Damage, Council grants +15 Aether
"IncreasedEvadeCooldown", -- Increase Evade Cooldown +2 Sec, Council grants +15 Aether
"IncreasedPotionCooldown", -- Increase potion cooldown +2 Sec, Council Grants +15 Aether
"ReduceAllResistance", -- Reduce All Resist -10%, Council grants +15 Aether
"EmpoweredCouncil", -- Fell Council +50% Damage, Council grants +15 Aether
"EmpoweredMasses", -- Aetheric Mass damage: +25%, Aetheric Mass grants +1 Aether
"EnergizingMasses", -- Slaying Aetheric Masses slow you, While slowed this way, you have UNLIMITED RESOURCES
"ThrivingMasses", -- Masses deal unavoidable damage, Wave start, spawn an Aetheric Mass
"MeteoricHellborne", -- Hellfire now spawns Hellborne, +1 Aether
"DeadlySpires", -- Soulspires Drain Health, Soulspires grant +2 Aether
"InvigoratingHellborne", -- Hellborne Damage +25%, Slaying Hellborne Invigorates you
"AetherRush", -- Normal Monsters Damage +25%, Gathering Aether Increases Movement Speed
"InfernalLords", -- Aether Lords Now Spawn, they grant +3 Aether
"EnergizingMasses", -- Slaying Aetheric Masses slow you, While slowed this way, you have UNLIMITED RESOURCES
"CorruptingSpires", -- Soulspires empower nearby foes, they also pull enemies inward
"GreedySpires", -- Soulspire requires 2x kills, Soulspires grant 2x Aether
"UnstableFiends", -- Elite Damage +25%, Aether Fiends explode and damage FOES
"GestatingMasses", -- Masses spawn an Aether lord on Death, Aether Lords Grant +3 Aether
"InfernalLords" -- Aether Lords Now Spawn, they grant +3 Aether
"UnstableFiends" -- Elite Damage +25%, Aether Fiends explode and damage FOES
}

return pylons
74 changes: 0 additions & 74 deletions tasks/reset_from_town.lua

This file was deleted.

68 changes: 68 additions & 0 deletions tasks/walking_to_horde.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
local utils = require "core.utils"
local enums = require "data.enums"
local explorer = require "core.explorer"
local tracker = require "core.tracker"

local walking_to_horde_task = {
name = "Walking to Horde",
last_teleport_time = 0,
teleport_wait_time = 10, -- Wait time in seconds
current_waypoint_index = 1,
waypoints = require "data.library",
arrived_destination = false
}

-- 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
end

-- Task execute function (without self)
function walking_to_horde_task.Execute()
console.print("Executing Walking to Horde task")

local current_time = get_time_since_inject()

if not tracker.teleported_from_town then
-- Teleport to the Library waypoint
teleport_to_waypoint(enums.waypoints.LIBRARY)

-- Set the flag to true after teleporting
tracker.teleported_from_town = true
walking_to_horde_task.last_teleport_time = current_time
walking_to_horde_task.current_waypoint_index = 1

console.print("Teleported to Library waypoint, waiting for " .. walking_to_horde_task.teleport_wait_time .. " seconds")
elseif current_time - walking_to_horde_task.last_teleport_time >= walking_to_horde_task.teleport_wait_time then
local current_waypoint = walking_to_horde_task.waypoints[walking_to_horde_task.current_waypoint_index]

if current_waypoint then
-- Set the custom target to the current waypoint
explorer:set_custom_target(current_waypoint)

-- Move to the target
explorer:move_to_target()

-- Check distance to current waypoint
local distance_to_waypoint = utils.distance_to(current_waypoint)
if distance_to_waypoint < 2 then
-- Move to the next waypoint
walking_to_horde_task.current_waypoint_index = walking_to_horde_task.current_waypoint_index + 1
console.print("Reached waypoint " .. (walking_to_horde_task.current_waypoint_index - 1) .. ", moving to next")
end
else
-- All waypoints have been reached
tracker.teleported_from_town = false
walking_to_horde_task.current_waypoint_index = 1
walking_to_horde_task.arrived_destination = true
console.print("Walking to Horde task completed")
return true
end
else
console.print("Waiting for teleport cooldown... " .. string.format("%.2f", walking_to_horde_task.teleport_wait_time - (current_time - walking_to_horde_task.last_teleport_time)) .. " seconds left")
end

return false
end

return walking_to_horde_task

0 comments on commit fa6ce51

Please sign in to comment.