hxp
5 天以前 a0dd1dc92bb2f6eb7067a624df20a9c326ecde87
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPreset.py
@@ -23,6 +23,7 @@
import IPY_GameWorld
import NetPackCommon
import PlayerOnline
import PlayerHero
import GameWorld
import ChConfig
@@ -178,7 +179,7 @@
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    batPresetID = clientData.BatPresetID
    funcPresetType = clientData.FuncPresetType
    funcPresetID = clientData.PresetID
    toPresetID = clientData.PresetID
    
    if funcPresetType == ShareDefine.FuncPreset_Battle:
        GameWorld.DebugLog("全局战斗预设不在此修改,请使用B263封包修改全局预设方案! funcPresetType=%s" % (funcPresetType))
@@ -188,19 +189,35 @@
        GameWorld.DebugLog("全局预设未解锁! batPresetID=%s" % batPresetID)
        return
    
    if not GetFuncPresetIDState(curPlayer, funcPresetID, funcPresetType):
        GameWorld.DebugLog("功能预设未解锁! funcPresetID=%s,funcPresetType=%s" % (funcPresetID, funcPresetType))
    if not GetFuncPresetIDState(curPlayer, toPresetID, funcPresetType):
        GameWorld.DebugLog("功能预设未解锁! toPresetID=%s,funcPresetType=%s" % (toPresetID, funcPresetType))
        return
    
    if GetFuncPresetID(curPlayer, batPresetID, funcPresetType) == funcPresetID:
        GameWorld.DebugLog("功能预设不变不处理! batPresetID=%s,funcPresetType=%s,funcPresetID=%s" % (batPresetID, funcPresetType, funcPresetID))
    nowPresetID = GetFuncPresetID(curPlayer, batPresetID, funcPresetType)
    if nowPresetID == toPresetID:
        GameWorld.DebugLog("功能预设不变不处理! batPresetID=%s,funcPresetType=%s,toPresetID=%s" % (batPresetID, funcPresetType, toPresetID))
        return
    
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PresetFuncID % (batPresetID, funcPresetType), funcPresetID)
    GameWorld.DebugLog("功能预设方案切换: batPresetID=%s,funcPresetType=%s,funcPresetID=%s" % (batPresetID, funcPresetType, funcPresetID))
    GameWorld.DebugLog("功能预设方案切换: batPresetID=%s,funcPresetType=%s,nowPresetID=%s,toPresetID=%s" % (batPresetID, funcPresetType, nowPresetID, toPresetID))
    # 武将方案检查是否空,空的话强制复制当前
    if funcPresetType == ShareDefine.FuncPreset_Hero:
        olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
        heroPreset = olPlayer.GetHeroPreset(toPresetID)
        if not heroPreset.heroItemDict:
            nowHeroPreset = olPlayer.GetHeroPreset(nowPresetID)
            itemIndexPosDict = {}
            itemIndexPosDict.update(nowHeroPreset.heroItemDict)
            GameWorld.DebugLog("该武将方案为空直接先复制当前方案! nowPresetID=%s,itemIndexPosDict=%s" % (nowPresetID, itemIndexPosDict))
            PlayerHero.DoSaveHeroPreset(curPlayer, toPresetID, itemIndexPosDict)
        heroPreset.OnSwitch()
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PresetFuncID % (batPresetID, funcPresetType), toPresetID)
    
    # 刷属性
    PlayerOnline.GetOnlinePlayer(curPlayer).RefreshBatPreset(batPresetID)
    #PlayerViewCache.ResetCacheUpdTickByPresetSwitch(curPlayer, batPresetID)
    PlayerOnline.GetOnlinePlayer(curPlayer).RefreshByFuncPreset(funcPresetType, toPresetID)
    
    Sync_FuncPresetSwitchInfo(curPlayer, batPresetID, funcPresetType)
    return
@@ -233,6 +250,7 @@
    GameWorld.DebugLog("全局战斗预设方案切换: batPresetType=%s,batPresetID=%s" % (batPresetType, batPresetID))
    
    # 刷属性
    #PlayerViewCache.ResetCacheUpdTickByPresetSwitch(curPlayer, batPresetID)
    PlayerOnline.GetOnlinePlayer(curPlayer).RefreshBatPreset(batPresetID)
    
    Sync_BatPresetSwitchInfo(curPlayer, batPresetType)