文章编辑人员:雪舞
内容测试时间:2023-6-14 15:18:46
测试版本:新武侠世界
我看到我们现在的逻辑在处理旧龙纹时并未保存雕纹或其他数据。我们需要对这部分进行修改,当龙纹的等级为1时,我们也需要保存任何其他的数据。
原始代码:
--开始正式升级了
local nFinalData = ""
if nMainLWdata == nil then
--新龙纹
local nLevel,nMoreExp = Lua_GetGrowToUp(1 + nGrowAdd)
nLevel,nMoreExp = Lua_LWGrowInt2Str(nLevel,nMoreExp)
nFinalData = "&LW"..nLevel..nMoreExp.."A000000".."00000000"
else
local nPos1,nPos2,nGrowLevel,nGrow,nAttrData,nHPLevel,nDecType,nDecLevel,nAttrType,nAttrLevel = strfind(nMainLWdata,x892003_g_DataSign)
if nPos1 == nil or nPos2 == nil then
local nLevel,nMoreExp = Lua_GetGrowToUp(1 + nGrowAdd)
nLevel,nMoreExp = Lua_LWGrowInt2Str(nLevel,nMoreExp)
nFinalData = nFinalData.."&LW"..nLevel..nMoreExp.."A000000".."00000000"
else
local _,_,_,nAllGrow = Lua_GetLWGrowData(tonumber(nGrowLevel))
local nLevel,nMoreExp = Lua_GetGrowToUp(nAllGrow + tonumber(nGrow) + nGrowAdd)
nLevel,nMoreExp = Lua_LWGrowInt2Str(nLevel,nMoreExp)
nFinalData = "&LW"..nLevel..nMoreExp..nAttrData..nHPLevel..nDecType..nDecLevel..nAttrType..nAttrLevel
nFinalData = gsub(nMainLWdata,x892003_g_DataSign,nFinalData)
end
end
如果 nMainLWdata 中不仅包含雕纹数据,还可能包含其他类型的数据,且所有这些数据都需要在升级后被保留。当 nPos1 或 nPos2 为 nil(意味着 nMainLWdata 中没有龙纹数据)时,将 nMainLWdata 添加到新创建的龙纹数据后面。这样做确实不会导致重复数据。
if nPos1 == nil or nPos2 == nil then
local nLevel,nMoreExp = Lua_GetGrowToUp(1 + nGrowAdd)
nLevel,nMoreExp = Lua_LWGrowInt2Str(nLevel,nMoreExp)
nFinalData = nFinalData.."&LW"..nLevel..nMoreExp.."A000000".."00000000"
改成
if nPos1 == nil or nPos2 == nil then
local nLevel,nMoreExp = Lua_GetGrowToUp(1 + nGrowAdd)
nLevel,nMoreExp = Lua_LWGrowInt2Str(nLevel,nMoreExp)
nFinalData = nFinalData.."&LW"..nLevel..nMoreExp.."A000000".."00000000"..nMainLWdata
|