| | |
| | | import PyGameData
|
| | | import urllib
|
| | | import md5
|
| | | import uuid
|
| | | #---------------------------------------------------------------------
|
| | | #设置允许的最大迭代数目, 默认1000
|
| | | #在NPCAI中, 可能超过1000, 所以要设定为2000
|
| | |
| | | return False
|
| | | #if not curPlayer.GetInitOK():
|
| | | # return False
|
| | | #if IsTJGPlayer(curPlayer):
|
| | | # return False
|
| | | if IsMirrorPlayer(curPlayer):
|
| | | return False
|
| | | return True
|
| | |
| | | # @return 返回值. 时间Data格式
|
| | | # @remarks 获得服务器系统时间
|
| | | def GetCurrentTime():
|
| | | return datetime.datetime.today()
|
| | | def GetServerTime():
|
| | | return datetime.datetime.today()
|
| | | # ctime = GetGameWorld().GetGameServerEventTime()
|
| | | #
|
| | |
| | | if npcObj == IPY_GameWorld.gnotSummon:
|
| | | return GetNPCManager().FindSummonNPCByID(curTagNPC.GetID())
|
| | |
|
| | | elif npcObj == IPY_GameWorld.gnotTruck:
|
| | | return GetNPCManager().FindTruckByID(curTagNPC.GetID())
|
| | | |
| | | elif npcObj == IPY_GameWorld.gnotPet:
|
| | | return GetNPCManager().FindPetByID(curTagNPC.GetID())
|
| | |
|
| | |
| | | ## 获取服务器ID所属主服ID
|
| | | ServerIDMainServerDict = IpyGameDataPY.GetConfigEx("ServerIDMainServerDict")
|
| | | if ServerIDMainServerDict == None:
|
| | | filePath = ChConfig.GetDBPath() + ("\\MixServerMap_%s.json" % GetPlatform())
|
| | | filePath = ChConfig.GetServerConfigPath() + ("\\MixServerMap_%s.json" % GetPlatform())
|
| | | if not os.path.isfile(filePath):
|
| | | SendGameErrorEx("GetMainServerIDError", "file can not found. %s" % filePath)
|
| | | else:
|
| | |
| | | # @return
|
| | | def GetPlatform():
|
| | | return ReadChConfig.GetPyMongoConfig("platform", "PlatformName")
|
| | |
|
| | | def IsTestPlatform(platform): return platform in ["test", "yun"]
|
| | |
|
| | | #===============================================================================
|
| | | # ##获得当前服务器ID
|
| | |
| | | return mainServerID
|
| | | return 0
|
| | |
|
| | | def GetDBPlayerAccIDByID(playerID):
|
| | | ## 获取玩家表账号ID - 根据玩家ID, 可用于判断是否本服玩家
|
| | | return PyGameData.g_dbPlayerIDMap.get(playerID, "")
|
| | |
|
| | | #===============================================================================
|
| | | # ƽ̨ID = appid
|
| | |
| | |
|
| | | ChannelCodeDict = ReadChConfig.GetEvalChConfig("ChannelCode")
|
| | | return ChannelCodeDict.get(codeNum, "")
|
| | |
|
| | | def GetGUID(): return str(uuid.uuid1())
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ##大额度金钱记录
|
| | |
| | | # return
|
| | | #===========================================================================
|
| | |
|
| | | DebugLog(text)
|
| | | DebugLog(text, curPlayer.GetPlayerID())
|
| | | text = text.decode(ShareDefine.Def_Game_Character_Encoding).encode(GetCharacterEncoding())
|
| | | curPlayer.DebugAnswer(text)
|
| | | return
|
| | |
| | |
|
| | | def SendGameErrorEx(errType, msgInfo="", playerID=0):
|
| | | ErrLog("SendGameErrorEx: %s -> %s" % (errType, msgInfo), playerID)
|
| | | SendGameError(errType, msgInfo)
|
| | | if GetGameWorld().GetDebugLevel():
|
| | | raise Exception("%s -> %s" % (errType, msgInfo))
|
| | | else:
|
| | | SendGameError(errType, msgInfo)
|
| | | return
|
| | |
|
| | | def SendGameError(errType, msgInfo=""):
|