ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
@@ -24,6 +24,7 @@
import IpyGameDataPY
import FormulaControl
import PlayerPrestigeSys
import GameLogic_Dingjunge
import PlayerBeauty
import PlayerFamily
import PlayerHorse
@@ -57,9 +58,10 @@
class Lineup():
    ## 阵容
    
    def __init__(self, playerID, lineupID):
    def __init__(self, playerID, lineupID, exclusiveMapID=0):
        self.playerID = playerID
        self.lineupID = lineupID
        self.exclusiveMapID = exclusiveMapID # 大于0时代表是某个功能地图专用,如定军阁,阵容与主阵容相同,只是属性、战力可能不一样
        self.olPlayer = None
        self.shapeType = 0
        self.heroItemDict = {} # 阵容武将背包索引信息  {itemIndex:posNum, ...}
@@ -81,9 +83,9 @@
            self.lineupChange = True
        self.shapeType = shapeType
        self.heroItemDict = heroItemDict
        GameWorld.DebugLog("更新阵容: lineupID=%s,%s" % (self.lineupID, heroItemDict), self.playerID)
        GameWorld.DebugLog("更新阵容: lineupID=%s,exclusiveMapID=%s,%s" % (self.lineupID, self.exclusiveMapID, heroItemDict), self.playerID)
        self.RefreshLineupAttr(refreshForce)
        if not isReload and self.olPlayer.curPlayer:
        if not isReload and self.olPlayer.curPlayer and not self.exclusiveMapID:
            PlayerHero.Sync_Lineup(self.olPlayer.curPlayer, self.lineupID)
        return
    
@@ -159,7 +161,7 @@
        # 属性、阵容
        self._calcAttrDict = {} # 功能点属性统计 {calcIndex:{attrID:value, ...}, ...}
        self._calcSpecEffDict = {} # 功能点特殊效果统计 {calcIndex:effInfo, ...}
        self._lineupDict = {} # 上阵阵容 {lineupID:Lineup, ...}
        self._lineupDict = {} # 上阵阵容 {lineKey:Lineup, ...}   lineKey 为 lineupID 或者 (lineupID, exclusiveMapID)
        self._effectiveCardDict = {} # 加成属性生效的武将卡牌信息 {heroID:[cardAddPer, itemIndex, inMain], ...}
        
        # 主线战斗
@@ -181,14 +183,20 @@
        ## 是否真的在线
        return self.curPlayer != None
    
    def GetLineup(self, lineupID, checkAttr=True):
    def GetLineup(self, lineupID, checkAttr=True, exclusiveMapID=0):
        # @param checkAttr: 检查刷新到最新阵容属性
        lineup = None
        if lineupID in self._lineupDict:
            lineup = self._lineupDict[lineupID]
        lineKey = lineupID
        if exclusiveMapID:
            if exclusiveMapID in ChConfig.ExclusiveBatAttrMapIDList:
                lineKey = (lineupID, exclusiveMapID)
            else:
                exclusiveMapID = 0
        if lineKey in self._lineupDict:
            lineup = self._lineupDict[lineKey]
        else:
            lineup = Lineup(self.playerID, lineupID)
            self._lineupDict[lineupID] = lineup
            lineup = Lineup(self.playerID, lineupID, exclusiveMapID)
            self._lineupDict[lineKey] = lineup
        lineup.olPlayer = self
        if checkAttr:
            lineup.CheckRefreshLineupAttr()
@@ -230,7 +238,7 @@
        self.RefreshRoleAttr()
        return
    
    def RefreshRoleAttr(self, refreshForce=False, isAllLineup=False):
    def RefreshRoleAttr(self, refreshForce=False, isAllLineup=False, exclusiveMapID=0):
        '''刷新主公属性,影响主公属性的功能点属性变化时统一调用此函数
        @param refreshForce: 是否强制立马刷新
        @param isAllLineup: 是否只同步刷所有阵容属性,如果设置False则默认仅刷主阵容属性
@@ -238,13 +246,16 @@
        GameWorld.DebugLog("请求刷属性: refreshForce=%s" % (refreshForce), self.playerID)
        # 主公属性刷新时,所有阵容都要同步刷新
        for lineup in self._lineupDict.values():
            if exclusiveMapID and lineup.exclusiveMapID != exclusiveMapID:
                # 有指定的话只要指定的即可
                continue
            lineup.SetNeedRefreshState()
            
        if refreshForce:
            self.DoRefreshRoleAttr(isAllLineup)
            self.DoRefreshRoleAttr(isAllLineup, exclusiveMapID)
        return
    
    def DoRefreshRoleAttr(self, isAllLineup=False):
    def DoRefreshRoleAttr(self, isAllLineup=False, exclusiveMapID=0):
        '''执行刷属性,默认额外刷主阵容,其他阵容可以用到的时候再刷新
        @param isAllLineup: 是否刷所有阵容,如果设置False则默认仅刷主阵容属性
        @return: 是否有刷属性,0-无;1-有
