#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
#-------------------------------------------------------------------------------
|
#
|
##@package GameWorldLogic.FBProcess.GameLogic_SkyTower
|
#
|
# @todo:ÌìÐÇËþ
|
# @author xdh
|
# @date 2019-05-09
|
# @version 1.0
|
# ÏêϸÃèÊö: ÌìÐÇËþ
|
#
|
#---------------------------------------------------------------------
|
#"""Version = 2019-05-09 11:00"""
|
#---------------------------------------------------------------------
|
|
import FBCommon
|
import GameWorld
|
import IPY_GameWorld
|
import PlayerControl
|
import NPCCustomRefresh
|
import ChPyNetSendPack
|
import ItemControler
|
import EventShell
|
import NetPackCommon
|
import ShareDefine
|
import IpyGameDataPY
|
import ChConfig
|
import ChPlayer
|
import PlayerActivity
|
import PlayerBillboard
|
import PlayerSuccess
|
import PlayerActTask
|
import GameObj
|
import GameWorldProcess
|
|
FBDict_Level = 'FBDict_Level' # ¸±±¾¹Ø¿¨
|
|
# ¸±±¾Í¨ÓÃÅäÖÃ
|
(
|
Def_PrepareTime, # ÿ¹Ø×¼±¸Ê±¼ä£¬Ãë
|
Def_FightTime, # ÿ¹ØÕ½¶·Ê±¼ä£¬Ãë
|
Def_ExitTime, # Í˳öʱ¼ä, Ãë
|
Def_DayPrizeMaxCnt, #ÿÈÕ½±Àø×î¶àÀÛ»ý¼¸Ì죨Åä0ÔòÎÞÏÞ£©
|
) = range(4)
|
|
# ¸±±¾×´Ì¬
|
(
|
FB_State_Open, # ¸±±¾¿ªÆô
|
FB_State_FightPrepare, # Õ½¶·×¼±¸Ê±¼ä
|
FB_State_Fighting, # Õ½¶·
|
FB_State_FreeTime, # »î¶¯½áÊø×¼±¸£¨Ê¤Àû/ʧ°Ü£©
|
FB_State_Close, # ¹Ø±Õ¸±±¾
|
) = range(5)
|
|
## ÌìÐÇËþÅäÖÃ
|
def __GetTrialCfg(): return FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_SkyTower)
|
|
def GetTowerIpyData(floor):
|
return IpyGameDataPY.GetIpyGameData('SkyTower', floor)
|
|
def OnFBPlayerOnLogin(curPlayer):
|
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, 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.ServerRewardList = serverRewardList
|
ttInfo.ServerRewardCount = len(ttInfo.ServerRewardList)
|
NetPackCommon.SendFakePack(curPlayer, ttInfo)
|
return
|
|
## »ñÈ¡µ±Ç°ÒÑͨ¹Ø¹Ø¿¨
|
def __GetSkyTowerCurFloor(curPlayer):
|
return curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerFloor)
|
|
## ¸üе±Ç°ÒÑͨ¹Ø¹Ø¿¨
|
def SetSkyTowerCurfloorID(curPlayer, floorID):
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_SkyTowerFloor, floorID)
|
|
#ÈÎÎñ
|
EventShell.EventRespons_SkyTowerCnt(curPlayer, floorID)
|
#ͨ¹Ø·ûÓ¡Ëþ³É¾Í
|
PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_PassSkyTower, floorID)
|
GameWorld.DebugLog(' ¸üÐÂÌìÐÇËþÒÑͨ¹ØÊý %s' % floorID)
|
return
|
|
## ÊÇ·ñ¿É½øÈë
|
# @param curPlayer
|
# @param mapID µØÍ¼ID
|
# @param lineId ·ÖÏßID
|
# @param tick
|
# @return ÊÇ·ñ¿É½øÈë
|
def OnEnterFBEvent(curPlayer, mapID, lineId, tick):
|
return True
|
|
|
## ¼ì²é¿É·ñ½øÐÐÌôÕ½
|
def __CheckCanChallenge(curPlayer, floorID):
|
playerID = curPlayer.GetPlayerID()
|
ipyData = GetTowerIpyData(floorID)
|
|
if not ipyData:
|
GameWorld.ErrLog("ÌìÐÇËþ¹Ø¿¨(%s)²»´æÔÚ" % (floorID), playerID)
|
return False
|
|
# ÊÇ·ñÒѹý¹Ø
|
if floorID <= __GetSkyTowerCurFloor(curPlayer):
|
GameWorld.DebugLog("ÌìÐÇËþ±¾¹Ø(%s)Òѹý¹Ø, ÎÞ·¨ÌôÕ½!" % floorID, playerID)
|
return False
|
|
if curPlayer.GetLV() < ipyData.GetNeedLV():
|
GameWorld.DebugLog("ÌìÐÇËþ±¾¹Ø µÈ¼¶²»×ã%s, ÎÞ·¨ÌôÕ½!" % ipyData.GetNeedLV(), playerID)
|
return False
|
|
return True
|
|
|
##¸±±¾Íæ¼Ò½øÈëµã
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param mapID µØÍ¼ID
|
# @param lineId ·ÖÏßID
|
# @param ipyEnterPosInfo ¹¦ÄÜÏß·IPYÅäÖÃ×ø±êÐÅÏ¢
|
# @param tick ʱ¼ä´Á
|
# @return posX, posY, Ëæ»ú°ë¾¶(¿ÉÑ¡)
|
def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick):
|
return ipyEnterPosInfo
|
|
|
## ÊÇ·ñ¿ÉÒÔ½øÈë
|
# @param ask ÇëÇóÐÅÏ¢
|
# @param tick
|
# @return »Ø¸´ÊÇ·ñͨ¹ýÇëÇó
|
def OnChangeMapAsk(ask, tick):
|
return IPY_GameWorld.cmeAccept
|
|
## ½ø¸±±¾
|
# @param curPlayer
|
# @param tick
|
# @return None
|
def DoEnterFB(curPlayer, tick):
|
gameFB = GameWorld.GetGameFB()
|
fbStep = gameFB.GetFBStep()
|
|
if fbStep == FB_State_FightPrepare:
|
notify_tick = __GetTrialCfg()[Def_PrepareTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
|
curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, max(notify_tick, 0), True)
|
|
elif fbStep == FB_State_Fighting:
|
notify_tick = __GetTrialCfg()[Def_FightTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
|
curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, max(notify_tick, 0), True)
|
elif fbStep > FB_State_Fighting:
|
PlayerControl.PlayerLeaveFB(curPlayer)
|
return
|
|
PlayerActTask.AddActTaskValue(curPlayer, ChConfig.ActTaskType_SkyTower)
|
|
# ²»×ö´¦Àí£¬Óи±±¾ÐÐΪ¿Í»§¶Ë·¢°üÑ¡ÔñÌôÕ½¹Ø¿¨
|
#EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_SkyTower, 0, ChConfig.CME_Log_Start)
|
return
|
|
|
## ¸±±¾Ê±¼äµ½¹Ø±Õ
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def OnCloseFB(tick):
|
return
|
|
|
##Íæ¼ÒÍ˳ö¸±±¾.
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param tick ʱ¼ä´Á
|
# @return ·µ»ØÖµÎÞÒâÒå
|
# @remarks Íæ¼ÒÖ÷¶¯À뿪¸±±¾.
|
def DoExitFB(curPlayer, tick):
|
# Íæ¼ÒÍ˳öĬÈϹرո±±¾
|
GameWorldProcess.CloseFB(tick)
|
return
|
|
|
##¸±±¾×ÜÂß¼¼ÆÊ±Æ÷
|
# @param tick ʱ¼ä´Á
|
# @return ÎÞÒâÒå
|
# @remarks ¸±±¾×ÜÂß¼¼ÆÊ±Æ÷
|
def OnProcess(tick):
|
gameFB = GameWorld.GetGameFB()
|
fbStep = gameFB.GetFBStep()
|
|
if fbStep == FB_State_FightPrepare:
|
__DoLogic_FightPrepare(tick)
|
elif fbStep == FB_State_Fighting:
|
__DoLogic_Fighting(tick)
|
elif fbStep == FB_State_FreeTime:
|
__DoLogic_FreeTime(tick)
|
elif fbStep == FB_State_Close:
|
pass
|
|
return
|
|
## »ñÈ¡BossID
|
def __GetSkyTowerBossID(floorID= -1):
|
gameFB = GameWorld.GetGameFB()
|
if floorID == -1:
|
floorID = gameFB.GetGameFBDictByKey(FBDict_Level)
|
ipyData = GetTowerIpyData(floorID)
|
|
if not ipyData:
|
GameWorld.ErrLog("__GetSkyTowerBossID() can not find %s in SkyTowerNPC.txt" % floorID)
|
return 0
|
return ipyData.GetBossID()
|
|
##Õ½¶·×¼±¸Ê±¼ä
|
# @param tick ʱÖÓ
|
# @return ÎÞÒâÒå
|
def __DoLogic_FightPrepare(tick):
|
gameFB = GameWorld.GetGameFB()
|
|
trialCfg = __GetTrialCfg()
|
if tick - gameFB.GetFBStepTick() < trialCfg[Def_PrepareTime] * 1000:
|
return
|
|
bossID = __GetSkyTowerBossID()
|
if not bossID:
|
FBCommon.DoLogic_FBKickAllPlayer()
|
return
|
|
FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttTowerTake, trialCfg[Def_FightTime] * 1000)
|
|
NPCCustomRefresh.SetNPCRefresh(FBCommon.GetFBLineRefreshNPC(ChConfig.Def_FBMapID_SkyTower, 0), [bossID])
|
|
#תÈëÕ½¶·
|
FBCommon.SetFBStep(FB_State_Fighting, tick)
|
return
|
|
## ¿ªÊ¼¸±±¾¹Ø¿¨
|
def StartfloorID(curPlayer, floorID, tick):
|
if curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
|
GameWorld.DebugLog("¸´»îÍæ¼Ò...", curPlayer.GetPlayerID())
|
ChPlayer.PlayerRebornByType(curPlayer, ChConfig.rebornType_City, tick)
|
GameObj.SetHPFull(curPlayer)
|
FBCommon.ClearFBNPC()
|
|
gameFB = GameWorld.GetGameFB()
|
gameFB.SetGameFBDict(FBDict_Level, floorID)
|
|
prepareTick = __GetTrialCfg()[Def_PrepareTime] * 1000
|
|
FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttWaitStart, prepareTick)
|
FBCommon.SetFBStep(FB_State_FightPrepare, tick)
|
helpDict = {FBCommon.Help_wheel:floorID}
|
FBCommon.Notify_FBHelp(curPlayer, helpDict)
|
GameWorld.DebugLog("StartfloorID, floorID=%s, helpDict=%s"
|
% (floorID, str(helpDict)), curPlayer.GetPlayerID())
|
return
|
|
|
##Õ½¶·Ê±¼ä
|
# @param tick ʱÖÓ
|
# @return ÎÞÒâÒå
|
def __DoLogic_Fighting(tick):
|
gameFB = GameWorld.GetGameFB()
|
|
#ÅжÏʱ¼ä½áÊø
|
if tick - gameFB.GetFBStepTick() < __GetTrialCfg()[Def_FightTime] * 1000:
|
return
|
|
floorID = gameFB.GetGameFBDictByKey(FBDict_Level)
|
playerManager = GameWorld.GetMapCopyPlayerManager()
|
for index in xrange(playerManager.GetPlayerCount()):
|
curPlayer = playerManager.GetPlayerByIndex(index)
|
if not curPlayer:
|
continue
|
__SendSkyTowerOverInfo(curPlayer, floorID, False)
|
|
#ÓÎÏ·½áÊø
|
__SetFBToFreeTime(tick)
|
return
|
|
##ÉèÖø±±¾½øÈëÀ뿪״̬
|
# @param tick ʱÖÓ
|
# @return ÎÞÒâÒå
|
def __SetFBToFreeTime(tick):
|
FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttLeaveMap, __GetTrialCfg()[Def_ExitTime] * 1000)
|
FBCommon.SetFBStep(FB_State_FreeTime, tick)
|
return
|
|
##±ÈÈü½áÊøµÄ¿ÕÏÐʱ¼ä
|
# @param tick ʱÖÓ
|
# @return ÎÞÒâÒå
|
# @remarks ±ÈÈü½áÊøµÄ¿ÕÏÐʱ¼ä
|
def __DoLogic_FreeTime(tick):
|
if tick - GameWorld.GetGameFB().GetFBStepTick() < __GetTrialCfg()[Def_ExitTime] * 1000:
|
return
|
|
#FBCommon.DoLogic_FBKickAllPlayer()
|
return
|
|
## ɱ¹Ö
|
# @param curPlayer
|
# @param curNPC ±»É±µÄ¹Ö
|
# @param tick
|
# @return None
|
def DoFB_Player_KillNPC(curPlayer, curNPC, tick):
|
gameFB = GameWorld.GetGameFB()
|
if gameFB.GetFBStep() != FB_State_Fighting:
|
return
|
bossID = __GetSkyTowerBossID()
|
if bossID != curNPC.GetNPCID():
|
return
|
|
|
floorID = gameFB.GetGameFBDictByKey(FBDict_Level)
|
|
# ¹ý¹ØÈ«·þ¹ã²¥
|
ipyData = GetTowerIpyData(floorID)
|
if not ipyData:
|
return
|
|
if ipyData.GetIsNotify():
|
#IPY_Data = IpyGameDataPY.IPY_Data()
|
#maxLevel = IPY_Data.GetRuneTowerByIndex(IPY_Data.GetRuneTowerCount()-1).GetID()
|
sysMark = 'KillGodTowerInfo_1'# if floorID == maxLevel else 'GeRen_liubo_471172'
|
PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetPlayerName(), floorID])
|
#¸üйؿ¨
|
SetSkyTowerCurfloorID(curPlayer, floorID)
|
# ¸ø¹ý¹Ø½±Àø
|
prizeDict = __GiveFBPassPrize(curPlayer, ipyData)
|
# ¹ý¹ØÊ±¼ä
|
costTime = tick - GameWorld.GetGameFB().GetFBStepTick()
|
prizeDict[FBCommon.Over_costTime] = costTime
|
__SendSkyTowerOverInfo(curPlayer, floorID, True, prizeDict)
|
PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_SkyTower)
|
|
SyncSkyTowerInfo(curPlayer, 0) # ͬ²½×îйؿ¨ÐÅÏ¢
|
__SetFBToFreeTime(tick)
|
|
if floorID >= 10:
|
PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_SkyTower, floorID)
|
|
# È«·þÄ¿±ê
|
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()
|
msgInfo = str(["ServerChallengePass", [floorID, maxNeedPassCount, rankRewardInfo]])
|
GameWorld.DebugLog("È«·þ¹ý¹ØÐÅϢͬ²½GameServer: %s" % msgInfo, playerID)
|
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(playerID, 0, 0, "SkyTower", msgInfo, len(msgInfo))
|
|
return
|
|
|
|
## ¸ø¹ý¹Ø½±Àø
|
def __GiveFBPassPrize(curPlayer, ipyData):
|
giveItemDict = ipyData.GetReward()
|
giveItemList = [[itemID, itemCnt, 0] for itemID, itemCnt in giveItemDict.items()]
|
event = ["SKYTower", False, {}]
|
ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList, None, event)
|
|
prizeDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(giveItemList)}
|
return prizeDict
|
|
|
|
## ·¢ËÍÌôÕ½½á¹ûÐÅÏ¢
|
def __SendSkyTowerOverInfo(curPlayer, floorID, isPass, overDict={}):
|
|
overDict[FBCommon.Over_dataMapID] = ChConfig.Def_FBMapID_SkyTower
|
overDict[FBCommon.Over_wheel] = floorID
|
overDict[FBCommon.Over_isPass] = int(isPass)
|
GameWorld.DebugLog("__SendSkyTowerOverInfo overDict=%s" % (str(overDict)), curPlayer.GetPlayerID())
|
FBCommon.Notify_FB_Over(curPlayer, overDict)
|
return
|
|
|
## ¼ì²éÊÇ·ñ¿É¹¥»÷£¬ Ö÷Åж¨²»¿É¹¥»÷µÄÇé¿ö£¬ÆäËûÂß¼ÓÉÍâ²ã¾ö¶¨
|
# @param attacker ¹¥»÷·½
|
# @param defender ·ÀÊØ·½
|
# @return bool
|
def CheckCanAttackTagObjInFB(attacker, defender):
|
gameFB = GameWorld.GetGameFB()
|
if gameFB.GetFBStep() != FB_State_Fighting:
|
return False
|
return True
|
|
##Íæ¼ÒËÀÍö.
|
# @param curPlayer:ËÀÍöµÄÍæ¼Ò
|
# @param tick ʱ¼ä´Á
|
# @return ·µ»ØÖµÎÞÒâÒå
|
# @remarks Íæ¼ÒÖ÷¶¯À뿪¸±±¾.
|
def DoPlayerDead(curPlayer):
|
gameFB = GameWorld.GetGameFB()
|
floorID = gameFB.GetGameFBDictByKey(FBDict_Level)
|
__SendSkyTowerOverInfo(curPlayer, floorID, False)
|
tick = GameWorld.GetGameWorld().GetTick()
|
#ÓÎÏ·½áÊø
|
__SetFBToFreeTime(tick)
|
return
|
|
## ÊÇ·ñ¸±±¾¸´»î
|
# @param None
|
# @return ÊÇ·ñ¸±±¾¸´»î
|
def OnPlayerReborn():
|
return True
|
|
## ¸±±¾ÐÐΪ
|
# @param curPlayer Íæ¼Ò
|
# @param actionType ÐÐΪÀàÐÍ
|
# @param actionInfo ÐÐΪÐÅÏ¢
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
def DoFBAction(curPlayer, actionType, actionInfo, tick):
|
# ĬÈÏΪѡÔñ¹Ø¿¨£¬Óɿͻ§¶Ë¾ö¶¨£¬½ø³¡¼°¸±±¾Ñ¡¹ØÍ¨ÓôËÐÐΪ
|
if actionInfo <= 0:
|
return
|
|
gameFB = GameWorld.GetGameFB()
|
fbStep = gameFB.GetFBStep()
|
|
if fbStep in [FB_State_FightPrepare, FB_State_Fighting]:
|
GameWorld.DebugLog("×¼±¸»òÕ½¶·ÖÐ, ÎÞ·¨±ä¸ü¹Ø¿¨!")
|
return
|
|
floorID = actionInfo
|
if not __CheckCanChallenge(curPlayer, floorID):
|
FBCommon.DoLogic_FBKickAllPlayer()
|
return
|
|
StartfloorID(curPlayer, floorID, tick)
|
return
|
|
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
|
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_SkyTowerServerRecord % floorID)
|
if rewardRecord & pow(2, needPlayerCount):
|
GameWorld.DebugLog("ÌìÐÇËþÈ«·þÌôÕ½²ãÒÑÁì½±!floorID=%s,needPlayerCount=%s,rewardRecord=%s" % (floorID, needPlayerCount, rewardRecord), playerID)
|
return
|
|
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]
|
|
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
|
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.Log("¹ý¹ØÅÅÃû½±ÀøÒÑ·¢·Å¹ý!floorID=%s,recordIndex=%s,rewardRecord=%s" % (floorID, recordIndex, rewardRecord), playerID)
|
return
|
updRewardRecord = rewardRecord | pow(2, recordIndex)
|
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)
|
|
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
|
|
def OnPlayerFBQuickPass(curPlayer, mapID, lineID):
|
'''¸±±¾¿ìËÙ¹ý¹ØÑéÖ¤
|
@param mapID: Êý¾ÝµØÍ¼ID
|
@param lineID: Ä¿±ê¹Ø¿¨Ïß·ID£¬¿ÉÒ»´ÎÐÔÌø¶à¹Ø£¬ÓÉǰ¶Ë·¢°ü¾ö¶¨
|
@return: (bossID, quickCnt) »ò None
|
@note: bossID Ä¿±êNPCID - Ä¿±ê¹Ø¿¨ËùÐèÒªÌôÕ½µÄÖ÷NPCID£¬Ò»°ãÊÇboss£¬ÓÃÓÚÑéÖ¤Õ½Á¦ÊÇ·ñÂú×ã¿ìËÙ¹ý¹Ø
|
@note: quickCnt ±¾´Î×ܹ²Ìø¹ý¼¸¹Ø - ĬÈÏ1
|
'''
|
|
if not __CheckCanChallenge(curPlayer, lineID):
|
return
|
curLineID = __GetSkyTowerCurFloor(curPlayer)
|
bossID = __GetSkyTowerBossID(lineID)
|
quickCnt = lineID - curLineID
|
|
return bossID, quickCnt
|
|
def OnPlayerFBQuickPassResult(curPlayer, mapID, lineID):
|
'''¸±±¾¿ìËÙ¹ý¹Ø½á¹û
|
'''
|
|
playerID = curPlayer.GetPlayerID()
|
curLineID = __GetSkyTowerCurFloor(curPlayer)
|
fromLineID = curLineID + 1
|
GameWorld.DebugLog("´¦Àí¿ìËÙ¹ý¹Ø½áËã: mapID=%s,fromLineID=%s to %s" % (mapID, fromLineID, lineID), playerID)
|
|
itemListTotal = []
|
for floorID in range(fromLineID, lineID + 1):
|
ipyData = GetTowerIpyData(floorID)
|
if not ipyData:
|
continue
|
|
if ipyData.GetIsNotify():
|
sysMark = 'KillGodTowerInfo_1'# if floorID == maxLevel else 'GeRen_liubo_471172'
|
PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetPlayerName(), floorID])
|
|
#¸üйؿ¨
|
SetSkyTowerCurfloorID(curPlayer, floorID)
|
|
#¹ý¹Ø½±Àø
|
giveItemDict = ipyData.GetReward()
|
giveItemList = [[itemID, itemCnt, 0] for itemID, itemCnt in giveItemDict.items()]
|
itemListTotal += giveItemList
|
|
PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_SkyTower)
|
|
# È«·þÄ¿±ê
|
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()
|
msgInfo = str(["ServerChallengePass", [floorID, maxNeedPassCount, rankRewardInfo]])
|
GameWorld.DebugLog("È«·þ¹ý¹ØÐÅϢͬ²½GameServer: %s" % msgInfo, playerID)
|
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(playerID, 0, 0, "SkyTower", msgInfo, len(msgInfo))
|
|
prizeItemList = GameWorld.MergeItemList(itemListTotal)
|
ItemControler.GivePlayerItemOrMail(curPlayer, prizeItemList, None, ["SKYTower", False, {}])
|
|
quickPassDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(prizeItemList), "quickPass":1}
|
__SendSkyTowerOverInfo(curPlayer, floorID, True, quickPassDict)
|
SyncSkyTowerInfo(curPlayer, 0) # ͬ²½×îйؿ¨ÐÅÏ¢
|
if floorID >= 10:
|
PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_SkyTower, floorID)
|
|
return
|