xdh
2019-04-18 d6bf998381c0aed3ed46940493fc6b39c05f5a28
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianTower.py
@@ -29,7 +29,7 @@
import ItemCommon
import ChConfig
import ChPlayer
import PlayerSuccess
import PlayerActLogin
import GameWorldProcess
import PlayerBillboard
import EventReport
@@ -49,7 +49,7 @@
FBDict_BossTotalHP = 'FBDict_BossTotalHP'  #BOSS血量
FBDict_LastHurtTick = 'FBDict_LastHurtTick'  #上次伤害时间
FBDict_HasGiveAward = 'FBDict_HasGiveAward'  # 是否有给奖励
FBDict_HasAddCnt = 'FBDict_HasAddCnt'  # 是否有扣次数
FBDict_HasPass = 'FBDict_HasPass'  # 是否有通关
# 副本通用配置
(
@@ -88,6 +88,7 @@
    ttInfo = ChPyNetSendPack.tagMCZhuXianTowerInfo()
    ttInfo.Clear()
    ttInfo.Floor = __GetZhuXianTowerCurPassLV(curPlayer)
    ttInfo.LastFloor = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ZhuXianTowerLastFloor)
    NetPackCommon.SendFakePack(curPlayer, ttInfo)
    return
@@ -98,11 +99,11 @@
## 更新当前已通关关卡
def SetZhuXianTowerCurPassLV(curPlayer, passlv):
def SetZhuXianTowerCurPassLV(curPlayer, passlv, costSeconds=0):
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ZhuXianTowerPassLV, passlv)
    #PlayerRune.DoUnlockRuneHole(curPlayer)
    #PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Tower, passlv, False)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ZhuXianTowerCostTime, costSeconds)
    #更新诛仙塔排行榜
    PlayerBillboard.UpdateZhuXianTowerBillboard(curPlayer)
    GameWorld.DebugLog(' 更新诛仙塔已通关数 %s' % passlv)
    return
@@ -133,9 +134,13 @@
    
##玩家切换地图
def DoPlayerChangeMapLogic(curPlayer):
    curStar = GameWorld.GetGameFB().GetGameFBDictByKey(FBDict_FBStar)
    if curStar != Def_MaxStar:
        FBCommon.UpdateFBEnterTick(curPlayer)
    gameFB = GameWorld.GetGameFB()
    fbStep = gameFB.GetFBStep()
    curStar = gameFB.GetGameFBDictByKey(FBDict_FBStar)
    hasPass = gameFB.GetGameFBDictByKey(FBDict_HasPass)
    if fbStep == FB_State_FreeTime: #失败或非S通关需要加cd
        if curStar != Def_MaxStar or not hasPass:
            FBCommon.UpdateFBEnterTick(curPlayer)
    return
##副本玩家进入点
@@ -198,7 +203,8 @@
    if fbStep == FB_State_FreeTime:
        #退出时,若s级则补发奖励
        curStar = gameFB.GetGameFBDictByKey(FBDict_FBStar)
        if curStar == Def_MaxStar:
        hasPass = gameFB.GetGameFBDictByKey(FBDict_HasPass)
        if hasPass and curStar == Def_MaxStar:
            __GiveFBPassPrize(curPlayer)
        GameWorldProcess.CloseFB(tick)
    return
@@ -331,12 +337,18 @@
    gameFB.SetGameFBDict(FBDict_HasGiveAward, 0)
    gameFB.SetGameFBDict(FBDict_StartTick, 0)
    gameFB.SetGameFBDict(FBDict_FBStar, 0)
    gameFB.SetGameFBDict(FBDict_HasPass, 0)
    
    prepareTick = __GetZhuXianCfg()[Def_PrepareTime] * 1000
    FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttAddUpTime, prepareTick)
    FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttWaitStart, prepareTick)
    FBCommon.SetFBStep(FB_State_FightPrepare, tick)
    lastFloor = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ZhuXianTowerLastFloor)
    if fbLevel != lastFloor:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ZhuXianTowerLastFloor, fbLevel)
        SyncZhuXianLevelInfo(curPlayer) # 同步信息
    DoFBHelp(curPlayer, tick)
    GameWorld.DebugLog("StartFBLevel, fbLevel=%s,totalHP=%s" % (fbLevel, totalHP), curPlayer.GetPlayerID())
    return
