|
(四)现在就可以将之前导出的Excel表格数据再导入进去(用快速导出和导入,要不然会很慢,记得点击保存。) (五)修改jymain.lua主游戏文件中的代码,这里要修改很多,光修改生命和内存,改的少,修改经验就麻烦。 1. 首先找到function LoadRecord(id)这个函数,然后在他前面新增增加两段代码,我用红色标出来。 --新增加的对生命最大值支持的两段代码 function SaveLife() for i = 0,JY.PersonNum-1 do JY.Person["生命str"] = tostring(JY.Person["生命"]) JY.Person["生命最大值str"] = tostring(JY.Person["生命最大值"]) JY.Person["内力str"] = tostring(JY.Person["内力"]) JY.Person["内力最大值str"] = tostring(JY.Person["内力最大值"]) -- 新增:经验 JY.Person["经验str"] = tostring(JY.Person["经验"]) end end function LoadLife() for i = 0,JY.PersonNum-1 do JY.Person["生命"] = tonumber(JY.Person["生命str"]) JY.Person["生命最大值"] = tonumber(JY.Person["生命最大值str"]) JY.Person["内力"] = tonumber(JY.Person["内力str"]) JY.Person["内力最大值"] = tonumber(JY.Person["内力最大值str"]) -- 新增:经验 JY.Person["经验"] = tonumber(JY.Person["经验str"]) end end function LoadRecord(id) local t1 = lib.GetTime() local data = Byte.create(24) Byte.loadfile(data, CC.R_IDXFilename[0], 0, 24) local idx = {} idx[0] = 0 for i = 1, 6 do idx = Byte.get32(data, 4 * (i - 1)) end JY.Data_Base = Byte.create(idx[1] - idx[0]) Byte.loadfile(JY.Data_Base, CC.R_GRPFilename[id], idx[0], idx[1] -idx[0]) local meta_t = { __index = function(t, k) return GetDataFromStruct(JY.Data_Base, 0, CC.Base_S, k) end, __newindex = function(t, k, v) SetDataFromStruct(JY.Data_Base, 0, CC.Base_S, k, v) end } setmetatable(JY.Base, meta_t) JY.PersonNum = math.floor((idx[2] - idx[1]) / CC.PersonSize) JY.Data_Person = Byte.create(CC.PersonSize * JY.PersonNum) Byte.loadfile(JY.Data_Person, CC.R_GRPFilename[id], idx[1],CC.PersonSize * JY.PersonNum) for i = 0, JY.PersonNum - 1 do JY.Person = {} local meta_t = { __index = function(t, k) return GetDataFromStruct(JY.Data_Person, i * CC.PersonSize, CC.Person_S,k) end, __newindex = function(t, k, v) SetDataFromStruct(JY.Data_Person, i * CC.PersonSize, CC.Person_S, k, v) end } setmetatable(JY.Person, meta_t) end JY.ThingNum = math.floor((idx[3] - idx[2]) / CC.ThingSize) JY.Data_Thing = Byte.create(CC.ThingSize * JY.ThingNum) Byte.loadfile(JY.Data_Thing, CC.R_GRPFilename[id], idx[2], CC.ThingSize* JY.ThingNum) for i = 0, JY.ThingNum - 1 do JY.Thing = {} local meta_t = { __index = function(t, k) return GetDataFromStruct(JY.Data_Thing, i * CC.ThingSize, CC.Thing_S, k) end, __newindex = function(t, k, v) SetDataFromStruct(JY.Data_Thing, i * CC.ThingSize, CC.Thing_S, k, v) end } setmetatable(JY.Thing, meta_t) end JY.SceneNum = math.floor((idx[4] - idx[3]) / CC.SceneSize) JY.Data_Scene = Byte.create(CC.SceneSize * JY.SceneNum) Byte.loadfile(JY.Data_Scene, CC.R_GRPFilename[id], idx[3], CC.SceneSize* JY.SceneNum) for i = 0, JY.SceneNum - 1 do JY.Scene = {} local meta_t = { __index = function(t, k) return GetDataFromStruct(JY.Data_Scene, i * CC.SceneSize, CC.Scene_S, k) end, __newindex = function(t, k, v) SetDataFromStruct(JY.Data_Scene, i * CC.SceneSize, CC.Scene_S, k, v) end } setmetatable(JY.Scene, meta_t) end JY.WugongNum = math.floor((idx[5] - idx[4]) / CC.WugongSize) JY.Data_Wugong = Byte.create(CC.WugongSize * JY.WugongNum) Byte.loadfile(JY.Data_Wugong, CC.R_GRPFilename[id], idx[4],CC.WugongSize * JY.WugongNum) for i = 0, JY.WugongNum - 1 do JY.Wugong = {} local meta_t = { __index = function(t, k) return GetDataFromStruct(JY.Data_Wugong, i * CC.WugongSize, CC.Wugong_S,k) end, __newindex = function(t, k, v) SetDataFromStruct(JY.Data_Wugong, i * CC.WugongSize, CC.Wugong_S, k, v) end } setmetatable(JY.Wugong, meta_t) end JY.ShopNum = math.floor((idx[6] - idx[5]) / CC.ShopSize) JY.Data_Shop = Byte.create(CC.ShopSize * JY.ShopNum) Byte.loadfile(JY.Data_Shop, CC.R_GRPFilename[id], idx[5], CC.ShopSize *JY.ShopNum) for i = 0, JY.ShopNum - 1 do JY.Shop = {} local meta_t = { __index = function(t, k) return GetDataFromStruct(JY.Data_Shop, i * CC.ShopSize, CC.Shop_S, k) end, __newindex = function(t, k, v) SetDataFromStruct(JY.Data_Shop, i * CC.ShopSize, CC.Shop_S, k, v) end } setmetatable(JY.Shop, meta_t) end loadglts(id) lib.LoadSMap(CC.S_Filename[id], CC.TempS_Filename, JY.SceneNum,CC.SWidth, CC.SHeight, CC.D_Filename[id], CC.DNum, 11) collectgarbage() JubenBugFix() lib.Debug(string.format("Loadrecord time=%d", lib.GetTime() -t1)) LoadLife() --新增加的对生命最大值支持的代码 end function SaveRecord(id) SaveLife() --新增加的对生命最大值支持的代码 local t1 = lib.GetTime() local data = Byte.create(24) Byte.loadfile(data, CC.R_IDXFilename[0], 0, 24) local idx = {} idx[0] = 0 for i = 1, 6 do idx = Byte.get32(data, 4 * (i - 1)) end os.remove(CC.R_GRPFilename[id]) os.remove(CC.S_Filename[id]) os.remove(CC.D_Filename[id]) if JY.Status == GAME_SMAP then JY.Base["无用"] = JY.SubScene else JY.Base["无用"] = -1 end Byte.savefile(JY.Data_Base, CC.R_GRPFilename[id], idx[0], idx[1] -idx[0]) Byte.savefile(JY.Data_Person, CC.R_GRPFilename[id], idx[1],CC.PersonSize * JY.PersonNum) Byte.savefile(JY.Data_Thing, CC.R_GRPFilename[id], idx[2], CC.ThingSize* JY.ThingNum) Byte.savefile(JY.Data_Scene, CC.R_GRPFilename[id], idx[3], CC.SceneSize* JY.SceneNum) Byte.savefile(JY.Data_Wugong, CC.R_GRPFilename[id], idx[4],CC.WugongSize * JY.WugongNum) Byte.savefile(JY.Data_Shop, CC.R_GRPFilename[id], idx[5], CC.ShopSize *JY.ShopNum) lib.SaveSMap(CC.S_Filename[id], CC.D_Filename[id]) saveglts(id) lib.Debug(string.format("SaveRecord time=%d", lib.GetTime() -t1)) end function filelength(filename) local inp = io.open(filename, "rb") local l = inp:seek("end") inp:close() return l end function GetS(id, x, y, level) return lib.GetS(id, x, y, level) end function SetS(id, x, y, level, v) lib.SetS(id, x, y, level, v) end function GetD(Sceneid, id, i) return lib.GetD(Sceneid, id, i) end function SetD(Sceneid, id, i, v) lib.SetD(Sceneid, id, i, v) end function GetDataFromStruct(data,offset, t_struct, key) local t = t_struct[key] local r if t[2] == 0 then r = Byte.get16(data, t[1] + offset) elseif t[2] == 1 then r = Byte.getu16(data, t[1] + offset) elseif t[2]==3then --新增加的对生命最大值支持的代码 r=Byte.get32(data,t[1]+offset); --新增加的对生命最大值支持的代码 elseif t[2] == 2 then if CC.SrcCharSet == 0 then r = lib.CharSet(Byte.getstr(data, t[1] + offset, t[3]), 0) else r = Byte.getstr(data, t[1] + offset, t[3]) end end return r end function SetDataFromStruct(data,offset, t_struct, key, v) local t = t_struct[key] if t[2] == 0 then Byte.set16(data, t[1] + offset, v) elseif t[2] == 1 then Byte.setu16(data, t[1] + offset, v) elseif t[2]==3then --新增加的对生命最大值支持的代码 Byte.set32(data,t[1]+offset,v); --新增加的对生命最大值支持的代码 elseif t[2] == 2 then local s if CC.SrcCharSet == 0 then s = lib.CharSet(v, 1) else s = v end Byte.setstr(data, t[1] + offset, t[3], s) end end 下面这个也要同步调整。 function CCFZB() CC.ZCOPEN = 0 CC.JS = 0 if CC.ExpCS > 2 or CC.ExpCS < 1 then CC.ExpCS = 1 end CC.NUMBER = #CC.RUNSTR for i = 0, 14 do for j = 0, 99 do if CC.GLTS[j] == nil then CC.GLTS[j] = 0 end end end if CC.PersonAttribMax["经验"] > 999999999 then CC.PersonAttribMax["经验"] =999999999 end if 32000 < CC.PersonAttribMax["物品修炼点数"] then CC.PersonAttribMax["物品修炼点数"] = 32000 end if 30000 < CC.PersonAttribMax["修炼点数"] then CC.PersonAttribMax["修炼点数"] = 30000 end if CC.PersonAttribMax["生命最大值"] > 999999999 then CC.PersonAttribMax["生命最大值"] = 999999999 end if CC.PersonAttribMax["受伤程度"] > 100 then CC.PersonAttribMax["受伤程度"] = 100 end if 100 < CC.PersonAttribMax["中毒程度"] then CC.PersonAttribMax["中毒程度"] = 100 end if 999999999 <CC.PersonAttribMax["内力最大值"] then CC.PersonAttribMax["内力最大值"] = 999999999 end if 100 < CC.PersonAttribMax["体力"] then CC.PersonAttribMax["体力"] = 100 end if CC.PersonAttribMax["攻击力"] > 5000 then CC.PersonAttribMax["攻击力"] = 5000 end if 5000 < CC.PersonAttribMax["防御力"] then CC.PersonAttribMax["防御力"] = 5000 end if CC.PersonAttribMax["轻功"] > 1000 then CC.PersonAttribMax["轻功"] = 999 end if 1000 < CC.PersonAttribMax["医疗能力"] then CC.PersonAttribMax["医疗能力"] = 999 end if 1000 < CC.PersonAttribMax["用毒能力"] then CC.PersonAttribMax["用毒能力"] = 999 end if 1000 < CC.PersonAttribMax["解毒能力"] then CC.PersonAttribMax["解毒能力"] = 999 end if 1000 < CC.PersonAttribMax["抗毒能力"] then CC.PersonAttribMax["抗毒能力"] = 100 end if CC.PersonAttribMax["拳掌功夫"] > 5000 then CC.PersonAttribMax["拳掌功夫"] = 5000 end if 5000 < CC.PersonAttribMax["御剑能力"] then CC.PersonAttribMax["御剑能力"] = 5000 end if 5000 < CC.PersonAttribMax["耍刀技巧"] then CC.PersonAttribMax["耍刀技巧"] = 5000 end if 5000 < CC.PersonAttribMax["特殊兵器"] then CC.PersonAttribMax["特殊兵器"] = 5000 end if 3000 < CC.PersonAttribMax["暗器技巧"] then CC.PersonAttribMax["暗器技巧"] = 5000 end if 800 < CC.PersonAttribMax["武学常识"] then CC.PersonAttribMax["武学常识"] = 800 end if 100 < CC.PersonAttribMax["品德"] then CC.PersonAttribMax["品德"] = 100 end if 100 < CC.PersonAttribMax["资质"] then CC.PersonAttribMax["资质"] = 100 end if 100 < CC.PersonAttribMax["攻击带毒"] then CC.PersonAttribMax["攻击带毒"] = 200 end CC.MAXSX[1] = CC.PersonAttribMax["生命最大值"] CC.MAXSX[2] = CC.PersonAttribMax["内力最大值"] CC.MAXSX[3] = CC.PersonAttribMax["攻击力"] CC.MAXSX[4] = CC.PersonAttribMax["防御力"] CC.MAXSX[5] = CC.PersonAttribMax["拳掌功夫"] CC.MAXSX[6] = CC.PersonAttribMax["御剑能力"] CC.MAXSX[7] = CC.PersonAttribMax["耍刀技巧"] CC.MAXSX[8] = CC.PersonAttribMax["特殊兵器"] if CONFIG.Operation == 1 then VK_SPACE = VK_RETURN end CC.FK = 1 CC.FKUP = 1 CC.RB = 1 for i = 1, #CC.YXND do for k = 1, 4 do if CC.YXND[k] < 0.5 then CC.YXND[k] = 0.5 elseif 2 < CC.YXND[k] then CC.YXND[k] = 2 end end end if CC.TeamWarNum > 12 then CC.TeamWarNum = 12 elseif 6 > CC.TeamWarNum then CC.TeamWarNum = 6 end for i = 1, 7 do if CC.ZZADD > 10 then CC.ZZADD = 10 end if 10 < CC.QGADD then CC.QGADD = 10 end if 10 < CC.TSZZADD then CC.TSZZADD = 10 end if 10 < CC.TSQGADD then CC.TSQGADD = 10 end if 20 < CC.UPADD then CC.UPADD = 20 end if 20 < CC.TSUPADD then CC.TSUPADD = 20 end end if CC.YXNDA == 0 then elseif CC.YXNDA == 1 then elseif CC.YXNDA == 2 then end if 10 > CC.SXYQ then CC.SXYQ = 10 end if 10 > CC.YXBQZ then CC.YXBQZ = 10 end if 10 < CC.DUDX then CC.DUDX = 10 end CC.MSSX = 100 end 在yjconst里面或者newconst里面对生命、内力最大的设置同步调整。应该是newconst里面调整 --人物属性最大值,部份数值修改过大会报错,谨慎修改! CC.PersonAttribMax["经验"]=99999999; CC.PersonAttribMax["物品修炼点数"]=30000; CC.PersonAttribMax["修炼点数"]=30000; CC.PersonAttribMax["生命最大值"]=99999999; CC.PersonAttribMax["受伤程度"]=100; CC.PersonAttribMax["中毒程度"]=100; CC.PersonAttribMax["内力最大值"]=99999999; CC.PersonAttribMax["体力"]=100; CC.PersonAttribMax["攻击力"]=3000; CC.PersonAttribMax["防御力"]=3000; CC.PersonAttribMax["轻功"]=999; CC.PersonAttribMax["医疗能力"]=999; CC.PersonAttribMax["用毒能力"]=400; CC.PersonAttribMax["解毒能力"]=300; CC.PersonAttribMax["抗毒能力"]=100; CC.PersonAttribMax["拳掌功夫"]=3000; CC.PersonAttribMax["御剑能力"]=3000; CC.PersonAttribMax["耍刀技巧"]=3000; CC.PersonAttribMax["特殊兵器"]=3000; CC.PersonAttribMax["暗器技巧"]=2000; CC.PersonAttribMax["武学常识"]=200; CC.PersonAttribMax["品德"]=100; CC.PersonAttribMax["资质"]=100; CC.PersonAttribMax["攻击带毒"]=200; CC.PersonAttribMax["生命丹药"]=3000; CC.PersonAttribMax["内力丹药"]=3000;
|