@@ -252,9 +263,16 @@
        
        isRefresh = False
        # 同步执行阵容属性刷新
        for lineupID, lineup in self._lineupDict.items():
            if not isAllLineup and lineupID != ShareDefine.Lineup_Main:
                continue
        for lineup in self._lineupDict.values():
            if not isAllLineup:
                # 有指定的话只要指定的即可
                if exclusiveMapID:
                    if lineup.exclusiveMapID != exclusiveMapID:
                        continue
                # 否则只刷主阵容,指定地图有效的也不需要刷
                elif lineup.lineupID != ShareDefine.Lineup_Main or lineup.exclusiveMapID != 0:
                    continue
            if lineup.CheckRefreshLineupAttr():
                isRefresh = True
                
@@ -270,13 +288,13 @@
        checkUpdEffHeroCard(self, heroItem) # 检查更新生效的卡牌
        
        itemIndex = heroItem.GetItemPlaceIndex()
        for lineupID, lineup in self._lineupDict.items():
        for lineKey, lineup in self._lineupDict.items():
            if lineup.CheckHeroItemUpdate(itemIndex):
                if lineupID not in effLineupIDList:
                    effLineupIDList.append(lineupID)
                if lineKey not in effLineupIDList:
                    effLineupIDList.append(lineKey)
                    
        GameWorld.DebugLog("武将物品变化: itemIndex=%s, 影响阵容:%s" % (itemIndex, effLineupIDList), self.playerID)
        return effLineupIDList
        return
    
    def GetLastBatBuffer(self): return self._lastBatBufferInfo
    def SetLastBatBuffer(self, guid, batBuffer):
