refactor: 删除升级指令s

main
NorthLan 2 years ago
parent 42d26f9cc1
commit 1b6a556647

@ -52,10 +52,6 @@ func (h *ZhgmangGameLogic) WithCmdParserLogic(p []cmd.Pattern) LogicOption {
Prefix: "m",
Alias: []string{"莽"},
ContentMaxLen: 0,
}, {
Prefix: "s",
Alias: []string{"升级"},
ContentMaxLen: 0,
}, {
Prefix: "n",
ContentMaxLen: 8,
@ -73,7 +69,6 @@ func (h *ZhgmangGameLogic) WithCmdHandlers() LogicOption {
logic.RegisterCMDHandler(h.handleJoinGame, "j")
logic.RegisterCMDHandler(h.handleAddUnit, "c")
logic.RegisterCMDHandler(h.handleWai, "w")
logic.RegisterCMDHandler(h.handleLevelUp, "s")
logic.RegisterCMDHandler(h.handleMockGift, "n")
}
}
@ -148,19 +143,6 @@ func (h *ZhgmangGameLogic) handleWai(liveRoom *LiveRoom, _ string, _ []rune, use
room.Broadcast(pb.PushZhgmangWai, &pbGameZhgMang.Wai{User: user})
}
func (h *ZhgmangGameLogic) handleLevelUp(liveRoom *LiveRoom, _ string, _ []rune, user *pbCommon.PbUser) {
room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform)
if err != nil {
return
}
logger.SLog.Debugf("用户 [%s] 基地升级", user.Username)
room.Broadcast(pb.PushZhgmangLevelUp, &pbGameZhgMang.LevelUp{
User: user,
})
}
func (h *ZhgmangGameLogic) handleMockGift(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) {
var err error
room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform)
@ -202,11 +184,11 @@ func (h *ZhgmangGameLogic) handleMockGift(liveRoom *LiveRoom, _ string, content
case "lt":
h.goldSpeedUp(room, user, float64(count)*0.1)
case "qp":
h.clearScreen(room, user)
h.clearScreen(room, user, int(count))
case "rd":
h.randomAddon(room, user)
h.randomAddon(room, user, int(count))
case "hb":
h.redPackAddon(room, user)
h.redPackAddon(room, user, int(count))
default:
h.goldSpeedUp(room, user, float64(count))
}
@ -228,27 +210,21 @@ func (h *ZhgmangGameLogic) handleGift(liveRoom *LiveRoom, user *pbCommon.PbUser,
case config.ZhgmangGiftFree:
h.goldSpeedUp(room, user, float64(gift.GiftNum)*0.1)
case config.ZhgmangGiftClearScreen:
for i := 0; i < int(gift.GiftNum); i++ {
h.clearScreen(room, user)
}
h.clearScreen(room, user, int(gift.GiftNum))
case config.ZhgmangGiftRandomAddon:
for i := 0; i < int(gift.GiftNum); i++ {
h.randomAddon(room, user)
}
h.randomAddon(room, user, int(gift.GiftNum))
default:
h.goldSpeedUp(room, user, float64(gift.GiftNum*gift.Price)*0.01)
}
case pbMq.MqGift_PACK:
if cfgGiftType == config.ZhgmangGiftClearScreen {
for i := 0; i < int(gift.GiftNum); i++ {
h.clearScreen(room, user)
}
h.clearScreen(room, user, int(gift.GiftNum))
} else {
h.goldSpeedUp(room, user, float64(gift.GiftNum)*0.01)
}
case pbMq.MqGift_RED_PACK:
// 红包
h.redPackAddon(room, user)
h.redPackAddon(room, user, int(gift.GiftNum))
}
}
@ -259,20 +235,26 @@ func (h *ZhgmangGameLogic) goldSpeedUp(room *manager.Room, user *pbCommon.PbUser
})
}
func (h *ZhgmangGameLogic) clearScreen(room *manager.Room, user *pbCommon.PbUser) {
room.Broadcast(pb.PushZhgmangClearScreen, &pbGameZhgMang.ClearScreen{
User: user,
})
func (h *ZhgmangGameLogic) clearScreen(room *manager.Room, user *pbCommon.PbUser, count int) {
for i := 0; i < count; i++ {
room.Broadcast(pb.PushZhgmangClearScreen, &pbGameZhgMang.ClearScreen{
User: user,
})
}
}
func (h *ZhgmangGameLogic) randomAddon(room *manager.Room, user *pbCommon.PbUser) {
room.Broadcast(pb.PushZhgmangRandomAddon, &pbGameZhgMang.RandomAddon{
User: user,
})
func (h *ZhgmangGameLogic) randomAddon(room *manager.Room, user *pbCommon.PbUser, count int) {
for i := 0; i < count; i++ {
room.Broadcast(pb.PushZhgmangRandomAddon, &pbGameZhgMang.RandomAddon{
User: user,
})
}
}
func (h *ZhgmangGameLogic) redPackAddon(room *manager.Room, user *pbCommon.PbUser) {
room.Broadcast(pb.PushZhgmangRedPackAddon, &pbGameZhgMang.RedPackAddon{
User: user,
})
func (h *ZhgmangGameLogic) redPackAddon(room *manager.Room, user *pbCommon.PbUser, count int) {
for i := 0; i < count; i++ {
room.Broadcast(pb.PushZhgmangRedPackAddon, &pbGameZhgMang.RedPackAddon{
User: user,
})
}
}

Loading…
Cancel
Save