Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop

This commit is contained in:
sk 2024-11-01 14:47:22 +08:00
commit fd2e1b3cad
7 changed files with 2172 additions and 2041 deletions

View File

@ -513,6 +513,7 @@ type PlayerData struct {
GuideStep int32 // tienlen游戏引导步骤跳过引导后该值会置为-1 GuideStep int32 // tienlen游戏引导步骤跳过引导后该值会置为-1
ClientVer int32 // 客户端版本号 ClientVer int32 // 客户端版本号
Guide []int // 引导步骤 Guide []int // 引导步骤
GuideData map[int32]int32 // 引导步骤 key:引导类型 value步骤
} }
// 七日签到数据 // 七日签到数据

File diff suppressed because it is too large Load Diff

View File

@ -353,10 +353,7 @@ message PlayerData {
int32 UseSkinId = 50; // id int32 UseSkinId = 50; // id
string ChannelID = 51; // ID string ChannelID = 51; // ID
int32 GuideStep = 52; // ; 0-1 int32 GuideStep = 52; // ; 0-1
// map<int32,int32> GuideData = 53;// key: value
// 0
// 0-1,
repeated int32 Guide = 53;
} }
// //
@ -1349,18 +1346,28 @@ message WindowsInfo{
message CSUpdateAttribute{ message CSUpdateAttribute{
int32 Tp = 1; // 1. 2. 3.() 4. int32 Tp = 1; // 1. 2. 3.() 4.
repeated int64 Param = 2; repeated int64 Param = 2;
int32 GuideId = 3; //ID 1- 2-
} }
//PACKET_SCUpdateAttribute //PACKET_SCUpdateAttribute
message SCUpdateAttribute{ message SCUpdateAttribute{
OpResultCode OpRetCode = 1; // OpResultCode OpRetCode = 1; //
int32 Tp = 2; int32 Tp = 2;
repeated int64 Param = 3; repeated int64 Param = 3;
int32 GuideId =4;//ID 1- 2-
} }
//PACKET_SCGuideConfig //PACKET_SCGuideConfig
message SCGuideConfig{ message SCGuideConfig{
repeated GuideInfo Info = 1;
}
message GuideInfo {
int32 On = 2; // 1 2 int32 On = 2; // 1 2
int32 Skip = 3; // 1 2 int32 Skip = 3; // 1 2
int32 GuideId = 4; // 1- 2-
repeated ItemInfo Awards = 5; //
int32 MaxStep = 6; //
int32 AwardStep = 7;//
} }
message Config{ message Config{
@ -1432,19 +1439,3 @@ message PopUpWindowInfo{
int32 OpenStatus = 4;//1- 0- int32 OpenStatus = 4;//1- 0-
int32 Weight = 5;// 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

View File

@ -901,8 +901,15 @@ message AnnouncerLogInfo{
// etcd /game/guide_config // etcd /game/guide_config
message GuideConfig { message GuideConfig {
string Platform = 1; // string Platform = 1; //
int32 On = 2; // 1 2 repeated GuideInfo Info = 2;
int32 Skip = 3; // 1 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;//
} }
// //

View File

@ -3093,17 +3093,23 @@ func CSUpdateAttribute(s *netlib.Session, packetId int, data interface{}, sid in
if !ok { if !ok {
return nil return nil
} }
if p.GuideData == nil {
p.GuideData = make(map[int32]int32)
}
stepId := p.GuideStep + 1 stepId := p.GuideStep + 1
pack := &player_proto.SCUpdateAttribute{ pack := &player_proto.SCUpdateAttribute{
OpRetCode: player_proto.OpResultCode_OPRC_Error, OpRetCode: player_proto.OpResultCode_OPRC_Error,
Tp: msg.GetTp(), Tp: msg.GetTp(),
Param: msg.GetParam(), Param: msg.GetParam(),
GuideId: msg.GuideId,
} }
send := func() { send := func() {
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCUpdateAttribute), pack) p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCUpdateAttribute), pack)
logger.Logger.Tracef("SCUpdateAttribute %v", pack) logger.Logger.Tracef("SCUpdateAttribute %v", pack)
if msg.GuideId != 1 {
stepId = p.GuideData[msg.GuideId]
}
// 日志 // 日志
if pack.OpRetCode == player_proto.OpResultCode_OPRC_Sucess { if pack.OpRetCode == player_proto.OpResultCode_OPRC_Sucess {
switch msg.GetTp() { 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() { switch msg.GetTp() {
case common.AttributeGuideStep: 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 return nil
} }
if PlatformMgrSingleton.GetConfig(p.Platform).GuideConfig.GetOn() != common.On { if cfg.GetOn() != common.On {
pack.OpRetCode = player_proto.OpResultCode_OPRC_Guide_Close pack.OpRetCode = player_proto.OpResultCode_OPRC_Guide_Close
send() send()
return nil return nil
} }
if p.GuideStep >= model.GameParamData.GuideStepMaxNum { if msg.GuideId == 1 {
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_End 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() send()
return nil // 获得10v卡
} if p.GuideStep == 2 {
if int64(p.GuideStep) >= msg.GetParam()[0] { BagMgrSingleton.AddItems(&model.AddItemParam{
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_Finish Platform: p.Platform,
send() SnId: p.SnId,
return nil Change: []*model.Item{
} {
if int64(p.GuideStep)+1 < msg.GetParam()[0] { ItemId: common.ItemIDVCard,
pack.OpRetCode = player_proto.OpResultCode_OPRC_GuideStep_Front ItemNum: 10,
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,
}, },
}, GainWay: common.GainWayGuide,
GainWay: common.GainWayGuide, Operator: "system",
Operator: "system", Remark: "新手引导奖励",
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: 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 pack.OpRetCode = player_proto.OpResultCode_OPRC_Guide_SkipClose
send() send()
return nil return nil
} }
if p.GuideStep >= 0 && p.GuideStep < model.GameParamData.GuideStepMaxNum { if msg.GuideId == 1 {
p.GuideStep = -1 // 跳过引导为 -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 pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
p.GuideData[msg.GuideId] = int32(msg.Param[0])
send() send()
return nil return nil
} }

View File

@ -321,7 +321,7 @@ func (this *Player) OnLogined() {
if !this.IsRob { if !this.IsRob {
if isFirstLogin { if isFirstLogin {
cfg := PlatformMgrSingleton.GetConfig(this.Platform).GuideConfig 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 this.GuideStep = -1
} }
} }
@ -2743,6 +2743,7 @@ func (this *Player) SendPlayerInfo() {
Signature: this.Signature, Signature: this.Signature,
Age: this.Age, Age: this.Age,
GuideStep: this.GuideStep, GuideStep: this.GuideStep,
GuideData: this.GuideData,
}, },
} }
if this.Roles != nil { if this.Roles != nil {
@ -4586,9 +4587,25 @@ func (this *Player) GetSkillAdd(id int32) int32 {
func (this *Player) SCGuide() { func (this *Player) SCGuide() {
cfg := PlatformMgrSingleton.GetConfig(this.Platform).GuideConfig cfg := PlatformMgrSingleton.GetConfig(this.Platform).GuideConfig
pack := &playerproto.SCGuideConfig{ pack := &playerproto.SCGuideConfig{}
On: cfg.GetOn(), for _, data := range cfg.Info {
Skip: cfg.GetSkip(), 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) this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SCGuideConfig), pack)
logger.Logger.Tracef("SCGuideConfig: %v", pack) logger.Logger.Tracef("SCGuideConfig: %v", pack)