xdh
2019-04-18 ab2158916e07846e4be746673231dac6dfa27fc9
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
@@ -30,8 +30,9 @@
import EventReport
import PlayerFamily
import PlayerActivity
import ItemControler
import PlayerSuccess
import PlayerMagicWeapon
import GameFuncComm
import PyGameData
import PlayerVip
import GameObj
@@ -66,6 +67,10 @@
Help_isHelp = 'isHelp' #本次是否是助战
Help_helpCount = 'helpCount' #该副本今日已助战次数
Help_relation = 'relation' #该副本关系加成信息 [优先关系, 总加成]
Help_robotJob = 'robotJob' #机器人职业 {"ObjID":job, ...}
Help_isAuto = 'isAuto' #是否自动召唤
Help_hasRefreshBoss = 'hasRefreshBoss' #是否已刷新boss
Help_gsItemInfo = 'gsItemInfo' #聚魂副本物品信息 {"波数":[[{"ItemID":101, "ItemCount":10}]]}
#副本结算信息通用key
Over_dataMapID = 'dataMapID' #数据地图ID
@@ -91,6 +96,8 @@
Over_leaderID = 'leaderID' #渡劫玩家ID
Over_xianyuanCoin = 'xianyuanCoin' #获得仙缘币信息 [获得仙缘币数, 没有获得的原因] 原因: 1-达到助战次数上限,2-达到每日获得仙缘币上限
Over_helpPlayer = 'helpPlayer' #助战玩家信息 {"玩家ID":{玩家信息key:value, ...}, ...}
Over_ownerID = 'ownerID' #归属玩家ID
Over_ownerName = 'ownerName' #归属玩家名
#副本行为
(
@@ -197,15 +204,6 @@
            if isNotify:
                PlayerControl.NotifyCode(curPlayer, "FbLV", [mapID])
            return ShareDefine.EntFBAskRet_LVLimit
        #职业阶判断
        jobRankLimit = fbLineIpyData.GetJobRankLimit()
        if jobRankLimit and PlayerControl.GetJobRank(curPlayer) < jobRankLimit:
            GameWorld.Log("玩家职业阶级不足, 无法进入副本!mapID=%s,lineID=%s,jobRank=%s < jobRankLimit=%s"
                          % (mapID, lineID, PlayerControl.GetJobRank(curPlayer), jobRankLimit), playerID)
            if isNotify:
                PlayerControl.NotifyCode(curPlayer, "SingleEnterJob", [mapID])
            return ShareDefine.EntFBAskRet_JobRankLimit
        
        #门票判断
        if not GetFBEnterTicket(curPlayer, mapID, lineID, fbLineIpyData, reqEnterCnt, isTeamAsk)[0]:
@@ -372,6 +370,17 @@
    gameFB.SetGameFBDict(ChConfig.Def_FB_NPCStrengthenMaxLV, maxLV)
    GameWorld.Log("NPC成长动态等级变更: isLeave=%s,totalLV=%s,playerCnt=%s,averageLV=%s,maxLV=%s" 
                  % (isLeave, totalLV, playerCnt, averageLV, maxLV), playerID)
    # 上古战场特殊处理
    if mapID == ChConfig.Def_FBMapID_ElderBattlefield:
        lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
        fbLineIpyData = GetFBLineIpyData(mapID, lineID)
        lvLimitMin = 0 if not fbLineIpyData else fbLineIpyData.GetLVLimitMin()
        robotLVDiff = IpyGameDataPY.GetFuncCfg("ElderBattlefieldCfg", 5)
        robotLVMin, robotLVMax = averageLV - robotLVDiff, averageLV
        robotLVMin = max(lvLimitMin, robotLVMin)
        gameFB.SetGameFBDict(ChConfig.Def_FB_NPCStrengthenMaxLV, robotLVMax)
        gameFB.SetGameFBDict(ChConfig.Def_FB_NPCStrengthenMinLV, robotLVMin)
        GameWorld.Log("    更新上古机器人等级范围: lineID=%s,robotLVDiff=%s,robotLV=(%s~%s)" % (lineID, robotLVDiff, robotLVMin, robotLVMax))
    return True
def UpdFBLineNPCStrengthenPlayerCnt(playerID, isLeave):
@@ -567,7 +576,7 @@
    return
def GetJsonItemList(itemList):
    ## [[itemID,itemCount,isBind], curItem] -> [{"ItemID":101, "Count":10, "IsBind":1, "IsSuite":1, "UserData":"自定义属性字符串"}]
    ## [[itemID,itemCount,isAuctionItem], curItem] -> [{"ItemID":101, "Count":10, "IsAuctionItem":1, "UserData":"自定义属性字符串"}]
    jsonItemList = []
    for itemInfo in itemList:
        itemDict = {}
@@ -578,7 +587,7 @@
            if infolen > 1:
                itemDict['Count'] = itemInfo[1]
            if infolen > 2:
                itemDict['IsBind'] = int(itemInfo[2])
                itemDict['IsAuctionItem'] = int(itemInfo[2])
        elif isinstance(itemInfo, int):
            itemDict['ItemID'] = itemInfo
        else: #物品实例
@@ -586,8 +595,8 @@
                continue
            itemDict['ItemID'] = itemInfo.GetItemTypeID()
            itemDict['Count'] = itemInfo.GetCount()
            itemDict['IsBind'] = int(itemInfo.GetIsBind())
            itemDict['IsSuite'] = int(itemInfo.GetIsSuite())
            itemDict['IsAuctionItem'] = ItemControler.GetIsAuctionItem(itemInfo)
            #itemDict['IsSuite'] = int(itemInfo.GetIsSuite())
            itemDict['UserData'] = itemInfo.GetUserData()
        jsonItemList.append(itemDict)
    return jsonItemList
@@ -615,7 +624,7 @@
#---------------------------------------------------------------------
def SyncDynamicBarrierState(barrierPointList, state, curPlayer=None):
    '''同步动态障碍物是否有效性
    @param barrierPointList: 障碍物点列表 [[aPosX,aPosY,bPosX,bPosY], [aPosX,aPosY,bPosX,bPosY], ...]
    @param barrierPointList: 障碍物点列表 [[aPosX,aPosY,bPosX,bPosY,angle可选], [aPosX,aPosY,bPosX,bPosY,angle可选], ...]
    @param state: 是否有效
    @param curPlayer: 指定通知目标玩家,为None时广播本地图所有玩家
    '''
@@ -623,12 +632,15 @@
    barrierStatePack.Clear()
    barrierStatePack.State = state
    barrierStatePack.BarrierList = []
    for aPosX, aPosY, bPosX, bPosY in barrierPointList:
    for posInfo in barrierPointList:
        aPosX, aPosY, bPosX, bPosY = posInfo[:4]
        angle = posInfo[4] if len(posInfo) > 4 else 0
        barrier = ChPyNetSendPack.tagMCDynamicBarrier()
        barrier.APosX = aPosX
        barrier.APosY = aPosY
        barrier.BPosX = bPosX
        barrier.BPosY = bPosY
        barrier.Angle = angle
        barrierStatePack.BarrierList.append(barrier)
    barrierStatePack.Count = len(barrierStatePack.BarrierList)
    if curPlayer:
@@ -1676,6 +1688,13 @@
            newEnterCnt = max(0, dayTimes - (maxCnt - enterCnt))
            PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, newEnterCnt)
            GameWorld.DebugLog("        特殊副本已进入次数更新: newEnterCnt=%s" % newEnterCnt)
        elif mapID == ChConfig.Def_FBMapID_ZhuXianBoss:
            if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_ZhuXianBoss):
                curCnt = min(maxCnt - enterCnt + IpyGameDataPY.GetFuncCfg('ZhuXianBossCntCfg'), IpyGameDataPY.GetFuncCfg('ZhuXianBossCntCfg', 2))
                if curCnt > dayTimes:
                    PlayerControl.NomalDictSetProperty(curPlayer, itemAddCntKey, curCnt - dayTimes)
                elif curCnt < dayTimes:
                    PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, dayTimes - curCnt)
            
        mapIDInfo.append(mapID)
        
