From 2e1e52eee26ce291749f124525726ef0213b569c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 26 Mar 2024 13:23:33 +0800 Subject: [PATCH] 1 --- server/matchserver/mt/Robot.go | 2 +- server/matchserver/team/team.go | 71 +++++++++++++++++++++++++++------ 2 files changed, 59 insertions(+), 14 deletions(-) diff --git a/server/matchserver/mt/Robot.go b/server/matchserver/mt/Robot.go index 924a4572..5a1501d4 100644 --- a/server/matchserver/mt/Robot.go +++ b/server/matchserver/mt/Robot.go @@ -6,7 +6,7 @@ import ( ) type Robot struct { - mtb.Config + mtb.Robot } type RobotTable struct { diff --git a/server/matchserver/team/team.go b/server/matchserver/team/team.go index 4480d57c..d531768f 100644 --- a/server/matchserver/team/team.go +++ b/server/matchserver/team/team.go @@ -4,6 +4,7 @@ import ( "q5" "f5" "cs" + "mt" "main/common" "main/constant" @@ -12,6 +13,11 @@ import ( "github.com/golang/protobuf/proto" ) +type robot struct { + meta *mt.Robot + specSkill int32 +} + type team struct { cs.MsgHandlerImpl teamUuid string @@ -26,10 +32,15 @@ type team struct { startTime int64 stateNotifyMsg *cs.SMTeamStateNotify memberIdHash map[string]common.Player + robotList []*robot matchOk *team matchTick int64 } +func (this* robot) FillMFTeamMember(*cs.MFTeamMember) { + +} + func (this *team) init(copyIdx int32, zoneId int32, nodeId int32, teamUuid string, owner common.Player, mapInfo* common.MapInfoRsp) { this.sortIdx++ @@ -319,6 +330,7 @@ func (this *team) genStartGameInfo() { AccountId string `json:"account_id"` SpecSkill int32 `json:"spec_skill"` HeroUniId string `json:"hero_uniid"` + IsAndroid int32 `json:"is_android"` } `json:"members"` } `json:"team_list"` ObList []struct { @@ -326,11 +338,13 @@ func (this *team) genStartGameInfo() { } `json:"ob_list"` } { ZoneId: this.GetZoneId(), - NodeId: this.GetNodeId(), - MapId: this.mapInfo.MapId, - RoomUuid: q5.ToString(this.getMainTeam().GetTeamUuid()), - StartTime: int32(this.startTime), - } + NodeId: this.GetNodeId(), + MapId: this.mapInfo.MapId, + RoomUuid: q5.ToString(this.getMainTeam().GetTeamUuid()), + StartTime: int32(this.startTime), + } + this.stateNotifyMsg.JoinMsg.TeamUuid = proto.String(this.getMainTeam().GetTeamUuid()) + q5.NewSlice(&this.stateNotifyMsg.TeamList, 0, 10) { q5.NewSlice(&startInfo.TeamList, 0, 10) teamList := []*team{} @@ -359,19 +373,49 @@ func (this *team) genStartGameInfo() { } } for _, t := range teamList { - ele := q5.NewSliceElement(&startInfo.TeamList) - ele.TeamUuid = t.GetTeamUuid() - for _, m := range t.memberIdHash { - ele2 := q5.NewSliceElement(&ele.Members) - ele2.AccountId = m.GetAccountId() - ele2.SpecSkill = m.GetSpecSkill() - ele2.HeroUniId = m.GetHeroUniid() + { + ele := q5.NewSliceElement(&startInfo.TeamList) + ele.TeamUuid = t.GetTeamUuid() + for _, m := range t.memberIdHash { + ele2 := q5.NewSliceElement(&ele.Members) + ele2.AccountId = m.GetAccountId() + ele2.SpecSkill = m.GetSpecSkill() + ele2.HeroUniId = m.GetHeroUniid() + } + if this.IsMobaMode() { + robotIdx := 0 + for i := len(ele.Members); i <= 4; i++ { + ele2 := q5.NewSliceElement(&ele.Members) + robot := t.robotList[robotIdx] + robotIdx++ + ele2.AccountId = "6517_2006_" + q5.ToString(robot.meta.GetId()) + ele2.SpecSkill = robot.specSkill + ele2.HeroUniId = "" + ele2.IsAndroid = 1 + } + } + } + { + ele := *q5.NewSliceElement(&this.stateNotifyMsg.TeamList) + ele.TeamUuid = proto.String(t.GetTeamUuid()) + for _, m := range t.memberIdHash { + m_pb := q5.NewSliceElement(&ele.Members) + m.FillMFTeamMember(*m_pb) + } + if this.IsMobaMode() { + robotIdx := 0 + for i := len(ele.Members); i <= 4; i++ { + robot := t.robotList[robotIdx] + robotIdx++ + m_pb := q5.NewSliceElement(&ele.Members) + robot.FillMFTeamMember(*m_pb) + } + } } } } sign := q5.Md5Str(q5.EncodeJson(&startInfo) + "520d8eAbB(8cf1^#$^&!@d833a42c820432PDAFE^^)") payload := sign + ":" + "normal_room|" + q5.EncodeJson(&startInfo) - this.stateNotifyMsg.JoinMsg.TeamUuid = proto.String(this.getMainTeam().GetTeamUuid()) this.stateNotifyMsg.JoinMsg.Payload = proto.String(payload) this.genNextCopyTeam() this.stateNotifyMsg.NextTeamUuid = proto.String(this.nextTeamUuid) @@ -455,5 +499,6 @@ func newTeam() *team { t.stateNotifyMsg = &cs.SMTeamStateNotify{} t.stateNotifyMsg.JoinMsg = &cs.MFJoinMsg{} t.memberIdHash = map[string]common.Player{} + t.robotList = []*robot{} return t }