修复锦标赛bug

This commit is contained in:
hahwu 2025-01-06 17:56:47 +08:00
parent b328f9b6ea
commit bb4f3716ce
3 changed files with 14 additions and 9 deletions

View File

@ -1,6 +1,7 @@
package game package game
import ( import (
"math"
"server/GoUtil" "server/GoUtil"
champshipCfg "server/conf/champship" champshipCfg "server/conf/champship"
randnameCfg "server/conf/randname" randnameCfg "server/conf/randname"
@ -143,21 +144,21 @@ func (c *ChampshipMgr) ai(m *msg.Msg) (interface{}, error) {
Notify := make(map[int]int) Notify := make(map[int]int)
for e, r := range v { for e, r := range v {
if r.Type == RANK_PLAYER_ROBOT { if r.Type == RANK_PLAYER_ROBOT {
AddScore := 0 AddScore := 0.0
Robot := ChampshipData.Robot[r.Uid] Robot := ChampshipData.Robot[r.Uid]
if Robot == nil { if Robot == nil {
continue continue
} }
if Robot.Type == 2 && Robot.Time+60 < Now { if Robot.Type == 2 && Robot.Time+60 < Now {
AddScore = int(Robot.PerScore) AddScore = Robot.PerScore
Robot.Time = Now Robot.Time = Now
} }
if Robot.Type == 3 && Robot.Time+1800 < Now { if Robot.Type == 3 && Robot.Time+1800 < Now {
AddScore = int(Robot.PerScore) AddScore = Robot.PerScore
Robot.Time = Now Robot.Time = Now
} }
r.Score += float64(AddScore) r.Score += AddScore
} else { } else {
Notify[r.Uid] = e Notify[r.Uid] = e
} }
@ -692,12 +693,12 @@ func CreateRobot(M float64, GroupId int) *ChampshipRobot {
Score := M / 10 Score := M / 10
PerScore := 0.0 PerScore := 0.0
if Type == 2 { if Type == 2 {
PerScore = (M / 10 * 0.34) / float64(GoUtil.NextZeroTimestampDuration()) / 60 PerScore = math.Round((M/10*0.34)/(float64(GoUtil.NextZeroTimestampDuration())/60)*100) / 100
Score = M / 10 * 0.66 Score = M / 10 * 0.66
} }
if Type == 3 { if Type == 3 {
PerScore = (M / 10 * 0.34) / float64(GoUtil.NextZeroTimestampDuration()) / 1800 PerScore = math.Round((M/10*0.34)/(float64(GoUtil.NextZeroTimestampDuration())/1800)*100) / 100
Score = 0 Score = 2
} }
return &ChampshipRobot{ return &ChampshipRobot{

View File

@ -102,8 +102,9 @@ func (gl *GameLogic) ZeroFlush() {
}) })
var a1 = []interface{}{gl.DailyTaskTimestamp} var a1 = []interface{}{gl.DailyTaskTimestamp}
GoUtil.CallEvent(MergeConst.Notify_Daily_Renew, a1) GoUtil.CallEvent(MergeConst.Notify_Daily_Renew, a1)
gl.RankMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新排行榜 gl.RankMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新排行榜
gl.VarMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新变量 gl.ChampshipMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新锦标赛
gl.VarMgrSend(MsgMod.MSG_ZERO_UPDATE) // 零点更新变量
gl.NotifyAll(MsgMod.MSG_ZERO_UPDATE) gl.NotifyAll(MsgMod.MSG_ZERO_UPDATE)
gl.CreateDailyLogFile() gl.CreateDailyLogFile()
} }

View File

@ -691,6 +691,9 @@ func (p *Player) GetSimpleData(Uid int, simple *PlayerSimpleData) error {
p.M_DwUin = int64(Uid) p.M_DwUin = int64(Uid)
p.InitPlayerOnly() p.InitPlayerOnly()
Base := p.GetPlayerBaseMod() Base := p.GetPlayerBaseMod()
if Base == nil {
return errors.New("GetSimpleData failed")
}
simple.Name = p.GetPlayerBaseMod().GetName() simple.Name = p.GetPlayerBaseMod().GetName()
simple.Avatar = p.PlayMod.getAvatarMod().SetId simple.Avatar = p.PlayMod.getAvatarMod().SetId
simple.Face = p.PlayMod.getFaceMod().SetId simple.Face = p.PlayMod.getFaceMod().SetId