diff --git a/common/constant.go b/common/constant.go index f47485d..a37571e 100644 --- a/common/constant.go +++ b/common/constant.go @@ -322,6 +322,7 @@ const ( GainWayPermitReset = 114 //赛季通行证积分重置 GainWayClientUpgrade = 115 //客户端升级奖励 GainWayLottery = 116 //开奖码抽奖 + GainWayGuide2 = 117 // 竞技馆引导奖励 ) // 后台选择 金币变化类型 的充值 类型id号起始 @@ -881,3 +882,14 @@ const ( const ( NoticeTypeCustomAward = 1 + iota // 房卡场获奖通知 ) + +const ( + GuideIdNewPlayer = 1 // 新手引导 + GuideIdCustom = 2 // 竞技馆引导 +) + +// 引导奖励账变类型 +var GuideIdToGainWay = map[int]int{ + GuideIdNewPlayer: GainWayGuide, + GuideIdCustom: GainWayGuide2, +} diff --git a/model/player.go b/model/player.go index 0b9a726..38a125a 100644 --- a/model/player.go +++ b/model/player.go @@ -111,6 +111,7 @@ const ( SystemFreeGive_CollectBox // 开启卡片礼盒奖励 SystemFreeGive_CollectBoxSwap // 卡片礼盒兑换奖励 SystemFreeGive_ClientUpgrade // 客户端升级奖励 + SystemFreeGive_Guide // 新手引导奖励 ) const ( SystemFreeGive_CoinType_Coin int32 = iota //金币 diff --git a/worldsrv/action_player.go b/worldsrv/action_player.go index 353eacf..802ec87 100644 --- a/worldsrv/action_player.go +++ b/worldsrv/action_player.go @@ -3112,22 +3112,24 @@ func CSUpdateAttribute(s *netlib.Session, packetId int, data interface{}, sid in } // 日志 if pack.OpRetCode == player_proto.OpResultCode_OPRC_Sucess { - switch msg.GetTp() { - case common.AttributeGuideStep, common.AttributeGuideSkip: - d := model.CustomData{ - Event: "guide", - Platform: p.Platform, - GuideTp: msg.GetTp(), - N: int64(stepId), + if msg.GetGuideId() == 0 || msg.GetGuideId() == common.GuideIdNewPlayer { + switch msg.GetTp() { + case common.AttributeGuideStep, common.AttributeGuideSkip: + d := model.CustomData{ + Event: "guide", + Platform: p.Platform, + GuideTp: msg.GetTp(), + N: int64(stepId), + } + b, _ := json.Marshal(d) + mq.Write(&model.ClientLogMysql{ + Data: string(b), + Platform: p.Platform, + Snid: p.SnId, + Ts: time.Now().Unix(), + CreateTs: p.CreateTime.Unix(), + }) } - b, _ := json.Marshal(d) - mq.Write(&model.ClientLogMysql{ - Data: string(b), - Platform: p.Platform, - Snid: p.SnId, - Ts: time.Now().Unix(), - CreateTs: p.CreateTime.Unix(), - }) } } } @@ -3150,7 +3152,7 @@ func CSUpdateAttribute(s *netlib.Session, packetId int, data interface{}, sid in send() return nil } - if msg.GuideId == 1 { + if msg.GuideId == common.GuideIdNewPlayer { if p.GuideStep < 0 { return nil } @@ -3209,12 +3211,26 @@ func CSUpdateAttribute(s *netlib.Session, packetId int, data interface{}, sid in ItemId: award.ItemId, ItemNum: award.ItemNum, }) + // 系统赠送 + if award.GetItemId() == common.ItemIDCoin { + mq.Write(model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_Guide, 0, award.GetItemNum())) + } + if award.GetItemId() == common.ItemIDDiamond { + mq.Write(model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_Guide, 1, award.GetItemNum())) + } } + + gainWay := common.GainWayGuide + gain := common.GuideIdToGainWay[int(msg.GetGuideId())] + if gain > 0 { + gainWay = gain + } + BagMgrSingleton.AddItems(&model.AddItemParam{ Platform: p.Platform, SnId: p.SnId, Change: items, - GainWay: common.GainWayGuide, + GainWay: int32(gainWay), Operator: "system", Remark: "完成引导奖励", })