10263 【越南】后端支持NPC仿真实玩家战斗和快速战斗
| | |
| | | Def_Billboard_MaxCnt = 100
|
| | | #---------------------------------------------------------------------
|
| | | #请求类型(需要和MapServer中的一致)
|
| | | Def_QueryType_Count = 55
|
| | | Def_QueryType_Count = 56
|
| | | (
|
| | | queryType_sqtPlayer, #查询玩家
|
| | | queryType_sqtFamilyWar, #家族战
|
| | |
| | | queryType_EnterFB, #进入副本
|
| | | queryType_NPCInfo, #查询NPCInfo
|
| | | queryType_NPCCnt, #查询NPC数量
|
| | | queryType_MirrorPlayer, #镜像玩家
|
| | | ) = range(0, Def_QueryType_Count)
|
| | | #------------------------------------------------------------------------------
|
| | | #家族某行为类型保存的条数
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #
|
| | | #
|
| | | ##@package QueryDBLogicResult.py
|
| | | #
|
| | | # @todo:GameServer向DB请求的回复信息
|
| | |
|
| | | import GameWorld
|
| | | import IPY_GameServer
|
| | | import ChConfig
|
| | |
|
| | | #-------------------------------------------------------------------------
|
| | |
|
| | | # //04 08 GameServer向DB请求的回复信息 tagDGQueryDBLogicResult
|
| | |
|
| | | # struct tagDGQueryDBLogicResult
|
| | | # {
|
| | | # tagHead Head;
|
| | | # BYTE Result; //结果:1成功;0失败
|
| | | # DWORD ID; //查询的ID
|
| | | # BYTE QueryType; //查询的类型
|
| | | # DWORD DataLen;
|
| | | # char Data[DataLen]; //原样返回的附加数据
|
| | | # DWORD ResultSetLen;
|
| | | # char ResultSet[ResultSetLen]; //结果集
|
| | | # };
|
| | |
|
| | | ## DB返回到GameServer信息
|
| | | # @param None None
|
| | | # @return None
|
| | | def RecvDGDBLogicResult(index, tick):
|
| | | dbResultPack = IPY_GameServer.IPY_DGQueryDBLogicResult()
|
| | | result = dbResultPack.GetResult() #结果:1成功,0失败
|
| | | if result == 0:
|
| | | return
|
| | | queryType = dbResultPack.GetQueryType()
|
| | | if queryType == 0:
|
| | | data = eval(dbResultPack.GetData())
|
| | | playerID = data['id'] #发起请求的玩家ID
|
| | | mapID = data['mapid']
|
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if not curPlayer:
|
| | | return
|
| | | |
| | | data['playerData'] = dbResultPack.GetResultSet()
|
| | | dateStr = str(data)
|
| | | GameWorld.GetPlayerManager().MapServer_QueryPlayer(0, ChConfig.queryType_MirrorPlayer, playerID, mapID,
|
| | | "PlayerMirror", dateStr, len(dateStr), curPlayer.GetRouteServerIndex())
|
| | | return |
| | |
| | | def SendProxyDBOper(self, *args): return _IPY_GameServer1.IPY_GameWorld_SendProxyDBOper(self, *args)
|
| | | def SendMergerChildToCenterStringData(self, *args): return _IPY_GameServer1.IPY_GameWorld_SendMergerChildToCenterStringData(self, *args)
|
| | | def SendCrossServerStateToLoginServer(self, *args): return _IPY_GameServer1.IPY_GameWorld_SendCrossServerStateToLoginServer(self, *args)
|
| | | def SendDBLogic(self, *args): return _IPY_GameServer1.IPY_GameWorld_SendDBLogic(self, *args)
|
| | | IPY_GameWorld_swigregister = _IPY_GameServer1.IPY_GameWorld_swigregister
|
| | | IPY_GameWorld_swigregister(IPY_GameWorld)
|
| | |
|
| | |
| | | IPY_LGCrossLoginResult_swigregister(IPY_LGCrossLoginResult)
|
| | |
|
| | |
|
| | | def GettagDGQueryDBLogicResult():
|
| | | return _IPY_MapServerToGameServer.GettagDGQueryDBLogicResult()
|
| | | GettagDGQueryDBLogicResult = _IPY_MapServerToGameServer.GettagDGQueryDBLogicResult
|
| | | class IPY_DGQueryDBLogicResult(_object):
|
| | | __swig_setmethods__ = {}
|
| | | __setattr__ = lambda self, name, value: _swig_setattr(self, IPY_DGQueryDBLogicResult, name, value)
|
| | | __swig_getmethods__ = {}
|
| | | __getattr__ = lambda self, name: _swig_getattr(self, IPY_DGQueryDBLogicResult, name)
|
| | | __repr__ = _swig_repr
|
| | | def GetResult(self): return _IPY_MapServerToGameServer.IPY_DGQueryDBLogicResult_GetResult(self)
|
| | | def GetID(self): return _IPY_MapServerToGameServer.IPY_DGQueryDBLogicResult_GetID(self)
|
| | | def GetQueryType(self): return _IPY_MapServerToGameServer.IPY_DGQueryDBLogicResult_GetQueryType(self)
|
| | | def GetDataLen(self): return _IPY_MapServerToGameServer.IPY_DGQueryDBLogicResult_GetDataLen(self)
|
| | | def GetData(self): return _IPY_MapServerToGameServer.IPY_DGQueryDBLogicResult_GetData(self)
|
| | | def GetResultSetLen(self): return _IPY_MapServerToGameServer.IPY_DGQueryDBLogicResult_GetResultSetLen(self)
|
| | | def GetResultSet(self): return _IPY_MapServerToGameServer.IPY_DGQueryDBLogicResult_GetResultSet(self)
|
| | | def __init__(self): |
| | | this = _IPY_MapServerToGameServer.new_IPY_DGQueryDBLogicResult()
|
| | | try: self.this.append(this)
|
| | | except: self.this = this
|
| | | __swig_destroy__ = _IPY_MapServerToGameServer.delete_IPY_DGQueryDBLogicResult
|
| | | __del__ = lambda self : None;
|
| | | IPY_DGQueryDBLogicResult_swigregister = _IPY_MapServerToGameServer.IPY_DGQueryDBLogicResult_swigregister
|
| | | IPY_DGQueryDBLogicResult_swigregister(IPY_DGQueryDBLogicResult)
|
| | |
|
| | |
|
| | | def GettagGCalcFamilyWarResult():
|
| | | return _IPY_MapServerToGameServer.GettagGCalcFamilyWarResult()
|
| | | GettagGCalcFamilyWarResult = _IPY_MapServerToGameServer.GettagGCalcFamilyWarResult
|
| | |
| | | Def_Player_Truck_ID_Rate = _IPY_PlayerDefine.Def_Player_Truck_ID_Rate
|
| | | Def_Player_Pet_ID_Rate = _IPY_PlayerDefine.Def_Player_Pet_ID_Rate
|
| | | Def_Player_PetList_MaxCnt = _IPY_PlayerDefine.Def_Player_PetList_MaxCnt
|
| | | Def_Player_MirrorID = _IPY_PlayerDefine.Def_Player_MirrorID
|
| | |
|
| | | def MakePetID(*args):
|
| | | return _IPY_PlayerDefine.MakePetID(*args)
|
| | |
| | | dgBroadcastMergeClient = _IPY_ServerDefine.dgBroadcastMergeClient
|
| | | dgMergerChildToCenter = _IPY_ServerDefine.dgMergerChildToCenter
|
| | | dgLoginMergeServer = _IPY_ServerDefine.dgLoginMergeServer
|
| | | dgDBGameServerToDBLogicResult = _IPY_ServerDefine.dgDBGameServerToDBLogicResult
|
| | | gmMapInitOk = _IPY_ServerDefine.gmMapInitOk
|
| | | gmPlayerInit = _IPY_ServerDefine.gmPlayerInit
|
| | | gmPlayerLogout = _IPY_ServerDefine.gmPlayerLogout
|
| | |
| | | gstSendDBMergeClientMsg = _IPY_ServerDefine.gstSendDBMergeClientMsg
|
| | | gstSendDBMergeClientListMsg = _IPY_ServerDefine.gstSendDBMergeClientListMsg
|
| | | gstMergePlayerData = _IPY_ServerDefine.gstMergePlayerData
|
| | | gstDBLogic = _IPY_ServerDefine.gstDBLogic
|
| | | gstMax = _IPY_ServerDefine.gstMax
|
| | | btgServerSupport = _IPY_ServerDefine.btgServerSupport
|
| | | btgLineID = _IPY_ServerDefine.btgLineID
|
| | |
| | | elif queryType == ChConfig.queryType_NPCCnt:
|
| | | __QueryMapNPCCntInfo(curPlayer, queryCallName, sendCMD, tick)
|
| | | return
|
| | | elif queryType == ChConfig.queryType_MirrorPlayer:
|
| | | data = str({"id" : curPlayer.GetPlayerID(), "mapid" : GameWorld.GetQueryPlayerMapID(curPlayer)})
|
| | | GameWorld.GetGameWorld().SendDBLogic(0, queryID, data, len(data))
|
| | | return
|
| | | else:
|
| | | GameWorld.ErrLog('unKnow queryType = %s' % (queryType))
|
| | |
|
| | |
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #请求类型(需要和GameServer中的一致)
|
| | | Def_QueryType_Count = 55
|
| | | Def_QueryType_Count = 56
|
| | | (
|
| | | queryType_sqtPlayer, #查询玩家
|
| | | queryType_sqtFamilyWar, #家族战
|
| | |
| | | queryType_EnterFB, #进入副本
|
| | | queryType_NPCInfo, #查询NPCInfo
|
| | | queryType_NPCCnt, #查询NPC数量
|
| | | queryType_MirrorPlayer, #镜像玩家
|
| | | ) = range(0, Def_QueryType_Count)
|
| | | #------------------------------------------------------------------------------
|
| | | #---------------------------------------------------------------------
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | |
|
| | | ##@package ClearPlayerMirror
|
| | | # 清理玩家镜像
|
| | |
|
| | |
|
| | | import GameWorld
|
| | |
|
| | | ## GM命令执行入口
|
| | | # @param curPlayer 当前玩家
|
| | | # @param playerList 参数列表 [玩家ID]
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def OnExec(curPlayer, playerList):
|
| | | playerID = 0
|
| | | if len(playerList) != 0:
|
| | | playerID = playerList[0]
|
| | | |
| | | if playerID != 0:
|
| | | mirrorPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if mirrorPlayer:
|
| | | mirrorPlayer.DeleteMirror()
|
| | | return
|
| | |
|
| | | ids = []
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in range(playerManager.OnlineCount()):
|
| | | mirrorPlayer = playerManager.OnlineAt(i)
|
| | | if not mirrorPlayer:
|
| | | continue
|
| | | |
| | | ids.append(mirrorPlayer.GetID())
|
| | |
|
| | | for id in ids:
|
| | | mirrorPlayer = playerManager.FindPlayerByID(id)
|
| | | if not mirrorPlayer:
|
| | | continue
|
| | | mirrorPlayer.DeleteMirror() |
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | |
|
| | | ##@package PlayerMirror
|
| | | # 创建玩家镜像, 考虑地图人满问题,py可以做个预判,可调整地图配置的人数上限
|
| | |
|
| | |
|
| | | import GameWorld
|
| | | import PlayerEventCounter
|
| | | import ChPlayer
|
| | | import GameServerRefresh
|
| | | import ChConfig
|
| | |
|
| | | ## GM命令执行入口
|
| | | # @param curPlayer 当前玩家
|
| | | # @param playerList 参数列表 [玩家ID]
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def OnExec(curPlayer, playerList):
|
| | | playerID = 0
|
| | | if len(playerList) != 0:
|
| | | playerID = playerList[0]
|
| | | |
| | | if playerID != 0:
|
| | | #向GameServer请求其他玩家数据
|
| | | #开始查询
|
| | | curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_MirrorPlayer, playerID, 'PlayerMirror', '', 0)
|
| | | return
|
| | |
|
| | | playerData = curPlayer.GetPackData()
|
| | | # playerData为base64后的数据
|
| | | mirrorPlayer = GameWorld.GetGameWorld().CreateMirrorPlayer(playerData, curPlayer.GetPosX(), curPlayer.GetPosY())
|
| | | |
| | | GameWorld.Log("mirrorPlayer.GetRealPlayerID %s"%mirrorPlayer.GetRealPlayerID())
|
| | | #CreateMirrorPlayer 中会调用到 ChPlayer.PlayerLogin
|
| | | #是否镜像玩家 判断 mirrorPlayer.GetRealPlayerID()是否为0
|
| | | #python自己处理,以下逻辑,可以在DoPlayerLogin函数最后 判断是镜像玩家后统一处理
|
| | |
|
| | | index = mirrorPlayer.GetIndex()
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | PlayerEventCounter.GameServer_InitOK(index, tick)
|
| | | ChPlayer.LoadMapOK(index, tick)
|
| | | GameServerRefresh.GameSever_PlayerInitOK(index, tick) |
| | |
| | | def SendDBFinishRecharge(self, *args): return _IPY_GameObj.IPY_Player_SendDBFinishRecharge(self, *args)
|
| | | def SendDBQueryRecharge(self): return _IPY_GameObj.IPY_Player_SendDBQueryRecharge(self)
|
| | | def GetMergePlayerData(self): return _IPY_GameObj.IPY_Player_GetMergePlayerData(self)
|
| | | def GetPackData(self): return _IPY_GameObj.IPY_Player_GetPackData(self)
|
| | | def GetRealPlayerID(self): return _IPY_GameObj.IPY_Player_GetRealPlayerID(self)
|
| | | def GetIndex(self): return _IPY_GameObj.IPY_Player_GetIndex(self)
|
| | | def DeleteMirror(self): return _IPY_GameObj.IPY_Player_DeleteMirror(self)
|
| | | def SendMergeRegisterPlayer(self, selectMapID = 0, selectDataMapID = 0, selectCopyMapID = 0,
|
| | | selectPosX = 0, selectPosY = 0): return _IPY_GameObj.IPY_Player_SendMergeRegisterPlayer(self, selectMapID, selectDataMapID, selectCopyMapID, selectPosX,
|
| | | selectPosY)
|
| | |
| | | def EventReport_EventReport(self, *args): return _IPY_GameWorld1.IPY_GameWorld_EventReport_EventReport(self, *args)
|
| | | def EventReport_SetEventReportParam(self, *args): return _IPY_GameWorld1.IPY_GameWorld_EventReport_SetEventReportParam(self, *args)
|
| | | def SendGameServerGeneralPack(self, *args): return _IPY_GameWorld1.IPY_GameWorld_SendGameServerGeneralPack(self, *args)
|
| | | def CreateMirrorPlayer(self, *args): return _IPY_GameWorld1.IPY_GameWorld_CreateMirrorPlayer(self, *args)
|
| | | IPY_GameWorld_swigregister = _IPY_GameWorld1.IPY_GameWorld_swigregister
|
| | | IPY_GameWorld_swigregister(IPY_GameWorld)
|
| | |
|
| | |
| | | Def_Player_Truck_ID_Rate = _IPY_PlayerDefine.Def_Player_Truck_ID_Rate
|
| | | Def_Player_Pet_ID_Rate = _IPY_PlayerDefine.Def_Player_Pet_ID_Rate
|
| | | Def_Player_PetList_MaxCnt = _IPY_PlayerDefine.Def_Player_PetList_MaxCnt
|
| | | Def_Player_MirrorID = _IPY_PlayerDefine.Def_Player_MirrorID
|
| | |
|
| | | def MakePetID(*args):
|
| | | return _IPY_PlayerDefine.MakePetID(*args)
|
| | |
| | | dgBroadcastMergeClient = _IPY_ServerDefine.dgBroadcastMergeClient
|
| | | dgMergerChildToCenter = _IPY_ServerDefine.dgMergerChildToCenter
|
| | | dgLoginMergeServer = _IPY_ServerDefine.dgLoginMergeServer
|
| | | dgDBGameServerToDBLogicResult = _IPY_ServerDefine.dgDBGameServerToDBLogicResult
|
| | | gmMapInitOk = _IPY_ServerDefine.gmMapInitOk
|
| | | gmPlayerInit = _IPY_ServerDefine.gmPlayerInit
|
| | | gmPlayerLogout = _IPY_ServerDefine.gmPlayerLogout
|
| | |
| | | gstSendDBMergeClientMsg = _IPY_ServerDefine.gstSendDBMergeClientMsg
|
| | | gstSendDBMergeClientListMsg = _IPY_ServerDefine.gstSendDBMergeClientListMsg
|
| | | gstMergePlayerData = _IPY_ServerDefine.gstMergePlayerData
|
| | | gstDBLogic = _IPY_ServerDefine.gstDBLogic
|
| | | gstMax = _IPY_ServerDefine.gstMax
|
| | | btgServerSupport = _IPY_ServerDefine.btgServerSupport
|
| | | btgLineID = _IPY_ServerDefine.btgLineID
|
| | |
| | | ##发送Map到GameServer的沟通包
|
| | | #
|
| | | def SendPyPackToGameServer(sendPack):
|
| | | if hasattr(sendPack, 'PlayerID'):
|
| | | if sendPack.PlayerID >= 100000000:
|
| | | return
|
| | | routeIndex = GameWorld.GetGameWorld().GetLineNO()
|
| | | #这里必须用GetRealMapID,GetMapID 实际取到的是DataMapID,在有分线的地图会问题
|
| | | mapID = GameWorld.GetGameWorld().GetRealMapID()
|
| | |
| | | if not PlayerBakRoot:
|
| | | #GameWorld.DebugLog("未启用备档")
|
| | | return
|
| | | |
| | | if curPlayer.GetRealPlayerID() != 0:
|
| | | return
|
| | |
|
| | | curTime = int(time.time())
|
| | | backupTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BackupTime)
|
| | | if not backupTime:
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #---------------------------------------------------------------------
|
| | | #
|
| | | #---------------------------------------------------------------------
|
| | | ##@package GY_Query_PlayerMirror
|
| | |
|
| | | import GameWorld
|
| | | import PlayerEventCounter
|
| | | import ChPlayer
|
| | | import GameServerRefresh
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | # @param query_Type 请求类型
|
| | | # @param query_ID 请求的玩家ID
|
| | | # @param packCMDList 发包命令
|
| | | # @param tick 当前时间
|
| | | # @return "True" or "False" or ""
|
| | | def DoLogic(query_Type, query_ID, packCMDList, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(query_ID)
|
| | | |
| | | if not curPlayer or curPlayer.IsEmpty():
|
| | | return ''
|
| | | playerData = packCMDList['playerData']
|
| | | # playerData为base64后的数据
|
| | | mirrorPlayer = GameWorld.GetGameWorld().CreateMirrorPlayer(playerData, curPlayer.GetPosX(), curPlayer.GetPosY())
|
| | | |
| | |
|
| | | #CreateMirrorPlayer 中会调用到 ChPlayer.PlayerLogin
|
| | | #是否镜像玩家 判断 mirrorPlayer.GetRealPlayerID()是否为0
|
| | | #python自己处理,以下逻辑,可以在DoPlayerLogin函数最后 判断是镜像玩家后统一处理
|
| | |
|
| | | index = mirrorPlayer.GetIndex()
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | PlayerEventCounter.GameServer_InitOK(index, tick)
|
| | | ChPlayer.LoadMapOK(index, tick)
|
| | | GameServerRefresh.GameSever_PlayerInitOK(index, tick)
|
| | | return ''
|
| | |
|
| | |
|
| | |
|
| | |
|