#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package GM.Commands.SetEquipPartStarLV  
 | 
#  
 | 
# @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 ItemCommon  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
#Â߼ʵÏÖ  
 | 
## GMÃüÁîÖ´ÐÐÈë¿Ú  
 | 
#  @param curPlayer µ±Ç°Íæ¼Ò  
 | 
#  @param cmdList ²ÎÊýÁбí [packType, index, starLV]  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def OnExec(curPlayer, cmdList):  
 | 
    if not cmdList:  
 | 
        __GMHelpAnswer(curPlayer)  
 | 
        return  
 | 
      
 | 
    if len(cmdList) == 1:  
 | 
        setStarLV = cmdList[0]  
 | 
        for pType, indexList in ChConfig.Pack_EquipPart_CanPlusStar.items():  
 | 
            for i in indexList:  
 | 
                curPack = curPlayer.GetItemManager().GetPack(pType)  
 | 
                curEquip = curPack.GetAt(i)  
 | 
                ChEquip.SetEquipPartStarLV(curPlayer, pType, i, curEquip, setStarLV)  
 | 
                ChEquip.SetEquipPartProficiency(curPlayer, pType, i, 0)  
 | 
            Operate_EquipPlus.DoLogic_OnEquipPartStarLVChange(curPlayer, pType)  
 | 
        ChEquip.NotifyEquipPartStarLV(curPlayer)  
 | 
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃËùÓв¿Î»ÐǼ¶Îª: %s" % setStarLV)  
 | 
        return  
 | 
      
 | 
    if len(cmdList) != 3:  
 | 
        __GMHelpAnswer(curPlayer, "²ÎÊý´íÎó£¡")  
 | 
        return  
 | 
      
 | 
    packType, index, starLV = cmdList  
 | 
    if packType not in ChConfig.Pack_EquipPart_CanPlusStar:  
 | 
        __GMHelpAnswer(curPlayer, "packType²»´æÔÚ£¡")  
 | 
        return  
 | 
      
 | 
    if index not in ChConfig.Pack_EquipPart_CanPlusStar[packType]:  
 | 
        __GMHelpAnswer(curPlayer, "indexË÷Òý²»´æÔÚ£¡")  
 | 
        return  
 | 
      
 | 
    curPack = curPlayer.GetItemManager().GetPack(packType)  
 | 
    curEquip = curPack.GetAt(index)  
 | 
  
 | 
    maxStarLV = ItemCommon.GetItemMaxStarLV(curEquip)  
 | 
    starLV = min(starLV, maxStarLV)  
 | 
    ChEquip.SetEquipPartStarLV(curPlayer, packType, index, curEquip, starLV)  
 | 
    ChEquip.SetEquipPartProficiency(curPlayer, packType, index, 0)  
 | 
    Operate_EquipPlus.DoLogic_OnEquipPartStarLVChange(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, "SetEquipPartStarLV ²ÎÊý[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, "    SetEquipPartStarLV ÐǼ¶ ¿ÉÖØÖÃËùÓв¿Î»Îª¶ÔÓ¦µÄÐǼ¶")  
 | 
    # GameWorld.DebugAnswer(curPlayer, "------------------------------")  
 | 
    #===========================================================================  
 | 
    return  
 |