Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
LyLoLoq committed Apr 24, 2023
1 parent e7da85b commit 01addd0
Showing 1 changed file with 135 additions and 61 deletions.
196 changes: 135 additions & 61 deletions PetLeveler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ local Enum = _G.Enum
local CastSpellByID = awful.unlock("CastSpellByID")
--

local ExpertRiding = awful.NewSpell(34090)

local ui, settings, cmd = awful.UI:New("pets", {
show = false,
title = { "Pet Leveler" },
Expand All @@ -34,6 +36,11 @@ General:Text({ text = "How to use" })
General:Text({ text = "Have at least 2 Zandalari pets with level 25" })
General:Text({ text = "Go to Pandaria" })
General:Text({ text = "Go to 26, 44 (/way 26, 44)" })
-- General:Checkbox({
-- text = "",
-- var = "general_draw_player_circle",
-- tooltip = "Will draw the combat reach circle of the player"
-- })

local statusFrame = ui:StatusFrame({
colors = {
Expand Down Expand Up @@ -182,56 +189,108 @@ local function IsAllActionsDisabled()
end
end

local points = { { x = -9.064600944519043, y = 1775.9498291015625, z = 241.838623046875 },
{ x = 14.844382286071777, y = 1750.138916015625, z = 239.5835723876953 },
{ x = 31.6319522857666, y = 1722.4278564453125, z = 235.72335815429688 },
{ x = 37.309627532958984, y = 1697.52880859375, z = 235.55502319335938 },
{ x = 32.51483917236328, y = 1669.8353271484375, z = 235.4310302734375 },
{ x = 21.58924102783203, y = 1646.4429931640625, z = 235.5524444580078 },
{ x = 5.141036033630371, y = 1630.0035400390625, z = 235.71583557128906 },
{ x = -14.736727714538574, y = 1624.0140380859375, z = 235.96070861816406 },
{ x = -33.19443130493164, y = 1624.43798828125, z = 236.83615112304688 },
{ x = -51.64878463745117, y = 1620.0142822265625, z = 235.8026885986328 },
{ x = -69.21536254882813, y = 1612.4444580078125, z = 236.17063903808594 },
{ x = -83.26188659667969, y = 1607.7333984375, z = 235.90151977539063 },
{ x = -99.76460266113281, y = 1613.592041015625, z = 235.50950622558594 },
{ x = -116.88923645019531, y = 1614.15380859375, z = 235.56930541992188 },
{ x = -142.53524780273438, y = 1608.3370361328125, z = 235.90016174316406 },
{ x = -157.7343292236328, y = 1610.5953369140625, z = 236.98574829101563 },
{ x = -173.0363311767578, y = 1608.39599609375, z = 236.4962615966797 },
{ x = -186.53749084472656, y = 1609.385009765625, z = 236.49671936035156 },
{ x = -187.8578643798828, y = 1623.2618408203125, z = 236.49671936035156 },
{ x = -182.020263671875, y = 1637.521728515625, z = 237.25076293945313 },
{ x = -177.22793579101563, y = 1653.1051025390625, z = 243.66490173339844 },
{ x = -173.6791534423828, y = 1667.6181640625, z = 243.9967498779297 },
{ x = -168.58010864257813, y = 1678.7198486328125, z = 241.9978485107422 },
{ x = -146.25790405273438, y = 1680.9102783203125, z = 240.53463745117188 },
{ x = -143.01829528808594, y = 1702.6085205078125, z = 244.5131072998047 },
{ x = -135.18206787109375, y = 1723.5579833984375, z = 243.6057586669922 },
{ x = -122.34901428222656, y = 1743.697265625, z = 239.97637939453125 },
{ x = -102.9196548461914, y = 1759.7666015625, z = 242.19711303710938 },
{ x = -72.31763458251953, y = 1777.629150390625, z = 241.7701873779297 },
{ x = -44.56441879272461, y = 1780.0518798828125, z = 242.7589569091797 },
{ x = -15.549094200134277, y = 1774.9156494140625, z = 241.61068725585938 },
{ x = 8.439135551452637, y = 1760.690185546875, z = 239.4760284423828 },
{ x = 27.72260284423828, y = 1738.2987060546875, z = 237.8439483642578 },
{ x = 38.44088363647461, y = 1716.5491943359375, z = 235.7870330810547 },
{ x = 41.492000579833984, y = 1694.905029296875, z = 235.66941833496094 },
{ x = 39.577396392822266, y = 1678.6116943359375, z = 236.07533264160156 },
{ x = 34.9979248046875, y = 1657.685546875, z = 235.49148559570313 },
{ x = 25.84428596496582, y = 1641.7100830078125, z = 235.83956909179688 },
{ x = 12.68175983428955, y = 1629.005859375, z = 235.62081909179688 },
{ x = -2.136003017425537, y = 1624.3277587890625, z = 235.95445251464844 },
{ x = -21.14913558959961, y = 1623.1536865234375, z = 236.21707153320313 },
{ x = -40.42232131958008, y = 1622.59423828125, z = 236.1230926513672 },
{ x = -55.992156982421875, y = 1617.3988037109375, z = 236.11705017089844 },
{ x = -70.16481018066406, y = 1611.758544921875, z = 236.17062377929688 },
{ x = -82.27399444580078, y = 1609.6085205078125, z = 235.98171997070313 },
{ x = -97.78848266601563, y = 1614.0284423828125, z = 235.51133728027344 },
{ x = -110.78910064697266, y = 1621.232421875, z = 235.51133728027344 },
{ x = -122.18473815917969, y = 1632.6727294921875, z = 236.15232849121094 },
{ x = -133.36117553710938, y = 1646.2099609375, z = 235.63084411621094 }
}

if ExpertRiding.known then
points = {
{ x = -131.83180236816406, y = 1709.742919921875, z = 244.20372009277344 },
{ x = -105.58808898925781, y = 1730.44970703125, z = 243.38377380371094 },
{ x = -84.12421417236328, y = 1751.8062744140625, z = 242.63296508789063 },
{ x = -61.09368896484375, y = 1789.068603515625, z = 249.875244140625 },
{ x = -38.833614349365234, y = 1821.541259765625, z = 232.93324279785156 },
{ x = -18.85279083251953, y = 1845.2017822265625, z = 210.05130004882813 },
{ x = 14.687411308288574, y = 1849.7840576171875, z = 200.9446563720703 },
{ x = 44.32094192504883, y = 1869.5216064453125, z = 194.69338989257813 },
{ x = 71.85079956054688, y = 1891.697998046875, z = 187.00192260742188 },
{ x = 103.81781005859375, y = 1901.179443359375, z = 182.77947998046875 },
{ x = 144.64561462402344, y = 1916.552490234375, z = 179.31605529785156 },
{ x = 174.89675903320313, y = 1908.00048828125, z = 179.3667755126953 },
{ x = 182.14007568359375, y = 1901.8721923828125, z = 180.49862670898438 },
{ x = 204.79151916503906, y = 1874.003662109375, z = 190.1284942626953 },
{ x = 215.92247009277344, y = 1844.039306640625, z = 204.65841674804688 },
{ x = 209.7032012939453, y = 1811.9986572265625, z = 226.9759521484375 },
{ x = 191.923828125, y = 1779.0247802734375, z = 252.53919982910156 },
{ x = 169.21295166015625, y = 1739.51708984375, z = 283.1856384277344 },
{ x = 145.34228515625, y = 1718.0765380859375, z = 296.0733337402344 },
{ x = 113.3151626586914, y = 1693.1688232421875, z = 295.9013671875 },
{ x = 98.02359008789063, y = 1666.2523193359375, z = 309.29937744140625 },
{ x = 69.28254699707031, y = 1644.1048583984375, z = 307.0331115722656 },
{ x = 41.571319580078125, y = 1655.591064453125, z = 282.9177551269531 },
{ x = 20.771446228027344, y = 1652.60888671875, z = 259.2049865722656 },
{ x = -9.63976001739502, y = 1640.9931640625, z = 249.6459503173828 },
{ x = -44.9519157409668, y = 1633.427490234375, z = 244.21897888183594 },
{ x = -79.47981262207031, y = 1622.1195068359375, z = 240.6708984375 },
{ x = -112.89861297607422, y = 1627.370849609375, z = 240.15138244628906 },
{ x = -135.98072814941406, y = 1652.295166015625, z = 241.37893676757813 },
{ x = -145.1597442626953, y = 1684.672119140625, z = 245.57489013671875 },
{ x = -179.07127380371094, y = 1681.230712890625, z = 247.3962860107422 },
{ x = -209.78404235839844, y = 1665.573486328125, z = 241.38134765625 },
{ x = -254.4716796875, y = 1661.2730712890625, z = 228.6956024169922 },
{ x = -284.6179504394531, y = 1668.5107421875, z = 216.39256286621094 },
{ x = -313.7078857421875, y = 1683.2705078125, z = 201.94937133789063 },
{ x = -336.6141052246094, y = 1708.903076171875, z = 189.90333557128906 },
{ x = -345.056884765625, y = 1736.9754638671875, z = 180.0364227294922 },
{ x = -333.71685791015625, y = 1770.6763916015625, z = 171.20401000976563 },
{ x = -302.83441162109375, y = 1795.5184326171875, z = 167.4652099609375 },
{ x = -267.3081970214844, y = 1805.0294189453125, z = 171.35923767089844 },
{ x = -240.84024047851563, y = 1790.2418212890625, z = 185.58900451660156 },
{ x = -216.577880859375, y = 1770.0179443359375, z = 204.9113006591797 },
{ x = -189.99209594726563, y = 1758.7496337890625, z = 219.65126037597656 },
{ x = -159.24037170410156, y = 1759.740234375, z = 233.7253875732422 },
{ x = -132.66796875, y = 1746.8443603515625, z = 244.9572296142578 },
{ x = -126.61276245117188, y = 1720.268798828125, z = 246.43975830078125 }
}
end

local points = {
{ x = -131.83180236816406, y = 1709.742919921875, z = 244.20372009277344 },
{ x = -105.58808898925781, y = 1730.44970703125, z = 243.38377380371094 },
{ x = -84.12421417236328, y = 1751.8062744140625, z = 242.63296508789063 },
{ x = -61.09368896484375, y = 1789.068603515625, z = 249.875244140625 },
{ x = -38.833614349365234, y = 1821.541259765625, z = 232.93324279785156 },
{ x = -18.85279083251953, y = 1845.2017822265625, z = 210.05130004882813 },
{ x = 14.687411308288574, y = 1849.7840576171875, z = 200.9446563720703 },
{ x = 44.32094192504883, y = 1869.5216064453125, z = 194.69338989257813 },
{ x = 71.85079956054688, y = 1891.697998046875, z = 187.00192260742188 },
{ x = 103.81781005859375, y = 1901.179443359375, z = 182.77947998046875 },
{ x = 144.64561462402344, y = 1916.552490234375, z = 179.31605529785156 },
{ x = 174.89675903320313, y = 1908.00048828125, z = 179.3667755126953 },
{ x = 182.14007568359375, y = 1901.8721923828125, z = 180.49862670898438 },
{ x = 204.79151916503906, y = 1874.003662109375, z = 190.1284942626953 },
{ x = 215.92247009277344, y = 1844.039306640625, z = 204.65841674804688 },
{ x = 209.7032012939453, y = 1811.9986572265625, z = 226.9759521484375 },
{ x = 191.923828125, y = 1779.0247802734375, z = 252.53919982910156 },
{ x = 169.21295166015625, y = 1739.51708984375, z = 283.1856384277344 },
{ x = 145.34228515625, y = 1718.0765380859375, z = 296.0733337402344 },
{ x = 113.3151626586914, y = 1693.1688232421875, z = 295.9013671875 },
{ x = 98.02359008789063, y = 1666.2523193359375, z = 309.29937744140625 },
{ x = 69.28254699707031, y = 1644.1048583984375, z = 307.0331115722656 },
{ x = 41.571319580078125, y = 1655.591064453125, z = 282.9177551269531 },
{ x = 20.771446228027344, y = 1652.60888671875, z = 259.2049865722656 },
{ x = -9.63976001739502, y = 1640.9931640625, z = 249.6459503173828 },
{ x = -44.9519157409668, y = 1633.427490234375, z = 244.21897888183594 },
{ x = -79.47981262207031, y = 1622.1195068359375, z = 240.6708984375 },
{ x = -112.89861297607422, y = 1627.370849609375, z = 240.15138244628906 },
{ x = -135.98072814941406, y = 1652.295166015625, z = 241.37893676757813 },
{ x = -145.1597442626953, y = 1684.672119140625, z = 245.57489013671875 },
{ x = -179.07127380371094, y = 1681.230712890625, z = 247.3962860107422 },
{ x = -209.78404235839844, y = 1665.573486328125, z = 241.38134765625 },
{ x = -254.4716796875, y = 1661.2730712890625, z = 228.6956024169922 },
{ x = -284.6179504394531, y = 1668.5107421875, z = 216.39256286621094 },
{ x = -313.7078857421875, y = 1683.2705078125, z = 201.94937133789063 },
{ x = -336.6141052246094, y = 1708.903076171875, z = 189.90333557128906 },
{ x = -345.056884765625, y = 1736.9754638671875, z = 180.0364227294922 },
{ x = -333.71685791015625, y = 1770.6763916015625, z = 171.20401000976563 },
{ x = -302.83441162109375, y = 1795.5184326171875, z = 167.4652099609375 },
{ x = -267.3081970214844, y = 1805.0294189453125, z = 171.35923767089844 },
{ x = -240.84024047851563, y = 1790.2418212890625, z = 185.58900451660156 },
{ x = -216.577880859375, y = 1770.0179443359375, z = 204.9113006591797 },
{ x = -189.99209594726563, y = 1758.7496337890625, z = 219.65126037597656 },
{ x = -159.24037170410156, y = 1759.740234375, z = 233.7253875732422 },
{ x = -132.66796875, y = 1746.8443603515625, z = 244.9572296142578 },
{ x = -126.61276245117188, y = 1720.268798828125, z = 246.43975830078125 }
}

awful.immerseOL(points)

Expand Down Expand Up @@ -263,12 +322,19 @@ local function NavigateRoute()
end
end
end
-- local safePosition = { x = -52.60315704345703, y = 1693.9749755859375, z = 235.41983032226563 }
-- awful.Draw(function(draw)
-- if not ExpertRiding.known then
-- local x1, y1, z1 = player.position()
-- draw:Line(x1, y1, z1, safePosition.x, safePosition.y, safePosition.z)
-- draw:Circle(safePosition.x, safePosition.y, safePosition.z, 100)
-- end
-- end)

awful.onTick(function()
if not pets.settings.enabled then
return
end

NavigateRoute()
end)

Expand All @@ -282,11 +348,17 @@ local function NavigateToNextBattle()

-- if nextPetBattle == nil then
local critters = awful.critters.filter(function(critter)
local count, total, units = awful.units.around(critter, 25, function(unit)
local count, _, _ = awful.units.around(critter, 25, function(unit)
return (not unit.friend) and (not unit.dead) and (unit.reaction == 2)
end)
return count == 0 and not critter.dead and awful.call('UnitIsBattlePet', critter.unit) and
not awful.call('UnitIsBattlePetCompanion', critter.unit)
-- if ExpertRiding.known then
return count == 0 and not critter.dead and awful.call('UnitIsBattlePet', critter.unit) and
not awful.call('UnitIsBattlePetCompanion', critter.unit)
-- else
-- return count == 0 and not critter.dead and awful.call('UnitIsBattlePet', critter.unit) and
-- not awful.call('UnitIsBattlePetCompanion', critter.unit) and
-- critter.distanceTo(safePosition.x, safePosition.y, safePosition.z) <= 100
-- end
end)
if #critters == 0 then
awful.alert("No battle pets found")
Expand Down Expand Up @@ -369,10 +441,10 @@ awful.addUpdateCallback(function()
if distanceToGround >= 20 then
-- awful.alert("Too high")
AscendStop()
elseif nextPetBattle == nil and not player.flying and player.mounted then
elseif nextPetBattle == nil and not player.flying and player.mounted and ExpertRiding.known then
awful.alert("Flying up")
JumpOrAscendStart()
elseif nextPetBattle and player.mounted and distanceToGround < 15 and distanceToBattle > 10 then
elseif nextPetBattle and player.mounted and distanceToGround < 15 and distanceToBattle > 10 and ExpertRiding.known then
awful.alert("Flying up to pet")
JumpOrAscendStart()
end
Expand Down Expand Up @@ -480,18 +552,20 @@ f:SetScript("OnEvent", OnEvent)
C_Timer.After(3, function()
awful.print("PetLeveler loaded")
awful.print("/pets to open menu")
if ExpertRiding.known then
awful.print("We can fly")
else
awful.print("We can't fly")
end
end)



-- local newPoints = {}
-- cmd:New(function(msg)
-- if string.lower(msg) == "add" then
-- local x, y, z = awful.player.position()
-- table.insert(points, { x = x, y = y, z = z })
-- Unlocker.Util.File:Write("scripts/awful/routines/PetLeveler/paths.json", Unlocker.Util.JSON:Encode(points), false)
-- elseif string.lower(msg) == "follow" then
-- off = false
-- elseif string.lower(msg) == "stop" then
-- off = true
-- -- local obj = { x, y, z }
-- table.insert(newPoints, { x = x, y = y, z = z })
-- Unlocker.Util.File:Write("scripts/awful/routines/PetLeveler/paths.json", Unlocker.Util.JSON:Encode(newPoints), false)
-- end
-- end)

0 comments on commit 01addd0

Please sign in to comment.