添加更改天气命令
This commit is contained in:
1 parent
6cca998915
commit
7df7fb9ac6
2 files changed
+46
No files matched your search
@@ -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: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>更改天气</color>",
|
||||
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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user