xdh
2019-04-13 10a2b69436a1ebb09fa49a339655e150bfda70a8
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py
@@ -36,23 +36,25 @@
FBPlayerDict_EncourageLV = 'FBPlayerDict_EncourageLV'  # 鼓舞等级
FBDict_IsOver = 'FBDict_IsOver'  #是否已结算, 结算时的tick
FBDict_IsReduceing = 'FBDict_IsReduceing'  #是否掉血中
FBPlayerDict_Rank = "FBPlayerDict_Rank"  # 玩家排名
FBDict_BossTotalHP = 'FBDict_BossTotalHP'  #BOSS血量
FBDict_LastHurtTick = 'FBDict_LastHurtTick'  #上次伤害时间
FBDict_IsEncourage = 'FBDict_IsEncourage'  #是否鼓舞过
FBDict_LastHPNotify = 'FBDict_LastHPNotify'  #上一个血量广播
(
    Def_BossTime, #BOSS时间
    Def_LeaveTime,#离开时间
    ) = range(2)
    Def_BossTime,  #BOSS时间
    Def_LeaveTime,  #离开时间
    Def_HPSpeed,  #掉血速度公式
    ) = range(3)
#当前副本地图的状态
(
FB_Step_Open, # 副本开启
FB_Step_Fighting, # 副本进行中
FB_Step_Over, # 副本结束
FB_Step_Close, # 副本关闭
FB_Step_Open,  # 副本开启
FB_Step_Fighting,  # 副本进行中
FB_Step_Over,  # 副本结束
FB_Step_Close,  # 副本关闭
) = range(4)
def OnFBPlayerOnLogin(curPlayer):
@@ -149,17 +151,16 @@
    if not hadDelTicket:
        FBCommon.SetHadDelTicket(curPlayer)
        FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_AllFamilyBoss, 1)
        if lineID == 0:
            PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_FamilyBoss1, 1)
        else:
            PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_FamilyBoss2, 1)
        PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_FamilyBoss1, 1)
        if fbStep == FB_Step_Open:
            FBCommon.SetFBStep(FB_Step_Fighting, tick)
        EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_AllFamilyBoss, 0, ChConfig.CME_Log_Start)
        if fbStep >= FB_Step_Over:
            PlayerControl.PlayerLeaveFB(curPlayer)
            return
    if fbStep >= FB_Step_Over:
        PlayerControl.PlayerLeaveFB(curPlayer)
        return
    if familyID not in PyGameData.g_allfamilyBossDict:
        PyGameData.g_allfamilyBossDict[familyID] = [curPlayer.GetFamilyName(), 0, [playerID]]
@@ -189,7 +190,7 @@
    gameWorld.SetGameWorldDict(FBDict_StartTick, 0)
    gameWorld.SetGameWorldDict(FBDict_Speed, 0)
    gameWorld.SetGameWorldDict(FBDict_RemainHP, 0)
    gameWorld.SetGameWorldDict(FBDict_IsReduceing, 0)
    gameWorld.SetPropertyID(0)
    PyGameData.g_allfamilyBossDict = {}
    return
@@ -279,7 +280,7 @@
    remainHPPer = min(1000000, remainHP * 1000000 / totalHP) if totalHP else 0
    playerID = curPlayer.GetPlayerID()
    IsEncourage = GameWorld.GetGameFB().GetPlayerGameFBDictByKey(playerID, FBDict_IsEncourage)
    fbHelpDict = {"hurtInfo":hurtInfo, 'hpReduceSpeed':hpReduceSpeed,'IsEncourage':IsEncourage,
    fbHelpDict = {"hurtInfo":hurtInfo, 'hpReduceSpeed':hpReduceSpeed, 'IsEncourage':IsEncourage,
                  'remainHPPer':remainHPPer, 'isReduceing':isReduceing, 'myHurt':myHurt % ChConfig.Def_PerPointValue,
                  'myHurtEx':myHurt / ChConfig.Def_PerPointValue, 'myRank':myRank, 'myMenberCnt':myMenberCnt
                  }
@@ -356,7 +357,6 @@
            GameWorldProcess.CloseFB(tick)
            FBCommon.SetFBStep(FB_Step_Close, tick)
            return
    
    elif fbStep == FB_Step_Fighting:
        startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick)
