local skynet = require "skynet" local oo = require "Class" local log = require "Log" local pb = require "pb" local dataType = require "DataType" local errorInfo = require "ErrorInfo" local Illustration = oo.class() Illustration.IllustrationType_Furniture = 1 --家具图鉴 Illustration.IllustrationType_Clothes = 2 --服装图鉴 Illustration.IllustrationType_Plant = 3 --植物图鉴 Illustration.IllustrationType_Special = 4 --特殊图鉴 Illustration.IllustrationType_Garden = 5 --花园图鉴 Illustration.IllustrationType_PetClothes = 6 --宠物服装图鉴 Illustration.IllustrationSubType_Furniture = 1 --家具套间 Illustration.IllustrationSubType_Clothes = 2 --服装套装 Illustration.IllustrationSubType_Flower = 3 --花卉 Illustration.IllustrationSubType_Gashapon = 4 --扭蛋 Illustration.IllustrationStatus_Achieve = 1 --已经完成 Illustration.IllustrationStatus_GainAward = 2 --领取奖励 function Illustration:Init() end --图鉴主页面展示 function Illustration:MainShow( player , c2sData , s2cData ) local data = {} data.itemList = {} data.illustration = {} local illustration = player.gameData.illustration --将全部图鉴分类型存进各表中 local furniture = { type = Illustration.IllustrationType_Furniture ,count = 0, item ={}} local clothes = { type = Illustration.IllustrationType_Clothes ,count = 0, item ={}} local plant = { type = Illustration.IllustrationType_Plant ,count = 0, item ={}} local special = { type = Illustration.IllustrationType_Special ,count = 0, item ={}} local garden = { type = Illustration.IllustrationType_Garden ,count = 0, item ={}} local petClothes = { type = Illustration.IllustrationType_PetClothes ,count = 0, item ={}} for k, v in pairs( illustration.goodsInfo ) do if dataType.GoodsType_Furniture == v.type or dataType.GoodsType_Decorate == v.type then table.insert( furniture.item , { type = v.type , id = v.id } ) furniture.count = furniture.count + 1 elseif dataType.GoodsType_Clothes == v.type then table.insert( clothes.item , { type = v.type , id = v.id } ) clothes.count = clothes.count + 1 elseif dataType.GoodsType_Plant == v.type then table.insert( plant.item , { type = v.type , id = v.id } ) plant.count = plant.count + 1 table.insert( special.item , { type = v.type , id = v.id } ) special.count = special.count + 1 elseif dataType.GoodsType_Garden == v.type then table.insert( garden.item , { type = v.type , id = v.id } ) garden.count = garden.count + 1 elseif dataType.GoodsType_PetClothes == v.type then table.insert( petClothes.item , { type = v.type , id = v.id } ) petClothes.count = petClothes.count + 1 end end table.insert( data.itemList , furniture ) table.insert( data.itemList , clothes ) table.insert( data.itemList , plant ) table.insert( data.itemList , special ) table.insert( data.itemList , garden ) table.insert( data.itemList , petClothes ) --图鉴进度信息 data.illustration.level = illustration.level data.illustration.progress = illustration.progress data.illustration.totalPoint = illustration.totalPoint s2cData.cmd = pb.enum("MsgType","CMD_S2C_IllustrationMainShow") s2cData.data = assert(pb.encode("S2CIllustrationMainShow", data)) end --图鉴进度查询 function Illustration:ProgressShow( player , c2sData , s2cData ) local data = {} data.illustration = {} local illustration = player.gameData.illustration data.illustration.level = illustration.level data.illustration.progress = illustration.progress data.illustration.totalPoint = illustration.totalPoint s2cData.cmd = pb.enum("MsgType","CMD_S2C_IllustrationProgress") s2cData.data = assert(pb.encode("S2CIllustrationProgress", data)) end --图鉴展示 function Illustration:Show( player , c2sData , s2cData ) c2sData.data = assert(pb.decode("C2SIllustrationShow", c2sData.data )) local data = {} local type = c2sData.data.type if not type then s2cData.code = errorInfo.ErrorCode.ErrRequestParam else data.type = type data.illustrationId = self:GetAwardInfo( player ) data.illustrationPointId = self:GetPointInfo( player ) --不需要的 --data.item = {} -- --if self.IllustrationType_Furniture == type then -- --self:Get( player , dataType.GoodsType_Furniture , data.item ) --将家具的图鉴发给客户端 -- --self:Get( player , dataType.GoodsType_Decorate , data.item ) --将装修的图鉴发给客户端 -- skynet.server.msgTips:Reduce( player , 17) --elseif self.IllustrationType_Clothes == type then --服装图鉴 -- --self:Get( player , dataType.GoodsType_Clothes , data.item ) -- skynet.server.msgTips:Reduce( player , 2) --elseif self.IllustrationType_Plant == type then -- --self:Get( player , dataType.GoodsType_Plant , data.item ) --将植物的图鉴发给客户端 -- skynet.server.msgTips:Reduce( player , 18) --elseif self.IllustrationType_Special == type then -- --self:Get( player , dataType.GoodsType_Plant , data.item ) -- skynet.server.msgTips:Reduce( player , 1) --elseif self.IllustrationType_Garden == type then -- --self:Get( player , dataType.GoodsType_Garden , data.item ) -- --花园红点 --elseif self.IllustrationType_PetClothes == type then --宠物服装图鉴 -- --self:Get( player , dataType.GoodsType_PetClothes, data.item ) -- skynet.server.msgTips:Reduce( player , 118) --end end s2cData.cmd = pb.enum("MsgType","CMD_S2C_IllustrationShow") s2cData.data = assert(pb.encode("S2CIllustrationShow", data)) end --图鉴奖励 function Illustration:Award( player , c2sData , s2cData ) c2sData.data = assert(pb.decode("C2SIllustrationAward", c2sData.data )) local data = {} data.rewardId = 0 local IllustrationId = c2sData.data.id if not IllustrationId then s2cData.code = errorInfo.ErrorCode.ErrRequestParam else for k, v in pairs( player.gameData.illustration.awardInfo ) do if IllustrationId == v.id and self.IllustrationStatus_Achieve == v.status then --获取当前图鉴ID的配置 local cfgAllIllustration = skynet.server.gameConfig:GetPlayerAllCfg( player , "Illustration") local cfgCurIllustration = {} for k1, v1 in pairs( cfgAllIllustration ) do if IllustrationId == v1.id then cfgCurIllustration = v1 break end end --发放奖励 local eventId = pb.enum("EnumMoneyChangeEventID","EventID_64") player:GiveReward( cfgCurIllustration.rewardId , eventId) data.rewardId = cfgCurIllustration.rewardId v.status = self.IllustrationStatus_GainAward --消除红点 for k1, v1 in pairs( player.gameData.illustration.pointInfo ) do if v1.id == v.id and self.IllustrationStatus_GainAward == v1.status then if self.IllustrationType_Furniture == cfgCurIllustration.type then skynet.server.msgTips:Reduce( player , 17 ) elseif self.IllustrationType_Clothes == cfgCurIllustration.type then skynet.server.msgTips:Reduce( player , 2 ) elseif self.IllustrationType_Plant == cfgCurIllustration.type then skynet.server.msgTips:Reduce( player , 18 ) elseif self.IllustrationType_Special == cfgCurIllustration.type then skynet.server.msgTips:Reduce( player , 1 ) elseif self.IllustrationType_PetClothes == cfgCurIllustration.type then skynet.server.msgTips:Reduce( player , 118 ) end break end end skynet.server.achieveTask:Modify( player , 40 , 1) skynet.server.taskListEvent:Modify( player , 40 , 1) log.debug(string.format("玩家 %d 图鉴 发放奖励 图鉴ID %d" , player.userId , IllustrationId )) break end end end data.illustrationId = self:GetAwardInfo( player ) s2cData.cmd = pb.enum("MsgType","CMD_S2C_IllustrationAward") s2cData.data = assert(pb.encode("S2CIllustrationAward", data)) end --领取图鉴积分 function Illustration:GetPoint( player , c2sData , s2cData ) c2sData.data = assert(pb.decode("C2SIllustrationGetPoint", c2sData.data )) local data = {} data.illustration = {} data.pointsChange = 0 local IllustrationId = c2sData.data.id if not IllustrationId then s2cData.code = errorInfo.ErrorCode.ErrRequestParam else local illustration = player.gameData.illustration for k, v in pairs( illustration.pointInfo ) do if IllustrationId == v.id and self.IllustrationStatus_Achieve == v.status then --获取当前图鉴ID的配置 local cfgAllIllustration = skynet.server.gameConfig:GetPlayerAllCfg( player , "Illustration") local cfgCurIllustration = {} for k1, v1 in pairs( cfgAllIllustration ) do if IllustrationId == v1.id then cfgCurIllustration = v1 break end end --积分变化 illustration.progress = illustration.progress + tonumber(cfgCurIllustration.pointReward) illustration.totalPoint = illustration.totalPoint + tonumber(cfgCurIllustration.pointReward) v.status = self.IllustrationStatus_GainAward --图鉴进度信息 data.pointsChange = tonumber(cfgCurIllustration.pointReward) data.illustration.level = illustration.level data.illustration.progress = illustration.progress data.illustration.totalPoint = illustration.totalPoint --红点逻辑 self:LevelRedDot( player , illustration.progress , illustration.level ) --消除红点 for k1, v1 in pairs( player.gameData.illustration.awardInfo ) do if v1.id == v.id and self.IllustrationStatus_GainAward == v1.status then if self.IllustrationType_Furniture == cfgCurIllustration.type then skynet.server.msgTips:Reduce( player , 17 ) elseif self.IllustrationType_Clothes == cfgCurIllustration.type then skynet.server.msgTips:Reduce( player , 2 ) elseif self.IllustrationType_Plant == cfgCurIllustration.type then skynet.server.msgTips:Reduce( player , 18 ) elseif self.IllustrationType_Special == cfgCurIllustration.type then skynet.server.msgTips:Reduce( player , 1 ) elseif self.IllustrationType_PetClothes == cfgCurIllustration.type then skynet.server.msgTips:Reduce( player , 118 ) end break end end end end end data.illustrationId = self:GetPointInfo( player ) s2cData.cmd = pb.enum("MsgType","CMD_S2C_IllustrationGetPoint") s2cData.data = assert(pb.encode("S2CIllustrationGetPoint", data)) end --图鉴进度红点 function Illustration:LevelRedDot( player, progress , level ) local cfgAllIllustration = skynet.server.gameConfig:GetPlayerAllCfg( player , "IllustrationLevel") for i, v in pairs(cfgAllIllustration) do if level == tonumber(v.level ) - 1 then if progress >= tonumber(v.requirePoint) then skynet.server.msgTips:Add( player , 117 ) break end end end end --领取图鉴进度奖励 function Illustration:GetLevelReward( player , c2sData , s2cData ) c2sData.data = assert(pb.decode("C2SIllustrationLevelReward", c2sData.data )) local data = {} data.illustration = {} --获取当前图鉴等级的配置 local cfgAllIllustration = skynet.server.gameConfig:GetPlayerAllCfg( player , "IllustrationLevel") local illustration = player.gameData.illustration for i, v in pairs(cfgAllIllustration) do if illustration.level == v.level - 1 then if illustration.progress >= v.requirePoint then illustration.level = illustration.level + 1 illustration.progress = illustration.progress - v.requirePoint local eventId = pb.enum("EnumMoneyChangeEventID","EventID_134") player:GiveReward( v.reward , eventId , 1 ) data.rewardId = v.reward data.illustration.level = illustration.level data.illustration.progress = illustration.progress data.illustration.totalPoint = illustration.totalPoint if i ~= #cfgAllIllustration then if illustration.progress < cfgAllIllustration[i+1].requirePoint then skynet.server.msgTips:ReduceAll( player , 117 ) end end break end end end s2cData.cmd = pb.enum("MsgType","CMD_S2C_IllustrationLevelReward") s2cData.data = assert(pb.encode("S2CIllustrationLevelReward", data)) end --新增图鉴 function Illustration:Add( player , goodsType , goodsId ) local IllustrationType = nil local msgId = 0 if dataType.GoodsType_Furniture == goodsType then if skynet.server.gashapon:IsGashapon( player , goodsId ) then IllustrationType = self.IllustrationType_Special msgId = 1 else IllustrationType = self.IllustrationType_Furniture msgId = 17 end elseif dataType.GoodsType_Decorate == goodsType then IllustrationType = self.IllustrationType_Furniture msgId = 17 elseif dataType.GoodsType_Clothes == goodsType then IllustrationType = self.IllustrationType_Clothes msgId = 2 elseif dataType.GoodsType_Plant == goodsType then IllustrationType = self.IllustrationType_Plant msgId = 18 elseif dataType.GoodsType_Garden == goodsType then IllustrationType = self.IllustrationType_Garden --花园红点 待添加 elseif dataType.GoodsType_PetClothes == goodsType then IllustrationType = self.IllustrationType_PetClothes msgId = 118 end --非图鉴类型不处理 if nil == IllustrationType then return end --不存在就插入图鉴 if not self:IsExistGoods( player , goodsType , goodsId ) then table.insert( player.gameData.illustration.goodsInfo , { type = goodsType , id = goodsId } ) local data = {} data.item = { type = goodsType , id = goodsId } data.illustrationId = 0 --检查是否完成图鉴,完成了就通知客户端 local isAchieve,illustrationId = self:IsNewAchieve( player , IllustrationType ) if isAchieve then data.illustrationId = illustrationId --if 1 ~= msgId then skynet.server.msgTips:Add( player , msgId ) --end end skynet.server.gameServer:SendMsgToUser( player.userId , "CMD_S2C_IllustrationUpdate" , data ) log.debug(string.format("玩家 %d 图鉴 新增图鉴 图鉴类型 %d 商品类型 %d 商品ID %d" , player.userId , IllustrationType , goodsType , goodsId )) end end --是否存在图鉴商品 function Illustration:IsExistGoods( player , type , id ) for k, v in pairs( player.gameData.illustration.goodsInfo ) do if type == v.type and id == v.id then return true end end return false end --是否领取图鉴礼包 function Illustration:IsGainAward( player , id ) for k, v in pairs( player.gameData.illustration.awardInfo ) do if id == v.id and self.IllustrationStatus_Achieve == v.status then return true end end return false end --是否有新完成的图鉴 function Illustration:IsNewAchieve( player , IllustrationType ) local IsAchieve = false local IllustrationId = nil --获取当前图鉴类型的配置 local cfgAllIllustration = skynet.server.gameConfig:GetPlayerAllCfg( player , "Illustration") local cfgIllustration = {} for k, v in pairs( cfgAllIllustration ) do if IllustrationType == v.type and 1 == v.display then --只有显示的才参与 table.insert( cfgIllustration , v ) end end if self.IllustrationType_Furniture == IllustrationType then --家具和装修 for k, v in pairs( cfgIllustration ) do if not self:IsExistAchieve( player , v.id ) then IsAchieve = self:CheckFurnitureAchieve( player , v.suitId ) if IsAchieve then IllustrationId = v.id break end end end elseif self.IllustrationType_Clothes == IllustrationType then --套装衣服 for k, v in pairs( cfgIllustration ) do if not self:IsExistAchieve( player , v.id ) then IsAchieve = self:CheckClothesAchieve( player , v.suitId ) if IsAchieve then IllustrationId = v.id break end end end elseif self.IllustrationType_PetClothes == IllustrationType then --宠物衣服 for k, v in pairs( cfgIllustration ) do if not self:IsExistAchieve( player , v.id ) then IsAchieve = self:CheckClothesAchieve( player , v.suitId ) if IsAchieve then IllustrationId = v.id break end end end elseif self.IllustrationType_Plant == IllustrationType then --植物 for k, v in pairs( cfgIllustration ) do if not self:IsExistAchieve( player , v.id ) then IsAchieve = self:CheckPlantAchieve( player , v.suitId ) if IsAchieve then IllustrationId = v.id break end end end elseif self.IllustrationType_Special== IllustrationType then --特殊扭蛋 for k, v in pairs( cfgIllustration ) do if not self:IsExistAchieve( player , v.id ) then IsAchieve = self:CheckSpecialAchieve( player , v.suitId ) if IsAchieve then IllustrationId = v.id break end end end elseif self.IllustrationType_Garden== IllustrationType then --花园 for k, v in pairs( cfgIllustration ) do if not self:IsExistAchieve( player , v.id ) then IsAchieve = self:CheckGardenAchieve( player , v.suitId ) if IsAchieve then IllustrationId = v.id break end end end end --完成了就添加 if IsAchieve then self:AddAchieve( player , IllustrationId ) log.debug(string.format("玩家 %d 图鉴 图鉴类型 %d 图鉴ID %d 完成" , player.userId , IllustrationType , IllustrationId )) end return IsAchieve,IllustrationId end --检查完成图鉴便没有领取的发消息提示 function Illustration:IsSendTips( player ) local cfgBook = skynet.server.gameConfig:GetPlayerAllCfg( player , "FurnitureBook") for k, v in pairs( cfgBook ) do --找到完成的图鉴ID,但又没有领取的 local IsAchieve = self:CheckAchieve( player , v.furnitrueId , v.decorateId ) if IsAchieve then if not self:IsGainAward( player , self.IllustrationType_Furniture , v.id ) then skynet.server.msgTips:Reset( player , 17 ) skynet.server.msgTips:Add( player , 17 ) return end end end end --检查套间完成图鉴 function Illustration:CheckFurnitureAchieve( player , suitId ) local IsAchieve1 = true local IsAchieve2 = true --找出套装家具 local cfgAllFurniture = skynet.server.gameConfig:GetPlayerAllCfg( player , "Furniture") local cfgFurniture = {} for k, v in pairs( cfgAllFurniture ) do if suitId== v.suitType then table.insert( cfgFurniture , v ) end end --家具 for k, v in pairs( cfgFurniture ) do IsAchieve1 = self:IsExistGoods( player , dataType.GoodsType_Furniture , v.id ) if not IsAchieve1 then break end end --找出套装装修 local cfgAllDecoration = skynet.server.gameConfig:GetPlayerAllCfg( player , "Decoration") local cfgDecoration = {} for k, v in pairs( cfgAllDecoration ) do if suitId== v.suitType then table.insert( cfgDecoration , v ) end end --装修 for k, v in pairs( cfgDecoration ) do IsAchieve2 = self:IsExistGoods( player , dataType.GoodsType_Decorate , v.id ) if not IsAchieve2 then break end end if IsAchieve1 and IsAchieve2 then return true else return false end end --检查衣服完成图鉴 function Illustration:CheckClothesAchieve( player , suitId ) local IsAchieve = true --找出衣服类型 local cfgAllClothes = {} local goodsType = nil local cfgClothesSuit = skynet.server.gameConfig:GetPlayerAllCfg( player , "ClothesSuit") for k, v in pairs(cfgClothesSuit) do if suitId == v.id then if 1 == v.type then --人物 goodsType = dataType.GoodsType_Clothes cfgAllClothes = skynet.server.gameConfig:GetPlayerAllCfg( player , "Clothes") elseif 2 == v.type then --宠物 goodsType = dataType.GoodsType_PetClothes cfgAllClothes = skynet.server.gameConfig:GetPlayerAllCfg( player , "PetClothes") end break end end --找出套装家具 local cfgClothes = {} for k, v in pairs( cfgAllClothes ) do if suitId== v.suitId then table.insert( cfgClothes , v ) end end --是否存在商品 for k, v in pairs( cfgClothes ) do IsAchieve = self:IsExistGoods( player , goodsType , v.id ) if not IsAchieve then break end end if IsAchieve then return true else return false end end --检查植物完成图鉴 function Illustration:CheckPlantAchieve( player , suitId ) local isAchieve = true --找出套装家具 local cfgPlant = skynet.server.gameConfig:GetPlayerAllCfg( player , "Plant") local cfgAllPlant = {} for k, v in pairs( cfgPlant ) do if suitId== v.subType then table.insert( cfgAllPlant , v ) end end --是否存在商品 for k, v in pairs( cfgAllPlant ) do isAchieve = self:IsExistGoods( player , dataType.GoodsType_Plant , v.id ) if not isAchieve then break end end return isAchieve end --检查特殊完成图鉴 function Illustration:CheckSpecialAchieve( player , suitId ) local IsAchieve = true --找出套装家具 local cfgAllGashapon = skynet.server.gameConfig:GetPlayerAllCfg( player , "Gashapon") local cfgGashapon = {} for k, v in pairs( cfgAllGashapon ) do if suitId== v.id then cfgGashapon = v break end end --扭蛋 for k, v in pairs( cfgGashapon.allItemId ) do IsAchieve = self:IsExistGoods( player , dataType.GoodsType_Furniture , v ) if not IsAchieve then break end end return IsAchieve end --检查花园完成图鉴 function Illustration:CheckGardenAchieve( player , suitId ) local IsAchieve = true --找出套装家具 local cfgGarden = skynet.server.gameConfig:GetPlayerAllCfg( player , "Garden") local cfgAllGarden = {} for k, v in pairs( cfgGarden ) do if suitId== v.id then table.insert( cfgAllGarden , v ) end end --是否存在商品 for k, v in pairs( cfgAllGarden ) do IsAchieve = self:IsExistGoods( player , dataType.GoodsType_Garden , v.id ) if not IsAchieve then break end end return IsAchieve end --获取图鉴 function Illustration:Get( player , goodsType , Illustration ) for k, v in pairs( player.gameData.illustration.goodsInfo ) do if goodsType == v.type then table.insert( Illustration , { type = v.type , id = v.id } ) end end end --获取所有的奖励信息 function Illustration:GetAwardInfo( player ) local awardId = {} for k, v in pairs( player.gameData.illustration.awardInfo ) do if self.IllustrationStatus_GainAward == v.status then table.insert( awardId , v.id) end end return awardId end function Illustration:GetPointInfo( player ) local pointId = {} for k, v in pairs( player.gameData.illustration.pointInfo ) do if self.IllustrationStatus_GainAward == v.status then table.insert( pointId , v.id) end end return pointId end --添加完成的图鉴 function Illustration:AddAchieve( player , IllustrationId ) local isExist = false for k, v in pairs( player.gameData.illustration.awardInfo ) do if IllustrationId == v.id then isExist = true break end end if not isExist then table.insert( player.gameData.illustration.awardInfo , { id = IllustrationId , status = self.IllustrationStatus_Achieve }) table.insert( player.gameData.illustration.pointInfo , { id = IllustrationId , status = self.IllustrationStatus_Achieve }) end end --是否存在完成的图鉴 function Illustration:IsExistAchieve( player , IllustrationId ) local isExist = false for k, v in pairs( player.gameData.illustration.awardInfo ) do if IllustrationId == v.id then isExist = true break end end return isExist end --该商品是不是套件 function Illustration:IsSuit( player , type , suitId ) local cfgAllIllustration = skynet.server.gameConfig:GetPlayerAllCfg( player , "Illustration") local cfgIllustration = {} for k, v in pairs( cfgAllIllustration ) do if type == v.type and suitId == v.suitId then return true end end return false end --同步积分奖励和收集奖励 (处理旧版数据) function Illustration:AsycPointReward( player ) if player.gameData.illustration.pointInfo == nil then player.gameData.illustration.pointInfo = {} end if next(player.gameData.illustration.pointInfo) == nil then --获取当前图鉴ID的配置 local cfgAllIllustration = skynet.server.gameConfig:GetPlayerAllCfg( player , "Illustration") for k, v in pairs( player.gameData.illustration.awardInfo ) do table.insert(player.gameData.illustration.pointInfo,{ id = v.id , status = self.IllustrationStatus_Achieve }) --红点 for k1, v1 in pairs( cfgAllIllustration ) do if v1.id == v.id then if v1.type == self.IllustrationType_Furniture then skynet.server.msgTips:Reset( player , 17 ) skynet.server.msgTips:Add( player , 17 ) elseif v1.type == self.IllustrationType_Clothes then skynet.server.msgTips:Reset( player , 2 ) skynet.server.msgTips:Add( player , 2 ) elseif v1.type == self.IllustrationType_Plant then skynet.server.msgTips:Reset( player , 18 ) skynet.server.msgTips:Add( player , 18 ) elseif v1.type == self.IllustrationType_Special then skynet.server.msgTips:Reset( player , 1 ) skynet.server.msgTips:Add( player , 1 ) elseif v1.type == self.IllustrationType_PetClothes then skynet.server.msgTips:Reset( player , 118 ) skynet.server.msgTips:Add( player , 118 ) end break end end end end end --将花园相关物品添加至图鉴(处理旧版数据) function Illustration:AsycGardenIllstration( player ) if next(player.gameData.bag) ~= nil then for i, v in pairs(player.gameData.bag) do if v.type == dataType.GoodsType_Garden then self:Add( player , dataType.GoodsType_Garden , v.id ) end end end end --修复旧版扭蛋bug function Illustration:FixGashaponData( player ) local cfgAllGashapon = skynet.server.gameConfig:GetPlayerAllCfg( player , "Gashapon") local cfgAllIllustration = skynet.server.gameConfig:GetPlayerAllCfg( player , "Illustration") local cfgGashapon = {} local IsAchieve = true skynet.server.msgTips:Reset( player , 1 ) for k, v in pairs( cfgAllGashapon ) do cfgGashapon = v for k1, v1 in pairs( cfgGashapon.allItemId ) do IsAchieve = self:IsExistGoods( player , dataType.GoodsType_Furniture , v1 ) if not IsAchieve then break end end if IsAchieve then for k2, v2 in pairs( cfgAllIllustration ) do if v2.type == self.IllustrationType_Special and v2.suitId == cfgGashapon.id then self:AddAchieve( player , v2.id ) skynet.server.msgTips:Add( player , 1 ) end end end end player.gameData.illustration.fixGashapon = true end --修复扭蛋红点 function Illustration:FixGashaponRedDot( player ) if player.gameData.illustration.pointInfo == nil or next(player.gameData.illustration.pointInfo) == nil then return end skynet.server.msgTips:Reset( player , 1 ) --获取当前图鉴ID的配置 for k, v in pairs( player.gameData.illustration.awardInfo ) do if self.IllustrationStatus_Achieve == v.status then local cfgCurOne= skynet.server.gameConfig:GetPlayerCurCfg( player , "Illustration" , v.id ) if cfgCurOne and self.IllustrationType_Special == cfgCurOne.type then skynet.server.msgTips:Add( player , 1 ) end end end for k, v in pairs( player.gameData.illustration.pointInfo ) do if self.IllustrationStatus_Achieve == v.status then local cfgCurOne = skynet.server.gameConfig:GetPlayerCurCfg( player , "Illustration" , v.id ) if cfgCurOne and self.IllustrationType_Special == cfgCurOne.type then skynet.server.msgTips:Add( player , 1 ) end end end end skynet.server.illustration = Illustration return Illustration