@@ -410,9 +422,8 @@
    isFirstS = 0
    if fbLevel != __GetZhuXianTowerCurPassLV(curPlayer) and curStar == Def_MaxStar:
        #更新关卡
        SetZhuXianTowerCurPassLV(curPlayer, fbLevel)
        #更新诛仙塔排行榜
        PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_ZhuXianTower, fbLevel, 10000-costTime/1000)
        SetZhuXianTowerCurPassLV(curPlayer, fbLevel, costTime/1000)
        isFirstS = 1  #是否首次S通关
    gameFB.SetGameFBDict(FBDict_isFirstS, isFirstS)
    
@@ -468,25 +479,20 @@
    if gameFB.GetGameFBDictByKey(FBDict_HasGiveAward):
        GameWorld.Log('本层奖励已给,不能重复给!!', curPlayer.GetID())
        return
    hasPass = gameFB.GetGameFBDictByKey(FBDict_HasPass)
    if not hasPass:
        return
    
    # 发邮件或放入背包
    needSpace = len(prizeItemList)
    emptySpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
    isSendMail = int(needSpace > emptySpace)  # 是否发送邮件
    if isSendMail:
        PlayerControl.SendMailByKey('KillGodTowerReward', [curPlayer.GetPlayerID()], prizeItemList)
        GameWorld.DebugLog("背包空间不够,发送邮件: mailItemList=%s" % str(prizeItemList), curPlayer.GetPlayerID())
    else:
        for itemID, itemCnt, isBind in prizeItemList:
            ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem],
                                            event=["ZhuXianTower", False, {}])
    #本次副本里第一次给奖励时扣次数(非首次S也扣次数)
    if (not isFirstPass and curStar == Def_MaxStar) or not gameFB.GetGameFBDictByKey(FBDict_HasAddCnt):
    ItemControler.GivePlayerItemOrMail(curPlayer, prizeItemList, 'KillGodTowerReward', ["ZhuXianTower", False, {}])
    #首次S级不扣次数,非S级给奖励扣次数,非首次S扣次数
    if not isFirstPass:
        FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_ZhuXianTower, 1)
        gameFB.SetGameFBDict(FBDict_HasAddCnt, 1)
        
    gameFB.SetGameFBDict(FBDict_HasGiveAward, 1)
    PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_ZhuXianTower, 1)
    return
@@ -504,7 +510,7 @@
    remainHP = GetBossRemainHP(tick)
    totalHP = __GetBossTotalHP()
    hpReduceSpeed = curSpeed * 10000 / totalHP if totalHP else 0
    remainHPPer = min(100, remainHP * 100 / totalHP) if totalHP else 0
    remainHPPer = min(1000000, remainHP * 1000000 / totalHP) if totalHP else 0
    fbLevel = gameFB.GetGameFBDictByKey(FBDict_Level)
    fbHelpDict = {FBCommon.Help_wheel:fbLevel, FBCommon.Help_grade:star, 'hpReduceSpeed':hpReduceSpeed, 'remainHPPer':remainHPPer, 'isReduceing':isReduceing}
    GameWorld.DebugLog("DoFBHelp: %s" % fbHelpDict, curPlayer.GetPlayerID())
@@ -520,6 +526,7 @@
    overDict[FBCommon.Over_isPass] = int(isPass)
    GameWorld.DebugLog("__SendZhuXianTowerOverInfo overDict=%s" % (str(overDict)), curPlayer.GetPlayerID())
    FBCommon.Notify_FB_Over(curPlayer, overDict)
    GameWorld.GetGameFB().SetGameFBDict(FBDict_HasPass, int(isPass))
    return