| | |
| | | import GameWorld
|
| | | import MirrorAttack
|
| | | import PlayerViewCacheTube
|
| | | import PlayerFB
|
| | | import ChConfig
|
| | |
|
| | | ## GM命令执行入口
|
| | |
| | | def OnExec(curPlayer, paramList):
|
| | | if not paramList:
|
| | | GameWorld.DebugAnswer(curPlayer, "-------------------%s" % GameWorld.GetCurrentDataTimeStr())
|
| | | GameWorld.DebugAnswer(curPlayer, "创建战斗: PlayerMirror c 是否后台 [目标ID ID2 ...]")
|
| | | GameWorld.DebugAnswer(curPlayer, "开始战斗: PlayerMirror s")
|
| | | GameWorld.DebugAnswer(curPlayer, "后台战斗: PlayerMirror s [玩家ID1 ID2 ...]")
|
| | | GameWorld.DebugAnswer(curPlayer, "切图战斗: PlayerMirror m [功能地图ID 线路 目标ID]")
|
| | | GameWorld.DebugAnswer(curPlayer, "跳过战斗: PlayerMirror q")
|
| | | GameWorld.DebugAnswer(curPlayer, "退出战斗: PlayerMirror e")
|
| | | GameWorld.DebugAnswer(curPlayer, "更新镜像: PlayerMirror 5")
|
| | | GameWorld.DebugAnswer(curPlayer, "加假数据: PlayerMirror a 个数 [起始ID 战力 区服ID 模版key]")
|
| | | GameWorld.DebugAnswer(curPlayer, "删假数据: PlayerMirror d")
|
| | | GameWorld.DebugAnswer(curPlayer, "输出数据: PlayerMirror p [起始索引 个数 ]")
|
| | | GameWorld.DebugAnswer(curPlayer, "是否后台:0-玩家自身参与战斗")
|
| | | GameWorld.DebugAnswer(curPlayer, "是否后台:1-玩家无感知,系统直接出结果")
|
| | | GameWorld.DebugAnswer(curPlayer, "目标ID:无-自己;>0-其他玩家ID支持跨服玩家ID")
|
| | | GameWorld.DebugAnswer(curPlayer, "目标ID多个时为多对多战斗")
|
| | | GameWorld.DebugAnswer(curPlayer, "多对多阵营分配均分AABBB即玩家和AA对BBB")
|
| | | GameWorld.DebugAnswer(curPlayer, "多对多阵营分配ID为前后前后即AABB")
|
| | | GameWorld.DebugAnswer(curPlayer, "后台战斗时ID阵营分配为[AABB]")
|
| | | GameWorld.DebugAnswer(curPlayer, "切图战斗时ID阵营分配为[自己ABB]")
|
| | | GameWorld.DebugAnswer(curPlayer, "玩家ID不填时默认自己跟自己打")
|
| | | return
|
| | |
|
| | | mapID = ChConfig.Def_FBMapID_MirrorBattle
|
| | | lineID = 0
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | value1 = paramList[0]
|
| | | if value1 == "c":
|
| | | isSysbg = paramList[1] if len(paramList) > 1 else 0
|
| | | if not isSysbg:
|
| | | if not PlayerFB.DoEnterCustomScene(curPlayer, mapID, lineID, tick):
|
| | | GameWorld.DebugAnswer(curPlayer, "进入自定义PK创景失败:%s" % mapID)
|
| | | return
|
| | | |
| | | mirrorIDList = paramList[2:]
|
| | | if value1 == "s":
|
| | | mapID = ChConfig.Def_FBMapID_MirrorBattle
|
| | | lineID = 0
|
| | | mirrorIDList = paramList[1:]
|
| | | if not mirrorIDList:
|
| | | mirrorIDList.append(playerID)
|
| | | mirrorIDList = [playerID, playerID]
|
| | | elif len(mirrorIDList) == 1:
|
| | | mirrorIDList = [playerID] + mirrorIDList
|
| | |
|
| | | factionIDListA, factionIDListB = [playerID], []
|
| | | reqPlayer = curPlayer if mirrorIDList[0] == playerID else None # 第一个ID是玩家ID时代表属于玩家发起的后台战斗
|
| | | requestID = playerID if curPlayer else GameWorld.GetGameWorld().GetTick()
|
| | | |
| | | factionIDListA, factionIDListB = [], []
|
| | | while mirrorIDList:
|
| | | # 后面为对手
|
| | | factionIDListB.append(mirrorIDList.pop(-1))
|
| | | # 前面为队友
|
| | | factionIDListA.append(mirrorIDList.pop(0))
|
| | | if mirrorIDList:
|
| | | factionIDListA.append(mirrorIDList.pop(0))
|
| | | |
| | | posX, posY = curPlayer.GetPosX(), curPlayer.GetPosY()
|
| | | battlePlayerList = []
|
| | | for i, batPlayerID in enumerate(factionIDListA):
|
| | | battlePlayerList.append({"playerID":batPlayerID, "faction":1, "posX":posX, "posY":posY + i * 5})
|
| | | for i, batPlayerID in enumerate(factionIDListB):
|
| | | battlePlayerList.append({"playerID":batPlayerID, "faction":2, "posX":posX + 5, "posY":posY + i * 5})
|
| | | factionIDListB.append(mirrorIDList.pop(-1))
|
| | | factionPlayerList = [factionIDListA, factionIDListB]
|
| | | |
| | | if MirrorAttack.OnRequestCreateMirrorBattle(mapID, lineID, requestID, factionPlayerList, True, reqPlayer):
|
| | | GameWorld.DebugAnswer(curPlayer, "后台战斗: %s VS %s" % (factionIDListA, factionIDListB))
|
| | | else:
|
| | | GameWorld.DebugAnswer(curPlayer, "后台战斗失败: %s VS %s" % (factionIDListA, factionIDListB))
|
| | | |
| | | elif value1 == "m":
|
| | | mapID = paramList[1] if len(paramList) > 1 else ChConfig.Def_FBMapID_MirrorBattle
|
| | | lineID = paramList[2] if len(paramList) > 2 else 0
|
| | | mirrorIDList = [playerID] + paramList[3:]
|
| | | if len(mirrorIDList) < 2:
|
| | | mirrorIDList.append(playerID) # 默认和自己打
|
| | |
|
| | | requestID = playerID
|
| | | if MirrorAttack.OnRequestCreateMirrorBattle(mapID, lineID, requestID, battlePlayerList, isSysbg, curPlayer):
|
| | | GameWorld.DebugAnswer(curPlayer, "请求创建镜像: %s VS %s" % (factionIDListA, factionIDListB))
|
| | | else:
|
| | | GameWorld.DebugAnswer(curPlayer, "请求创建镜像失败: %s VS %s" % (factionIDListA, factionIDListB))
|
| | | |
| | | elif value1 == "s":
|
| | | battle = MirrorAttack.GetMirrorBattle(curPlayer)
|
| | | if battle:
|
| | | MirrorAttack.OnMirrorBattleStart(battle.battleID)
|
| | | |
| | | factionIDListA, factionIDListB = [], []
|
| | | while mirrorIDList:
|
| | | factionIDListA.append(mirrorIDList.pop(0))
|
| | | if mirrorIDList:
|
| | | factionIDListB.append(mirrorIDList.pop(-1))
|
| | | factionPlayerList = [factionIDListA, factionIDListB]
|
| | | |
| | | reqOK = MirrorAttack.OnRequestCreateMirrorBattle(mapID, lineID, requestID, factionPlayerList, False, curPlayer, True)
|
| | | GameWorld.DebugAnswer(curPlayer, "切图战斗: %s VS %s, %s" % (factionIDListA, factionIDListB, reqOK))
|
| | | |
| | | elif value1 == "q":
|
| | | battle = MirrorAttack.GetMirrorBattle(curPlayer)
|
| | | if battle:
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "无法执行快速战斗,详见地图日志!")
|
| | | return
|
| | |
|
| | | elif value1 == "e":
|
| | | PlayerFB.DoExitCustomScene(curPlayer)
|
| | | |
| | | elif value1 == 5:
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | PlayerViewCacheTube.UpdateGameServerPlayerCache(curPlayer, tick, forcePackData=True)
|