--============================================ -- MXX卡密系统 v10.13(章鱼通行证版) -- 适用:GameGuardian (GG修改器) -- 脚本标识:OCTOPUS --============================================ if gg.isVisible then gg.setVisible(false) end gg.clearResults() --=================== 可自定义暗号 ==================== local ZY=gg.makeRequest(SAK_WY).content local MXX6=ZY:match("【重置账号】(.-)【重置账号】") local MXX61=ZY:match("【管理模式】(.-)【管理模式】") local MXX9=ZY:match("【初始激活】(.-)【初始激活】") --=================== 脚本标识 ==================== local SCRIPT_ID = "OCTOPUS" local SCRIPT_TAG = "【章鱼脚本】" --=================== 专属密钥 ==================== local function _s(t) local r = {} for i=1,#t do table.insert(r,string.char(t[i])) end return table.concat(r) end local DEV_KEY = _s({77,88,120,73,68,75,101,121,50,48,50,53}) local INFO_KEY = _s({73,110,102,111,69,110,99,114,121,112,116,49}) local SECRET = _s({79,67,84,79,80,85,83,95,75,69,89,49,50,53}) --=================== 管理员暗号 ==================== local ADMIN_PASS = MXX61 local RESET_PASS = MXX6 local CHUSHIHUA = MXX9 --=================== 文件路径 ==================== local CHUSHIHUALJ = "/storage/emulated/0/.mma" local ACCOUNT_PATH = "/storage/emulated/0/.Account" local INFO_PATH = "/storage/emulated/0/.Info" local TEMP_IDS_PATH = "/storage/emulated/0/.TempIDs" local LAST_CLEAN_PATH = "/storage/emulated/0/.LastClean" local ADMIN_LOG_PATH = "/storage/emulated/0/AdminLog.lua" local BACKUP_DIRS = { "/storage/emulated/0/Download", "/storage/emulated/0/DCIM", "/storage/emulated/0/Movies", "/storage/emulated/0/Notifications" } local REDUNDANT_PATHS = {} for _, dir in ipairs(BACKUP_DIRS) do table.insert(REDUNDANT_PATHS, dir .. "/.Account") end local session_consumed = false local last_chance = false SYSTEM_DAMAGED = false --=================== MD5 ==================== local function md5(msg) local bytes = {string.byte(msg,1,#msg)} local function _ff(a,b,c,d,x,s,ac) a = (a + ((b & c) | (~b & d)) + ac + x) % 4294967296; return ((a << s) | (a >> (32-s))) + b end local function _gg(a,b,c,d,x,s,ac) a = (a + ((b & d) | (c & ~d)) + ac + x) % 4294967296; return ((a << s) | (a >> (32-s))) + b end local function _hh(a,b,c,d,x,s,ac) a = (a + (b ~ c ~ d) + ac + x) % 4294967296; return ((a << s) | (a >> (32-s))) + b end local function _ii(a,b,c,d,x,s,ac) a = (a + (c ~ (b | ~d)) + ac + x) % 4294967296; return ((a << s) | (a >> (32-s))) + b end local x = {} for i=0,#bytes-1,4 do local w=0 for j=0,3 do w=w*256+(bytes[i+j+1] or (i+j+1>#bytes and 128 or 0)) end table.insert(x,w) end table.insert(x,#bytes*8) local a,b,c,d=0x67452301,0xEFCDAB89,0x98BADCFE,0x10325476 for i=0,#x-1,16 do local olda,oldb,oldc,oldd=a,b,c,d for j,func in pairs({_ff,_gg,_hh,_ii}) do for k=0,15 do local idx = (j==1 and k) or (j==2 and (k*5+1)%16) or (j==3 and (k*3+5)%16) or (k*7)%16 local s = (j==1 and (k<8 and 7 or k<12 and 12 or k<16 and 17 or 22)) or (j==2 and (k<2 and 5 or k<6 and 9 or k<10 and 14 or 20)) or (j==3 and (k<4 and 4 or k<8 and 11 or k<12 and 16 or 23)) or (j==4 and (k<1 and 6 or k<9 and 10 or k<11 and 15 or 21)) local ac = (j==1 and 0xD76AA478 or j==2 and 0xF61E2562 or j==3 and 0xFFFA3942 or 0x8771F681) a = func(a,b,c,d,x[i+(idx)] or 0,s,ac) local tmp = d; d=c; c=b; b=a; a=tmp end end a = (a+olda)%4294967296; b = (b+oldb)%4294967296 c = (c+oldc)%4294967296; d = (d+oldd)%4294967296 end return string.format("%08x%08x%08x%08x",a,b,c,d) end --=================== 加解密 ==================== local function bxor(s,k) local r = {} for i=1,#s do local kb = string.byte(k,(i-1)%#k+1) table.insert(r,string.char(string.byte(s,i)~kb)) end return table.concat(r) end local function tohex(s) return (s:gsub(".",function(c)return string.format("%02X",string.byte(c))end)) end local function fromhex(h) return (h:gsub("%x%x",function(x)return string.char(tonumber(x,16))end)) end local function encrypt(data,key) return tohex(bxor(data,key)) end local function decrypt(hex,key) return bxor(fromhex(hex),key) end --=================== 账号文件读写 ==================== local function read_account_file(path) local f = io.open(path,"r") if not f then return nil end local hex = f:read("*a") f:close() if hex and #hex>0 then local acc = decrypt(hex,DEV_KEY) if acc and acc:match("^%d+$") then return acc end end return nil end local function sync_account_files(account) local f = io.open(ACCOUNT_PATH,"w") if f then f:write(encrypt(account,DEV_KEY)); f:close() end for _,dir in ipairs(BACKUP_DIRS) do local path = dir .. "/.Account" local f2 = io.open(path,"w") if f2 then f2:write(encrypt(account,DEV_KEY)); f2:close() end end end --=================== 多脚本数据管理(共存修复版)=================== function parse_multi_script_info(content) local data = {} local current_tag = nil for line in content:gmatch("[^\n]+") do if line:match("^【(.+)】$") then current_tag = line data[current_tag] = {} elseif current_tag and line:match("=") then local key, value = line:match("([^=]+)=(.+)") if key and value then data[current_tag][key] = value end end end return data end function build_multi_script_info(data) local lines = {} local first = true local tag_order = {"【工厂脚本】", "【章鱼脚本】", "【账号】"} for _, tag in ipairs(tag_order) do if data[tag] then if not first then table.insert(lines, "") end first = false table.insert(lines, tag) for key, value in pairs(data[tag]) do table.insert(lines, key .. "=" .. value) end end end for tag, fields in pairs(data) do local found = false for _, t in ipairs(tag_order) do if tag == t then found = true; break end end if not found then if not first then table.insert(lines, "") end first = false table.insert(lines, tag) for key, value in pairs(fields) do table.insert(lines, key .. "=" .. value) end end end return table.concat(lines, "\n") end function load_member() local f = io.open(INFO_PATH,"r") if not f then return {type=0,expire=0,times=0,pending_times=0,account="",debug_times=0,display_type=-1} end local hex = f:read("*a") f:close() if not hex or hex == "" then return {type=0,expire=0,times=0,pending_times=0,account="",debug_times=0,display_type=-1} end local decrypted = decrypt(hex, INFO_KEY) if not decrypted or decrypted == "" then return {type=0,expire=0,times=0,pending_times=0,account="",debug_times=0,display_type=-1} end local multi_data = parse_multi_script_info(decrypted) if multi_data[SCRIPT_TAG] then local script_data = multi_data[SCRIPT_TAG] return { type = tonumber(script_data.type) or 0, expire = tonumber(script_data.expire) or 0, times = tonumber(script_data.times) or 0, pending_times = tonumber(script_data.pending_times) or 0, account = script_data.account or "", debug_times = tonumber(script_data.debug_times) or 0, display_type = tonumber(script_data.display_type) or -1 } else return {type=0,expire=0,times=0,pending_times=0,account="",debug_times=0,display_type=-1} end end function save_member(m) if not m.account or m.account=="" then m.account = get_account() end if m.debug_times==nil then m.debug_times=0 end if m.display_type==nil then m.display_type=-1 end local f = io.open(INFO_PATH,"r") local multi_data = {} if f then local hex = f:read("*a") f:close() if hex and #hex > 0 then local decrypted = decrypt(hex, INFO_KEY) if decrypted and decrypted ~= "" then multi_data = parse_multi_script_info(decrypted) end end end multi_data[SCRIPT_TAG] = { type = tostring(m.type), expire = tostring(m.expire), times = tostring(m.times), pending_times = tostring(m.pending_times), account = m.account, debug_times = tostring(m.debug_times), display_type = tostring(m.display_type) } local ACCOUNT_TAG = "【账号】" if not multi_data[ACCOUNT_TAG] then multi_data[ACCOUNT_TAG] = {account = m.account} else multi_data[ACCOUNT_TAG].account = m.account end local plain_content = build_multi_script_info(multi_data) local encrypted = encrypt(plain_content, INFO_KEY) local fw = io.open(INFO_PATH,"w") if fw then fw:write(encrypted); fw:close() end end function get_shared_account() local m = load_member() if m.account and m.account ~= "" then return m.account end local acc = read_account_file(ACCOUNT_PATH) if acc then return acc end for _,path in ipairs(REDUNDANT_PATHS) do acc = read_account_file(path) if acc then sync_account_files(acc); return acc end end local len = 8 + math.random(0,5) acc = "" for i=1,len do acc = acc .. math.random(0,9) end sync_account_files(acc) return acc end function get_account() return get_shared_account() end function update_status(m) if m.type==2 and m.expire<=os.time() then if m.pending_times>0 then m.type=3; m.times=m.pending_times; m.pending_times=0 else m.type=0 end m.expire=0 end return m end --=================== 每日清理 ==================== function should_clean_today() local f = io.open(LAST_CLEAN_PATH,"r") if f then local hex = f:read("*a") f:close() if hex and #hex>0 then local last = decrypt(hex, DEV_KEY) local today = os.date("%Y%m%d") return last ~= today end end return true end function mark_cleaned_today() local today = os.date("%Y%m%d") local encrypted = encrypt(today, DEV_KEY) local f = io.open(LAST_CLEAN_PATH,"w") if f then f:write(encrypted); f:close() end end function daily_clean() if not should_clean_today() then return end mark_cleaned_today() end --=================== 临时充值ID池 ==================== function load_temp_ids() local ids = {} local f = io.open(TEMP_IDS_PATH,"r") if f then local hex = f:read("*a") f:close() if hex and #hex>0 then local decrypted = decrypt(hex, INFO_KEY) if decrypted and #decrypted>0 then for item in decrypted:gmatch("[^|]+") do table.insert(ids,item) end end end end return ids end function save_temp_ids(ids) local plain = table.concat(ids,"|") local encrypted = encrypt(plain, INFO_KEY) local f = io.open(TEMP_IDS_PATH,"w") if f then f:write(encrypted); f:close() end end function generate_temp_id_str(account) local random = math.random(100000,999999) local ts = os.time() local raw = account .. "|" .. ts .. "|" .. random local sign = md5(raw .. SECRET):sub(1,8) return encrypt(raw .. "|" .. sign, DEV_KEY) end function parse_temp_id(temp_id_str) local hex = temp_id_str:match("^%x+$") if not hex then return nil end local payload = decrypt(hex, DEV_KEY) local parts = {} for w in payload:gmatch("[^|]+") do table.insert(parts,w) end if #parts<4 then return nil end local acc, ts, rand, sign = parts[1], parts[2], parts[3], parts[4] if md5(acc.."|"..ts.."|"..rand..SECRET):sub(1,8) ~= sign then return nil end return acc end function add_temp_id(account) local ids = load_temp_ids() local new_id = generate_temp_id_str(account) table.insert(ids, new_id) while #ids > 4 do table.remove(ids, 1) end save_temp_ids(ids) return new_id end function remove_temp_id(temp_id_str) local ids = load_temp_ids() local new_ids = {} for _, tid in ipairs(ids) do if tid ~= temp_id_str then table.insert(new_ids, tid) end end save_temp_ids(new_ids) end function is_temp_id_valid(temp_id_str) local ids = load_temp_ids() for _, tid in ipairs(ids) do if tid == temp_id_str then return true end end return false end --=================== 卡密生成与范围 ==================== function generate_card(account, temp_id_str, ctype, value) local ts = os.time() local raw = table.concat({temp_id_str, ctype, value, ts}, "|") local sign = md5(raw .. SECRET .. account):sub(1, 16) return encrypt(raw .. "|" .. sign, SECRET) end function extract_temp_id_from_card(card_str, my_account) local hex = card_str:match("^%x+$") if not hex then return nil end local payload = decrypt(hex, SECRET) local parts = {} for w in payload:gmatch("[^|]+") do table.insert(parts, w) end if #parts < 5 then return nil end local tid, ctype, val, ts, sign = parts[1], parts[2], parts[3], parts[4], parts[5] local raw = table.concat({tid, ctype, val, ts}, "|") if md5(raw .. SECRET .. my_account):sub(1, 16) ~= sign then return nil end return tid, ctype, tonumber(val) end --=================== 时间格式化 ==================== function format_expire_time(timestamp) if not timestamp or timestamp == 0 then return "无" end return os.date("%Y年%m月%d号 %H时%M分%S秒", timestamp) end --=================== 状态文字 ==================== function get_display_status_text() local m = load_member() update_status(m) save_member(m) local disp = m.display_type or -1 if disp == 1 then return "👤 普通会员" end if disp == 2 then return "🌟 SVIP时间会员" end if disp == 3 then return "🌟 SVIP次数会员" end if disp == 4 then return "🔧 内测人员" end if m.type == 0 then return "🚫 未加入会员" elseif m.type == 1 then return "👤 普通会员" elseif m.type == 2 then return "🌟 SVIP时间会员" elseif m.type == 3 then return "🌟 SVIP次数会员" end return "🚫 未加入会员" end function get_remain_text(display_type) local m = load_member() update_status(m) save_member(m) local dt = display_type or m.display_type or -1 if dt == 1 then if m.type >= 1 then return "♾️ 永久有效" else return "未开通" end end if dt == 2 then if m.type == 2 and m.expire > os.time() then return "⏳ " .. format_expire_time(m.expire) else return "未开通" end end if dt == 3 then if m.type == 3 and m.times > 0 then return "🔢 剩余次数:" .. m.times .. "次" elseif m.pending_times > 0 then return "📦 待用次数:" .. m.pending_times .. "次" else return "未开通" end end if dt == 4 then local debug_times = m.debug_times or 0 if debug_times > 0 then return "🔧 调试剩余:" .. debug_times .. "次" else return "未开通" end end if m.type == 0 then return "🚫 未加入会员" elseif m.type == 1 then return "♾️ 永久有效" elseif m.type == 2 then local r = math.floor(m.expire - os.time()) if r <= 0 then return "⏰ 已过期" end return "⏳ 到期时间为:" .. format_expire_time(m.expire) elseif m.type == 3 then return "🔢 剩余次数:" .. m.times .. "次" end return "" end --=================== 激活文件 ==================== function save_activation_file(account) local f = io.open(CHUSHIHUALJ, "w") if f then f:write(encrypt(account, DEV_KEY)) f:close() return true end return false end function check_common_activation() local acc = get_account() local f = io.open(CHUSHIHUALJ, "r") if not f then gg.alert("❌ 未激活普通会员\n📢 请到Q群领取免费永久卡密激活") return false end local hex = f:read("*a") f:close() if decrypt(hex, DEV_KEY) ~= acc then gg.alert("❌ 激活文件与当前账号不符\n📢 请重新输入激活码激活") return false end return true end --=================== 管理日志 ==================== function write_admin_log(account, card, temp_id, ctype, value) local ts = os.time() local date_str = os.date("%Y年%m月%d号 %H时%M分%S秒", ts) local data_line = table.concat({account, card, temp_id, ts, ctype, value}, "|") local info_lines = { "📟账号:" .. account, "🆔临时ID:" .. temp_id, "🎫类型:" .. ctype .. "卡密", "🔢数量:" .. value, "📅生成日期:" .. date_str, "🔑卡密:" .. card, "🏷️脚本:" .. SCRIPT_ID } local old_text = "" local f = io.open(ADMIN_LOG_PATH, "r") if f then old_text = f:read("*a") or "" f:close() end local count = 1 for _ in old_text:gmatch("记录%d+") do count = count + 1 end local new_block = "记录" .. count .. "\n" .. data_line .. "\n" .. table.concat(info_lines, "\n") .. "\n" local new_text = #old_text > 0 and old_text .. "\n" .. new_block or new_block f = io.open(ADMIN_LOG_PATH, "w") if f then f:write(new_text) f:close() end end --=================== 重置 ==================== local function reset_all_data() local files = {ACCOUNT_PATH, INFO_PATH, TEMP_IDS_PATH, LAST_CLEAN_PATH, CHUSHIHUALJ} for _, path in ipairs(files) do os.remove(path) end for _, path in ipairs(REDUNDANT_PATHS) do os.remove(path) end gg.alert("✅ 账号数据已清除,请重新启动脚本") os.exit() end --=================== 界面功能 ==================== function show_my_id() if SYSTEM_DAMAGED then gg.alert("❌ 数据已损坏,无法查看账号") return end local acc = get_account() gg.copyText(acc) gg.alert("🆔 您的账号:\n" .. acc .. "\n\n✅ 已自动复制到剪贴板") end function admin_panel() local rid = gg.prompt({"请输入会员ID(临时充值ID)"}, {[1] = ""}, {[1] = "text"}) if not rid then return end local rid_str = rid[1] if rid_str == "" then return end local account = parse_temp_id(rid_str) if not account then gg.alert("❌ 无效的临时ID") return end local sel = gg.choice({"🔢 次数卡密", "⏱️ 秒数卡密", "🕐 小时卡密", "📅 天数卡密", "🌙 月数卡密", "🎆 年数卡密", "🔧 调试卡密", "↩️ 返回"}) if not sel or sel == 8 then return end local ctype if sel == 7 then ctype = "debug" else ctype = ({"times", "seconds", "hours", "days", "months", "years"})[sel] end local val = gg.prompt({"请输入数量/时长"}, {[1] = ""}, {[1] = "number"}) if not val then return end local v = tonumber(val[1]) if not v or v <= 0 then gg.alert("❌ 输入无效") return end local card = generate_card(account, rid_str, ctype, v) write_admin_log(account, card, rid_str, ctype, v) local shengchengriqi = os.date("%Y年%m月%d号 %H时%M分%S秒") local act = gg.choice({"📋 复制卡密", "↩️ 返回"}, nil, "✅ 卡密生成成功\n\n📟 账号:" .. account .. "\n🆔 临时ID:" .. rid_str .. "\n🎫 类型:" .. ctype .. "卡密\n🔢 数量:" .. v .. "\n📅 生成日期:" .. shengchengriqi .. "\n🏷️ 脚本:" .. SCRIPT_ID .. "\n\n🔑 卡密:\n" .. card) if act == 1 then gg.copyText(card) gg.toast("📋 卡密已复制") end end function chongzhi_ui() if SYSTEM_DAMAGED then local res = gg.prompt({"我的ID:", "输入卡密"}, {[1] = "数据信息已损坏,无法生成临时ID", [2] = ""}, {[1] = "number", [2] = "text"}) if not res then return end local card = res[2] if card == "" then return end if card == RESET_PASS then local confirm = gg.choice({"确定重置", "取消"}, nil, "⚠️ 将删除所有账号数据,此操作不可恢复!") if confirm == 1 then reset_all_data() end return end if card == ADMIN_PASS then admin_panel() return end gg.alert("❌ 数据已损坏,无法完成充值") return end local myacc = get_account() local new_tid = add_temp_id(myacc) local res = gg.prompt({"我的ID:", "输入卡密"}, {[1] = new_tid, [2] = ""}, {[1] = "number", [2] = "text"}) if not res then return end local card = res[2] if card == "" then gg.alert("❌ 请输入卡密") return end if card == RESET_PASS then local confirm = gg.choice({"确定重置", "取消"}, nil, "⚠️ 将删除所有账号数据,此操作不可恢复!") if confirm == 1 then reset_all_data() end return end if card == ADMIN_PASS then admin_panel() return end if card == tostring(CHUSHIHUA) then local m = load_member() update_status(m) if m.type == 2 or m.type == 3 or m.debug_times > 0 then if save_activation_file(myacc) then gg.alert("✅ 激活文件已更新\n(高级状态不变)") else gg.alert("⚠️ 激活文件写入失败") end return end m.type = 1 m.expire = 0 m.times = 0 m.pending_times = 0 save_member(m) if save_activation_file(myacc) then gg.alert("🎉 您已成为【普通会员】!") else gg.alert("⚠️ 激活文件写入失败") end return end local tid, ctype, val = extract_temp_id_from_card(card, myacc) if not tid then gg.alert("❌ 卡密无效") return end if not is_temp_id_valid(tid) then gg.alert("❌ 临时ID已失效,请重新生成充值ID") return end local m = load_member() update_status(m) local num = tonumber(val) if ctype == "debug" then m.debug_times = (m.debug_times or 0) + num save_member(m) gg.alert("🔧 调试次数增加 " .. num .. " 次\n当前剩余:" .. m.debug_times .. "次") elseif ctype == "times" then if m.type == 2 and m.expire > os.time() then m.pending_times = m.pending_times + num save_member(m) gg.alert("📌 当前为时间SVIP,次数将在到期后启用\n🔢 已存入次数:" .. m.pending_times .. "次") elseif m.type == 3 then m.times = m.times + num save_member(m) gg.alert("🎉 充值成功!剩余次数:" .. m.times .. "次") else m.type = 3 m.times = num m.expire = 0 m.pending_times = 0 save_member(m) gg.alert("🎉 您已成为【SVIP次数会员】\n🔢 可用次数:" .. m.times .. "次") end else local add = num * (ctype == "seconds" and 1 or ctype == "hours" and 3600 or ctype == "days" and 86400 or ctype == "months" and 2592000 or 31536000) local now = os.time() if m.type == 2 and m.expire > now then m.expire = m.expire + add else if m.type == 3 and m.times > 0 then m.pending_times = m.times end m.type = 2 m.times = 0 m.expire = now + add end save_member(m) gg.alert("🎉 您已成为【SVIP时间会员】\n⏳ 到期:" .. os.date("%Y-%m-%d %H:%M:%S", m.expire)) end remove_temp_id(tid) end function show_auth() if SYSTEM_DAMAGED then gg.alert("❌ 数据已损坏,无法查看授权") return end local m = load_member() update_status(m) save_member(m) local acc = get_account() local can_normal = (m.type >= 1) local can_time = (m.type == 2 and m.expire > os.time()) local can_count = (m.type == 3 and m.times > 0) or (m.pending_times > 0) local can_debug = (m.debug_times or 0) > 0 local choices = { "👤 显示为普通会员", "🌟 显示为SVIP时间会员", "🌟 显示为SVIP次数会员", "🔧 显示为内测人员", "🔄 自动(最高优先级)", "↩️ 返回" } local disp_map = {1, 2, 3, 4, -1} local cur_status = get_display_status_text() local svip_expire = "未开通" if m.type == 2 then if m.expire > os.time() then svip_expire = format_expire_time(m.expire) else svip_expire = "已过期" end end local debug_info = "未开通" if can_debug then debug_info = "剩余 " .. m.debug_times .. " 次" end local info = "📩 授权信息\n\n" .. "🆔 账号:" .. acc .. "\n" .. "🎫 当前显示:" .. cur_status .. "\n\n" .. "📅 SVIP到期:" .. svip_expire .. "\n" .. "🔧 调试次数:" .. debug_info if m.pending_times > 0 then info = info .. "\n📦 待用次数:" .. m.pending_times .. "次(到期后启用)" end local act = gg.choice(choices, nil, info) if not act or act == 6 then return end if act == 5 then m.display_type = -1 save_member(m) gg.toast("✅ 已切换为自动显示") return end local chosen = disp_map[act] if chosen == 1 then if can_normal then m.display_type = 1 save_member(m) gg.toast("✅ 头衔已切换为普通会员") else gg.alert("❌ 您未开通普通会员,无法使用此头衔") end elseif chosen == 2 then if can_time then m.display_type = 2 save_member(m) gg.toast("✅ 头衔已切换为SVIP时间会员") else gg.alert("❌ 您未开通SVIP时间会员,无法使用此头衔") end elseif chosen == 3 then if can_count then m.display_type = 3 save_member(m) gg.toast("✅ 头衔已切换为SVIP次数会员") else gg.alert("❌ 您未开通SVIP次数会员,无法使用此头衔") end elseif chosen == 4 then if can_debug then m.display_type = 4 save_member(m) gg.toast("✅ 头衔已切换为内测人员") else gg.alert("❌ 您未开通调试会员,无法使用此头衔") end end end --=================== 系统完整性验证 ==================== function verify_and_repair() local main_acc = read_account_file(ACCOUNT_PATH) if not main_acc then for _, path in ipairs(REDUNDANT_PATHS) do local acc = read_account_file(path) if acc then main_acc = acc sync_account_files(acc) break end end end if not main_acc then save_member({type = 0, expire = 0, times = 0, pending_times = 0, account = "", debug_times = 0, display_type = -1}) end return "ok" end --=================== 检测并清理多余账号 ==================== function check_and_clean_duplicate_accounts() local found_accounts = {} local account_paths = {} local paths_to_check = {ACCOUNT_PATH} for _, dir in ipairs(BACKUP_DIRS) do table.insert(paths_to_check, dir .. "/.Account") end for _, path in ipairs(paths_to_check) do local acc = read_account_file(path) if acc then local found = false for i, existing in ipairs(found_accounts) do if existing == acc then found = true break end end if not found then table.insert(found_accounts, acc) table.insert(account_paths, {account = acc, path = path}) end end end if #found_accounts > 1 then local choices = {} for i, info in ipairs(account_paths) do table.insert(choices, "账号 " .. info.account .. " (路径: " .. info.path .. ")") end table.insert(choices, "删除所有账号,重新生成") table.insert(choices, "取消,退出脚本") local selected = gg.choice(choices, nil, "⚠️ 检测到多个账号!\n请选择要保留的账号,其他将被删除") if selected == nil or selected == #choices then gg.alert("❌ 请解决账号冲突后重新运行脚本") os.exit() elseif selected == #choices - 1 then for _, info in ipairs(account_paths) do os.remove(info.path) end local data_files = {INFO_PATH, TEMP_IDS_PATH, LAST_CLEAN_PATH, CHUSHIHUALJ} for _, file in ipairs(data_files) do os.remove(file) end gg.alert("✅ 所有账号数据已清除\n请重新启动脚本,将自动生成新账号") os.exit() else local keep_account = account_paths[selected].account local keep_path = account_paths[selected].path for i, info in ipairs(account_paths) do if i ~= selected then os.remove(info.path) end end if keep_path ~= ACCOUNT_PATH then sync_account_files(keep_account) end local m = load_member() if m.account and m.account ~= keep_account then m.account = keep_account save_member(m) end gg.alert("✅ 已保留账号:" .. keep_account .. "\n其他账号已删除") end return true end return false end --=================== 启动时检测账号冲突 ==================== function startup_check() local cleaned = check_and_clean_duplicate_accounts() if cleaned then gg.alert("📢 账号已清理完成,请重新运行脚本") os.exit() end local integrity = verify_and_repair() if integrity == "new_user" or integrity == "ok" or integrity == "recovered" then if integrity == "recovered" then gg.toast("✅ 数据已从备份恢复") end else SYSTEM_DAMAGED = true gg.toast("⚠️ 数据异常,部分功能受限") end end --=================== 主菜单 ==================== function MainMenu() while true do local m = load_member() update_status(m) save_member(m) local remain = SYSTEM_DAMAGED and "❌ 已损坏" or get_remain_text(m.display_type) local status = SYSTEM_DAMAGED and "❌ 已损坏" or get_display_status_text() local menu = gg.choice({ "💳 充值卡密", "🚀 开启脚本", "📋 查看授权", "🆔 我的账号", "❌ 退出脚本" }, nil, "【章鱼通行证版】卡密剩余时间:" .. remain .. "\n\n会员状态:" .. status) if not menu then goto menu_continue end if menu == 1 then chongzhi_ui() elseif menu == 2 then if SYSTEM_DAMAGED then gg.alert("❌ 数据已损坏,无法开启脚本") goto menu_continue end local isSVIP = (m.type == 2 or m.type == 3) if not isSVIP then gg.alert("🔒 此脚本所有功能仅限SVIP会员使用!\n\n请充值SVIP卡密(时间会员或次数会员)\n点击【💳 充值卡密】进行充值") goto menu_continue end if m.type == 3 then if m.times <= 0 then gg.alert("❌ 您的SVIP次数已用完,请充值次数卡密") goto menu_continue elseif m.times == 1 then m.times = m.times - 1 save_member(m) Main_Function() break else m.times = m.times - 1 save_member(m) Main_Function() break end else Main_Function() break end elseif menu == 3 then show_auth() elseif menu == 4 then show_my_id() elseif menu == 5 then gg.setVisible(false) os.exit() end ::menu_continue:: end end --=================== 章鱼通行证功能代码 ==================== gg.clearResults() sj = {} xgz = {} gg.toast("模拟城市 - 章鱼通行证版") function search(ss, lx, nc, dz1, dz2) if ss ~= nil then if lx ~= nil then if nc == nil then nc = 4 end gg.setRanges(nc) if dz1 == nil then dz1 = "-1" end if dz2 == nil then dz1 = "0" end gg.searchNumber(ss, lx, false, 536870912, dz1, dz2) sl = gg.getResultCount() if sl ~= 0 then sj = gg.getResults(sl) gg.toast("搜索到 " .. sl .. " 个结果") gg.clearResults() else gg.toast("未搜索到结果") end else gg.toast("无搜索值类型") end else gg.toast("无需搜索值") end end function py1(value, lx, py) if #sj ~= nil then z1 = {} z2 = {} for i = 1, #sj do z1[i] = {} z1[i].address = sj[i].address + py z1[i].flags = lx end z1 = gg.getValues(z1) for i = 1, #sj do if z1[i].value == value then z2[#z2 + 1] = {} z2[#z2] = sj[i] end end sj = z2 z1 = {} z2 = {} gg.toast("共偏移 " .. #sj .. " 个数据") else gg.toast("没有搜索数据") end end function py2(value, lx, py) if #sj ~= nil then z1 = {} z2 = {} for i = 1, #sj do z1[i] = {} z1[i].address = sj[i].address + py z1[i].flags = lx end z1 = gg.getValues(z1) for i = 1, #sj do if z1[i].value ~= value then z2[#z2 + 1] = {} z2[#z2] = sj[i] end end sj = z2 z1 = {} z2 = {} gg.toast("共偏移 " .. #sj .. " 个数据") else gg.toast("没有搜索数据") end end function xg1(value, lx, py, dj) if #sj ~= nil then z = {} for i = 1, #sj do z[i] = {} z[i].address = sj[i].address + py z[i].flags = lx z[i].value = value if dj == true then z[i].freeze = true end end if dj == true then gg.addListItems(z) else gg.clearList() gg.setValues(z) end gg.toast("共修改 " .. #z .. " 个数据") else gg.toast("没有搜索数据") end end function xg2(bz, value, lx, py, dj) if #bz ~= nil then z = {} for i = 1, #bz do z[i] = {} z[i].address = bz[i].address + py z[i].flags = lx z[i].value = value if dj == true then z[i].freeze = true end end if dj == true then gg.addListItems(z) else gg.clearList() gg.setValues(z) end gg.toast("共修改 " .. #z .. " 个数据") else gg.toast("没有搜索数据") end end function bc(bz) if sj ~= nil then _ENV[bz] = sj else gg.toast("无数据") end end function BaAdd(add) t = gg.getValues({[1] = {address = add, flags = 4}}) return t[1].value & 0xFFFFFFFF end function set(dz, xg, lx, dj) if dj == "true" then gg.addListItems({{address = dz, flags = lx, value = xg, freeze = true}}) else gg.setValues({{address = dz, flags = lx, value = xg}}) end gg.toast("已修改完成~") end -- 章鱼通行证变量 zytzm1 = 152 zytzm2 = 2 zytzm3 = 414 zytzm4 = 414 -- 市长通行证变量 sztzm1 = "414" sztzm2 = "69" sztzm3 = "1" sztzm4 = "414" -- 验证范围4 gg.clearResults() gg.setRanges(4) gg.searchNumber(751144117, gg.TYPE_DWORD) if gg.getResultsCount() > 0 then selectedRange = 4 else -- 验证范围-2080896(这是一个数值常量,直接使用) gg.clearResults() gg.setRanges(-2080896) gg.searchNumber(751144117, gg.TYPE_DWORD) if gg.getResultsCount() > 0 then selectedRange = -2080896 else -- 验证范围32 gg.clearResults() gg.setRanges(32) gg.searchNumber(751144117, gg.TYPE_DWORD) if gg.getResultsCount() > 0 then selectedRange = 32 end end end gg.setRanges(selectedRange) -- 验证失败则终止脚本 if not selectedRange then neicunyanzheng = gg.alert("❌ 检测到你未选择正确的进程,是否需要退出选择进程。", "不退出", "退出") if neicunyanzheng == 1 then -- 不退出,继续执行(但这里selectedRange还是nil,后续可能还会出问题) -- 建议您在这里添加处理逻辑 else os.exit() end end -- ========== 工厂生产材料数据 ========== local putongcl = { ["金属"] = 267176888, ["木头"] = 2090874750, ["塑料"] = -1270634091, ["种子"] = 274276185, ["矿物质"] = -1369888960, ["化学物质"] = 1570439054, ["纺织品"] = 144394935, ["糖和香料"] = 1807545838, ["玻璃"] = 260292831, ["饲料"] = 1658060491, ["电子元件"] = -181617693, ["钉子"] = 268207452, ["木板"] = 351941774, ["砖头"] = -188562685, ["水泥"] = -164698239, ["胶水"] = 2090296690, ["油漆"] = 270579361, ["锤子"] = 26243455, ["卷尺"] = -297136870, ["铲子"] = 465115894, ["厨具"] = 1799827558, ["钻机"] = 256959164, ["梯子"] = 182451793, ["蔬菜"] = -1970978713, ["面粉"] = -2127979990, ["西瓜"] = 1447646651, ["奶酪"] = -161427822, ["奶油"] = 255768525, ["牛排"] = 2090108855, ["玉米"] = 2090156119, ["椅子"] = -161567233, ["桌子"] = 495471776, ["高级纺织品"] = 1228123200, ["沙发"] = 255678199, ["橱柜"] = 334762709, ["草"] = 260508453, ["树苗"] = -788997290, ["庭院椅子"] = 1125663546, ["火盆"] = -1398164872, ["花园地精雕像"] = 566656095, ["割草机"] = 1818945505, ["甜甜圈"] = -113650078, ["绿色冰沙"] = 1593061790, ["面包卷"] = 123794044, ["樱桃蛋糕"] = -466890509, ["冻酸奶"] = -325591165, ["咖啡"] = -153089811, ["帽子"] = 1534432269, ["鞋子"] = 274394919, ["手表"] = -1018293267, ["西服"] = -1408194775, ["书包"] = 108385717, ["薯条"] = -719795061, ["披萨"] = 270885747, ["汉堡"] = -1799384545, ["三文治"] = -712060721, ["汽水"] = -265079577, ["爆米花"] = -1136019226, ["电视机"] = 5863855, ["电冰箱"] = 298050001, ["烧烤架"] = 1943086388, ["电灯泡"] = -1494660480, ["微波炉"] = 1171629674, ["招财猫"] = -2135434832, ["石灯笼"] = -2135434831, ["盆栽"] = -2135434830, ["毛衣"] = -852364093, ["奢侈品"] = -852364092, ["法棍面包"] = -852364091, ["茶壶"] = 527492590, ["钢盔"] = 527492591, ["电话亭"] = 527492592, ["再生布料"] = -1480795913, ["环保袋"] = 1553334434, ["生态鞋"] = -2118495682, ["瑜伽垫"] = 1886510007, ["原油"] = 953030492, ["机油"] = -1964329030, ["汽车轮胎"] = -1290152913, ["引擎"] = -75965445, ["椰子"] = -760220352, ["椰子油"] = 248304484, ["面霜"] = -1740539876, ["热带饮料"] = 449644219, ["鱼"] = 2090257423, ["鱼罐头"] = 1939782264, ["鱼汤"] = 1148007126, ["鲑鱼三明治"] = 1321484032, ["真丝"] = 2090724376, ["丝线"] = 479440892, ["扇子"] = 193491386, ["袍子"] = 2090694637 } local kuodicl = { ["摄像头"] = 13285930, ["锁头"] = 21080992, ["钢条"] = 543978041, ["排气管"] = 1206566498, ["轮子"] = 12777566, ["推土铲"] = -1227768711, ["电池"] = -520565565, ["遥控器"] = -2038227, ["手套"] = 112710515, ["游泳圈"] = 265268177, ["舵轮"] = 265268178, ["泳镜"] = 265268179, ["滑雪板"] = 745632329, ["指南针"] = 745632330, ["滑雪帽"] = 745632331 } local zhanzhengcl = { ["弹药箱"] = 2090081903, ["铁钻"] = 253271711, ["望远镜"] = 1560176023, ["消防栓"] = 860715237, ["汽油"] = -916988905, ["扩音器"] = -1540742631, ["老虎钳"] = 352219700, ["疏通赛"] = -1247109630, ["螺旋桨"] = -1962827238, ["橡胶靴"] = -1607480754, ["小黄鸭"] = 471968558, ["医疗包"] = 226338627 } local jiachengqicl = { ["能量泵I"] = 1965976282, ["能量泵II"] = 1965976283, ["能量泵III"] = 1965976284, ["能量吸血鬼I"] = 1736317036, ["能量吸血鬼II"] = 1736317037, ["能量吸血鬼III"] = 1736317038, ["屏障I"] = 1587235432, ["屏障II"] = 1587235433, ["屏障III"] = 1587235434, ["城市冰冻I"] = 924894801, ["城市冰冻II"] = 924894802, ["城市冰冻III"] = 924894803, ["头奖I"] = 1692935226, ["头奖II"] = 1692935227, ["头奖III"] = 1692935228, ["哑弹I"] = 91798751, ["哑弹II"] = 91798752, ["哑弹III"] = 91798753 } local zhanzhengkpcl = { ["滑稽之手"] = 1430583743, ["收缩射线"] = 1430583746, ["巨石怪"] = -35376651, ["人生地不熟"] = 1430583747, ["磁力之击"] = 1430583749, ["触手漩涡"] = 1430583748, ["飞行的V机器人"] = -35376655, ["迪斯科旋风"] = -35376689, ["植物怪兽"] = -35376688, ["冰风暴"] = 1430583750, ["死鱼之灾"] = -35376685, ["远古诅咒"] = -35376684, ["死神之手"] = 1430583751, ["16吨"] = -35376683, ["末日蜘蛛"] = -35376680, ["舞鞋"] = -35376687, ["修建传送门"] = -35376681, ["B级电影怪兽"] = -35376654, ["蟒蛇怒缠"] = -35376648, ["响亮怒吼"] = -35376647, ["末日鸭叫"] = -35376650, ["电击之神"] = -35376649, ["护盾破坏者(国际服)"] = -35376623 } local omgcl = { ["4D打印机"] = -1540641695, ["全息投影仪"] = 1940876015, ["悬浮滑板"] = -1307054383, ["机器宠物"] = 1430745728, ["传送舱"] = -661139406, ["反重力鞋子"] = 638948574, ["太阳能板"] = -1847614967, ["喷气背包"] = -681051257, ["冷聚变室"] = -477356184, ["超波炉"] = -805181992 } local zhanzhrngkabaocl = { ["普通卡包1"] = -636750183, ["普通卡包2"] = 225143393, ["稀有卡包1"] = -159081574, ["稀有卡包2"] = -1687658947, ["稀有卡包3"] = -1191661694, ["传奇卡包1"] = -1516369694, ["传奇卡包2"] = 1499407571 } -- 偏移量定义 local OFFSET_392 = 412 local OFFSET_MINUS_12 = -12 local OFFSET_MINUS_28 = -28 local OFFSET_MINUS_8 = -8 local OFFSET_32 = 32 local OFFSET_16 = 16 local shuliang = nil local wupindingwei = nil local shuliangAddr = nil local wupindingweiAddr = nil function showError(msg) gg.alert("❌ 错误", msg) end function showSuccess(msg) gg.alert("✅ 成功", msg) end function init() gg.clearResults() gg.searchNumber("60000", gg.TYPE_DWORD) local totalCount = gg.getResultsCount() if totalCount == 0 then showError("搜索60000失败") return false end local allResults = gg.getResults(totalCount) local found = false for i, v in ipairs(allResults) do local addr5000 = v.address + OFFSET_392 local val5000 = gg.getValues({{address = addr5000, flags = gg.TYPE_DWORD}})[1].value if val5000 == 5000 then local checkAddr = addr5000 + OFFSET_MINUS_12 local checkVal = gg.getValues({{address = checkAddr, flags = gg.TYPE_WORD}})[1].value if checkVal == 1 then local addrMinus28 = addr5000 + OFFSET_MINUS_28 local ptr64 = gg.getValues({{address = addrMinus28, flags = gg.TYPE_QWORD}})[1].value if ptr64 == nil or ptr64 == 0 then showError("获取64位指针失败") return false end local finalAddr = ptr64 + OFFSET_MINUS_8 local shuliangVal = gg.getValues({{address = finalAddr, flags = gg.TYPE_DWORD}})[1].value shuliang = shuliangVal shuliangAddr = finalAddr found = true break end end end if not found then showError("请检查进程是否正确") return false end gg.clearResults() gg.searchNumber("1698928035", gg.TYPE_DWORD) local totalCount2 = gg.getResultsCount() if totalCount2 == 0 then showError("搜索1698928035失败") return false end local allResults2 = gg.getResults(totalCount2) local wpAddr = allResults2[1].address + OFFSET_32 local wpVal = gg.getValues({{address = wpAddr, flags = gg.TYPE_DWORD}})[1].value wupindingwei = wpVal wupindingweiAddr = wpAddr gg.clearResults() showSuccess("初始化成功!") return true end function setCustomCount() if shuliangAddr == nil then showError("请先执行初始化") return end local currentVal = gg.getValues({{address = shuliangAddr, flags = gg.TYPE_DWORD}})[1].value local dialog = gg.prompt({"自定义数量(当前值:" .. currentVal .. ")"}, {""}, {"number"}) if dialog == nil then return end local newValue = tonumber(dialog[1]) if newValue == nil then showError("请输入有效的数字") return end gg.setValues({{address = shuliangAddr, value = newValue, flags = gg.TYPE_DWORD}}) local verifyVal = gg.getValues({{address = shuliangAddr, flags = gg.TYPE_DWORD}})[1].value if verifyVal == newValue then shuliang = newValue gg.clearResults() showSuccess("自定义数量修改成功!新数量: " .. newValue) else showError("修改失败") end end function setCustomInput() if wupindingweiAddr == nil then showError("请先执行初始化") return end local dialog = gg.prompt({"请输入需要生产的物品数值"}, {""}, {"number"}) if dialog == nil then return end local searchVal = tonumber(dialog[1]) if searchVal == nil then showError("请输入有效的数字") return end gg.clearResults() gg.searchNumber(tostring(searchVal), gg.TYPE_DWORD) local totalCount = gg.getResultsCount() if totalCount == 0 then showError("搜索值失败") return end local allResults = gg.getResults(totalCount) local firstVal = allResults[1].value local refineStr = firstVal .. ";" .. firstVal .. "::9" gg.searchNumber(refineStr, gg.TYPE_DWORD) local refineCount = gg.getResultsCount() if refineCount == 0 then showError("改善搜索失败") return end local refineResults = gg.getResults(refineCount) local kapianAddr = refineResults[1].address + OFFSET_16 local kapian = gg.getValues({{address = kapianAddr, flags = gg.TYPE_DWORD}})[1].value if kapian == nil then showError("获取值失败") return end gg.setValues({{address = wupindingweiAddr, value = kapian, flags = gg.TYPE_DWORD}}) local verifyVal = gg.getValues({{address = wupindingweiAddr, flags = gg.TYPE_DWORD}})[1].value if verifyVal == kapian then wupindingwei = kapian gg.clearResults() showSuccess("自定义生产成功!数值: " .. searchVal) else showError("替换失败") end end function useMaterial(materialName, materialTable) if wupindingweiAddr == nil then showError("请先执行初始化") return end local searchVal = materialTable[materialName] if searchVal == nil then showError("未找到材料对应的值") return end gg.clearResults() gg.searchNumber(tostring(searchVal), gg.TYPE_DWORD) local totalCount = gg.getResultsCount() if totalCount == 0 then showError("搜索材料值失败") return end local allResults = gg.getResults(totalCount) local firstVal = allResults[1].value local refineStr = firstVal .. ";" .. firstVal .. "::9" gg.searchNumber(refineStr, gg.TYPE_DWORD) local refineCount = gg.getResultsCount() if refineCount == 0 then showError("改善搜索失败") return end local refineResults = gg.getResults(refineCount) local kapianAddr = refineResults[1].address + OFFSET_16 local kapian = gg.getValues({{address = kapianAddr, flags = gg.TYPE_DWORD}})[1].value if kapian == nil then showError("获取kapian失败") return end gg.setValues({{address = wupindingweiAddr, value = kapian, flags = gg.TYPE_DWORD}}) local verifyVal = gg.getValues({{address = wupindingweiAddr, flags = gg.TYPE_DWORD}})[1].value if verifyVal == kapian then wupindingwei = kapian gg.clearResults() showSuccess("生产成功!" .. materialName) else showError("替换失败") end end -- 公共内存读写函数 function readDword(addr) return gg.getValues({{address = addr, flags = 4}})[1].value end function readQword(addr) return gg.getValues({{address = addr, flags = 32}})[1].value end function writeDword(addr, val) gg.setValues({{address = addr, flags = 4, value = val}}) end function writeQword(addr, val) gg.setValues({{address = addr, flags = 4, value = val}}) end -- 全局变量 g_mat_baseAddr = nil g_mat_quantityAddr = {} g_mat_replaceAddr1 = {} g_mat_cardDataAddr = {} g_mat_kapianGroups = {} g_card_baseAddr = nil g_card_quantityAddr = {} g_card_replaceAddr1 = {} g_card_cardDataAddr = {} g_card_kapianGroups = {} g_boost_baseAddr = nil g_boost_quantityAddr = {} g_boost_replaceAddr1 = {} g_boost_cardDataAddr = {} g_boost_kapianGroups = {} --=================== 主功能函数(修复悬浮窗隐藏)=================== function Main_Function() while true do MXX = gg.choice({ '通行证战争材料', '通行证战争卡片', '通行证产加成器', '工厂生产材料', '市长通行证', '章鱼通行证', '退出脚本'}, nil, '【章鱼通行证版】游戏:模拟城市国际服64位 | 版本:V1.0') -- 修复:点击空白处退出功能菜单 if MXX == nil then return end if MXX == 1 then -- 通行证战争材料 local exitMenu = false while not exitMenu do local choice = gg.choice({ "初始化并获取Q值", "自定义加成器数量", "1~6种战争材料(第1~6组)", "7~12种战争材料(第7~12组)", "返回首页" }, nil, "战争材料 - 请选择操作") if choice == nil then exitMenu = true break end if choice == 1 then local xunwencl = gg.multiChoice({'重置重复领取'}) if xunwencl and xunwencl[1] == true then search(zytzm1,4,4~1~32~-2080896) py1(zytzm2, 4, 176) py1(zytzm3, 4, 188) py1(zytzm4, 4, 196) xg1(0, 4, 424, false) xg1(0, 4, 428, false) xg1(0, 4, 432, false) xg1(0, 4, 436, false) xg1(0, 4, 440, false) xg1(0, 4, 444, false) gg.toast("普通通行证已重复领取") end gg.clearResults() gg.searchNumber(tostring(zytzm1), gg.TYPE_DWORD) local results = gg.getResults(2000) if #results == 0 then gg.toast("初始化失败:未找到结果") else local step1 = {} for _, v in ipairs(results) do if readDword(v.address + 176) == zytzm2 then table.insert(step1, v.address + 176) end end if #step1 == 0 then gg.toast("初始化失败:第一级验证失败") else local step2 = {} for _, addr in ipairs(step1) do if readDword(addr + 12) == zytzm3 then table.insert(step2, addr + 12) end end if #step2 == 0 then gg.toast("初始化失败:第二级验证失败") else local step3 = {} for _, addr in ipairs(step2) do if readDword(addr + 8) == zytzm4 then table.insert(step3, addr + 8) end end if #step3 == 0 then gg.toast("初始化失败:第三级验证失败") else local originalAddr = step3[1] - 176 - 12 - 8 local val128 = readQword(originalAddr + 128) local ptr1 = readQword(val128) g_mat_baseAddr = ptr1 local quantityOffsets = {48, 208, 368, 528, 688, 848} for i, off in ipairs(quantityOffsets) do g_mat_quantityAddr[i] = g_mat_baseAddr + off g_mat_replaceAddr1[i] = g_mat_quantityAddr[i] - 16 g_mat_cardDataAddr[i] = readQword(g_mat_replaceAddr1[i]) end gg.clearResults() gg.searchNumber('2090081903', gg.TYPE_DWORD) gg.searchNumber('2090081903;2090081903::9', gg.TYPE_DWORD) local results2 = gg.getResults(10) if #results2 == 0 then gg.toast("获取加成器组失败:未找到结果") else local addr2 = results2[1].address local ptrValue2 = readQword(addr2 + 16) local kpzz = readDword(ptrValue2) gg.clearResults() gg.searchNumber(tostring(kpzz), gg.TYPE_DWORD) local kpzzResults = gg.getResults(500) local validResults = {} for i, v in ipairs(kpzzResults) do local newAddr = v.address + 24 local val = readDword(newAddr) if val and (val < -1000 or val > 1000) then table.insert(validResults, {address = newAddr, value = val}) end end g_mat_kapianGroups = {} for idx, item in ipairs(validResults) do local ptrAddr = readQword(item.address) if ptrAddr and ptrAddr ~= 0 then g_mat_kapianGroups[idx] = { Cia1 = readQword(ptrAddr + 0x0), Cia2 = readQword(ptrAddr + 0x4), Cia3 = readQword(ptrAddr + 0x8), Cia4 = readQword(ptrAddr + 0xC), Cia5 = readQword(ptrAddr + 0x10), Cia6 = readQword(ptrAddr + 0x14), ptrAddr = ptrAddr } end end gg.clearResults() gg.toast(string.format("初始化完成,共获取 %d 组加成器数据", #g_mat_kapianGroups)) end end end end end elseif choice == 2 then if #g_mat_quantityAddr == 0 then gg.toast("错误:请先执行【初始化并获取Q值】") else local curQty = {} for i = 1, #g_mat_quantityAddr do curQty[i] = readDword(g_mat_quantityAddr[i]) end local inputList = { "是否要重复领取", "批量修改数量(输入后下方加成器数量失效)", string.format("加成器1 当前数量:%d\n输入新数量", curQty[1]), string.format("加成器2 当前数量:%d\n输入新数量", curQty[2]), string.format("加成器3 当前数量:%d\n输入新数量", curQty[3]), string.format("加成器4 当前数量:%d\n输入新数量", curQty[4]), string.format("加成器5 当前数量:%d\n输入新数量", curQty[5]), string.format("加成器6 当前数量:%d\n输入新数量", curQty[6]), "校准位置的不用理会" } local defaultList = { false, "", tostring(curQty[1]), tostring(curQty[2]), tostring(curQty[3]), tostring(curQty[4]), tostring(curQty[5]), tostring(curQty[6]), "" } local inputTypes = { "checkbox", "number", "number", "number", "number", "number", "number", "number", "number" } local inputs = gg.prompt(inputList, defaultList, inputTypes) if inputs == nil then gg.toast("用户取消操作") else if inputs[1] == true then search(zytzm1,4,4~1~32~-2080896) py1(zytzm2, 4, 176) py1(zytzm3, 4, 188) py1(zytzm4, 4, 196) xg1(0, 4, 424, true) xg1(0, 4, 428, true) xg1(0, 4, 432, true) xg1(0, 4, 436, true) xg1(0, 4, 440, true) xg1(0, 4, 444, true) gg.toast("普通通行证已重复领取") end local batchValue = tonumber(inputs[2]) if batchValue and batchValue > 0 then for i = 1, #g_mat_quantityAddr do if batchValue ~= curQty[i] then writeDword(g_mat_quantityAddr[i], batchValue) end end gg.toast(string.format("批量修改完成,所有加成器数量设置为 %d", batchValue)) else for i = 1, #g_mat_quantityAddr do local newVal = tonumber(inputs[i + 1]) if newVal and newVal ~= curQty[i] then writeDword(g_mat_quantityAddr[i], newVal) end end gg.toast("自定义加成器数量完成") end end end elseif choice == 3 then if #g_mat_kapianGroups == 0 then gg.toast("错误:没有可用的加成器组数据,请先执行【初始化并获取Q值】") else for i = 1, 6 do if g_mat_kapianGroups[i] then writeQword(g_mat_cardDataAddr[i] + 0, g_mat_kapianGroups[i].Cia1) writeQword(g_mat_cardDataAddr[i] + 4, g_mat_kapianGroups[i].Cia2) writeQword(g_mat_cardDataAddr[i] + 8, g_mat_kapianGroups[i].Cia3) writeQword(g_mat_cardDataAddr[i] + 12, g_mat_kapianGroups[i].Cia4) writeQword(g_mat_cardDataAddr[i] + 16, g_mat_kapianGroups[i].Cia5) writeQword(g_mat_cardDataAddr[i] + 20, g_mat_kapianGroups[i].Cia6) end end gg.toast("已使用第1~6组数据替换加成器1~6") end elseif choice == 4 then if #g_mat_kapianGroups < 7 then gg.toast("数据不足,需要至少7组数据") else for i = 1, 6 do if g_mat_kapianGroups[6 + i] then writeQword(g_mat_cardDataAddr[i] + 0, g_mat_kapianGroups[6 + i].Cia1) writeQword(g_mat_cardDataAddr[i] + 4, g_mat_kapianGroups[6 + i].Cia2) writeQword(g_mat_cardDataAddr[i] + 8, g_mat_kapianGroups[6 + i].Cia3) writeQword(g_mat_cardDataAddr[i] + 12, g_mat_kapianGroups[6 + i].Cia4) writeQword(g_mat_cardDataAddr[i] + 16, g_mat_kapianGroups[6 + i].Cia5) writeQword(g_mat_cardDataAddr[i] + 20, g_mat_kapianGroups[6 + i].Cia6) end end gg.toast("已使用第7~12组数据替换加成器1~6") end elseif choice == 5 then exitMenu = true end end end if MXX == 2 then -- 通行证战争卡片 local exitMenu = false while not exitMenu do local choice = gg.choice({ "一键初始化", "自定义卡片数量", "1~8张卡片(第1~8组)", "9~16张卡片(第9~16组)", "17~24张卡片(第17~24组)", "返回首页" }, nil, "战争卡片 - 请选择操作") if choice == nil then exitMenu = true break end if choice == 1 then search(zytzm1,4,4~1~32~-2080896) py1(zytzm2, 4, 176) py1(zytzm3, 4, 188) py1(zytzm4, 4, 196) xg1(0, 4, 424, false) xg1(0, 4, 428, false) xg1(0, 4, 432, false) xg1(0, 4, 436, false) xg1(0, 4, 440, false) xg1(0, 4, 444, false) gg.toast("普通通行证已重复领取") gg.clearResults() gg.searchNumber(tostring(zytzm1), gg.TYPE_DWORD) local results = gg.getResults(2000) if #results == 0 then gg.toast("初始化失败") else local step1 = {} for _, v in ipairs(results) do if readDword(v.address + 176) == zytzm2 then table.insert(step1, v.address + 176) end end if #step1 == 0 then gg.toast("一级验证失败") else local step2 = {} for _, addr in ipairs(step1) do if readDword(addr + 12) == zytzm3 then table.insert(step2, addr + 12) end end if #step2 == 0 then gg.toast("二级验证失败") else local step3 = {} for _, addr in ipairs(step2) do if readDword(addr + 8) == zytzm4 then table.insert(step3, addr + 8) end end if #step3 == 0 then gg.toast("三级验证失败") else local originalAddr = step3[1] - 176 - 12 - 8 g_card_baseAddr = readQword(readQword(originalAddr + 128)) local quantityOffsets = {48, 208, 368, 528, 688, 848, 1008, 1168} for i, off in ipairs(quantityOffsets) do g_card_quantityAddr[i] = g_card_baseAddr + off g_card_replaceAddr1[i] = g_card_quantityAddr[i] - 16 g_card_cardDataAddr[i] = readQword(g_card_replaceAddr1[i]) end gg.clearResults() gg.searchNumber('1430583743', gg.TYPE_DWORD) gg.searchNumber('1430583743;1430583743::9', gg.TYPE_DWORD) local results2 = gg.getResults(10) if #results2 == 0 then gg.toast("获取卡片组失败") else local kpzz = readDword(readQword(results2[1].address + 16)) gg.clearResults() gg.searchNumber(tostring(kpzz), gg.TYPE_DWORD) local kpzzResults = gg.getResults(500) local validResults = {} for i, v in ipairs(kpzzResults) do local val = readDword(v.address + 24) if val and (val < -1000 or val > 1000) then table.insert(validResults, {address = v.address + 24, value = val}) end end g_card_kapianGroups = {} for idx, item in ipairs(validResults) do local ptrAddr = readQword(item.address) if ptrAddr and ptrAddr ~= 0 then g_card_kapianGroups[idx] = { via1 = readQword(ptrAddr + 0x0), via2 = readQword(ptrAddr + 0x4), via3 = readQword(ptrAddr + 0x8), via4 = readQword(ptrAddr + 0xC), ptrAddr = ptrAddr } end end gg.clearResults() gg.toast("初始化完成,共" .. #g_card_kapianGroups .. "组数据") end end end end end elseif choice == 2 then if #g_card_quantityAddr == 0 then gg.toast("请先执行【一键初始化】") else local curQty = {} for i = 1, #g_card_quantityAddr do curQty[i] = readDword(g_card_quantityAddr[i]) end local inputList = { "是否要重复领取", "批量修改数量", string.format("卡片1:%d", curQty[1]), string.format("卡片2:%d", curQty[2]), string.format("卡片3:%d", curQty[3]), string.format("卡片4:%d", curQty[4]), string.format("卡片5:%d", curQty[5]), string.format("卡片6:%d", curQty[6]), string.format("卡片7:%d", curQty[7]), string.format("卡片8:%d", curQty[8]), "无用值(保留)" } local defaultList = { false, "", tostring(curQty[1]), tostring(curQty[2]), tostring(curQty[3]), tostring(curQty[4]), tostring(curQty[5]), tostring(curQty[6]), tostring(curQty[7]), tostring(curQty[8]), "" } local inputTypes = { [1] = "checkbox", [2] = "number", [3] = "number", [4] = "number", [5] = "number", [6] = "number", [7] = "number", [8] = "number", [9] = "number", [10] = "number", [11] = "number" } local inputs = gg.prompt(inputList, defaultList, inputTypes) if inputs == nil then gg.toast("取消") else if inputs[1] == true then search(zytzm1,4,4~1~32~-2080896) py1(zytzm2, 4, 176) py1(zytzm3, 4, 188) py1(zytzm4, 4, 196) xg1(0, 4, 424, true) xg1(0, 4, 428, true) xg1(0, 4, 432, true) xg1(0, 4, 436, true) xg1(0, 4, 440, true) xg1(0, 4, 444, true) gg.toast("普通通行证已重复领取") end local batchValue = tonumber(inputs[2]) if batchValue and batchValue > 0 then for i = 1, #g_card_quantityAddr do if batchValue ~= curQty[i] then writeDword(g_card_quantityAddr[i], batchValue) end end gg.toast("批量修改完成:" .. batchValue) else for i = 1, #g_card_quantityAddr do local newVal = tonumber(inputs[i + 1]) if newVal and newVal ~= curQty[i] then writeDword(g_card_quantityAddr[i], newVal) end end gg.toast("自定义数量完成") end end end elseif choice == 3 then if #g_card_kapianGroups == 0 then gg.toast("请先初始化") elseif #g_card_kapianGroups < 8 then gg.toast("数据不足") else for i = 1, 8 do writeQword(g_card_cardDataAddr[i] + 0, g_card_kapianGroups[i].via1) writeQword(g_card_cardDataAddr[i] + 4, g_card_kapianGroups[i].via2) writeQword(g_card_cardDataAddr[i] + 8, g_card_kapianGroups[i].via3) writeQword(g_card_cardDataAddr[i] + 12, g_card_kapianGroups[i].via4) end gg.toast("已替换卡片1~8") end elseif choice == 4 then if #g_card_kapianGroups < 16 then gg.toast("数据不足") else for i = 1, 8 do writeQword(g_card_cardDataAddr[i] + 0, g_card_kapianGroups[8 + i].via1) writeQword(g_card_cardDataAddr[i] + 4, g_card_kapianGroups[8 + i].via2) writeQword(g_card_cardDataAddr[i] + 8, g_card_kapianGroups[8 + i].via3) writeQword(g_card_cardDataAddr[i] + 12, g_card_kapianGroups[8 + i].via4) end gg.toast("已替换卡片1~8(第9~16组)") end elseif choice == 5 then if #g_card_kapianGroups < 24 then gg.toast("数据不足") else for i = 1, 8 do writeQword(g_card_cardDataAddr[i] + 0, g_card_kapianGroups[16 + i].via1) writeQword(g_card_cardDataAddr[i] + 4, g_card_kapianGroups[16 + i].via2) writeQword(g_card_cardDataAddr[i] + 8, g_card_kapianGroups[16 + i].via3) writeQword(g_card_cardDataAddr[i] + 12, g_card_kapianGroups[16 + i].via4) end gg.toast("已替换卡片1~8(第17~24组)") end elseif choice == 6 then exitMenu = true end end end if MXX == 3 then -- 通行证产加成器 local exitMenu = false while not exitMenu do local choice = gg.choice({ "一键初始化", "自定义加成器数量", "1~7种加成器(第1~7组)", "8~14种加成器(第8~14组)", "15~21种加成器(第15~21组)", "返回首页" }, nil, "加成器") if choice == nil then exitMenu = true break end if choice == 1 then search(zytzm1,4,4~1~32~-2080896) py1(zytzm2, 4, 176) py1(zytzm3, 4, 188) py1(zytzm4, 4, 196) xg1(0, 4, 424, false) xg1(0, 4, 428, false) xg1(0, 4, 432, false) xg1(0, 4, 436, false) xg1(0, 4, 440, false) xg1(0, 4, 444, false) gg.toast("普通通行证已重复领取") gg.clearResults() gg.searchNumber(tostring(zytzm1), gg.TYPE_DWORD) local results = gg.getResults(2000) if #results == 0 then gg.toast("未找到结果") else local step1 = {} for _, v in ipairs(results) do if readDword(v.address + 176) == zytzm2 then table.insert(step1, v.address + 176) end end if #step1 == 0 then gg.toast("一级失败") else local step2 = {} for _, addr in ipairs(step1) do if readDword(addr + 12) == zytzm3 then table.insert(step2, addr + 12) end end if #step2 == 0 then gg.toast("二级失败") else local step3 = {} for _, addr in ipairs(step2) do if readDword(addr + 8) == zytzm4 then table.insert(step3, addr + 8) end end if #step3 == 0 then gg.toast("三级失败") else local originalAddr = step3[1] - 176 - 12 - 8 g_boost_baseAddr = readQword(readQword(originalAddr + 128)) local quantityOffsets = {48, 208, 368, 528, 688, 848, 1008} for i, off in ipairs(quantityOffsets) do g_boost_quantityAddr[i] = g_boost_baseAddr + off g_boost_replaceAddr1[i] = g_boost_quantityAddr[i] - 16 g_boost_cardDataAddr[i] = readQword(g_boost_replaceAddr1[i]) end gg.clearResults() gg.searchNumber('1965976282', gg.TYPE_DWORD) gg.searchNumber('1965976282;1965976282::9', gg.TYPE_DWORD) local results2 = gg.getResults(10) if #results2 == 0 then gg.toast("获取加成器组失败") else local kpzz = readDword(readQword(results2[1].address + 16)) gg.clearResults() gg.searchNumber(tostring(kpzz), gg.TYPE_DWORD) local kpzzResults = gg.getResults(500) local validResults = {} for i, v in ipairs(kpzzResults) do local val = readDword(v.address + 24) if val and (val < -1000 or val > 1000) then table.insert(validResults, {address = v.address + 24, value = val}) end end g_boost_kapianGroups = {} for idx, item in ipairs(validResults) do local ptrAddr = readQword(item.address) if ptrAddr and ptrAddr ~= 0 then g_boost_kapianGroups[idx] = { Cia1 = readQword(ptrAddr + 0x00), Cia2 = readQword(ptrAddr + 0x04), Cia3 = readQword(ptrAddr + 0x08), Cia4 = readQword(ptrAddr + 0x0C), Cia5 = readQword(ptrAddr + 0x10), Cia6 = readQword(ptrAddr + 0x14), ptrAddr = ptrAddr } end end gg.clearResults() gg.toast("初始化完成,共" .. #g_boost_kapianGroups .. "组") end end end end end elseif choice == 2 then if #g_boost_quantityAddr == 0 then gg.toast("请先初始化") else local curQty = {} for i = 1, #g_boost_quantityAddr do curQty[i] = readDword(g_boost_quantityAddr[i]) end local inputs = gg.prompt({ "是否重复领取", "批量修改数量", "加成器1:" .. curQty[1], "加成器2:" .. curQty[2], "加成器3:" .. curQty[3], "加成器4:" .. curQty[4], "加成器5:" .. curQty[5], "加成器6:" .. curQty[6], "加成器7:" .. curQty[7] }, {false, "", tostring(curQty[1]), tostring(curQty[2]), tostring(curQty[3]), tostring(curQty[4]), tostring(curQty[5]), tostring(curQty[6]), tostring(curQty[7])}, {[1] = "checkbox", [2] = "number", [3] = "number", [4] = "number", [5] = "number", [6] = "number", [7] = "number", [8] = "number", [9] = "number"}) if inputs == nil then gg.toast("取消") else if inputs[1] == true then search(zytzm1,4,4~1~32~-2080896) py1(zytzm2, 4, 176) py1(zytzm3, 4, 188) py1(zytzm4, 4, 196) xg1(0, 4, 424, true) xg1(0, 4, 428, true) xg1(0, 4, 432, true) xg1(0, 4, 436, true) xg1(0, 4, 440, true) xg1(0, 4, 444, true) gg.toast("普通通行证已重复领取") end local batch = tonumber(inputs[2]) if batch and batch > 0 then for i = 1, #g_boost_quantityAddr do writeDword(g_boost_quantityAddr[i], batch) end gg.toast("批量修改为" .. batch) else for i = 1, #g_boost_quantityAddr do local v = tonumber(inputs[i + 1]) if v then writeDword(g_boost_quantityAddr[i], v) end end gg.toast("自定义完成") end end end elseif choice == 3 then if #g_boost_kapianGroups == 0 then gg.toast("请先初始化") elseif #g_boost_kapianGroups < 7 then gg.toast("数据不足") else for i = 1, 7 do writeQword(g_boost_cardDataAddr[i] + 0, g_boost_kapianGroups[i].Cia1) writeQword(g_boost_cardDataAddr[i] + 4, g_boost_kapianGroups[i].Cia2) writeQword(g_boost_cardDataAddr[i] + 8, g_boost_kapianGroups[i].Cia3) writeQword(g_boost_cardDataAddr[i] + 12, g_boost_kapianGroups[i].Cia4) writeQword(g_boost_cardDataAddr[i] + 16, g_boost_kapianGroups[i].Cia5) writeQword(g_boost_cardDataAddr[i] + 20, g_boost_kapianGroups[i].Cia6) end gg.toast("已替换加成器1~7(第1~7组)") end elseif choice == 4 then if #g_boost_kapianGroups < 14 then gg.toast("数据不足") else for i = 1, 7 do writeQword(g_boost_cardDataAddr[i] + 0, g_boost_kapianGroups[7 + i].Cia1) writeQword(g_boost_cardDataAddr[i] + 4, g_boost_kapianGroups[7 + i].Cia2) writeQword(g_boost_cardDataAddr[i] + 8, g_boost_kapianGroups[7 + i].Cia3) writeQword(g_boost_cardDataAddr[i] + 12, g_boost_kapianGroups[7 + i].Cia4) writeQword(g_boost_cardDataAddr[i] + 16, g_boost_kapianGroups[7 + i].Cia5) writeQword(g_boost_cardDataAddr[i] + 20, g_boost_kapianGroups[7 + i].Cia6) end gg.toast("已替换加成器1~7(第8~14组)") end elseif choice == 5 then if #g_boost_kapianGroups < 21 then gg.toast("数据不足") else for i = 1, 7 do writeQword(g_boost_cardDataAddr[i] + 0, g_boost_kapianGroups[14 + i].Cia1) writeQword(g_boost_cardDataAddr[i] + 4, g_boost_kapianGroups[14 + i].Cia2) writeQword(g_boost_cardDataAddr[i] + 8, g_boost_kapianGroups[14 + i].Cia3) writeQword(g_boost_cardDataAddr[i] + 12, g_boost_kapianGroups[14 + i].Cia4) writeQword(g_boost_cardDataAddr[i] + 16, g_boost_kapianGroups[14 + i].Cia5) writeQword(g_boost_cardDataAddr[i] + 20, g_boost_kapianGroups[14 + i].Cia6) end gg.toast("已替换加成器1~7(第15~21组)") end elseif choice == 6 then exitMenu = true end end end if MXX == 4 then -- 工厂生产材料(修复悬浮窗隐藏) local menuItems = { "初始化", "数量设置", "自定义输入", "普通材料", "扩地材料", "战争材料", "战争加成器", "战争卡片", "OMG材料", "战争卡包", "返回首页" } local putongList = {} for name, _ in pairs(putongcl) do table.insert(putongList, name) end table.sort(putongList) table.insert(putongList, "返回上级") local kuodiList = {} for name, _ in pairs(kuodicl) do table.insert(kuodiList, name) end table.sort(kuodiList) table.insert(kuodiList, "返回上级") local zhanzhengList = {} for name, _ in pairs(zhanzhengcl) do table.insert(zhanzhengList, name) end table.sort(zhanzhengList) table.insert(zhanzhengList, "返回上级") local jiachengqiList = {} for name, _ in pairs(jiachengqicl) do table.insert(jiachengqiList, name) end table.sort(jiachengqiList) table.insert(jiachengqiList, "返回上级") local zhanzhengkpList = {} for name, _ in pairs(zhanzhengkpcl) do table.insert(zhanzhengkpList, name) end table.sort(zhanzhengkpList) table.insert(zhanzhengkpList, "返回上级") local omgList = {} for name, _ in pairs(omgcl) do table.insert(omgList, name) end table.sort(omgList) table.insert(omgList, "返回上级") local kabaoList = {} for name, _ in pairs(zhanzhrngkabaocl) do table.insert(kabaoList, name) end table.sort(kabaoList) table.insert(kabaoList, "返回上级") local title = "\n工厂生产材料 | V1.0\n【SVIP会员专属】\n" if shuliangAddr and wupindingweiAddr then title = title .. "✅ 已初始化" else title = title .. "⚠️ 未初始化,请先执行初始化" end -- 修复:添加 while 循环和 nil 判断 while true do local choice = gg.choice(menuItems, nil, title) if choice == nil then break end if choice == 1 then init() elseif choice == 2 then if not shuliangAddr then showError("请先执行初始化") else setCustomCount() end elseif choice == 3 then if not wupindingweiAddr then showError("请先初始化") else setCustomInput() end elseif choice == 4 then if not wupindingweiAddr then showError("请先初始化") else while true do local subChoice = gg.choice(putongList, nil, "========== 普通材料 ==========") if subChoice == nil or subChoice == #putongList then break elseif subChoice >= 1 and subChoice < #putongList then useMaterial(putongList[subChoice], putongcl) end end end elseif choice == 5 then if not wupindingweiAddr then showError("请先初始化") else while true do local subChoice = gg.choice(kuodiList, nil, "========== 扩地材料 ==========") if subChoice == nil or subChoice == #kuodiList then break elseif subChoice >= 1 and subChoice < #kuodiList then useMaterial(kuodiList[subChoice], kuodicl) end end end elseif choice == 6 then if not wupindingweiAddr then showError("请先初始化") else while true do local subChoice = gg.choice(zhanzhengList, nil, "========== 战争材料 ==========") if subChoice == nil or subChoice == #zhanzhengList then break elseif subChoice >= 1 and subChoice < #zhanzhengList then useMaterial(zhanzhengList[subChoice], zhanzhengcl) end end end elseif choice == 7 then if not wupindingweiAddr then showError("请先初始化") else while true do local subChoice = gg.choice(jiachengqiList, nil, "========== 战争加成器 ==========") if subChoice == nil or subChoice == #jiachengqiList then break elseif subChoice >= 1 and subChoice < #jiachengqiList then useMaterial(jiachengqiList[subChoice], jiachengqicl) end end end elseif choice == 8 then if not wupindingweiAddr then showError("请先初始化") else while true do local subChoice = gg.choice(zhanzhengkpList, nil, "========== 战争卡片 ==========") if subChoice == nil or subChoice == #zhanzhengkpList then break elseif subChoice >= 1 and subChoice < #zhanzhengkpList then useMaterial(zhanzhengkpList[subChoice], zhanzhengkpcl) end end end elseif choice == 9 then if not wupindingweiAddr then showError("请先初始化") else while true do local subChoice = gg.choice(omgList, nil, "========== OMG材料 ==========") if subChoice == nil or subChoice == #omgList then break elseif subChoice >= 1 and subChoice < #omgList then useMaterial(omgList[subChoice], omgcl) end end end elseif choice == 10 then if not wupindingweiAddr then showError("请先初始化") else while true do local subChoice = gg.choice(kabaoList, nil, "========== 战争卡包 ==========") if subChoice == nil or subChoice == #kabaoList then break elseif subChoice >= 1 and subChoice < #kabaoList then useMaterial(kabaoList[subChoice], zhanzhrngkabaocl) end end end elseif choice == 11 then break end end end if MXX == 5 then -- 市长通行证 szdl = gg.choice({ '1.通行证满级', '2.一键修改需数量', '3.返回首页' }, nil, '市长大楼') if szdl == nil then -- 点击空白处返回 elseif szdl == 1 then search(sztzm1,4,4~1~32~-2080896) py1(sztzm2,4,-188) py1(sztzm3,4,-12) py1(sztzm4,4,8) xg1(1121823710,4,232, false) gg.toast("市长通行证已经满级了,修改高级通行证可能会闪退重启就好了") elseif szdl == 2 then -- 1. 清空列表 gg.clearResults() -- 2. 设置内存范围为CA gg.setRanges(selectedRange) -- 3. 搜索sztzm2 gg.searchNumber(tostring(sztzm2), 4) local count = gg.getResultsCount() gg.toast("正在搜索链条,请耐心等待") if count == 0 then gg.clearResults() gg.alert("搜索失败,未找到sztzm2") return end -- 保存所有结果 local allResults = gg.getResults(count) ----print("搜索到 " .. count .. " 个结果,开始筛选...") -- 4. 一次性读取所有偏移176的值(批量读取加速) local batchSize = 100 local step2Results = {} local totalCount = #allResults for i = 1, totalCount, batchSize do local batchEnd = math.min(i + batchSize - 1, totalCount) local readList = {} for j = i, batchEnd do table.insert(readList, {address = allResults[j].address + 176, flags = 4}) end local batchValues = gg.getValues(readList) for j, val in ipairs(batchValues) do if val and val.value == sztzm3 then local idx = i + j - 1 table.insert(step2Results, { originalAddr = allResults[idx].address, offsetAddr = allResults[idx].address + 176, offsetValue = val.value }) end end if i % 1000 == 0 then --print(" 处理中: " .. i .. "/" .. totalCount) end end if #step2Results == 0 then gg.clearResults() gg.alert("未找到符合条件的sztzm3") return end --print("找到 " .. #step2Results .. " 个sztzm3结果") -- 5. 批量读取偏移+12的值 local step3Results = {} totalCount = #step2Results for i = 1, totalCount, batchSize do local batchEnd = math.min(i + batchSize - 1, totalCount) local readList = {} for j = i, batchEnd do table.insert(readList, {address = step2Results[j].offsetAddr + 12, flags = 4}) end local batchValues = gg.getValues(readList) for j, val in ipairs(batchValues) do if val and val.value == sztzm1 then local idx = i + j - 1 table.insert(step3Results, { originalAddr = step2Results[idx].originalAddr, addrsztzm3 = step2Results[idx].offsetAddr, offsetAddr = step2Results[idx].offsetAddr + 12, offsetValue = val.value }) end end end if #step3Results == 0 then gg.clearResults() gg.alert("未找到符合条件的sztzm1") return end --print("找到 " .. #step3Results .. " 个sztzm1结果") -- 6. 批量读取偏移+8的值 local step4Results = {} totalCount = #step3Results for i = 1, totalCount, batchSize do local batchEnd = math.min(i + batchSize - 1, totalCount) local readList = {} for j = i, batchEnd do table.insert(readList, {address = step3Results[j].offsetAddr + 8, flags = 4}) end local batchValues = gg.getValues(readList) for j, val in ipairs(batchValues) do if val and val.value == sztzm4 then local idx = i + j - 1 table.insert(step4Results, { originalAddr = step3Results[idx].originalAddr, addrsztzm3 = step3Results[idx].addrsztzm3, addrsztzm1 = step3Results[idx].offsetAddr, offsetAddr = step3Results[idx].offsetAddr + 8, offsetValue = val.value }) end end end if #step4Results == 0 then gg.clearResults() gg.alert("未找到符合条件的sztzm4") return end --print("找到 " .. #step4Results .. " 个sztzm4结果") -- 7. 批量读取偏移-116的Q值指针 local step5Results = {} totalCount = #step4Results for i = 1, totalCount, batchSize do local batchEnd = math.min(i + batchSize - 1, totalCount) local readList = {} for j = i, batchEnd do table.insert(readList, {address = step4Results[j].offsetAddr - 116, flags = gg.TYPE_QWORD}) end local batchValues = gg.getValues(readList) for j, val in ipairs(batchValues) do if val and val.value ~= 0 then local idx = i + j - 1 table.insert(step5Results, { originalAddr = step4Results[idx].originalAddr, addrsztzm4 = step4Results[idx].offsetAddr, ptrValue = val.value }) end end end if #step5Results == 0 then gg.clearResults() gg.alert("未找到有效的指针") return end --print("找到 " .. #step5Results .. " 个有效指针") -- 8. 批量读取偏移48的值,判断是否等于3000 local finalResults = {} totalCount = #step5Results for i = 1, totalCount, batchSize do local batchEnd = math.min(i + batchSize - 1, totalCount) local readList = {} for j = i, batchEnd do table.insert(readList, {address = step5Results[j].ptrValue + 48, flags = 4}) end local batchValues = gg.getValues(readList) for j, val in ipairs(batchValues) do if val then local idx = i + j - 1 if val.value == 3000 then table.insert(finalResults, { finalAddr = step5Results[idx].ptrValue + 48, ptrValue = step5Results[idx].ptrValue, value = val.value }) end end end end --print("偏移48后共有 " .. totalCount .. " 个结果") if #finalResults == 0 then --print("未找到值为3000的结果") gg.clearResults() gg.alert("检测到你未进入市长通行证,或版本已失效") return end --print("找到 " .. #finalResults .. " 个值为3000的结果") -- 9. 加载偏移48后值为3000的结果 --print("\n--- 加载偏移48后的3000结果 ---") local resultList = {} for i, v in ipairs(finalResults) do table.insert(resultList, { address = v.finalAddr, flags = 4, value = v.value }) --print(string.format(" 结果%d: 地址=0x%X, 数值=%d", i, v.finalAddr, v.value)) end gg.loadResults(resultList) --print("✓ 已加载 " .. #resultList .. " 个3000结果") -- 10. 偏移160,保存为saijibi --print("\n--- 偏移160,保存为saijibi ---") local saijibi = {} for i, v in ipairs(resultList) do local targetAddr = v.address + 160 local targetValue = gg.getValues({{address = targetAddr, flags = 4}}) if targetValue and targetValue[1] then table.insert(saijibi, { address = targetAddr, flags = 4, value = targetValue[1].value }) end end --print("saijibi共 " .. #saijibi .. " 个结果") -- 11. saijibi偏移160,保存为xinshijibi --print("\n--- saijibi偏移160,保存为xinshijibi ---") local xinshijibi = {} for i, v in ipairs(saijibi) do local targetAddr = v.address + 160 local targetValue = gg.getValues({{address = targetAddr, flags = 4}}) if targetValue and targetValue[1] then table.insert(xinshijibi, { address = targetAddr, flags = 4, value = targetValue[1].value }) end end --print("xinshijibi共 " .. #xinshijibi .. " 个结果") -- 12. xinshijibi偏移160,保存为linshicangku --print("\n--- xinshijibi偏移160,保存为linshicangku ---") local linshicangku = {} for i, v in ipairs(xinshijibi) do local targetAddr = v.address + 160 local targetValue = gg.getValues({{address = targetAddr, flags = 4}}) if targetValue and targetValue[1] then table.insert(linshicangku, { address = targetAddr, flags = 4, value = targetValue[1].value }) end end --print("linshicangku共 " .. #linshicangku .. " 个结果") -- 13. linshicangku偏移4000,保存为jinyaoshi --print("\n--- linshicangku偏移4000,保存为jinyaoshi ---") local jinyaoshi = {} for i, v in ipairs(linshicangku) do local targetAddr = v.address + 4000 local targetValue = gg.getValues({{address = targetAddr, flags = 4}}) if targetValue and targetValue[1] then table.insert(jinyaoshi, { address = targetAddr, flags = 4, value = targetValue[1].value }) end end --print("jinyaoshi共 " .. #jinyaoshi .. " 个结果") -- 14. jinyaoshi偏移1120,保存为yinyaoshi --print("\n--- jinyaoshi偏移1120,保存为yinyaoshi ---") local yinyaoshi = {} for i, v in ipairs(jinyaoshi) do local targetAddr = v.address + 1120 local targetValue = gg.getValues({{address = targetAddr, flags = 4}}) if targetValue and targetValue[1] then table.insert(yinyaoshi, { address = targetAddr, flags = 4, value = targetValue[1].value }) end end --print("yinyaoshi共 " .. #yinyaoshi .. " 个结果") -- 15. yinyaoshi偏移320,保存为lvchao --print("\n--- yinyaoshi偏移320,保存为lvchao ---") local lvchao = {} for i, v in ipairs(yinyaoshi) do local targetAddr = v.address + 320 local targetValue = gg.getValues({{address = targetAddr, flags = 4}}) if targetValue and targetValue[1] then table.insert(lvchao, { address = targetAddr, flags = 4, value = targetValue[1].value }) end end --print("lvchao共 " .. #lvchao .. " 个结果") -- 16. 加载jinyaoshi,偏移-136,保存为xsjdm --print("\n--- 加载jinyaoshi,偏移-136,保存为xsjdm ---") gg.loadResults(jinyaoshi) local jinyaoshiLoaded = gg.getResults(#jinyaoshi) local xsjdm = {} for i, v in ipairs(jinyaoshiLoaded) do local targetAddr = v.address - 136 local targetValue = gg.getValues({{address = targetAddr, flags = 4}}) if targetValue and targetValue[1] then table.insert(xsjdm, { address = targetAddr, flags = 4, value = targetValue[1].value }) end end --print("xsjdm共 " .. #xsjdm .. " 个结果") -- 17. 加载xinshijibi,偏移-16,替换为xsjdm的值 --print("\n--- 加载xinshijibi,偏移-16,替换为xsjdm的值 ---") gg.loadResults(xinshijibi) local xinshijibiLoaded = gg.getResults(#xinshijibi) for i, v in ipairs(xinshijibiLoaded) do local targetAddr = v.address - 16 if i <= #xsjdm then gg.setValues({{address = targetAddr, flags = 4, value = xsjdm[i].value}}) end end -- 18. 自定义数值输入(带勾选功能) --print("\n--- 自定义数值输入 ---") local txzzdy = gg.prompt({ '金币', '赛季币', '临仓', '新币', '金钥', '银钥', '绿钞', '统一修改(勾选后上方1~7无效)' }, { [1] = '', [2] = '', [3] = '', [4] = '', [5] = '', [6] = '', [7] = '', [8] = '' }, { [1] = 'number', [2] = 'number', [3] = 'number', [4] = 'number', [5] = 'number', [6] = 'number', [7] = 'number', [8] = 'number' }) if not txzzdy then --print("已取消修改") return end -- 19. 判断是否有勾选统一修改 local isUnified = false if txzzdy[8] and txzzdy[8] ~= "" then isUnified = true --print("已启用统一修改模式,统一值为: " .. txzzdy[8]) else --print("使用单独修改模式") end -- 20. 根据输入修改对应值 --print("\n--- 开始修改数值 ---") if isUnified then local unifiedValue = txzzdy[8] for i, v in ipairs(resultList) do gg.setValues({{address = v.address, flags = 4, value = unifiedValue}}) end for i, v in ipairs(saijibi) do gg.setValues({{address = v.address, flags = 4, value = unifiedValue}}) end for i, v in ipairs(linshicangku) do gg.setValues({{address = v.address, flags = 4, value = unifiedValue}}) end for i, v in ipairs(xinshijibi) do gg.setValues({{address = v.address, flags = 4, value = unifiedValue}}) end for i, v in ipairs(jinyaoshi) do gg.setValues({{address = v.address, flags = 4, value = unifiedValue}}) end for i, v in ipairs(yinyaoshi) do gg.setValues({{address = v.address, flags = 4, value = unifiedValue}}) end for i, v in ipairs(lvchao) do gg.setValues({{address = v.address, flags = 4, value = unifiedValue}}) end --print("统一修改完成,所有项已修改为: " .. unifiedValue) else if txzzdy[1] and txzzdy[1] ~= "" then for i, v in ipairs(resultList) do gg.setValues({{address = v.address, flags = 4, value = txzzdy[1]}}) end end if txzzdy[2] and txzzdy[2] ~= "" then for i, v in ipairs(saijibi) do gg.setValues({{address = v.address, flags = 4, value = txzzdy[2]}}) end end if txzzdy[3] and txzzdy[3] ~= "" then for i, v in ipairs(linshicangku) do gg.setValues({{address = v.address, flags = 4, value = txzzdy[3]}}) end end if txzzdy[4] and txzzdy[4] ~= "" then for i, v in ipairs(xinshijibi) do gg.setValues({{address = v.address, flags = 4, value = txzzdy[4]}}) end end if txzzdy[5] and txzzdy[5] ~= "" then for i, v in ipairs(jinyaoshi) do gg.setValues({{address = v.address, flags = 4, value = txzzdy[5]}}) end end if txzzdy[6] and txzzdy[6] ~= "" then for i, v in ipairs(yinyaoshi) do gg.setValues({{address = v.address, flags = 4, value = txzzdy[6]}}) end end if txzzdy[7] and txzzdy[7] ~= "" then for i, v in ipairs(lvchao) do gg.setValues({{address = v.address, flags = 4, value = txzzdy[7]}}) end gg.alert("已经完成修改,点击领取任何一个物品将会显示出修改的数值") gg.clearResults() end --print("单独修改完成") --gg.alert("未找到符合条件的sztzm3") --print("\n✓ 修改完成!") -- gg.alert("修改完成!") end elseif szdl == 3 then -- 返回 end end if MXX == 6 then -- 章鱼通行证 zyguai = gg.choice({ '1.满级通行证', '2.再领一次通行证', '3.返回首页' }, nil, '章鱼通行证') if zyguai == nil then -- 点击空白处返回 elseif zyguai == 1 then search(zytzm1,4,4~1~32~-2080896) py1(zytzm2, 4, 176) py1(zytzm3, 4, 188) py1(zytzm4, 4, 196) xg1(0, 4, 416, false) xg1(0, 4, 420, false) gg.toast("章鱼哥投降了通行证满级了") elseif zyguai == 2 then local zhangytxzlpfs = gg.multiChoice({'普通通行证重复领取', '高精通行证重复领取'}) if zhangytxzlpfs == nil then -- 取消 elseif zhangytxzlpfs[1] == true then search(zytzm1,4,4~1~32~-2080896) py1(zytzm2, 4, 176) py1(zytzm3, 4, 188) py1(zytzm4, 4, 196) xg1(0, 4, 424, true) xg1(0, 4, 428, true) xg1(0, 4, 432, true) xg1(0, 4, 436, true) xg1(0, 4, 440, true) xg1(0, 4, 444, true) gg.toast("普通通行证以重复领取") elseif zhangytxzlpfs[2] == true then search(zytzm1,4,4~1~32~-2080896) py1(zytzm2, 4, 176) py1(zytzm3, 4, 188) py1(zytzm4, 4, 196) xg1(0, 4, 448, true) xg1(0, 4, 452, true) xg1(0, 4, 456, true) xg1(0, 4, 460, true) xg1(0, 4, 464, true) xg1(0, 4, 468, true) gg.toast("高级通行证以重复领取") end elseif zyguai == 3 then -- 返回 end end if MXX == 7 then gg.clearResults() print("退出脚本") os.exit() end end end --=================== 启动入口 ==================== startup_check() daily_clean() MainMenu() --=================== 主循环(修复悬浮窗隐藏)=================== local XGCK while true do if gg.isVisible(true) then XGCK = 1 gg.setVisible(false) end gg.clearResults() if XGCK == 1 then Main_Function() XGCK = -1 end gg.sleep(100) end