| | |
| | | import CrossBoss
|
| | |
|
| | | import time
|
| | |
|
| | | import json
|
| | |
|
| | |
|
| | | '''
|
| | |
| | | def GetBossAttentionDict(self):
|
| | | return self.bossAttentionDict
|
| | |
|
| | | # RecordData改json记录 bossid存为字符串
|
| | | def UpdateBossAttention(self, playerid, bossid, isAdd):
|
| | | bossid = str(bossid)
|
| | | if playerid in self.bossAttentionDict:
|
| | | bossAttentionData = self.bossAttentionDict[playerid]
|
| | | recordDict = eval(bossAttentionData.RecordData)
|
| | | recordDict = json.loads(bossAttentionData.RecordData)
|
| | | if isAdd:
|
| | | recordDict[bossid] = isAdd
|
| | | else:
|
| | |
| | | self.bossAttentionDict.pop(playerid)
|
| | |
|
| | | else:
|
| | | bossAttentionData.RecordData = str(recordDict)
|
| | | bossAttentionData.RecordData = json.dumps(recordDict, ensure_ascii=False)
|
| | | bossAttentionData.DataLen = len(bossAttentionData.RecordData)
|
| | | else:
|
| | | if not isAdd:
|
| | |
| | | bossAttention = PyGameDataStruct.tagDBPyBossAttention()
|
| | | bossAttention.clear()
|
| | | bossAttention.PlayerID = playerid
|
| | | bossAttention.RecordData = str({bossid:isAdd})
|
| | | bossAttention.RecordData = json.dumps({bossid:isAdd}, ensure_ascii=False)
|
| | | bossAttention.DataLen = len(bossAttention.RecordData)
|
| | | self.bossAttentionDict[playerid] = bossAttention
|
| | |
|
| | |
| | | attentionData = self.bossAttentionDict.get(curPlayer.GetPlayerID())
|
| | | if not attentionData:
|
| | | return
|
| | | bttentionDict = eval(attentionData.RecordData)
|
| | | bttentionDict = json.loads(attentionData.RecordData)
|
| | | packData = ChPyNetSendPack.tagGCBossAttentionInfo()
|
| | | packData.BossList = []
|
| | | for bossid, addState in bttentionDict.items():
|
| | | bossInfo = ChPyNetSendPack.tagGCBossAttention()
|
| | | bossInfo.BossID=bossid
|
| | | bossInfo.BossID=int(bossid)
|
| | | bossInfo.AddState=addState
|
| | | packData.BossList.append(bossInfo)
|
| | |
|
| | |
| | | data.clear()
|
| | | pos += data.readData(datas, pos, dataslen)
|
| | | playerID = data.PlayerID
|
| | | if type(eval(data.RecordData)) != list:
|
| | | self.bossAttentionDict[playerID] = data
|
| | | else:
|
| | | data.clear()
|
| | | self.bossAttentionDict[playerID] = data
|
| | |
|
| | | return pos
|
| | |
|