hxp
2019-02-12 4551dd1308ab484688ca96be2be8b811fd3a23e6
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianTower.py
@@ -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'  # 是否有通关
# 副本通用配置
(
@@ -78,6 +78,28 @@
def OnFBPlayerOnLogin(curPlayer):
    if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_ZXTower):
        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_ZXTower, 1)
        #奖励变更补偿 s级通关奖励里的宝石
        curFloor = __GetZhuXianTowerCurPassLV(curPlayer)
        if curFloor:
            giveItemList = []
            for floor in xrange(1, curFloor+1):
                ipyData = GetTowerIpyData(floor)
                if not ipyData:
                    continue
                for itemInfo in ipyData.GetFirstAward():
                    itemID = itemInfo[0]
                    itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
                    if not itemData:
                        continue
                    if itemData.GetType() == ChConfig.Def_ItemType_ZhuXianStone:
                        giveItemList.append(itemInfo)
            if giveItemList:
                PlayerControl.SendMailByKey('KillGodTowerCompensation', [curPlayer.GetID()], giveItemList)
    SyncZhuXianLevelInfo(curPlayer)
    return
@@ -88,6 +110,7 @@
    ttInfo = ChPyNetSendPack.tagMCZhuXianTowerInfo()
    ttInfo.Clear()
    ttInfo.Floor = __GetZhuXianTowerCurPassLV(curPlayer)
    ttInfo.LastFloor = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ZhuXianTowerLastFloor)
    NetPackCommon.SendFakePack(curPlayer, ttInfo)
    return
@@ -120,21 +143,26 @@
## 检查可否进行挑战
def __CheckCanChallenge(curPlayer):
    #判断次数
    enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % ChConfig.Def_FBMapID_ZhuXianTower)
    if enterCnt >= FBCommon.GetEnterFBMaxCnt(curPlayer, ChConfig.Def_FBMapID_ZhuXianTower):
        GameWorld.Log('进入次数不足!!')
        return 0
    curFloor = __GetZhuXianTowerCurPassLV(curPlayer)
    ipyMgr = IpyGameDataPY.IPY_Data()
    maxFloor = ipyMgr.GetZhuXianTowerByIndex(ipyMgr.GetZhuXianTowerCount() - 1).GetID()
    if curFloor >= maxFloor:
    if curFloor >= maxFloor: #已经最后层时,判断次数
        enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % ChConfig.Def_FBMapID_ZhuXianTower)
        if enterCnt >= FBCommon.GetEnterFBMaxCnt(curPlayer, ChConfig.Def_FBMapID_ZhuXianTower):
            GameWorld.Log('进入次数不足!!')
            return 0
        return maxFloor
    return curFloor + 1
    
##玩家切换地图
def DoPlayerChangeMapLogic(curPlayer):
    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
##副本玩家进入点
@@ -197,7 +225,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
@@ -330,12 +359,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
@@ -402,14 +437,12 @@
        return
    # 记录过关
    #EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_ZhuXianTower, 0, ChConfig.CME_Log_End, 0, 1)
    ipyMgr = IpyGameDataPY.IPY_Data()
    maxFloor = ipyMgr.GetZhuXianTowerByIndex(ipyMgr.GetZhuXianTowerCount() - 1).GetID()
    # 过关时间
    costTime = tick - GameWorld.GetGameFB().GetFBStepTick()
    curStar = gameFB.GetGameFBDictByKey(FBDict_FBStar)
    isFirstS = 0
    if fbLevel < maxFloor and curStar == Def_MaxStar:
    if fbLevel != __GetZhuXianTowerCurPassLV(curPlayer) and curStar == Def_MaxStar:
        #更新关卡
        SetZhuXianTowerCurPassLV(curPlayer, fbLevel)
        #更新诛仙塔排行榜
@@ -469,25 +502,19 @@
    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, {}])
    #本次副本里第一次给奖励时扣次数
    if 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)
    return
@@ -505,7 +532,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())
@@ -521,6 +548,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