| | |
| | | import ItemCommon
|
| | | import ItemControler
|
| | | import IPY_GameWorld
|
| | | import IpyGameDataPY
|
| | | import ShareDefine
|
| | | import ChConfig
|
| | |
|
| | | import random
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #逻辑实现
|
| | |
| | | cmdlen = len(cmdList)
|
| | | if cmdlen < 1:
|
| | | GameWorld.DebugAnswer(curPlayer, "重新随机传奇属性: AddLegendAttr 背包格子索引")
|
| | | GameWorld.DebugAnswer(curPlayer, "添加指定传奇属性: AddLegendAttr 背包格子索引 属性ID1 属性ID2 ...")
|
| | | GameWorld.DebugAnswer(curPlayer, "添加所有传奇属性: AddLegendAttr 背包格子索引 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "部位所有传奇属性: AddLegendAttr 背包格子索引 1")
|
| | | return
|
| | |
|
| | | #获取物品
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "非装备无法获得传奇属性!")
|
| | | return
|
| | |
|
| | | attrIDList, attrValueList = [], [] # 重新刷新的属性
|
| | | addAttrIDList, addAttrValueList = [], [] # 添加的属性
|
| | | if curItem.GetType() == ChConfig.Def_ItemType_retWing:
|
| | | attrInfo = __GetWingGMAddLegendAttrInfo(curPlayer, curItem, cmdList)
|
| | | else:
|
| | | attrInfo = __GetEquipGMAddLegendAttrInfo(curPlayer, curItem, cmdList)
|
| | | |
| | | if not attrInfo or (not attrInfo[0] and not attrInfo[1]):
|
| | | isAllAttr = cmdList[1] if len(cmdList) > 1 else 0
|
| | | legendAttrInfo = ItemControler.GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr)
|
| | | if not legendAttrInfo:
|
| | | GameWorld.DebugAnswer(curPlayer, "获取该装备传奇属性失败或没有传奇属性!")
|
| | | return
|
| | | ItemControler.SetEquipLegendAttr(curItem, legendAttrInfo)
|
| | |
|
| | | if attrInfo[0]:
|
| | | attrIDList, attrValueList = attrInfo[0]
|
| | | if attrInfo[1]:
|
| | | addAttrIDList, addAttrValueList = attrInfo[1]
|
| | | if legendAttrInfo[2]:
|
| | | GameWorld.DebugAnswer(curPlayer, "神传奇属性:%s %s" % (legendAttrInfo[2], legendAttrInfo[3]))
|
| | | if legendAttrInfo[4]:
|
| | | GameWorld.DebugAnswer(curPlayer, "仙传奇属性:%s %s" % (legendAttrInfo[4], legendAttrInfo[5]))
|
| | | if legendAttrInfo[6]:
|
| | | GameWorld.DebugAnswer(curPlayer, "极传奇属性:%s %s" % (legendAttrInfo[6], legendAttrInfo[7]))
|
| | | if legendAttrInfo[0]:
|
| | | GameWorld.DebugAnswer(curPlayer, "传奇属性:%s %s" % (legendAttrInfo[0], legendAttrInfo[1]))
|
| | |
|
| | | # 传奇属性
|
| | | if attrIDList and attrValueList and len(attrIDList) == len(attrValueList):
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)
|
| | | GameWorld.DebugLog("刷新传奇属性: ID=%s,value=%s" % (attrIDList, attrValueList))
|
| | | for i, attrID in enumerate(attrIDList):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, attrID)
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, attrValueList[i])
|
| | | |
| | | # 直接添加的
|
| | | if addAttrIDList and addAttrValueList and len(addAttrIDList) == len(addAttrValueList):
|
| | | GameWorld.DebugLog("添加传奇属性: ID=%s,value=%s" % (addAttrIDList, addAttrValueList))
|
| | | for i, attrID in enumerate(addAttrIDList):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, attrID)
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, addAttrValueList[i])
|
| | | |
| | | idList = [curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrID, i) \
|
| | | for i in range(curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID))]
|
| | | valueList = [curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValue, i) \
|
| | | for i in range(curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue))]
|
| | | GameWorld.DebugLog("当前传奇属性: ID=%s,value=%s" % (idList, valueList))
|
| | | |
| | | return
|
| | |
|
| | | def __GetEquipGMAddLegendAttrInfo(curPlayer, curItem, cmdList):
|
| | | isAdd = False
|
| | | cmdlen = len(cmdList)
|
| | | equipPlace = curItem.GetEquipPlace()
|
| | | itemColor = curItem.GetItemColor()
|
| | | if cmdlen == 1:
|
| | | return ItemControler.GetAddEquipLegendAttr(curItem), []
|
| | | |
| | | if cmdList[1] == 0:
|
| | | legAttrRuleDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRule")
|
| | | if equipPlace not in legAttrRuleDict:
|
| | | GameWorld.DebugAnswer(curPlayer, "该装备位无法获得传奇属性!equipPlace=%s" % equipPlace)
|
| | | return
|
| | | commAttrList, goodAttrList, specAttrList = legAttrRuleDict[equipPlace]
|
| | | attrIDList = commAttrList + goodAttrList
|
| | | if specAttrList:
|
| | | if type(specAttrList) == int:
|
| | | attrIDList.append(specAttrList)
|
| | | else:
|
| | | attrIDList += specAttrList
|
| | | else:
|
| | | isAdd = True
|
| | | attrIDList = cmdList[1:]
|
| | | |
| | | legAttrIDList = []
|
| | | legAttrValueList = []
|
| | | |
| | | legAttrValueDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValue")
|
| | | for attrID in attrIDList:
|
| | | if attrID not in legAttrValueDict:
|
| | | GameWorld.DebugAnswer(curPlayer, "没有该传奇属性: %s" % attrID)
|
| | | continue
|
| | | colorValueDict = legAttrValueDict[attrID]
|
| | | if itemColor not in colorValueDict:
|
| | | continue
|
| | | legAttrIDList.append(attrID)
|
| | | legAttrValueList.append(colorValueDict[itemColor])
|
| | | |
| | | if not legAttrIDList or not legAttrValueList:
|
| | | return
|
| | | return ([], [legAttrIDList, legAttrValueList]) if isAdd else ([legAttrIDList, legAttrValueList], [])
|
| | |
|
| | | def __GetWingGMAddLegendAttrInfo(curPlayer, curItem, cmdList):
|
| | | isAdd = False
|
| | | cmdlen = len(cmdList)
|
| | | if cmdlen == 1:
|
| | | return ItemControler.GetAddEquipLegendAttr(curItem), []
|
| | | |
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | wingLegAttrValueDict = IpyGameDataPY.GetFuncEvalCfg("WingLegendAttrValue")
|
| | | if itemClassLV not in wingLegAttrValueDict:
|
| | | GameWorld.DebugAnswer(curPlayer, "该翅膀阶级无法获得传奇属性!itemClassLV=%s" % itemClassLV)
|
| | | return
|
| | | curClassLVLegAttrDict = wingLegAttrValueDict[itemClassLV]
|
| | | if cmdList[1] == 0:
|
| | | attrIDList = curClassLVLegAttrDict.keys()
|
| | | else:
|
| | | isAdd = True
|
| | | attrIDList = cmdList[1:]
|
| | | |
| | | legAttrIDList = []
|
| | | legAttrValueList = []
|
| | | for attrID in attrIDList:
|
| | | if attrID not in curClassLVLegAttrDict:
|
| | | GameWorld.DebugAnswer(curPlayer, "没有该翅膀传奇属性: %s" % attrID)
|
| | | continue
|
| | | legAttrIDList.append(attrID)
|
| | | legAttrValueList.append(random.choice(curClassLVLegAttrDict[attrID]))
|
| | | |
| | | if not legAttrIDList or not legAttrValueList:
|
| | | return
|
| | | return ([], [legAttrIDList, legAttrValueList]) if isAdd else ([legAttrIDList, legAttrValueList], [])
|
| | |
|
| | |
|