【猫草大作战】-转盘逻辑bug

This commit is contained in:
hahwu 2025-12-10 11:59:55 +08:00
parent 1fc341b77b
commit 2b54cd128f
3 changed files with 39 additions and 2 deletions

View File

@ -34,6 +34,22 @@ func GetGameNum(Id int) int {
return gamedata.GetIntValue(data, "PassNum") return gamedata.GetIntValue(data, "PassNum")
} }
func GetGameMaxProgress(Id int) int {
TemplateId := GetTemplateId(Id)
data, err := gamedata.GetData(CATNIP_GAME_CFG_NAME)
if err != nil {
return 0
}
MaxProgress := 0
for _, v := range data {
if gamedata.GetIntValue(v, "Template") != TemplateId {
continue
}
MaxProgress = max(MaxProgress, gamedata.GetIntValue(v, "Need"))
}
return MaxProgress
}
func GetJackpotItem(Mul int) (int, []*item.Item, int, int) { func GetJackpotItem(Mul int) (int, []*item.Item, int, int) {
data, err := gamedata.GetData(CATNIP_JACKPOT_CFG_NAME) data, err := gamedata.GetData(CATNIP_JACKPOT_CFG_NAME)
if err != nil { if err != nil {

View File

@ -129,6 +129,24 @@ func (p *PlayerChessData) UpdateChessData(player *Player, MChessData map[string]
return nil return nil
} }
func (p *PlayerChessData) UpdateChessDataTest(player *Player, MChessData map[string]int32) error {
p.Data.MChessData = MChessData
if true {
res := &msg.ResUpdatePlayerChessData{
Code: msg.RES_CODE_FAIL,
Msg: "棋子数据不一致",
}
log.Debug("棋子数据不一致, %v---%v", p.Data.MChessData, player.PlayMod.getChessMod().GetChessList())
player.SendErrClienRes(res)
player.TeLog("outsync_event", map[string]interface{}{
"outsync_event": "UpdatePlayerChessDataFunc",
})
return fmt.Errorf("棋子数据不一致")
}
player.PlayMod.getChessMod().ChessMap = MChessData
return nil
}
// 检查棋子数据是否一致 // 检查棋子数据是否一致
func (p *PlayerChessData) checkChessEqual(player *Player) bool { func (p *PlayerChessData) checkChessEqual(player *Player) bool {
if len(p.Data.MChessData) == 0 && conf.Server.GameName == "Merge_Pet_Local" { if len(p.Data.MChessData) == 0 && conf.Server.GameName == "Merge_Pet_Local" {

View File

@ -170,6 +170,9 @@ func (c *CatnipMod) Play(Id int) (int, int, int, []*item.Item, []*item.Item, int
if !ok { if !ok {
return 0, 0, 0, nil, nil, 0, fmt.Errorf("game with ID %d does not exist", Id) return 0, 0, 0, nil, nil, 0, fmt.Errorf("game with ID %d does not exist", Id)
} }
if GameInfo.Status != GAME_STATUS_IN_PROGRESS {
return 0, 0, 0, nil, nil, 0, fmt.Errorf("game with ID %d is not in progress", Id)
}
Id, Items, Growth, FriendItems := catnipCfg.GetJackpotItem(c.Mul) Id, Items, Growth, FriendItems := catnipCfg.GetJackpotItem(c.Mul)
Growth = Growth * c.Mul Growth = Growth * c.Mul
if Growth > 0 { if Growth > 0 {
@ -215,7 +218,7 @@ func (c *CatnipMod) Growth(Id, Growth int) {
return // Game is not in progress return // Game is not in progress
} }
GameInfo.Progress += Growth GameInfo.Progress += Growth
if GameInfo.Progress >= catnipCfg.GetGameNum(Id) { // Assuming the game ends when progress reaches a certain threshold if GameInfo.Progress >= catnipCfg.GetGameMaxProgress(c.Id) { // Assuming the game ends when progress reaches a certain threshold
GameInfo.Status = GAME_STATUS_COMPLETED GameInfo.Status = GAME_STATUS_COMPLETED
} }
} }
@ -225,7 +228,7 @@ func (c *CatnipMod) GrowthByUid(Uid, Growth int) {
if v.Partner == Uid { if v.Partner == Uid {
v.Progress += Growth v.Progress += Growth
v.PartnerAdd += Growth v.PartnerAdd += Growth
if v.Progress >= catnipCfg.GetGameNum(v.Id) { // Assuming the game ends when progress reaches a certain threshold if v.Progress >= catnipCfg.GetGameMaxProgress(c.Id) { // Assuming the game ends when progress reaches a certain threshold
v.Status = GAME_STATUS_COMPLETED v.Status = GAME_STATUS_COMPLETED
} }
} }