elseif mode == "follow" then
globalMovementMode = "follow"
globalFollowTargetName = targetName
globalDestX, globalDestY, globalDestZ = targetX, targetY, targetZ
end
end
function stopMovement()
globalMovementMode = nil
globalFollowTargetName = nil
end
if not globalMovementThread then
globalMovementThread = createThread(function()
local lastSim = 0
while true do
if globalMovementMode then
local now = getTickCount()
if now - lastSim >= 100 then simulateForeground() lastSim = now end
if _G.globalPlayerListPowerEdit then local np = tonumber(_G.globalPlayerListPowerEdit.Text) if np then defaultStepSize = np end end
if _G.globalPlayerListDelayEdit then local nd = tonumber(_G.globalPlayerListDelayEdit.Text) if nd then defaultStepDelay = nd end end
local x, y, z = getPlayerCoordinates()
if not x or not (globalDestX and globalDestY and globalDestZ) then stopMovement() Sleep(defaultStepDelay)
else
if globalMovementMode == "follow" and globalFollowTargetName then updateFollowTargetCoordinates() end
local dx = globalDestX - x; local dy = globalDestY - y; local dz = globalDestZ - z
local dist = math.sqrt(dx * dx + dy * dy + dz * dz)
local factor = dist > 2 * defaultStepSize and defaultStepSize / dist or 0.5
if dist > defaultStepSize then
local newX = x + (globalDestX - x) * factor
local newY = y + (globalDestY - y) * factor
local newZ = z + (globalDestZ - z) * factor
setPlayerCoordinates(newX, newY, newZ)
else
setPlayerCoordinates(globalDestX, globalDestY, globalDestZ)
if globalMovementMode == "teleport" then stopMovement() end
end
Sleep(defaultStepDelay)
end
else Sleep(50) end
end
end)
end
function openPlayerListInterface()
controls = {}
lastWorldBasePtr = nil
local pform = createForm()
pform.Caption = "Player List"
pform.Width = 425
pform.Height = 500
pform.FormStyle = 'fsSystemStayOnTop'
pform.ShowInTaskBar = 'stAlways'
pform.BorderStyle = 'bsSizeable'
pform.AlphaBlend = true
pform.AlphaBlendValue = 230
pform.Left = main.Left - 193
pform.Top = main.Top + main.Height
local playerCountLabel = createLabel(pform)
playerCountLabel.Caption = "Player Count: "
playerCountLabel.Left = 10
playerCountLabel.Top = 0
playerCountLabel.Fon*****lor = 0x00FF00
local labelPower = createLabel(pform)
labelPower.Caption = "Power"
labelPower.Left = 110
labelPower.Top = 3
labelPower.Fon*****lor = 0x00FF00
local editPower = createEdit(pform)
editPower.Left = 145
editPower.Top = 0
editPower.Width = 40
editPower.Text = tostring(defaultStepSize)
_G.globalPlayerListPowerEdit = editPower
local labelDelay = createLabel(pform)
labelDelay.Caption = "MS"
labelDelay.Left = 195
labelDelay.Top = 3
labelDelay.Fon*****lor = 0x00FF00
local editDelay = createEdit(pform)
editDelay.Left = 215
editDelay.Top = 0
editDelay.Width = 50
editDelay.Text = tostring(defaultStepDelay)
_G.globalPlayerListDelayEdit = editDelay
local stopGlobalBtn = createButton(pform)
stopGlobalBtn.Caption = "Stop"
stopGlobalBtn.Width = 150
stopGlobalBtn.Height = 25
stopGlobalBtn.Left = playerCountLabel.Left + 265
stopGlobalBtn.Top = 0
stopGlobalBtn.Fon*****lor = 0xFF0000
stopGlobalBtn.Font.Style = "fsBold"
stopGlobalBtn.OnClick = function() stopMovement() end
local function updatePlayerList(pform, playerCountLabel)
if not pform.Visible then return end
local newWorldPointerAddr = readInteger(worldScanAddr + 1)
if not newWorldPointerAddr then
playerCountLabel.Caption = "Player Count: 0"
controls = {}
lastWorldBasePtr = nil
return
end
local newWorldOffset = newWorldPointerAddr - Base
local localWorldBasePtr = string.format("Trove.exe+%X", newWorldOffset)
if not getAddressSafe(localWorldBasePtr) then
playerCountLabel.Caption = "Player Count: 0"
controls = {}
lastWorldBasePtr = nil
return
end
if lastWorldBasePtr and lastWorldBasePtr ~= localWorldBasePtr then controls = {} end
lastWorldBasePtr = localWorldBasePtr
local plrCountAddrLocal = string.format("[[%s]+FC]+2C", localWorldBasePtr)
local totalPlayerCount = readInteger(plrCountAddrLocal) or 0
for i = 0, totalPlayerCount - 1 do
local name, x, y, z = getPlayerInfo(i, localWorldBasePtr)
if name and globalFollowTargetName and string.lower(name) == string.lower(globalFollowTargetName) then
globalDestX, globalDestY, globalDestZ = x, y, z
break
end
end
local playersInfo = {}
local refName, refX, refY, refZ = getPlayerInfo(0, localWorldBasePtr)
for i = 0, totalPlayerCount - 1 do
local name, x, y, z = getPlayerInfo(i, localWorldBasePtr)
if name ~= refName then
local dx = x - refX
local dy = y - refY
local dz = z - refZ
local dist = math.sqrt(dx * dx + dy * dy + dz * dz)
table.insert(playersInfo, {name = name, x = x, y = y, z = z, distance = dist})
end
end
table.sort(playersInfo, function(a, b) return a.distance < b.distance end)
local displayCount =
#playersInfo
playerCountLabel.Caption = "Player Count: " .. displayCount
while
#controls < displayCount * 4 do
table.insert(controls, createLabel(pform))
table.insert(controls, createLabel(pform))
table.insert(controls, createButton(pform))
table.insert(controls, createButton(pform))
end
for i = 1, displayCount do
local info = playersInfo[i]
local yPos = 30 + (i - 1) * 30
local idx = (i - 1) * 4
local nameCtrl = controls[idx + 1]
if nameCtrl and nameCtrl.Font then
nameCtrl.Caption = info.name
nameCtrl.Fon*****lor = 0x00FF00
nameCtrl.Left = 10
nameCtrl.Top = yPos
nameCtrl.Visible = true
end
local coordCtrl = controls[idx + 2]
if coordCtrl and coordCtrl.Font then
coordCtrl.Caption = string.format("X:%d Y:%d Z:%d", math.floor(info.x), math.floor(info.y), math.floor(info.z))
coordCtrl.Left = 140
coordCtrl.Top = yPos
coordCtrl.Fon*****lor = 0x00FF00
coordCtrl.Visible = true
end
local teleportBtn = controls[idx + 3]
if teleportBtn then
teleportBtn.Caption = "Teleport"
teleportBtn.Left = 275
teleportBtn.Top = yPos - 5
teleportBtn.Visible = true
teleportBtn.OnClick = function() stopMovement(); startMovement("teleport", nil, info.x, info.y, info.z) end
end
local followBtn = controls[idx + 4]
if followBtn then
followBtn.Caption = "Follow"
followBtn.Left = 350
followBtn.Top = yPos - 5
followBtn.Visible = true
followBtn.OnClick = function() stopMovement(); startMovement("follow", info.name, info.x, info.y, info.z) end
end
end
for i = (displayCount * 4) + 1,
#controls do
if controls[i] then controls[i].Visible = false end
end
end
local updateTimer = createTimer(pform, true)
updateTimer.Interval = 100
updateTimer.OnTimer = function() updatePlayerList(pform, playerCountLabel) end
pform.OnClose = function(form) updateTimer.destroy(); stopMovement(); _G.globalPlayerListPowerEdit = nil; _G.globalPlayerListDelayEdit = nil; return caFree end
pform.Show()
end
local playerListBtn = createButton(main)
playerListBtn.Caption = "Player"
playerListBtn.Width = 42
playerListBtn.Height = 20
playerListBtn.Left = 197
playerListBtn.Top = 120
playerListBtn.OnClick = function() openPlayerListInterface() end
function applyMovementBuffers()
if skipBuffer then
writeFloat(base + 0x80, skipBuffer.x)
writeFloat(base + 0x84, skipBuffer.y)
writeFloat(base + 0x88, skipBuffer.z)
skipBuffer = nil
end
if flyBuffer then
writeFloat(base + 0xB0, flyBuffer.vx)
writeFloat(base + 0xB4, flyBuffer.vy)
writeFloat(base + 0xB8, flyBuffer.vz)
flyBuffer = nil
end
end
_G.applyMovementBuffers = applyMovementBuffers
local function handleHotkeys()
local now = getTickCount()
local speedKey = getVKCode(speedRow.key.Text:upper())
if isKeyPressed(speedKey) and now - (speedRow.lastTick or 0) > tonumber(speedRow.timer.Text or "100") then
speedRow.enabled.Checked = not speedRow.enabled.Checked
speedRow.lastTick = now
applySpeedXOR()
speedRow.state.Caption = speedRow.enabled.Checked and "On" or "Off"
speedRow.state.Fon*****lor = speedRow.enabled.Checked and 0x00FF00 or 0x0000EE
if not speedRow.enabled.Checked then
local bp = getAddressSafe(fixedBase)
local spd = resolvePointer(bp, SpeedOffsets)
if spd and defaultSpeedEncoded then local enc = xor(floatToInt(80), globalSpeedKey); writeInteger(spd, enc) end
end
end
for _, row in ipairs(rows) do
local key = getVKCode(row.key.Text:upper())
local delay = tonumber(row.timer.Text) or 100
row.lastTick = row.lastTick or 0
if row.enabled.Checked then
row.enabled.Fon*****lor = 0x00FF00
if isKeyPressed(key) and (now - row.lastTick >= delay) then row.callback(row); row.lastTick = now end
else
row.enabled.Fon*****lor = 0xAAAAAA
end
end
end
initDefaultSpeed()
local mainTimer = createTimer(nil)
mainTimer.Interval = 30
mainTimer.OnTimer = function()
if not ensureProcessAttached() then return end
base = getAddressSafe(skipChainString)
dir_base = getAddressSafe(flyChainString)
if not base or not dir_base then return end
simulateForeground()
handleHotkeys()
applyMovementBuffers()
end
local speedTimer = createTimer(nil)
speedTimer.Interval = 20
speedTimer.OnTimer = applySpeedXOR
main.OnClose = function()
mainTimer.destroy()
speedTimer.destroy()
superCheckTimer.destroy()
closeCE()
return caFree
end
[/CODE][/QUOTE]