猫草大作战优化
This commit is contained in:
parent
259814ab90
commit
bcd385210a
@ -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 {
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user