| | |
| | | self.__PlayerItem = self.__PlayerItemManager.GetPack(IPY_GameWorld.rptItem)
|
| | | return
|
| | |
|
| | | ## 玩家是否能装备物品 |
| | | # @param curItem 当前物品
|
| | | # @param needNotify 是否需要通知客户端
|
| | | # @return 布尔值
|
| | | # @remarks 函数详细说明.
|
| | | def PlayerCanEquipItem(self, curItem, needNotify):
|
| | | curPlayer = self.__Player
|
| | | #非法装备检查
|
| | | if curItem.GetIsLocked():
|
| | | if needNotify:
|
| | | PlayerControl.NotifyCode(curPlayer, "RescannotEquip")
|
| | | |
| | | return False
|
| | | |
| | | #任务物品检查
|
| | | if IsEventItem(curItem):
|
| | | if needNotify:
|
| | | PlayerControl.NotifyCode(curPlayer, "TaskRes")
|
| | | |
| | | return False
|
| | | |
| | | #数据库中是1开始
|
| | | # if curItem.GetEquipPlace() == 0:
|
| | | # if needNotify:
|
| | | # #物品不能装备
|
| | | # PlayerControl.NotifyCode(curPlayer, "GeRen_hgg_595819")
|
| | | #
|
| | | # return False
|
| | | |
| | | #职业检查
|
| | | if not ItemCommon.CheckJob(curPlayer, curItem):
|
| | | if needNotify:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_31379")
|
| | |
|
| | | return False
|
| | |
|
| | | #性别检查
|
| | | curItemNeedSexReq = curItem.GetSexReq()
|
| | | |
| | | if curItemNeedSexReq != ChConfig.Def_PlayerSex_All and curItemNeedSexReq != curPlayer.GetSex() :
|
| | | if needNotify:
|
| | | PlayerControl.NotifyCode(curPlayer, "SexErr")
|
| | |
|
| | | return False
|
| | |
|
| | | #等级检查
|
| | | if not CheckItemUseLV(curPlayer, curItem, needNotify):
|
| | | return False
|
| | | |
| | | #=======================================================================
|
| | | # #马匹检查
|
| | | # if curItem.GetType() == ChConfig.Def_Item_Type_Horse and not CheckCanEquipHorse(curPlayer):
|
| | | # return False
|
| | | #=======================================================================
|
| | |
|
| | | |
| | | return True
|
| | | |
| | | |
| | | ## 交换装备
|
| | | # @param curItem 当前物品
|
| | | # @param equipPackIndex 装备背包格子
|
| | |
| | |
|
| | | return False
|
| | |
|
| | | # 计算装备的珍品数量
|
| | | def RefreshStartEquipCount(self):
|
| | | # curPlayer = self.__Player
|
| | | # count = 0
|
| | | # equipPack = self.__PlayerEquip
|
| | | # for i in xrange(equipPack.GetCount()):
|
| | | # curEquip = equipPack.GetAt(i)
|
| | | # |
| | | # if curEquip.IsEmpty():
|
| | | # continue
|
| | | # |
| | | # if not curEquip.GetItemQuality():
|
| | | # continue
|
| | | # |
| | | # count += 1
|
| | | # |
| | | # curPlayer.SetDict(ChConfig.Def_PlayerKey_StartEquipCnt, count)
|
| | | return
|
| | | |
| | | def GetStartEquipCount(self):
|
| | | return 0
|
| | | #curPlayer = self.__Player
|
| | | #return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_StartEquipCnt)
|
| | |
|
| | | ## 装备当前物品
|
| | | # @param curItem 当前物品
|
| | | # @param equipPackIndex 客户端发来装备位置(IPY_GameWorld.retMax 代表服务器自动装备)
|
| | | # @return 替换的位置 -1表示替换失败
|
| | | def EquipItem(self, curItem, equipPackIndex):
|
| | | if not self.PlayerCanEquipItem(curItem, True):
|
| | | return -1
|
| | | |
| | | classLV = ItemCommon.GetItemClassLV(curItem)
|
| | | equipPlace = curItem.GetEquipPlace()
|
| | | |
| | | curPlayer = self.__Player
|
| | | equipPack = self.__PlayerEquip
|
| | | equipItem = equipPack.GetAt(equipPackIndex)
|
| | | if not equipItem:
|
| | | return -1
|
| | | desItemID, desUserData = [0, ''] if equipItem.IsEmpty() else [equipItem.GetItemTypeID(), equipItem.GetUserData()]
|
| | | srcItemID, srcUserData = curItem.GetItemTypeID(), curItem.GetUserData()
|
| | | |
| | | befIsOrangeEquip = 1 if (not equipItem.IsEmpty() and equipItem.GetItemColor() >= ChConfig.Def_Quality_Orange) else 0
|
| | | aftIsOrangeEquip = 1 if curItem.GetItemColor() >= ChConfig.Def_Quality_Orange else 0
|
| | | |
| | | #--其他装备物品---
|
| | | #itemColor = curItem.GetItemColor()
|
| | | result = self.SwitchEquip(curItem, equipPackIndex)
|
| | | if result:
|
| | | #换装宝石处理
|
| | | Operate_EquipStone.DoMoveEquipStone(curPlayer, equipPackIndex)
|
| | | dataDict = {'dotype':'EquipItem', 'desItemID':desItemID, 'desUserData':desUserData,'srcItemID':srcItemID,'srcUserData':srcUserData}
|
| | | DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_EquipChange, dataDict)
|
| | | self.__UpdEquipOrangeCount(befIsOrangeEquip, aftIsOrangeEquip)
|
| | | |
| | | self.RefreshStartEquipCount()
|
| | | return equipPlace if result else -1
|
| | | |
| | | def __UpdEquipOrangeCount(self, befIsOrangeEquip, aftIsOrangeEquip):
|
| | | #更新橙装数量
|
| | | curPlayer = self.__Player
|
| | | befEquipOrangeCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_EquipOrangeCount)
|
| | | aftEquipOrangeCount = max(0, befEquipOrangeCount + aftIsOrangeEquip - befIsOrangeEquip)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_EquipOrangeCount, aftEquipOrangeCount)
|
| | | GameWorld.DebugLog("更新橙装及以上件数: befIsOrangeEquip=%s,aftIsOrangeEquip=%s,befEquipOrangeCount=%s,aftEquipOrangeCount=%s" |
| | | % (befIsOrangeEquip, aftIsOrangeEquip, befEquipOrangeCount, aftEquipOrangeCount))
|
| | | return
|
| | |
|
| | | ## 替换可以叠加物品逻辑
|
| | | # @param curEquip 当前装备
|
| | |
| | | SetItemCount(curItem, sumValue - equipPackCount)
|
| | |
|
| | | return True
|
| | | |
| | | ## 卸载物品 |
| | | # @param equipIndex 装备索引
|
| | | # @param packIndex 背包索引
|
| | | # @return equipID , equipPlace
|
| | | # @remarks 函数详细说明.
|
| | | def UnEquipItem(self, equipIndex, packIndex):
|
| | | curPlayer = self.__Player
|
| | | equipItem = self.__PlayerEquip
|
| | | curEquip = equipItem.GetAt(equipIndex)
|
| | | #目标装备检查
|
| | | if curEquip == None or curEquip.IsEmpty():
|
| | | return
|
| | | |
| | | equipID = curEquip.GetItemTypeID()
|
| | | userData = curEquip.GetUserData()
|
| | | equipPlace = curEquip.GetEquipPlace()
|
| | | suiteID = curEquip.GetSuiteID()
|
| | | itemClassLV = ItemCommon.GetItemClassLV(curEquip)
|
| | | #该物品锁定不执行==============================================
|
| | | if curEquip.GetIsLocked():
|
| | | PlayerControl.NotifyCode(curPlayer, "RescannotEquip")
|
| | | return
|
| | | |
| | | if IsEventItem(curEquip):
|
| | | PlayerControl.NotifyCode(curPlayer, "TaskRes")
|
| | | return
|
| | | |
| | | #物品栏背包
|
| | | curPack = self.__PlayerItemManager.GetPack(IPY_GameWorld.rptItem)
|
| | | |
| | | if packIndex < 0 or packIndex >= curPack.GetCount():
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [IPY_GameWorld.rptItem])
|
| | | return
|
| | | |
| | | curEquipCount = curEquip.GetCount()
|
| | | |
| | | #装备为单数量物品无需遍历背包判定,以拖入的某个格子是否可以填充为判定 __CanDragItem
|
| | | #=======================================================================
|
| | | # if not self.CanPutInItem(IPY_GameWorld.rptItem, equipID, curEquipCount, curEquip.GetIsBind()):
|
| | | # #GameWorld.Log("玩家背包无法放入这个物品")
|
| | | # return
|
| | | #=======================================================================
|
| | | |
| | | #设置物品激活状态为False
|
| | | #curEquip.SetIsSoulActive(False)
|
| | | # if curEquip.GetItemStarLV() != 0:
|
| | | # curEquip.SetItemStarLV(0) # 脱下的物品星级设置为0
|
| | | |
| | | befIsOrangeEquip = 1 if curEquip.GetItemColor() >= ChConfig.Def_Quality_Orange else 0
|
| | | aftIsOrangeEquip = 0
|
| | | |
| | | #背包物品放入仓库
|
| | | if not DragItem(curPlayer, IPY_GameWorld.rptEquip, equipIndex, IPY_GameWorld.rptItem, packIndex, curEquipCount):
|
| | | return
|
| | | self.RefreshStartEquipCount()
|
| | | self.__UpdEquipOrangeCount(befIsOrangeEquip, aftIsOrangeEquip)
|
| | | |
| | | # 广播卸装
|
| | | if equipIndex in PlayerControl.GetFaceEquipIndexList(curPlayer) or equipPlace in ChConfig.Def_SyncEquipStateByIndex:
|
| | | curPlayer.Sync_UnEquipItem(equipID, equipIndex)
|
| | | if suiteID and itemClassLV == ChEquip.GetEquipFacadeClassLV(curPlayer):
|
| | | #脱当前外观阶的套装
|
| | | ChEquip.ChangeEquipfacadeByClassLV(curPlayer, itemClassLV)
|
| | | |
| | | dataDict = {'dotype':'UnEquipItem', 'equipID':equipID, 'userData':userData}
|
| | | DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_EquipChange, dataDict)
|
| | | #===============================================================================
|
| | | # #destItemPlace = 卸下物品的位置 |
| | | # destItemPlace = curPack.GetAt(packIndex)
|
| | | # |
| | | # if destItemPlace == None or destItemPlace.IsEmpty() == 0:
|
| | | # #卸下目标不是空的
|
| | | # GameWorld.Log("卸下目标不是空的")
|
| | | # return
|
| | | # |
| | | # destItemPlace.PutIn(curEquip)
|
| | | #===============================================================================
|
| | | return equipID, equipPlace, itemClassLV
|
| | |
|
| | | #是否能放入物品(第几个物品栏, 物品序号, 放入的物品, 放入物品ID, 物品是否绑定)
|
| | | #===============================================================================
|
| | |
| | | itemNoteDict = ItemCommon.GetItemNoteDict(item, canPutinCount, packItemCount, canPutinCount)
|
| | | ItemCommon.DR_GetItem(curPlayer, packIndex, eventName, itemNoteDict, addDict)
|
| | | else:
|
| | | #可以放下
|
| | | if isEquip:
|
| | | self.CheckEquipAttr(packIndex, tagItem)
|
| | | |
| | | if tagItem.GetGameWorldItemType() == IPY_GameWorld.gwitRoleItem:
|
| | | item.PutIn(tagItem)
|
| | | elif tagItem.GetGameWorldItemType() == IPY_GameWorld.gwitSingleItem:
|
| | |
| | |
|
| | | #放入东西
|
| | | return putResult
|
| | | |
| | | def CheckEquipAttr(self, packType, curItem):
|
| | | legendAttrIDCount = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID)
|
| | | legendAttrValueCount = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue)
|
| | | |
| | | if legendAttrIDCount and legendAttrValueCount and legendAttrIDCount == legendAttrValueCount:
|
| | | return
|
| | | |
| | | curPlayer = self.__Player
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer)
|
| | | if not legendAttrInfo:
|
| | | return
|
| | | |
| | | curPlayer = self.__Player
|
| | | srcScore = ItemCommon.GetEquipGearScore(curItem)
|
| | | SetEquipLegendAttr(curItem, legendAttrInfo)
|
| | | ItemCommon.MakeEquipGS(curItem)
|
| | | updScore = ItemCommon.GetEquipGearScore(curItem)
|
| | | GameWorld.DebugLog("传奇属性异常,重新刷新一次属性: packType=%s,itemID=%s,srcScore=%s,updScore=%s" |
| | | % (packType, curItem.GetItemTypeID(), srcScore, updScore), curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | ## 是否能放入物品
|
| | | # @param packIndex 背包索引
|
| | |
| | |
|
| | | ## 背包整理
|
| | | def ResetItem(curPlayer, packIndex, beingIndex, endIndex, tick):
|
| | |
|
| | | # 卡牌约定后端不整理背包,由前端自行排序
|
| | | #开始整理
|
| | | __DoResetItem(curPlayer, packIndex, beingIndex, endIndex, tick)
|
| | | curPlayer.Notify_PackResetOK()
|
| | | #__DoResetItem(curPlayer, packIndex, beingIndex, endIndex, tick)
|
| | | #curPlayer.Notify_PackResetOK()
|
| | | return
|
| | |
|
| | |
|
| | |
| | | posNum1, posNum2 = 0, 0
|
| | | for lpIndex in range(item1.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)):
|
| | | lineupValue = item1.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | lineupID = lineupValue / 10000
|
| | | lineupID, _, posNum = PlayerHero.GetLineupValue(lineupValue)
|
| | | if lineupID != ShareDefine.Lineup_Main:
|
| | | continue
|
| | | posNum1 = lineupValue % 100
|
| | | posNum1 = posNum
|
| | | break
|
| | |
|
| | | for lpIndex in range(item2.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)):
|
| | | lineupValue = item2.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | lineupID = lineupValue / 10000
|
| | | lineupID, _, posNum = PlayerHero.GetLineupValue(lineupValue)
|
| | | if lineupID != ShareDefine.Lineup_Main:
|
| | | continue
|
| | | posNum2 = lineupValue % 100
|
| | | posNum2 = posNum
|
| | | break
|
| | |
|
| | | if (posNum1 and posNum2) or (not posNum1 and not posNum2):
|
| | |
| | |
|
| | | return
|
| | |
|
| | | ## 清除背包中的任务物品
|
| | | # @param curPlayer 当前玩家
|
| | | # @param packIndex 背包类型
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def ClearPackEventItem(curPlayer , packIndex):
|
| | | curPack = curPlayer.GetItemManager().GetPack(packIndex)
|
| | | itemList = []
|
| | | |
| | | for i in range(0, curPack.GetCount()):
|
| | | item = curPack.GetAt(i)
|
| | | #空物品
|
| | | if not item or item.IsEmpty():
|
| | | continue
|
| | | |
| | | #不是任务物品
|
| | | if not IsEventItem(item):
|
| | | continue
|
| | | |
| | | itemList.append(item)
|
| | | |
| | | curPlayerID = curPlayer.GetID()
|
| | | |
| | | for item in itemList:
|
| | | GameWorld.Log('###清空背包 = %s 中的任务物品 = %s' % (packIndex , item.GetItemTypeID()) , curPlayerID)
|
| | | item.Clear()
|
| | | |
| | | return
|
| | |
|
| | | def CheckGiveBindMoneyTypeItem(curPlayer, checkMoneyType=None):
|
| | | ## 检查给绑定货币的展示物品
|
| | | bindMoneyItemInfo = IpyGameDataPY.GetFuncEvalCfg("PutInItemPack", 2, {})
|
| | |
| | | if isAuctionItem:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime, int(time.time()))
|
| | | return
|
| | | |
| | | if not curPlayer:
|
| | | return
|
| | | |
| | | if ItemCommon.GetIsEquip(curItem):
|
| | | legendAttrIDCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID)
|
| | | legendAttrValueCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue)
|
| | | if legendAttrIDCnt and legendAttrIDCnt == legendAttrValueCnt:
|
| | | legendAttrInfo = GetEquipLegendAttrGroup(curItem)
|
| | | #GameWorld.DebugLog("已经有传奇属性的拍品: %s" % str(legendAttrInfo))
|
| | | else:
|
| | | # 生成传奇属性
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer)
|
| | | #GameWorld.DebugLog("重新生成传奇属性的拍品: %s" % str(legendAttrInfo))
|
| | | if not legendAttrInfo:
|
| | | return
|
| | | |
| | | updateDict = {}
|
| | | if legendAttrInfo[0]:
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrID] = legendAttrInfo[0]
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrValue] = legendAttrInfo[1]
|
| | | if legendAttrInfo[2]:
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrIDShen] = legendAttrInfo[2]
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrValueShen] = legendAttrInfo[3]
|
| | | if legendAttrInfo[4]:
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrIDXian] = legendAttrInfo[4]
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrValueXian] = legendAttrInfo[5]
|
| | | if legendAttrInfo[6]:
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrIDJi] = legendAttrInfo[6]
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrValueJi] = legendAttrInfo[7]
|
| | | |
| | | delKeyList = [ShareDefine.Def_IudetAuctionItemCreateTime]
|
| | | ItemCommon.UpdateItemUserData(curItem, updateDict, delKeyList, isUpdateGS=True)
|
| | | |
| | | return
|
| | |
|
| | | def GetItemCountByID(curPlayer, itemID):
|
| | |
| | | return True
|
| | | return False
|
| | |
|
| | | ## 双手武器,需要两只手才拿得动
|
| | | # @param curEquip
|
| | | # @return bool
|
| | | def IsTwoHandedWeapon(curEquip):
|
| | | return curEquip.IsBothHands() == ShareDefine.Def_Weapon_Two_Handed
|
| | |
|
| | |
|
| | | ## 双持武器,左右手都可以拿得起来的武器
|
| | | # @param curEquip
|
| | | # @return bool
|
| | | def IsDualWeapons(curEquip):
|
| | | return curEquip.IsBothHands() == ShareDefine.Def_Weapon_Dual_Hands
|
| | |
|
| | |
|
| | | ## 装备多位置装备处理
|
| | | # @param equipPack 当前装备背包
|
| | | # @param packEquipIndex 客户端发来装备位置(IPY_GameWorld.retMax 代表服务器自动装备)
|
| | | # @param placeList 可装备的位置列表
|
| | | # @return 装备位置
|
| | | def GetMultiPlaceEquipPlace(equipPack, packEquipIndex, placeList):
|
| | | |
| | | #---客户端指定位置---
|
| | | if packEquipIndex in placeList:
|
| | | return packEquipIndex
|
| | | |
| | | #---服务端判断空位置---
|
| | | for placeIndex in placeList:
|
| | | curEquip = equipPack.GetAt(placeIndex)
|
| | | |
| | | if curEquip.IsEmpty():
|
| | | return placeIndex
|
| | | |
| | | elif IsTwoHandedWeapon(curEquip):
|
| | | #武器特殊处理,双手直接交换
|
| | | return placeIndex
|
| | | |
| | | #---无空位置,替换---
|
| | | return placeList[0]
|
| | |
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isAuctionItem=False, expireTime=0, curPlayer=None, setAttrDict=None):
|
| | | ''' 获取功能产出的物品实例
|
| | | @param isAuctionItem: 是否拍品,默认非拍品
|
| | |
| | | GameWorld.ErrLog("产出物品异常,无法创建物品 = %s" % (itemID))
|
| | | return
|
| | | return curItem
|
| | |
|
| | | def GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr=False):
|
| | | '''获取生成到装备上的传奇属性
|
| | | @return: None 或者 [传奇属性效果ID列表], [属性值列表], [神ID], [神值], [仙ID], [仙值], [极ID], [极值]
|
| | | '''
|
| | | # if GetIsAuctionItem(curItem):
|
| | | # #GameWorld.DebugLog("拍品无法生成传奇属性!")
|
| | | # return
|
| | | itemID = curItem.GetItemTypeID()
|
| | | itemType = curItem.GetType()
|
| | | itemColor = curItem.GetItemColor()
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | isSuit = 1 if curItem.GetSuiteID() else 0
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog("EquipShenAttr", itemID)
|
| | | if ipyData:
|
| | | return ipyData.GetLegendAttrIDList(), ipyData.GetLegendAttrValueList(), \
|
| | | ipyData.GetShenAttrIDList(), ipyData.GetShenAttrValueList(), \
|
| | | ipyData.GetXianAttrIDList(), ipyData.GetXianAttrValueList(), \
|
| | | ipyData.GetJiAttrIDList(), ipyData.GetJiAttrValueList()
|
| | | |
| | | # 1. 定条数
|
| | | attrCountIpyData = IpyGameDataPY.GetIpyGameDataNotLog("EquipLegendAttrCount", itemType, itemColor, isSuit, itemQuality)
|
| | | if not attrCountIpyData:
|
| | | if itemColor >= ChConfig.Def_Quality_Purple:
|
| | | GameWorld.DebugLog("该装备没有传奇属性: itemID=%s" % (itemID))
|
| | | return
|
| | | legendAttrCountInfoList = attrCountIpyData.GetLegendAttrCountInfo() # 传奇属性条数信息 [[条数, [属性类型库编号, ...]], ...]
|
| | | if not legendAttrCountInfoList:
|
| | | return
|
| | | |
| | | if curPlayer:
|
| | | playerID, playerLV = curPlayer.GetPlayerID(), curPlayer.GetLV()
|
| | | else:
|
| | | playerID = 0
|
| | | playerLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
|
| | | GameWorld.Log("生成装备传奇属性时没有玩家等级, 取当前世界等级! itemID=%s,worldLV=%s" % (itemID, playerLV))
|
| | | |
| | | # 2. 定属性ID
|
| | | attrTypeIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrType", itemType)
|
| | | if not attrTypeIpyData:
|
| | | return
|
| | | legendAttrTypeLibDict = attrTypeIpyData.GetLegendAttrTypeLib() # 传奇属性类型库 {属性类型库编号:[属性ID,...], ...}
|
| | | |
| | | curLegAttrIDList = []
|
| | | curLegAttrValueList = []
|
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | if isAllAttr:
|
| | | if curPlayer.GetGMLevel() != 90:
|
| | | return
|
| | | for attrIDList in legendAttrTypeLibDict.values():
|
| | | curLegAttrIDList += attrIDList
|
| | | #GameWorld.DebugLog("所有传奇属性: %s" % (curLegAttrIDList), playerID)
|
| | | else:
|
| | | #GameWorld.DebugLog("随机传奇属性: itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" |
| | | # % (itemID, itemType, itemClassLV, itemColor, isSuit), playerID)
|
| | | for attrCount, libNumList in legendAttrCountInfoList:
|
| | | attrIDList = []
|
| | | for libNum in libNumList:
|
| | | attrIDList.extend(legendAttrTypeLibDict.get(libNum, []))
|
| | | for curAttrID in curLegAttrIDList:
|
| | | if curAttrID in attrIDList:
|
| | | attrIDList.remove(curAttrID)
|
| | | if len(attrIDList) < attrCount:
|
| | | GameWorld.ErrLog("装备传奇属性ID库配置不够条数随机!itemID=%s,itemType=%s,legendAttrCountInfoList=%s,legendAttrTypeLibDict=%s" |
| | | % (itemID, itemType, legendAttrCountInfoList, legendAttrTypeLibDict), playerID)
|
| | | return
|
| | | curLegAttrIDList += random.sample(attrIDList, attrCount)
|
| | | #GameWorld.DebugLog(" 随机传奇属性: attrCount=%s,libNumList=%s,attrIDList=%s,curLegAttrIDList=%s" |
| | | # % (attrCount, libNumList, attrIDList, curLegAttrIDList), playerID)
|
| | | |
| | | # 3. 定数值
|
| | | attrValueIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrValue", itemType, itemClassLV, itemColor, isSuit, itemQuality)
|
| | | if not attrValueIpyData:
|
| | | GameWorld.ErrLog("传奇属性等级数值表找不到配置!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s,itemQuality=%s" |
| | | % (itemID, itemType, itemClassLV, itemColor, isSuit, itemQuality), playerID)
|
| | | return
|
| | | |
| | | attrLVLibNumDict = attrValueIpyData.GetLVLegendAttrLibNumInfo() # {属性ID:{等级:库编号, ...}}
|
| | | for attrID in curLegAttrIDList:
|
| | | if attrID not in attrLVLibNumDict:
|
| | | GameWorld.ErrLog("传奇属性等级数值表没有配置属性ID对应等级库编号!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s,attrID=%s" |
| | | % (itemID, itemType, itemClassLV, itemColor, isSuit, attrID), playerID)
|
| | | return
|
| | | curLibNum = None
|
| | | lvAttrLibList = attrLVLibNumDict[attrID]
|
| | | for lv, libNum in lvAttrLibList:
|
| | | if playerLV <= lv:
|
| | | curLibNum = libNum
|
| | | break
|
| | | if curLibNum == None:
|
| | | GameWorld.ErrLog("传奇属性等级数值表找不到属性ID对应等级库编号!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s,attrID=%s,playerLV=%s" |
| | | % (itemID, itemType, itemClassLV, itemColor, isSuit, attrID, playerLV), playerID)
|
| | | return
|
| | | attrLibIpyData = attrValueIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrLib", attrID)
|
| | | if not attrLibIpyData:
|
| | | GameWorld.ErrLog("传奇属性库不存在传奇属性ID配置!itemID=%s,attrID=%s" % (itemID, attrID), playerID)
|
| | | return
|
| | | attrLibDict = attrLibIpyData.GetLegendAttrLib() # {库编号:[随机数值, ...], ...}
|
| | | if curLibNum not in attrLibDict:
|
| | | GameWorld.ErrLog("传奇属性库编号不存在!itemID=%s,attrID=%s,curLibNum=%s" % (itemID, attrID, curLibNum), playerID)
|
| | | return
|
| | | valueList = attrLibDict[curLibNum]
|
| | | attrValue = random.choice(valueList)
|
| | | curLegAttrValueList.append(attrValue)
|
| | | #GameWorld.DebugLog(" 随机属性: attrID=%s,attrValue=%s,playerLV=%s,curLibNum=%s,valueList=%s" |
| | | # % (attrID, attrValue, playerLV, curLibNum, valueList), playerID)
|
| | | return curLegAttrIDList, curLegAttrValueList, [], [], [], [], [], []
|
| | |
|
| | | def GetEquipLegendAttrAll(curItem):
|
| | | ## 获取装备传奇属性 - 所有分组合并返回
|
| | | legendAttrInfo = GetEquipLegendAttrGroup(curItem)
|
| | | legAttrIDList = legendAttrInfo[0] + legendAttrInfo[2] + legendAttrInfo[4] + legendAttrInfo[6]
|
| | | legAttrValueList = legendAttrInfo[1] + legendAttrInfo[3] + legendAttrInfo[5] + legendAttrInfo[7]
|
| | | return legAttrIDList, legAttrValueList
|
| | |
|
| | | def GetEquipLegendAttrGroup(curItem):
|
| | | ## 获取装备传奇属性 - 按类型分组返回
|
| | | |
| | | legAttrIDList, legAttrValueList = [], []
|
| | | legendAttrIDCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID)
|
| | | legendAttrValueCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue)
|
| | | if legendAttrIDCnt == legendAttrValueCnt:
|
| | | for i in xrange(legendAttrIDCnt):
|
| | | legAttrIDList.append(curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrID, i))
|
| | | legAttrValueList.append(curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValue, i))
|
| | | |
| | | shenAttrIDList, shenAttrValueList = [], []
|
| | | shenAttrIDCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrIDShen)
|
| | | shenAttrValueCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValueShen)
|
| | | if shenAttrIDCnt == shenAttrValueCnt:
|
| | | for i in xrange(shenAttrIDCnt):
|
| | | shenAttrIDList.append(curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrIDShen, i))
|
| | | shenAttrValueList.append(curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValueShen, i))
|
| | | |
| | | xianAttrIDList, xianAttrValueList = [], []
|
| | | xianAttrIDCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrIDXian)
|
| | | xianAttrValueCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValueXian)
|
| | | if xianAttrIDCnt == xianAttrValueCnt:
|
| | | for i in xrange(xianAttrIDCnt):
|
| | | xianAttrIDList.append(curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrIDXian, i))
|
| | | xianAttrValueList.append(curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValueXian, i))
|
| | | |
| | | jiAttrIDList, jiAttrValueList = [], []
|
| | | jiAttrIDCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrIDJi)
|
| | | jiAttrValueCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValueJi)
|
| | | if jiAttrIDCnt == jiAttrValueCnt:
|
| | | for i in xrange(jiAttrIDCnt):
|
| | | jiAttrIDList.append(curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrIDJi, i))
|
| | | jiAttrValueList.append(curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValueJi, i))
|
| | | |
| | | return legAttrIDList, legAttrValueList, shenAttrIDList, shenAttrValueList, xianAttrIDList, xianAttrValueList, jiAttrIDList, jiAttrValueList
|
| | |
|
| | | def SetEquipLegendAttr(curItem, legendAttrInfo):
|
| | | ## 设置装备传奇属性
|
| | | |
| | | legAttrIDList, legAttrValueList, shenAttrIDList, shenAttrValueList, \
|
| | | xianAttrIDList, xianAttrValueList, jiAttrIDList, jiAttrValueList = legendAttrInfo
|
| | | |
| | | # 普通传奇属性
|
| | | if legAttrIDList and legAttrValueList and len(legAttrIDList) == len(legAttrValueList):
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)
|
| | | for i in xrange(len(legAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, legAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, legAttrValueList[i])
|
| | | |
| | | # 神 传奇属性
|
| | | if shenAttrIDList and shenAttrValueList and len(shenAttrIDList) == len(shenAttrValueList):
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDShen)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueShen)
|
| | | for i in xrange(len(shenAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDShen, shenAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueShen, shenAttrValueList[i])
|
| | | |
| | | # 仙 传奇属性
|
| | | if xianAttrIDList and xianAttrValueList and len(xianAttrIDList) == len(xianAttrValueList):
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDXian)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueXian)
|
| | | for i in xrange(len(xianAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDXian, xianAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueXian, xianAttrValueList[i])
|
| | | |
| | | # 极 传奇属性
|
| | | if jiAttrIDList and jiAttrValueList and len(jiAttrIDList) == len(jiAttrValueList):
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDJi)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueJi)
|
| | | for i in xrange(len(jiAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDJi, jiAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueJi, jiAttrValueList[i])
|
| | | |
| | | return
|
| | |
|
| | | ##创建物品所需的动态数据
|
| | | #
|