| | |
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | | import PyGameData
|
| | | import cPickle
|
| | | import json
|
| | | # 获取玩家跨服服务器上的名字
|
| | | #===============================================================================
|
| | | # def GetCrossPlayerName(curPlayer):
|
| | |
| | |
|
| | | return opName.decode('gbk').encode(GameWorld.GetCharacterEncoding()) + playerName
|
| | |
|
| | | def GetCrossCommZoneIpyDataByZoneID(zoneID):
|
| | | ## 获取跨服常规分区 |
| | | def GetCrossZoneIpyDataByZoneID(mapID, zoneID):
|
| | | ## 获取跨服分区
|
| | | zoneTypeName = ChConfig.Def_CrossZoneTypeName.get(mapID, "CrossZoneComm")
|
| | | crossZoneName = GameWorld.GetCrossZoneName()
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog("CrossZoneComm", crossZoneName, zoneID)
|
| | | return ipyData
|
| | | return IpyGameDataPY.GetIpyGameData(zoneTypeName, crossZoneName, zoneID)
|
| | |
|
| | | def GetCrossCommZoneIpyDataByServerGroupID(serverGroupID):
|
| | | ## 获取跨服常规分区
|
| | | def GetCrossZoneIpyDataByServerGroupID(mapID, serverGroupID):
|
| | | ## 获取跨服分区
|
| | | zoneTypeName = ChConfig.Def_CrossZoneTypeName.get(mapID, "CrossZoneComm")
|
| | | crossZoneName = GameWorld.GetCrossZoneName()
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition("CrossZoneComm", {"CrossZoneName":crossZoneName}, True)
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition(zoneTypeName, {"CrossZoneName":crossZoneName}, True)
|
| | | if not ipyDataList:
|
| | | return
|
| | | for ipyData in ipyDataList:
|
| | |
| | | if (isinstance(serverGroupIDInfo, tuple) and serverGroupIDInfo[0] <= serverGroupID <= serverGroupIDInfo[1]) \
|
| | | or (isinstance(serverGroupIDInfo, int) and serverGroupIDInfo == serverGroupID):
|
| | | return ipyData
|
| | | GameWorld.ErrLog("没有找到跨服玩法对应分区! mapID=%s, serverGroupID=%s, zoneTypeName=%s" % (mapID, serverGroupID, zoneTypeName))
|
| | | return
|
| | |
|
| | | def GetCrossCommZoneIpyDataListByServerGroupID(serverGroupID):
|
| | | def GetCrossZoneIpyDataListByServerGroupID(mapID, serverGroupID):
|
| | | ## 获取跨服常规分区列表
|
| | | if serverGroupID:
|
| | | ipyData = GetCrossCommZoneIpyDataByServerGroupID(serverGroupID)
|
| | | ipyData = GetCrossZoneIpyDataByServerGroupID(mapID, serverGroupID)
|
| | | if not ipyData:
|
| | | return
|
| | | ipyDataList = [ipyData]
|
| | | else:
|
| | | crossZoneName = GameWorld.GetCrossZoneName()
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition("CrossZoneComm", {"CrossZoneName":crossZoneName}, True)
|
| | | zoneTypeName = ChConfig.Def_CrossZoneTypeName.get(mapID, "CrossZoneComm")
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition(zoneTypeName, {"CrossZoneName":crossZoneName}, True)
|
| | | return ipyDataList
|
| | |
|
| | | def GetServerCrossZoneMapIpyData(mapID, serverGroupID=0):
|
| | |
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | | serverGroupID = GameWorld.GetServerGroupID()
|
| | | zoneIpyData = GetCrossCommZoneIpyDataByServerGroupID(serverGroupID)
|
| | | zoneIpyData = GetCrossZoneIpyDataByServerGroupID(mapID, serverGroupID)
|
| | | if not zoneIpyData:
|
| | | return
|
| | | commZoneID = zoneIpyData.GetZoneID()
|
| | | return IpyGameDataPY.GetIpyGameDataByCondition(tableName, {"ZoneID":commZoneID})
|
| | | zoneID = zoneIpyData.GetZoneID()
|
| | | return IpyGameDataPY.GetIpyGameDataByCondition(tableName, {"ZoneID":zoneID})
|
| | |
|
| | | def IsCrossServerOpen():
|
| | | ## 跨服服务器是否开放中
|
| | |
| | | PlayerControl.SetCrossMapID(curPlayer, 0)
|
| | | return
|
| | |
|
| | | def SendCrossRealmReg(curPlayer, registerMap, mapID=0, dataMapID=0, copyMapID=0, posX=0, posY=0):
|
| | | def SendCrossRealmReg(curPlayer, registerMap, mapID=0, dataMapID=0, copyMapID=0, posX=0, posY=0, lineID=0):
|
| | | # 发送跨服账号注册上传数据
|
| | |
|
| | | # 设置上传数据的活动类型
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_CrossRegisterMap, registerMap)
|
| | | sysMsg = str([registerMap, mapID, dataMapID, copyMapID, posX, posY])
|
| | | sysMsg = str([registerMap, mapID, dataMapID, copyMapID, posX, posY, lineID])
|
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, "CrossRealmReg", sysMsg, len(sysMsg))
|
| | | GameWorld.Log("SendCrossRealmReg registerMap=%s,mapID=%s,dataMapID=%s,copyMapID=%s,posX=%s,posY=%s"
|
| | | % (registerMap, mapID, dataMapID, copyMapID, posX, posY), curPlayer.GetPlayerID())
|
| | |
| | | GameWorld.DebugLog("查看跨服玩家,是本服玩家,直接回复!tagPlayerID=%s" % (tagPlayerID), playerID)
|
| | | sendPack = ChPyNetSendPack.tagSCQueryPlayerCacheResult()
|
| | | sendPack.PlayerID = tagPlayerID
|
| | | sendPack.PropData = json.dumps(cPickle.loads(curCache.GetPropData()), ensure_ascii=False)
|
| | | sendPack.PropData = curCache.GetPropData()
|
| | | sendPack.PropDataSize = len(sendPack.PropData)
|
| | | sendPack.ItemData = json.dumps(cPickle.loads(PlayerViewCache.GetItemData(curCache)), ensure_ascii=False)
|
| | | sendPack.ItemData = PlayerViewCache.GetItemData(curCache)
|
| | | sendPack.ItemDataSize = len(sendPack.ItemData)
|
| | | sendPack.PlusData = json.dumps(cPickle.loads(PlayerViewCache.GetPlusData(curCache)), ensure_ascii=False)
|
| | | sendPack.PlusData = PlayerViewCache.GetPlusData(curCache)
|
| | | sendPack.PlusDataSize = len(sendPack.PlusData)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
| | | PropData, ItemData, PlusData = cacheInfo
|
| | | sendPack = ChPyNetSendPack.tagSCQueryPlayerCacheResult()
|
| | | sendPack.PlayerID = tagPlayerID
|
| | | sendPack.PropData = json.dumps(cPickle.loads(PropData), ensure_ascii=False)
|
| | | sendPack.PropData = PropData
|
| | | sendPack.PropDataSize = len(sendPack.PropData)
|
| | | sendPack.ItemData = json.dumps(cPickle.loads(ItemData), ensure_ascii=False)
|
| | | sendPack.ItemData = ItemData
|
| | | sendPack.ItemDataSize = len(sendPack.ItemData)
|
| | | sendPack.PlusData = json.dumps(cPickle.loads(PlusData), ensure_ascii=False)
|
| | | sendPack.PlusData = PlusData
|
| | | sendPack.PlusDataSize = len(sendPack.PlusData)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
| | | # 离线的话直接发邮件
|
| | | GameWorld.Log("收到跨服获得物品,玩家不在线,直接发邮件! itemInfo=%s" % str(itemInfo), playerID)
|
| | | itemID, itemCount, isBind, itemUserData = itemData
|
| | | addItemList = [{"ItemID":itemID, "Count":itemCount, "IsBind":isBind, "UserData":itemUserData}]
|
| | | addItemList = [{"ItemID":itemID, "Count":itemCount, "IsAuctionItem":isBind, "UserData":itemUserData}]
|
| | | PlayerCompensation.SendMailByKey("", [playerID], addItemList, detail={"CrossPutInItem":1, "Event":event})
|
| | | return
|
| | |
|