| | |
| | | import ChConfig
|
| | | import PlayerControl
|
| | | import PlayerViewCache
|
| | | import PlayerCompensation
|
| | | import ChPyNetSendPack
|
| | | import PlayerDBGSEvent
|
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | | import PyGameData
|
| | |
|
| | | # 获取玩家跨服服务器上的名字
|
| | |
| | | return playerName
|
| | |
|
| | | return opName.decode('gbk').encode(GameWorld.GetCharacterEncoding()) + playerName
|
| | |
|
| | | def GetServerCrossZoneIpyData(mapID, serverGroupID=0):
|
| | | ## 获取本服对应跨服玩法分区地图信息
|
| | | if mapID not in ChConfig.Def_CrossZoneTableName:
|
| | | return
|
| | | if not serverGroupID:
|
| | | serverGroupID = GameWorld.GetServerGroupID()
|
| | | |
| | | tableName = ChConfig.Def_CrossZoneTableName[mapID]
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | if not hasattr(ipyDataMgr, "Get%sCount" % tableName):
|
| | | return
|
| | | |
| | | for i in xrange(getattr(ipyDataMgr, "Get%sCount" % tableName)()):
|
| | | ipyData = getattr(ipyDataMgr, "Get%sByIndex" % tableName)(i)
|
| | | serverGroupIDList = ipyData.GetServerGroupIDList()
|
| | | for serverGroupIDInfo in serverGroupIDList:
|
| | | if (isinstance(serverGroupIDInfo, tuple) and serverGroupIDInfo[0] <= serverGroupID <= serverGroupIDInfo[1]) \
|
| | | or (isinstance(serverGroupIDInfo, int) and serverGroupIDInfo == serverGroupID):
|
| | | return ipyData
|
| | | return
|
| | |
|
| | | def IsCrossServerOpen():
|
| | | ## 跨服服务器是否开放中
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | |
|
| | | def CrossServerMsg_PutInItem(itemInfo):
|
| | | ## 跨服获得物品
|
| | |
|
| | | GameWorld.DebugLog("收到跨服服务器获得物品!")
|
| | | playerID = itemInfo["PlayerID"]
|
| | | itemData = itemInfo["ItemData"]
|
| | | event = itemInfo["Event"]
|
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if curPlayer:
|
| | | # 在线的话推到MapServer处理
|
| | | itemMsg = str(itemInfo)
|
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, "CrossPutInItem", itemMsg, len(itemMsg))
|
| | | return
|
| | | # 离线的话直接发邮件
|
| | | GameWorld.Log("收到跨服获得物品,玩家不在线,直接发邮件! itemInfo=%s" % str(itemInfo), playerID)
|
| | | itemID, itemCount, isBind, itemUserData = itemData
|
| | | addItemList = [{"ItemID":itemID, "Count":itemCount, "IsBind":isBind, "UserData":itemUserData}]
|
| | | PlayerCompensation.SendMailByKey("", [playerID], addItemList, detail={"CrossPutInItem":1, "Event":event})
|
| | | return
|
| | |
|
| | | def CrossServerMsg_GiveMoney(msgInfo):
|
| | | ## 跨服获得货币
|
| | | |
| | | playerID = msgInfo["PlayerID"]
|
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if not curPlayer:
|
| | | GameWorld.ErrLog("跨服获得货币时玩家不在线! msgInfo=%s" % str(msgInfo), playerID)
|
| | | return
|
| | | msgInfo = str(msgInfo)
|
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, "CrossGiveMoney", msgInfo, len(msgInfo))
|
| | | return
|
| | |
|
| | |
|
| | | |