#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package GM.Commands.SetEquipPartStar  
 | 
#  
 | 
# @todo:ÉèÖÃ×°±¸²¿Î»¹«¹²ÐÇÊý  
 | 
# @author xdh  
 | 
# @date 2019-3-2  
 | 
# @version 1.0  
 | 
#  
 | 
# ÏêϸÃèÊö: ÉèÖÃ×°±¸²¿Î»¹«¹²ÐÇÊý  
 | 
#  
 | 
#---------------------------------------------------------------------  
 | 
"""Version = 2019-3-2 17:00"""  
 | 
#---------------------------------------------------------------------  
 | 
import PlayerControl  
 | 
import ChEquip  
 | 
import GameWorld  
 | 
import IpyGameDataPY  
 | 
import ChConfig  
 | 
import IPY_GameWorld  
 | 
#---------------------------------------------------------------------  
 | 
#Â߼ʵÏÖ  
 | 
## GMÃüÁîÖ´ÐÐÈë¿Ú  
 | 
#  @param curPlayer µ±Ç°Íæ¼Ò  
 | 
#  @param cmdList ²ÎÊýÁбí [classlv, equipPlace, starLV]  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def OnExec(curPlayer, cmdList):  
 | 
    if not cmdList:  
 | 
        __GMHelpAnswer(curPlayer)  
 | 
        return  
 | 
    if len(cmdList) == 1:  
 | 
        starLV = cmdList[0]  
 | 
        equipMaxClasslv = IpyGameDataPY.GetFuncCfg('EquipMaxClasslv')  
 | 
        for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(IPY_GameWorld.rptEquip, []):  
 | 
            for classlv in xrange(1, equipMaxClasslv+1):  
 | 
                ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classlv, equipPlace)  
 | 
                if not ipyData:  
 | 
                    continue   
 | 
                equipPackIndex = ipyData.GetGridIndex()  
 | 
                ChEquip.SetEquipPartStar(curPlayer, equipPackIndex, starLV)  
 | 
        ChEquip.NotifyEquipPartStar(curPlayer)  
 | 
        ChEquip.RefreshPlayerEquipAttribute(curPlayer)  
 | 
        playControl = PlayerControl.PlayerControl(curPlayer)  
 | 
        playControl.RefreshPlayerAttrState()  
 | 
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃËùÓв¿Î»ÐÇÊýΪ: %s" % (starLV))  
 | 
    elif len(cmdList) == 2:  
 | 
        classLV, starLV = cmdList  
 | 
        for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(IPY_GameWorld.rptEquip, []):  
 | 
  
 | 
            ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)  
 | 
            if not ipyData:  
 | 
                continue   
 | 
            equipPackIndex = ipyData.GetGridIndex()  
 | 
            ChEquip.SetEquipPartStar(curPlayer, equipPackIndex, starLV)  
 | 
        ChEquip.NotifyEquipPartStar(curPlayer)  
 | 
        ChEquip.RefreshPlayerEquipAttribute(curPlayer, classLV)  
 | 
        playControl = PlayerControl.PlayerControl(curPlayer)  
 | 
        playControl.RefreshPlayerAttrState()  
 | 
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃ%s½×ËùÓв¿Î»ÐÇÊýΪ: %s" % (classLV, starLV))  
 | 
          
 | 
    if len(cmdList) != 3:  
 | 
        return  
 | 
    classLV, equipPlace, starLV = cmdList  
 | 
    ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)  
 | 
    if not ipyData:  
 | 
        __GMHelpAnswer(curPlayer)  
 | 
        return  
 | 
    equipPackIndex = ipyData.GetGridIndex()  
 | 
    ChEquip.SetEquipPartStar(curPlayer, equipPackIndex, starLV)  
 | 
    ChEquip.NotifyEquipPartStar(curPlayer, equipPackIndex)  
 | 
    ChEquip.RefreshPlayerEquipAttribute(curPlayer, classLV)  
 | 
    playControl = PlayerControl.PlayerControl(curPlayer)  
 | 
    playControl.RefreshPlayerAttrState()  
 | 
    GameWorld.DebugAnswer(curPlayer, "ÉèÖÃ%s½×%s²¿Î»ÐÇÊýΪ: %s" % (classLV, equipPlace, starLV))  
 | 
    return  
 | 
  
 | 
  
 | 
def __GMHelpAnswer(curPlayer, errorMsg=""):  
 | 
    if errorMsg:  
 | 
        GameWorld.DebugAnswer(curPlayer, "%s" % errorMsg)  
 | 
    GameWorld.DebugAnswer(curPlayer, "SetEquipPartStar ÐÇÊý")  
 | 
    GameWorld.DebugAnswer(curPlayer, "SetEquipPartStar ½×¼¶ ÐÇÊý")  
 | 
    GameWorld.DebugAnswer(curPlayer, "SetEquipPartStar ½×¼¶ ²¿Î» ÐÇÊý")  
 | 
      
 | 
    return  
 |