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
ClientVer int32 // 客户端版本号
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
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

View File

@ -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;//
}
//

View File

@ -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
}

View File

@ -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)