| | |
| | | if legendAttrIDCount and legendAttrValueCount and legendAttrIDCount == legendAttrValueCount:
|
| | | return
|
| | |
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem)
|
| | | curPlayer = self.__Player
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer)
|
| | | if not legendAttrInfo:
|
| | | return
|
| | |
|
| | |
| | |
|
| | | def CheckRolePackEquipAttr(self):
|
| | | ''' 玩家上线修复装备属性bug
|
| | | 版本1:邮件给装备没有传奇属性,检查无传奇属性装备
|
| | | 版本2:绝版属性数值调整,已获得的装备重新刷下
|
| | | '''
|
| | | curPlayer = self.__Player
|
| | | checkVersion = 20190103
|
| | | key = "LoginCheckEquipAttr"
|
| | | curVersion = curPlayer.NomalDictGetProperty(key)
|
| | | if curVersion == checkVersion:
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("玩家上线处理装备属性! curVersion=%s,checkVersion=%s" % (curVersion, checkVersion), playerID)
|
| | | |
| | | outOfPrintAttrItemDict = {} # 有绝版属性的定制物品属性信息 {itemID:[绝版属性ID列表, 绝版属性数值列表], ...}
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetAppointItemCount()):
|
| | | ipyData = ipyDataMgr.GetAppointItemByIndex(i)
|
| | | outOfPrintAttrList = ipyData.GetOutOfPrintAttr()
|
| | | outOfPrintAttrValueList = ipyData.GetOutOfPrintAttrValue()
|
| | | if not outOfPrintAttrList or len(outOfPrintAttrList) != len(outOfPrintAttrValueList):
|
| | | continue
|
| | | itemID = GetAppointItemRealID(ipyData.GetID())
|
| | | if not itemID:
|
| | | continue
|
| | | outOfPrintAttrItemDict[itemID] = [outOfPrintAttrList, outOfPrintAttrValueList]
|
| | | |
| | | checkPackList = [IPY_GameWorld.rptEquip, IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse]
|
| | | for packType in checkPackList:
|
| | | curPack = curPlayer.GetItemManager().GetPack(packType)
|
| | | for i in xrange(curPack.GetCount()):
|
| | | curItem = curPack.GetAt(i)
|
| | | #GameWorld.DebugLog("packType=%s,i=%s" % (packType, i))
|
| | | if curItem.IsEmpty():
|
| | | continue
|
| | | isEquip = ItemCommon.CheckItemIsEquip(curItem)
|
| | | if not isEquip:
|
| | | continue
|
| | | itemID = curItem.GetItemTypeID()
|
| | | self.CheckEquipAttr(packType, curItem)
|
| | | |
| | | # 重刷绝版属性
|
| | | if itemID in outOfPrintAttrItemDict:
|
| | | outOfPrintAttrList, outOfPrintAttrValueList = outOfPrintAttrItemDict[itemID]
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetOutOfPrintAttrID)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetOutOfPrintAttrValue)
|
| | | for outOfPrintAttrIndex in xrange(len(outOfPrintAttrList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetOutOfPrintAttrID, outOfPrintAttrList[outOfPrintAttrIndex])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetOutOfPrintAttrValue, outOfPrintAttrValueList[outOfPrintAttrIndex])
|
| | | GameWorld.Log(" 玩家登录重刷装备绝版属性: packType=%s,i=%s,itemID=%s,outOfPrintAttrList=%s,outOfPrintAttrValueList=%s" |
| | | % (packType, i, itemID, outOfPrintAttrList, outOfPrintAttrValueList), playerID)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, key, checkVersion)
|
| | | # curPlayer = self.__Player
|
| | | # checkVersion = 20190103
|
| | | # key = "LoginCheckEquipAttr"
|
| | | # curVersion = curPlayer.NomalDictGetProperty(key)
|
| | | # if curVersion == checkVersion:
|
| | | # return
|
| | | # playerID = curPlayer.GetPlayerID()
|
| | | # GameWorld.Log("玩家上线处理装备属性! curVersion=%s,checkVersion=%s" % (curVersion, checkVersion), playerID)
|
| | | # |
| | | # outOfPrintAttrItemDict = {} # 有绝版属性的定制物品属性信息 {itemID:[绝版属性ID列表, 绝版属性数值列表], ...}
|
| | | # ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | # for i in xrange(ipyDataMgr.GetAppointItemCount()):
|
| | | # ipyData = ipyDataMgr.GetAppointItemByIndex(i)
|
| | | # outOfPrintAttrList = ipyData.GetOutOfPrintAttr()
|
| | | # outOfPrintAttrValueList = ipyData.GetOutOfPrintAttrValue()
|
| | | # if not outOfPrintAttrList or len(outOfPrintAttrList) != len(outOfPrintAttrValueList):
|
| | | # continue
|
| | | # itemID = GetAppointItemRealID(ipyData.GetID())
|
| | | # if not itemID:
|
| | | # continue
|
| | | # outOfPrintAttrItemDict[itemID] = [outOfPrintAttrList, outOfPrintAttrValueList]
|
| | | # |
| | | # checkPackList = [IPY_GameWorld.rptEquip, IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse]
|
| | | # for packType in checkPackList:
|
| | | # curPack = curPlayer.GetItemManager().GetPack(packType)
|
| | | # for i in xrange(curPack.GetCount()):
|
| | | # curItem = curPack.GetAt(i)
|
| | | # #GameWorld.DebugLog("packType=%s,i=%s" % (packType, i))
|
| | | # if curItem.IsEmpty():
|
| | | # continue
|
| | | # isEquip = ItemCommon.CheckItemIsEquip(curItem)
|
| | | # if not isEquip:
|
| | | # continue
|
| | | # itemID = curItem.GetItemTypeID()
|
| | | # self.CheckEquipAttr(packType, curItem)
|
| | | # |
| | | # # 重刷绝版属性
|
| | | # if itemID in outOfPrintAttrItemDict:
|
| | | # outOfPrintAttrList, outOfPrintAttrValueList = outOfPrintAttrItemDict[itemID]
|
| | | # curItem.ClearUserAttr(ShareDefine.Def_IudetOutOfPrintAttrID)
|
| | | # curItem.ClearUserAttr(ShareDefine.Def_IudetOutOfPrintAttrValue)
|
| | | # for outOfPrintAttrIndex in xrange(len(outOfPrintAttrList)):
|
| | | # curItem.AddUserAttr(ShareDefine.Def_IudetOutOfPrintAttrID, outOfPrintAttrList[outOfPrintAttrIndex])
|
| | | # curItem.AddUserAttr(ShareDefine.Def_IudetOutOfPrintAttrValue, outOfPrintAttrValueList[outOfPrintAttrIndex])
|
| | | # GameWorld.Log(" 玩家登录重刷装备绝版属性: packType=%s,i=%s,itemID=%s,outOfPrintAttrList=%s,outOfPrintAttrValueList=%s" |
| | | # % (packType, i, itemID, outOfPrintAttrList, outOfPrintAttrValueList), playerID)
|
| | | # |
| | | # PlayerControl.NomalDictSetProperty(curPlayer, key, checkVersion)
|
| | | return
|
| | |
|
| | | ## 是否能放入物品
|
| | |
| | |
|
| | | ## 获取定制表物品数据
|
| | | # @param index 表index
|
| | | # @param isBind 是否绑定
|
| | | # @param isAuctionItem 是否拍品
|
| | | # @return ItemDictData
|
| | | def GetAppointItemDictData(index, isBind):
|
| | | def GetAppointItemDictData(index, isAuctionItem):
|
| | | itemID = GetAppointItemRealID(index)
|
| | | if not itemID:
|
| | | return {}
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("AppointItem", index)
|
| | | if not ipyData:
|
| | | GameWorld.ErrLog("GivePlayerAppointItem() Index=%s not data" % (index))
|
| | | GameWorld.ErrLog("GetAppointItemDictData() Index=%s not data" % (index))
|
| | | return {}
|
| | | itemDictData = {}
|
| | |
|
| | |
| | | itemDictData['CancelUseLimit'] = ipyData.GetCancelUseLimit()
|
| | |
|
| | | # 设置是否绑定
|
| | | isBind = 1 if not isAuctionItem else 0
|
| | | itemDictData['IsBind'] = isBind
|
| | |
|
| | | #装备绝版属性,随等级变化
|
| | |
| | | #---无空位置,替换---
|
| | | return placeList[0]
|
| | |
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isBind=1, expireTime=0):
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isAuctionItem=False, expireTime=0, curPlayer=None, isAllAttr=False):
|
| | | ''' 获取功能产出的物品实例
|
| | | @param isAuctionItem: 是否拍品,默认非拍品
|
| | | @param expireTime: 有效时间,时间单位由时效类型决定
|
| | | @param curPlayer: 产出该物品时的玩家,非拍品时需传入该值,物品某些属性由玩家等级决定,如传奇属性
|
| | | @param isAllAttr: 是否生成该装备所有属性,GM创建物品时用,需验证相关权限
|
| | | '''
|
| | | curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isBind, expireTime)
|
| | | curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isAuctionItem, expireTime)
|
| | | if not curItem:
|
| | | GameWorld.ErrLog("产出物品异常,无法创建物品 = %s" % (itemID))
|
| | | return
|
| | |
| | | if GetAppointItemRealID(itemID):
|
| | | curItem.Clear()
|
| | | #GameWorld.DebugLog("清除给定制物品之前已经创建的物品ID=%s" % itemID)
|
| | | return GetItemByData(GetAppointItemDictData(itemID, isBind))
|
| | | return GetItemByData(GetAppointItemDictData(itemID, isAuctionItem))
|
| | | |
| | | # 拍品不处理其他属性
|
| | | if isAuctionItem:
|
| | | return curItem
|
| | |
|
| | | tmpEquipData = SingleEquipTmpData()
|
| | |
|
| | | # 传奇属性
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem)
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr)
|
| | | if legendAttrInfo:
|
| | | tmpEquipData.legendAttrIDList = legendAttrInfo[0]
|
| | | tmpEquipData.legendAttrValueList = legendAttrInfo[1]
|
| | |
| | | ChItem.EquipAddAdditionEx(curItem, tmpEquipData)
|
| | | return curItem
|
| | |
|
| | | def GetAddEquipLegendAttr(curItem):
|
| | | def GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr=False):
|
| | | '''获取生成到装备上的传奇属性
|
| | | @return: None-没有传奇属性; 传奇属性字典-[[传奇属性效果ID列表], [属性值列表]]
|
| | | @return: None 或者 [[传奇属性效果ID列表], [属性值列表]]
|
| | | '''
|
| | | if not curItem.GetIsBind():
|
| | | #GameWorld.DebugLog("拍品无法生成传奇属性!")
|
| | | return
|
| | | itemID = curItem.GetItemTypeID()
|
| | | itemType = curItem.GetType()
|
| | | if itemType == ChConfig.Def_ItemType_retWing:
|
| | | return __GetAddWingLegendAttr(curItem)
|
| | | |
| | | isZhuXianEquip = ItemCommon.GetIsZhuXianEquip(curItem)
|
| | | if isZhuXianEquip:
|
| | | return __GetRandLegendAttr(curItem)
|
| | | |
| | | itemColor = curItem.GetItemColor()
|
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | key = (itemColor, itemQuality)
|
| | | isDogzEquip = ItemCommon.GetIsDogzEquip(curItem)
|
| | | # {(颜色,星级):[一般属性条数, 追求属性条数, 固定属性条数], ...}
|
| | | if isDogzEquip:
|
| | | #神兽装备条数不一样
|
| | | legAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrCount", 2)
|
| | | else:
|
| | | legAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrCount")
|
| | | if key not in legAttrCntDict:
|
| | | #GameWorld.DebugLog("该装备品质没有传奇属性: itemColor=%s,itemQuality=%s" % (itemColor, itemQuality))
|
| | | isSuit = 1 if curItem.GetSuiteID() else 0
|
| | | # 1. 定条数
|
| | | attrCountIpyData = IpyGameDataPY.GetIpyGameDataNotLog("EquipLegendAttrCount", itemType, itemColor, isSuit)
|
| | | if not attrCountIpyData:
|
| | | if itemColor >= ChConfig.Def_Quality_Purple:
|
| | | GameWorld.DebugLog("该装备没有传奇属性: itemID=%s" % (itemID))
|
| | | return
|
| | | commAttrCnt, goodAttrCnt, specAttrCnt = legAttrCntDict[key]
|
| | | |
| | | # {装备位:[[一般属性ID列表], [追求属性ID列表], [固定属性ID列表]], ...}
|
| | | equipPlace = curItem.GetEquipPlace()
|
| | | legAttrRuleDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRule")
|
| | | if equipPlace not in legAttrRuleDict:
|
| | | #GameWorld.DebugLog("该装备位没有传奇属性, equipPlace=%s" % equipPlace)
|
| | | fixedLegendAttrCount = attrCountIpyData.GetFixedLegendAttrCount()
|
| | | goodLegendAttrCount = attrCountIpyData.GetGoodLegendAttrCount()
|
| | | otherLegendAttrCount = attrCountIpyData.GetOtherLegendAttrCount()
|
| | | if fixedLegendAttrCount <= 0 and goodLegendAttrCount <= 0 and otherLegendAttrCount <= 0:
|
| | | return
|
| | | commAttrList, goodAttrList, specAttrList = legAttrRuleDict[equipPlace]
|
| | |
|
| | | randAttrIDList = [] # 先随机传奇属性类型
|
| | | if commAttrCnt:
|
| | | randAttrIDList.extend(random.sample(commAttrList, min(len(commAttrList), commAttrCnt)))
|
| | | if goodAttrCnt:
|
| | | randAttrIDList.extend(random.sample(goodAttrList, min(len(goodAttrList), goodAttrCnt)))
|
| | | if specAttrCnt:
|
| | | if type(specAttrList) == int:
|
| | | if specAttrList:
|
| | | randAttrIDList.append(specAttrList)
|
| | | else:
|
| | | randAttrIDList.extend(random.sample(specAttrList, min(len(specAttrList), specAttrCnt)))
|
| | | |
| | | if not curPlayer:
|
| | | GameWorld.ErrLog("生成装备传奇属性时玩家不存在!itemID=%s" % (itemID))
|
| | | return
|
| | | |
| | | playerID, playerLV = curPlayer.GetPlayerID(), curPlayer.GetLV()
|
| | | # 2. 定属性ID
|
| | | attrTypeIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrType", itemType)
|
| | | if not attrTypeIpyData:
|
| | | return
|
| | | fixedLegendAttrList = attrTypeIpyData.GetFixedLegendAttrList()
|
| | | goodLegendAttrList = attrTypeIpyData.GetGoodLegendAttrList()
|
| | | commLegendAttrList = attrTypeIpyData.GetCommLegendAttrList()
|
| | | curLegAttrIDList = []
|
| | | curLegAttrValueList = []
|
| | | # {属性ID:{颜色:数值, ...}, ...}
|
| | | if isDogzEquip:
|
| | | # 神兽装备数值不一样 |
| | | legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor2", 1, {})
|
| | | legAttrValueClassLVColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor2", 2, {})
|
| | | else:
|
| | | legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor", 1, {})
|
| | | legAttrValueClassLVColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor", 2, {})
|
| | | legAttrValueClassLVDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByClassLV")
|
| | | for attrID in randAttrIDList:
|
| | | if attrID in legAttrValueColorDict:
|
| | | colorValueDict = legAttrValueColorDict[attrID]
|
| | | if itemColor not in colorValueDict:
|
| | | GameWorld.ErrLog("没有配置传奇属性ID装备颜色对应的数值, attrID=%s,itemColor=%s" % (attrID, itemColor))
|
| | | continue
|
| | | attrValue = colorValueDict[itemColor]
|
| | | # {属性ID:{阶:{颜色:数值, ...}, ...}, ...}
|
| | | elif attrID in legAttrValueClassLVColorDict:
|
| | | classLVColorValueDict = legAttrValueClassLVColorDict[attrID]
|
| | | if itemClassLV in classLVColorValueDict:
|
| | | colorValueDict = classLVColorValueDict[itemClassLV]
|
| | | else:
|
| | | minClassLV, maxClassLV = min(classLVColorValueDict), max(classLVColorValueDict)
|
| | | if itemClassLV <= minClassLV:
|
| | | colorValueDict = classLVColorValueDict[minClassLV]
|
| | | elif itemClassLV >= maxClassLV:
|
| | | colorValueDict = classLVColorValueDict[maxClassLV]
|
| | | else:
|
| | | GameWorld.ErrLog("没有配置传奇属性ID装备阶级颜色对应的数值, attrID=%s,itemClassLV=%s" % (attrID, itemClassLV))
|
| | | continue
|
| | | if itemColor not in colorValueDict:
|
| | | GameWorld.ErrLog("没有配置传奇属性ID装备阶级颜色对应的数值, attrID=%s,itemClassLV=%s,itemColor=%s" % (attrID, itemClassLV, itemColor))
|
| | | continue
|
| | | attrValue = colorValueDict[itemColor]
|
| | | elif attrID in legAttrValueClassLVDict:
|
| | | classLVValueDict = legAttrValueClassLVDict[attrID]
|
| | | if itemClassLV in classLVValueDict:
|
| | | attrValue = classLVValueDict[itemClassLV]
|
| | | else:
|
| | | minClassLV, maxClassLV = min(classLVValueDict), max(classLVValueDict)
|
| | | if itemClassLV <= minClassLV:
|
| | | attrValue = classLVValueDict[minClassLV]
|
| | | elif itemClassLV >= maxClassLV:
|
| | | attrValue = classLVValueDict[maxClassLV]
|
| | | else:
|
| | | GameWorld.ErrLog("没有配置传奇属性ID装备阶级对应的数值, attrID=%s,itemClassLV=%s" % (attrID, itemClassLV))
|
| | | continue
|
| | | else:
|
| | | GameWorld.ErrLog("没有配置传奇属性ID对应的数值, attrID=%s" % attrID)
|
| | | continue
|
| | | |
| | | curLegAttrIDList.append(attrID)
|
| | | curLegAttrValueList.append(attrValue)
|
| | | # GameWorld.DebugLog("itemClassLV=%s,itemColor=%s,itemQuality=%s,commAttrCnt=%s,goodAttrCnt=%s,specAttrCnt=%s" |
| | | # % (itemClassLV, itemColor, itemQuality, commAttrCnt, goodAttrCnt, specAttrCnt))
|
| | | # GameWorld.DebugLog("commAttrList=%s, goodAttrList=%s, specAttrList=%s" % (commAttrList, goodAttrList, specAttrList))
|
| | | # GameWorld.DebugLog("randAttrIDList=%s,curLegAttrIDList=%s, curLegAttrValueList=%s" |
| | | # % (randAttrIDList, curLegAttrIDList, curLegAttrValueList))
|
| | | return [curLegAttrIDList, curLegAttrValueList]
|
| | |
|
| | | def __GetRandLegendAttr(curItem):
|
| | | # 纯随机类型及数值的规则
|
| | | |
| | | itemType = curItem.GetType()
|
| | | 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, {}) # 传奇类型组 {"组ID":[属性ID1, 属性ID2], ...}
|
| | | for groupType in randGroupList:
|
| | | if str(groupType) not in legendAttrGroupDict:
|
| | | GameWorld.ErrLog("没有配置传奇属性组对应传奇属性类型列表! groupType=%s" % groupType)
|
| | | continue
|
| | | randLegendAttrIDLsit += legendAttrGroupDict[str(groupType)]
|
| | | |
| | | if not randLegendAttrIDLsit:
|
| | | return
|
| | | |
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | 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 = qualityCountDict[str(itemQuality)]
|
| | | if not randCountList or len(randCountList) != 2:
|
| | | return
|
| | | legAttrCnt = random.randint(randCountList[0], randCountList[1])
|
| | | legAttrCnt = min(len(randLegendAttrIDLsit), legAttrCnt)
|
| | | curLegAttrIDList = random.sample(randLegendAttrIDLsit, legAttrCnt)
|
| | | curLegAttrValueList = []
|
| | | |
| | | randValueListDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 4) # 随机数值: {"传奇属性ID":[随机数值1, 数值2, ...], ...}
|
| | | maxValueMinCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 5) # 保底最大数值条数: {(阶,星):条数, ...], ...} 没配置的默认0
|
| | | maxValueMinCount = maxValueMinCountDict.get((itemClassLV, itemQuality), 0)
|
| | | if legAttrCnt < maxValueMinCount:
|
| | | GameWorld.ErrLog("传奇属性条数少于保底最大数值条数: itemClassLV=%s, itemQuality=%s, legAttrCnt=%s, maxValueMinCount=%s" |
| | | % (itemClassLV, itemQuality, legAttrCnt, maxValueMinCount))
|
| | | return
|
| | | |
| | | for i, attrID in enumerate(curLegAttrIDList):
|
| | | if str(attrID) not in randValueListDict:
|
| | | GameWorld.ErrLog("传奇属性没有配置随机数值范围或配置错误: attrID=%s" % (attrID))
|
| | | if isAllAttr:
|
| | | if curPlayer.GetGMLevel() != 90:
|
| | | return
|
| | | randValueList = randValueListDict[str(attrID)]
|
| | | if i < maxValueMinCount:
|
| | | randValue = max(randValueList)
|
| | | else:
|
| | | randValue = random.choice(randValueList)
|
| | | curLegAttrValueList.append(randValue)
|
| | | |
| | | # GameWorld.DebugLog("itemType=%s,itemClassLV=%s,itemQuality=%s,randLegendAttrIDLsit=%s" % (itemType, itemClassLV, itemQuality, randLegendAttrIDLsit))
|
| | | # GameWorld.DebugLog("legAttrCnt=%s,maxValueMinCount=%s" % (legAttrCnt, maxValueMinCount))
|
| | | # GameWorld.DebugLog("curLegAttrIDList=%s,curLegAttrValueList=%s" % (curLegAttrIDList, curLegAttrValueList))
|
| | | curLegAttrIDList = fixedLegendAttrList + goodLegendAttrList + commLegendAttrList
|
| | | else:
|
| | | if fixedLegendAttrCount:
|
| | | if len(fixedLegendAttrList) < fixedLegendAttrCount:
|
| | | GameWorld.ErrLog("装备固定传奇属性配置不足!itemID=%s,itemType=%s,fixedLegendAttrCount=%s,fixedLegendAttrList=%s" |
| | | % (itemID, itemType, fixedLegendAttrCount, fixedLegendAttrList), playerID)
|
| | | return
|
| | | curLegAttrIDList += fixedLegendAttrList[:fixedLegendAttrCount]
|
| | | |
| | | if goodLegendAttrCount:
|
| | | if len(goodLegendAttrList) < goodLegendAttrCount:
|
| | | GameWorld.ErrLog("装备追求传奇属性配置不足!itemID=%s,itemType=%s,goodLegendAttrCount=%s,goodLegendAttrList=%s" |
| | | % (itemID, itemType, goodLegendAttrCount, goodLegendAttrList), playerID)
|
| | | return
|
| | | curLegAttrIDList += random.sample(goodLegendAttrList, goodLegendAttrCount)
|
| | | |
| | | if otherLegendAttrCount:
|
| | | otherLegendAttrList = list(goodLegendAttrList) + list(commLegendAttrList)
|
| | | for curAttrID in curLegAttrIDList:
|
| | | if curAttrID in otherLegendAttrList:
|
| | | otherLegendAttrList.remove(curAttrID)
|
| | | if len(otherLegendAttrList) < otherLegendAttrCount:
|
| | | GameWorld.ErrLog("装备一般传奇属性配置不足!itemID=%s,itemType=%s,otherLegendAttrCount=%s,otherLegendAttrList=%s" |
| | | % (itemID, itemType, otherLegendAttrCount, otherLegendAttrList), playerID)
|
| | | return
|
| | | curLegAttrIDList += random.sample(otherLegendAttrList, otherLegendAttrCount)
|
| | | |
| | | # 3. 定数值
|
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | attrValueIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrValue", itemType, itemClassLV, itemColor, isSuit)
|
| | | if not attrValueIpyData:
|
| | | GameWorld.ErrLog("传奇属性等级数值表找不到配置!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" |
| | | % (itemID, itemType, itemClassLV, itemColor, isSuit), playerID)
|
| | | return
|
| | | #GameWorld.DebugLog("随机传奇属性: itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" |
| | | # % (itemID, itemType, itemClassLV, itemColor, isSuit, ), playerID)
|
| | | #GameWorld.DebugLog(" 固定条数=%s-%s,追求条数=%s-%s,其他条数=%s-%s" |
| | | # % (fixedLegendAttrCount, fixedLegendAttrList, goodLegendAttrCount, goodLegendAttrList, |
| | | # otherLegendAttrCount, commLegendAttrList), playerID) |
| | | attrLVLibNumDict = attrValueIpyData.GetLVLegendAttrLibNumInfo() # {属性ID:{等级:库编号, ...}}
|
| | | for attrID in curLegAttrIDList:
|
| | | if attrID not in attrLVLibNumDict:
|
| | | GameWorld.ErrLog("传奇属性等级数值表没有配置属性ID对应等级库编号!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s,attrID=%s" |
| | | % (itemID, itemType, itemClassLV, itemColor, isSuit, attrID), playerID)
|
| | | return
|
| | | curLibNum = None
|
| | | lvAttrLibList = attrLVLibNumDict[attrID]
|
| | | for lv, libNum in lvAttrLibList:
|
| | | if playerLV <= lv:
|
| | | curLibNum = libNum
|
| | | break
|
| | | if curLibNum == None:
|
| | | GameWorld.ErrLog("传奇属性等级数值表找不到属性ID对应等级库编号!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s,attrID=%s,playerLV=%s" |
| | | % (itemID, itemType, itemClassLV, itemColor, isSuit, attrID, playerLV), playerID)
|
| | | return
|
| | | attrLibIpyData = attrValueIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrLib", attrID)
|
| | | if not attrLibIpyData:
|
| | | GameWorld.ErrLog("传奇属性库不存在传奇属性ID配置!itemID=%s,attrID=%s" % (itemID, attrID), playerID)
|
| | | return
|
| | | attrLibDict = attrLibIpyData.GetLegendAttrLib() # {库编号:[随机数值, ...], ...}
|
| | | if curLibNum not in attrLibDict:
|
| | | GameWorld.ErrLog("传奇属性库编号不存在!itemID=%s,attrID=%s,curLibNum=%s" % (itemID, attrID, curLibNum), playerID)
|
| | | return
|
| | | valueList = attrLibDict[curLibNum]
|
| | | attrValue = random.choice(valueList)
|
| | | curLegAttrValueList.append(attrValue)
|
| | | #GameWorld.DebugLog(" 随机属性: attrID=%s,attrValue=%s,playerLV=%s,curLibNum=%s,valueList=%s" |
| | | # % (attrID, attrValue, playerLV, curLibNum, valueList), playerID)
|
| | | return [curLegAttrIDList, curLegAttrValueList]
|
| | |
|
| | | def __GetAddWingLegendAttr(curItem):
|
| | | # {阶数:条数, ...}
|
| | | wingLegAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("WingLegendAttrCount")
|
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | if itemClassLV not in wingLegAttrCntDict:
|
| | | GameWorld.DebugLog("该翅膀阶级没有传奇属性, 阶数=%s" % itemClassLV)
|
| | | return
|
| | | legAttrCnt = wingLegAttrCntDict[itemClassLV]
|
| | | # {阶数:{属性ID1:[数值随机列表], 属性ID2:[数值随机列表]},阶数:{属性ID1:[数值随机列表], 属性ID2:[数值随机列表]},...}
|
| | | wingLegAttrValueDict = IpyGameDataPY.GetFuncEvalCfg("WingLegendAttrValue")
|
| | | if itemClassLV not in wingLegAttrValueDict:
|
| | | GameWorld.ErrLog("该翅膀阶级没有配置对应的传奇属性数值, 阶数=%s" % itemClassLV) |
| | | return
|
| | | curClassLVLegAttrDict = wingLegAttrValueDict[itemClassLV]
|
| | | attrIDList = curClassLVLegAttrDict.keys()
|
| | | legAttrCnt = min(len(attrIDList), legAttrCnt)
|
| | | GameWorld.DebugLog("生成翅膀传奇属性: itemClassLV=%s,legAttrCnt=%s,attrIDList=%s" % (itemClassLV, legAttrCnt, attrIDList))
|
| | | if not legAttrCnt:
|
| | | return
|
| | | curLegAttrIDList = random.sample(attrIDList, legAttrCnt)
|
| | | #curLegAttrIDList.sort()
|
| | | curLegAttrValueList = [random.choice(curClassLVLegAttrDict[attrID]) for attrID in curLegAttrIDList]
|
| | | GameWorld.DebugLog(" curLegAttrIDList=%s, curLegAttrValueList=%s" % (curLegAttrIDList, curLegAttrValueList))
|
| | | return [curLegAttrIDList, curLegAttrValueList]
|
| | |
|
| | | ##创建物品所需的动态数据
|
| | | #
|