function x990114_NewExterior_FuTiBox(sceneId,selfId,nIndex)
--首先看看背包有没有对应装备
local nFinPos = -1
for i = 0,29 do
if LuaFnGetBagEquipType( sceneId, selfId, i ) == 4 then
nFinPos = i
end
end
if nFinPos == -1 then
nFinPos = TryRecieveItem(sceneId,selfId,10211001,1)
end
local nPossVisualData = x990114_GetPossVisualData(sceneId,selfId)
local gg = 0
BeginUICommand( sceneId )
UICommand_AddInt( sceneId,nFinPos)
for i = 1,21 do
local nEchoData = ""
for j = 1,9 do
nEchoData = nEchoData..nPossVisualData[i][j]
end
UICommand_AddString( sceneId,nEchoData)
-- AddGlobalCountNews( sceneId, i..": "..nEchoData)
end
EndUICommand( sceneId )
DispatchUICommand( sceneId, selfId, 202201271 )
end
从每次都传输一次,改成三次传输一次:
function x990114_NewExterior_FuTiBox(sceneId,selfId,nIndex)
--首先看看背包有没有对应装备
local nFinPos = -1
for i = 0,29 do
if LuaFnGetBagEquipType( sceneId, selfId, i ) == 4 then
nFinPos = i
end
end
if nFinPos == -1 then
nFinPos = TryRecieveItem(sceneId,selfId,10211001,1)
end
local nPossVisualData = x990114_GetPossVisualData(sceneId,selfId)
local gg = 0
BeginUICommand( sceneId )
UICommand_AddInt( sceneId,nFinPos)
for i = 1,21,3 do
local nEchoData = ""
for k = 0,2 do
if i + k <= 21 then
for j = 1,9 do
nEchoData = nEchoData..nPossVisualData[i + k][j]
end
end
end
UICommand_AddString( sceneId,nEchoData)
-- AddGlobalCountNews( sceneId, i..": "..nEchoData)
end
EndUICommand( sceneId )
DispatchUICommand( sceneId, selfId, 202201271 )
end
for i = 1, 21 do
local tempmd = Get_XParam_STR(i - 1)
if tempmd ~= nil and tempmd ~= "" then
for j = 1, 21 do
if tonumber(string.sub(tempmd,j,j)) ~= 0 then
g_Huanse_IconVisList[i][j] = 1
end
end
end
end
修改后的代码:
for i = 1, 21, 3 do
local tempmd = Get_XParam_STR(math.floor((i - 1) / 3))
if tempmd ~= nil and tempmd ~= "" then
for k = 0, 2 do
if i + k <= 21 then
local offset = k * 9
for j = 1, 9 do
if tonumber(string.sub(tempmd, offset + j, offset + j)) ~= 0 then
g_Huanse_IconVisList[i + k][j] = 1
end
end
end
end
end
end
function x889383_UpdateHuanSe(sceneId, selfId)
--幻色数据库读取
local nPossVisualData = x889383_GetPossVisualData(sceneId, selfId)
if nPossVisualData ~= nil then
BeginUICommand(sceneId)
for i = 1, 21, 3 do
local nEchoData = ""
for k = 0, 2 do
if i + k <= 21 then
for j = 1, 9 do
nEchoData = nEchoData .. nPossVisualData[i + k][j]
end
end
end
UICommand_AddString(sceneId, nEchoData)
end
EndUICommand(sceneId)
DispatchUICommand(sceneId, selfId, 8893833)
end
end
客户端:
for i = 1, g_Huanse_MaxTypeCount, 3 do
local tempmd = Get_XParam_STR(math.floor((i - 1) / 3))
if tempmd ~= nil and tempmd ~= "" then
for k = 0, 2 do
if i + k <= g_Huanse_MaxTypeCount then
local offset = k * g_Huanse_MaxColorCount
for j = 1, g_Huanse_MaxColorCount do
if tonumber(string.sub(tempmd, offset + j, offset + j)) ~= 0 then
g_Huanse_IconVisList[i + k][j] = 1
end
end
end
end
end
end