| | |
| | | @param isAuctionItem: 是否拍品,默认非拍品
|
| | | @param expireTime: 有效时间,时间单位由时效类型决定
|
| | | '''
|
| | | if itemCount < 1:
|
| | | if itemCount < 1 or not itemID:
|
| | | GameWorld.ErrLog("创建物品个数不能少于1! itemID=%s,itemCount=%s" % (itemID, itemCount))
|
| | | return
|
| | | curSingleItem = GameWorld.GetItemFactory().CreateItem(itemID)
|
| | |
| | | if setAttrDict == None:
|
| | | curSingleItem.Clear()
|
| | | return
|
| | | elif GetIsMGGuayu(curSingleItem):
|
| | | setAttrDict = GetCreateMGGuayuAttr(curSingleItem, curPlayer, setAttrDict)
|
| | | if setAttrDict == None:
|
| | | curSingleItem.Clear()
|
| | | return
|
| | | AddCreateItemAttr(curSingleItem, setAttrDict)
|
| | |
|
| | | #这里返回的是SingleItem , 如果创建了,未使用,会找出C++内存泄露!!!
|
| | |
| | | @param curPlayer: 可能为None
|
| | | @param setAttrDict: 直接设置物品的属性 {key:value, ...} key支持 ShareDefine.Def_IudetXXX字符串 或 自定key
|
| | | @return: None - 异常情况,物品实例需要clear
|
| | | equipAttrDict - 生成后的最新属性k:v字典,可直接用于 SetCreateEquipAttr
|
| | | equipAttrDict - 生成后的最新属性k:v字典,可直接用于 AddCreateItemAttr
|
| | | '''
|
| | | if setAttrDict == None:
|
| | | setAttrDict = {}
|
| | |
| | | GameWorld.DebugLog(" legendAttrIDList=%s,legendAttrValueList=%s" % (legendAttrIDList, legendAttrValueList), playerID)
|
| | |
|
| | | GameWorld.DebugLog(" 装备最终属性: equipAttrDict=%s,setAttrDict=%s" % (equipAttrDict, setAttrDict), playerID)
|
| | | return equipAttrDict
|
| | |
|
| | | def GetCreateMGGuayuAttr(curItem, curPlayer=None, setAttrDict=None):
|
| | | '''获取生成命格卦玉所有属性
|
| | | @param curPlayer: 可能为None
|
| | | @param setAttrDict: 直接设置物品的属性 {key:value, ...} key支持 ShareDefine.Def_IudetXXX字符串 或 自定key
|
| | | @return: None - 异常情况,物品实例需要clear
|
| | | equipAttrDict - 生成后的最新属性k:v字典,可直接用于 AddCreateItemAttr
|
| | | '''
|
| | | if setAttrDict == None:
|
| | | setAttrDict = {}
|
| | | playerID = 0 if not curPlayer else curPlayer.GetPlayerID()
|
| | | itemID = curItem.GetItemTypeID()
|
| | | itemType = curItem.GetType()
|
| | | itemColor = curItem.GetItemColor()
|
| | | equipAttrDict = {}
|
| | | |
| | | # 定制属性,如有需要可扩展
|
| | | |
| | | if not curPlayer:
|
| | | return
|
| | | |
| | | gwLV = max(1, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MGGanwuLV))
|
| | | gwIpyData = IpyGameDataPY.GetIpyGameData("MGGanwuLV", gwLV)
|
| | | colorIpyData = IpyGameDataPY.GetIpyGameData("MGGuayuQuality", itemColor)
|
| | | typeIpyData = IpyGameDataPY.GetIpyGameData("MGGuayuType", itemType)
|
| | | if not gwIpyData or not colorIpyData or not typeIpyData:
|
| | | return
|
| | | |
| | | # 四维基础值、加成值
|
| | | baseAttrDict = {ChConfig.AttrID_Atk:[gwIpyData.GetAtkBase(), colorIpyData.GetAtkPlus()],
|
| | | ChConfig.AttrID_Def:[gwIpyData.GetDefBase(), colorIpyData.GetDefPlus()],
|
| | | ChConfig.AttrID_MaxHP:[gwIpyData.GetHPBase(), colorIpyData.GetHPPlus()],
|
| | | ChConfig.AttrID_AtkSpeed:[gwIpyData.GetAtkSpeedBase(), colorIpyData.GetAtkSpeedPlus()],
|
| | | }
|
| | | # 四维占比
|
| | | attrProportion = typeIpyData.GetBaseAttrProportion()
|
| | | |
| | | randfloat = random.uniform # 随机一个ab区间的数 [a, b],ab支持小数
|
| | | |
| | | itemLV = setAttrDict.get(str(ShareDefine.Def_IudetItemLV), 0)
|
| | | if not itemLV:
|
| | | # 随机等级
|
| | | lowLV, highLV = IpyGameDataPY.GetFuncEvalCfg("MinggeTY", 2)
|
| | | randLVList = range(max(gwLV + lowLV, 1), gwLV + highLV)
|
| | | itemLV = random.choice(randLVList)
|
| | | equipAttrDict[str(ShareDefine.Def_IudetItemLV)] = itemLV
|
| | | |
| | | GameWorld.DebugLog("生成命格卦玉: itemID=%s,itemLV=%s,itemColor=%s,itemType=%s" % (itemID, itemLV, itemColor, itemType), playerID)
|
| | | legendAttrIDList = setAttrDict.get(str(ShareDefine.Def_IudetLegendAttrID))
|
| | | legendAttrValueList = setAttrDict.get(str(ShareDefine.Def_IudetLegendAttrValue))
|
| | | if legendAttrIDList != None and legendAttrValueList != None and len(legendAttrIDList) == len(legendAttrValueList):
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrID)] = legendAttrIDList
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrValue)] = legendAttrValueList
|
| | | else:
|
| | | fixedAttrID = typeIpyData.GetFixedAttrID() # 固定属性
|
| | | attrIDLib = typeIpyData.GetAttrIDLib() # 随机属性库
|
| | | libAttrCnt = colorIpyData.GetAttrLibCnt() # 随机属性个数
|
| | | |
| | | attrRangeDefault = colorIpyData.GetAttrRange()
|
| | | attrRangeDict = colorIpyData.GetAttrRangeDict()
|
| | | |
| | | random.shuffle(attrIDLib)
|
| | | randAttrList = attrIDLib[:libAttrCnt]
|
| | | attrIDList = [fixedAttrID] + randAttrList
|
| | | GameWorld.DebugLog(" attrIDList=%s,libAttrCnt=%s,%s" % (attrIDList, libAttrCnt, attrIDLib), playerID)
|
| | | |
| | | legendAttrIDList = []
|
| | | legendAttrValueList = []
|
| | | for attrID in attrIDList:
|
| | | |
| | | # 基础四维计算
|
| | | if attrID in baseAttrDict:
|
| | | baseValue, plusValue = baseAttrDict[attrID]
|
| | | attrValue = eval(IpyGameDataPY.GetFuncCompileCfg("MinggeTY", 3))
|
| | | GameWorld.DebugLog(" attrID=%s,attrValue=%s,baseValue=%s,plusValue=%s,attrProportion=%s" |
| | | % (attrID, attrValue, baseValue, plusValue, attrProportion), playerID)
|
| | | |
| | | # 其他战斗属性
|
| | | else:
|
| | | attrRange = attrRangeDict.get(attrID, attrRangeDefault)
|
| | | if not attrRange or len(attrRange) != 2:
|
| | | continue
|
| | | attrMin, attrMax = attrRange
|
| | | attrValue = random.randint(attrMin, attrMax)
|
| | | GameWorld.DebugLog(" attrID=%s,attrValue=%s(%s~%s)" % (attrID, attrValue, attrMin, attrMax), playerID)
|
| | | |
| | | legendAttrIDList.append(attrID)
|
| | | legendAttrValueList.append(attrValue)
|
| | | |
| | | if legendAttrIDList:
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrID)] = legendAttrIDList
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrValue)] = legendAttrValueList
|
| | | |
| | | # 意象技能
|
| | | if itemType in IpyGameDataPY.GetFuncEvalCfg("MinggeTY", 4):
|
| | | yxSkillTypeIDList = IpyGameDataPY.GetFuncEvalCfg("MinggeTY", 5)
|
| | | randSkillTypeID = random.choice(yxSkillTypeIDList) if yxSkillTypeIDList else 0
|
| | | if randSkillTypeID:
|
| | | equipAttrDict[str(ShareDefine.Def_IudetAddSkillID)] = [randSkillTypeID]
|
| | | GameWorld.DebugLog(" itemType=%s,randSkillTypeID=%s" % (itemType, randSkillTypeID), playerID)
|
| | | |
| | | GameWorld.DebugLog(" 卦玉最终属性: equipAttrDict=%s,setAttrDict=%s" % (equipAttrDict, setAttrDict), playerID)
|
| | | return equipAttrDict
|
| | |
|
| | | def SetItemUserData(curItem, dataInfo):
|
| | |
| | | ## 返回是否神兽装备
|
| | | return curItem.GetType() in ChConfig.Def_DogzEquiipType
|
| | |
|
| | | def GetIsMGGuayu(curItem):
|
| | | ## 是否命格卦玉
|
| | | return curItem.GetType() in ChConfig.Def_MGGuayuType
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ##遍历数据库查找合适的物品, 通过 效果ID + 效果A值确定物品
|
| | | # @param itemType 物品类型
|