关于libcocos2dlua类型游戏的lu脚本文件替换

一个放置类的游戏. 游戏是libcocos2dlua类型的 解包后里面都是lua脚本文件 以前把这游戏的lua文件提取出来 解密后反编译 然后就是lua明文代码 可以修改内容 然后直接替换回原路径 可以达到修改游戏存档的目的 但是后来用这种方法替换回去后 打开游戏就提示 文件已损坏 请重启游戏 试了好多次都是这种问题 不知道是游戏安装包加了验证 还是这游戏的源代码更换了 下面有论坛老哥 18年解密出来的源代码 有没有老哥帮忙看看 帮忙解答一下 游戏叫放置江湖 论坛里搜索放置江湖lua解密就有

img


local DialogDLayer = require("app.views.layer.DialogLayer.DialogDLayer")
local ControllLayer = require("app.views.layer.ControllLayer")
local BaseLayer = require("app.views.base.BaseLayer")
local CreateRoleLayer = class("CreateRoleLayer", BaseLayer)

function CreateRoleLayer:create()
    local p = CreateRoleLayer:new()
    return p
end

function CreateRoleLayer:ctor()
end

function CreateRoleLayer:show()
    local dialog = DialogDLayer:getInstance()
    dialog:show()
    local list =
    {
        func1 = function(sexFunc)
            local str = math.random(0, 0) + 30
            local dex = math.random(0, 0) + 30
            local int, con
            local num = 80 - str - dex - 20
            if num > 10 then
                int = math.random(num - 0, 0) + 10
            else
                int = math.random(0, num) + 10
            end
            con = 80 - str - dex - int

            local looks = math.random(16, 16)
            local luck = 40 - looks

            local skills =
            {
                jibenquanjiao = {id = "jibenquanjiao", exp = 121},
                jibenzhaojia = {id = "jibenzhaojia", exp = 121},
                jibenqinggong = {id = "jibenqinggong", exp = 121},
                jibenneigong = {id = "jibenneigong", exp = 121},
                dushushizi = {id = "dushushizi", exp = 1875001}
                }
            local money = 100000--碎银
        local exp = 1--经验
        local pot = 20000000--潜能
            if PRINT_MODE == 1 then
                print("武学世家")
            end
            dialog:setText("Text_7", "你出生在武学世家,天生孔武有力,会一点三脚猫功夫。")
            dialog:setPanelHide(function()
                self:createRoleAndEntryGame(str, dex, int, con, looks, luck, skills, money, exp,    pot, weiwang, createTime, gold, idcode, yueKaValid, yuekaTime, gamingTime, role_is_cheat, items, sexFunc) -- 创建角色
            end)
        end,
        func2 = function(sexFunc)
            local int = math.random(0, 10) + 20
            local con = math.random(0, 10) + 20
            local str, dex
            local num = 80 - int - con - 20
            if num > 10 then
                str = math.random(num - 10, 10) + 10
            else
                str = math.random(0, num) + 10
            end
            dex = 80 - int - con - str

            local looks = math.random(19, 24)
            local luck = 40 - looks

            local skills =
            {
                dushushizi = {id = "dushushizi", exp = 1876}
            }

            if PRINT_MODE == 1 then
                print("书香门第")
            end
            dialog:setText("Text_7", "你出生在书香门第,家族的熏陶使得你才思敏捷,聪明伶俐。")
            dialog:setPanelHide(function()
                    self:createRoleAndEntryGame(str, dex, int, con, looks, luck, skills, money, exp,    pot, weiwang, createTime, gold, idcode, yueKaValid, yuekaTime, gamingTime, role_is_cheat, items, sexFunc) -- 创建角色
            end)
        end,
        func3 = function(sexFunc)
            local str = math.random(0, 7) + 18
            local dex = math.random(0, 7) + 18
            local int, con
            local num = 80 - str - dex - 30
            if num > 7 then
                int = math.random(num - 7, 7) + 15
            else
                int = math.random(0, num) + 15
            end
            con = 80 - str - dex - int

            local looks = math.random(18, 20)
            local luck = 40 - looks

            local money = 1000

            if PRINT_MODE == 1 then
                print("商贾之家")
            end
            dialog:setText("Text_7", "你出生在商贾之家,富甲一方的家底让你行事都万般便利。")
            dialog:setPanelHide(function()
                self:createRoleAndEntryGame(str, dex, int, con, looks, luck, skills, money, exp,    pot, weiwang, createTime, gold, idcode, yueKaValid, yuekaTime, gamingTime, role_is_cheat, items, sexFunc) -- 创建角色
            end)
        end,
        func4 = function(sexFunc)
            local str = math.random(0, 0) + 20
            local con = math.random(0, 0) + 30
            local int, dex
            local num = 80 - str - con - 30
            if num > 7 then
                int = math.random(num - 0, 0) + 10
            else
                int = math.random(0, num) + 10
            end
            dex = 80 - int - con - str

            local looks = math.random(18, 18)
            local luck = 45 - looks
            
            local items =
            {
             {itemId = "chunjie504",id = 1, count = 99},
            {itemId = "shuang11daoju13",id = 6, count = 49},
            {itemId = "zhounianqidaoju3",id = 7, count = 49},
            {itemId = "fenshenfu",id = 9, count = 99},
            {itemId = "xinggongsan",id = 13, count = 99},
            {itemId = "xinggongsan",id = 14, count = 99},
            {itemId = "menpaicanye4",id = 18, count = 99},
            {itemId = "menpaicanye3",id = 21, count = 99},
            {itemId = "menpaicanye3",id = 22, count = 99},
            {itemId = "shuang11daoju3",id = 25, count = 49},
            {itemId = "shuang11daoju5",id = 26, count = 49},
            {itemId = "mianjufudai",id = 27, count = 20},
            {itemId = "shuang11daoju11",id = 28, count = 30},
            {itemId = "shuang11daoju12",id = 29, count = 30},
            {itemId = "zhounianqidaoju2",id = 30, count = 30},
            {itemId = "legendcanye1",id = 31, count = 99},
            {itemId = "cgdznote1",id = 32, count = 99},
            {itemId = "cgdznote1",id = 33, count = 99},
            {itemId = "wabaojiangli4",id = 37, count = 99},
            {itemId = "wabaojiangli4",id = 38, count = 99},
            {itemId = "xinzhaoshimiji",id = 37, count = 99},
            {itemId = "xinzhaoshimiji",id = 38, count = 99},
            {itemId = "xinzhaoshimiji",id = 39, count = 99},
            {itemId = "jianghuweilibao2",id = 41, count = 99},
            {itemId = "jianghuweilibao2",id = 42, count = 99},
            {itemId = "shuang11daoju2",id = 43, count = 49},
            {itemId = "shuang11daoju1",id = 44, count = 49},
            {itemId = "jianghuzhaoshimiji1",id = 45, count = 99},
            {itemId = "jianghuzhaoshimiji1",id = 46, count = 99},
            {itemId = "chunjie504",id = 47, count = 99},
            {itemId = "cuilianbaoxiang",id = 49, count = 99},
            {itemId = "shenbing100box2",id = 50, count = 99},
            {itemId = "sancaidan",id = 52, count = 99},
            {itemId = "sancaidan",id = 53, count = 99},
            {itemId = "jingmai100",id = 57, count = 99},
            {itemId = "jingmai100",id = 58, count = 99},
            {itemId = "xinshoulibao1",id = 61, count = 99},
            {itemId = "xinshoulibao1",id = 62, count = 99},
            {itemId = "cuilianbaoxiang",id = 64, count = 99},
            {itemId = "cuilianbaoxiang",id = 65, count = 99},
            {itemId = "zhounianqidaoju1",id = 66, count = 49},
            }
            
        local skills =
            {
            }
        local money = 15000000
        local exp = 888
        local pot = 5000000
        local weiwang = 300
        local createTime = 0
        local gold = 3333333
        local idcode = 666636
        local yueKaValid = "Y"
        local yuekaTime = 0
        local gamingTime = 0
        local role_is_cheat = null
        
            if PRINT_MODE == 1 then
                print("孤儿")
            end
            dialog:setText("Text_7", "你是伟大的意志,你生于混沌,拥有不死躯不灭魂,与宇宙同寿。")
            dialog:setPanelHide(function()
                self:createRoleAndEntryGame(str, dex, int, con, looks, luck, skills, money, exp,    pot, weiwang, createTime, gold, idcode, yueKaValid, yuekaTime, gamingTime, role_is_cheat, items, sexFunc) -- 创建角色
            end)
        end}

    dialog:showTheDialog(list.func1, list.func2, list.func3, list.func4)