@@ -1741,6 +1760,9 @@
    if mapID == ChConfig.Def_FBMapID_SealDemon and maxDayTimes and maxCnt - enterCnt >= maxDayTimes:
        GameWorld.DebugLog('当前次数已满,无需购买。。')
        return
    if mapID == ChConfig.Def_FBMapID_ZhuXianBoss and maxCnt - enterCnt >= IpyGameDataPY.GetFuncCfg('ZhuXianBossCntCfg', 2):
        return
    if hasBuyCnt >= canBuyCnt:
        GameWorld.DebugLog("购买次数已经用完mapID=%s"%mapID)
        return
@@ -1887,7 +1909,7 @@
#  @param tick 当前时间
#  @param isMaxlv 是否直接满级
#  @return None
def FbEncourageBuff(curPlayer, key, encourageType, tick, isMaxlv=False):
def FbEncourageBuff(curPlayer, key, encourageType, tick, ownerID=0):
    #GameWorld.Log("FbEncourageBuff moneyType=%s" % (moneyType))
    curMapID = curPlayer.GetMapID()
    curMapID = GetRecordMapID(curMapID)
@@ -1896,10 +1918,10 @@
        return
    maxCnt = ipyData.GetInspireMaxLV()
    gameFB = GameWorld.GetGameFB()
    curPlayerID = curPlayer.GetID()
    encourageLV = gameFB.GetPlayerGameFBDictByKey(curPlayerID, key)
    ownerID = ownerID or curPlayer.GetID()
    encourageLV = gameFB.GetPlayerGameFBDictByKey(ownerID, key)
    encourageCntKey = 'FbEncourageCnt_%s' % encourageType
    encourageCnt = gameFB.GetPlayerGameFBDictByKey(curPlayerID, encourageCntKey)
    encourageCnt = gameFB.GetPlayerGameFBDictByKey(ownerID, encourageCntKey)
    maxLV = IpyGameDataPY.GetFuncEvalCfg('FBEncourageBuff', 2, {}).get(curMapID, 0)
    if encourageLV >= maxLV:
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_93643")
@@ -1934,29 +1956,47 @@
        return
    
    buffType = SkillCommon.GetBuffType(skillBuff)
    BuffSkill.DoAddBuff(curPlayer, buffType, skillBuff, tick)
    gameFB.SetPlayerGameFBDict(curPlayerID, key, encourageLV+1)
    gameFB.SetPlayerGameFBDict(curPlayerID, encourageCntKey, encourageCnt+1)
    gameFB.SetPlayerGameFBDict(ownerID, key, encourageLV+1)
    gameFB.SetPlayerGameFBDict(ownerID, encourageCntKey, encourageCnt+1)
    #GameWorld.Log("FbEncourageBuff encourage nextLV=%s success" % encourageLV)
    addHurtNum = IpyGameDataPY.GetFuncEvalCfg('FBEncourageBuff', 3, {}).get(curMapID, 0)
    PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_628920", [(encourageLV+1)*addHurtNum])
    SendFBEncourageInfo(curPlayer, encourageLV+1)
    #成就
    PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FBEncourage, 1, [curMapID])
    EventShell.EventRespons_FBEncourage(curPlayer, curMapID)
    return
    if curMapID == ChConfig.Def_FBMapID_AllFamilyBoss:
        #给副本里所有盟成员提示
        playerManager = GameWorld.GetMapCopyPlayerManager()
        for index in xrange(playerManager.GetPlayerCount()):
            player = playerManager.GetPlayerByIndex(index)
            if not player:
                continue
            if player.GetFamilyID() != ownerID:
                continue
            BuffSkill.DoAddBuff(player, buffType, skillBuff, tick)
            PlayerControl.NotifyCode(player, "AllianceBossText2", [curPlayer.GetName(), encourageLV+1])
            SendFBEncourageInfo(player, encourageLV+1, ownerID)
            if player.GetID() == curPlayer.GetID():
                PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FBEncourage, 1, [curMapID])
                EventShell.EventRespons_FBEncourage(curPlayer, curMapID)
    else:
        BuffSkill.DoAddBuff(curPlayer, buffType, skillBuff, tick)
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_628920", [(encourageLV+1)*addHurtNum])
        SendFBEncourageInfo(curPlayer, encourageLV+1, ownerID)
        #成就
        PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FBEncourage, 1, [curMapID])
        EventShell.EventRespons_FBEncourage(curPlayer, curMapID)
    return True
