This commit is contained in:
aozhiwei 2024-03-26 13:23:33 +08:00
parent f9034bdfd8
commit 2e1e52eee2
2 changed files with 59 additions and 14 deletions

View File

@ -6,7 +6,7 @@ import (
)
type Robot struct {
mtb.Config
mtb.Robot
}
type RobotTable struct {

View File

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