#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GM.Commands.AddLegendAttr
|
#
|
# @todo:Ìí¼Ó/ÖØÐÂÉú³É´«ÆæÊôÐÔ
|
# @author hxp
|
# @date 2017-08-23
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: Ìí¼Ó/ÖØÐÂÉú³É´«ÆæÊôÐÔ
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2017-08-23 23:00"""
|
#-------------------------------------------------------------------------------
|
|
import GameWorld
|
import ItemCommon
|
import ItemControler
|
import IPY_GameWorld
|
import ShareDefine
|
|
#---------------------------------------------------------------------
|
#Â߼ʵÏÖ
|
## GMÃüÁîÖ´ÐÐÈë¿Ú
|
# @param curPlayer µ±Ç°Íæ¼Ò
|
# @param cmdList ²ÎÊýÁбí [index£¬attrIndexList]
|
# @return None
|
def OnExec(curPlayer, cmdList):
|
cmdlen = len(cmdList)
|
if cmdlen < 1:
|
GameWorld.DebugAnswer(curPlayer, "ÖØÐÂËæ»ú´«ÆæÊôÐÔ: AddLegendAttr ±³°ü¸ñ×ÓË÷Òý")
|
GameWorld.DebugAnswer(curPlayer, "²¿Î»ËùÓд«ÆæÊôÐÔ: AddLegendAttr ±³°ü¸ñ×ÓË÷Òý 1")
|
return
|
|
#»ñÈ¡ÎïÆ·
|
index = cmdList[0]
|
curItem = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem).GetAt(index)
|
if not ItemCommon.CheckItemIsEquip(curItem):
|
GameWorld.DebugAnswer(curPlayer, "·Ç×°±¸ÎÞ·¨»ñµÃ´«ÆæÊôÐÔ!")
|
return
|
|
if ItemControler.GetIsAuctionItem(curItem):
|
GameWorld.DebugAnswer(curPlayer, "ÅÄÆ·ÎÞ·¨Éú³É´«ÆæÊôÐÔ!")
|
return
|
|
isAllAttr = cmdList[1] if len(cmdList) > 1 else 0
|
legendAttrInfo = ItemControler.GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr)
|
if not legendAttrInfo:
|
GameWorld.DebugAnswer(curPlayer, "»ñÈ¡¸Ã×°±¸´«ÆæÊôÐÔʧ°Ü»òûÓд«ÆæÊôÐÔ!")
|
return
|
attrIDList, attrValueList = legendAttrInfo
|
|
# ´«ÆæÊôÐÔ
|
if attrIDList and attrValueList and len(attrIDList) == len(attrValueList):
|
curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)
|
curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)
|
attrDict = {}
|
for i, attrID in enumerate(attrIDList):
|
value = attrValueList[i]
|
curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, attrID)
|
curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, value)
|
attrDict[attrID] = value
|
GameWorld.DebugAnswer(curPlayer, "´«ÆæÊôÐÔ:%s" % (attrDict))
|
|
return
|
|