Project Sylvanas docs axiombot.net Discord

Sell at a vendor and come back

Keeps to roads and away from red mobs, and never walks to a spot it cannot reach: it asks check_spots first.

local VENDOR = { x = 10131.6, y = 2529.2, z = 1324.3 }
local OPTS = { roads = true, avoid_mobs = true }

local function go_and_back(home, on_done)
    local client = _G.AXIOM_NAV and _G.AXIOM_NAV.client
    if not client then return on_done(false, "no AXIOM_NAV") end

    client:check_spots({ VENDOR }, function(ok, spots)
        if not ok or not spots[1].reachable then
            core.log_warning("vendor cannot be reached on foot")
            return on_done(false, "unreachable")
        end
        core.log(("vendor: a %.0f yd walk"):format(spots[1].walk))

        client:move_to(VENDOR, function(arrived, why)
            if not arrived then return on_done(false, why) end

            -- ... sell here (your plugin's job) ...

            client:move_to(home, on_done, OPTS)
        end, OPTS)
    end)
end

local me = core.object_manager.get_local_player()
go_and_back(me:get_position(), function(ok, why)
    core.log("vendor run: " .. (ok and "done" or tostring(why)))
end)

Leaving the road near the end

Roads can make the last stretch long. Switch them off for the same place, and the walk changes over without stopping:

client:move_to(VENDOR, on_done, { roads = true })
-- later, about 60 yd from the vendor:
client:move_to(VENDOR, on_done, { roads = false })