| | |
| | | import random
|
| | | import json
|
| | | import math
|
| | | import cPickle
|
| | |
|
| | | RecType = ShareDefine.Def_UniversalGameRecType_XMZZStageRecord
|
| | | RecType1 = ShareDefine.Def_UniversalGameRecType_XMZZPKInfoRecord
|
| | |
| | | curCache = PlayerViewCache.ViewCacheMgr.FindCache(pkPlayerID)
|
| | | if not curCache:
|
| | | return
|
| | | PropData, ItemData = curCache.GetPropData(), curCache.GetItemData()
|
| | |
|
| | | packData = ChPyNetSendPack.tagGCXMZZFightInfo()
|
| | | packData.Clear()
|
| | | packData.PlayerID = pkPlayerID
|
| | | packData.PropData = PropData
|
| | | packData.PropData = json.dumps(cPickle.loads(curCache.GetPropData()), ensure_ascii=False)
|
| | | packData.PropDataSize = len(packData.PropData)
|
| | | packData.ItemData = ItemData
|
| | | packData.ItemData = json.dumps(cPickle.loads(PlayerViewCache.GetItemData(curCache)), ensure_ascii=False)
|
| | | packData.ItemDataSize = len(packData.ItemData)
|
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return
|
| | |
| | | #已匹配过的跳过
|
| | | continue
|
| | |
|
| | | propDataDict = cPickle.loads(curCache.GetPropData())
|
| | | itemDataDict = cPickle.loads(itemData)
|
| | | if playerID in g_playerPowerDict:
|
| | | power = g_playerPowerDict[playerID]
|
| | | else:
|
| | | propDataDict = eval(curCache.GetPropData())
|
| | | power = propDataDict.get('FightPower', 0)
|
| | | g_playerPowerDict[playerID] = power
|
| | |
|
| | | pkDataDict[playerID] = [curCache.GetPropData(), curCache.GetItemData()]
|
| | | pkDataDict[playerID] = [propDataDict, itemDataDict]
|
| | | #GameWorld.DebugLog(' 筛选对手 playerID=%s,power=%s' % (playerID, power))
|
| | | if minPower1 < power < myPower:
|
| | | underList1.append(playerID)
|
| | |
| | | if isRobotNPC:
|
| | | #机器人, 职业随机
|
| | | openJob = IpyGameDataPY.GetFuncEvalCfg("OpenJob")
|
| | | PropData = str({"Job":random.choice(openJob), "LV":curPlayer.GetLV()})
|
| | | ItemData = "" # 前端自己根据职业及NPC等级处理
|
| | | PropData = {"Job":random.choice(openJob), "LV":curPlayer.GetLV()}
|
| | | ItemData = {} # 前端自己根据职业及NPC等级处理
|
| | | else:
|
| | | if myPlayerID in g_historyPKDict:
|
| | | g_historyPKDict[myPlayerID].append(pkPlayerID)
|
| | | else:
|
| | | g_historyPKDict[myPlayerID] = [pkPlayerID]
|
| | |
|
| | | PropData, ItemData = pkDataDict.get(pkPlayerID, ["", ""])
|
| | | PropData, ItemData = pkDataDict.get(pkPlayerID, [{}, {}])
|
| | | XMZZManager.vsPlayerIDDict[myPlayerID] = pkPlayerID
|
| | |
|
| | | GameWorld.DebugLog(' 仙魔之争匹配对手信息 pkPlayerID=%s, PropData=%s, overInfo=%s' % (pkPlayerID, PropData, overInfo), myPlayerID)
|
| | |
| | | packData = ChPyNetSendPack.tagGCXMZZFightInfo()
|
| | | packData.Clear()
|
| | | packData.PlayerID = pkPlayerID
|
| | | packData.PropData = PropData
|
| | | packData.PropData = json.dumps(PropData, ensure_ascii=False)
|
| | | packData.PropDataSize = len(packData.PropData)
|
| | | packData.ItemData = ItemData
|
| | | packData.ItemData = json.dumps(ItemData, ensure_ascii=False)
|
| | | packData.ItemDataSize = len(packData.ItemData)
|
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | |
|
| | | #通知地图
|
| | | pkPlayerPropData = {}
|
| | | if PropData:
|
| | | pkPlayerPropData = eval(PropData)
|
| | | pkPlayerPropData = PropData
|
| | | else:
|
| | | GameWorld.ErrLog("仙魔之争没有匹配到对手信息!fightPower=%s" % curPlayer.GetFightPower(), myPlayerID)
|
| | | vsPlayerInfo = [pkPlayerID, pkPlayerPropData]
|