|
|
@@ -55,18 +55,83 @@ local function genSkinUnit(human,id)
|
|
|
}
|
|
|
end
|
|
|
|
|
|
+
|
|
|
+local function populateMsg(human, net, id)
|
|
|
+ local cfg = HeroSkinExcel[id]
|
|
|
+ local skinId = cfg.content[1]
|
|
|
+ local skinCfg = SkinExcel[skinId]
|
|
|
+ local iconframeId = cfg.content[2]
|
|
|
+ local iconframeCfg = HeadFrameExcel[iconframeId]
|
|
|
+
|
|
|
+ net.id = id
|
|
|
+ net.skinId = skinId
|
|
|
+ net.headId = iconframeId
|
|
|
+ net.headDesc = iconframeCfg.desc or ""
|
|
|
+ net.headKeepTime = iconframeCfg.keepTime
|
|
|
+ net.headName = iconframeCfg.name or ""
|
|
|
+ net.headCamp = iconframeCfg.camp or 0
|
|
|
+
|
|
|
+ BuyLogic.fontBuyItem(human, net.buyItem, cfg.buyId)
|
|
|
+
|
|
|
+ net.skinAttr[0] = #skinCfg.attrs
|
|
|
+ for i, attrInfo in ipairs(skinCfg.attrs) do
|
|
|
+ net.skinAttr[i].key = attrInfo[1]
|
|
|
+ net.skinAttr[i].value = attrInfo[2]
|
|
|
+ end
|
|
|
+
|
|
|
+ net.headAttr[0] = #iconframeCfg.attrs
|
|
|
+ for i, attrInfo in ipairs(iconframeCfg.attrs) do
|
|
|
+ net.headAttr[i].key = attrInfo[1]
|
|
|
+ net.headAttr[i].value = attrInfo[2]
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
-----------------------------------------
|
|
|
|
|
|
function query(human,panelId)
|
|
|
+ local retLen = 0
|
|
|
local ret = {}
|
|
|
for id,cfg in pairs(HeroSkinExcel) do
|
|
|
if cfg.panelId == panelId then
|
|
|
- ret[#ret+1] = genSkinUnit(human,id)
|
|
|
+ -- ret[#ret+1] = genSkinUnit(human,id)
|
|
|
+ retLen = retLen + 1
|
|
|
+ ret[retLen] = id
|
|
|
end
|
|
|
end
|
|
|
- return {
|
|
|
- list = ret
|
|
|
- }
|
|
|
+ -- return {
|
|
|
+ -- list = ret
|
|
|
+ -- }
|
|
|
+
|
|
|
+ local msgRet = Msg.gc.GC_SKIN_DATA_QUERY
|
|
|
+ msgRet.ret = GC_SKIN_QUERY
|
|
|
+ msgRet.isEnd = 0
|
|
|
+ local len, msgMaxLen = 0, 20
|
|
|
+
|
|
|
+ for _, id in ipairs(ret) do
|
|
|
+ len = len + 1
|
|
|
+ populateMsg(human, msgRet.skinData[len], id)
|
|
|
+
|
|
|
+ if len >= msgMaxLen then
|
|
|
+ msgRet.skinData[0] = len
|
|
|
+ retLen = retLen - len
|
|
|
+
|
|
|
+ if retLen <= 0 then
|
|
|
+ msgRet.isEnd = 1
|
|
|
+ return Msg.send(msgRet,human.fd)
|
|
|
+ end
|
|
|
+
|
|
|
+ len = 0
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ if len > 0 then
|
|
|
+ msgRet.skinData[0] = len
|
|
|
+ msgRet.isEnd = 1
|
|
|
+ Msg.send(msgRet,human.fd)
|
|
|
+ end
|
|
|
+
|
|
|
end
|
|
|
|
|
|
function buy(human,buyId)
|
|
|
@@ -82,10 +147,12 @@ function buy(human,buyId)
|
|
|
SkinLogic.skinUnlock(human,skinCfg.content[1]) --BagLogic.addItemList(human,skinCfg.content,"skin_buy")
|
|
|
RoleHeadLogic.active(human,RoleHeadLogic.HEAD_TYPE_2,skinCfg.content[2])
|
|
|
--刷新
|
|
|
- local data=query(human,skinCfg.panelId)
|
|
|
- RefreshClient(human,GC_SKIN_QUERY,data)
|
|
|
+ -- local data=query(human,skinCfg.panelId)
|
|
|
+ -- RefreshClient(human,GC_SKIN_QUERY,data)
|
|
|
+ query(human,skinCfg.panelId)
|
|
|
end
|
|
|
|
|
|
+
|
|
|
function RefreshClient(human,type,data)
|
|
|
local msgRet = Msg.gc.GC_ROLE_CHANGE_BASEINFO
|
|
|
msgRet.ret = type
|
|
|
@@ -135,8 +202,9 @@ function BuySkinBySuiPian(human, nSkinID, nItemID)
|
|
|
SkinLogic.skinUnlock(human,skinCfg.content[1]) --BagLogic.addItemList(human,skinCfg.content,"skin_buy")
|
|
|
RoleHeadLogic.active(human,RoleHeadLogic.HEAD_TYPE_2,skinCfg.content[2])
|
|
|
--刷新
|
|
|
- local data=query(human,skinCfg.panelId)
|
|
|
- RefreshClient(human,GC_SKIN_QUERY,data)
|
|
|
+ -- local data=query(human,skinCfg.panelId)
|
|
|
+ -- RefreshClient(human,GC_SKIN_QUERY,data)
|
|
|
+ query(human,skinCfg.panelId)
|
|
|
|
|
|
BagLogic.delItem(human, nItemID, 1, "item_use")
|
|
|
end
|