比赛场记录机器人皮肤
This commit is contained in:
parent
fd510661b7
commit
dc631f4334
|
@ -114,7 +114,7 @@ type Player struct {
|
|||
sparams map[int]string //字符参数
|
||||
IsLocal bool //是否本地player
|
||||
Items map[int32]int64 //背包数据
|
||||
MatchParams []int32 //比赛参数 排名、段位、假snid、假角色
|
||||
MatchParams []int32 //比赛参数 排名、段位、假snid、假角色、假皮肤
|
||||
MatchRobotGrades []MatchRobotGrade
|
||||
TestLog []string // 调试日志
|
||||
RankScore map[int32]int64 // 段位积分
|
||||
|
|
|
@ -118,6 +118,11 @@ func (this *ScenePolicyTienLen) OnPlayerEnter(s *base.Scene, p *base.Player) {
|
|||
playerData.CopyRoleId = p.MatchParams[3]
|
||||
}
|
||||
}
|
||||
if len(p.MatchParams) > 4 {
|
||||
if p.MatchParams[4] != 0 {
|
||||
playerData.SkinId = p.MatchParams[4]
|
||||
}
|
||||
}
|
||||
}
|
||||
pack := &tienlen.SCTienLenPlayerEnter{
|
||||
Data: playerData,
|
||||
|
@ -475,6 +480,11 @@ func TienLenCreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *TienLen
|
|||
pd.CopyRoleId = p.MatchParams[3]
|
||||
}
|
||||
}
|
||||
if len(p.MatchParams) > 4 {
|
||||
if p.MatchParams[4] != 0 {
|
||||
pd.SkinId = p.MatchParams[4]
|
||||
}
|
||||
}
|
||||
}
|
||||
pack.IsOutRecord = playerEx.CanUseRecordItem()
|
||||
pack.ItemRecExpireTime = playerEx.ItemRecExpireTime
|
||||
|
@ -498,6 +508,11 @@ func TienLenCreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *TienLen
|
|||
pd1.CopyRoleId = nowPlayer.MatchParams[3]
|
||||
}
|
||||
}
|
||||
if len(nowPlayer.MatchParams) > 4 {
|
||||
if nowPlayer.MatchParams[4] != 0 {
|
||||
pd1.SkinId = nowPlayer.MatchParams[4]
|
||||
}
|
||||
}
|
||||
}
|
||||
//手牌
|
||||
for j := int32(0); j < rule.HandCardNum; j++ {
|
||||
|
|
|
@ -146,6 +146,7 @@ func (this *CSEnterRoomHandler) Process(s *netlib.Session, packetid int, data in
|
|||
if p.Roles != nil {
|
||||
roleId = p.Roles.ModId
|
||||
}
|
||||
skinId := int32(300001)
|
||||
var tm *TmMatch
|
||||
if len(scene.params) > 3 {
|
||||
sortId := scene.params[0]
|
||||
|
@ -155,10 +156,11 @@ func (this *CSEnterRoomHandler) Process(s *netlib.Session, packetid int, data in
|
|||
grade = tm.copyRobotGrades[randIndex].grade
|
||||
snid = tm.copyRobotGrades[randIndex].copySnid
|
||||
roleId = tm.copyRobotGrades[randIndex].copyRoleId
|
||||
skinId = tm.copyRobotGrades[randIndex].CopySkinId
|
||||
tm.copyRobotGrades = append(tm.copyRobotGrades[:randIndex], tm.copyRobotGrades[randIndex+1:]...)
|
||||
}
|
||||
}
|
||||
mc := NewMatchContext(p, tm, grade, snid, 1, roleId, 0)
|
||||
mc := NewMatchContext(p, tm, grade, snid, 1, roleId, skinId, 0)
|
||||
if mc != nil {
|
||||
mc.gaming = true
|
||||
p.matchCtx = mc
|
||||
|
|
|
@ -15,6 +15,7 @@ type PlayerMatchContext struct {
|
|||
copySnid int32
|
||||
copyLv int32
|
||||
copyRoleId int32
|
||||
copySkinId int32
|
||||
}
|
||||
|
||||
type MatchContextSlice []*PlayerMatchContext
|
||||
|
@ -54,7 +55,7 @@ func (p MatchContextSlice) Sort(isFinals bool) {
|
|||
}
|
||||
}
|
||||
|
||||
func NewMatchContext(p *Player, tm *TmMatch, grade, snid, lv, roleId int32, seq int) *PlayerMatchContext {
|
||||
func NewMatchContext(p *Player, tm *TmMatch, grade, snid, lv, roleId, skinId int32, seq int) *PlayerMatchContext {
|
||||
if !p.IsRob {
|
||||
snid = p.SnId
|
||||
}
|
||||
|
@ -67,5 +68,6 @@ func NewMatchContext(p *Player, tm *TmMatch, grade, snid, lv, roleId int32, seq
|
|||
copySnid: snid,
|
||||
copyLv: lv,
|
||||
copyRoleId: roleId,
|
||||
copySkinId: skinId,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ func (this *Scene) PlayerEnter(p *Player, pos int, ischangeroom bool) bool {
|
|||
takeCoin := p.Coin
|
||||
leaveCoin := int64(0)
|
||||
gameTimes := rand.Int31n(100)
|
||||
matchParams := []int32{} //排名、段位、假snid、假角色
|
||||
matchParams := []int32{} //排名、段位、假snid、假角色、假皮肤
|
||||
|
||||
if this.IsMatchScene() && p.matchCtx != nil {
|
||||
takeCoin = int64(p.matchCtx.grade)
|
||||
|
@ -304,7 +304,8 @@ func (this *Scene) PlayerEnter(p *Player, pos int, ischangeroom bool) bool {
|
|||
matchParams = append(matchParams, 1) //段位默认值
|
||||
}
|
||||
matchParams = append(matchParams, p.matchCtx.copySnid) //假snid
|
||||
matchParams = append(matchParams, p.matchCtx.copyRoleId) //假snid
|
||||
matchParams = append(matchParams, p.matchCtx.copyRoleId) //假RoleId
|
||||
matchParams = append(matchParams, p.matchCtx.copySkinId) //假SkinId
|
||||
} else {
|
||||
if p.IsRob {
|
||||
if len(this.paramsEx) > 0 { //机器人携带金币动态调整
|
||||
|
|
|
@ -29,6 +29,7 @@ type TmGradeInfo struct {
|
|||
copySnid int32
|
||||
copyLv int32
|
||||
copyRoleId int32
|
||||
CopySkinId int32
|
||||
}
|
||||
|
||||
type TmMatch struct {
|
||||
|
@ -135,7 +136,7 @@ func (tm *TmMatch) CreateRobotGrades(round int) {
|
|||
tm.robotGrades[round-1] = []*TmGradeInfo{}
|
||||
var snids []int32
|
||||
var lvs []int32
|
||||
var roleIds []int32
|
||||
var roleIds, skinIds []int32
|
||||
for _, player := range PlayerMgrSington.snidMap {
|
||||
if len(snids) > int(lastPromotionNum) {
|
||||
break
|
||||
|
@ -148,6 +149,9 @@ func (tm *TmMatch) CreateRobotGrades(round int) {
|
|||
roleId = player.Roles.ModId
|
||||
}
|
||||
roleIds = append(roleIds, roleId)
|
||||
if player.Skin != nil && player.Skin.ModId != 0 {
|
||||
skinIds = append(skinIds, player.Skin.ModId)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(snids) <= int(lastPromotionNum) {
|
||||
|
@ -164,6 +168,7 @@ func (tm *TmMatch) CreateRobotGrades(round int) {
|
|||
snids = append(snids, tmpSnid)
|
||||
lvs = append(lvs, 1)
|
||||
roleIds = append(roleIds, int32(2000001))
|
||||
skinIds = append(skinIds, 300001)
|
||||
}
|
||||
}
|
||||
for i := 0; i < int(lastPromotionNum); i++ {
|
||||
|
@ -172,6 +177,7 @@ func (tm *TmMatch) CreateRobotGrades(round int) {
|
|||
copySnid: snids[i],
|
||||
copyLv: lvs[i],
|
||||
copyRoleId: roleIds[i],
|
||||
CopySkinId: skinIds[i],
|
||||
}
|
||||
tm.robotGrades[round-1] = append(tm.robotGrades[round-1], gradeInfo)
|
||||
}
|
||||
|
@ -218,6 +224,7 @@ func (tm *TmMatch) CreateRobotGrades(round int) {
|
|||
copySnid: tm.robotGrades[round-1][index].copySnid,
|
||||
copyLv: tm.robotGrades[round-1][index].copyLv,
|
||||
copyRoleId: tm.robotGrades[round-1][index].copyRoleId,
|
||||
CopySkinId: tm.robotGrades[round-1][index].CopySkinId,
|
||||
}
|
||||
tm.robotGrades[round] = append(tm.robotGrades[round], gradeInfo)
|
||||
}
|
||||
|
@ -244,6 +251,7 @@ func (tm *TmMatch) CreateRobotGrades(round int) {
|
|||
copySnid: tm.robotGrades[round-1][index].copySnid,
|
||||
copyLv: tm.robotGrades[round-1][index].copyLv,
|
||||
copyRoleId: tm.robotGrades[round-1][index].copyRoleId,
|
||||
CopySkinId: tm.robotGrades[round-1][index].CopySkinId,
|
||||
}
|
||||
tm.robotGrades[round] = append(tm.robotGrades[round], gradeInfo)
|
||||
}
|
||||
|
@ -292,6 +300,7 @@ func (tm *TmMatch) RobotGradesDecline(round int) {
|
|||
copySnid: info.copySnid,
|
||||
copyLv: info.copyLv,
|
||||
copyRoleId: info.copyRoleId,
|
||||
CopySkinId: info.CopySkinId,
|
||||
}
|
||||
tm.robotGrades[lastRound][i] = gradeInfo
|
||||
if info.copySnid != 0 {
|
||||
|
|
|
@ -784,7 +784,7 @@ func (this *Tournament) CreatePlayerMatchContext(p *Player, m *TmMatch, seq int)
|
|||
roleId = p.Roles.ModId
|
||||
}
|
||||
|
||||
mc := NewMatchContext(p, m, 1000, p.SnId, 1, roleId, seq)
|
||||
mc := NewMatchContext(p, m, 1000, p.SnId, 1, roleId, p.Skin.ModId, seq)
|
||||
if mc != nil {
|
||||
if this.players[m.SortId] == nil {
|
||||
this.players[m.SortId] = make(map[int32]*PlayerMatchContext)
|
||||
|
|
Loading…
Reference in New Issue