@@ -396,22 +396,22 @@
    
    if isPass:
        worldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
        familyAuctionItemDict = {} #{仙盟ID:[[享受收益的成员ID, ...], [[拍品ID,总个数,拍品组数], ...]], ...}
        familyAuctionItemDict = {}  #{仙盟ID:[[享受收益的成员ID, ...], [[拍品ID,总个数,拍品组数], ...]], ...}
        batchPlayerIDList, batchAddItemList, batchParamList, batchDetailList = [], [], [], []
        event=["AllFamilyBoss", False, {}]
        event = ["AllFamilyBoss", False, {}]
        needMemberCnt = IpyGameDataPY.GetFuncCfg('LeagueBOSSNumber1')
        for rank, hurtInfo in enumerate(playerHurtList, 1):
            familyID = hurtInfo[0]
            memberIDList = hurtInfo[1][2]
            memberCnt = len(memberIDList)
            familyAuctionItemList, menberItemList = __GetFamilyBossAward(rank, worldLV)
            GameWorld.Log('rank=%s,worldLV=%s,familyAuctionItemList=%s,menberItemList=%s,memberCnt=%s'%(rank, worldLV,familyAuctionItemList,menberItemList, memberCnt), familyID)
            GameWorld.Log('rank=%s,worldLV=%s,familyAuctionItemList=%s,menberItemList=%s,memberCnt=%s' % (rank, worldLV, familyAuctionItemList, menberItemList, memberCnt), familyID)
            
            overDict = {FBCommon.Over_rank:rank, 'memberCnt':len(memberIDList)}
            if memberCnt >= needMemberCnt and familyAuctionItemList:#仙盟拍品
            if memberCnt >= needMemberCnt and familyAuctionItemList:  #仙盟拍品
                familyAuctionItemDict[familyID] = [memberIDList, familyAuctionItemList]
                overDict['AuctionItem'] = FBCommon.GetJsonItemList(familyAuctionItemList)
            if menberItemList: #成员奖励
            if menberItemList:  #成员奖励
                overDict[FBCommon.Over_itemInfo] = FBCommon.GetJsonItemList(menberItemList)
                
            mailPlayerIDList = []
@@ -433,7 +433,7 @@
        if batchPlayerIDList:
            PlayerControl.SendMailBatch("LeagueBOSS2", batchPlayerIDList, batchAddItemList, batchParamList, batchDetail=batchDetailList)
        if familyAuctionItemDict:
            GameWorld.Log('familyAuctionItemDict=%s'%familyAuctionItemDict)
            GameWorld.Log('familyAuctionItemDict=%s' % familyAuctionItemDict)
            PlayerAuctionHouse.DoAddFamilyAuctionItem(familyAuctionItemDict)
    else:
        playerCount = playerManager.GetPlayerCount()
@@ -441,14 +441,16 @@
            curPlayer = playerManager.GetPlayerByIndex(index)
            if not curPlayer:
                continue
            member.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
            FBCommon.NotifyFBOver(member, ChConfig.Def_FBMapID_AllFamilyBoss, lineID, isPass)
            curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
            FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_AllFamilyBoss, lineID, isPass)
  
    return
def __GetFamilyBossAward(rank, worldLV):
    familyAuctionItemList, menberItemList = [], []
    awardRateList = []
    awardPieRateDict = {}
    ipyMgr = IpyGameDataPY.IPY_Data()
    for i in xrange(ipyMgr.GetFamilyBossAwardCount()):
        ipyData = ipyMgr.GetFamilyBossAwardByIndex(i)
