From e9d03356b5720fa34d606659753ea1df288a0fe2 Mon Sep 17 00:00:00 2001 From: LA-DI-DA <11174151+0O0o0oOoO00@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:50:10 +0800 Subject: [PATCH] Upd: lua scripts --- bin/Lua/ShipChanger.lua | 29 ++++++++++++++++++----------- bin/Lua/ShipFucker.lua | 30 ++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/bin/Lua/ShipChanger.lua b/bin/Lua/ShipChanger.lua index bcde29f6f..15bc39e2c 100644 --- a/bin/Lua/ShipChanger.lua +++ b/bin/Lua/ShipChanger.lua @@ -5,25 +5,32 @@ function string.split(s, p) end function ChangeShip() - local Result = gg.prompt({"舰船Id", "当前舰种Id", "目标舰种Id"} + local Result = gg.prompt({"舰船Id", "舰船星级", "当前舰种Id", "目标舰种Id"} ,{} - ,{"number", "number", "number"}) + ,{"number", "number", "number", "number"}) local ShipIdList = string.split(tostring(Result[1]), ";") - local ShipTypeIdList = string.split(tostring(Result[2]), ";") - local TargetShipTypeIdList = string.split(tostring(Result[3]), ";") + local ShipStarList = string.split(tostring(Result[2]), ";") + local ShipTypeIdList = string.split(tostring(Result[3]), ";") + local TargetShipTypeIdList = string.split(tostring(Result[4]), ";") - if #ShipIdList ~= #ShipTypeIdList or #ShipIdList ~= #TargetShipTypeIdList then + if #ShipIdList ~= #ShipTypeIdList or #ShipIdList ~= #TargetShipTypeIdList or #ShipIdList ~= #ShipStarList then Exit("参数数量不匹配!") end for i = 1, #ShipIdList do - -- | here is the shar of ship - -- v - gg.searchNumber(ShipIdList[i]..";1;"..ShipTypeIdList[i].."::610", gg.TYPE_DOUBLE) - gg.refineNumber(ShipTypeIdList[i], gg.TYPE_AUTO) - gg.getResults(1024) - gg.editAll(TargetShipTypeIdList[i], gg.TYPE_DOUBLE) + gg.searchNumber(ShipIdList[i]..";"..ShipStarList[i]..";"..ShipTypeIdList[i].."::610", gg.TYPE_DOUBLE) + gg.refineNumber(ShipTypeIdList[i], gg.TYPE_DOUBLE) + local SearchResult = gg.getResults(1024) + if next(SearchResult) == nil then + gg.clearResults() + gg.searchNumber(ShipIdList[i]..";"..ShipStarList[i]..";"..ShipTypeIdList[i].."::610", gg.TYPE_DWORD) + gg.refineNumber(ShipTypeIdList[i], gg.TYPE_DWORD) + gg.getResults(1024) + gg.editAll(TargetShipTypeIdList[i], gg.TYPE_DWORD) + else + gg.editAll(TargetShipTypeIdList[i], gg.TYPE_DOUBLE) + end gg.clearResults() end Exit("修改成功!") diff --git a/bin/Lua/ShipFucker.lua b/bin/Lua/ShipFucker.lua index 83431c18f..90c0d1485 100644 --- a/bin/Lua/ShipFucker.lua +++ b/bin/Lua/ShipFucker.lua @@ -7,7 +7,7 @@ end -- {Id};{Star};{Type}:{Attribute}>{Target}[;{Attribute}>{Target}...][|{Id};{Star};{Type}:{Attribute}>{Target}[;{Attribute}>{Target}...]] function ChangeShipAttribute() local Result = gg.prompt({"格式:{舰船Id};{舰船星级};{类型Id}:{属性}>{目标值}[;{属性}>{目标值}...],多个之间用'|'连接"} - ,{} + ,{} ,{"text"}) local TargetList = string.split(tostring(Result[1]), "|") @@ -24,12 +24,19 @@ function ChangeShipAttribute() --]] gg.searchNumber(ShipData.."::610", gg.TYPE_DOUBLE) - gg.refineNumber(string.split(ShipData, ";")[1], gg.TYPE_AUTO) + gg.refineNumber(string.split(ShipData, ";")[1], gg.TYPE_DOUBLE) local SearchResult = gg.getResults(1024) + + if next(SearchResult) == nil then + gg.searchNumber(ShipData.."::610", gg.TYPE_DWORD) + gg.refineNumber(string.split(ShipData, ";")[1], gg.TYPE_DWORD) + SearchResult = gg.getResults(1024) + end + for j = 1, #SearchResult do - local MemoryFrom = SearchResult[j].address - 0x1000 - local MemoryTo = SearchResult[j].address + 0x1000 + local MemoryFrom = SearchResult[j].address - 0x800 + local MemoryTo = SearchResult[j].address - 0x650 for k = 1, #ShipAttributeList do -- fuck gg -- fuck lua @@ -38,16 +45,23 @@ function ChangeShipAttribute() local SplitedAttribute = string.split(tostring(ShipAttributeList[k]), ">") local AttributeToSearchList = SplitedAttribute[1] local TargetAttributeList = SplitedAttribute[2] + gg.clearResults() gg.searchNumber(AttributeToSearchList, gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, MemoryFrom, MemoryTo) - gg.getResults(1024) - gg.editAll(TargetAttributeList, gg.TYPE_DOUBLE) + local AttributeResult = gg.getResults(1024) + if next(AttributeResult) == nil then + gg.clearResults() + gg.searchNumber(AttributeToSearchList, gg.TYPE_DWORD, false, gg.SIGN_EQUAL, MemoryFrom, MemoryTo) + gg.getResults(1024) + gg.editAll(TargetAttributeList, gg.TYPE_DWORD) + else + gg.editAll(TargetAttributeList, gg.TYPE_DOUBLE) + end gg.clearResults() end - end end Exit("修改成功!") -end +end function Exit(Message) gg.alert(Message)