709 lines
26 KiB
Lua
709 lines
26 KiB
Lua
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 redisKeyUrl = require "RedisKeyUrl"
|
||
local json = require "json"
|
||
local MsgTips = oo.class()
|
||
|
||
--检查一下玩家是否有新的消息提示
|
||
function MsgTips:LoginInitData( player )
|
||
player.tmpData.lastRefreshTime = 0 --上一次刷新时间
|
||
local cfgTask = skynet.server.gameConfig:GetPlayerAllCfg( player , "PhoneMsg") --消息配置
|
||
for k, v in pairs( cfgTask ) do
|
||
if not player.gameData.msgTips.data[ v.id ] then
|
||
player.gameData.msgTips.data[ v.id ] = {}
|
||
player.gameData.msgTips.data[ v.id ].id = v.id
|
||
player.gameData.msgTips.data[ v.id ].isRefresh = true --是否能刷新
|
||
player.gameData.msgTips.data[ v.id ].count = 0 --数量
|
||
end
|
||
end
|
||
end
|
||
|
||
--消息提示确认
|
||
function MsgTips:Confirm( player , c2sData , s2cData )
|
||
c2sData.data = assert(pb.decode("C2SMsgTipsConfirm", c2sData.data ))
|
||
|
||
local data = {}
|
||
local id = c2sData.data.tipsInfo.id
|
||
local count = c2sData.data.tipsInfo.count
|
||
|
||
if not id or not count then
|
||
s2cData.code = errorInfo.ErrorCode.ErrRequestParam
|
||
else
|
||
local msgTips = player.gameData.msgTips.data[ id ]
|
||
if not msgTips then
|
||
s2cData.code = errorInfo.ErrorCode.ErrRequestParam
|
||
else
|
||
msgTips.isRefresh = true
|
||
|
||
--只种设置面板中领奖的
|
||
if (id >= 20 and id <= 22) or 66 == id then
|
||
msgTips.count = 0
|
||
end
|
||
--[[
|
||
if 15 ~= id then
|
||
msgTips.count = msgTips.count - count
|
||
if msgTips.count < 0 then
|
||
msgTips.count = 0
|
||
end
|
||
end
|
||
]]
|
||
|
||
data.tipsInfo = self:GetOneTips( player , id )
|
||
data.reward = {}
|
||
|
||
--只有部分可以红点领奖
|
||
for k, v in pairs( player.gameData.msgTips.reward ) do
|
||
if id == v.id and dataType.Status_CanGain == v.status then
|
||
local goodsType = v.goodsType
|
||
local goodsId = v.goodsId
|
||
local goodsCount = v.goodsCount
|
||
data.reward = { goodsType = goodsType , goodsId = goodsId , goodsCount = goodsCount }
|
||
skynet.server.bag:AddGoods( player , goodsType , goodsId , goodsCount )
|
||
v.status = dataType.Status_AlreadyGain
|
||
log.debug(string.format("玩家 %d 消息提示 领取奖励 消息ID %d 物品类型 %d 物品ID %d 物品数量 %d" , player.userId , id , goodsType , goodsId , goodsCount))
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
s2cData.cmd = pb.enum("MsgType","CMD_S2C_MsgTipsConfirm")
|
||
s2cData.data = assert(pb.encode("S2CMsgTipsConfirm", data))
|
||
end
|
||
|
||
--清除指定红点
|
||
function MsgTips:ReduceTips( player , c2sData , s2cData )
|
||
c2sData.data = assert(pb.decode("C2SReduceTips", c2sData.data ))
|
||
self:ReduceAll(player, c2sData.data.id)
|
||
local data = {}
|
||
s2cData.cmd = pb.enum("MsgType","CMD_S2C_ReduceTips")
|
||
s2cData.data = assert(pb.encode("S2CReduceTips", data))
|
||
end
|
||
|
||
--发送最新的消息提示
|
||
function MsgTips:SendLastTips( player , msgId )
|
||
local data = {}
|
||
data.tipsInfo = self:GetOneTips( player , msgId )
|
||
skynet.server.gameServer:SendMsgToUser( player.userId , "CMD_S2C_MsgTipsNotice" , data )
|
||
end
|
||
|
||
--增加提示
|
||
function MsgTips:Add( player , id , count , isSendMsg )
|
||
count = count or 1
|
||
if nil == isSendMsg then
|
||
isSendMsg = true
|
||
end
|
||
|
||
local msgTips = player.gameData.msgTips.data[ id ]
|
||
if not msgTips then
|
||
return
|
||
end
|
||
|
||
local phoneMsg = skynet.server.gameConfig:GetPlayerCurCfg( player , "PhoneMsg", id )
|
||
if not phoneMsg then
|
||
return
|
||
end
|
||
|
||
--未解锁的不发红点
|
||
if 1 == phoneMsg.msgType and not player:IsUnlockSystem( dataType.UnlockSystem_Gift) or
|
||
2 == phoneMsg.msgType and not player:IsUnlockSystem( dataType.UnlockSystem_Used) or
|
||
3 == phoneMsg.msgType and not player:IsUnlockSystem( dataType.UnlockSystem_Furniture) or
|
||
4 == phoneMsg.msgType and not player:IsUnlockSystem( dataType.UnlockSystem_Clothing) or
|
||
5 == phoneMsg.msgType and not player:IsUnlockSystem( dataType.UnlockSystem_Plant) or
|
||
6 == phoneMsg.msgType and not player:IsUnlockSystem( dataType.UnlockSystem_MoveHome) or
|
||
7 == phoneMsg.msgType and not player:IsUnlockSystem( dataType.UnlockSystem_Friend) then
|
||
return
|
||
end
|
||
|
||
msgTips.isRefresh = false
|
||
msgTips.count = msgTips.count + count
|
||
if id >= 20 and id <= 22 then
|
||
local goodsId = 0
|
||
if 20 == id then
|
||
goodsId = 674
|
||
elseif 21 == id then
|
||
goodsId = 672
|
||
elseif 22 == id then
|
||
goodsId = 673
|
||
end
|
||
|
||
local isExist = false
|
||
for k, v in pairs( player.gameData.msgTips.reward ) do
|
||
if id == v.id then
|
||
isExist = true
|
||
end
|
||
end
|
||
|
||
if not isExist then
|
||
local reward = {}
|
||
reward.id = id
|
||
reward.status = dataType.Status_CanGain
|
||
reward.goodsType = pb.enum("EnumGoodsType" ,"Furniture")
|
||
reward.goodsId = goodsId
|
||
reward.goodsCount = 1
|
||
table.insert( player.gameData.msgTips.reward , reward )
|
||
end
|
||
end
|
||
|
||
local data = {}
|
||
data.tipsInfo = self:GetOneTips( player , id )
|
||
skynet.server.gameServer:SendMsgToUser( player.userId , "CMD_S2C_MsgTipsNotice" , data )
|
||
log.debug(string.format("玩家 %d 消息提示 发送红点 消息ID %d " , player.userId , id))
|
||
end
|
||
|
||
--重置为0
|
||
function MsgTips:Reset( player , id )
|
||
local msgTips = player.gameData.msgTips
|
||
if msgTips.data[ id ] then
|
||
msgTips.data[ id ].count = 0
|
||
self:Get(player ,id).isRefresh = true
|
||
end
|
||
end
|
||
|
||
--减少
|
||
function MsgTips:Reduce( player , id )
|
||
local msgTipsData = player.gameData.msgTips.data[ id ]
|
||
|
||
if msgTipsData and msgTipsData.count > 0 then
|
||
msgTipsData.count = msgTipsData.count - 1
|
||
if msgTipsData.count < 0 then
|
||
msgTipsData.count = 0
|
||
end
|
||
|
||
local data = {}
|
||
data.tipsInfo = self:GetOneTips( player , id )
|
||
skynet.server.gameServer:SendMsgToUser( player.userId , "CMD_S2C_MsgTipsNotice" , data )
|
||
self:Get(player ,id).isRefresh = true
|
||
end
|
||
end
|
||
|
||
--减少所有
|
||
function MsgTips:ReduceAll( player , id )
|
||
local msgTipsData = player.gameData.msgTips.data[ id ]
|
||
if msgTipsData and msgTipsData.count > 0 then
|
||
msgTipsData.count = 0
|
||
local data = {}
|
||
data.tipsInfo = self:GetOneTips( player , id )
|
||
skynet.server.gameServer:SendMsgToUser( player.userId , "CMD_S2C_MsgTipsNotice" , data )
|
||
self:Get(player ,id).isRefresh = true
|
||
end
|
||
end
|
||
|
||
--增加提示
|
||
function MsgTips:AddNoNotice( player , id )
|
||
local msgTips = player.gameData.msgTips.data[ id ]
|
||
if not msgTips then
|
||
return
|
||
end
|
||
|
||
msgTips.count = msgTips.count + 1
|
||
end
|
||
|
||
--获取TIPS信息
|
||
function MsgTips:Get( player , id )
|
||
return player.gameData.msgTips.data[ id ]
|
||
end
|
||
|
||
--获取当个TIPS信息
|
||
function MsgTips:GetOneTips( player , id )
|
||
return { id = id , count = player.gameData.msgTips.data[ id ].count }
|
||
end
|
||
|
||
--获取所有TIPS信息(玩家登录时会调用)
|
||
function MsgTips:GetAllTips( player , curDetail , groupData )
|
||
local myGroupId = curDetail.groupId
|
||
local myPartnerId = player.gameData.partner.id
|
||
|
||
--登录时,对所有的红点进行检查一下,有的话统一发给客户端
|
||
local isFriendNewMsg = false
|
||
local friendList = skynet.server.partner:GetFriendList( player )
|
||
for k, v in pairs(friendList) do
|
||
if v.unReadCount > 0 then
|
||
isFriendNewMsg = true
|
||
break
|
||
end
|
||
end
|
||
|
||
if isFriendNewMsg then
|
||
self:Reset(player , 53 )
|
||
self:Add( player , 53 , 1 , false )
|
||
end
|
||
|
||
--检查一下是否有申请好友
|
||
local applyList = skynet.server.partner:GetApplyList( player )
|
||
if #applyList > 0 then
|
||
self:Reset(player , 54 )
|
||
skynet.server.msgTips:Add( player , 54 , 1 , false )
|
||
end
|
||
|
||
--如果自己是家园管理园,就需要检查是下有不有人加入,发送红点
|
||
if curDetail and "" ~= curDetail.groupId and skynet.server.group.IdentityType_Member ~= curDetail.groupIdentityType then
|
||
local redisApplyJoinKey = string.format( redisKeyUrl.GameServerGroupUserApplyJoinZSet , myGroupId )
|
||
local partnerIds = skynet.server.redis:zrange( redisApplyJoinKey , 0 , -1 )
|
||
if #partnerIds > 0 then
|
||
--有玩家需要加入
|
||
|
||
local joinType = tonumber(groupData[2]) or skynet.server.groupManage.JoinType_Audit
|
||
if skynet.server.groupManage.JoinType_Freedom == joinType then
|
||
--如果家园已经改成自由加入,那么之前的申请列表就可以清除了
|
||
for k, joinPartnerId in pairs( partnerIds ) do
|
||
--将每个玩家的申请加入家园的列表中删除该家园
|
||
local redisJoinPartnerIdKey = string.format( redisKeyUrl.GameServerGroupMyApplyJoinZSet , joinPartnerId )
|
||
skynet.server.redis:zrem( redisJoinPartnerIdKey , myGroupId )
|
||
end
|
||
--然后删除该家园的所有申请列表
|
||
skynet.server.redis:del(redisApplyJoinKey)
|
||
elseif skynet.server.groupManage.JoinType_Audit == joinType then
|
||
--如果家园还是审核状态,就需要发送红点
|
||
self:Reset(player , 60 )
|
||
self:Add( player , 60 , 1 , false )
|
||
end
|
||
else
|
||
self:Reset(player , 60 )
|
||
end
|
||
end
|
||
|
||
if curDetail and "" ~= curDetail.groupId and 0 == curDetail.groupSignInType then
|
||
local isHave = false
|
||
--没有签到就有红点
|
||
if 0 == curDetail.groupSignInType then
|
||
isHave = true
|
||
end
|
||
|
||
--有奖励并且我没有领取有红点
|
||
local contributeReward = tonumber(groupData[1] )
|
||
if contributeReward and contributeReward > 0 then
|
||
local redisKey = string.format( redisKeyUrl.GameServerGroupContributeRewardRecordSet, myGroupId )
|
||
if skynet.server.redis:sismember( redisKey , myPartnerId ) then
|
||
isHave = true
|
||
end
|
||
end
|
||
|
||
--检查有不有帮助奖励
|
||
local helpCount,rewardId = skynet.server.groupManage:CheckHelpReward( player )
|
||
if 0 ~= helpCount then
|
||
isHave = true
|
||
end
|
||
|
||
if isHave then
|
||
self:Reset( player , 38 )
|
||
self:Add( player , 38 , 1 , false)
|
||
end
|
||
else
|
||
self:Reset( player , 38 )
|
||
end
|
||
|
||
if curDetail and "" ~= curDetail.groupId and curDetail.groupRandId >= 1 and curDetail.groupRandId <= 6 then
|
||
self:Reset( player , 39 )
|
||
self:Add( player , 39 , 1 , false)
|
||
else
|
||
self:Reset( player , 39 )
|
||
end
|
||
|
||
skynet.server.friend:GetMsgTipsCount( player )
|
||
--获取当前所有的红点信息
|
||
local tipsInfo = {}
|
||
for id, v in pairs( player.gameData.msgTips.data ) do
|
||
table.insert( tipsInfo , { id = id , count = v.count })
|
||
end
|
||
return tipsInfo
|
||
end
|
||
|
||
--刷新
|
||
function MsgTips:Refresh( player )
|
||
if skynet.GetTime() < player.tmpData.lastRefreshTime then
|
||
return
|
||
end
|
||
|
||
player.tmpData.lastRefreshTime = skynet.GetTime() + 60
|
||
|
||
local time = skynet.GetTime()
|
||
local gameData = player.gameData
|
||
|
||
if self:Get(player ,3).isRefresh then
|
||
skynet.server.used:CheckRefreshGoods( player )
|
||
self:ReduceAll( player , 3 )
|
||
--出售的商品有买家来下单啦!
|
||
for k, v in pairs( gameData.used.sellInfo ) do
|
||
if time >=v.sellTime and skynet.server.used.SellStatus_SomeoneWant == v.status then
|
||
self:Add( player , 3 )
|
||
break
|
||
end
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,4).isRefresh then
|
||
self:ReduceAll( player , 4 )
|
||
--快递已送达,快去取件吧
|
||
for k, v in pairs( gameData.used.logisticsInfo ) do
|
||
if time >= v.reachTime and skynet.server.used.GoodsStatus_AlreadyReach == v.goodsStatus then
|
||
self:Add( player , 4 )
|
||
--通知客户端
|
||
local data = {}
|
||
data.logisticsInfo = skynet.server.used:GetLogisticsInfo( player )
|
||
skynet.server.gameServer:SendMsgToUser( player.userId , "CMD_S2C_UsedLogisticsShow" , data )
|
||
break
|
||
end
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,5).isRefresh then
|
||
--家具换货咯,快来看看
|
||
local shopType = dataType.ShopType_Furniture
|
||
if gameData.shop[ shopType ] and time >= gameData.shop[ shopType ].nextRefreshTime then
|
||
self:Add( player , 5 )
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,6).isRefresh then
|
||
--摆件换货咯,快来看看
|
||
local shopType = dataType.ShopType_Cinnabar
|
||
if gameData.shop[ shopType ] and time >= gameData.shop[ shopType ].nextRefreshTime then
|
||
self:Add( player , 6 )
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,7).isRefresh then
|
||
--装修换货咯,快来看看
|
||
local shopType = dataType.ShopType_Decorate
|
||
if gameData.shop[ shopType ] and time >= gameData.shop[ shopType ].nextRefreshTime then
|
||
self:Add( player , 7 )
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,8).isRefresh then
|
||
--套间展示更换咯,快来看看
|
||
local shopType = dataType.ShopType_Suit
|
||
if gameData.shop[ shopType ] and time >= gameData.shop[ shopType ].nextRefreshTime then
|
||
self:Add( player , 8 )
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,9).isRefresh then
|
||
--服饰换货咯,快来看看
|
||
local shopType = dataType.ShopType_Clothes
|
||
if gameData.shop[ shopType ] and time >= gameData.shop[ shopType ].nextRefreshTime then
|
||
self:Add( player , 9 )
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,10).isRefresh then
|
||
--装扮换货咯,快来看看
|
||
local shopType = dataType.ShopType_Fashion
|
||
if gameData.shop[ shopType ] and time >= gameData.shop[ shopType ].nextRefreshTime then
|
||
self:Add( player , 10 )
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,11).isRefresh then
|
||
--植物种子换货咯,快来看看
|
||
local shopType = dataType.ShopType_Seed
|
||
if gameData.shop[ shopType ] and time >= gameData.shop[ shopType ].nextRefreshTime then
|
||
self:Add( player , 11 )
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,12).isRefresh then
|
||
--出售的植物被买家买走啦
|
||
local shopType = dataType.ShopType_Plant
|
||
local curShelf = nil
|
||
if gameData.shop[ shopType ] then
|
||
for i = 1, skynet.server.plantShop.MaxShelfCount , 1 do
|
||
curShelf = gameData.shop[ shopType ].shopShelf[ i ]
|
||
if 0 ~= curShelf.goodsId and time >= curShelf.sellTime and not curShelf.isSell then
|
||
self:Add( player , 12 )
|
||
break
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,13).isRefresh then
|
||
--新的花盆解锁了,快来看看
|
||
local shopType = dataType.ShopType_Seed
|
||
local flowerpotList = skynet.server.generalShop:GetUnLockFlowerpot( player , self.FlowerpotType_Seed )
|
||
for k1, v1 in pairs( flowerpotList ) do
|
||
local isExistFlowerpot = false --是否存在花盆
|
||
for k2, v2 in pairs( gameData.shop[ shopType ].specialGoods ) do
|
||
if v1 == v2.id then
|
||
isExistFlowerpot = true
|
||
break
|
||
end
|
||
end
|
||
if not isExistFlowerpot then
|
||
self:Add( player , 13 )
|
||
break
|
||
end
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,16).isRefresh then
|
||
--闲菜换货咯,快来看看
|
||
if time >= gameData.used.buyRefreshTime then
|
||
self:Add( player , 16 )
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,31).isRefresh then
|
||
if skynet.server.raffle:CheckFreeDesign(player,skynet.server.raffle.LotteryType_2) then
|
||
self:Add( player , 31 )
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,34).isRefresh then
|
||
if skynet.server.raffle:CheckFreeDesign(player,skynet.server.raffle.LotteryType_1) then
|
||
self:Add( player , 34 )
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,41).isRefresh then
|
||
--染色工坊有可领取的 进行添加对应的红点
|
||
for k ,v in pairs(gameData.dyeWorkShop.slotData) do
|
||
if time >= v.finishTime and v.status == skynet.server.dyeworkshop.SlotStatusTime then
|
||
v.status = skynet.server.dyeworkshop.SlotStatusGet
|
||
self:Add( player , 41 )
|
||
end
|
||
end
|
||
end
|
||
|
||
--扭蛋机红点
|
||
if self:Get(player ,50).isRefresh then
|
||
--消除对应红点
|
||
if skynet.server.bag:GetGoodsCount( player , dataType.GoodsType_Prop , 7) > 0 then
|
||
skynet.server.msgTips:Add(player , 50)
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,51).isRefresh and gameData.shop[ dataType.ShopType_Cuisine ] then
|
||
--料理店植物成熟 进行添加对应的红点
|
||
local timeCoefficient = skynet.server.store:GetTimeCoefficient(player , 3)
|
||
for k ,v in pairs(gameData.shop[ dataType.ShopType_Cuisine ].plotInfos) do
|
||
if v.matId > 0 then
|
||
local cfgCuisineMaterial = skynet.server.gameConfig:GetPlayerAllCfg( player , "CuisineMaterial")
|
||
local allStatusTime = skynet.server.cuisineShop:GetAllStatusTime(player , cfgCuisineMaterial[v.matId].plantId , v.status , v.nextStatusTime , timeCoefficient)
|
||
if allStatusTime[4] and time >= allStatusTime[4].nextStatusTime and v.nextStatusTime > 0 then
|
||
self:Add( player , 51 )
|
||
--修改对应状态
|
||
v.status = 5
|
||
v.nextStatusTime = 0
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
if self:Get(player ,61).isRefresh then
|
||
--家具工坊有可领取的 进行添加对应的红点
|
||
for k ,v in pairs(gameData.furnitureWorkShop.slotData) do
|
||
if time >= v.finishTime and v.status == skynet.server.furnitureWorkShop.SlotStatusTime then
|
||
v.status = skynet.server.furnitureWorkShop.SlotStatusGet
|
||
self:Add( player , 61 )
|
||
end
|
||
end
|
||
end
|
||
|
||
--咖啡店有一种材料可以领取就给红点
|
||
if self:Get(player ,72).isRefresh then
|
||
local curShop = gameData.shop[ dataType.ShopType_Coffee ]
|
||
if curShop then
|
||
for k, v in pairs( curShop.supplierBoxes ) do
|
||
--如果CD时间到了,就给红点
|
||
if skynet.GetTime() > v.nextRefreshTime and v.count < 1 then
|
||
self:Reset( player , 72 )
|
||
self:Add( player , 72 )
|
||
break
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
--造型间剪刀满了
|
||
if self:Get(player ,74).isRefresh then
|
||
skynet.server.styleShop:CheckRestoreEnergy( player )
|
||
end
|
||
|
||
--宠物店出游奖励可领取增加红点
|
||
if self:Get(player ,82).isRefresh then
|
||
local curShop = gameData.shop[ dataType.ShopType_PetShop ]
|
||
if curShop then
|
||
for k, v in pairs( curShop.petTravel ) do
|
||
--如果CD时间到了,就给红点
|
||
if self:GetOneTips(player, 82).count == 0 then
|
||
if v.status == 2 or v.status == 1 and skynet.GetTime() >= v.finishTime then
|
||
self:Reset( player , 82 )
|
||
self:Add( player , 82 )
|
||
break
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
--宠物店商店盲盒有奖励可领取增加红点
|
||
if self:Get(player ,83).isRefresh then
|
||
local curShop = gameData.shop[ dataType.ShopType_PetShop ]
|
||
if curShop then
|
||
if self:GetOneTips(player, 83).count == 0 then
|
||
if curShop.blindBoxStatus == 1 or curShop.blindBoxStatus == 0 and skynet.GetTime() >= curShop.nextFreeTime then
|
||
self:Reset( player , 83 )
|
||
self:Add( player , 83 )
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
--恋家置业房产咨询租房完成可领奖时增加红点
|
||
if self:Get(player ,86).isRefresh then
|
||
local curShop = gameData.houseRent
|
||
if curShop then
|
||
self:ReduceAll( player , 86 )
|
||
for k, v in pairs( curShop.houseInfo ) do
|
||
--如果CD时间到了,就给红点
|
||
if (v.leaseStatus == 2 or v.leaseStatus == 3) and skynet.GetTime() >= v.finishTime and skynet.server.houseRent:IsShow( player , v.id ) then
|
||
self:Add( player , 86 )
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
--限时累计充值
|
||
if self:Get(player ,94).isRefresh then
|
||
if skynet.server.activityLimitedAccum:IfConDrawReward(player) then
|
||
self:Add( player , 94 )
|
||
end
|
||
end
|
||
-- --向往一日任务可领奖时增加红点
|
||
if self:Get(player ,99).isRefresh then
|
||
if gameData.activity[dataType.ActivityType_DreamLife] and next(gameData.activity[dataType.ActivityType_DreamLife]) ~= nil then
|
||
skynet.server.group:CheckDreamLifeTask(player)
|
||
for k, v in pairs( gameData.activity[dataType.ActivityType_DreamLife].DreamLife.tasks ) do
|
||
if v.kind == 1 and v.status == skynet.server.activityDreamLife.TaskStatus_NoFinish and skynet.GetTime() >= v.finishTime then
|
||
v.status = skynet.server.activityDreamLife.TaskStatus_NoGet
|
||
self:Add( player , 99 )
|
||
elseif v.kind == 2 and v.status ~= skynet.server.activityDreamLife.TaskStatus_Get and v.status ~= skynet.server.activityDreamLife.TaskStatus_NoGet then
|
||
local cfgOneDreamLifeTask = skynet.server.gameConfig:GetPlayerCurCfg(player, "DreamLifeTask", v.id).targetHeadcount
|
||
local taskType = dataType.GroupTaskType_DreamLife
|
||
v.progress = skynet.server.group:GetTaskCount(player, taskType, v.id)
|
||
if v.progress >= cfgOneDreamLifeTask then
|
||
v.status = skynet.server.activityDreamLife.TaskStatus_NoGet
|
||
self:Add( player , 99 )
|
||
elseif v.progress < cfgOneDreamLifeTask and v.status == skynet.server.activityDreamLife.TaskStatus_NoFinish then
|
||
if skynet.server.group:GetDreamLifeTaskState(player, v.id) then
|
||
v.status = skynet.server.activityDreamLife.TaskStatus_OtherNoFinish
|
||
end
|
||
-- 修改进度
|
||
-- skynet.server.group:UpdateTask(player, taskType, v.id)
|
||
|
||
--进度赋值
|
||
v.progress = skynet.server.group:GetTaskCount(player, taskType, v.id)
|
||
if v.progress >= cfgOneDreamLifeTask then
|
||
v.status = skynet.server.activityDreamLife.TaskStatus_NoGet
|
||
self:Add( player , 99 )
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
-- 好物匹配 关卡可以挑战
|
||
if self:Get(player ,104).isRefresh then
|
||
|
||
--活动开启,放大镜大于0
|
||
if skynet.server.activityMatchStuff:CanChallenge(player) then
|
||
self:Add(player,104)
|
||
end
|
||
end
|
||
|
||
--好物匹配 商店可以兑换
|
||
if self:Get(player ,105).isRefresh then
|
||
if skynet.server.activityMatchStuff:IsCanBuy(player) then
|
||
--可以购买
|
||
self:Add(player,105)
|
||
end
|
||
end
|
||
|
||
--新手限定设计卡池 领奖
|
||
if self:Get(player ,107).isRefresh then
|
||
if skynet.server.activityNewPlayerRaffle:IsDrawReward(player) then
|
||
self:Add(player,107)
|
||
end
|
||
end
|
||
|
||
--限时签到 领奖
|
||
if self:Get(player ,109).isRefresh then
|
||
local conNormalRewardIds,conSpecialRewardIds =skynet.server.activitySignPack:GetConDrawReward(player)
|
||
if next(conNormalRewardIds) or next(conSpecialRewardIds) then
|
||
self:Add(player,109)
|
||
end
|
||
end
|
||
|
||
--寻宝活动有挑战机会时
|
||
if self:Get(player ,113).isRefresh then
|
||
if skynet.server.activitySeekTreasure:IsConParticipationNum(player) then
|
||
self:Add(player,113)
|
||
end
|
||
end
|
||
|
||
--寻宝活动挑战未完成时
|
||
if self:Get(player ,114).isRefresh then
|
||
if skynet.server.activitySeekTreasure:IsEnd(player) then
|
||
self:Add(player,114)
|
||
end
|
||
end
|
||
|
||
--进阶礼包
|
||
if self:Get(player ,116).isRefresh then
|
||
if skynet.server.activityStagePack:isCanDraw(player) then
|
||
self:Add(player,116)
|
||
end
|
||
end
|
||
|
||
--限时设计礼包
|
||
if self:Get(player ,68).isRefresh then
|
||
if skynet.server.raffle:CheckTimeAward(player) then
|
||
self:Add(player,68)
|
||
end
|
||
end
|
||
|
||
--限时设计签到
|
||
if self:Get(player ,69).isRefresh then
|
||
if skynet.server.raffle:CheckSignIn(player) then
|
||
self:Add(player,69)
|
||
end
|
||
end
|
||
|
||
--分层礼包
|
||
if self:Get(player,115).isRefresh then
|
||
-- 处理红点
|
||
if not skynet.server.activityLevelPack:isFirstOpen(player) then
|
||
self:Add(player, 115)
|
||
end
|
||
end
|
||
|
||
--每日灯谜-答题
|
||
if self:Get(player ,119).isRefresh then
|
||
if skynet.server.activityDailyRiddle:isCanAnswer(player) then
|
||
self:Add(player,119)
|
||
end
|
||
end
|
||
|
||
--每日灯谜-领奖
|
||
if self:Get(player ,120).isRefresh then
|
||
if skynet.server.activityDailyRiddle:isCanDraw(player) then
|
||
self:Add(player,120)
|
||
end
|
||
end
|
||
|
||
--复刻商店
|
||
if self:Get(player ,123).isRefresh then
|
||
if skynet.server.activityReplicaStore:isCanDraw(player) then
|
||
self:Add(player,123)
|
||
end
|
||
end
|
||
end
|
||
|
||
skynet.server.msgTips = MsgTips
|
||
return MsgTips |