| | |
| | | return
|
| | | if not dataMsg:
|
| | | return
|
| | | sendMsg = str({"MsgType":msgType, "Data":dataMsg, "ServerGroupID":GameWorld.GetServerGroupID()})
|
| | | sendMsg = json.dumps({"MsgType":msgType, "Data":dataMsg, "ServerGroupID":GameWorld.GetServerGroupID()}, ensure_ascii=False)
|
| | | 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 = eval(recvMsg)
|
| | | msgDict = json.loads(recvMsg)
|
| | |
|
| | | msgType = msgDict.get("MsgType", -1)
|
| | | msgData = msgDict.get("Data", "")
|
| | |
| | | return
|
| | | if not dataMsg:
|
| | | return
|
| | | sendMsg = str({"MsgType":msgType, "Data":dataMsg})
|
| | | sendMsg = json.dumps({"MsgType":msgType, "Data":dataMsg}, ensure_ascii=False)
|
| | | if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_GameWorldInitOK):
|
| | | GameWorld.ErrLog("跨服服务器未启动好,不允许向子服发送数据! serverGroupIDList=%s, sendMsg=%s" % (serverGroupIDList, sendMsg))
|
| | | return
|
| | |
| | | GameWorld.Log("服务器未启动好,不处理跨服信息!")
|
| | | return
|
| | |
|
| | | msgDict = eval(dataMsg)
|
| | | msgDict = json.loads(dataMsg)
|
| | | msgType = msgDict.get("MsgType", -1)
|
| | | msgData = msgDict.get("Data", "")
|
| | |
|
| | |
| | | import operator
|
| | | import random
|
| | | import time
|
| | | import json
|
| | |
|
| | | class CrossPKPlayer():
|
| | | ## 跨服PK玩家类
|
| | |
| | | overInfoData.OverType = overType
|
| | | overInfoData.PlayerID = playerID
|
| | | overInfoData.WinnerID = winnerID
|
| | | overInfoData.RoundWinnerInfo = str(roundWinnerIDList)
|
| | | overInfoData.RoundWinnerInfo = json.dumps(roundWinnerIDList, ensure_ascii=False)
|
| | | overInfoData.RoundWinnerLen = len(overInfoData.RoundWinnerInfo)
|
| | | overInfoData.PKScore = pkScore
|
| | | overInfoData.DanLV = danLV
|
| | |
| | | winnerID = overInfoData.WinnerID
|
| | | roundWinnerIDList = []
|
| | | try:
|
| | | roundWinnerIDList = eval(overInfoData.RoundWinnerInfo)
|
| | | roundWinnerIDList = json.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
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | #年月日时间格式
|
| | |
| | | recMapID = universalRecData.GetValue1()
|
| | | if recMapID == mapID:
|
| | | findRecData = universalRecData
|
| | | fbOpenRecord[recMapID] = eval(universalRecData.GetStrValue1())
|
| | | fbOpenRecord[recMapID] = json.loads(universalRecData.GetStrValue1())
|
| | |
|
| | | if not findRecData:
|
| | | findRecData = recTypeListData.AddRec()
|
| | | findRecData.SetValue1(mapID)
|
| | | findRecData.SetStrValue1(str([curDayStr]))
|
| | | findRecData.SetStrValue1(json.dumps([curDayStr], ensure_ascii=False))
|
| | | fbOpenRecord[mapID] = [curDayStr]
|
| | | else:
|
| | | recordList = eval(findRecData.GetStrValue1())
|
| | | recordList = json.loads(findRecData.GetStrValue1())
|
| | | if curDayStr not in recordList:
|
| | | recordList.append(curDayStr)
|
| | | if len(recordList) > 3: #只存最近3次
|
| | | del recordList[0]
|
| | | findRecData.SetStrValue1(str(recordList))
|
| | | findRecData.SetStrValue1(json.dumps(recordList, ensure_ascii=False))
|
| | | fbOpenRecord[mapID] = recordList
|
| | | else:
|
| | | return
|
| | |
| | | for index in range(recTypeListData.Count()):
|
| | | universalRecData = recTypeListData.At(index)
|
| | | recMapID = universalRecData.GetValue1()
|
| | | recordList = eval(universalRecData.GetStrValue1())
|
| | | recordList = json.loads(universalRecData.GetStrValue1())
|
| | | fbOpenRecord[recMapID] = recordList
|
| | | return fbOpenRecord
|
| | |
|
| | |
| | | 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()
|
| | |
|
| | | return pos
|
| | |
|
| | |
| | |
|
| | | import random
|
| | | import copy
|
| | |
|
| | | import json
|
| | |
|
| | | '''
|
| | | 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 eval(recData.GetStrValue3()) # 解散的家族ID列表 [familyID, ...]
|
| | | def SetBatRecDissolutionID(recData, dissFamilyIDList): return recData.SetStrValue3(str(dissFamilyIDList))
|
| | | 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))
|
| | |
|
| | | ''' 王者仙盟
|
| | | value1 家族ID
|
| | |
| | | import PlayerControl
|
| | | import IPY_GameServer
|
| | | import DataRecordPack
|
| | | import json
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | ## 设置玩家家族行为
|
| | |
| | | # @return None
|
| | | def MapServer_PlayerFamilyActionNote(curPlayer, actionType, actionData, tick):
|
| | |
|
| | | actionDataList = eval(actionData)
|
| | | actionDataList = json.loads(actionData)
|
| | |
|
| | | familyId = curPlayer.GetFamilyID()
|
| | |
|
| | |
| | | import copy
|
| | | import PlayerViewCache
|
| | | import PlayerTeam
|
| | | import json
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | |
| | | #玩家的数据没有缓存过
|
| | | PlayerControl.NotifyCode(curPlayer, 'Friend_OffLine')
|
| | | return
|
| | | cacheDict = eval(curCache.GetPropData())
|
| | | cacheDict = json.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 = eval(curCache.GetPropData())
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | PlayerControl.NotifyCode(curPlayer, 'Friend_MakeFriend', [cacheDict['Name']])
|
| | | # 记录等对方上线通知地图,任务等会用到触发逻辑,通用记录次数即可, MapServer_SyncFriendInfo为具体的好友数量,根据策划需求制作
|
| | | pass
|
| | |
| | | curCache = PlayerViewCache.ViewCacheMgr.FindCache(tagID)
|
| | | if not curCache:
|
| | | return
|
| | | cacheDict = eval(curCache.GetPropData())
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | playerName = cacheDict['Name']
|
| | | else:
|
| | | playerName = tagPlayer.GetName()
|
| | |
| | | if curPlayer and not PlayerControl.GetIsTJG(curPlayer):
|
| | | continue
|
| | |
|
| | | recordDict = eval(bossAttentionData.RecordData)
|
| | | if recordDict.get(bossID, 0) in [0, 9]:
|
| | | recordDict = json.loads(bossAttentionData.RecordData)
|
| | | if recordDict.get(str(bossID), 0) in [0, 9]:
|
| | | #0-默认未关注, 1-主动关注, 2-自动关注, 9-主动取消关注
|
| | | continue
|
| | | curCache = PlayerViewCache.ViewCacheMgr.FindCache(playerID)
|
| | | if not curCache:
|
| | | continue
|
| | | cacheDict = eval(curCache.GetPropData())
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | if not CheckCanGeTui(cacheDict, geTuiType):
|
| | | # 过滤个推
|
| | | continue
|
| | |
| | | if not curCache:
|
| | | return
|
| | |
|
| | | cacheDict = eval(curCache.GetPropData())
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | if not CheckCanGeTui(cacheDict, Def_Onoff_Chat):
|
| | | # 过滤个推
|
| | | return
|
| | |
| | | import IpyGameDataPY
|
| | | import PlayerViewCache
|
| | | import PyGameData
|
| | |
|
| | | import json
|
| | | #--------------------社交圈基本结构-------------------
|
| | | # 社交圈
|
| | | class SocialPlayers(object):
|
| | |
| | | playerSocial.RealmLV = 1
|
| | | playerSocial.OnlineType = ChConfig.Def_Offline
|
| | | else:
|
| | | cacheDict = eval(curCache.GetPropData())
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | |
|
| | | playerSocial.clear()
|
| | | playerSocial.PlayerID = playerID
|
| | |
| | | import CrossRealmMsg
|
| | | import ChNetSendPack
|
| | | import NetPackCommon
|
| | | import json
|
| | | import PlayerGeTui
|
| | | import re
|
| | |
|
| | |
| | | return
|
| | |
|
| | | if curCache:
|
| | | cacheDict = eval(curCache.GetPropData())
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | | tagPlayerName = cacheDict["Name"]
|
| | |
|
| | | talkType = sendPack.GetTalkType()
|
| | |
| | |
|
| | | # 同步更新助战信息
|
| | | if PlayerFBHelpBattle.IsInHelpBattleCheckInList(PlayerID):
|
| | | PropDataDict = eval(PropData)
|
| | | PropDataDict = json.loads(PropData)
|
| | | fightPower = PropDataDict.get("FightPower", 0)
|
| | | familyID = PropDataDict.get("FamilyID", 0)
|
| | | playerName = PropDataDict.get("Name", "")
|
| | |
| | | return
|
| | |
|
| | | playerEquipList = []
|
| | | equipItemList = eval(itemData)
|
| | | equipItemList = json.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 = eval(curCache.GetPropData())
|
| | | cacheDict = json.loads(curCache.GetPropData())
|
| | |
|
| | | answerPack.PlayerID = clientPack.PlayerID
|
| | | answerPack.PlayerName = cacheDict["Name"]
|
| | |
| | | curCache = ViewCacheMgr.FindCache(playerID)
|
| | | if not curCache:
|
| | | return
|
| | | PropData = eval(curCache.GetPropData())
|
| | | PropData = json.loads(curCache.GetPropData())
|
| | | PropData["FamilyID"] = familyID
|
| | | PropData["FamilyName"] = familyName
|
| | | playerLV = PropData["LV"]
|
| | |
| | | import GameFuncComm
|
| | | import PlayerTJG
|
| | | import IpyGameDataPY
|
| | | import json
|
| | |
|
| | | import time
|
| | | import random
|
| | |
| | | return
|
| | |
|
| | | #请求记录申请进入家族信息
|
| | | sendMsg = str([familyID, curPlayer.GetFightPower()])
|
| | | sendMsg = json.dumps([familyID, curPlayer.GetFightPower()])
|
| | | curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_AddFamilyAction,
|
| | | ShareDefine.Def_ActionType_FamilyAdd, '', sendMsg, len(sendMsg))
|
| | |
|
| | |
| | | ## 添加家族事件记录
|
| | | def AddFamilyEventNote(curPlayer, eventType, valueList):
|
| | | ##同步记录到GameServer, eventType默认为value1
|
| | | sendMsg = str([eventType] + valueList)
|
| | | sendMsg = json.dumps([eventType] + valueList, ensure_ascii=False)
|
| | | curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_AddFamilyAction, ShareDefine.Def_ActionType_FamilyEvent, '', sendMsg, len(sendMsg))
|
| | | GameWorld.DebugLog("AddFamilyEventNote sendMsg=%s" % sendMsg)
|
| | | return
|