--扭蛋机 local MsgPack = MsgPack local Capsule = class("Capsule", require("shared.ModelBase")) function Capsule:ctor(properties) Capsule.super.ctor(self, properties) end RewardType = { GOODS = 1, SPECIAL = 2, INCENTIVE = 3, } SpecialType = { TOP = 1, CORE = 2, LAST = 3, JOKER = 4, KING = 5, } CapsuleType = { PRIVATE = 0, PUBLIC = 1, } --[[ --通知数据结构 { [roleId] = { [good_id1] = { }, [good_id2] = { }, } } ]]-- Capsule.schema = { id = {"number", 0}, --扭蛋机key,配置读取 room = {"number", 0}, --房间号, 配置读取 name = {"string"}, typ = {"number", 1}, -- 1=共享,2=独享 coin = {"number", 0}, --货币代号 token = {"table", {}}, --抽一次,货币=消耗 register = {"table", {}}, --人数 {["id"]=0}, 0 围观, 1 已报名 record = {"table", {}}, --抽取记录 列表 recordByRole = {"table", {}}, -- 抽取记录,hash, {roleid=record} rank = {"table", {}}, --排行 goods = {"table", {}}, --奖励池 specials = {"table", {}}, --特殊赏 incentive = {"table", {}}, --激励奖 incentiveRecord = {"table", {}}, --激励奖记录 {roleId = {}, roleId={}} specialsRecord= {"table", {}}, --特殊赏领取记录 {1={},2={}} key=触发特殊赏的 抽奖次数, v=特殊赏商品 table resetTimes = {"number", 0}, --每日一次手动重置的机会 hideTime = {"number", 0} , --隐藏时间 drawEndTime = {"number", 0}, --抽完时间 } function Capsule:getResetFields() return { id = self:getProperty("id"), room = self:getProperty("room"), typ = self:getProperty("typ"), coin = 0, token = {}, register = {}, record = {}, recordByRole = {}, rank = {}, goods = {}, specials = {}, incentive = {}, incentiveRecord = {}, specialsRecord= {}, resetTimes = 0, hideTime = 0, drawEndTime = 0, } end function Capsule:init() local id = self:getProperty("id") local room = self:getProperty("room") self:setProperties(self:getResetFields()) local ichibankuji = csvdb["ichibankuji_mainCsv"][id][room] --奖励池 local goods_id = ichibankuji["goods_id"] local goods, specials, incentive = {}, {}, {} for _, data in pairs(csvdb["ichibankuji_goodsCsv"]) do for _, val in pairs(data) do if val.key == goods_id then goods[goods_id..val.id] = clone(val) end end end for _, v in pairs(goods) do v.weight = (v.weight or 0) * v.amount end --特殊赏 local special_ids = ichibankuji["special_id"] if special_ids ~= "" then for _, special_id in ipairs(special_ids:toArray(true, "=")) do local val = csvdb["ichibankuji_specialCsv"][special_id] if type(val.type) == "number" then specials[special_id] = {np= 1, amount = val.amount, award = val.award, quality = tonumber(val.type), showIndex = val.showIndex} elseif type(val.type) == "string" then local pos = val.type:find("=") if pos then for k, v in pairs(val.type:toNumMap()) do specials[special_id] = {np= v, amount = val.amount, award = val.award, quality = k, showIndex = val.showIndex} end else specials[special_id] = {np= 1, amount = val.amount, award = val.award, quality = tonumber(val.type), showIndex = val.showIndex} end end end end --激励奖 local incentive_ids = ichibankuji["incentive_id"] if incentive_ids ~= "" then for _, incentive_id in ipairs(incentive_ids:toArray(true, "=")) do local val = csvdb["ichibankuji_incentiveCsv"][incentive_id] if type(val.type) == "number" then incentive["last"] = {np=val.type, award = val.award} elseif type(val.type) == "string" then for k, v in pairs(val.type:toNumMap()) do if k == 2 then incentive["amount"] = {np= v, award = val.award} elseif k==3 then incentive["probabilities"] = {np= v, award = val.award} end end end end end --货币类型 local coin = ichibankuji["token"]:toArray(true, "=") self:setProperties({coin = coin[1] or 0, token = coin, hideTime = ichibankuji.hide_time, goods = goods, specials = specials, incentive = incentive}) end function Capsule:isShow() if skynet.timex() >= self:getProperty("hideTime") then return false end return true end function Capsule:reset2TimeOut(curTime, now) now = now or skynet.timex() local interval if now >= curTime then self:init() self:create() else interval = curTime - now end interval = (interval)* 100 skynet.timeout(interval, handler(self,self.reset3TimeOut)(curTime)) end function Capsule:reset3TimeOut(curTime, now) now = now or skynet.timex() local cur4Time = curTime or (specTime({hour = 4},now)) local interval if cur4Time > now then interval = cur4Time - now elseif cur4Time < now then local nextTime = dayLater(now) interval = nextTime - now elseif cur4Time == now then self:init() self:create() local nextTime = dayLater(now) interval = nextTime - now end interval = (interval)* 100 skynet.timeout(interval, handler(self,self.reset3TimeOut)) end function Capsule:reset4TimeOut(curTime, now) now = now or skynet.timex() local interval if curTime > now then interval = curTime - now elseif curTime < now then local nextTime = dayLater(now) interval = nextTime - now elseif curTime == now then self:init() self:create() return false end interval = (interval)* 100 skynet.timeout(interval, handler(self,self.reset4TimeOut)) end function Capsule:checkTime(reset, now) local resetArr = reset:toArray(true, "=") if not next(resetArr) then return false end if resetArr[1] == 2 then if self:getGoodsAmount() > 0 then return false end local drawEndTime = self:getProperty("drawEndTime") or 0 if drawEndTime == 0 then return false end if now - drawEndTime >= resetArr[2] then return true end --self:reset2TimeOut(drawEndTime + resetArr[2], now) elseif resetArr[1] == 3 then local cur4Time = specTime({hour = 4},now) if now == cur4Time then return true end --self:reset3TimeOut(cur4Time, now) elseif resetArr[1] == 4 then if now == resetArr[2] then return true end --self:reset4TimeOut(resetArr[2], now) end return false end function Capsule:refreshing(now) local id = self:getProperty("id") local room = self:getProperty("room") local ichibankuji = csvdb["ichibankuji_mainCsv"][id][room] local reset = tostring(ichibankuji.reset) if reset == "0" then return false elseif reset == "1" then if self:getProperty("resetTimes") == 0 then self:setProperty("resetTime", 1) return true end return false else return self:checkTime(reset, now) end return false end function Capsule:getOnlineCount() local register = self:getProperty("register") or {} local reg, onlookers = 0, 0 for _, v in pairs(register) do if v == 1 then reg = reg + 1 else onlookers = onlookers + 1 end end return {[0]=onlookers, [1]=reg, [2] = reg+onlookers} end function Capsule:join(roleId) --一个房间最多人数 TODO local register = self:getProperty("register") or {} register[roleId] = 0 self:setProperty("register", register) return self:data(roleId) end function Capsule:getRegisterByRoleId(roleId) local register = self:getProperty("register") or {} return register[roleId] or 0 end function Capsule:isRegister(roleId) return self:getRegisterByRoleId(roleId) == 1 end function Capsule:register(roleId) local register = self:getProperty("register") or {} register[roleId] = 1 self:setProperty("register", register) return self:data(roleId) end function Capsule:exit(roleId) local register = self:getProperty("register") or {} if next(register) then register[roleId] = nil return true end return false end function Capsule:confirmed(cares) local goods = self:getProperty("goods") or {} local specials = self:getProperty("specials") or {} local change = {} for k, v in pairs(cares) do if v.typ == 1 then if goods[k] and goods[k].amount ~= v.count then change[k] = {typ=1, count = goods[k].amount} end else if specials[k] and specials[k].amount ~= v.count then change[k] = {typ=1, count = specials[k].amount} end end end return change end function Capsule:getGoodsAmount() local goods = self:getProperty("goods") or {} local amount = 0 for _, v in pairs(goods) do amount = amount + v.amount end return amount end function Capsule:getSpecialByType(typ) local specials = self:getProperty("specials") or {} for k, v in pairs(specials) do if v.quality == typ then return k, v end end return nil end function Capsule:checkSpecialFlag(typ) local spKey, special = self:getSpecialByType(typ) if not special then return nil end if special["amount"] <= 0 then return nil end return spKey, special end local function getSpecialReward(rewardRecord, count, award, spKey, typ, now) local rewardByRole = {} while(count > 0 and next(rewardRecord)) do local roleId = math.randWeight(rewardRecord, "amount") if roleId then local tmp = rewardRecord[roleId] tmp["amount"] = tmp["amount"] - 1 if tmp["amount"] <= 0 then rewardRecord[roleId] = nil end local name = getNameByRoleId(roleId) tmp = {name = name, good_id = spKey, typ = RewardType.SPECIAL, award = award, amount = 1, quality = typ, create_time= now} table.insert(rewardByRole, tmp) count = count - 1 end end return rewardByRole, count end local rewardToRecordFunc = function(specialsRecord, recordAmount, rewardByRole) if not specialsRecord[recordAmount] then specialsRecord[recordAmount] = rewardByRole else table.insert(specialsRecord[recordAmount], rewardByRole) end end local function getRecordAmount(record) return #record end function Capsule:getTop(record, recordAmount,now) local spKey, special = self:checkSpecialFlag(SpecialType.TOP) if not special then return nil end local specials = self:getProperty("specials") or {} local specialsRecord = self:getProperty("specialsRecord") or {} if recordAmount < special["np"] then return nil end local topRecord = {} local count = special["np"] for _, v in ipairs(record) do if count <= 0 then break end local tmpCount = 0 if count >= v.amount then count = count - v.amount tmpCount = v.amount else tmpCount = count count = 0 end if not topRecord[v.roleId]then topRecord[v.roleId] = {amount = v.amount } else topRecord[v.roleId] = {amount = (topRecord[v.roleId]["amount"] or 0) + tmpCount} end end local rewardByRole, count = getSpecialReward(topRecord, special["amount"], special["award"], spKey, SpecialType.TOP,now) special["amount"] = count specials[spKey] = special rewardToRecordFunc(specialsRecord, recordAmount, rewardByRole) self:setProperties({specialsRecord = specialsRecord, specials = specials}) return rewardByRole end --TODO function Capsule:getCore(record, recordAmount,now) local spKey, special = self:checkSpecialFlag(SpecialType.CORE) if not special then return nil end local specials = self:getProperty("specials") or {} local specialsRecord = self:getProperty("specialsRecord") or {} local count = special["np"] if count > recordAmount then return nil end local left = math.ceil((count - recordAmount)/2) or 0 local roleRecord = {} for i, v in ipairs(record) do if count <= 0 then break end if i > left then local tmpCount = 0 if count >= v.amount then count = count - v.amount tmpCount = v.amount else tmpCount = count count = 0 end if not roleRecord[v.roleId]then roleRecord[v.roleId] = {amount = v.amount } else roleRecord[v.roleId] = {amount = (roleRecord[v.roleId]["amount"] or 0) + tmpCount} end end end local rewardByRole, count = getSpecialReward(roleRecord, special["amount"], special["award"], spKey, SpecialType.CORE,now) special["amount"] = count specials[spKey] = special rewardToRecordFunc(specialsRecord, recordAmount, rewardByRole) self:setProperties({specialsRecord = specialsRecord, specials = specials}) return rewardByRole end function Capsule:getLast(record, recordAmount, now) local spKey, special = self:checkSpecialFlag(SpecialType.LAST) if not special then return nil end local specials = self:getProperty("specials") or {} local specialsRecord = self:getProperty("specialsRecord") or {} table.sort(record, function(a, b) return a.create_time > b.create_time end) local count = special["np"] local roleRecord = {} for _, v in ipairs(record) do if count <= 0 then break end local tmpCount = 0 if count >= v.amount then count = count - v.amount tmpCount = v.amount else tmpCount = count count = 0 end if not roleRecord[v.roleId]then roleRecord[v.roleId] = {amount = v.amount } else roleRecord[v.roleId] = {amount = (roleRecord[v.roleId]["amount"] or 0) + tmpCount} end end local rewardByRole, count = getSpecialReward(roleRecord, special["amount"], special["award"], spKey, SpecialType.LAST,now) special["amount"] = count specials[spKey] = special rewardToRecordFunc(specialsRecord, recordAmount, rewardByRole) self:setProperties({specialsRecord = specialsRecord, specials = specials}) return rewardByRole end function Capsule:getJoker(record, recordAmount, now) local spKey, special = self:checkSpecialFlag(SpecialType.JOKER) if not special then return nil end local specials = self:getProperty("specials") or {} local specialsRecord = self:getProperty("specialsRecord") or {} local roleRecord = {} for _, v in ipairs(record) do if not roleRecord[v.roleId]then roleRecord[v.roleId] = {amount = v.amount } else roleRecord[v.roleId] = {amount = (roleRecord[v.roleId]["amount"] or 0) + v.amount} end end local rewardByRole, count = getSpecialReward(roleRecord, special["amount"], special["award"], spKey, SpecialType.JOKER,now) special["amount"] = count specials[spKey] = special rewardToRecordFunc(specialsRecord, recordAmount, rewardByRole) self:setProperties({specialsRecord = specialsRecord, specials = specials}) return rewardByRole end function Capsule:getKing(record, recordAmount, now) local spKey, special = self:checkSpecialFlag(SpecialType.KING) if not special then return nil end local specials = self:getProperty("specials") or {} local specialsRecord = self:getProperty("specialsRecord") or {} local rank = self:getProperty("rank") or {} if not next(rank) then return nil end local roleRecord = {} for roleId, count in pairs(rank) do table.insert(roleRecord, {roleId = roleId, count = count}) end table.sort(roleRecord, function(a, b) return a.count > b.count end) local count = math.min(special["amount"], #roleRecord) local rewardByRole = {} local index = 1 while (count > 0 ) do count = count - 1 local tmp = roleRecord[index] if not tmp then break end index = index + 1 local name = getNameByRoleId(tmp.roleId) table.insert(rewardByRole, {name = name, good_id = spKey, typ = RewardType.SPECIAL, award = special["award"], amount = 1, SpecialType.KING, create_time= now}) end special["amount"] = count specials[spKey] = special rewardToRecordFunc(specialsRecord, recordAmount, rewardByRole) self:setProperties({specialsRecord = specialsRecord, specials = specials}) return rewardByRole end function Capsule:checkSpecialReward(now, goodsAmount) local specials = self:getProperty("specials") or {} if not next(specials) then return nil end local record = self:getProperty("record") or {} if not next(record) then return nil end table.sort(record, function(a, b) return a.create_time < b.create_time end ) local recordAmount = getRecordAmount(record) local notify = self:getTop(record, recordAmount,now) or {} if goodsAmount == 0 then local coreReward = self:getCore(record, recordAmount, now) rewardToRecordFunc(notify, recordAmount, coreReward) local lastReward = self:getLast(record, recordAmount, now) rewardToRecordFunc(notify, recordAmount, lastReward) local jokerReward = self:getJoker(record, recordAmount, now) rewardToRecordFunc(notify, recordAmount, jokerReward) local kingReward = self:getKing(record, recordAmount, now) rewardToRecordFunc(notify, recordAmount, kingReward) end return notify end function Capsule:checkIncentive(roleId, name, now) local goods = self:getProperty("goods") or {} local recordByRole = self:getProperty("recordByRole") or {} local roleRecord = recordByRole[roleId] or {} local incentiveRecord = self:getProperty("incentiveRecord") or {} local incentiveByRole = incentiveRecord[roleId] or {} local incentive = self:getProperty("incentive") local notify = {} -- 最后一抽 TODO if incentive["last"] then local last = true for k, v in pairs(goods) do if v and v.amount then last = false break end end if last then notify["last"] = {name = name, good_id = "last", typ = RewardType.INCENTIVE, award = incentive["last"]["award"], amount = 1, quality = 1, create_time= now} end end --次数 if incentive["amount"] then local amount = 0 for _, v in pairs(roleRecord) do if (v.calculated or 0) == 0 then amount = amount + v.amount end end local count = math.floor(amount / incentive["amount"]["np"]) if count > 0 then local tmpCount = count * incentive["amount"]["np"] notify["amount"] = {name = name, roleId= roleId, good_id = "amount", typ = RewardType.INCENTIVE, award = incentive["amount"]["award"], amount = count, quality = 2, create_time= now} --填充v.calculated 字段,标识已经用于每x抽的计算中。 for _, v in pairs(roleRecord) do if tmpCount <= 0 then break end v.calculated = v.calculated or 0 if v.calculated ~= v.amount then if tmpCount <= v.amount then v.calculated = tmpCount tmpCount = 0 else v.calculated = v.amount tmpCount = tmpCount - v.amount end end end end end --概率 if incentive["probabilities"] then local probabilities = math.randomInt(1, 100) if probabilities <= incentive["probabilities"]["np"] then notify["probabilities"] = {name = name, good_id = "probabilities", typ = RewardType.INCENTIVE, award = incentive["probabilities"]["award"], amount = 1, quality = 3, create_time= now} end end for k, v in pairs(notify) do if not incentiveByRole[k] then incentiveByRole[k] = v else incentiveByRole[k].amount = incentiveByRole[k].amount + v.amount end end incentiveRecord[roleId] = incentiveByRole self:setProperty("incentiveRecord", incentiveRecord) return incentiveByRole end local rewardCollect = function(reward, goods) for _, v in pairs(goods) do for id, count in pairs(v.award:toNumMap()) do reward[id] = (reward[id] or 0) + count * v.amount end end end local rewardCollectByRoleId = function(roleId, reward, goods) local tmp = {} for _, val in pairs(goods) do for _, v in ipairs(val) do if v.roleId == roleId then for id, count in pairs(v.award:toNumMap()) do reward[id] = (reward[id] or 0) + count * v.amount end if not tmp[v.good_id] then tmp[v.good_id] = v else tmp[v.good_id].amount = tmp[v.good_id].amount + v.amount end end end end return tmp end function Capsule:drawByCount(roleId, count) if count <= 0 then return nil end local goods = self:getProperty("goods") or {} local record = self:getProperty("record") or {} local rank = self:getProperty("rank") or {} local rankRole = rank[roleId] or 0 local recordByRole = self:getProperty("recordByRole") or {} local roleRecord = recordByRole[roleId] or {} local id = self:getProperty("id") local room = self:getProperty("room") local ichibankuji = csvdb["ichibankuji_mainCsv"][id][room] local goods_id = ichibankuji["goods_id"] local now = skynet.timex() --奖励,普通奖品信息 local goodsByUsual= {} local name = getNameByRoleId(roleId) while (goods and next(goods) and count > 0) do local good_id = math.randWeight(goods, "weight") if not good_id then break end local good = goods[good_id] or {} if good and good.amount > 0 then good.amount = good.amount - 1 --插入rank rankRole = rankRole + 1 --插入记录 local tmpNotify = {roleId = roleId, name= name, good_id = good_id, typ = RewardType.GOODS, award = good.award, amount = 1, quality = good.quality, create_time= now} table.insert(record, tmpNotify) --作为奖励记录+通知 if not goodsByUsual[good_id] then goodsByUsual[good_id] = tmpNotify else goodsByUsual[good_id].amount = goodsByUsual[good_id].amount + 1 end --记录角色的抽奖记录 计算激励奖需要用到 if not roleRecord[good_id] then roleRecord[good_id] = tmpNotify else roleRecord[good_id].amount = roleRecord[good_id].amount + 1 end good.weight = good.weight - csvdb["ichibankuji_goodsCsv"][goods_id][good.id].weight count = count - 1 end end --奖励池重新赋值 rank[roleId] = rankRole recordByRole[roleId] = roleRecord self:setProperties({recordByRole = recordByRole, record = record, goods = goods, rank = rank}) --奖励收集 local reward = {} rewardCollect(reward, goodsByUsual) local goodsByIncentive = self:checkIncentive(roleId, name, now) rewardCollect(reward, goodsByIncentive) local goodsAmount = self:getGoodsAmount() if goodsAmount == 0 then self:setProperty("drawEndTime", now) end local goodsBySpecial = self:checkSpecialReward(now, goodsAmount) local specialByRole = rewardCollectByRoleId(roleId, reward, goodsBySpecial) local drawReward = {} drawReward["reward"] = reward drawReward["usual"] = goodsByUsual drawReward["specials"] = goodsBySpecial if next(goodsByIncentive) then drawReward["incentive"] = goodsByIncentive end if next(specialByRole) then drawReward["special"] = specialByRole end return drawReward end function Capsule:drawAll(roleId) local goods = self:getProperty("goods") or {} local record = self:getProperty("record") or {} local rank = self:getProperty("rank") or {} local rankRole = rank[roleId] or 0 local recordByRole = self:getProperty("recordByRole") or {} local roleRecord = recordByRole[roleId] or {} local now = skynet.timex() local name = getNameByRoleId(roleId) local goodsByUsual = {} for good_id, good in pairs(goods) do if good.amount > 0 then --插入rank rankRole = rankRole + good.amount --插入记录 local tmpNotify = {roleId = roleId, name= name, good_id = good_id, typ = RewardType.GOODS, award = good.award, amount = good.amount, quality = good.quality, create_time = now} for i = 1, good.amount do table.insert(record, {roleId = roleId, name= name, good_id = good_id, typ = RewardType.GOODS, award = good.award, amount = 1, quality = good.quality, create_time = now}) end --作为奖励记录+通知 if not goodsByUsual[good_id] then goodsByUsual[good_id] = tmpNotify else goodsByUsual[good_id].amount = goodsByUsual[good_id].amount + good.award end --记录角色的抽奖记录 if not roleRecord[good_id] then roleRecord[good_id] = tmpNotify else roleRecord[good_id].amount = roleRecord[good_id].amount + good.amount end good.amount = 0 end end rank[roleId] = rankRole recordByRole[roleId] = roleRecord self:setProperties({recordByRole = recordByRole, record = record, goods = goods, rank = rank}) --奖励收集 local reward = {} rewardCollect(reward, goodsByUsual) local goodsByIncentive = self:checkIncentive(roleId, name, now) rewardCollect(reward, goodsByIncentive) local goodsAmount = self:getGoodsAmount() if goodsAmount == 0 then self:setProperty("drawEndTime", now) end local goodsBySpecial = self:checkSpecialReward(now, goodsAmount) local specialByRole = rewardCollectByRoleId(roleId, reward, goodsBySpecial) local drawReward = {} drawReward["reward"] = reward drawReward["usual"] = goodsByUsual drawReward["specials"] = goodsBySpecial if next(goodsByIncentive) then drawReward["incentive"] = goodsByIncentive end if next(specialByRole) then drawReward["special"] = specialByRole end return drawReward end --@param --[[ @roleId @typ 0=独享,1=公开 @cares 关注{k=v} ]]-- function Capsule:draw(roleId, full, cares) if self:getProperty("typ") == 1 then --是否报名 if self:isRegister(roleId) == false then return 4 end --关注的奖品的数量发生了变化 if cares then local change = self:confirmed(cares) if next(change) then return 5, change end end end if full == 0 then return 6, self:drawByCount(roleId, 1) elseif full == 1 then return 6, self:drawByCount(roleId, 10) elseif full == 2 then return 6, self:drawAll(roleId) end end function Capsule:pageRecord(up, idx) local record = self:getProperty("record") or {} if not next(record) then return nil end --默认取20条 idx = idx or #record up = up or 0 local count = 0 local tmpRecord = {} if up == 1 then --向上获取索引更大的 从上往下拉 count = math.min(#record - idx, 20) for i = idx, count do tmpRecord[i] = record[i] end else --向下获取索引更小的 从下往上拉 count = math.max(idx - 20, 0) for i = count, idx do tmpRecord[i] = record[i] end end return tmpRecord end --检查是否有未领取奖励的通知 function Capsule:getSpecialNotify(roleId) local specialsRecord = self:getProperty("specialsRecord") or {} local tmp = {} for _, goods in pairs(specialsRecord) do for _, good in ipairs(goods) do if good.roleId == roleId then if not good.nty or good.nty == 0 then tmp[good.good_id] = good end end end end self:setProperty("specialsRecord", specialsRecord) return tmp end function Capsule:clearSpecialNty(roleId, good_ids) local specialsRecord = self:getProperty("specialsRecord") or {} for _, goods in pairs(specialsRecord) do for _, good in ipairs(goods) do for _, good_id in ipairs(good_ids) do if good_id == good.good_id and good.roleId == roleId then good.nty = 1 end end end end self:setProperty("specialsRecord", specialsRecord) end function Capsule:getRoleProgress(roleId) local recordByRole = self:getProperty("recordByRole") or {} local roleRecord = recordByRole[roleId] or {} local amount = 0 for _, v in pairs(roleRecord) do v.calculated = v.calculated or 0 if v.calculated ~= v.amount then amount = amount + (v.amount - v.calculated) end end return amount end function Capsule:data(roleId) return { id = self:getProperty("id"), room = self:getProperty("room"), typ = self:getProperty("typ"), name = self:getProperty("name"), coin = self:getProperty("coin"), onlineCount = self:getOnlineCount(), playerStatus = self:getRegisterByRoleId(roleId), record = self:pageRecord() or {}, rank = self:getProperty("rank"), goods = self:getProperty("goods"), specials = self:getProperty("specials"), incentive = self:getProperty("incentive"), specialsRecord= self:getProperty("specialsRecord"), roleProgress = self:getRoleProgress(roleId), } end return Capsule