hch
2019-04-27 552f4ce1704ee326eded21f56f032c7db0e11f4f
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetEquipPartPlusLV.py
@@ -21,7 +21,6 @@
import ChConfig
import ChEquip
import GameWorld
import ItemCommon
import IpyGameDataPY
#---------------------------------------------------------------------
#逻辑实现
@@ -31,14 +30,31 @@
#  @return None
#  @remarks 函数详细说明.
def OnExec(curPlayer, cmdList):
    if not cmdList:
        __GMHelpAnswer(curPlayer)
        return
    packType = IPY_GameWorld.rptEquip
    curPack = curPlayer.GetItemManager().GetPack(packType)
    refreshClassLV = 0
    # 设置所有阶
    if len(cmdList) == 2:
        setStarLV = cmdList[1]
        classLV = cmdList[0]
        setStarLV, evolveLV = cmdList
        equipMaxClasslv = IpyGameDataPY.GetFuncCfg('EquipMaxClasslv')
        for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(packType, []):
            for classlv in xrange(1, equipMaxClasslv+1):
                ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classlv, equipPlace)
                if not ipyData:
                    continue
                gridIndex = ipyData.GetGridIndex()
                curEquip = curPack.GetAt(gridIndex)
                ChEquip.SetEquipPartPlusLV(curPlayer, packType, gridIndex, curEquip, setStarLV)
                ChEquip.SetEquipPartProficiency(curPlayer, packType, gridIndex, 0)
                ChEquip.SetEquipPartPlusEvolveLV(curPlayer, packType, gridIndex, evolveLV)
        GameWorld.DebugAnswer(curPlayer, "设置所有部位强化等级(%s),进化等级(%s)" % (setStarLV, evolveLV))
    # 设置指定阶
    elif len(cmdList) == 3:
        classLV, setStarLV, evolveLV = cmdList
        for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(packType, []):
            ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)
            if not ipyData:
@@ -47,76 +63,40 @@
            curEquip = curPack.GetAt(gridIndex)
            ChEquip.SetEquipPartPlusLV(curPlayer, packType, gridIndex, curEquip, setStarLV)
            ChEquip.SetEquipPartProficiency(curPlayer, packType, gridIndex, 0)
            ChEquip.SetEquipPartPlusEvolveLV(curPlayer, packType, gridIndex, 0)
            Operate_EquipPlus.DoLogic_OnEquipPartStarLVChange(curPlayer, packType, classLV)
        ChEquip.NotifyEquipPartPlusLV(curPlayer)
        GameWorld.DebugAnswer(curPlayer, "设置%s阶所有部位强化等级为: %s" % (classLV, setStarLV))
        return
    if len(cmdList) != 3:
            ChEquip.SetEquipPartPlusEvolveLV(curPlayer, packType, gridIndex, evolveLV)
        GameWorld.DebugAnswer(curPlayer, "设置%s阶所有部位强化等级(%s),进化等级(%s)" % (classLV, setStarLV, evolveLV))
        refreshClassLV = classLV
    # 设置指定阶部位
    elif len(cmdList) == 4:
        classLV, equipPlace, starLV, evolveLV = cmdList
        if equipPlace not in ChConfig.Pack_EquipPart_CanPlusStar[packType]:
            __GMHelpAnswer(curPlayer, "部位不存在!")
            return
        ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)
        if not ipyData:
            return
        gridIndex = ipyData.GetGridIndex()
        curEquip = curPack.GetAt(gridIndex)
        ChEquip.SetEquipPartPlusLV(curPlayer, packType, gridIndex, curEquip, starLV)
        ChEquip.SetEquipPartProficiency(curPlayer, packType, gridIndex, evolveLV)
        GameWorld.DebugAnswer(curPlayer, "设置%s阶%s部位强化等级(%s),进化等级(%s)" % (classLV, equipPlace, starLV, evolveLV))
        refreshClassLV = classLV
    else:
        __GMHelpAnswer(curPlayer, "参数错误!")
        return
    
    classLV, equipPlace, starLV = cmdList
    if packType not in ChConfig.Pack_EquipPart_CanPlusStar:
        __GMHelpAnswer(curPlayer, "packType不存在!")
        return
    if equipPlace not in ChConfig.Pack_EquipPart_CanPlusStar[packType]:
        __GMHelpAnswer(curPlayer, "index索引不存在!")
        return
    ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)
    if not ipyData:
        return
    gridIndex = ipyData.GetGridIndex()
    curEquip = curPack.GetAt(gridIndex)
    if not ItemCommon.CheckItemCanUse(curEquip):
        return
    maxStarLV = ItemCommon.GetItemMaxPlusLV(curPlayer, gridIndex, curEquip)
    starLV = min(starLV, maxStarLV)
    ChEquip.SetEquipPartPlusLV(curPlayer, packType, gridIndex, curEquip, starLV)
    ChEquip.SetEquipPartProficiency(curPlayer, packType, gridIndex, 0)
    Operate_EquipPlus.DoLogic_OnEquipPartStarLVChange(curPlayer, packType, classLV)
    Operate_EquipPlus.DoLogic_OnEquipPartStarLVChange(curPlayer, packType, refreshClassLV)
    ChEquip.NotifyEquipPartPlusLV(curPlayer, packType)
    return
