| | |
| | | #"""Version = 2024-12-26 17:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import ChConfig
|
| | | import ShareDefine
|
| | | import PyDataManager
|
| | | import PlayerPackData
|
| | | import ReadChConfig
|
| | | import PlayerViewCache
|
| | | import GameWorld
|
| | |
|
| | | import base64
|
| | | import random
|
| | | import PyDataManager
|
| | |
|
| | | ## 执行逻辑
|
| | | # @param curPlayer 当前玩家
|
| | | # @param gmList []
|
| | | # @return None
|
| | | def OnExec(curPlayer, gmList):
|
| | | if not gmList:
|
| | | return
|
| | | value = gmList[0]
|
| | | if value == "a":
|
| | | __addFackPackData(gmList[1:])
|
| | | elif value == "d":
|
| | | __delFackPackData()
|
| | | elif value == "p":
|
| | | __printPackData(gmList[1:])
|
| | | return
|
| | | isSendToDB = True
|
| | | return isSendToDB
|
| | |
|
| | | def OnGetMergeParam(curPlayer):
|
| | | return []
|
| | |
| | | return
|
| | |
|
| | | def __addFackPackData(gmList):
|
| | | ## 添加假的打包数据,一般用于开发测试功能用
|
| | | FakeName = "假名字".decode(ShareDefine.Def_Game_Character_Encoding).encode(GameWorld.GetCharacterEncoding())
|
| | | packDataMgr = PyDataManager.GetDBPlayerPackDataManager()
|
| | | #GameWorld.DebugAnswer(curPlayer, "添加镜像: PlayerMirror a 个数 [起始ID 战力 区服ID 模版key]")
|
| | | ## 添加假的打包数据,一般用于开发测试功能用,打包数据在db添加,GameServer添加查看缓存
|
| | | #GameWorld.DebugAnswer(None, "跨服GameServer玩家查看数据数:%s" % PyDataManager.GetPlayerViewCachePyManager().GetCount())
|
| | | #return
|
| | | addCount = gmList[0] if len(gmList) > 0 else 1
|
| | | startID = gmList[1] if len(gmList) > 1 else 1
|
| | | fightPower = gmList[2] if len(gmList) > 2 else 0
|
| | | serverID = gmList[3] if len(gmList) > 3 else 0
|
| | | packDataTempKey = gmList[4] if len(gmList) > 4 else ""
|
| | | |
| | | jobFackPackDataDict = ReadChConfig.GetEvalChConfig("FackPackData")
|
| | | #packDataTempKey = gmList[4] if len(gmList) > 4 else ""
|
| | |
|
| | | addOKCount = 0
|
| | | for index in range(addCount):
|
| | | fackID = startID + index
|
| | | if packDataMgr.IsPlayerIn(fackID):
|
| | | curCache = PlayerViewCache.FindViewCache(fackID, True)
|
| | | if not curCache:
|
| | | continue
|
| | | propDict = PlayerViewCache.GetCachePropDataDict(curCache)
|
| | |
|
| | | job = random.randint(1, 2)
|
| | | tempKey = packDataTempKey if packDataTempKey else "job%s" % job
|
| | | if tempKey not in jobFackPackDataDict:
|
| | | GameWorld.DebugAnswer(None, "配置FackPackData.txt没有该模版key:%s" % tempKey)
|
| | | return
|
| | | packDataTeam = jobFackPackDataDict[tempKey]
|
| | | packDataTeamBuff = base64.b64decode(packDataTeam)
|
| | | |
| | | tempDBPlayer = PlayerPackData.GetDBPlayerByPackData(packDataTeam)
|
| | | tempDBPlayer.PlayerID = fackID
|
| | | tempDBPlayer.PlayerName = "%s%s" % (FakeName, fackID)
|
| | | curServerID = serverID if serverID else fackID / 100
|
| | | if not curServerID:
|
| | | curServerID = 9999
|
| | | tempDBPlayer.AccID = "fack%s@test@s%s" % (fackID, curServerID)
|
| | | # 没有指定模版,则随机数据
|
| | | if not packDataTempKey:
|
| | | tempDBPlayer.Job = job
|
| | | tempDBPlayer.LV = random.randint(tempDBPlayer.LV, tempDBPlayer.LV + 2)
|
| | | tempDBPlayer.OfficialRank = random.randint(tempDBPlayer.OfficialRank, tempDBPlayer.OfficialRank + 2)
|
| | | if serverID:
|
| | | propDict["AccID"] = "fake%s@test@s%s" % (fackID, serverID)
|
| | |
|
| | | curFightPower = fightPower if fightPower else (tempDBPlayer.FightPowerEx * ChConfig.Def_PerPointValue + tempDBPlayer.FightPower)
|
| | | curFightPower += index
|
| | | tempDBPlayer.FightPower = curFightPower % ChConfig.Def_PerPointValue
|
| | | tempDBPlayer.FightPowerEx = curFightPower / ChConfig.Def_PerPointValue
|
| | | |
| | | updBuff = tempDBPlayer.getBuffer() + packDataTeamBuff[tempDBPlayer.getLength():]
|
| | | updPackData = base64.b64encode(updBuff)
|
| | | packDataMgr.UpdPlayerPackData(fackID, updPackData)
|
| | | if fightPower:
|
| | | propDict["FightPower"] = fightPower + index
|
| | | |
| | | addOKCount += 1
|
| | |
|
| | | packDataMgr.Sort()
|
| | | |
| | | GameWorld.DebugAnswer(None, "添加假玩家打包数据数:%s,总:%s" % (addOKCount, packDataMgr.GetCount()))
|
| | | GameWorld.DebugAnswer(None, "跨服GameServer添加假玩家查看数据数:%s,%s~%s,总:%s" |
| | | % (addOKCount, startID, fackID, PyDataManager.GetPlayerViewCachePyManager().GetCount()))
|
| | | return
|
| | |
|
| | | def __delFackPackData():
|
| | |
|
| | | delCount = 0
|
| | | packDataMgr = PyDataManager.GetDBPlayerPackDataManager()
|
| | | for index in range(packDataMgr.GetCount())[::-1]:
|
| | | packObj = packDataMgr.At(index)
|
| | | if packObj.playerID >= 10000:
|
| | | cacheMgr = PyDataManager.GetPlayerViewCachePyManager()
|
| | | for index in range(cacheMgr.GetCount())[::-1]:
|
| | | viewCache = cacheMgr.At(index)
|
| | | if viewCache.PlayerID >= 10000:
|
| | | continue
|
| | | packDataMgr.DelPlayerPackData(packObj.playerID)
|
| | | cacheMgr.DelPlayerViewCache(viewCache.PlayerID)
|
| | | delCount += 1
|
| | |
|
| | | GameWorld.DebugAnswer(None, "删除假玩家打包数据数:%s,剩:%s" % (delCount, packDataMgr.GetCount()))
|
| | | GameWorld.DebugAnswer(None, "删除假玩家数据数:%s" % delCount)
|
| | | return
|
| | |
|
| | | def __printPackData(gmList):
|
| | | startIndex = gmList[0] if len(gmList) > 0 else 0
|
| | | printCount = gmList[1] if len(gmList) > 1 else 100
|
| | | packDataMgr = PyDataManager.GetDBPlayerPackDataManager()
|
| | | packDataMgr.Sort()
|
| | | dataCount = packDataMgr.GetCount()
|
| | | GameWorld.DebugLog("=== 打包数据总数: dataCount=%s,startIndex=%s" % (dataCount, startIndex))
|
| | | for index in range(startIndex, startIndex + printCount):
|
| | | if index >= dataCount:
|
| | | break
|
| | | packObj = packDataMgr.At(index)
|
| | | playerID = packObj.playerID
|
| | | fightPower = packObj.fightPower
|
| | | serverID = packObj.serverID
|
| | | GameWorld.DebugLog("index=%s,playerID=%s,serverID=%s,fightPower=%s,%s" % (index, playerID, serverID, fightPower, packObj.GetBaseDict()))
|
| | | GameWorld.DebugAnswer(None, "输出完毕详见GameServer日志!总:%s" % (dataCount))
|
| | | GameWorld.DebugAnswer(None, "跨服GameServer缓存条数:%s,打包条数:%s" |
| | | % (PyDataManager.GetPlayerViewCachePyManager().GetCount(), |
| | | PyDataManager.GetDBPlayerPackDataManager().GetCount()
|
| | | ))
|
| | | return
|
| | |
|