xdh
2019-06-04 256e1c97cf082750fdfbf710d681e176dd19c66c
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyBoss.py
@@ -24,6 +24,8 @@
import NetPackCommon
import ShareDefine
import IpyGameDataPY
import PlayerDBGSEvent
import PlayerControl
import ChConfig
import time
@@ -35,9 +37,9 @@
def GetFamilyBossIsOpen(fActionData): return fActionData.GetValue2()
def SetFamilyBossIsOpen(fActionData, isOpen): return fActionData.SetValue2(isOpen)
def GetFamilyBossLimitCnt():
def GetFamilyBossLimitCnt(family):
    '''仙盟BOSS每周次数限制'''
    return IpyGameDataPY.GetFuncCfg('FamilyBossOpen', 4)
    return PlayerFamily.GetFamilySetting(family, ChConfig.Def_FamilySetting_BossFBCnt)#IpyGameDataPY.GetFuncCfg('FamilyBossOpen', 4)
def GetFamilyBossCostFood():
    '''仙盟BOSS开启消耗兽粮'''
@@ -88,6 +90,7 @@
#  @return None
def OnLogin(curPlayer):
    NotifyFamilyBossFBInfo(curPlayer)
    NotifyAllFamilyBossState(curPlayer)
    return
@@ -125,7 +128,7 @@
    curWeekOpenCnt = GetFamilyBossOpenCnt(familyBossFBData)
    
    # 次数判断
    maxOpenCnt = GetFamilyBossLimitCnt()
    maxOpenCnt = GetFamilyBossLimitCnt(curFamily)
    if curWeekOpenCnt >= maxOpenCnt:
        GameWorld.Log("    本周开启次数=%s >= 最大开启次数=%s" % (curWeekOpenCnt, maxOpenCnt))
        return
@@ -181,7 +184,8 @@
    curFamily.Broadcast_FamilyChange()
    #通知地图服务器刷新
    PlayerFamily.SendPack_MapServer_PlayerFamilyRefresh(curFamily)
    GameWorld.Log("    __DoOpenCostLogic 扣除家族兽粮=%s OK!" % (foodCost))
    GameWorld.Log("    __DoOpenCostLogic 扣除家族兽粮=%s OK!, familyID=%s,playerFamilyLV=%s"
                  % (foodCost, curPlayer.GetFamilyID(), curMember.GetFamilyLV()), curPlayer.GetPlayerID())
    return True
@@ -271,4 +275,50 @@
#############################多仙盟BOSS#############################
def OnAllFamilyBossStateChange(isOpen):
    if isOpen:
        #本次开启时间距离上次击杀时间超过1小时则重置
        lastKillTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_AllFamilyBossTime)
        curTime = int(time.time())
        if abs(curTime-lastKillTime)> 3600:
            PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_AllFamilyBossTime, 0)
            #֪ͨ
            NotifyAllFamilyBossState()
    return
def AllFamilyBossKilled():
    if PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_AllFamilyBossTime):
        GameWorld.Log('多仙盟Boss已被击杀,不可重复!!')
        return
    curTime = int(time.time())
    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_AllFamilyBossTime, curTime)
    GameWorld.Log('多仙盟Boss被击杀!!')
    NotifyAllFamilyBossState()
    return
def NotifyAllFamilyBossState(curPlayer=None):
    lastKillTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_AllFamilyBossTime)
    bossInfo = ChPyNetSendPack.tagGCAllFamilyBossInfo()
    bossInfo.IsEnd = 1 if lastKillTime else 0
    if curPlayer == None:
        playerManager = GameWorld.GetPlayerManager()
        for i in xrange(playerManager.GetActivePlayerCount()):
            curPlayer = playerManager.GetActivePlayerAt(i)
            if curPlayer == None or not curPlayer.GetInitOK():
                continue
            if PlayerControl.GetIsTJG(curPlayer):
                continue
            NetPackCommon.SendFakePack(curPlayer, bossInfo)
    else:
        if PlayerControl.GetIsTJG(curPlayer):
            return
        NetPackCommon.SendFakePack(curPlayer, bossInfo)
    return
#是否在仙盟BOSS活动中
def IsInAllFamilyBoss(lineID=-1):
    state1 = GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyBoss1)
    return state1