Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop
This commit is contained in:
commit
fd2e1b3cad
|
@ -513,6 +513,7 @@ type PlayerData struct {
|
|||
GuideStep int32 // tienlen游戏引导步骤;跳过引导后,该值会置为-1
|
||||
ClientVer int32 // 客户端版本号
|
||||
Guide []int // 引导步骤
|
||||
GuideData map[int32]int32 // 引导步骤 key:引导类型 value:步骤
|
||||
}
|
||||
|
||||
// 七日签到数据
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -353,10 +353,7 @@ message PlayerData {
|
|||
int32 UseSkinId = 50; // 皮肤id
|
||||
string ChannelID = 51; // 渠道ID
|
||||
int32 GuideStep = 52; // 引导步骤; 最小为0,-1表示跳过引导了
|
||||
// 引导步骤完成情况
|
||||
// 下标:0表示竞技馆引导
|
||||
// 值:最小为0,-1表示引导完成, 其余表示已引导步骤
|
||||
repeated int32 Guide = 53;
|
||||
map<int32,int32> GuideData = 53;//引导数据 key:引导类型 value:步骤
|
||||
}
|
||||
|
||||
//周卡数据
|
||||
|
@ -1349,18 +1346,28 @@ message WindowsInfo{
|
|||
message CSUpdateAttribute{
|
||||
int32 Tp = 1; // 1.更新引导阶段 2.跳过引导 3.更新引导状态(测试用) 4.标记竞技馆引导页面已经显示过
|
||||
repeated int64 Param = 2;
|
||||
int32 GuideId = 3; //引导ID 1-新手引导 2-竞技馆引导
|
||||
}
|
||||
//PACKET_SCUpdateAttribute
|
||||
message SCUpdateAttribute{
|
||||
OpResultCode OpRetCode = 1; //操作结果
|
||||
int32 Tp = 2;
|
||||
repeated int64 Param = 3;
|
||||
int32 GuideId =4;//引导ID 1-新手引导 2-竞技馆引导
|
||||
}
|
||||
|
||||
//PACKET_SCGuideConfig
|
||||
message SCGuideConfig{
|
||||
repeated GuideInfo Info = 1;
|
||||
|
||||
}
|
||||
message GuideInfo {
|
||||
int32 On = 2; // 引导开关 1开启 2关闭
|
||||
int32 Skip = 3; // 引导跳过开关 1开启 2关闭
|
||||
int32 GuideId = 4; // 引导类型 1-新手引导 2-竞技馆引导
|
||||
repeated ItemInfo Awards = 5; //奖励
|
||||
int32 MaxStep = 6; // 步骤长度
|
||||
int32 AwardStep = 7;//领奖步骤
|
||||
}
|
||||
|
||||
message Config{
|
||||
|
@ -1431,20 +1438,4 @@ message PopUpWindowInfo{
|
|||
string Key = 3;
|
||||
int32 OpenStatus = 4;//1-开启 0-关闭
|
||||
int32 Weight = 5;//弹窗权重
|
||||
}
|
||||
|
||||
// 更新引导状态
|
||||
// PACKET_CSUpdateGuide
|
||||
message CSUpdateGuide {
|
||||
int32 GuideId = 1; // 引导类型 0.竞技馆引导 1....
|
||||
int32 Step = 2; // 引导步骤
|
||||
int32 Op = 3; // 操作 1.更新 2.跳过 3.修改引导步骤(调试用)
|
||||
}
|
||||
|
||||
// PACKET_SCUpdateGuide
|
||||
message SCUpdateGuide {
|
||||
OpResultCode OpRetCode = 1; //操作结果
|
||||
int32 GuideId = 2; // 引导类型
|
||||
int32 Step = 3; // 引导步骤
|
||||
int32 Op = 4;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -901,8 +901,15 @@ message AnnouncerLogInfo{
|
|||
// etcd /game/guide_config
|
||||
message GuideConfig {
|
||||
string Platform = 1; // 平台
|
||||
int32 On = 2; // 引导开关 1开启 2关闭
|
||||
int32 Skip = 3; // 引导跳过开关 1开启 2关闭
|
||||
repeated GuideInfo Info = 2;
|
||||
}
|
||||
message GuideInfo {
|
||||
int32 On = 1; // 引导开关 1开启 2关闭
|
||||
int32 Skip = 2; // 引导跳过开关 1开启 2关闭
|
||||
int32 GuideId = 3; // 引导类型 1-新手引导 2-竞技馆引导
|
||||
repeated ItemInfo Awards = 4; // 奖励
|
||||
int32 MaxStep = 5; // 步骤长度
|
||||
int32 AwardStep = 6;//领奖步骤
|
||||
}
|
||||
|
||||
//娃娃机配置视频
|
||||
|
|
|
@ -3093,17 +3093,23 @@ func CSUpdateAttribute(s *netlib.Session, packetId int, data interface{}, sid in
|
|||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
if p.GuideData == nil {
|
||||
p.GuideData = make(map[int32]int32)
|
||||
}
|
||||
stepId := p.GuideStep + 1
|
||||
pack := &player_proto.SCUpdateAttribute{
|
||||
OpRetCode: player_proto.OpResultCode_OPRC_Error,
|
||||
Tp: msg.GetTp(),
|
||||
Param: msg.GetParam(),
|
||||
GuideId: msg.GuideId,
|
||||
}
|
||||
|
||||
send := func() {
|
||||
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCUpdateAttribute), pack)
|
||||
logger.Logger.Tracef("SCUpdateAttribute %v", pack)
|
||||
if msg.GuideId != 1 {
|
||||
stepId = p.GuideData[msg.GuideId]
|
||||
}
|
||||
// 日志
|
||||
if pack.OpRetCode == player_proto.OpResultCode_OPRC_Sucess {
|
||||
switch msg.GetTp() {
|
||||
|
@ -3125,62 +3131,113 @@ func CSUpdateAttribute(s *netlib.Session, packetId int, data interface{}, sid in
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if msg.GuideId == 0 {
|
||||
return nil
|
||||
}
|
||||
if PlatformMgrSingleton.GetConfig(p.Platform).GuideConfig.Info[msg.GuideId] == nil {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_Guide_Close
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
cfg := PlatformMgrSingleton.GetConfig(p.Platform).GuideConfig.Info[msg.GuideId]
|
||||
switch msg.GetTp() {
|
||||
case common.AttributeGuideStep:
|
||||
if len(msg.GetParam()) == 0 || msg.GetParam()[0] == 0 || p.GuideStep < 0 {
|
||||
if len(msg.GetParam()) == 0 || msg.GetParam()[0] == 0 {
|
||||
return nil
|
||||
}
|
||||
if PlatformMgrSingleton.GetConfig(p.Platform).GuideConfig.GetOn() != common.On {
|
||||
if cfg.GetOn() != common.On {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_Guide_Close
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
if p.GuideStep >= model.GameParamData.GuideStepMaxNum {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_End
|
||||
if msg.GuideId == 1 {
|
||||
if p.GuideStep < 0 {
|
||||
return nil
|
||||
}
|
||||
if p.GuideStep >= model.GameParamData.GuideStepMaxNum {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_End
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
if int64(p.GuideStep) >= msg.GetParam()[0] {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_Finish
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
if int64(p.GuideStep)+1 < msg.GetParam()[0] {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_Front
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
p.GuideStep = int32(msg.GetParam()[0])
|
||||
stepId = p.GuideStep
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
if int64(p.GuideStep) >= msg.GetParam()[0] {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_Finish
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
if int64(p.GuideStep)+1 < msg.GetParam()[0] {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_Front
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
p.GuideStep = int32(msg.GetParam()[0])
|
||||
stepId = p.GuideStep
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
|
||||
send()
|
||||
// 获得10v卡
|
||||
if p.GuideStep == 2 {
|
||||
BagMgrSingleton.AddItems(&model.AddItemParam{
|
||||
Platform: p.Platform,
|
||||
SnId: p.SnId,
|
||||
Change: []*model.Item{
|
||||
{
|
||||
ItemId: common.ItemIDVCard,
|
||||
ItemNum: 10,
|
||||
// 获得10v卡
|
||||
if p.GuideStep == 2 {
|
||||
BagMgrSingleton.AddItems(&model.AddItemParam{
|
||||
Platform: p.Platform,
|
||||
SnId: p.SnId,
|
||||
Change: []*model.Item{
|
||||
{
|
||||
ItemId: common.ItemIDVCard,
|
||||
ItemNum: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
GainWay: common.GainWayGuide,
|
||||
Operator: "system",
|
||||
Remark: "新手引导奖励",
|
||||
})
|
||||
GainWay: common.GainWayGuide,
|
||||
Operator: "system",
|
||||
Remark: "新手引导奖励",
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if p.GuideData[msg.GuideId] >= cfg.MaxStep {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_End
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
if int64(p.GuideData[msg.GuideId]) >= msg.GetParam()[0] {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_Finish
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
p.GuideData[msg.GuideId] = int32(msg.Param[0])
|
||||
if p.GuideData[msg.GuideId] == cfg.AwardStep {
|
||||
//发奖
|
||||
var items []*model.Item
|
||||
for _, award := range cfg.Awards {
|
||||
items = append(items, &model.Item{
|
||||
ItemId: award.ItemId,
|
||||
ItemNum: award.ItemNum,
|
||||
})
|
||||
}
|
||||
BagMgrSingleton.AddItems(&model.AddItemParam{
|
||||
Platform: p.Platform,
|
||||
SnId: p.SnId,
|
||||
Change: items,
|
||||
GainWay: common.GainWayGuide,
|
||||
Operator: "system",
|
||||
Remark: "完成引导奖励",
|
||||
})
|
||||
}
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
|
||||
send()
|
||||
}
|
||||
return nil
|
||||
case common.AttributeGuideSkip:
|
||||
if PlatformMgrSingleton.GetConfig(p.Platform).GuideConfig.GetSkip() != common.On {
|
||||
if cfg.GetSkip() != common.On {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_Guide_SkipClose
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
if p.GuideStep >= 0 && p.GuideStep < model.GameParamData.GuideStepMaxNum {
|
||||
p.GuideStep = -1 // 跳过引导为 -1
|
||||
if msg.GuideId == 1 {
|
||||
if p.GuideStep >= 0 && p.GuideStep < model.GameParamData.GuideStepMaxNum {
|
||||
p.GuideStep = -1 // 跳过引导为 -1
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
|
||||
p.GuideData[msg.GuideId] = int32(msg.Param[0])
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -321,7 +321,7 @@ func (this *Player) OnLogined() {
|
|||
if !this.IsRob {
|
||||
if isFirstLogin {
|
||||
cfg := PlatformMgrSingleton.GetConfig(this.Platform).GuideConfig
|
||||
if cfg == nil || cfg.GetOn() != common.On {
|
||||
if cfg == nil || cfg.Info[1] == nil || cfg.Info[1].GetOn() != common.On {
|
||||
this.GuideStep = -1
|
||||
}
|
||||
}
|
||||
|
@ -2743,6 +2743,7 @@ func (this *Player) SendPlayerInfo() {
|
|||
Signature: this.Signature,
|
||||
Age: this.Age,
|
||||
GuideStep: this.GuideStep,
|
||||
GuideData: this.GuideData,
|
||||
},
|
||||
}
|
||||
if this.Roles != nil {
|
||||
|
@ -4586,9 +4587,25 @@ func (this *Player) GetSkillAdd(id int32) int32 {
|
|||
|
||||
func (this *Player) SCGuide() {
|
||||
cfg := PlatformMgrSingleton.GetConfig(this.Platform).GuideConfig
|
||||
pack := &playerproto.SCGuideConfig{
|
||||
On: cfg.GetOn(),
|
||||
Skip: cfg.GetSkip(),
|
||||
pack := &playerproto.SCGuideConfig{}
|
||||
for _, data := range cfg.Info {
|
||||
var awards []*playerproto.ItemInfo
|
||||
for _, award := range data.Awards {
|
||||
item := &playerproto.ItemInfo{
|
||||
ItemId: award.GetItemId(),
|
||||
ItemNum: award.GetItemNum(),
|
||||
}
|
||||
awards = append(awards, item)
|
||||
}
|
||||
info := &playerproto.GuideInfo{
|
||||
On: data.GetOn(),
|
||||
Skip: data.GetSkip(),
|
||||
GuideId: data.GetGuideId(),
|
||||
Awards: awards,
|
||||
MaxStep: data.MaxStep,
|
||||
AwardStep: data.AwardStep,
|
||||
}
|
||||
pack.Info = append(pack.Info, info)
|
||||
}
|
||||
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SCGuideConfig), pack)
|
||||
logger.Logger.Tracef("SCGuideConfig: %v", pack)
|
||||
|
|
Loading…
Reference in New Issue