This commit is contained in:
flswld committed 2023-11-09 20:46:51 +08:00
1 parent 656b7c27ca
commit 98c6bbfe13
8 files changed
+139 -45

No files matched your search

+26 -28
View File
@@ -84,7 +84,7 @@ func (c *CommandManager) NewHelpCommandController() *CommandController {
return &CommandController{
Name: "帮助",
AliasList: []string{"help"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>查看简要帮助信息</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>帮助</color>",
UsageList: []string{
"{alias} 查看简要帮助信息",
"{alias} <序号/命令别名> 查看详细帮助信息",
@@ -128,8 +128,6 @@ func (c *CommandManager) HelpCommand(content *CommandContent) bool {
}
helpText += fmt.Sprintf("<color=%v>%v. %v</color> <color=#FFE5CC>-</color> %v\n", permColor, commandCount, controller.Name, strings.ReplaceAll(controller.Description, "{alias}", controller.AliasList[0]))
}
helpText += "\n<color=#FFFFCC>help</color> <color=#FFCCE5><命令别名></color> <color=#FF9999>能查看详细用法哦~</color>\n"
helpText += "<color=#FF6347><></color> <color=#87CEFA>代表必填参数</color> <color=#FF6347>[]</color> <color=#87CEFA>代表可选参数</color> <color=#FF6347>/</color> <color=#87CEFA>代表或者</color>"
content.SendMessage(content.Executor, helpText)
return true
}
@@ -267,9 +265,9 @@ func (c *CommandManager) JumpCommand(content *CommandContent) bool {
func (c *CommandManager) NewEquipCommandController() *CommandController {
return &CommandController{
Name: "管理武器",
Name: "武器",
AliasList: []string{"equip", "weapon"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>管理你的武器</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>武器</color>",
UsageList: []string{
"{alias} add <武器ID/all> [武器等级] [突破等级] 添加武器",
},
@@ -328,12 +326,12 @@ func (c *CommandManager) EquipCommand(content *CommandContent) bool {
func (c *CommandManager) NewItemCommandController() *CommandController {
return &CommandController{
Name: "管理物品",
Name: "道具",
AliasList: []string{"item"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>管理你的物品</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>道具</color>",
UsageList: []string{
"{alias} add <物品ID/all> [数量] 添加物品",
"{alias} clear 清除全部物品",
"{alias} add <道具ID/all> [数量] 添加道具",
"{alias} clear 清除全部道具",
},
Perm: CommandPermNormal,
Func: c.ItemCommand,
@@ -388,9 +386,9 @@ func (c *CommandManager) ItemCommand(content *CommandContent) bool {
func (c *CommandManager) NewAvatarCommandController() *CommandController {
return &CommandController{
Name: "管理角色",
Name: "角色",
AliasList: []string{"avatar"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>管理你的角色</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>角色</color>",
UsageList: []string{
"{alias} add <角色ID/all>",
},
@@ -439,9 +437,9 @@ func (c *CommandManager) AvatarCommand(content *CommandContent) bool {
func (c *CommandManager) NewGiveCommandController() *CommandController {
return &CommandController{
Name: "给予物品",
Name: "物品",
AliasList: []string{"give"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>获得全部物品</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>物品</color>",
UsageList: []string{
"模式:ID / item (所有物品) / weapon (所有武器) / reliquary (所有圣遗物) / avatar (所有角色) / costume (所有时装) / flycloak (所有风之翼) / all (全部)\n不要加上括号内的中文!!",
"{alias} <模式> [数量] 给予指定物品",
@@ -575,7 +573,7 @@ func (c *CommandManager) NewKillCommandController() *CommandController {
return &CommandController{
Name: "杀死实体",
AliasList: []string{"kill"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>杀死讨厌的实体</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>杀死实体</color>",
UsageList: []string{
"{alias} self 杀死自己",
"{alias} monster <实体ID/all> 杀死怪物",
@@ -636,9 +634,9 @@ func (c *CommandManager) KillCommand(content *CommandContent) bool {
func (c *CommandManager) NewMonsterCommandController() *CommandController {
return &CommandController{
Name: "生成怪物",
Name: "怪物",
AliasList: []string{"monster"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>生成原魔</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>怪物</color>",
UsageList: []string{
"{alias} <怪物ID> [数量] [等级] [姿势 (暂时无效)] [坐标X] [坐标Y] [坐标Z] 生成怪物",
},
@@ -688,9 +686,9 @@ func (c *CommandManager) MonsterCommand(content *CommandContent) bool {
func (c *CommandManager) NewGadgetCommandController() *CommandController {
return &CommandController{
Name: "生成物件",
Name: "物件",
AliasList: []string{"gadget"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>生成物件</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>物件</color>",
UsageList: []string{
"{alias} <物件ID> [数量] 附近生成物件",
},
@@ -719,9 +717,9 @@ func (c *CommandManager) GadgetCommand(content *CommandContent) bool {
func (c *CommandManager) NewQuestCommandController() *CommandController {
return &CommandController{
Name: "管理任务",
Name: "任务",
AliasList: []string{"quest"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>管理你的任务</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>任务</color>",
UsageList: []string{
"{alias} <add/accept> <任务ID> 接受任务",
"{alias} finish <任务ID/all> 完成任务",
@@ -785,9 +783,9 @@ func (c *CommandManager) QuestCommand(content *CommandContent) bool {
func (c *CommandManager) NewPointCommandController() *CommandController {
return &CommandController{
Name: "解锁锚点",
Name: "锚点",
AliasList: []string{"point"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>解锁地图上的锚点</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>锚点</color>",
UsageList: []string{
"{alias} [场景ID] <锚点ID/all> 解锁锚点",
},
@@ -830,9 +828,9 @@ func (c *CommandManager) PointCommand(content *CommandContent) bool {
func (c *CommandManager) NewWeatherCommandController() *CommandController {
return &CommandController{
Name: "更改天气",
Name: "天气",
AliasList: []string{"weather"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>更改天气</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>天气</color>",
UsageList: []string{
"{alias} [天气区域ID] <气象类型> 更改天气",
},
@@ -961,9 +959,9 @@ func (c *CommandManager) DebugCommand(content *CommandContent) bool {
func (c *CommandManager) NewWudiCommandController() *CommandController {
return &CommandController{
Name: "开关无敌",
Name: "无敌",
AliasList: []string{"wudi"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>开关无敌</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>无敌</color>",
UsageList: []string{
"{alias} global avatar <on/off> 开关玩家无敌",
},
@@ -1063,9 +1061,9 @@ func (c *CommandManager) EnergyCommand(content *CommandContent) bool {
func (c *CommandManager) NewStaminaCommandController() *CommandController {
return &CommandController{
Name: "无限耐力",
Name: "耐力",
AliasList: []string{"stamina"},
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>无限耐力</color>",
Description: "<color=#FFFFCC>{alias}</color> <color=#FFCC99>耐力</color>",
UsageList: []string{
"{alias} infinite <on/off> 开关无限耐力",
},
+7 -2
View File
@@ -490,7 +490,6 @@ func (g *GMCmd) GMUnlockAllOpenState(userId uint32) {
// GMFreeMode 自由探索模式
func (g *GMCmd) GMFreeMode(userId uint32) {
GAME.LogoutPlayer(userId)
player := USER_MANAGER.GetOnlineUser(userId)
if player == nil {
logger.Error("player is nil, uid: %v", userId)
@@ -504,7 +503,13 @@ func (g *GMCmd) GMFreeMode(userId uint32) {
player.PropMap[constant.PLAYER_PROP_PLAYER_CAN_DIVE] = 1
player.PropMap[constant.PLAYER_PROP_DIVE_MAX_STAMINA] = 10000
player.PropMap[constant.PLAYER_PROP_DIVE_CUR_STAMINA] = 10000
g.GMUnlockAllOpenState(userId)
GAME.SendMsg(cmd.PlayerPropNotify, userId, player.ClientSeq, GAME.PacketPlayerPropNotify(player))
for _, openStateData := range gdconf.GetOpenStateDataMap() {
player.OpenStateMap[uint32(openStateData.OpenStateId)] = 1
}
GAME.SendMsg(cmd.OpenStateChangeNotify, player.PlayerId, player.ClientSeq, &proto.OpenStateChangeNotify{
OpenStateMap: player.OpenStateMap,
})
for _, sceneData := range gdconf.GetSceneDataMap() {
g.GMUnlockAllPoint(userId, uint32(sceneData.SceneId))
}
-3
View File
@@ -579,9 +579,6 @@ func (w *World) GetPlayerActiveAvatarEntity(player *model.Player) *Entity {
avatarEntityId := w.GetPlayerWorldAvatarEntityId(player, activeAvatarId)
scene := w.GetSceneById(player.SceneId)
entity := scene.GetEntity(avatarEntityId)
if entity == nil {
panic("fuck")
}
return entity
}
+7
View File
@@ -209,6 +209,9 @@ func PrintContextLog(luaState *lua.LState) int {
}
func BeginCameraSceneLook(luaState *lua.LState) int {
// TODO 由于解锁风之翼任务相关原因暂时屏蔽
luaState.Push(lua.LNumber(-1))
return 1
ctx, ok := luaState.Get(1).(*lua.LTable)
if !ok {
luaState.Push(lua.LNumber(-1))
@@ -282,6 +285,10 @@ func ChangeGroupGadget(luaState *lua.LState) int {
gadgetStateInfo := new(gdconf.Gadget)
gdconf.ParseLuaTableToObject(gadgetInfo, gadgetStateInfo)
entity := group.GetEntityByConfigId(uint32(gadgetStateInfo.ConfigId))
if entity == nil {
luaState.Push(lua.LNumber(-1))
return 1
}
GAME.ChangeGadgetState(player, entity.GetId(), uint32(gadgetStateInfo.State))
luaState.Push(lua.LNumber(0))
return 1
+5 -1
View File
@@ -323,7 +323,11 @@ func (g *Game) handleEntityMove(player *model.Player, world *World, scene *Scene
rate /= 10.0
fightProp := entity.GetFightProp()
maxHp := fightProp[constant.FIGHT_PROP_MAX_HP]
g.SubPlayerAvatarHp(player.PlayerId, entity.GetAvatarEntity().GetAvatarId(), maxHp*rate, false, proto.ChangHpReason_CHANGE_HP_SUB_FALL)
damage := maxHp * rate
if motionInfo.State == proto.MotionState_MOTION_FIGHT {
damage /= 2.0
}
g.SubPlayerAvatarHp(player.PlayerId, entity.GetAvatarEntity().GetAvatarId(), damage, false, proto.ChangHpReason_CHANGE_HP_SUB_FALL)
}
}
player.Speed = &model.Vector{X: float64(motionInfo.Speed.X), Y: float64(motionInfo.Speed.Y), Z: float64(motionInfo.Speed.Z)}
+52 -11
View File
@@ -153,6 +153,11 @@ func (g *Game) AcceptQuest(player *model.Player, notifyClient bool) {
}
}
if canAccept {
if questData.QuestId == 35721 {
// TODO 由于第一次风龙任务进入秘境客户端会无限重连相关原因暂时屏蔽
COMMAND_MANAGER.gmCmd.GMFreeMode(player.PlayerId)
continue
}
dbQuest.AddQuest(uint32(questData.QuestId))
addQuestIdList = append(addQuestIdList, uint32(questData.QuestId))
}
@@ -238,7 +243,7 @@ func (g *Game) QuestExec(player *model.Player, questId uint32, questExecType int
if err != nil {
continue
}
g.AddSceneGroupSuite(player, uint32(groupId), uint8(suiteId))
g.RefreshSceneGroupSuite(player, uint32(groupId), uint8(suiteId))
case constant.QUEST_EXEC_TYPE_SET_OPEN_STATE:
if len(questExec.Param) != 2 {
continue
@@ -335,6 +340,18 @@ func (g *Game) QuestExec(player *model.Player, questId uint32, questExecType int
continue
}
g.ChangeGameTime(scene, uint32(hour*60))
case constant.QUEST_EXEC_TYPE_ROLLBACK_QUEST:
if len(questExec.Param) != 1 {
continue
}
rollbackQuestId, err := strconv.Atoi(questExec.Param[0])
if err != nil {
continue
}
dbQuest := player.GetDbQuest()
rollbackQuest := dbQuest.GetQuestById(uint32(rollbackQuestId))
rollbackQuest.State = constant.QUEST_STATE_UNSTARTED
g.StartQuest(player, rollbackQuest.QuestId, true)
}
}
}
@@ -357,13 +374,27 @@ func (g *Game) TriggerQuest(player *model.Player, cond int32, complexParam strin
dbQuest := player.GetDbQuest()
updateQuestIdList := make([]uint32, 0)
for _, quest := range dbQuest.GetQuestMap() {
if quest.State == constant.QUEST_STATE_FINISHED {
if quest.State != constant.QUEST_STATE_UNFINISHED {
continue
}
questDataConfig := gdconf.GetQuestDataById(int32(quest.QuestId))
if questDataConfig == nil {
continue
}
for _, questCond := range questDataConfig.FailCondList {
if questCond.Type != cond {
continue
}
switch cond {
case constant.QUEST_FINISH_COND_TYPE_LUA_NOTIFY:
// LUA侧通知 复杂参数
if questCond.ComplexParam != complexParam {
continue
}
dbQuest.FailQuest(quest.QuestId)
updateQuestIdList = append(updateQuestIdList, quest.QuestId)
}
}
for _, questCond := range questDataConfig.FinishCondList {
if questCond.Type != cond {
continue
@@ -429,15 +460,6 @@ func (g *Game) TriggerQuest(player *model.Player, cond int32, complexParam strin
dbQuest.ForceFinishQuest(quest.QuestId)
updateQuestIdList = append(updateQuestIdList, quest.QuestId)
}
if quest.State == constant.QUEST_STATE_FINISHED {
g.QuestExec(player, quest.QuestId, QuestExecTypeFinish)
if len(questDataConfig.ItemIdList) != 0 {
for index, itemId := range questDataConfig.ItemIdList {
questItem := []*ChangeItem{{ItemId: uint32(itemId), ChangeCount: uint32(questDataConfig.ItemCountList[index])}}
g.AddPlayerItem(player.PlayerId, questItem, true, 0)
}
}
}
}
}
if len(updateQuestIdList) > 0 {
@@ -499,6 +521,25 @@ func (g *Game) TriggerQuest(player *model.Player, cond int32, complexParam strin
ParentQuestList: parentQuestList,
})
}
for _, questId := range updateQuestIdList {
quest := dbQuest.GetQuestById(questId)
questDataConfig := gdconf.GetQuestDataById(int32(quest.QuestId))
if questDataConfig == nil {
continue
}
if quest.State == constant.QUEST_STATE_FINISHED {
g.QuestExec(player, quest.QuestId, QuestExecTypeFinish)
if len(questDataConfig.ItemIdList) != 0 {
for index, itemId := range questDataConfig.ItemIdList {
questItem := []*ChangeItem{{ItemId: uint32(itemId), ChangeCount: uint32(questDataConfig.ItemCountList[index])}}
g.AddPlayerItem(player.PlayerId, questItem, true, 0)
}
}
}
if quest.State == constant.QUEST_STATE_FAILED {
g.QuestExec(player, quest.QuestId, QuestExecTypeFail)
}
}
g.AcceptQuest(player, true)
}
}
+30
View File
@@ -1019,6 +1019,36 @@ func (g *Game) AddSceneGroupSuiteCore(player *model.Player, scene *Scene, groupI
scene.AddGroupSuite(groupId, suiteId, entityMap)
}
func (g *Game) RefreshSceneGroupSuite(player *model.Player, groupId uint32, suiteId uint8) {
world := WORLD_MANAGER.GetWorldById(player.WorldId)
if world == nil {
return
}
scene := world.GetSceneById(player.SceneId)
group := scene.GetGroupById(groupId)
if group == nil {
return
}
suite := group.GetSuiteById(suiteId)
if suite == nil {
return
}
entityIdList := make([]uint32, 0)
for _, entity := range suite.GetAllEntity() {
entityIdList = append(entityIdList, entity.GetId())
}
g.RemoveSceneEntityNotifyBroadcast(scene, proto.VisionType_VISION_MISS, entityIdList, 0)
scene.RemoveGroupSuite(groupId, suiteId)
dbWorld := player.GetDbWorld()
dbScene := dbWorld.GetSceneById(player.SceneId)
dbSceneGroup := dbScene.GetSceneGroupById(groupId)
dbSceneGroup.RemoveAllKill()
g.AddSceneGroupSuite(player, groupId, suiteId)
}
// CreateConfigEntity 创建配置表里的实体
func (g *Game) CreateConfigEntity(scene *Scene, groupId uint32, entityConfig any) uint32 {
world := scene.GetWorld()
+12
View File
@@ -130,3 +130,15 @@ func (q *DbQuest) ForceFinishQuest(questId uint32) {
q.AddQuestProgress(questId, index, uint32(finishCond.Count))
}
}
func (q *DbQuest) FailQuest(questId uint32) {
quest, exist := q.QuestMap[questId]
if !exist {
logger.Error("get quest is nil, questId: %v", questId)
return
}
if quest.State != constant.QUEST_STATE_UNFINISHED {
return
}
quest.State = constant.QUEST_STATE_FAILED
}