diff --git a/gs/game/game_command_controller.go b/gs/game/game_command_controller.go
index 3b00e6f3..2e016af0 100644
--- a/gs/game/game_command_controller.go
+++ b/gs/game/game_command_controller.go
@@ -37,6 +37,7 @@ func (c *CommandManager) InitController() {
c.NewGadgetCommandController(),
c.NewQuestCommandController(),
c.NewPointCommandController(),
+ c.NewWeatherCommandController(),
c.NewXLuaDebugCommandController(),
c.NewGcgCommandController(),
}
@@ -812,6 +813,41 @@ func (c *CommandManager) PointCommand(content *CommandContent) bool {
})
}
+// 更改天气命令
+
+func (c *CommandManager) NewWeatherCommandController() *CommandController {
+ return &CommandController{
+ Name: "更改天气",
+ AliasList: []string{"weather"},
+ Description: "{alias} 更改天气",
+ UsageList: []string{
+ "{alias} [天气区域ID] <气象类型> 更改天气",
+ },
+ Perm: CommandPermNormal,
+ Func: c.WeatherCommand,
+ }
+}
+
+func (c *CommandManager) WeatherCommand(content *CommandContent) bool {
+ var weatherAreaId = content.AssignPlayer.WeatherInfo.WeatherAreaId // 天气区域id
+ var climateType uint32 // 气象类型
+
+ return content.Option("uint32", func(param any) bool {
+ // 天气id
+ weatherAreaId = param.(uint32)
+ return true
+ }).Dynamic("uint32", func(param any) bool {
+ // 气象类型
+ climateType = param.(uint32)
+ return true
+ }).Execute(func() bool {
+ // 设置天气
+ c.gmCmd.GMSetWeather(content.AssignPlayer.PlayerId, weatherAreaId, climateType)
+ content.SendSuccMessage(content.Executor, "已更改天气,指定UID:%v,天气区域ID:%v,气象类型:%v。", content.AssignPlayer.PlayerId, weatherAreaId, climateType)
+ return true
+ })
+}
+
// xLua调试命令
func (c *CommandManager) NewXLuaDebugCommandController() *CommandController {
diff --git a/gs/game/game_command_gm.go b/gs/game/game_command_gm.go
index c4593846..8ad61c85 100644
--- a/gs/game/game_command_gm.go
+++ b/gs/game/game_command_gm.go
@@ -377,6 +377,16 @@ func (g *GMCmd) GMUnlockAllPoint(userId uint32, sceneId uint32) {
})
}
+// GMSetWeather 设置天气
+func (g *GMCmd) GMSetWeather(userId uint32, weatherAreaId uint32, climateType uint32) {
+ player := USER_MANAGER.GetOnlineUser(userId)
+ if player == nil {
+ logger.Error("player is nil, uid: %v", userId)
+ return
+ }
+ GAME.SetPlayerWeather(player, weatherAreaId, climateType)
+}
+
// GMCreateMonster 在玩家附近创建怪物
func (g *GMCmd) GMCreateMonster(userId uint32, monsterId uint32, posX, posY, posZ float64, count uint32, level uint8) {
player := USER_MANAGER.GetOnlineUser(userId)