#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package GM.Commands.SetEquipPartPlusLV  
 | 
#  
 | 
# @todo:ÉèÖÃ×°±¸²¿Î»¹«¹²Ç¿»¯µÈ¼¶  
 | 
# @author hxp  
 | 
# @date 2015-12-15  
 | 
# @version 1.0  
 | 
#  
 | 
# ÏêϸÃèÊö: ÉèÖÃ×°±¸²¿Î»¹«¹²Ç¿»¯µÈ¼¶  
 | 
#  
 | 
#---------------------------------------------------------------------  
 | 
"""Version = 2015-12-15 17:00"""  
 | 
#---------------------------------------------------------------------  
 | 
import Operate_EquipPlus  
 | 
import IPY_GameWorld  
 | 
import ChConfig  
 | 
import ChEquip  
 | 
import GameWorld  
 | 
import IpyGameDataPY  
 | 
#---------------------------------------------------------------------  
 | 
#Â߼ʵÏÖ  
 | 
## GMÃüÁîÖ´ÐÐÈë¿Ú  
 | 
#  @param curPlayer µ±Ç°Íæ¼Ò  
 | 
#  @param cmdList ²ÎÊýÁбí [packType, index, starLV]  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def OnExec(curPlayer, cmdList):  
 | 
      
 | 
    packType = IPY_GameWorld.rptEquip  
 | 
    curPack = curPlayer.GetItemManager().GetPack(packType)  
 | 
    refreshClassLV = 0  
 | 
      
 | 
    # ÉèÖÃËùÓÐ½×  
 | 
    if len(cmdList) == 2:  
 | 
        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:  
 | 
                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),½ø»¯µÈ¼¶(%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, 0)  
 | 
        ChEquip.SetEquipPartPlusEvolveLV(curPlayer, packType, gridIndex, evolveLV)  
 | 
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃ%s½×%s²¿Î»Ç¿»¯µÈ¼¶(%s),½ø»¯µÈ¼¶(%s)" % (classLV, equipPlace, starLV, evolveLV))  
 | 
        refreshClassLV = classLV  
 | 
          
 | 
    else:  
 | 
        __GMHelpAnswer(curPlayer, "²ÎÊý´íÎó£¡")  
 | 
        return  
 | 
      
 | 
    Operate_EquipPlus.DoLogic_OnEquipPartStarLVChange(curPlayer, packType, refreshClassLV)  
 | 
    ChEquip.NotifyEquipPartPlusLV(curPlayer, packType)  
 | 
    return  
 | 
  
 | 
def __GMHelpAnswer(curPlayer, errorMsg=""):  
 | 
    if errorMsg:  
 | 
        GameWorld.DebugAnswer(curPlayer, "%s" % errorMsg)  
 | 
    GameWorld.DebugAnswer(curPlayer, "ÉèÖÃËùÓн׼¶: SetEquipPartPlusLV Ç¿»¯µÈ¼¶ ½ø½×µÈ¼¶")  
 | 
    GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÖ¸¶¨½×¼¶: SetEquipPartPlusLV ½×¼¶  Ç¿»¯µÈ¼¶ ½ø½×µÈ¼¶")  
 | 
    GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÖ¸¶¨²¿Î»: SetEquipPartPlusLV ½×¼¶ ²¿Î» Ç¿»¯µÈ¼¶ ½ø½×µÈ¼¶")  
 | 
    return  
 |