@@ -458,20 +460,31 @@
        rankList = ipyData.GetRank()
        if rank < rankList[0] or rank > rankList[1]:
            continue
        awardRateList = ipyData.GetAward()
    if not awardRateList:
        GameWorld.ErrLog('仙盟Boss奖励表 未配置该奖励 rank=%s,worldLV=%s'%(rank, worldLV))
        awardRateList = ipyData.GetAward1()
        awardPieRateDict = ipyData.GetAward2()
    if not awardRateList and not awardPieRateDict:
        GameWorld.ErrLog('仙盟Boss奖励表 未配置该奖励 rank=%s,worldLV=%s' % (rank, worldLV))
        return familyAuctionItemList, menberItemList
    for rate, itemInfo in awardRateList:
        if not GameWorld.CanHappen(rate, 10000):
            continue
        if len(itemInfo) != 3:
            GameWorld.ErrLog('仙盟Boss奖励表配置错误 itemInfo=%s'%itemInfo)
            GameWorld.ErrLog('仙盟Boss奖励表配置错误 itemInfo=%s' % itemInfo)
            continue
        if itemInfo[2]:
            familyAuctionItemList.append(itemInfo)
        else:
            menberItemList.append(itemInfo)
    for doCnt, awardPieRateList in awardPieRateDict.items():
        for _ in xrange(doCnt):
            resultItem = GameWorld.GetResultByRandomList(awardPieRateList)
            if len(resultItem) != 3:
                GameWorld.ErrLog('仙盟Boss奖励表配置错误 itemInfo=%s' % resultItem)
                continue
            if resultItem[2]:
                familyAuctionItemList.append(resultItem)
            else:
                menberItemList.append(resultItem)
    
    return familyAuctionItemList, menberItemList
@@ -480,17 +493,31 @@
    gameFB = GameWorld.GetGameFB()
    isOver = gameFB.GetGameFBDictByKey(FBDict_IsOver)
 
    if not isOver and GetBossRemainHP(tick) == 0:
        #结束 设置BOSS死亡
        FBCommon.ClearFBNPC()
        FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
        GameWorld.DebugLog('结束 设置BOSS死亡')
    if not isOver:
        if GetBossRemainHP(tick) == 0:
            #结束 设置BOSS死亡
            FBCommon.ClearFBNPC()
            FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
            GameWorld.DebugLog('结束 设置BOSS死亡')
            gameFB.SetGameFBDict(FBDict_IsOver, tick)
            __DoLogicAllFamilyBossOver(1, tick)
        else:
            #血量广播
            needNotifyHPPerList = [50, 20]
            lastIndex = gameFB.GetGameFBDictByKey(FBDict_LastHPNotify)
            if lastIndex >= len(needNotifyHPPerList):
                return
            remainPer = GetBossRemainHPPer(tick)
            notifyHPPer = needNotifyHPPerList[lastIndex]
            if remainPer == notifyHPPer or remainPer - 1 == notifyHPPer:
                gameFB.SetGameFBDict(FBDict_LastHPNotify, lastIndex + 1)
                lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
                bossID = CurFBLineBOSSID(lineID)
                msgMark = 'AllianceBossHP1' if lineID == 0 else 'AllianceBossHP2'
                PlayerControl.WorldNotify(0, msgMark, [bossID, notifyHPPer])
        gameFB.SetGameFBDict(FBDict_IsOver, tick)
        __DoLogicAllFamilyBossOver(1, tick)
    return
@@ -503,8 +530,9 @@
    lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
    if lineID < 0:
        return
    curSpeed = int(min(1 + 0.08 * (playerCnt - 1), 1.8) * 1000)
    curSpeed = eval(FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_AllFamilyBoss, lineID)[Def_HPSpeed])
    gameWorld.SetGameWorldDict(FBDict_Speed, curSpeed)
    if not gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing):
        return
@@ -562,7 +590,7 @@
    lastSpeed = gameWorld.GetGameWorldDictByKey(FBDict_Speed) 
    remainHP = gameWorld.GetGameWorldDictByKey(FBDict_RemainHP)
    if not gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing):
        return remainHP
        return remainHP if startTick else __GetBossTotalHP()
    if not startTick:
        startTick = tick
        remainHP = __GetBossTotalHP()
@@ -575,7 +603,7 @@
    remainHP = GetBossRemainHP(tick)
    totalHP = __GetBossTotalHP()
    if not totalHP:
        return 0
        return 100
    return remainHP * 100 / totalHP