|  |  |  | 
|---|
|  |  |  | import DataRecordPack | 
|---|
|  |  |  | import EventReport | 
|---|
|  |  |  | import ChItem | 
|---|
|  |  |  | import PlayerMergeEvent | 
|---|
|  |  |  | import IpyGameDataPY | 
|---|
|  |  |  | import Operate_EquipStone | 
|---|
|  |  |  | import PlayerViewCacheTube | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("物品过期时间" + timeStr) | 
|---|
|  |  |  | return GameWorld.ChangeTimeStrToNum(timeStr) | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 创建物品 | 
|---|
|  |  |  | #  @param itemID 物品ID | 
|---|
|  |  |  | #  @return curSingleItem | 
|---|
|  |  |  | #  @remarks 函数详细说明. | 
|---|
|  |  |  | def CreateSingleItem(itemID, itemCount=1, isBind=0): | 
|---|
|  |  |  | def CreateSingleItem(itemID, itemCount=1, isAuctionItem=False, expireTime=0): | 
|---|
|  |  |  | ''' 创建物品 | 
|---|
|  |  |  | @param isAuctionItem: 是否拍品,默认非拍品 | 
|---|
|  |  |  | @param expireTime: 有效时间,时间单位由时效类型决定 | 
|---|
|  |  |  | ''' | 
|---|
|  |  |  | if itemCount < 1: | 
|---|
|  |  |  | GameWorld.ErrLog("创建物品个数不能少于1! itemID=%s,itemCount=%s" % (itemID, itemCount)) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | curSingleItem = GameWorld.GetItemFactory().CreateItem(itemID) | 
|---|
|  |  |  | if not curSingleItem: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  | curSingleItem.SetRemainHour(outTimeServerDay) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if isBind: | 
|---|
|  |  |  | curSingleItem.SetIsBind(1) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if isAuctionItem: | 
|---|
|  |  |  | if IpyGameDataPY.GetIpyGameDataNotLog("AuctionItem", itemID): | 
|---|
|  |  |  | ItemControler.SetIsAuctionItem(curSingleItem, isAuctionItem) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | GameWorld.ErrLog("拍卖物品表不存在该ID!创建拍品失败,默认转为非拍品!itemID=%s" % itemID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ItemControler.SetItemCount(curSingleItem, itemCount) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if expireTime > 0: | 
|---|
|  |  |  | curSingleItem.SetUserAttr(ShareDefine.Def_IudetExpireTime, expireTime) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #这里返回的是SingleItem , 如果创建了,未使用,会找出C++内存泄露!!! | 
|---|
|  |  |  | return curSingleItem | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def UpdateItemUserData(curItem, updateDict={}, delKeyList=[], isUpdateGS=False): | 
|---|
|  |  |  | ''' 更新物品UserData数据 | 
|---|
|  |  |  | @param curItem: IPY_SingleItem 或  IPY_RoleItem | 
|---|
|  |  |  | @param updateDict: 需要更新的数据 {key:value, key:valueList, ...} | 
|---|
|  |  |  | @param delKeyList: 需要删除的数据 key列表[key, ...] | 
|---|
|  |  |  | @param isUpdateGS: 是否更新评分 | 
|---|
|  |  |  | @note: UserData格式举例 {'17':['65','7','52'],'50':['0'],'19':['420','380','50'],'50':['1552728662']} | 
|---|
|  |  |  | ''' | 
|---|
|  |  |  |  | 
|---|
|  |  |  | isRoleItem = False | 
|---|
|  |  |  | if not hasattr(curItem, "SetUserData"): | 
|---|
|  |  |  | item = curItem.GetItem() | 
|---|
|  |  |  | isRoleItem = True | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | item = curItem | 
|---|
|  |  |  | userData = item.GetUserData() | 
|---|
|  |  |  | if not userData: | 
|---|
|  |  |  | userDataDict = {} | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | userDataDict = eval(userData) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for delKey in delKeyList: | 
|---|
|  |  |  | userDataDict.pop(str(delKey), None) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for key, value in updateDict.items(): | 
|---|
|  |  |  | if type(value) == int: | 
|---|
|  |  |  | valueList = ['%s' % value] | 
|---|
|  |  |  | elif type(value) == list: | 
|---|
|  |  |  | valueList = ['%s' % v for v in value] | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | userDataDict['%s' % key] = valueList | 
|---|
|  |  |  |  | 
|---|
|  |  |  | UserData = str(userDataDict).replace(" ", "") | 
|---|
|  |  |  | item.SetUserData(UserData, len(UserData)) | 
|---|
|  |  |  | if isUpdateGS: | 
|---|
|  |  |  | MakeEquipGS(curItem) | 
|---|
|  |  |  | elif isRoleItem: | 
|---|
|  |  |  | curItem.SetCount(curItem.GetCount()) # 为了触发物品同步 | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def MakeEquipGS(curItem): | 
|---|
|  |  |  | if not CheckNoteEquipGS(curItem): | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def CalcEquipGS(curItem): | 
|---|
|  |  |  | ##计算装备评分 | 
|---|
|  |  |  | '''计算装备评分 | 
|---|
|  |  |  | 评分组成:装备基础 + 传奇属性 + 绝版属性 | 
|---|
|  |  |  | ''' | 
|---|
|  |  |  | if not CheckNoteEquipGS(curItem): | 
|---|
|  |  |  | #GameWorld.DebugLog("不设置装备评分") | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | 
|---|
|  |  |  | break | 
|---|
|  |  |  | attrDict[effectID] = attrDict.get(effectID, 0) + curEffect.GetEffectValue(0) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | gsParamIpyData = None | 
|---|
|  |  |  | classLV = GetItemClassLV(curItem) | 
|---|
|  |  |  | color = curItem.GetItemColor() | 
|---|
|  |  |  | isSuit = 1 if curItem.GetSuiteID() > 0 else 0 | 
|---|
|  |  |  | gsParamIpyData = IpyGameDataPY.GetIpyGameData("EquipGSParam", classLV, color, isSuit) | 
|---|
|  |  |  | # 传奇属性 | 
|---|
|  |  |  | legendAttrIDCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID) | 
|---|
|  |  |  | legendAttrValueCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue) | 
|---|
|  |  |  | if legendAttrIDCnt and legendAttrIDCnt == legendAttrValueCnt: | 
|---|
|  |  |  | classLV = GetItemClassLV(curItem) | 
|---|
|  |  |  | color = curItem.GetItemColor() | 
|---|
|  |  |  | itemQuality = curItem.GetItemQuality() | 
|---|
|  |  |  | gsParamIpyData = IpyGameDataPY.GetIpyGameData("EquipGSParam", classLV, color, itemQuality) | 
|---|
|  |  |  | for i in xrange(legendAttrIDCnt): | 
|---|
|  |  |  | attrID = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrID, i) | 
|---|
|  |  |  | attrValue = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValue, i) | 
|---|
|  |  |  | attrDict[attrID] = attrDict.get(attrID, 0) + attrValue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | MinAtk = attrDict.get(ShareDefine.Def_Effect_MinAtk, 0) | 
|---|
|  |  |  | MaxAtk = attrDict.get(ShareDefine.Def_Effect_MaxAtk, 0) | 
|---|
|  |  |  | Atk = attrDict.get(ShareDefine.Def_Effect_Atk, 0) | 
|---|
|  |  |  | MinAtk = attrDict.get(ShareDefine.Def_Effect_MinAtk, 0) + Atk | 
|---|
|  |  |  | MaxAtk = attrDict.get(ShareDefine.Def_Effect_MaxAtk, 0) + Atk | 
|---|
|  |  |  | MaxHP = attrDict.get(ShareDefine.Def_Effect_MaxHP, 0) | 
|---|
|  |  |  | Def = attrDict.get(ShareDefine.Def_Effect_Def, 0) | 
|---|
|  |  |  | ArmorDefPer = attrDict.get(ShareDefine.Def_Effect_ArmorDefAddPer, 0) | 
|---|
|  |  |  | ArmorDefPer = 0 | 
|---|
|  |  |  | IceAtk = attrDict.get(ShareDefine.Def_Effect_IceAtk, 0) | 
|---|
|  |  |  | IceDef = attrDict.get(ShareDefine.Def_Effect_IceDef, 0) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | AtkPer = attrDict.get(ShareDefine.Def_Effect_AddAtkByPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetAtkPerC()) | 
|---|
|  |  |  | DamagePer = attrDict.get(ShareDefine.Def_Effect_DamagePer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDamagePerC()) | 
|---|
|  |  |  | SuperHitRate = attrDict.get(ShareDefine.Def_Effect_SuperHitRate, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSuperHitRateC()) | 
|---|
|  |  |  | BaseEquipMaxHPAddPer = attrDict.get(ShareDefine.Def_Effect_BaseEquipMaxHPAddPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetBaseEquipMaxHPAddPerC()) | 
|---|
|  |  |  | BaseEquipAtkAddPer = attrDict.get(ShareDefine.Def_Effect_BaseEquipAtkAddPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetBaseEquipAtkAddPerC()) | 
|---|
|  |  |  | AtkPer = 0#attrDict.get(ShareDefine.Def_Effect_AddAtkByPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetAtkPerC()) | 
|---|
|  |  |  | DamagePer = 0#attrDict.get(ShareDefine.Def_Effect_DamagePer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDamagePerC()) | 
|---|
|  |  |  | SuperHitRate = 0#attrDict.get(ShareDefine.Def_Effect_SuperHitRate, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSuperHitRateC()) | 
|---|
|  |  |  | SuperHit = attrDict.get(ShareDefine.Def_Effect_SuperHit, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSuperHitC()) | 
|---|
|  |  |  | SuperHitPer = attrDict.get(ShareDefine.Def_Effect_SuperHitPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSuperHitPerC()) | 
|---|
|  |  |  | DamReducePer = attrDict.get(ShareDefine.Def_Effect_DamReducePer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDamReducePerC()) | 
|---|
|  |  |  | MaxHPPer = attrDict.get(ShareDefine.Def_Effect_MaxHPPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetMaxHPPerC()) | 
|---|
|  |  |  | DefPer = attrDict.get(ShareDefine.Def_Effect_DefPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDefPerC()) | 
|---|
|  |  |  | DamReducePer = 0#attrDict.get(ShareDefine.Def_Effect_DamReducePer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDamReducePerC()) | 
|---|
|  |  |  | MaxHPPer = 0#attrDict.get(ShareDefine.Def_Effect_MaxHPPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetMaxHPPerC()) | 
|---|
|  |  |  | DefPer = 0#attrDict.get(ShareDefine.Def_Effect_DefPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDefPerC()) | 
|---|
|  |  |  | LuckyHitRate = attrDict.get(ShareDefine.Def_Effect_LuckyHitRate, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetLuckyHitRateC()) | 
|---|
|  |  |  | PetDamPer = attrDict.get(ShareDefine.Def_Effect_PetDamPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetPetDamPerC()) | 
|---|
|  |  |  | LuckyHitRateReduce = attrDict.get(ShareDefine.Def_Effect_LuckyHitRateReduce, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetLuckyHitRateReduceC()) | 
|---|
|  |  |  | LuckyHit = attrDict.get(ShareDefine.Def_Effect_LuckyHit, 0) | 
|---|
|  |  |  | LuckyHitReduce = attrDict.get(ShareDefine.Def_Effect_LuckyHitReduce, 0) | 
|---|
|  |  |  | LuckPer = attrDict.get(ShareDefine.Def_Effect_LuckPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetLuckPerC()) | 
|---|
|  |  |  | PetDamPer = 0#attrDict.get(ShareDefine.Def_Effect_PetDamPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetPetDamPerC()) | 
|---|
|  |  |  | PerLVAtk = attrDict.get(ShareDefine.Def_Effect_PerLVAtk, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetPerLVAtkC()) | 
|---|
|  |  |  | MissRate = attrDict.get(ShareDefine.Def_Effect_MissRate, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetMissRateC()) | 
|---|
|  |  |  | HitRate = attrDict.get(ShareDefine.Def_Effect_HitRate, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetHitRateC()) | 
|---|
|  |  |  | DamBackPer = attrDict.get(ShareDefine.Def_Effect_DamBackPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDamBackPerC()) | 
|---|
|  |  |  | MissRate = 0#attrDict.get(ShareDefine.Def_Effect_MissRate, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetMissRateC()) | 
|---|
|  |  |  | HitRate = 0#attrDict.get(ShareDefine.Def_Effect_HitRate, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetHitRateC()) | 
|---|
|  |  |  | DamBackPer = 0#attrDict.get(ShareDefine.Def_Effect_DamBackPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDamBackPerC()) | 
|---|
|  |  |  | PerLVMaxHP = attrDict.get(ShareDefine.Def_Effect_PerLVMaxHP, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetPerLVMaxHPC()) | 
|---|
|  |  |  | DropEquipPer = attrDict.get(ShareDefine.Def_Effect_DropEquipPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDropEquipPerC()) | 
|---|
|  |  |  | DropEquipPer = 0#attrDict.get(ShareDefine.Def_Effect_DropEquipPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDropEquipPerC()) | 
|---|
|  |  |  | DropMoneyPer = attrDict.get(ShareDefine.Def_Effect_DropMoneyPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDropMoneyPerC()) | 
|---|
|  |  |  | IgnoreDefRateReduce = attrDict.get(ShareDefine.Def_Effect_IgnoreDefRateReduce, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetIgnoreDefRateReduceC()) | 
|---|
|  |  |  | DamChanceDef = attrDict.get(ShareDefine.Def_Effect_DamChanceDef, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDamChanceDefC()) | 
|---|
|  |  |  | IgnoreDefRateReduce = 0#attrDict.get(ShareDefine.Def_Effect_IgnoreDefRateReduce, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetIgnoreDefRateReduceC()) | 
|---|
|  |  |  | DamChanceDef = 0#attrDict.get(ShareDefine.Def_Effect_DamChanceDef, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetDamChanceDefC()) | 
|---|
|  |  |  | SuperHitReduce = attrDict.get(ShareDefine.Def_Effect_SuperHitReduce, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSuperHitReduceC()) | 
|---|
|  |  |  | SkillAtkRate = attrDict.get(ShareDefine.Def_Effect_SkillAtkRate, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAtkRateC()) | 
|---|
|  |  |  | SpeedPer = attrDict.get(ShareDefine.Def_Effect_SpeedPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSpeedPerC()) | 
|---|
|  |  |  | SkillAtkRateReduceC = attrDict.get(ShareDefine.Def_Effect_SkillAtkRate, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAtkRateReduceC()) | 
|---|
|  |  |  | SkillAtkRate = 0#attrDict.get(ShareDefine.Def_Effect_SkillAtkRate, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAtkRateC()) | 
|---|
|  |  |  | SpeedPer = 0#attrDict.get(ShareDefine.Def_Effect_SpeedPer, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSpeedPerC()) | 
|---|
|  |  |  | SkillAtkRateReduce = 0#attrDict.get(ShareDefine.Def_Effect_SkillAtkRateReduce, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAtkRateReduceC()) | 
|---|
|  |  |  | Hit = attrDict.get(ShareDefine.Def_Effect_Hit, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetHitC()) | 
|---|
|  |  |  | Miss = attrDict.get(ShareDefine.Def_Effect_Miss, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetMissC()) | 
|---|
|  |  |  | SkillAddPerA = 0#attrDict.get(ShareDefine.Def_Effect_SkillAddPer1, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer1C()) | 
|---|
|  |  |  | SkillAddPerB = 0#attrDict.get(ShareDefine.Def_Effect_SkillAddPer2, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer2C()) | 
|---|
|  |  |  | SkillAddPerC = 0#attrDict.get(ShareDefine.Def_Effect_SkillAddPer3, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer3C()) | 
|---|
|  |  |  | SkillAddPerD = 0#attrDict.get(ShareDefine.Def_Effect_SkillAddPer4, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer4C()) | 
|---|
|  |  |  | SkillAddPerE = 0#attrDict.get(ShareDefine.Def_Effect_SkillAddPer5, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer5C()) | 
|---|
|  |  |  | SkillAddPerF = 0#attrDict.get(ShareDefine.Def_Effect_SkillAddPer6, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer6C()) | 
|---|
|  |  |  | SkillAddPerG = 0#attrDict.get(ShareDefine.Def_Effect_SkillAddPer7, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer7C()) | 
|---|
|  |  |  | SkillReducePerA = 0#attrDict.get(ShareDefine.Def_Effect_SkillReducePer1, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer1C()) | 
|---|
|  |  |  | SkillReducePerB = 0#attrDict.get(ShareDefine.Def_Effect_SkillReducePer2, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer2C()) | 
|---|
|  |  |  | SkillReducePerC = 0#attrDict.get(ShareDefine.Def_Effect_SkillReducePer3, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer3C()) | 
|---|
|  |  |  | SkillReducePerD = 0#attrDict.get(ShareDefine.Def_Effect_SkillReducePer4, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer4C()) | 
|---|
|  |  |  | SkillReducePerE = 0#attrDict.get(ShareDefine.Def_Effect_SkillReducePer5, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer5C()) | 
|---|
|  |  |  | SkillReducePerF = 0#attrDict.get(ShareDefine.Def_Effect_SkillReducePer6, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer6C()) | 
|---|
|  |  |  | SkillReducePerG = 0#attrDict.get(ShareDefine.Def_Effect_SkillReducePer7, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer7C()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 攻速不默认乘,仅作为参数提供策划使用 | 
|---|
|  |  |  | AtkSpeed = attrDict.get(ShareDefine.Def_Effect_AtkSpeed, 0) | 
|---|
|  |  |  | AtkSpeedC = 1 if not gsParamIpyData else gsParamIpyData.GetAtkSpeedC() | 
|---|
|  |  |  | AtkSpeed = 0#attrDict.get(ShareDefine.Def_Effect_AtkSpeed, 0) | 
|---|
|  |  |  | AtkSpeedC = 1#1 if not gsParamIpyData else gsParamIpyData.GetAtkSpeedC() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 绝版 | 
|---|
|  |  |  | outOfPrintAttrIDCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetOutOfPrintAttrID) | 
|---|
|  |  |  | 
|---|
|  |  |  | if GetIsDogzEquip(curItem): | 
|---|
|  |  |  | # 神兽装备用不同公式 | 
|---|
|  |  |  | value = eval(FormulaControl.GetCompileFormula("EquipGSFormula3", IpyGameDataPY.GetFuncCfg("EquipGSFormula", 3))) | 
|---|
|  |  |  | elif GetIsZhuXianEquip(curItem): | 
|---|
|  |  |  | value = eval(FormulaControl.GetCompileFormula("EquipGSFormula4", IpyGameDataPY.GetFuncCfg("EquipGSFormula", 4))) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | value = eval(FormulaControl.GetCompileFormula("EquipGSFormula", IpyGameDataPY.GetFuncCfg("EquipGSFormula"))) | 
|---|
|  |  |  | return value | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetZhuXianEquipTotalGS(curPlayer): | 
|---|
|  |  |  | ##诛仙装备总评分 | 
|---|
|  |  |  | equipScoreTotal = 0 | 
|---|
|  |  |  | zhuXianEquipPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptZhuXianEquip) | 
|---|
|  |  |  | for equipIndex in xrange(zhuXianEquipPack.GetCount()): | 
|---|
|  |  |  | curEquip = zhuXianEquipPack.GetAt(equipIndex) | 
|---|
|  |  |  | if curEquip.IsEmpty(): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | equipScoreTotal += GetEquipGearScore(curEquip) | 
|---|
|  |  |  | return equipScoreTotal | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | ## 通过效果ID,检查是否为指定物品 | 
|---|
|  |  |  | 
|---|
|  |  |  | #  @return True or False | 
|---|
|  |  |  | #  @remarks 函数详细说明. | 
|---|
|  |  |  | def CheckItemByEffectID(curPlayer, curItem, effectList): | 
|---|
|  |  |  | if not CheckItemCanUse(curItem): | 
|---|
|  |  |  | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem): | 
|---|
|  |  |  | return False | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not ItemControler.CheckItemUseLV(curPlayer, curItem, False): | 
|---|
|  |  |  | 
|---|
|  |  |  | for i in range(backPack.GetCount()): | 
|---|
|  |  |  | curItem = backPack.GetAt(i) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not CheckItemCanUse(curItem): | 
|---|
|  |  |  | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if curItem.GetItemTypeID() != findItemID: | 
|---|
|  |  |  | 
|---|
|  |  |  | userData = curItem.GetUserData() | 
|---|
|  |  |  | notifyList[4] = userData if (userData and userData != "{}") else "" | 
|---|
|  |  |  | notifyList[5] =  place | 
|---|
|  |  |  | suiteInfo = PlayerViewCacheTube.__GetEquipPartSuiteInfo(curPlayer) | 
|---|
|  |  |  | notifyList[6] = "" if not suiteInfo else json.dumps(suiteInfo, ensure_ascii=False) | 
|---|
|  |  |  | notifyList[7] = ChEquip.GetEquipPartStarLV(curPlayer, IPY_GameWorld.rptEquip, place) | 
|---|
|  |  |  | notifyList[6] = "" | 
|---|
|  |  |  | notifyList[7] = ChEquip.GetEquipPartPlusLV(curPlayer, IPY_GameWorld.rptEquip, place) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 单部位洗练信息 | 
|---|
|  |  |  | washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % place) + 1 | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | #此函数验证当前职业阶可用(向下兼容),同CheckJob区分使用 | 
|---|
|  |  |  | def JobUseable(curPlayer, curItem): | 
|---|
|  |  |  | '''判断物品是否职业可用 | 
|---|
|  |  |  | 物品表中职业限制规则: 0为通用;非0百位代表职业,十位和个位为职业阶数, 职业阶向下兼容,高阶可使用低阶物品 | 
|---|
|  |  |  | ''' | 
|---|
|  |  |  | itemJobLimit = curItem.GetJobLimit() | 
|---|
|  |  |  | if not itemJobLimit: | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 取消限制的物品 | 
|---|
|  |  |  | if curItem.GetUserAttr(ShareDefine.Def_IudetCancelUseLimit) == 1: | 
|---|
|  |  |  | return CheckJob(curPlayer, curItem) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if curPlayer.GetJob() == itemJobLimit / 100 and PlayerControl.GetJobRank(curPlayer) >= itemJobLimit % 100: | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | return False | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #此函数验证当前职业系可用,同JobUseable区分使用 | 
|---|
|  |  |  | #此函数验证当前职业系可用 | 
|---|
|  |  |  | def CheckJob(curPlayer, curItem): | 
|---|
|  |  |  | '''判断物品是否职业系可用 | 
|---|
|  |  |  | 物品表中职业限制规则: 0为通用;非0百位代表职业,十位和个位为职业阶数, 职业阶向下兼容,高阶可使用低阶物品 | 
|---|
|  |  |  | 物品表中职业限制规则: 0为通用;非0百位代表职业 | 
|---|
|  |  |  | ''' | 
|---|
|  |  |  | itemJobLimit = curItem.GetJobLimit() | 
|---|
|  |  |  | if not itemJobLimit: | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | if curPlayer.GetJob() == itemJobLimit / 100: | 
|---|
|  |  |  | if curPlayer.GetJob() == itemJobLimit: | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | 
|---|
|  |  |  | # 特殊判定根据时效时间判定物品是否可以使用 | 
|---|
|  |  |  | # 过期物品不能使用或装备但是可以出售续费 | 
|---|
|  |  |  | def CheckItemCanUseByExpireTime(curItem): | 
|---|
|  |  |  | curItemCreateTime = curItem.GetCreateTime() | 
|---|
|  |  |  | curItemExpireTime = curItem.GetExpireTime() | 
|---|
|  |  |  | curItemPastTime = GameWorld.GetPastSeconds(curItemCreateTime) | 
|---|
|  |  |  | #    curItemCreateTime = curItem.GetCreateTime() | 
|---|
|  |  |  | #    curItemExpireTime = curItem.GetExpireTime() | 
|---|
|  |  |  | #    curItemPastTime = GameWorld.GetPastSeconds(curItemCreateTime) | 
|---|
|  |  |  | # | 
|---|
|  |  |  | #    reduceType = curItem.GetEndureReduceType() | 
|---|
|  |  |  | #    if reduceType == ChConfig.Def_EquipReduceType_RTimeItem and \ | 
|---|
|  |  |  | #    curItemPastTime >= curItemExpireTime: | 
|---|
|  |  |  | #        # 过期了 | 
|---|
|  |  |  | #        return False | 
|---|
|  |  |  | # | 
|---|
|  |  |  | #    if reduceType == ChConfig.Def_EquipReduceType_Time: | 
|---|
|  |  |  | #        # 开始装备时间 | 
|---|
|  |  |  | #        startTime = curItem.GetUserAttr(ShareDefine.Def_IudetCreateTime) | 
|---|
|  |  |  | #        if startTime == 0: | 
|---|
|  |  |  | #            return True | 
|---|
|  |  |  | #        if time.time() - startTime > curItemExpireTime: | 
|---|
|  |  |  | #            return False | 
|---|
|  |  |  |  | 
|---|
|  |  |  | reduceType = curItem.GetEndureReduceType() | 
|---|
|  |  |  | if reduceType == ChConfig.Def_EquipReduceType_RTimeItem and \ | 
|---|
|  |  |  | curItemPastTime >= curItemExpireTime: | 
|---|
|  |  |  | # 过期了 | 
|---|
|  |  |  | return False | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if reduceType == ChConfig.Def_EquipReduceType_Time: | 
|---|
|  |  |  | # 开始装备时间 | 
|---|
|  |  |  | startTime = curItem.GetUserAttr(ShareDefine.Def_IudetCreateTime) | 
|---|
|  |  |  | if startTime == 0: | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | if time.time() - startTime > curItemExpireTime: | 
|---|
|  |  |  | isExpireItem, expireTime = GetItemRemainingTime(curItem) | 
|---|
|  |  |  | if isExpireItem: | 
|---|
|  |  |  | if expireTime <= 0: | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ##检查该物品是否合法,类型验证 | 
|---|
|  |  |  | # @param curItem 物品实例 | 
|---|
|  |  |  | # @param checkType 物品类型 | 
|---|
|  |  |  | # @return 布尔值(物品是否合法) | 
|---|
|  |  |  | # @remarks 检查该物品是否合法,类型验证 | 
|---|
|  |  |  | def CheckItemByType(curItem, checkType): | 
|---|
|  |  |  | #验证材料 | 
|---|
|  |  |  | if not CheckItemCanUse(curItem): | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | def GetItemRemainingTime(curItem): | 
|---|
|  |  |  | ''' 获取物品剩余时间,秒 | 
|---|
|  |  |  | @return: 是否时效物品, 剩余时间 | 
|---|
|  |  |  | ''' | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #类型不符合 | 
|---|
|  |  |  | if curItem.GetType() != checkType: | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | isExpireItem = False | 
|---|
|  |  |  | reduceType = curItem.GetEndureReduceType() | 
|---|
|  |  |  | remainingTime = 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | if reduceType in [ChConfig.Def_EquipReduceType_Time, ChConfig.Def_EquipReduceType_RTimeItem]: | 
|---|
|  |  |  | isExpireItem = True | 
|---|
|  |  |  | # 装备后开始计时 | 
|---|
|  |  |  | curItemExpireTime = curItem.GetUserAttr(ShareDefine.Def_IudetExpireTime) | 
|---|
|  |  |  | if not curItemExpireTime: | 
|---|
|  |  |  | curItemExpireTime = curItem.GetExpireTime() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 开始装备时间 | 
|---|
|  |  |  | startTime = curItem.GetUserAttr(ShareDefine.Def_IudetCreateTime) | 
|---|
|  |  |  | if startTime == 0: | 
|---|
|  |  |  | remainingTime = curItemExpireTime | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | curItemPastTime = max(0, int(time.time()) - startTime) | 
|---|
|  |  |  | remainingTime = max(0, curItemExpireTime - curItemPastTime) | 
|---|
|  |  |  | return isExpireItem, remainingTime | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return isExpireItem, remainingTime | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 检查装备是否有镶嵌宝石 | 
|---|
|  |  |  | #  @param curItem 装备对象 | 
|---|
|  |  |  | 
|---|
|  |  |  | for i in range(curItemPack.GetCount()): | 
|---|
|  |  |  | findItem = curItemPack.GetAt(i) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not CheckItemCanUse(findItem): | 
|---|
|  |  |  | if not CheckItemCanUse(findItem) or ItemControler.GetIsAuctionItem(findItem): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #不使用绑定的材料 | 
|---|
|  |  |  | 
|---|
|  |  |  | for i in range(curItemPack.GetCount()): | 
|---|
|  |  |  | curItem = curItemPack.GetAt(i) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not CheckItemCanUse(curItem): | 
|---|
|  |  |  | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #不使用绑定的材料 | 
|---|
|  |  |  | 
|---|
|  |  |  | for i in range(curItemPack.GetCount()): | 
|---|
|  |  |  | curItem = curItemPack.GetAt(i) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not CheckItemCanUse(curItem): | 
|---|
|  |  |  | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if curItem.GetItemTypeID() != findItemID: | 
|---|
|  |  |  | 
|---|
|  |  |  | for i in range(itemPack.GetCount()): | 
|---|
|  |  |  | curItem = itemPack.GetAt(i) | 
|---|
|  |  |  | #过滤不符合其他条件的物品 | 
|---|
|  |  |  | if not CheckItemCanUse(curItem): | 
|---|
|  |  |  | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if curItem.GetItemTypeID() != findItemID: | 
|---|
|  |  |  | 
|---|
|  |  |  | for i in range(itemPack.GetCount()): | 
|---|
|  |  |  | curItem = itemPack.GetAt(i) | 
|---|
|  |  |  | #过滤不符合其他条件的物品 | 
|---|
|  |  |  | if not CheckItemCanUse(curItem): | 
|---|
|  |  |  | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if curItem.GetItemTypeID() != findItemID: | 
|---|
|  |  |  | 
|---|
|  |  |  | for i in range(itemPack.GetCount()): | 
|---|
|  |  |  | curItem = itemPack.GetAt(i) | 
|---|
|  |  |  | #过滤不符合其他条件的物品 | 
|---|
|  |  |  | if not CheckItemCanUse(curItem): | 
|---|
|  |  |  | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if curItem.GetItemTypeID() != findItemID: | 
|---|
|  |  |  | 
|---|
|  |  |  | return hasEnough, itemIndexList, findItemIsBind, needCnt | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetPackItemBindStateIndexInfo(curPlayer, itemID): | 
|---|
|  |  |  | def GetPackItemBindStateIndexInfo(curPlayer, itemID, needCount=0, packType=IPY_GameWorld.rptItem): | 
|---|
|  |  |  | ''' 获取背包消耗道具绑定及未绑定索引情况 | 
|---|
|  |  |  | @param needCount: 所需个数, 默认绑定优先,当找到已经足够的个数后不再遍历,减少无用遍历 | 
|---|
|  |  |  | @return: 可消耗物品列表[[绑定物品索引], [不绑定物品索引]], 绑定个数, 未绑定个数 | 
|---|
|  |  |  | ''' | 
|---|
|  |  |  | consumeItemIndexList = [[], []] # 可消耗物品列表[[绑定物品索引], [不绑定物品索引]] | 
|---|
|  |  |  | bindCnt, unBindCnt = 0, 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem) | 
|---|
|  |  |  | curPack = curPlayer.GetItemManager().GetPack(packType) | 
|---|
|  |  |  | for i in range(0, curPack.GetCount()): | 
|---|
|  |  |  | curItem = curPack.GetAt(i) | 
|---|
|  |  |  | if not curItem: | 
|---|
|  |  |  | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if curItem.GetItemTypeID() != itemID: | 
|---|
|  |  |  | 
|---|
|  |  |  | if curItem.GetIsBind(): | 
|---|
|  |  |  | consumeItemIndexList[0].append(i) | 
|---|
|  |  |  | bindCnt += itemCount | 
|---|
|  |  |  | if needCount > 0 and bindCnt >= needCount: | 
|---|
|  |  |  | break | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | consumeItemIndexList[1].append(i) | 
|---|
|  |  |  | unBindCnt += itemCount | 
|---|
|  |  |  | 
|---|
|  |  |  | #系统提示 LostRes 失去物品 | 
|---|
|  |  |  | #if needSysmsg: | 
|---|
|  |  |  | #    PlayerControl.NotifyCode(curPlayer, 'LostRes', [itemTypeID, totalUseCnt]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #添加跨服服务器中使用物品事件 | 
|---|
|  |  |  | if itemTypeID in ReadChConfig.GetEvalChConfig("MergeServerCanUseItemID"): | 
|---|
|  |  |  | eventInfo = [itemTypeID, totalUseCnt, makeItemBind, eventName, saveDataDict] | 
|---|
|  |  |  | PlayerMergeEvent.AddMSPlayerEvent(curPlayer.GetPlayerID(), PlayerMergeEvent.Def_MSPEvent_DelItem, eventInfo) | 
|---|
|  |  |  | return makeItemBind | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetCostItemIndexList(costItemInfo, itemPack, bindFirst=True): | 
|---|
|  |  |  | 
|---|
|  |  |  | for i in xrange(itemPack.GetCount()): | 
|---|
|  |  |  | curItem = itemPack.GetAt(i) | 
|---|
|  |  |  | #过滤不符合其他条件的物品 | 
|---|
|  |  |  | if not CheckItemCanUse(curItem): | 
|---|
|  |  |  | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | curItemID = curItem.GetItemTypeID() | 
|---|
|  |  |  | if curItemID not in costItemDict: | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetShopItemPrice(itemID, priceType): | 
|---|
|  |  |  | ''' 获取商城物品对应价格 ''' | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameDataByCondition("Store", {"ItemID":itemID, "MoneyType":priceType}, isLogNone=False) | 
|---|
|  |  |  | # 系统固定商店类型: 仙玉(2-常用道具,3-成长变强),绑玉(4-绑玉商城) | 
|---|
|  |  |  | priceTypeShopTypeDict = {IPY_GameWorld.TYPE_Price_Gold_Money:[2, 3], | 
|---|
|  |  |  | IPY_GameWorld.TYPE_Price_Gold_Paper:[4], | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ipyData = None | 
|---|
|  |  |  | if priceType in priceTypeShopTypeDict: | 
|---|
|  |  |  | for shopType in priceTypeShopTypeDict[priceType]: | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameDataByCondition("Store", {"ShopType":shopType, "ItemID":itemID, "MoneyType":priceType}, isLogNone=False) | 
|---|
|  |  |  | if ipyData: | 
|---|
|  |  |  | break | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameDataByCondition("Store", {"ItemID":itemID, "MoneyType":priceType}, isLogNone=False) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | return ipyData.GetMoneyNum() | 
|---|
|  |  |  | 
|---|
|  |  |  | for index in range(0, itemPack.GetCount()): | 
|---|
|  |  |  | item = itemPack.GetAt(index) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not CheckItemCanUse(item): | 
|---|
|  |  |  | if not CheckItemCanUse(item) or ItemControler.GetIsAuctionItem(item): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | itemTypeID = item.GetItemTypeID() | 
|---|
|  |  |  | 
|---|
|  |  |  | #  @remarks 函数详细说明. | 
|---|
|  |  |  | def DoLogic_ItemBindType(curPlayer, curItem, bindType): | 
|---|
|  |  |  | #固定不绑定 | 
|---|
|  |  |  | if bindType == ChConfig.Def_BindType_NoBind: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #不处理已经绑定的物品 | 
|---|
|  |  |  | if curItem.GetIsBind(): | 
|---|
|  |  |  | return | 
|---|
|  |  |  | #不是这个功能的绑定类型 | 
|---|
|  |  |  | if curItem.GetBindType() != bindType: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if curItem.GetBindType() == ChConfig.Def_BindType_DoEquipBind: | 
|---|
|  |  |  | pass | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ItemControler.SetItemIsBind(curItem, True) | 
|---|
|  |  |  | #拍品去除绑定逻辑,暂屏蔽 | 
|---|
|  |  |  | #    if bindType == ChConfig.Def_BindType_NoBind: | 
|---|
|  |  |  | #        return | 
|---|
|  |  |  | # | 
|---|
|  |  |  | #    #不处理已经绑定的物品 | 
|---|
|  |  |  | #    if curItem.GetIsBind(): | 
|---|
|  |  |  | #        return | 
|---|
|  |  |  | #    #不是这个功能的绑定类型 | 
|---|
|  |  |  | #    if curItem.GetBindType() != bindType: | 
|---|
|  |  |  | #        return | 
|---|
|  |  |  | #    if curItem.GetBindType() == ChConfig.Def_BindType_DoEquipBind: | 
|---|
|  |  |  | #        pass | 
|---|
|  |  |  | # | 
|---|
|  |  |  | #    ItemControler.SetItemIsBind(curItem, True) | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | 
|---|
|  |  |  | #  @remarks 函数详细说明. | 
|---|
|  |  |  | def SwitchItem(curPlayer, curItem, switchItem, putInPackIndex): | 
|---|
|  |  |  | ##物品绑定字段判定 -> 装备绑定 | 
|---|
|  |  |  | if putInPackIndex == IPY_GameWorld.rptEquip: | 
|---|
|  |  |  | if putInPackIndex in [IPY_GameWorld.rptEquip, ShareDefine.rptZhuXianEquip]: | 
|---|
|  |  |  | DoLogic_ItemBindType(curPlayer, switchItem, ChConfig.Def_BindType_DoEquipBind) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 装备技能书、坐骑装备绑定 | 
|---|
|  |  |  | if putInPackIndex in [IPY_GameWorld.rptHorseEquip]: | 
|---|
|  |  |  | if putInPackIndex in [IPY_GameWorld.rptHorseEquip, ShareDefine.rptZhuXianEquip]: | 
|---|
|  |  |  | DoLogic_ItemBindType(curPlayer, curItem, ChConfig.Def_BindType_DoEquipBind) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #交换装备 | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ##物品绑定字段判定 -> 装备绑定 | 
|---|
|  |  |  | if putInPackIndex == IPY_GameWorld.rptEquip: | 
|---|
|  |  |  | if putInPackIndex in [IPY_GameWorld.rptEquip, ShareDefine.rptZhuXianEquip]: | 
|---|
|  |  |  | DoLogic_ItemBindType(curPlayer, switchItem, ChConfig.Def_BindType_DoEquipBind) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 装备技能书、坐骑装备绑定 | 
|---|
|  |  |  | if putInPackIndex in [IPY_GameWorld.rptHorseEquip]: | 
|---|
|  |  |  | if putInPackIndex in [IPY_GameWorld.rptHorseEquip, ShareDefine.rptZhuXianEquip]: | 
|---|
|  |  |  | DoLogic_ItemBindType(curPlayer, emptyItem, ChConfig.Def_BindType_DoEquipBind) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if switchItem.GetGameWorldItemType() == IPY_GameWorld.gwitRoleItem: | 
|---|
|  |  |  | 
|---|
|  |  |  | ## 返回是否神兽装备 | 
|---|
|  |  |  | return curItem.GetType() in ChConfig.Def_DogzEquiipType | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 返回是否武器 | 
|---|
|  |  |  | #  @param curItem 当前物品 | 
|---|
|  |  |  | #  @return None | 
|---|
|  |  |  | #  @remarks 函数详细说明. | 
|---|
|  |  |  | def GetIsWeapon(curItem): | 
|---|
|  |  |  | return curItem.GetType() in ChConfig.Def_WeaponItemType | 
|---|
|  |  |  | def GetIsZhuXianEquip(curItem): | 
|---|
|  |  |  | ## 返回是否诛仙装备 | 
|---|
|  |  |  | return curItem.GetType() in ChConfig.Def_ZhuXianEquiipType | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | ##遍历数据库查找合适的物品, 通过 效果ID + 效果A值确定物品 | 
|---|
|  |  |  | 
|---|
|  |  |  | curItem = curItemPack.GetAt(i) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #检查物品 | 
|---|
|  |  |  | if not CheckItemCanUse(curItem): | 
|---|
|  |  |  | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | effect = curItem.GetEffectByIndex(0) | 
|---|
|  |  |  | 
|---|
|  |  |  | ItemControler.SetItemCount(curItem, curItemCnt - delCnt, | 
|---|
|  |  |  | curPlayer.GetPlayerID(), curPlayer.GetAccID(), | 
|---|
|  |  |  | curPlayer.GetPlayerName()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #添加跨服服务器中使用物品事件 | 
|---|
|  |  |  | if curItemTypeID in ReadChConfig.GetEvalChConfig("MergeServerCanUseItemID"): | 
|---|
|  |  |  | eventInfo = [curItemTypeID, delCnt, curItemBind, recordName, saveDataDict] | 
|---|
|  |  |  | PlayerMergeEvent.AddMSPlayerEvent(curPlayer.GetPlayerID(), PlayerMergeEvent.Def_MSPEvent_DelItem, eventInfo) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def DelVPackItem(curPlayer, packIndex, placeList, eventName=""): | 
|---|
|  |  |  | 
|---|
|  |  |  | itemName = str(itemID) if not curItemData else  curItemData.GetName() | 
|---|
|  |  |  | itemName = "%s LV%s" % (itemName, plusLV + 1) | 
|---|
|  |  |  | isNeedRecord = curItemData and ItemControler.IsRuneItemNeedRecord(curItemData, plusLV) | 
|---|
|  |  |  | if packIndex == ShareDefine.rptGatherSoul: | 
|---|
|  |  |  | itemID = ItemControler.GetGatherSoulItemID(itemKeyData) | 
|---|
|  |  |  | plusLV = ItemControler.GetGatherSoulItemPlusLV(itemKeyData) | 
|---|
|  |  |  | curItemData = GameWorld.GetGameData().GetItemByTypeID(itemID) | 
|---|
|  |  |  | itemName = str(itemID) if not curItemData else  curItemData.GetName() | 
|---|
|  |  |  | itemName = "%s LV%s" % (itemName, plusLV + 1) | 
|---|
|  |  |  | isNeedRecord = curItemData and ItemControler.IsGatherSoulItemNeedRecord(curItemData, plusLV) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_VPackItem % (packIndex, place), 0) | 
|---|
|  |  |  | if isNeedRecord: | 
|---|
|  |  |  | 
|---|
|  |  |  | ItemControler.Sync_VPackItem_Clear(curPlayer, packIndex, placeList) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 获取物品最高强化星级 | 
|---|
|  |  |  | ## 获取物品最高强化等级 | 
|---|
|  |  |  | #  @param itemType: 物品类型 | 
|---|
|  |  |  | #  @return 最大星级,0为不可强化 | 
|---|
|  |  |  | def GetItemMaxStarLV(curItem): | 
|---|
|  |  |  | equipPlace = curItem.GetEquipPlace() | 
|---|
|  |  |  | plusMaxTypeDict = IpyGameDataPY.GetFuncEvalCfg("StrengthenLevelLimit", 1) | 
|---|
|  |  |  | if not plusMaxTypeDict: | 
|---|
|  |  |  | GameWorld.ErrLog("GetItemMaxStarLV没有强化类型映射表") | 
|---|
|  |  |  | def GetItemMaxPlusLV(curPlayer, equipPackindex, curItem): | 
|---|
|  |  |  | findType = ChEquip.GetEquipPlusType(curItem) | 
|---|
|  |  |  | if not findType: | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if equipPlace not in plusMaxTypeDict: | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | findType = plusMaxTypeDict[equipPlace] | 
|---|
|  |  |  | #仙器特殊取固定值 | 
|---|
|  |  |  | if equipPlace in [ShareDefine.retFairyCan, ShareDefine.retFairyCan2]: | 
|---|
|  |  |  | rank = 0 | 
|---|
|  |  |  | itemColor = 0 | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | rank = GetItemClassLV(curItem) | 
|---|
|  |  |  | itemColor = curItem.GetItemColor() | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData("ItemPlusMax", findType, rank, itemColor) | 
|---|
|  |  |  | equipStar = ChEquip.GetEquipPartStarByRank(curPlayer, equipPackindex, curItem) | 
|---|
|  |  |  | ipyData = IpyGameDataPY.InterpolationSearch('ItemPlusMax', 'Star', equipStar, {'Type':findType}) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | GameWorld.ErrLog("找不到装备强化等级上限表数据配置! rank = %s, %s" % (rank , curItem.GetItemQuality())) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | return ipyData.GetLevelMax() | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 获取物品阶级 | 
|---|
|  |  |  | ## 获取物品最高强化进化等级 | 
|---|
|  |  |  | #  @param itemType: 物品类型 | 
|---|
|  |  |  | #  @return 最大星级,0为不可强化 | 
|---|
|  |  |  | def GetItemMaxPlusEvolveLV(curPlayer, equipPackindex, curItem): | 
|---|
|  |  |  | packType = IPY_GameWorld.rptEquip | 
|---|
|  |  |  | curPlusLV = ChEquip.GetEquipPartPlusLVByRank(curPlayer, packType, equipPackindex, curItem) | 
|---|
|  |  |  | equipPlace = curItem.GetEquipPlace() | 
|---|
|  |  |  | ipyData = IpyGameDataPY.InterpolationSearch('EquipPlusEvolve', 'NeedPlusLV', curPlusLV, {'EquipPlace':equipPlace}) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | return ipyData.GetEvolveLV() | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 获取物品最高星数 | 
|---|
|  |  |  | #  @param itemType: 物品类型 | 
|---|
|  |  |  | #  @return 最大星级,0为不可强化 | 
|---|
|  |  |  | def GetItemMaxStar(curItem): | 
|---|
|  |  |  | itemColor = curItem.GetItemColor() | 
|---|
|  |  |  | maxStarDict = IpyGameDataPY.GetFuncEvalCfg('EquipPartStar', 1) | 
|---|
|  |  |  | if str(itemColor) not in maxStarDict: | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | classLV = GetItemClassLV(curItem) | 
|---|
|  |  |  | return maxStarDict[str(itemColor)].get(str(classLV), 0) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 获取物品阶级或品级 | 
|---|
|  |  |  | def GetItemClassLV(curItem): | 
|---|
|  |  |  | return curItem.GetLV() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | def SetEquipGearScore(curItem, value): | 
|---|
|  |  |  | return curItem.SetGearScore(value) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetEquipPackIndex(curItem): | 
|---|
|  |  |  | ## 根据物品获取对应的可装备背包位置 | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', GetItemClassLV(curItem), curItem.GetEquipPlace()) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | return -1 | 
|---|
|  |  |  | return ipyData.GetGridIndex() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 每日可使用次数 | 
|---|
|  |  |  | def GetCanUseCountDaily(curItem): return curItem.GetMaxAddSkillCnt() | 
|---|
|  |  |  | ## 每周可使用次数, 预留,暂不实现 | 
|---|
|  |  |  | 
|---|
|  |  |  | if not curItem or curItem.IsEmpty(): | 
|---|
|  |  |  | return {} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | isAuctionItem = ItemControler.GetIsAuctionItem(curItem) | 
|---|
|  |  |  | if not CheckItemIsEquip(curItem): | 
|---|
|  |  |  | return [curItem.GetItemTypeID(), curItem.GetCount(), curItem.GetIsBind()] | 
|---|
|  |  |  | return [curItem.GetItemTypeID(), curItem.GetCount(), isAuctionItem] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | addItemDict = {} | 
|---|
|  |  |  | addItemDict['ItemID'] = curItem.GetItemTypeID() | 
|---|
|  |  |  | addItemDict['Count'] = curItem.GetCount() | 
|---|
|  |  |  | addItemDict['IsBind'] = int(curItem.GetIsBind()) | 
|---|
|  |  |  | addItemDict['IsAuctionItem'] = isAuctionItem | 
|---|
|  |  |  | #addItemDict['IsBind'] = int(curItem.GetIsBind()) | 
|---|
|  |  |  | #addItemDict['EquipGS'] = GetEquipGearScore(curItem) | 
|---|
|  |  |  | #addItemDict['ItemStarLV'] = curItem.GetItemStarLV() | 
|---|
|  |  |  | #addItemDict['CurDurg'] = GameWorld.GetIntUpper(curItem.GetCurDurg(), ChConfig.Def_EndureRepairParameter) | 
|---|
|  |  |  | 
|---|
|  |  |  | #addItemDict['EquipMaxAtkValue'] = curItem.GetEquipMaxAtkValue() | 
|---|
|  |  |  | #addItemDict['FitLV'] = curItem.GetFitLV() | 
|---|
|  |  |  | #addItemDict['Proficiency'] = curItem.GetProficiency() | 
|---|
|  |  |  | addItemDict['IsSuite'] = int(curItem.GetIsSuite()) | 
|---|
|  |  |  | #addItemDict['IsSuite'] = int(curItem.GetIsSuite()) | 
|---|
|  |  |  | #addItemDict['BaseHP'] = curItem.GetBaseHP() | 
|---|
|  |  |  | #addItemDict['BaseMagicDef'] = curItem.GetBaseMagicDef() | 
|---|
|  |  |  | #addItemDict['MaxAddSkillCnt'] = curItem.GetMaxAddSkillCnt() | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetJsonItem(itemInfo): | 
|---|
|  |  |  | '''获取物品信息对应的json信息 | 
|---|
|  |  |  | @param itemInfo: 支持列表 [itemID, itemCount, isBind], 支持动态列表长度,索引代表属性固定 | 
|---|
|  |  |  | @param itemInfo: 支持列表 [itemID, itemCount, isAuctionItem], 支持动态列表长度,索引代表属性固定 | 
|---|
|  |  |  | 支持物品实例, 如果是示例时必须在给玩家之前先获取出来,防止给玩家后该物品实例被清空 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @return: {"ItemID":101, "Count":10, "IsBind":1, "IsSuite":1, "UserData":"自定义属性字符串"} | 
|---|
|  |  |  | @return: {"ItemID":101, "Count":10, "IsAuctionItem":1, "UserData":"自定义属性字符串"} | 
|---|
|  |  |  | ''' | 
|---|
|  |  |  | itemDict = {} | 
|---|
|  |  |  | if isinstance(itemInfo, list) or isinstance(itemInfo, tuple): | 
|---|
|  |  |  | 
|---|
|  |  |  | if infolen > 1 and itemInfo[1] > 1: | 
|---|
|  |  |  | itemDict["Count"] = itemInfo[1] | 
|---|
|  |  |  | if infolen > 2 and itemInfo[2]: | 
|---|
|  |  |  | itemDict["IsBind"] = int(itemInfo[2]) | 
|---|
|  |  |  | itemDict["IsAuctionItem"] = int(itemInfo[2]) | 
|---|
|  |  |  | elif isinstance(itemInfo, int): | 
|---|
|  |  |  | itemDict["ItemID"] = itemInfo | 
|---|
|  |  |  | else: #物品实例 | 
|---|
|  |  |  | 
|---|
|  |  |  | itemDict["ItemID"] = itemInfo.GetItemTypeID() | 
|---|
|  |  |  | if itemInfo.GetCount() > 1: | 
|---|
|  |  |  | itemDict["Count"] = itemInfo.GetCount() | 
|---|
|  |  |  | if itemInfo.GetIsBind(): | 
|---|
|  |  |  | itemDict["IsBind"] = int(itemInfo.GetIsBind()) | 
|---|
|  |  |  | if itemInfo.GetIsSuite(): | 
|---|
|  |  |  | itemDict["IsSuite"] = int(itemInfo.GetIsSuite()) | 
|---|
|  |  |  | if ItemControler.GetIsAuctionItem(itemInfo): | 
|---|
|  |  |  | itemDict["IsAuctionItem"] = 1 | 
|---|
|  |  |  | if itemInfo.GetUserData(): | 
|---|
|  |  |  | itemDict["UserData"] = itemInfo.GetUserData() | 
|---|
|  |  |  | return itemDict | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 将物品列表重复物品堆叠起来返回整理后的列表 | 
|---|
|  |  |  | #  @param itemlist | 
|---|
|  |  |  | #  @return 整理后的物品列表 | 
|---|
|  |  |  | def GetSimpleItemList(itemlist): | 
|---|
|  |  |  | sItemList = [] | 
|---|
|  |  |  | sItemDict = {} | 
|---|
|  |  |  | for item in itemlist: | 
|---|
|  |  |  | maxPackCount = item.GetPackCount() | 
|---|
|  |  |  | if maxPackCount == 0: | 
|---|
|  |  |  | return itemlist | 
|---|
|  |  |  | itemCnt = item.GetCount() | 
|---|
|  |  |  | if itemCnt > maxPackCount: | 
|---|
|  |  |  | return itemlist | 
|---|
|  |  |  | itemid = item.GetItemTypeID() | 
|---|
|  |  |  | isBind = item.GetIsBind() | 
|---|
|  |  |  | key = (itemid,isBind) | 
|---|
|  |  |  | if key in sItemDict: | 
|---|
|  |  |  | for sitem in sItemDict[key]: | 
|---|
|  |  |  | if sitem.GetCount() >= maxPackCount: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | totalCnt = item.GetCount()+ sitem.GetCount() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if totalCnt > maxPackCount: | 
|---|
|  |  |  | ItemControler.SetItemCount(sitem, maxPackCount) | 
|---|
|  |  |  | ItemControler.SetItemCount(item, totalCnt - maxPackCount) | 
|---|
|  |  |  | sItemList.append(item) | 
|---|
|  |  |  | sItemDict[key].append(item) | 
|---|
|  |  |  | break | 
|---|
|  |  |  | ItemControler.SetItemCount(sitem, totalCnt) | 
|---|
|  |  |  | item.Clear() | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | sItemList.append(item) | 
|---|
|  |  |  | sItemDict[key] = [item] | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return sItemList | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## ======================================================================================= | 
|---|
|  |  |  | ##根据活动类型配置随机装备品质 | 
|---|
|  |  |  | # @param itemType | 
|---|
|  |  |  | # @return 品质 | 
|---|
|  |  |  | def GetRandEquipQualityByTable(itemType, tableName): | 
|---|
|  |  |  | qualityRandDict = ReadChConfig.GetEvalChConfig(tableName) | 
|---|
|  |  |  | qualityRandList = qualityRandDict.get(itemType, []) | 
|---|
|  |  |  | if qualityRandList == []: | 
|---|
|  |  |  | qualityRandList = qualityRandDict[-1] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return GameWorld.GetResultByRandomList(qualityRandList, 0) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 随机卓越装备,根据规则从数据库中筛选出,等级职业 | 
|---|
|  |  |  | #  @param equipType 装备类型 | 
|---|
|  |  |  | #  @return 抽奖是否成功 | 
|---|
|  |  |  | def RandGreateEquip(curPlayer, equipType, isBind, tableName, quality=1): | 
|---|
|  |  |  | equipList = GameDataControl.GetItemDataListByType(equipType) | 
|---|
|  |  |  | equipLVRandList, lvFormulaStr, lvRange, jobRand, luckyShotRand, greateNumRand, \ | 
|---|
|  |  |  | broadcastList, plusRand, addAttrRand = ReadChConfig.GetEvalChConfig(tableName) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | playerLV = curPlayer.GetLV() | 
|---|
|  |  |  | step = GameWorld.GetResultByRandomList(equipLVRandList, 0) | 
|---|
|  |  |  | getLVMin = eval(lvFormulaStr) | 
|---|
|  |  |  | getLVMax = getLVMin + lvRange | 
|---|
|  |  |  | checkJob = GameWorld.CanHappen(jobRand) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | randList = [] | 
|---|
|  |  |  | findItem = None | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for item in equipList: | 
|---|
|  |  |  | if item.GetUseLV() < getLVMin or item.GetUseLV() > getLVMax: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if item.GetItemQuality() != quality: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if checkJob: | 
|---|
|  |  |  | if JobUseable(curPlayer, item): | 
|---|
|  |  |  | findItem = item | 
|---|
|  |  |  | break | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | randList.append(item) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if randList: | 
|---|
|  |  |  | findItem = random.choice(randList) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if findItem == None: | 
|---|
|  |  |  | return None, False | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return CreateGreateItem(findItem, luckyShotRand, greateNumRand, broadcastList, | 
|---|
|  |  |  | plusRand, addAttrRand, isBind) | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 生成抽奖的卓越装备 | 
|---|
|  |  |  | #  @param 各属性 | 
|---|
|  |  |  | #  @return 生成的物品,是否广播 | 
|---|
|  |  |  | def CreateGreateItem(findItem, luckyShotRand, greateNumRand, broadcastList, | 
|---|
|  |  |  | plusRand, addAttrRand, isBind): | 
|---|
|  |  |  | itemID = findItem.GetItemTypeID() | 
|---|
|  |  |  | equipItem = CreateSingleItem(itemID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | tmpEquipData = ItemControler.SingleEquipTmpData() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | tmpEquipData.starLV = random.randint(plusRand[0], plusRand[1]) | 
|---|
|  |  |  | tmpEquipData.holeCnt = 3 | 
|---|
|  |  |  | tmpEquipData.isBind = isBind | 
|---|
|  |  |  | tmpEquipData.isSuite = 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 装备附加属性 | 
|---|
|  |  |  | ChItem.EquipAddAdditionEx(equipItem, tmpEquipData) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | broadcast = False | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return equipItem, broadcast | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 随机普通装备,根据规则从数据库中筛选出,等级职业 | 
|---|
|  |  |  | #  @param equipType 装备类型 | 
|---|
|  |  |  | #  @return 抽奖是否成功 | 
|---|
|  |  |  | def RandNormalEquip(curPlayer, equipType, isBind, tableName): | 
|---|
|  |  |  | equipList = GameDataControl.GetItemDataListByType(equipType) | 
|---|
|  |  |  | equipLVRandList, lvFormulaStr, lvRange, jobRand, luckyShotRand, \ | 
|---|
|  |  |  | plusRand, addAttrRand, skillRand = ReadChConfig.GetEvalChConfig(tableName) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | playerLV = curPlayer.GetLV() | 
|---|
|  |  |  | step = GameWorld.GetResultByRandomList(equipLVRandList, 0) | 
|---|
|  |  |  | getLVMin = eval(lvFormulaStr) | 
|---|
|  |  |  | getLVMax = getLVMin + lvRange | 
|---|
|  |  |  | checkJob = GameWorld.CanHappen(jobRand) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | randList = [] | 
|---|
|  |  |  | findItem = None | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for item in equipList: | 
|---|
|  |  |  | if item.GetUseLV() < getLVMin or item.GetUseLV() > getLVMax: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if item.GetItemQuality() != 0: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if checkJob: | 
|---|
|  |  |  | if JobUseable(curPlayer, item): | 
|---|
|  |  |  | findItem = item | 
|---|
|  |  |  | break | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | randList.append(item) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if randList: | 
|---|
|  |  |  | findItem = random.choice(randList) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if findItem == None: | 
|---|
|  |  |  | return None | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return CreateNormalItem(findItem, luckyShotRand, plusRand, addAttrRand, isBind, skillRand) | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 生成抽奖的卓越装备 | 
|---|
|  |  |  | #  @param 各属性 | 
|---|
|  |  |  | #  @return 生成的物品 | 
|---|
|  |  |  | def CreateNormalItem(findItem, luckyShotRand, plusRand, addAttrRand, isBind, skillRand): | 
|---|
|  |  |  | itemID = findItem.GetItemTypeID() | 
|---|
|  |  |  | equipItem = CreateSingleItem(itemID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | tmpEquipData = ItemControler.SingleEquipTmpData() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | tmpEquipData.starLV = random.randint(plusRand[0], plusRand[1]) | 
|---|
|  |  |  | tmpEquipData.holeCnt = 3 | 
|---|
|  |  |  | tmpEquipData.isBind = isBind | 
|---|
|  |  |  | tmpEquipData.isSuite = 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 装备附加属性 | 
|---|
|  |  |  | ChItem.EquipAddAdditionEx(equipItem, tmpEquipData) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return equipItem | 
|---|
|  |  |  | def GetWeightItemListByAlchemyDiffLV(curPlayer, weightList, alchemyDiffLV): | 
|---|
|  |  |  | ## 根据炼丹等级差异等级过滤权重列表中不满足的物品,返回新的权重列表 | 
|---|
|  |  |  | resultWeightList = [] | 
|---|
|  |  |  | if alchemyDiffLV: | 
|---|
|  |  |  | curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV) | 
|---|
|  |  |  | for itemInfo in weightList: | 
|---|
|  |  |  | itemID = itemInfo[1][0] | 
|---|
|  |  |  | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID) | 
|---|
|  |  |  | if not itemData: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | if GetItemClassLV(itemData) > curAlchemyLV + alchemyDiffLV: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | resultWeightList.append(itemInfo) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | resultWeightList = weightList | 
|---|
|  |  |  | return resultWeightList | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## ======================================================================================= | 
|---|
|  |  |  |  | 
|---|