|  |  |  | 
|---|
|  |  |  | # @change: "2014-12-23 15:30" xmnathan GameServer增加根据LineNO发送Py自定义包接口 | 
|---|
|  |  |  | # @change: "2015-10-22 23:00" hxp 增加Recv_MergerChildToCenter | 
|---|
|  |  |  | #------------------------------------------------------------------------------- | 
|---|
|  |  |  | """Version = 2015-10-22 23:00""" | 
|---|
|  |  |  | #"""Version = 2015-10-22 23:00""" | 
|---|
|  |  |  | #------------------------------------------------------------------------------- | 
|---|
|  |  |  | #---导入--- | 
|---|
|  |  |  | import IPY_GameServer | 
|---|
|  |  |  | 
|---|
|  |  |  | import traceback | 
|---|
|  |  |  | import ChMapToGamePyPack | 
|---|
|  |  |  | import CrossRealmMsg | 
|---|
|  |  |  | import PlayerControl | 
|---|
|  |  |  | #------------------------------------------------------------------------------- | 
|---|
|  |  |  | #---全局变量--- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | curPackHeadRegDict["CallFunc"](index, curPackData, tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | except Exception: | 
|---|
|  |  |  | Log("python自定义封包解析失败~~~~~\r\n%s" % traceback.format_exc()) | 
|---|
|  |  |  | if GameWorld.GetGameWorld().GetDebugLevel(): | 
|---|
|  |  |  | raise Exception("python自定义封包解析失败~~~~~\r\n%s" % traceback.format_exc()) | 
|---|
|  |  |  | GameWorld.RaiseException("python自定义封包解析失败\r\n%s" % traceback.format_exc()) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | innerPackData = clientPack.GetBuffer() | 
|---|
|  |  |  | curPlayer.Sync_GeneralPack(len(innerPackData), innerPackData) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def SendPackByPlayer(clientPack, curPlayer=None): | 
|---|
|  |  |  | ## 发送封包,当curPlayer为None时则发送全服玩家 | 
|---|
|  |  |  | if not curPlayer: | 
|---|
|  |  |  | # 全服广播在线玩家 | 
|---|
|  |  |  | playerManager = GameWorld.GetPlayerManager() | 
|---|
|  |  |  | for i in xrange(playerManager.GetActivePlayerCount()): | 
|---|
|  |  |  | curPlayer = playerManager.GetActivePlayerAt(i) | 
|---|
|  |  |  | if curPlayer == None: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | if PlayerControl.GetIsTJG(curPlayer): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | SendFakePack(curPlayer, clientPack) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | if PlayerControl.GetIsTJG(curPlayer): | 
|---|
|  |  |  | return | 
|---|
|  |  |  | SendFakePack(curPlayer, clientPack) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------------------------------- | 
|---|
|  |  |  | #---Py封包注册信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | curPackHeadRegDict["CallFunc"](routeIndex, mapID, curPackData, tick) | 
|---|
|  |  |  | #Log("RecvMapPyPack: CallFunc curPackHead = %s"%curPackHead) | 
|---|
|  |  |  | except Exception: | 
|---|
|  |  |  | Log("RecvMapPyPack python自定义封包解析失败~~~~~\r\n%s" % traceback.format_exc()) | 
|---|
|  |  |  | if GameWorld.GetGameWorld().GetDebugLevel(): | 
|---|
|  |  |  | raise Exception("RecGamePyPack python自定义封包解析失败~~~~~\r\n%s" % traceback.format_exc()) | 
|---|
|  |  |  | GameWorld.RaiseException("RecvMapPyPack python自定义封包解析失败\r\n%s" % traceback.format_exc()) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------------------------------- | 
|---|