| | |
| | | return msgList
|
| | |
|
| | |
|
| | | ## 提示超级装备
|
| | | # @param curPlayer 当前玩家
|
| | | # @param curItem 得到的物品
|
| | | # @param notifyType 鉴定1 打造2 升星3 神器升星4 神器唤醒5 宠物装备合成6 丢宝箱装备7
|
| | | # @param useItemID 使用的物品id
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Notify_SuperItem(curPlayer, curItem, notifyType, useItemID=0):
|
| | | #===============================================================================
|
| | | #Item_Link_Appraisal 鉴定出了一件惊世神装
|
| | | #Item_Link_Factory 打造出了一件惊世神装
|
| | | #S1 -> playID,S2 -> playname,S3 -> playname,s4 -> itemID,s5 -> start,s6 -> hole,s7-s15 stoneID,s16 -> 五行,
|
| | | #s17 -> 灵魂技能ID,s18 -> 当前耐久,s19 -> 最大耐久,s20 -> 绑定,s21 -> MakeID,s22 -> 物品名字
|
| | | #===============================================================================
|
| | |
|
| | | |
| | | #升星及神器
|
| | | if notifyType in [3]:
|
| | | #===============================================================================
|
| | | # #升星的系统提示参数列表
|
| | | # roleName = curPlayer.GetName()
|
| | | # |
| | | # #S1 -> playID,S2 -> playname,S3 -> playname,
|
| | | # msgList = ['%s' % curPlayer.GetID(), '%s' % roleName, '%s' % roleName]
|
| | | # |
| | | # # 物品xml参数s4-s55
|
| | | # msgList.extend(GetItemXMLMsg(curItem))
|
| | | # |
| | | # # GameWorld.Log('升星,msgList = %s, %s'%(len(msgList), msgList))
|
| | | # if notifyType == 3:
|
| | | # msgList.extend(["%s" % curItem.GetItemStarLV()]) # 升星最后一个参数为星数
|
| | | # #普通升星
|
| | | # PlayerControl.WorldNotify(0, "Item_Link_UpGrade", msgList)
|
| | | #===============================================================================
|
| | |
|
| | | return
|
| | |
|
| | | |
| | | #---除升星外的系统提示参数列表---
|
| | | msgList = ['%s' % curPlayer.GetID(), '%s' % curPlayer.GetName(), '%s' % curPlayer.GetName(),
|
| | | '%s' % curItem.GetItemTypeID(),'%s' % curItem.GetIsBind(), '%s' % curItem.GetItemTypeID()
|
| | | ]
|
| | | #鉴定
|
| | | if notifyType == 1:
|
| | | PlayerControl.WorldNotify(0, "Item_Link_Appraisal", msgList)
|
| | | #打造
|
| | | elif notifyType == 2:
|
| | | PlayerControl.WorldNotify(0, "Item_Link_Factory", msgList)
|
| | | #宠物装备合成
|
| | | elif notifyType == 6:
|
| | | PlayerControl.WorldNotify(0, "Pet_liubo_436832", msgList)
|
| | | # mu装备全服广播
|
| | | elif notifyType == 7:
|
| | | # 插入使用的物品名
|
| | | if not useItemID:
|
| | | return
|
| | | msgList.insert(3, '%s' % useItemID)
|
| | | msgList.insert(4, '%s' % useItemID)
|
| | | itemInfo = GetNotifySuperItemInfo(curPlayer, curItem)
|
| | | msgList = msgList[:5] + itemInfo
|
| | | PlayerControl.WorldNotify(0, "GeRen_lhs_318691", msgList)
|
| | | return
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | |
|
| | | ## 清除按天过期物品
|
| | | # @param curPlayer 玩家
|
| | | # @return None
|
| | |
| | | GameWorld.DebugLog("物品过期时间" + timeStr)
|
| | | return GameWorld.ChangeTimeStrToNum(timeStr)
|
| | |
|
| | |
|
| | | ## 创建物品
|
| | | # @param itemID 物品ID
|
| | | # @return curSingleItem
|
| | | # @remarks 函数详细说明.
|
| | | def CreateSingleItem(itemID, itemCount=1, isBind=0, expireTime=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:
|
| | |
| | | #这里返回的是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):
|
| | |
| | |
|
| | | def CalcEquipGS(curItem):
|
| | | '''计算装备评分
|
| | | 评分组成:装备基础 + 传奇属性 + 绝版属性
|
| | | 评分组成:装备基础 + 传奇属性
|
| | | '''
|
| | | if not CheckNoteEquipGS(curItem):
|
| | | #GameWorld.DebugLog("不设置装备评分")
|
| | |
| | | break
|
| | | attrDict[effectID] = attrDict.get(effectID, 0) + curEffect.GetEffectValue(0)
|
| | |
|
| | | gsValueEx = 0
|
| | | skillGSDict = IpyGameDataPY.GetFuncCfg("EquipGSFormula", 4)
|
| | | for i in xrange(curItem.GetAddSkillCount()):
|
| | | addSkillID = curItem.GetAddSkill(i)
|
| | | if not addSkillID:
|
| | | break
|
| | | gsValueEx += skillGSDict.get(str(addSkillID), 0)
|
| | | |
| | | itemID = curItem.GetItemTypeID()
|
| | | classLV = GetItemClassLV(curItem)
|
| | | color = curItem.GetItemColor()
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | gsParamIpyData = IpyGameDataPY.GetIpyGameData("EquipGSParam", classLV, color, itemQuality)
|
| | | isSuit = 1 if curItem.GetSuiteID() > 0 else 0
|
| | | gsParamIpyData = IpyGameDataPY.GetIpyGameDataNotLog("EquipGSParam", classLV, color, isSuit)
|
| | | # 传奇属性
|
| | | legendAttrIDCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID)
|
| | | legendAttrValueCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue)
|
| | |
| | | attrValue = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValue, i)
|
| | | attrDict[attrID] = attrDict.get(attrID, 0) + attrValue
|
| | |
|
| | | lingQiIpyData = IpyGameDataPY.GetIpyGameDataNotLog("LingQiAttr", itemID)
|
| | | if lingQiIpyData:
|
| | | gsValueEx += lingQiIpyData.GetLingQiAttrScore()
|
| | | |
| | | 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)
|
| | | FabaoHurt = attrDict.get(ShareDefine.Def_Effect_FabaoHurt, 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())
|
| | | SkillAtkRateReduce = attrDict.get(ShareDefine.Def_Effect_SkillAtkRateReduce, 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())
|
| | | SkillAddPer1 = attrDict.get(ShareDefine.Def_Effect_SkillAddPer1, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer1C())
|
| | | SkillAddPer2 = attrDict.get(ShareDefine.Def_Effect_SkillAddPer2, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer2C())
|
| | | SkillAddPer3 = attrDict.get(ShareDefine.Def_Effect_SkillAddPer3, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer3C())
|
| | | SkillAddPer4 = attrDict.get(ShareDefine.Def_Effect_SkillAddPer4, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer4C())
|
| | | SkillAddPer5 = attrDict.get(ShareDefine.Def_Effect_SkillAddPer5, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer5C())
|
| | | SkillAddPer6 = attrDict.get(ShareDefine.Def_Effect_SkillAddPer6, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer6C())
|
| | | SkillAddPer7 = attrDict.get(ShareDefine.Def_Effect_SkillAddPer7, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer7C())
|
| | | SkillReducePer1 = attrDict.get(ShareDefine.Def_Effect_SkillReducePer1, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer1C())
|
| | | SkillReducePer2 = attrDict.get(ShareDefine.Def_Effect_SkillReducePer2, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer2C())
|
| | | SkillReducePer3 = attrDict.get(ShareDefine.Def_Effect_SkillReducePer3, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer3C())
|
| | | SkillReducePer4 = attrDict.get(ShareDefine.Def_Effect_SkillReducePer4, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer4C())
|
| | | SkillReducePer5 = attrDict.get(ShareDefine.Def_Effect_SkillReducePer5, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer5C())
|
| | | SkillReducePer6 = attrDict.get(ShareDefine.Def_Effect_SkillReducePer6, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer6C())
|
| | | SkillReducePer7 = attrDict.get(ShareDefine.Def_Effect_SkillReducePer7, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer7C())
|
| | | SkillAddPerA = 0
|
| | | SkillAddPerB = 0
|
| | | SkillAddPerC = 0
|
| | | SkillAddPerD = 0
|
| | | SkillAddPerE = 0
|
| | | SkillAddPerF = 0
|
| | | SkillAddPerG = 0
|
| | | SkillReducePerA = 0
|
| | | SkillReducePerB = 0
|
| | | SkillReducePerC = 0
|
| | | SkillReducePerD = 0
|
| | | SkillReducePerE = 0
|
| | | SkillReducePerF = 0
|
| | | SkillReducePerG = 0
|
| | |
|
| | | # 攻速不默认乘,仅作为参数提供策划使用
|
| | | AtkSpeed = attrDict.get(ShareDefine.Def_Effect_AtkSpeed, 0)
|
| | | AtkSpeedC = 1 if not gsParamIpyData else gsParamIpyData.GetAtkSpeedC()
|
| | | |
| | | # 绝版
|
| | | outOfPrintAttrIDCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetOutOfPrintAttrID)
|
| | | outOfPrintAttrValueCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetOutOfPrintAttrValue)
|
| | | if outOfPrintAttrIDCnt and outOfPrintAttrIDCnt == outOfPrintAttrValueCnt:
|
| | | for i in xrange(legendAttrIDCnt):
|
| | | attrID = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetOutOfPrintAttrID, i)
|
| | | attrValue = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetOutOfPrintAttrValue, i)
|
| | | attrDict[attrID] = attrDict.get(attrID, 0) + attrValue
|
| | | AtkSpeed = 0#attrDict.get(ShareDefine.Def_Effect_AtkSpeed, 0)
|
| | | AtkSpeedC = 1#1 if not gsParamIpyData else gsParamIpyData.GetAtkSpeedC()
|
| | |
|
| | | OnlyFinalHurt = attrDict.get(ShareDefine.Def_Effect_OnlyFinalHurt, 0)
|
| | | PVPAtkBackHP = attrDict.get(ShareDefine.Def_Effect_PVPAtkBackHP, 0)
|
| | |
| | | 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")))
|
| | | value += gsValueEx
|
| | | 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:
|
| | |
| | | return 0
|
| | | keyStr = ChConfig.Def_VPackCnt_Dict[packindex]
|
| | | return IpyGameDataPY.GetFuncCfg(keyStr)
|
| | | #---------------------------------------------------------------------
|
| | | ## 获得物品信息提示
|
| | | # @param curPlayer 当前玩家
|
| | | # @param useItemID 使用物品
|
| | | # @param singleItem 通知的物品对象
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def NeedNotifyItem(curPlayer, useItemID , singleItem):
|
| | | #需要提示的物品列表
|
| | | #===========================================================================
|
| | | # itemIDDict = ReadChConfig.GetEvalChConfig('need_notify_id_dict')
|
| | | # if useItemID not in itemIDDict.keys():
|
| | | # return
|
| | | # |
| | | # notifyList = itemIDDict.get(useItemID, [])
|
| | | # |
| | | # if not notifyList:
|
| | | # GameWorld.Log("NeedNotifyItem() need_notify_id_dict.txt error useItemID=%s not data" % (useItemID))
|
| | | # return
|
| | | # |
| | | # isQualityNotify = notifyList[0] # 卓越是否提示
|
| | | # notifyStarLV = notifyList[1] # 通知的强化星级
|
| | | # itemIdList = notifyList[2:] # 去除星级通知的,其他的为具体id通知
|
| | | # |
| | | # curItemID = singleItem.GetItemTypeID()
|
| | | # curItemCount = singleItem.GetCount()
|
| | | # # 如果是指定标的物
|
| | | # if (curItemID, curItemCount) in itemIdList:
|
| | | # PlayerControl.WorldNotify(0, "itemuse_chenxin_0", [curPlayer.GetPlayerName(),
|
| | | # useItemID, useItemID, curItemID, curItemID, curItemCount])
|
| | | # return
|
| | | # |
| | | # # 其他的装备判断
|
| | | # itemQuality = singleItem.GetItemQuality()
|
| | | # isSuite = singleItem.GetIsSuite()
|
| | | # plusLV = singleItem.GetItemStarLV()
|
| | | # # 卓越广播,套装广播,星级广播
|
| | | # if (isQualityNotify and itemQuality) or isSuite or plusLV >= notifyStarLV:
|
| | | # Notify_SuperItem(curPlayer, singleItem, 7, useItemID)
|
| | | #===========================================================================
|
| | | |
| | | return
|
| | |
|
| | |
|
| | | ## 杀怪掉落提示
|
| | |
| | | # @return None
|
| | | def NotifyItemDropByKill(curPlayer, curItem, npcID, notifyMark='', mapID=0):
|
| | | return #吕超说此处屏蔽
|
| | | #需要提示的物品列表
|
| | | itemIDDict = ReadChConfig.GetEvalChConfig('need_notify_id_dict')
|
| | |
|
| | | notifyList = itemIDDict.get(0, [])
|
| | | if not notifyList:
|
| | | #GameWorld.Log("NotifyItemDropByKill() need_notify_id_dict.txt error useItemID=0")
|
| | | return
|
| | | |
| | | playerName = curPlayer.GetPlayerName()
|
| | | notifyQuality = notifyList[0] # 需要提示的品质等级
|
| | | notifyStarLV = notifyList[1] # 通知的强化星级
|
| | | itemIdList = notifyList[2:] # 去除星级通知的,其他的为具体id通知
|
| | | |
| | | curItemID = curItem.GetItemTypeID()
|
| | | curItemCount = curItem.GetCount()
|
| | | mapID = GameWorld.GetMap().GetMapID() if not mapID else mapID
|
| | | # 如果是指定标的物
|
| | | if (curItemID, curItemCount) in itemIdList:
|
| | | itemIDMarkDict = ReadChConfig.GetEvalChConfig('need_notify_id_mark_dict')
|
| | | notifyMark = itemIDMarkDict.get(curItemID, "GeRen_admin_272921")
|
| | | PlayerControl.WorldNotify(0, notifyMark, [playerName, mapID, npcID, curItemID, curItemID])
|
| | | return
|
| | | |
| | | # 其他的装备判断
|
| | | # itemQuality = curItem.GetItemQuality()
|
| | | # isSuite = curItem.GetIsSuite()
|
| | | # plusLV = curItem.GetItemStarLV()
|
| | | # # 卓越广播,套装广播,星级广播
|
| | | # if not ((itemQuality >= notifyQuality) or isSuite or plusLV >= notifyStarLV):
|
| | | # return
|
| | | |
| | | msgList = ['%s' % playerName, |
| | | '%s' % mapID, |
| | | '%s' % npcID,
|
| | | #'%s' % 0,
|
| | | ] + GetNotifySuperItemInfo(curPlayer, curItem)
|
| | | |
| | | notifyMark = notifyMark if notifyMark else "GeRen_admin_671654"
|
| | | PlayerControl.WorldNotify(0, notifyMark , msgList)
|
| | | return
|
| | |
|
| | | def GetNotifySuperItemInfo(curPlayer, curItem, place=None):
|
| | | '''装备提示超链接信息汇总
|
| | | <a><Word info=item id=%s0/>|showitem=%s0 isbind=%s1 itemcnt=%s2 stone=%s3 userdata=%s4 place=%s5 equippartsuite=%s6 strengthenlv=%s7 equipwash=%s8 equipitems=%s9</a>
|
| | | isbind:是否绑定
|
| | | itemcnt:物品数量
|
| | | stone:宝石信息 [stoneItemID, ...]
|
| | | userdata:传奇属性
|
| | | place:装备位
|
| | | equippartsuite:套装信息 同查看玩家
|
| | | strengthenlv:强化等级
|
| | | equipwash:洗练信息 同查看玩家,单部位
|
| | | equipitems:各部位物品id [[装备位,物品id] ...]
|
| | | def CacheNotifyEquipDetailInfo(curPlayer, curEquip):
|
| | | ''' 缓存装备广播信息中的装备明细信息
|
| | | 因为本版本需要的查看的内容相对较多,为了减少全服广播流量消耗,所以先进行缓存,玩家点击查看时再进行查询
|
| | | '''
|
| | | if place == None:
|
| | | place = curItem.GetEquipPlace()
|
| | | |
| | | guid = curEquip.GetGUID()
|
| | | packType = curEquip.GetItemPlaceType()
|
| | | packIndex = curEquip.GetItemPlaceIndex()
|
| | | if packType != IPY_GameWorld.rptEquip:
|
| | | return guid
|
| | | |
| | | classLV = GetItemClassLV(curEquip)
|
| | | if not classLV:
|
| | | return guid
|
| | | |
| | | itemID = curEquip.GetItemTypeID()
|
| | | #部位星级
|
| | | equipStar = ChEquip.GetEquipPartStarByRank(curPlayer, packIndex, curEquip)
|
| | | |
| | | #部位强化数据
|
| | | plusLV = ChEquip.GetEquipPartPlusLVByRank(curPlayer, packType, packIndex, curEquip)
|
| | | plusEvolveLV = ChEquip.GetEquipPartPlusEvolveLVByEquip(curPlayer, packType, packIndex, curEquip)
|
| | | |
| | | #部位洗练数据
|
| | | washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % packIndex)
|
| | | washValueList = []
|
| | | for attrNum in xrange(1, Operate_EquipWash.Def_EquipWashMaxAttrCount + 1):
|
| | | value = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (packIndex, attrNum))
|
| | | washValueList.append(value)
|
| | |
|
| | | notifyList = [""] * 10
|
| | | notifyList[0] = curItem.GetItemTypeID()
|
| | | notifyList[1] = curItem.GetIsBind()
|
| | | notifyList[2] = curItem.GetCount()
|
| | | notifyList[3] = "%s" % Operate_EquipStone.GetEquipIndexStoneIDList(curPlayer, place)
|
| | | 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)
|
| | | #部位宝石数据
|
| | | stoneIDList = Operate_EquipStone.GetEquipIndexStoneIDList(curPlayer, packIndex)
|
| | |
|
| | | # 单部位洗练信息
|
| | | washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % place) + 1
|
| | | valueList = [curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (place, attrNum)) \
|
| | | for attrNum in xrange(1, Operate_EquipWash.Def_EquipWashMaxAttrCount + 1)]
|
| | | notifyList[8] = "%s" % {"Place":place, "LV":washLV, "Value":valueList}
|
| | | |
| | | # 身上所穿装备ID信息
|
| | | equipItems = []
|
| | | playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | for equipIndex in xrange(playerEquip.GetCount()):
|
| | | if equipIndex not in ShareDefine.RoleEquipType :
|
| | | continue
|
| | | curEquip = playerEquip.GetAt(equipIndex)
|
| | | if not curEquip or curEquip.IsEmpty():
|
| | | continue
|
| | | equipItems.append([curEquip.GetItemPlaceIndex(), curEquip.GetItemTypeID()])
|
| | | notifyList[9] = "%s" % equipItems
|
| | | |
| | | return notifyList
|
| | | #本阶已穿装备ID [[itemID,star], ...]
|
| | | classItems = [] |
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'ClassLV':classLV}, True)
|
| | | if ipyDataList:
|
| | | equipPack = curPlayer.GetItemManager().GetPack(packType)
|
| | | for ipyData in ipyDataList:
|
| | | index = ipyData.GetGridIndex()
|
| | | classEquip = equipPack.GetAt(index)
|
| | | if not classEquip or classEquip.IsEmpty():
|
| | | continue
|
| | | equipID = classEquip.GetItemTypeID()
|
| | | star = ChEquip.GetEquipPartStarByRank(curPlayer, index, classEquip)
|
| | | classItems.append([equipID, star])
|
| | | |
| | | cacheInfo = [guid, itemID, equipStar, plusLV, plusEvolveLV, washLV, washValueList, stoneIDList, classItems]
|
| | | cacheInfo = json.dumps(cacheInfo, ensure_ascii=False)
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "NotifyEquipDetailInfo", cacheInfo, len(cacheInfo))
|
| | | return guid
|
| | |
|
| | | ## 使用物品的特殊提示
|
| | | # @param curPlayer 当前玩家
|
| | |
| | | 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
|
| | |
| | | return isExpireItem, remainingTime
|
| | |
|
| | | return isExpireItem, remainingTime
|
| | |
|
| | | ##检查该物品是否合法,类型验证
|
| | | # @param curItem 物品实例
|
| | | # @param checkType 物品类型 |
| | | # @return 布尔值(物品是否合法)
|
| | | # @remarks 检查该物品是否合法,类型验证
|
| | | def CheckItemByType(curItem, checkType):
|
| | | #验证材料
|
| | | if not CheckItemCanUse(curItem):
|
| | | return False
|
| | | |
| | | #类型不符合
|
| | | if curItem.GetType() != checkType:
|
| | | return False
|
| | | |
| | | return True
|
| | |
|
| | | ## 检查装备是否有镶嵌宝石
|
| | | # @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, needCount=0):
|
| | | 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:
|
| | |
| | | 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:
|
| | |
| | | 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 in [IPY_GameWorld.rptEquip, ShareDefine.rptZhuXianEquip]:
|
| | | if putInPackIndex in [IPY_GameWorld.rptEquip]:
|
| | | DoLogic_ItemBindType(curPlayer, switchItem, ChConfig.Def_BindType_DoEquipBind)
|
| | |
|
| | | # 装备技能书、坐骑装备绑定
|
| | | if putInPackIndex in [IPY_GameWorld.rptHorseEquip, ShareDefine.rptZhuXianEquip]:
|
| | | if putInPackIndex in [IPY_GameWorld.rptHorseEquip]:
|
| | | DoLogic_ItemBindType(curPlayer, curItem, ChConfig.Def_BindType_DoEquipBind)
|
| | |
|
| | | #交换装备
|
| | |
| | | return
|
| | |
|
| | | ##物品绑定字段判定 -> 装备绑定
|
| | | if putInPackIndex in [IPY_GameWorld.rptEquip, ShareDefine.rptZhuXianEquip]:
|
| | | if putInPackIndex in [IPY_GameWorld.rptEquip]:
|
| | | DoLogic_ItemBindType(curPlayer, switchItem, ChConfig.Def_BindType_DoEquipBind)
|
| | |
|
| | | # 装备技能书、坐骑装备绑定
|
| | | if putInPackIndex in [IPY_GameWorld.rptHorseEquip, ShareDefine.rptZhuXianEquip]:
|
| | | if putInPackIndex in [IPY_GameWorld.rptHorseEquip]:
|
| | | DoLogic_ItemBindType(curPlayer, emptyItem, ChConfig.Def_BindType_DoEquipBind)
|
| | |
|
| | | if switchItem.GetGameWorldItemType() == IPY_GameWorld.gwitRoleItem:
|
| | |
| | | def GetIsDogzEquip(curItem):
|
| | | ## 返回是否神兽装备
|
| | | return curItem.GetType() in ChConfig.Def_DogzEquiipType
|
| | |
|
| | | def GetIsZhuXianEquip(curItem):
|
| | | ## 返回是否诛仙装备
|
| | | return curItem.GetType() in ChConfig.Def_ZhuXianEquiipType
|
| | |
|
| | | ## 返回是否武器
|
| | | # @param curItem 当前物品
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GetIsWeapon(curItem):
|
| | | return curItem.GetType() in ChConfig.Def_WeaponItemType
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ##遍历数据库查找合适的物品, 通过 效果ID + 效果A值确定物品
|
| | |
| | | curItem = curItemPack.GetAt(i)
|
| | |
|
| | | #检查物品
|
| | | if not CheckItemCanUse(curItem):
|
| | | if not CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem):
|
| | | continue
|
| | |
|
| | | effect = curItem.GetEffectByIndex(0)
|
| | |
| | | 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:
|
| | | def GetWeightItemListByAlchemyDiffLV(curPlayer, weightList, alchemyDiffLV):
|
| | | ''' 根据炼丹等级差异等级过滤权重列表中不满足的物品,返回新的权重列表
|
| | | @param weightList: 物品权重信息列表
|
| | | @param alchemyDiffLV: 是否过滤掉大于X级的炼丹等级物品,0-不过滤,1-过滤且读默认配置,>1-特殊功能指定的过滤等级
|
| | | '''
|
| | | resultWeightList = []
|
| | | if alchemyDiffLV:
|
| | | # 如果有指定大于1的等级则取指定等级,没有的话取默认等级差
|
| | | if alchemyDiffLV == 1:
|
| | | alchemyDiffLV = IpyGameDataPY.GetFuncCfg("AlchemyDiffLV", 1)
|
| | | curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
|
| | | for itemInfo in weightList:
|
| | | itemID = itemInfo[1][0]
|
| | | if itemID: # 支持配置ID为0时代表不产出
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | 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
|
| | | if GetItemClassLV(itemData) > curAlchemyLV + alchemyDiffLV:
|
| | | continue
|
| | | resultWeightList.append(itemInfo)
|
| | | else:
|
| | | resultWeightList = weightList
|
| | | return resultWeightList
|
| | |
|
| | | ## =======================================================================================
|
| | |
|