6328 【后端】优化代码eval - json只适合字符串序列化,并且尽量用于非中文;建议使用cPickle 的dumps 和loads,协议用2,可支持所有类型,缺点为序列化后不可阅读
| | |
| | | import GMShell
|
| | |
|
| | | import traceback
|
| | | import json
|
| | | import cPickle
|
| | |
|
| | | def SendMsgToCrossServer(msgType, dataMsg):
|
| | | ## 发送信息到跨服服务器上
|
| | |
| | | return
|
| | | if not dataMsg:
|
| | | return
|
| | | sendMsg = json.dumps({"MsgType":msgType, "Data":dataMsg, "ServerGroupID":GameWorld.GetServerGroupID()}, ensure_ascii=False)
|
| | | |
| | | # 协议要用最高级2,可减少长度
|
| | | sendMsg = cPickle.dumps({"MsgType":msgType, "Data":dataMsg, "ServerGroupID":GameWorld.GetServerGroupID()}, 2)
|
| | | if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_GameWorldInitOK):
|
| | | GameWorld.ErrLog("服务器未启动好,不允许向跨服服务器发送数据! %s" % (sendMsg))
|
| | | return
|
| | |
| | | if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_GameWorldInitOK):
|
| | | GameWorld.Log("服务器未启动好,不处理子服信息!")
|
| | | return
|
| | | msgDict = json.loads(recvMsg)
|
| | | msgDict = cPickle.loads(recvMsg)
|
| | |
|
| | | msgType = msgDict.get("MsgType", -1)
|
| | | msgData = msgDict.get("Data", "")
|
| | |
| | | return
|
| | | if not dataMsg:
|
| | | return
|
| | | sendMsg = json.dumps({"MsgType":msgType, "Data":dataMsg}, ensure_ascii=False)
|
| | | sendMsg = cPickle.dumps({"MsgType":msgType, "Data":dataMsg}, 2)
|
| | | if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_GameWorldInitOK):
|
| | | GameWorld.ErrLog("跨服服务器未启动好,不允许向子服发送数据! serverGroupIDList=%s, sendMsg=%s" % (serverGroupIDList, sendMsg))
|
| | | return
|
| | |
| | | serverGroupIDList = list(set(serverGroupIDList)) # 去重
|
| | | #for serverGroupID in serverGroupIDList:
|
| | | # GameWorld.GetGameWorld().SendMergeMsgToClientByGroupID(serverGroupID, sendMsg)
|
| | | jsonGroupIDInfo = json.dumps(serverGroupIDList, ensure_ascii=False)
|
| | | jsonGroupIDInfo = cPickle.dumps(serverGroupIDList, 2)
|
| | | GameWorld.GetGameWorld().SendMergeMsgToClientByGroupList(jsonGroupIDInfo, sendMsg)
|
| | | return
|
| | |
|
| | |
| | | GameWorld.Log("服务器未启动好,不处理跨服信息!")
|
| | | return
|
| | |
|
| | | msgDict = json.loads(dataMsg)
|
| | | msgDict = cPickle.loads(dataMsg)
|
| | | msgType = msgDict.get("MsgType", -1)
|
| | | msgData = msgDict.get("Data", "")
|
| | |
|
| | |
| | | import operator
|
| | | import random
|
| | | import time
|
| | | import json
|
| | | import cPickle
|
| | |
|
| | | class CrossPKPlayer():
|
| | | ## 跨服PK玩家类
|
| | |
| | | overInfoData.OverType = overType
|
| | | overInfoData.PlayerID = playerID
|
| | | overInfoData.WinnerID = winnerID
|
| | | overInfoData.RoundWinnerInfo = json.dumps(roundWinnerIDList, ensure_ascii=False)
|
| | | overInfoData.RoundWinnerInfo = cPickle.dumps(roundWinnerIDList, 2)
|
| | | overInfoData.RoundWinnerLen = len(overInfoData.RoundWinnerInfo)
|
| | | overInfoData.PKScore = pkScore
|
| | | overInfoData.DanLV = danLV
|
| | |
| | | winnerID = overInfoData.WinnerID
|
| | | roundWinnerIDList = []
|
| | | try:
|
| | | roundWinnerIDList = json.loads(overInfoData.RoundWinnerInfo)
|
| | | roundWinnerIDList = cPickle.loads(overInfoData.RoundWinnerInfo)
|
| | | except:
|
| | | GameWorld.ErrLog("__OnLoginNotifyPKOverInfo roundWinnerIDList eval error! RoundWinnerInfo=%s" % overInfoData.RoundWinnerInfo, playerID)
|
| | | pkScore = overInfoData.PKScore
|
| | |
| | |
|
| | | from types import IntType
|
| | | import time
|
| | | import json
|
| | | import cPickle
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | #年月日时间格式
|
| | |
| | | recMapID = universalRecData.GetValue1()
|
| | | if recMapID == mapID:
|
| | | findRecData = universalRecData
|
| | | fbOpenRecord[recMapID] = json.loads(universalRecData.GetStrValue1())
|
| | | fbOpenRecord[recMapID] = cPickle.loads(universalRecData.GetStrValue1())
|
| | |
|
| | | if not findRecData:
|
| | | findRecData = recTypeListData.AddRec()
|
| | | findRecData.SetValue1(mapID)
|
| | | findRecData.SetStrValue1(json.dumps([curDayStr], ensure_ascii=False))
|
| | | findRecData.SetStrValue1(cPickle.dumps([curDayStr], 2))
|
| | | fbOpenRecord[mapID] = [curDayStr]
|
| | | else:
|
| | | recordList = json.loads(findRecData.GetStrValue1())
|
| | | recordList = cPickle.loads(findRecData.GetStrValue1())
|
| | | if curDayStr not in recordList:
|
| | | recordList.append(curDayStr)
|
| | | if len(recordList) > 3: #只存最近3次
|
| | | del recordList[0]
|
| | | findRecData.SetStrValue1(json.dumps(recordList, ensure_ascii=False))
|
| | | findRecData.SetStrValue1(cPickle.dumps(recordList, 2))
|
| | | fbOpenRecord[mapID] = recordList
|
| | | else:
|
| | | return
|
| | |
| | | for index in range(recTypeListData.Count()):
|
| | | universalRecData = recTypeListData.At(index)
|
| | | recMapID = universalRecData.GetValue1()
|
| | | recordList = json.loads(universalRecData.GetStrValue1())
|
| | | recordList = cPickle.loads(universalRecData.GetStrValue1())
|
| | | fbOpenRecord[recMapID] = recordList
|
| | | return fbOpenRecord
|
| | |
|
| | |
| | | import CrossBoss
|
| | |
|
| | | import time
|
| | | import json
|
| | |
|
| | | import cPickle
|
| | |
|
| | | '''
|
| | | ShareDefine.Def_UniversalGameRecType_BossInfo
|
| | |
| | | bossid = str(bossid)
|
| | | if playerid in self.bossAttentionDict:
|
| | | bossAttentionData = self.bossAttentionDict[playerid]
|
| | | recordDict = json.loads(bossAttentionData.RecordData)
|
| | | recordDict = cPickle.loads(bossAttentionData.RecordData)
|
| | | if isAdd:
|
| | | recordDict[bossid] = isAdd
|
| | | else:
|
| | |
| | | self.bossAttentionDict.pop(playerid)
|
| | |
|
| | | else:
|
| | | bossAttentionData.RecordData = json.dumps(recordDict, ensure_ascii=False)
|
| | | bossAttentionData.RecordData = cPickle.dumps(recordDict, 2)
|
| | | bossAttentionData.DataLen = len(bossAttentionData.RecordData)
|
| | | else:
|
| | | if not isAdd:
|
| | |
| | | bossAttention = PyGameDataStruct.tagDBPyBossAttention()
|
| | | bossAttention.clear()
|
| | | bossAttention.PlayerID = playerid
|
| | | bossAttention.RecordData = json.dumps({bossid:isAdd}, ensure_ascii=False)
|
| | | bossAttention.RecordData = cPickle.dumps({bossid:isAdd}, 2)
|
| | | bossAttention.DataLen = len(bossAttention.RecordData)
|
| | | self.bossAttentionDict[playerid] = bossAttention
|
| | |
|
| | |
| | | attentionData = self.bossAttentionDict.get(curPlayer.GetPlayerID())
|
| | | if not attentionData:
|
| | | return
|
| | | bttentionDict = json.loads(attentionData.RecordData)
|
| | | bttentionDict = cPickle.loads(attentionData.RecordData)
|
| | | packData = ChPyNetSendPack.tagGCBossAttentionInfo()
|
| | | packData.BossList = []
|
| | | for bossid, addState in bttentionDict.items():
|
| | |
| | |
|
| | | import random
|
| | | import copy
|
| | | import json
|
| | | import cPickle
|
| | |
|
| | | '''
|
| | | 1. 仙盟改名
|
| | |
| | | def SetBatRecFamilyNameA(recData, familyNameA): return recData.SetStrValue1(familyNameA)
|
| | | def GetBatRecFamilyNameB(recData): return recData.GetStrValue2()
|
| | | def SetBatRecFamilyNameB(recData, familyNameB): return recData.SetStrValue2(familyNameB)
|
| | | def GetBatRecDissolutionID(recData): return [] if not recData.GetStrValue3() else json.loads(recData.GetStrValue3()) # 解散的家族ID列表 [familyID, ...]
|
| | | def SetBatRecDissolutionID(recData, dissFamilyIDList): return recData.SetStrValue3(json.dumps(dissFamilyIDList, ensure_ascii=False))
|
| | | def GetBatRecDissolutionID(recData): return [] if not recData.GetStrValue3() else cPickle.loads(recData.GetStrValue3()) # 解散的家族ID列表 [familyID, ...]
|
| | | def SetBatRecDissolutionID(recData, dissFamilyIDList): return recData.SetStrValue3(cPickle.dumps(dissFamilyIDList, 2))
|
| | |
|
| | | ''' 王者仙盟
|
| | | value1 家族ID
|
| | |
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | | import PyGameData
|
| | |
|
| | | import cPickle
|
| | | import json
|
| | | # 获取玩家跨服服务器上的名字
|
| | | #===============================================================================
|
| | | # def GetCrossPlayerName(curPlayer):
|
| | |
| | | GameWorld.DebugLog("查看跨服玩家,是本服玩家,直接回复!tagPlayerID=%s" % (tagPlayerID), playerID)
|
| | | sendPack = ChPyNetSendPack.tagSCQueryPlayerCacheResult()
|
| | | sendPack.PlayerID = tagPlayerID
|
| | | sendPack.PropData = curCache.GetPropData()
|
| | | sendPack.PropData = json.dumps(cPickle.loads(curCache.GetPropData()), ensure_ascii=False)
|
| | | sendPack.PropDataSize = len(sendPack.PropData)
|
| | | sendPack.ItemData = PlayerViewCache.GetItemData(curCache)
|
| | | sendPack.ItemData = json.dumps(cPickle.loads(PlayerViewCache.GetItemData(curCache)), ensure_ascii=False)
|
| | | sendPack.ItemDataSize = len(sendPack.ItemData)
|
| | | sendPack.PlusData = PlayerViewCache.GetPlusData(curCache)
|
| | | sendPack.PlusData = json.dumps(cPickle.loads(PlayerViewCache.GetPlusData(curCache)), ensure_ascii=False)
|
| | | sendPack.PlusDataSize = len(sendPack.PlusData)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
| | | PropData, ItemData, PlusData = cacheInfo
|
| | | sendPack = ChPyNetSendPack.tagSCQueryPlayerCacheResult()
|
| | | sendPack.PlayerID = tagPlayerID
|
| | | sendPack.PropData = PropData
|
| | | sendPack.PropData = json.dumps(cPickle.loads(PropData), ensure_ascii=False)
|
| | | sendPack.PropDataSize = len(sendPack.PropData)
|
| | | sendPack.ItemData = ItemData
|
| | | sendPack.ItemData = json.dumps(cPickle.loads(ItemData), ensure_ascii=False)
|
| | | sendPack.ItemDataSize = len(sendPack.ItemData)
|
| | | sendPack.PlusData = PlusData
|
| | | sendPack.PlusData = json.dumps(cPickle.loads(PlusData), ensure_ascii=False)
|
| | | sendPack.PlusDataSize = len(sendPack.PlusData)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
| | | import IPY_GameServer
|
| | | import ReadChConfig
|
| | | import base64
|
| | | import json
|
| | | import cPickle
|
| | |
|
| | | #[isBase64, gbk]
|
| | | EncodingList = ReadChConfig.GetEvalChConfig("EncodingTex")
|
| | |
| | | sendDict, callFunc, extendValueList = g_dbCommandList.pop(0)
|
| | |
|
| | | #0:不返回,1:DB返回信息到GameServer
|
| | | GameWorld.GetGameWorld().SendDBOper(1, json.dumps(sendDict, ensure_ascii=False))
|
| | | GameWorld.GetGameWorld().SendDBOper(1, cPickle.dumps(sendDict, 2))
|
| | | GameWorld.Log("send dbcommand:%s"%sendDict)
|
| | |
|
| | | g_proccessCmdInfo = [callFunc, extendValueList]
|
| | |
| | | import PlayerControl
|
| | | import IPY_GameServer
|
| | | import DataRecordPack
|
| | | import json
|
| | | import cPickle
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | ## 设置玩家家族行为
|
| | |
| | | # @return None
|
| | | def MapServer_PlayerFamilyActionNote(curPlayer, actionType, actionData, tick):
|
| | |
|
| | | actionDataList = json.loads(actionData)
|
| | | actionDataList = cPickle.loads(actionData)
|
| | |
|
| | | familyId = curPlayer.GetFamilyID()
|
| | |
|
| | |
| | | import copy
|
| | | import PlayerViewCache
|
| | | import PlayerTeam
|
| | | import json
|
| | | import cPickle
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | |
| | | #玩家的数据没有缓存过
|
| | | PlayerControl.NotifyCode(curPlayer, 'Friend_OffLine')
|
| | | return
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | cacheDict = cPickle.loads(curCache.GetPropData())
|
| | | tagLV = cacheDict["LV"]
|
| | | else:
|
| | | tagLV = tagPlayer.GetLV()
|
| | |
| | | PlayerControl.NotifyCode(srcPlayer, 'Friend_MakeFriend', [curPlayer.GetName()])
|
| | | #srcPlayer.MapServer_QueryPlayerResult(0, 0, 'AddFriendSucceed', "", 0)
|
| | | else:
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | cacheDict = cPickle.loads(curCache.GetPropData())
|
| | | PlayerControl.NotifyCode(curPlayer, 'Friend_MakeFriend', [cacheDict['Name']])
|
| | | # 记录等对方上线通知地图,任务等会用到触发逻辑,通用记录次数即可, MapServer_SyncFriendInfo为具体的好友数量,根据策划需求制作
|
| | | pass
|
| | |
| | | curCache = PlayerViewCache.ViewCacheMgr.FindCache(tagID)
|
| | | if not curCache:
|
| | | return
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | cacheDict = cPickle.loads(curCache.GetPropData())
|
| | | playerName = cacheDict['Name']
|
| | | else:
|
| | | playerName = tagPlayer.GetName()
|
| | |
| | | import PyDataManager
|
| | | import time
|
| | | import json
|
| | | import cPickle
|
| | | # VIP权限
|
| | | Def_Onoff_VIPCount = 5
|
| | | (
|
| | |
| | | if curPlayer and not PlayerControl.GetIsTJG(curPlayer):
|
| | | continue
|
| | |
|
| | | recordDict = json.loads(bossAttentionData.RecordData)
|
| | | if recordDict.get(str(bossID), 0) in [0, 9]:
|
| | | recordDict = cPickle.loads(bossAttentionData.RecordData)
|
| | | if recordDict.get(bossID, 0) in [0, 9]:
|
| | | #0-默认未关注, 1-主动关注, 2-自动关注, 9-主动取消关注
|
| | | continue
|
| | | curCache = PlayerViewCache.ViewCacheMgr.FindCache(playerID)
|
| | | if not curCache:
|
| | | continue
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | cacheDict = cPickle.loads(curCache.GetPropData())
|
| | | if not CheckCanGeTui(cacheDict, geTuiType):
|
| | | # 过滤个推
|
| | | continue
|
| | |
| | | if not curCache:
|
| | | return
|
| | |
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | cacheDict = cPickle.loads(curCache.GetPropData())
|
| | | if not CheckCanGeTui(cacheDict, Def_Onoff_Chat):
|
| | | # 过滤个推
|
| | | return
|
| | |
| | | import IpyGameDataPY
|
| | | import PlayerViewCache
|
| | | import PyGameData
|
| | | import json
|
| | | import cPickle
|
| | | #--------------------社交圈基本结构-------------------
|
| | | # 社交圈
|
| | | class SocialPlayers(object):
|
| | |
| | | playerSocial.RealmLV = 1
|
| | | playerSocial.OnlineType = ChConfig.Def_Offline
|
| | | else:
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | cacheDict = cPickle.loads(curCache.GetPropData())
|
| | |
|
| | | playerSocial.clear()
|
| | | playerSocial.PlayerID = playerID
|
| | |
| | | import CrossRealmMsg
|
| | | import ChNetSendPack
|
| | | import NetPackCommon
|
| | | import json
|
| | | import cPickle
|
| | | import PlayerGeTui
|
| | | import re
|
| | |
|
| | |
| | | return
|
| | |
|
| | | if curCache:
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | cacheDict = cPickle.loads(curCache.GetPropData())
|
| | | tagPlayerName = cacheDict["Name"]
|
| | |
|
| | | talkType = sendPack.GetTalkType()
|
| | |
| | | import ChConfig
|
| | |
|
| | | import time
|
| | | import cPickle
|
| | | import json
|
| | |
|
| | | ViewCacheMgr = GameWorld.GameWorldData.GetPlayerViewCacheMgr()
|
| | |
| | |
|
| | | # 同步更新助战信息
|
| | | if PlayerFBHelpBattle.IsInHelpBattleCheckInList(PlayerID):
|
| | | PropDataDict = json.loads(PropData)
|
| | | PropDataDict = cPickle.loads(PropData)
|
| | | fightPower = PropDataDict.get("FightPower", 0)
|
| | | familyID = PropDataDict.get("FamilyID", 0)
|
| | | playerName = PropDataDict.get("Name", "")
|
| | |
| | | sendPack.PlusDataSize = len(sendPack.PlusData)
|
| | | else:
|
| | | #成功回包 缓存数据
|
| | | sendPack.PropData = curCache.GetPropData()
|
| | | sendPack.PropData = json.dumps(cPickle.loads(curCache.GetPropData()), ensure_ascii=False)
|
| | | sendPack.PropDataSize = len(sendPack.PropData)
|
| | | sendPack.ItemData = GetItemData(curCache)
|
| | | sendPack.ItemData = json.dumps(cPickle.loads(GetItemData(curCache)), ensure_ascii=False)
|
| | | sendPack.ItemDataSize = len(sendPack.ItemData)
|
| | | sendPack.PlusData = GetPlusData(curCache)
|
| | | sendPack.PlusData = json.dumps(cPickle.loads(GetPlusData(curCache)), ensure_ascii=False)
|
| | | sendPack.PlusDataSize = len(sendPack.PlusData)
|
| | |
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | |
| | | return
|
| | |
|
| | | playerEquipList = []
|
| | | equipItemList = json.loads(itemData)
|
| | | equipItemList = cPickle.loads(itemData)
|
| | | for equipItemDict in equipItemList:
|
| | | equipIndex = equipItemDict["ItemIndex"]
|
| | | if equipIndex not in ShareDefine.RoleEquipType:
|
| | |
| | | answerPack.OnlineType = ChConfig.Def_Offline
|
| | | answerPack.ServerGroupID = 0
|
| | | else:
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | cacheDict = cPickle.loads(curCache.GetPropData())
|
| | |
|
| | | answerPack.PlayerID = clientPack.PlayerID
|
| | | answerPack.PlayerName = cacheDict["Name"]
|
| | |
| | | curCache = ViewCacheMgr.FindCache(playerID)
|
| | | if not curCache:
|
| | | return
|
| | | PropData = json.loads(curCache.GetPropData())
|
| | | PropData = cPickle.loads(curCache.GetPropData())
|
| | | PropData["FamilyID"] = familyID
|
| | | PropData["FamilyName"] = familyName
|
| | | playerLV = PropData["LV"]
|
| | |
|
| | | PropData = json.dumps(PropData, ensure_ascii=False)
|
| | | ItemData = curCache.GetItemData()
|
| | | PlusData = curCache.GetPlusData()
|
| | | PropData = cPickle.dumps(PropData, 2)
|
| | | ItemData = GetItemData(curCache)
|
| | | PlusData = GetPlusData(curCache)
|
| | | UpdatePlayerCache(playerID, PropData, ItemData, PlusData, True if playerLV > 150 else False)
|
| | | return
|
| | |
|
| | |
| | | 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]
|
| | |
| | | import GameFuncComm
|
| | | import PlayerTJG
|
| | | import IpyGameDataPY
|
| | | import json
|
| | | import cPickle
|
| | |
|
| | | import time
|
| | | import random
|
| | |
| | | return
|
| | |
|
| | | #请求记录申请进入家族信息
|
| | | sendMsg = json.dumps([familyID, curPlayer.GetFightPower()])
|
| | | sendMsg = cPickle.dumps([familyID, curPlayer.GetFightPower()], 2)
|
| | | curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_AddFamilyAction,
|
| | | ShareDefine.Def_ActionType_FamilyAdd, '', sendMsg, len(sendMsg))
|
| | |
|
| | |
| | | ## 添加家族事件记录
|
| | | def AddFamilyEventNote(curPlayer, eventType, valueList):
|
| | | ##同步记录到GameServer, eventType默认为value1
|
| | | sendMsg = json.dumps([eventType] + valueList, ensure_ascii=False)
|
| | | sendMsg = cPickle.dumps([eventType] + valueList, 2)
|
| | | curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_AddFamilyAction, ShareDefine.Def_ActionType_FamilyEvent, '', sendMsg, len(sendMsg))
|
| | | GameWorld.DebugLog("AddFamilyEventNote sendMsg=%s" % sendMsg)
|
| | | return
|
| | |
| | | import BossHurtMng
|
| | |
|
| | | import time
|
| | | import json
|
| | | import cPickle
|
| | |
|
| | | Def_Process_Tick = "ProcessPlayerCache"
|
| | | ##玩家下线同步
|
| | |
| | | curPlayerPlusDict["Fruit"] = PlayerAttrFruit.GetAttrFruitEatCntDict(curPlayer)
|
| | |
|
| | | #-----------
|
| | | curPlayerPropData = json.dumps(curPlayerPropDict, ensure_ascii=False)
|
| | | curPlayerItemData = json.dumps(curEquipItemList, ensure_ascii=False)
|
| | | curPlayerPlusData = json.dumps(__RemoveEmptyDataKey(curPlayerPlusDict), ensure_ascii=False)
|
| | | curPlayerPropData = cPickle.dumps(curPlayerPropDict, 2)
|
| | | curPlayerItemData = cPickle.dumps(curEquipItemList, 2)
|
| | | curPlayerPlusData = cPickle.dumps(__RemoveEmptyDataKey(curPlayerPlusDict), 2)
|
| | | return (curPlayerPropData, curPlayerItemData, curPlayerPlusData)
|
| | |
|
| | | def __RemoveEmptyDataKey(dataDict):
|
| | |
| | | funcName = ''
|
| | | try:
|
| | | # 获得gm命令信息
|
| | | gmCmdDict = json.loads(cmd) |
| | | gmCmdDict = eval(cmd) |
| | | funcName = gmCmdDict.get(GMCommon.Def_GMKey_Type, '')
|
| | |
|
| | | if funcName == None:
|