猫草大作战优化

This commit is contained in:
hahwu 2025-12-08 10:13:37 +08:00
parent 259814ab90
commit bcd385210a
2 changed files with 14 additions and 1 deletions

View File

@ -365,7 +365,8 @@ func handle(p *Player, m *msg.Msg) error {
if ActivityId != CatnipGrowthInfo.ActivityId { // 活动ID不匹配
return nil
}
CatnipMod.Growth(CatnipGrowthInfo.GameId, CatnipGrowthInfo.Growth)
CatnipMod.GrowthByUid(m.From, CatnipGrowthInfo.Growth)
p.CatnipBackData()
case msg.HANDLE_TYPE_FRIEND_GREETING_REPLY:
FriendMod := p.PlayMod.getFriendMod()
if v, ok := m.Extra.(friend.ReplyInfo); ok {

View File

@ -221,6 +221,18 @@ func (c *CatnipMod) Growth(Id, Growth int) {
}
}
func (c *CatnipMod) GrowthByUid(Uid, Growth int) {
for _, v := range c.Game {
if v.Partner == Uid {
v.Progress += Growth
if v.Progress >= catnipCfg.GetGameNum(v.Id) { // Assuming the game ends when progress reaches a certain threshold
v.Status = GAME_STATUS_COMPLETED
}
}
}
}
func (c *CatnipMod) SetEmoji(Id, EmojiId int) {
GameInfo, ok := c.Game[Id]
if !ok {