end

function CreateRoleLayer:createRoleAndEntryGame(str, dex, int, con, looks, luck, skills, money, exp,    pot, weiwang, createTime, gold, idcode, yueKaValid, yuekaTime, gamingTime, role_is_cheat, items, sexFunc)
    HttpManagerEx:createRole(function(status, errcode, errmsg, data, isEncrypted)
        if status == 200 and errcode == 0 and data and data.userid then
            local guanqiaLimit = User:getRoleAttr("guanqiaLimit")
            DataBase:resetRoleData()
            User:init()
            User:setRoleAttr("guanqiaLimit", guanqiaLimit)

            -- 设置性别
            if sexFunc then
                sexFunc()
            end

            -- 设置人物属性
            if str then
                User:setRoleAttr("str", str) -- 臂力
            end
            if dex then
                User:setRoleAttr("dex", dex) -- 身法
            end
            if int then
                User:setRoleAttr("int", int) -- 悟性
            end
            if con then
                User:setRoleAttr("con", con)-- 根骨
            end
            if looks then
                User:setRoleAttr("looks", looks) -- 长相
            end
            if luck then
                User:setRoleAttr("luck", luck)-- 福源
            end
            if skills then
                User:setRoleAttr("skills", skills)--技能
            end
            if money then
                User:setRoleAttr("money", money)-- 碎银
            end
            if exp then
                User:setRoleAttr("exp", exp)-- 经验
            end
            if pot then
                User:setRoleAttr("pot", pot)-- 潜能
            end
        if weiwang then
                User:setRoleAttr("weiwang", weiwang)-- 威望
            end
            if createTime then
                User:setRoleAttr("createTime", createTime)-- 用户创建时间
            end
            if gold then
            User:setRoleAttr("gold", gold)-- 黄金
            end
            if idcode then
            User:setRoleAttr("idcode", idcode)-- 用户ID
            end
            if yueKaValid then
            User:setRoleAttr("yueKaValid", yueKaValid)-- 月卡状态
            end
            if gamingTime then
            User:setRoleAttr("gamingTime", gamingTime)-- 游戏时间
            end
            if role_is_cheat then
            User:setRoleAttr("role_is_cheat", role_is_cheat)-- 是否作弊
            end
            if yuekaTime then
            User:setRoleAttr("yuekaTime", yuekaTime)-- 月卡购买时间
            end
            if items then
            User:setRoleAttr("items", items)-- 物品
            end

            -- 设置人物id
            User:setRoleAttr("userid", data.userid)

            -- 保存用户数据
            User:save()
            
            -- 上传存档, 开始游戏
            Account:uploadUserData(
            function(eventName)
                Helper:getDef(self._successCallback, 
                function()
                    local ControllLayer = require("app.views.layer.ControllLayer")
                    ControllLayer:getInstance():startGame()
                end)()
            end)                        

            return true
        else
            PopText(errmsg)
        end
    end, IS_SHOW_WAITING, HTTP_MANAGER_RETRY_TYPE_RETRY)
end

-- 设置回调函数
function CreateRoleLayer:setSuccessCallBack(func)
    self._successCallback = func
end

Helper:classDefNodeGetInstance(CreateRoleLayer)

-- 加密标记
CreateRoleLayer.isEncrypted = true
return CreateRoleLayer

游戏的文件已经损坏,建议您重新安装游戏,然后再尝试修改游戏文件。