def __GMHelpAnswer(curPlayer, errorMsg=""):
    if errorMsg:
        GameWorld.DebugAnswer(curPlayer, "%s" % errorMsg)
    packTypeStrDict = {
                       IPY_GameWorld.rptEquip:"装备背包",
                       IPY_GameWorld.rptHorseEquip:"坐骑装备背包",
                       }
#===============================================================================
#    indexStrDict = {
#                    "%s_%s" % (IPY_GameWorld.rptEquip, IPY_GameWorld.retMask):"头盔",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, IPY_GameWorld.retClothes):"衣服",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, IPY_GameWorld.retArm):"护手",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, IPY_GameWorld.retTrousers):"裤子",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, IPY_GameWorld.retShoes):"鞋子",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, IPY_GameWorld.retNeck):"项链",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, IPY_GameWorld.retRingLeft):"左戒指",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, IPY_GameWorld.retRingRight):"右戒指",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, ShareDefine.retWeapon):"右手武器",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, ShareDefine.retWeapon2):"左手武器",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, IPY_GameWorld.retAmulet):"护符",
#                    "%s_%s" % (IPY_GameWorld.rptEquip, IPY_GameWorld.retBelt):"腰带",
#
#                    }
#===============================================================================
    #===========================================================================
    # GameWorld.DebugAnswer(curPlayer, "SetEquipPartPlusLV 参数[packType, index, starLV]")
    # for pType, indexList in ChConfig.Pack_EquipPart_CanPlusStar.items():
    #    GameWorld.DebugAnswer(curPlayer, "    packType=%s(%s)ʱ" % (pType, packTypeStrDict.get(pType, "")))
    #    indexStr = "index="
    #    for i in indexList:
    #        indexStr += "%s(%s)," % (i, indexStrDict.get("%s_%s" % (pType, i), ""))
    #    GameWorld.DebugAnswer(curPlayer, "        %s" % indexStr)
    #
    # GameWorld.DebugAnswer(curPlayer, "    SetEquipPartPlusLV 强化等级 可重置所有部位为对应的强化等级")
    # GameWorld.DebugAnswer(curPlayer, "------------------------------")
    #===========================================================================
    GameWorld.DebugAnswer(curPlayer, "设置所有阶级: SetEquipPartPlusLV 强化等级 进阶等级")
    GameWorld.DebugAnswer(curPlayer, "设置指定阶级: SetEquipPartPlusLV 阶级  强化等级 进阶等级")
    GameWorld.DebugAnswer(curPlayer, "设置指定部位: SetEquipPartPlusLV 阶级 部位 强化等级 进阶等级")
    return