mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-19 06:03:27 +02:00
Fixes for bot and websocket based entergame
This commit is contained in:
@@ -310,6 +310,7 @@ function EnterGame.checkWebsocket()
|
||||
if webSocket then
|
||||
webSocket:close()
|
||||
webSocket = nil
|
||||
newLogin.code:setText("")
|
||||
end
|
||||
return
|
||||
end
|
||||
@@ -328,13 +329,14 @@ function EnterGame.checkWebsocket()
|
||||
webSocket = HTTP.WebSocketJSON(url, {
|
||||
onOpen = function(message, webSocketId)
|
||||
if webSocket and webSocket.id == webSocketId then
|
||||
webSocket.send({type="init", uid=G.uuid, version=APP_VERSION})
|
||||
webSocket.send({type="init", uid=G.UUID, version=APP_VERSION})
|
||||
end
|
||||
end,
|
||||
onMessage = function(message, webSocketId)
|
||||
if webSocket and webSocket.id == webSocketId then
|
||||
if message.type == "login" then
|
||||
webSocketLoginPacket = nil
|
||||
EnterGame.hide()
|
||||
onHTTPResult(message, nil)
|
||||
elseif message.type == "quick_login" and message.code and message.qrcode then
|
||||
EnterGame.showNewLogin(message.code, message.qrcode)
|
||||
|
@@ -130,7 +130,12 @@ context.useRune = function(itemid, target, lastSpellTimeout)
|
||||
end
|
||||
context.userune = context.useRune
|
||||
|
||||
context.findItem = g_game.findItemInContainers
|
||||
context.findItem = function(itemId, subType)
|
||||
if subType == nil then
|
||||
subType = -1
|
||||
end
|
||||
return g_game.findItemInContainers(itemId, subType)
|
||||
end
|
||||
|
||||
context.attack = g_game.attack
|
||||
context.cancelAttack = g_game.cancelAttack
|
||||
|
@@ -28,6 +28,15 @@ context.getFinger = function() return context.getInventoryItem(context.SlotFinge
|
||||
context.getAmmo = function() return context.getInventoryItem(context.SlotAmmo) end
|
||||
context.getPurse = function() return context.getInventoryItem(context.SlotPurse) end
|
||||
|
||||
|
||||
context.getContainers = function() return g_game.getContainers() end
|
||||
context.getContainer = function(index) return g_game.getContainer(index) end
|
||||
|
||||
context.moveToSlot = function(item, slot, count)
|
||||
if not item then
|
||||
return
|
||||
end
|
||||
if count == nil then
|
||||
count = item:getCount()
|
||||
end
|
||||
return g_game.move(item, {x=65535, y=slot, z=0}, count)
|
||||
end
|
@@ -276,9 +276,9 @@ Panels.Equip = function(parent)
|
||||
if slotItem and (slotItem:getId() == item1 or slotItem:getId() == item2) then
|
||||
return
|
||||
end
|
||||
local newItem = context.findItem(context.storage[panelName].item1, 0)
|
||||
local newItem = context.findItem(context.storage[panelName].item1)
|
||||
if not newItem then
|
||||
newItem = context.findItem(context.storage[panelName].item2, 0)
|
||||
newItem = context.findItem(context.storage[panelName].item2)
|
||||
if not newItem then
|
||||
return
|
||||
end
|
||||
|
Reference in New Issue
Block a user