| | |
| | | import GameObj
|
| | | import GameWorldProcess
|
| | |
|
| | |
|
| | | g_runeTypeDict = {}
|
| | | FBDict_Level = 'FBDict_Level' # 副本关卡
|
| | |
|
| | |
|
| | | # 副本通用配置
|
| | | (
|
| | |
| | | Def_DayPrizeMaxCnt, #每日奖励最多累积几天(配0则无限)
|
| | | ) = range(4)
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | # 副本状态
|
| | | (
|
| | | FB_State_Open, # 副本开启
|
| | |
| | | FB_State_FreeTime, # 活动结束准备(胜利/失败)
|
| | | FB_State_Close, # 关闭副本
|
| | | ) = range(5)
|
| | |
|
| | |
|
| | | ## 天星塔配置
|
| | | def __GetTrialCfg(): return FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_SkyTower)
|
| | |
| | | SyncSkyTowerInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def OnMixFirstLogin(curPlayer):
|
| | | curFloorID = __GetSkyTowerCurFloor(curPlayer)
|
| | | if not curFloorID:
|
| | | return
|
| | | |
| | | passFloorInfo = {}
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetSkyTowerServerChallengeCount()):
|
| | | ipyDataServer = ipyDataMgr.GetSkyTowerServerChallengeByIndex(index)
|
| | | floorID = ipyDataServer.GetFloorID()
|
| | | if floorID > curFloorID:
|
| | | continue
|
| | | maxNeedPassCount = 0
|
| | | for rank in ipyDataServer.GetPassRankRewardInfo().keys():
|
| | | maxNeedPassCount = max(maxNeedPassCount, int(rank))
|
| | | for needPlayerCount in ipyDataServer.GetServerRewardInfo().keys():
|
| | | maxNeedPassCount = max(maxNeedPassCount, int(needPlayerCount))
|
| | | |
| | | passFloorInfo[floorID] = maxNeedPassCount
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | msgInfo = str(["MixFirstLogin", [passFloorInfo]])
|
| | | GameWorld.Log("天星塔合服首登同步GameServer: %s" % msgInfo, playerID)
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(playerID, 0, 0, "SkyTower", msgInfo, len(msgInfo))
|
| | | return
|
| | |
|
| | | ## 同步天星塔关卡信息
|
| | | # @floorID 为0时默认全部同步,> 0时仅同步该关卡
|
| | | def SyncSkyTowerInfo(curPlayer):
|
| | | def SyncSkyTowerInfo(curPlayer, serverRewardFloor=None, force=False):
|
| | | |
| | | syncFloorIDList = []
|
| | | if serverRewardFloor == None:
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetSkyTowerServerChallengeCount()):
|
| | | ipyDataServer = ipyDataMgr.GetSkyTowerServerChallengeByIndex(index)
|
| | | syncFloorIDList.append(ipyDataServer.GetFloorID())
|
| | | elif serverRewardFloor > 0:
|
| | | syncFloorIDList = [serverRewardFloor]
|
| | | |
| | | serverRewardList = [] |
| | | for floorID in syncFloorIDList:
|
| | | recordValue = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerServerRecord % floorID)
|
| | | if not recordValue and not force:
|
| | | continue
|
| | | serverRewardInfo = ChPyNetSendPack.tagMCSkyTowerServerReward()
|
| | | serverRewardInfo.Floor = floorID
|
| | | serverRewardInfo.ServerRewardRecord = recordValue
|
| | | serverRewardList.append(serverRewardInfo)
|
| | | |
| | | ttInfo = ChPyNetSendPack.tagMCSkyTowerInfo()
|
| | | ttInfo.Clear()
|
| | | ttInfo.Floor = __GetSkyTowerCurFloor(curPlayer)
|
| | | ttInfo.ServerRewardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerChallengeRewardRecord)
|
| | | ttInfo.ServerRewardList = serverRewardList
|
| | | ttInfo.ServerRewardCount = len(ttInfo.ServerRewardList)
|
| | | NetPackCommon.SendFakePack(curPlayer, ttInfo)
|
| | | return
|
| | |
|
| | |
| | | __SendSkyTowerOverInfo(curPlayer, floorID, True, prizeDict)
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_SkyTower)
|
| | |
|
| | | SyncSkyTowerInfo(curPlayer) # 同步最新关卡信息
|
| | | SyncSkyTowerInfo(curPlayer, 0) # 同步最新关卡信息
|
| | | __SetFBToFreeTime(tick)
|
| | |
|
| | | if floorID >= 10:
|
| | |
| | | # 全服目标
|
| | | ipyDataServer = IpyGameDataPY.GetIpyGameDataNotLog("SkyTowerServerChallenge", floorID)
|
| | | if ipyDataServer:
|
| | | maxNeedPassCount = 0
|
| | | rankRewardInfo = ipyDataServer.GetPassRankRewardInfo()
|
| | | for rank in rankRewardInfo.keys():
|
| | | maxNeedPassCount = max(maxNeedPassCount, int(rank))
|
| | | for needPlayerCount in ipyDataServer.GetServerRewardInfo().keys():
|
| | | maxNeedPassCount = max(maxNeedPassCount, int(needPlayerCount))
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | playerName = curPlayer.GetPlayerName()
|
| | | job = curPlayer.GetJob()
|
| | | playerLV = curPlayer.GetLV()
|
| | | realmLV = curPlayer.GetOfficialRank()
|
| | | msgInfo = str(["ServerChallengePass", [floorID, playerID, playerName, job, playerLV, realmLV]])
|
| | | msgInfo = str(["ServerChallengePass", [floorID, maxNeedPassCount, rankRewardInfo]])
|
| | | GameWorld.DebugLog("全服过关信息同步GameServer: %s" % msgInfo, playerID)
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(playerID, 0, 0, "SkyTower", msgInfo, len(msgInfo))
|
| | |
|
| | | return
|
| | |
| | | StartfloorID(curPlayer, floorID, tick)
|
| | | return
|
| | |
|
| | | def OnGetSkyTowerServerChallengeReward(curPlayer, floorID):
|
| | | def OnGetSkyTowerServerChallengeReward(curPlayer, floorID, needPlayerCount):
|
| | | ## 领取全服挑战层奖励
|
| | | needPlayerCount = GameWorld.ToIntDef(needPlayerCount, 1)
|
| | | if needPlayerCount <= 0:
|
| | | # 必须大于0, 0记录排名奖励是否已领取
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("SkyTowerServerChallenge", floorID)
|
| | | if not ipyData:
|
| | | return
|
| | | recordIndex = ipyData.GetRewardRecordIndex()
|
| | | rewardInfo = ipyData.GetReward()
|
| | | rewardInfo = ipyData.GetServerRewardInfo()
|
| | | if str(needPlayerCount) not in rewardInfo:
|
| | | GameWorld.DebugLog("不存在该全服奖励:floorID=%s,needPlayerCount=%s" % (floorID, needPlayerCount), playerID)
|
| | | return
|
| | | giveItemList = rewardInfo[str(needPlayerCount)]
|
| | |
|
| | | rewardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerChallengeRewardRecord)
|
| | | if rewardRecord & pow(2, recordIndex):
|
| | | GameWorld.DebugLog("天星塔全服挑战层已领奖!floorID=%s,recordIndex=%s,rewardRecord=%s" % (floorID, recordIndex, rewardRecord))
|
| | | rewardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerServerRecord % floorID)
|
| | | if rewardRecord & pow(2, needPlayerCount):
|
| | | GameWorld.DebugLog("天星塔全服挑战层已领奖!floorID=%s,needPlayerCount=%s,rewardRecord=%s" % (floorID, needPlayerCount, rewardRecord), playerID)
|
| | | return
|
| | |
|
| | | ipyData.GetRewardRecordIndex()
|
| | | msgInfo = str(["ServerChallengeReward", [floorID, recordIndex, rewardInfo]])
|
| | | msgInfo = str(["ServerChallengeReward", [floorID, needPlayerCount, giveItemList]])
|
| | | GameWorld.DebugLog("天星塔全服挑战层领奖同步GameServer: %s" % msgInfo, playerID)
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(playerID, 0, 0, "SkyTower", msgInfo, len(msgInfo))
|
| | | return
|
| | |
|
| | | def GameServer_SkyTowerInfo(curPlayer, resultList):
|
| | | ## GameServer 返回信息
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | msgType, msgData = resultList[:2]
|
| | |
|
| | | if msgType == "ServerChallengeReward":
|
| | | isPass = resultList[2]
|
| | | floorID, recordIndex, rewardInfo = msgData
|
| | | if not isPass:
|
| | | GameWorld.Log("天星塔GameServer返回: %s" % str(resultList), playerID)
|
| | | if msgType == "ServerChallengePass":
|
| | | floorID, _, rankRewardInfo = msgData
|
| | | rankIndex = resultList[2]
|
| | | if rankIndex < 0:
|
| | | GameWorld.DebugLog("过关全服排名未上榜: floorID=%s,rankIndex=%s" % (floorID, rankIndex), playerID)
|
| | | return
|
| | | |
| | | rewardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerChallengeRewardRecord)
|
| | | rank = rankIndex + 1
|
| | | orderDict = {}
|
| | | for k, v in rankRewardInfo.items():
|
| | | orderDict[int(k)] = v
|
| | | giveItemList = GameWorld.GetOrderValueByDict(orderDict, rank, False)
|
| | | if not giveItemList:
|
| | | GameWorld.DebugLog("该层该名次没有奖励: rank=%s" % rank, playerID)
|
| | | return
|
| | | recordIndex = 0 # 排名奖励默认用0索引位记录
|
| | | rewardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerServerRecord % floorID)
|
| | | if rewardRecord & pow(2, recordIndex):
|
| | | GameWorld.DebugLog("返回时天星塔全服挑战层已领奖!floorID=%s,recordIndex=%s,rewardRecord=%s" % (floorID, recordIndex, rewardRecord))
|
| | | GameWorld.Log("过关排名奖励已发放过!floorID=%s,recordIndex=%s,rewardRecord=%s" % (floorID, recordIndex, rewardRecord), playerID)
|
| | | return
|
| | | updRewardRecord = rewardRecord | pow(2, recordIndex)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_SkyTowerChallengeRewardRecord, updRewardRecord)
|
| | | SyncSkyTowerInfo(curPlayer)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_SkyTowerServerRecord % floorID, updRewardRecord)
|
| | | GameWorld.Log("天星塔发放过关全服排名奖励: floorID=%s,rank=%s,updRewardRecord=%s,giveItemList=%s" |
| | | % (floorID, rank, updRewardRecord, giveItemList), playerID)
|
| | |
|
| | | giveItemList = [[itemID, itemCnt, 0] for itemID, itemCnt in rewardInfo.items()]
|
| | | paramList = [floorID, rank]
|
| | | PlayerControl.SendMailByKey("SkyTowerPassRank", [playerID], giveItemList, paramList)
|
| | | |
| | | elif msgType == "ServerChallengeReward":
|
| | | floorID, needPlayerCount, giveItemList = msgData
|
| | | canGet = resultList[2]
|
| | | if not canGet:
|
| | | GameWorld.DebugLog("返回时天星塔全服挑战层不能领取: floorID=%s,needPlayerCount=%s" % (floorID, needPlayerCount), playerID)
|
| | | return
|
| | | |
| | | rewardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerServerRecord % floorID)
|
| | | if rewardRecord & pow(2, needPlayerCount):
|
| | | GameWorld.DebugLog("返回时天星塔全服挑战层已领奖!floorID=%s,needPlayerCount=%s,rewardRecord=%s" % (floorID, needPlayerCount, rewardRecord), playerID)
|
| | | return
|
| | | updRewardRecord = rewardRecord | pow(2, needPlayerCount)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_SkyTowerServerRecord % floorID, updRewardRecord)
|
| | | |
| | | GameWorld.Log("天星塔发放过关全服奖励: floorID=%s,needPlayerCount=%s,updRewardRecord=%s,giveItemList=%s" |
| | | % (floorID, needPlayerCount, updRewardRecord, giveItemList), playerID)
|
| | | |
| | | event = ["SKYTowerServerChallengeReward", False, {"floorID":floorID}]
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList, None, event)
|
| | | |
| | | SyncSkyTowerInfo(curPlayer, floorID)
|
| | |
|
| | | return
|
| | |
|