这是我的世界lua脚本源码,作用是改保湿度。
如下。
function S_Pointer(t_So, t_Offset, _bit)
local function getRanges()
local ranges = {}
local t = gg.getRangesList('^/data/*.so*$')
for i, v in pairs(t) do
if v.type:sub(2, 2) == 'w' then
table.insert(ranges, v)
end
end
return ranges
end
local function Get_Address(N_So, Offset, ti_bit)
local ti = gg.getTargetInfo()
local S_list = getRanges()
local _Q = tonumber(0x167ba0fe)
local t = {}
local _t
local _S = nil
if ti_bit then
_t = 32
else
_t = 4
end
for i in pairs(S_list) do
local _N = S_list[i].internalName:gsub('^.*/', '')
if N_So[1] == _N and N_So[2] == S_list[i].state then
_S = S_list[i]
break
end
end
if _S then
t[#t + 1] = {}
t[#t].address = _S.start + Offset[1]
t[#t].flags = _t
if #Offset ~= 1 then
for i = 2, #Offset do
local S = gg.getValues(t)
t = {}
for _ in pairs(S) do
if not ti.x64 then
S[_].value = S[_].value & 0xFFFFFFFF
end
t[#t + 1] = {}
t[#t].address = S[_].value + Offset[i]
t[#t].flags = _t
end
end
end
_S = t[#t].address
end
return _S
end
local _A = string.format('0x%X', Get_Address(t_So, t_Offset, _bit))
return _A
end
function split(szFullString, szSeparator)
local nFindStartIndex = 1
local nSplitIndex = 1
local nSplitArray = {}
while true do
local nFindLastIndex = string.find
(szFullString, szSeparator, nFindStartIndex)
if not nFindLastIndex then
nSplitArray[nSplitIndex] =
string.sub(szFullString, nFindStartIndex, string.len
(szFullString))
break end
nSplitArray[nSplitIndex] = string.sub
(szFullString, nFindStartIndex, nFindLastIndex - 1)
nFindStartIndex = nFindLastIndex + string.len
(szSeparator)
nSplitIndex = nSplitIndex + 1 end return
nSplitArray end
function xgxc(szpy, qmxg)
for x = 1, #(qmxg) do
xgpy = szpy + qmxg[x]["offset"]
xglx = qmxg[x]["type"]
xgsz = qmxg[x]["value"]
xgdj = qmxg[x]["freeze"]
if xgdj == nil or xgdj == "" then
gg.setValues({[1]
= {address = xgpy, flags = xglx, value = xgsz}})
else
gg.addListItems({[1]
= {address = xgpy, flags = xglx,
freeze = xgdj, value = xgsz}}) end
xgsl = xgsl + 1 xgjg = true end end
function xqmnb(qmnb)
gg.clearResults()
gg.setRanges(qmnb[1]["memory"])
gg.toast("开始搜索💫") gg.setVisible(false)
gg.searchNumber(qmnb[3]["value"], qmnb[3]["type"]) gg.setVisible(false)
if gg.getResultCount() == 0 then gg.setVisible(false)
gg.toast(qmnb[2]["name"] .. "修改失败") gg.setVisible(false)
else
gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) gg.setVisible(false)
gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) gg.setVisible(false)
gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) gg.setVisible(false)
gg.setVisible(false) if gg.getResultCount() == 0 then
gg.setVisible(false) gg.toast(qmnb[2]["name"] .. "修改失败") gg.setVisible(false)
gg.setVisible(false) else
gg.setVisible(false) sl = gg.getResults(999999)
gg.setVisible(false) sz = gg.getResultCount()
gg.setVisible(false) xgsl = 0 if sz > 999999 then
gg.setVisible(false) sz = 999999 end for i = 1, sz do
pdsz = true for v = 4, #(qmnb) do if
pdsz == true then gg.setVisible(false)
pysz = {} pysz[1]
= {} pysz[1].address
= sl[i].address + qmnb[v]["offset"] pysz[1].flags
= qmnb[v]["type"]
szpy = gg.getValues(pysz)
pdpd = qmnb[v]["lv"] .. ";" .. szpy[1].value szpd
= split(pdpd, ";") tzszpd
= szpd[1] pyszpd = szpd[2]
if tzszpd == pyszpd then
pdjg = true pdsz = true else
pdjg = false pdsz = false end end end if
pdjg == true then szpy
= sl[i].address xgxc(szpy, qmxg) end end
gg.setVisible(false) if xgjg == true then
gg.setVisible(false) gg.toast(qmnb[2]["name"] .. "已修改😁")
else
gg.setVisible(false) gg.toast(qmnb[2]["name"] .. "修改失败😭")
end end end end
function editData(qmnb,qmxg)gg.setVisible(false)gg.clearResults()qmnbv=qmnb[3]["value"]or qmnb[3][1]qmnbt=qmnb[3]["type"]or qmnb[3][2]qmnbn=qmnb[2]["name"]or qmnb[2][1]gg.setRanges(qmnb[1]["memory"]or qmnb[1][1])gg.searchNumber(qmnbv,qmnbt)gg.refineNumber(qmnbv,qmnbt)sz=gg.getResultCount()if sz==0 then gg.toast(qmnbn.."开启失败")else sl=gg.getResults(999999)for i=1,sz do pdsz=true for v=4,#qmnb do if pdsz==true then pysz={{}}pysz[1].address=sl[i].address+(qmnb[v]["offset"]or qmnb[v][2])pysz[1].flags=qmnb[v]["type"]or qmnb[v][3]szpy=gg.getValues(pysz)tzszpd=tostring(qmnb[v]["lv"]or qmnb[v][1]):gsub(",","")pyszpd=tostring(szpy[1].value):gsub(",","")if tzszpd==pyszpd then pdjg=true pdsz=true else pdjg=false pdsz=false end end end if pdjg==true then szpy=sl[i].address for x=1,#qmxg do xgsz=qmxg[x]["value"]or qmxg[x][1]xgpy=szpy+(qmxg[x]["offset"]or qmxg[x][2])xglx=qmxg[x]["type"]or qmxg[x][3]xgdj=qmxg[x]["freeze"]or qmxg[x][4]xg={{address=xgpy,flags=xglx,value=xgsz}}if xgdj==true then xg[1].freeze=xgdj gg.addListItems(xg)else gg.setValues(xg)end end xgjg=true end end if xgjg==true then gg.toast(qmnbn.."开启成功😁")else gg.toast(qmnbn.."开启失败😭")end end end
D=gg.TYPE_DWORD E=gg.TYPE_DOUBLE F=gg.TYPE_FLOAT W=gg.TYPE_WORD B=gg.TYPE_BYTE X=gg.TYPE_XOR Q=gg.TYPE_QWORD
DWORD=gg.TYPE_DWORD DOUBLE=gg.TYPE_DOUBLE FLOAT=gg.TYPE_FLOAT WORD=gg.TYPE_WORD BYTE=gg.TYPE_BYTE XOR=gg.TYPE_XOR QWORD=gg.TYPE_QWORDfunction mwh(mwh1,mwh2,py) local mwh={} mwh[1]={} mwh[1].address=mwh1 mwh[1].flags=mwh2 mwh[1].value=py gg.setValues(mwh) end
function Main0()
SN = gg.choice({
"一级菜单",
}, nil, "我是一个默默无闻的公告")
if SN==1 then
Main1()
end
FX=0
endfunction Main1()
SN = gg.choice({
"测试",
}, nil, "这是一个公告")
if SN==1 then
HS2()
end
FX=0
endfunction HS2()
gg.alert("一个鸡腿是2,保证有10颗鸡腿不然没效果")
local a1= gg.prompt({'输入你要改成的饱食度'}, {[1] = 0}, {[1] = 'text'})
if a1==nil then
print("您选择了取消") main()
else
if a1=="" then
print("您还未输入") main()
end
gg.clearResults()
gg.setRanges(4)
gg.searchNumber("1.6815581571897805E-44;1065353216D;9.80908925027372E-45;1101004800D;1101004800D;20;20", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1)
gg.searchNumber("20", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1)
gg.getResults(1000)
gg.editAll(a1[1],gg.TYPE_FLOAT)
gg.toast("开启成功")
gg.clearResults()
end
endMain0()