|
|
@ -116,7 +116,8 @@ func (m *Manager) reportItem(ctx context.Context, tx *gorm.DB, item ReportReq, w
|
|
|
|
model.DefaultUserGradeLevel,
|
|
|
|
model.DefaultUserGradeLevel,
|
|
|
|
model.DefaultUserGradeStar,
|
|
|
|
model.DefaultUserGradeStar,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
item.Score)
|
|
|
|
item.Score,
|
|
|
|
|
|
|
|
item.Position)
|
|
|
|
dbModel.Grade = int64(grade.Grade)
|
|
|
|
dbModel.Grade = int64(grade.Grade)
|
|
|
|
dbModel.Level = int64(grade.Level)
|
|
|
|
dbModel.Level = int64(grade.Level)
|
|
|
|
dbModel.Star = int64(grade.Star)
|
|
|
|
dbModel.Star = int64(grade.Star)
|
|
|
@ -142,7 +143,8 @@ func (m *Manager) reportItem(ctx context.Context, tx *gorm.DB, item ReportReq, w
|
|
|
|
dbModel.Level,
|
|
|
|
dbModel.Level,
|
|
|
|
dbModel.Star,
|
|
|
|
dbModel.Star,
|
|
|
|
dbModel.BravePoint,
|
|
|
|
dbModel.BravePoint,
|
|
|
|
item.Score)
|
|
|
|
item.Score,
|
|
|
|
|
|
|
|
item.Position)
|
|
|
|
dbModel.Grade = int64(grade.Grade)
|
|
|
|
dbModel.Grade = int64(grade.Grade)
|
|
|
|
dbModel.Level = int64(grade.Level)
|
|
|
|
dbModel.Level = int64(grade.Level)
|
|
|
|
dbModel.Star = int64(grade.Star)
|
|
|
|
dbModel.Star = int64(grade.Star)
|
|
|
@ -164,7 +166,7 @@ func (m *Manager) reportItem(ctx context.Context, tx *gorm.DB, item ReportReq, w
|
|
|
|
return resp, nil
|
|
|
|
return resp, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (m *Manager) calcRank(win bool, userCountSatisfied bool, grade, level, star, bravePoint int64, score float32) (g pb.Grade, result pb.StatPvPReportResp_GradeResult, reason pb.StatPvPReportResp_GradeReason) {
|
|
|
|
func (m *Manager) calcRank(win bool, userCountSatisfied bool, grade, level, star, bravePoint int64, score float32, position int32) (g pb.Grade, result pb.StatPvPReportResp_GradeResult, reason pb.StatPvPReportResp_GradeReason) {
|
|
|
|
g.Grade = int32(grade)
|
|
|
|
g.Grade = int32(grade)
|
|
|
|
g.Level = int32(level)
|
|
|
|
g.Level = int32(level)
|
|
|
|
g.Star = int32(star)
|
|
|
|
g.Star = int32(star)
|
|
|
@ -208,6 +210,26 @@ func (m *Manager) calcRank(win bool, userCountSatisfied bool, grade, level, star
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 大段位保护
|
|
|
|
|
|
|
|
if grade <= m.config.Grade.ProtectedGradeThreshold {
|
|
|
|
|
|
|
|
g.Grade = int32(grade)
|
|
|
|
|
|
|
|
g.Level = int32(level)
|
|
|
|
|
|
|
|
g.Star = int32(star)
|
|
|
|
|
|
|
|
g.BravePoint = bravePoint
|
|
|
|
|
|
|
|
reason = pb.StatPvPReportResp_Lost
|
|
|
|
|
|
|
|
result = pb.StatPvPReportResp_Keep
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 名次保护
|
|
|
|
|
|
|
|
if position <= m.config.Grade.ProtectedGradeLost {
|
|
|
|
|
|
|
|
g.Grade = int32(grade)
|
|
|
|
|
|
|
|
g.Level = int32(level)
|
|
|
|
|
|
|
|
g.Star = int32(star)
|
|
|
|
|
|
|
|
g.BravePoint = bravePoint
|
|
|
|
|
|
|
|
reason = pb.StatPvPReportResp_Lost
|
|
|
|
|
|
|
|
result = pb.StatPvPReportResp_Keep
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
// 段位的骁勇分减扣规则
|
|
|
|
// 段位的骁勇分减扣规则
|
|
|
|
bravePointCost := m.config.Grade.BravePointCost[grade]
|
|
|
|
bravePointCost := m.config.Grade.BravePointCost[grade]
|
|
|
|
if bravePoint >= bravePointCost {
|
|
|
|
if bravePoint >= bravePointCost {
|
|
|
|