## 添加副本鼓舞buff,一般用于玩家掉线后,在规定时间内重新上线回到副本时重新上buff
#  @param curPlayer 玩家
#  @param key 副本玩家字典key
#  @param tick 当前时间
#  @return None
def AddFbEncourageBuff(curPlayer, key, tick):
def AddFbEncourageBuff(curPlayer, key, tick, ownerID=0):
    curPlayerID = curPlayer.GetID()
    GameWorld.Log("AddFbEncourageBuff() curPlayerID=%s" % curPlayerID)
  
    gameFB = GameWorld.GetGameFB()
    encourageLV = gameFB.GetPlayerGameFBDictByKey(curPlayerID, key)
    encourageLV = gameFB.GetPlayerGameFBDictByKey(ownerID, key)
    if not encourageLV:
        return
    mapID = GameWorld.GetMap().GetMapID()
@@ -1971,7 +2011,7 @@
    buffType = SkillCommon.GetBuffType(skillBuff)
    BuffSkill.DoAddBuff(curPlayer, buffType, skillBuff, tick)
    
    SendFBEncourageInfo(curPlayer, encourageLV)
    SendFBEncourageInfo(curPlayer, encourageLV, ownerID)
    return
## 清除鼓舞buff
@@ -1991,7 +2031,7 @@
## 发送副本鼓舞信息
#  @param curPlayer 玩家
#  @return None
def SendFBEncourageInfo(curPlayer, lv):
def SendFBEncourageInfo(curPlayer, lv, ownerID=0):
    #//A3 0A 副本鼓舞信息通知 #tagMCFBEncourageInfo
    curMapID = curPlayer.GetMapID()
    curMapID = GetRecordMapID(curMapID)
@@ -2003,12 +2043,12 @@
    encourageInfo.InfoList = []
    encourageCntKey = 'FbEncourageCnt_%s'
    gameFB = GameWorld.GetGameFB()
    curPlayerID = curPlayer.GetID()
    ownerID = ownerID or curPlayer.GetID()
    for ipyData in ipyDataList:
        inspireType = ipyData.GetInspireType()
        packData = ChPyNetSendPack.tagMCFBEncourageCnt()
        packData.MoneyType = inspireType
        packData.EncourageCnt = gameFB.GetPlayerGameFBDictByKey(curPlayerID, encourageCntKey % inspireType)
        packData.EncourageCnt = gameFB.GetPlayerGameFBDictByKey(ownerID, encourageCntKey % inspireType)
        encourageInfo.InfoList.append(packData)
    encourageInfo.Cnt = len(encourageInfo.InfoList)
    NetPackCommon.SendFakePack(curPlayer, encourageInfo)