@@ -493,7 +511,7 @@
        cardPerTotal += cardAddPer
        if itemIndex in hisEffCardIndexList:
            hisEffCardIndexList.remove(itemIndex) # 不变的直接移除,剩余未移除的就是失效的
            GameWorld.DebugLog("生效的卡牌不变的: heroID=%s,itemIndex=%s,inMain=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inMain, cardAddPer, cardPerTotal))
            #GameWorld.DebugLog("生效的卡牌不变的: heroID=%s,itemIndex=%s,inMain=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inMain, cardAddPer, cardPerTotal))
        else:
            GameWorld.DebugLog("生效的卡牌变化的: heroID=%s,itemIndex=%s,inMain=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inMain, cardAddPer, cardPerTotal))
            heroItem = curPack.GetAt(itemIndex)
@@ -590,6 +608,11 @@
        shapeType = lineShapeTypeDict.get(lineupID, 0)
        lineup.UpdLineup(heroItemDict, shapeType, isReload=True)
        
        if lineupID == ShareDefine.Lineup_Main:
            for exclusiveMapID in ChConfig.ExclusiveBatAttrMapIDList:
                exclusiveLineup = olPlayer.GetLineup(lineupID, False, exclusiveMapID=exclusiveMapID)
                exclusiveLineup.UpdLineup(heroItemDict, shapeType, isReload=True)
    PlayerHero.Sync_Lineup(curPlayer)
    return
@@ -604,6 +627,7 @@
    PlayerHJG.CalcHJGAttr(curPlayer)
    PlayerHorse.CalcHorseAttr(curPlayer)
    PlayerBeauty.CalcBeautyAttr(curPlayer)
    GameLogic_Dingjunge.CalcDingjungeAttr(curPlayer)
    return
def doRefreshLineupAttr(curPlayer, olPlayer, lineup):
@@ -623,8 +647,9 @@
    '''
    playerID = curPlayer.GetPlayerID()
    lineupID = lineup.lineupID
    exclusiveMapID = lineup.exclusiveMapID
    
    GameWorld.DebugLog("刷新阵容属性: lineupID=%s" % lineupID, playerID)
    GameWorld.DebugLog("刷新阵容属性: lineupID=%s,exclusiveMapID=%s" % (lineupID, exclusiveMapID), playerID)
    GameWorld.DebugLog("    itemIndex-posNum : %s" % lineup.heroItemDict, playerID)
    
    lineup.FreeLineupHero()
@@ -834,6 +859,7 @@
    hjgAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_HJG)
    horseAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Horse)
    beautyAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Beauty)
    dingjungeAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Dingjunge) if exclusiveMapID == ChConfig.Def_FBMapID_Dingjunge else {}
    
    GameWorld.DebugLog("    国家武将统计=%s" % countryHeroInfo, playerID)
    GameWorld.DebugLog("    羁绊武将统计=%s" % fetterHeroInfo, playerID)
@@ -853,6 +879,7 @@
    GameWorld.DebugLog("    主幻境阁属性=%s" % hjgAttrDict, playerID)
    GameWorld.DebugLog("    主公坐骑属性=%s" % horseAttrDict, playerID)
    GameWorld.DebugLog("    主公红颜属性=%s" % beautyAttrDict, playerID)
    GameWorld.DebugLog("    定军专属属性=%s" % dingjungeAttrDict, playerID)
    
    effCardAddPer = 0
    for effInfo in olPlayer.GetEffectiveCardDict().values():
@@ -909,6 +936,9 @@
            
            beautyValue = beautyAttrDict.get(attrID, 0)
            beautyPer = beautyAttrDict.get(attrPerID, 0) / 10000.0 if attrPerID else 0
            dingjungeValue = dingjungeAttrDict.get(attrID, 0)
            dingjungePer = dingjungeAttrDict.get(attrPerID, 0) / 10000.0 if attrPerID else 0
                
            heroSelfValue, heroSelfPer = selfAttrDict.get(attrID, 0), 0 # 武将自身基值
            inheritPer = 1 # 继承比例,默认100%
@@ -936,6 +966,7 @@
            attrParamDict = {"lvValue":lvValue, "equipValue":equipValue, "realmValue":realmValue, "realmPer":realmPer, "cardPer":cardPer,
                             "gubaoValue":gubaoValue, "gubaoPer":gubaoPer, "hjgValue":hjgValue, "hjgPer":hjgPer, "horseValue":horseValue, "horsePer":horsePer, 
                             "beautyValue":beautyValue, "beautyPer":beautyPer, "fatesValue":fatesValue, "fatesPer":fatesPer,
                             "dingjungeValue":dingjungeValue, "dingjungePer":dingjungePer,
                             "heroSelfValue":heroSelfValue, "heroSelfPer":heroSelfPer, "inheritPer":inheritPer, "heroLVValue":heroLVValue, "heroLVPer":heroLVPer,
                             "lineupHaloValue":lineupHaloValue, "lineupHaloPer":lineupHaloPer, "fetterValue":fetterValue, "fetterPer":fetterPer,
                             "starTalentValue":starTalentValue, "starTalentPer":starTalentPer, "breakLVValue":breakLVValue, "breakLVPer":breakLVPer,
@@ -999,10 +1030,10 @@
                           % (heroID, fightPowerTotal, fightPower, skillFightPower, logAttrDict, lineupHero.heroSkillIDList), playerID)
        
    lineup.fightPower = lineupFightPower
    GameWorld.DebugLog("    阵容最终战力: lineupID=%s,lineupFightPower=%s" % (lineupID, lineupFightPower), playerID)
    GameWorld.DebugLog("    阵容最终战力: lineupID=%s,lineupFightPower=%s,exclusiveMapID=%s" % (lineupID, lineupFightPower, exclusiveMapID), playerID)
    
    # 非主线阵容不处理以下内容
    if lineupID != ShareDefine.Lineup_Main:
    if lineupID != ShareDefine.Lineup_Main or exclusiveMapID:
        return
    
    PlayerControl.SetFightPower(curPlayer, lineupFightPower)