| | |
| | | # 纯随机类型及数值的规则
|
| | |
|
| | | itemType = curItem.GetType()
|
| | | equipTypeRandGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 2, {}) # 随机传奇属性类型组配置: {(装备类型1, 装备类型2, ...):[传奇属性类型组1, ...], ...}
|
| | | if itemType in equipTypeRandGroupDict:
|
| | | randGroupList = equipTypeRandGroupDict[itemType]
|
| | | else:
|
| | | randGroupList = []
|
| | | for typeTuple, groupList in equipTypeRandGroupDict.items():
|
| | | if not isinstance(typeTuple, tuple):
|
| | | continue
|
| | | if itemType in typeTuple:
|
| | | randGroupList = groupList
|
| | | break
|
| | | |
| | | equipTypeRandGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 2, {}) # 随机传奇属性类型组配置: {"装备类型":[传奇类型组1, 组2, ...], ...}
|
| | | if str(itemType) not in equipTypeRandGroupDict:
|
| | | return
|
| | | randGroupList = equipTypeRandGroupDict[str(itemType)]
|
| | | if not randGroupList:
|
| | | GameWorld.ErrLog("该物品类型没有传奇属性!itemType=%s" % itemType)
|
| | | return
|
| | |
|
| | | randLegendAttrIDLsit = []
|
| | | legendAttrGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 1, {}) # 传奇类型组 {1:[传奇属性类型ID组], ...}
|
| | | legendAttrGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 1, {}) # 传奇类型组 {"组ID":[属性ID1, 属性ID2], ...}
|
| | | for groupType in randGroupList:
|
| | | if groupType not in legendAttrGroupDict:
|
| | | if str(groupType) not in legendAttrGroupDict:
|
| | | GameWorld.ErrLog("没有配置传奇属性组对应传奇属性类型列表! groupType=%s" % groupType)
|
| | | continue
|
| | | randLegendAttrIDLsit += legendAttrGroupDict[groupType]
|
| | | randLegendAttrIDLsit += legendAttrGroupDict[str(groupType)]
|
| | |
|
| | | if not randLegendAttrIDLsit:
|
| | | return
|
| | |
|
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | randCountKey = (itemClassLV, itemQuality)
|
| | | randCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 3) # 随机条数: {(阶,星):[随机条数A, 随机条数B]], ...}
|
| | | if randCountKey not in randCountDict:
|
| | | randCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 3) # 随机条数: {"阶":{"星":[条数A, 条数B], ...}, ...}
|
| | | if str(itemClassLV) not in randCountDict:
|
| | | GameWorld.ErrLog("没有配置装备阶对应随机传奇属性条数: itemClassLV=%s" % (itemClassLV))
|
| | | return
|
| | | qualityCountDict = randCountDict[str(itemClassLV)]
|
| | | if str(itemQuality) not in qualityCountDict:
|
| | | GameWorld.ErrLog("没有配置装备阶星对应随机传奇属性条数: itemClassLV=%s, itemQuality=%s" % (itemClassLV, itemQuality))
|
| | | return
|
| | | randCountList = randCountDict[randCountKey]
|
| | | randCountList = qualityCountDict[str(itemQuality)]
|
| | | if not randCountList or len(randCountList) != 2:
|
| | | return
|
| | | legAttrCnt = random.randint(randCountList[0], randCountList[1])
|
| | |
| | | curLegAttrIDList = random.sample(randLegendAttrIDLsit, legAttrCnt)
|
| | | curLegAttrValueList = []
|
| | |
|
| | | randValueListDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 4) # 随机数值: {传奇属性类型:[随机数值1, 数值2, ...], ...}
|
| | | randValueListDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 4) # 随机数值: {"传奇属性ID":[随机数值1, 数值2, ...], ...}
|
| | | maxValueMinCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 5) # 保底最大数值条数: {(阶,星):条数, ...], ...} 没配置的默认0
|
| | | maxValueMinCount = maxValueMinCountDict.get((itemClassLV, itemQuality), 0)
|
| | | if legAttrCnt < maxValueMinCount:
|
| | |
| | | return
|
| | |
|
| | | for i, attrID in enumerate(curLegAttrIDList):
|
| | | if attrID not in randValueListDict:
|
| | | if str(attrID) not in randValueListDict:
|
| | | GameWorld.ErrLog("传奇属性没有配置随机数值范围或配置错误: attrID=%s" % (attrID))
|
| | | return
|
| | | randValueList = randValueListDict[attrID]
|
| | | randValueList = randValueListDict[str(attrID)]
|
| | | if i < maxValueMinCount:
|
| | | randValue = max(randValueList)
|
| | | else:
|