| | |
| | | import EventReport
|
| | | import ChItem
|
| | | import IpyGameDataPY
|
| | | import Operate_EquipStone
|
| | | import Operate_EquipWash
|
| | | import FormulaControl
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import PyGameData
|
| | |
| | | GameWorld.DebugLog("背包类型初始格子数: packType=%s,initCount=%s" % (packType, initCount))
|
| | | return initCount
|
| | |
|
| | | def GetPackOpenItemCnt(curPlayer, packType):
|
| | | ## 获取对应背包已购买的格子数
|
| | | openCntDict = IpyGameDataPY.GetFuncEvalCfg("OpenPack", 3, {})
|
| | | if str(packType) not in openCntDict:
|
| | | return 0
|
| | | openCntList = openCntDict[str(packType)]
|
| | | if not openCntList:
|
| | | return 0
|
| | | |
| | | buyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PackBuyCnt % packType)
|
| | | openCnt = sum(openCntList[:buyCnt])
|
| | | if buyCnt > len(openCntList):
|
| | | addCnt = (buyCnt - len(openCntList)) * openCntList[-1]
|
| | | openCnt += addCnt
|
| | | |
| | | return openCnt
|
| | |
|
| | | def SyncPackBuyCnt(curPlayer, packType=None):
|
| | | ## 同步已购买格子次数信息
|
| | | openCntDict = IpyGameDataPY.GetFuncEvalCfg("OpenPack", 3, {})
|
| | | if not openCntDict:
|
| | | return
|
| | | syncTypeList = [str(packType)] if packType else openCntDict.keys()
|
| | | |
| | | clientPack = ChPyNetSendPack.tagSCPackBuyInfo()
|
| | | clientPack.BuyInfoList = []
|
| | | for packTypeStr in syncTypeList:
|
| | | packType = int(packTypeStr)
|
| | | buy = ChPyNetSendPack.tagSCPackBuy()
|
| | | buy.PackType = packType
|
| | | buy.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PackBuyCnt % packType)
|
| | | clientPack.BuyInfoList.append(buy)
|
| | | clientPack.Count = len(clientPack.BuyInfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | ## 获得虚拟背包格子数
|
| | | # @param packindex 背包索引
|
| | | # @return 背包格子数
|
| | |
| | | return 0
|
| | | keyStr = ChConfig.Def_VPackCnt_Dict[packindex]
|
| | | return IpyGameDataPY.GetFuncCfg(keyStr)
|
| | |
|
| | |
|
| | | ## 杀怪掉落提示
|
| | | # @param curPlayer 当前玩家
|
| | | # @return None
|
| | | def NotifyItemDropByKill(curPlayer, curItem, npcID, notifyMark='', mapID=0):
|
| | | return #吕超说此处屏蔽
|
| | |
|
| | | def CacheNotifyEquipDetailInfo(curPlayer, curEquip):
|
| | | ''' 缓存装备广播信息中的装备明细信息
|
| | | 因为本版本需要的查看的内容相对较多,为了减少全服广播流量消耗,所以先进行缓存,玩家点击查看时再进行查询
|
| | | '''
|
| | | |
| | | 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.GetEquipPartPlusLV(curPlayer, packType, packIndex)
|
| | | plusEvolveLV = ChEquip.GetEquipPartPlusEvolveLV(curPlayer, packType, packIndex)
|
| | | |
| | | #部位洗练数据
|
| | | 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)
|
| | | |
| | | #部位宝石数据
|
| | | stoneIDList = Operate_EquipStone.GetEquipIndexStoneIDList(curPlayer, packIndex)
|
| | | |
| | | #本阶已穿装备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 当前玩家
|
| | |
| | | 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:
|
| | |
| | | DR_DelItem(curPlayer, packIndex, "VPack_%s" % packIndex if not eventName else eventName, dataDict)
|
| | | ItemControler.Sync_VPackItem_Clear(curPlayer, packIndex, placeList)
|
| | | return
|
| | |
|
| | |
|
| | | ## 获取物品最高强化进化等级
|
| | | # @param itemType: 物品类型
|
| | | # @return 最大星级,0为不可强化
|
| | | def GetItemMaxPlusEvolveLV(curPlayer, equipPackindex, curItem):
|
| | | packType = IPY_GameWorld.rptEquip
|
| | | curPlusLV = ChEquip.GetEquipPartPlusLV(curPlayer, packType, equipPackindex)
|
| | | 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 GetWingLV(curItem):
|
| | | ## 获取翅膀代数等级
|
| | | wingLVDict = IpyGameDataPY.GetFuncEvalCfg("WingLV", 1)
|
| | | return wingLVDict.get(str(curItem.GetLV()), 0)
|
| | |
|
| | | ## 装备评分
|
| | | def GetEquipGearScore(curItem):
|
| | |
| | | @param alchemyDiffLV: 是否过滤掉大于X级的炼丹等级物品,0-不过滤,1-过滤且读默认配置,>1-特殊功能指定的过滤等级
|
| | | '''
|
| | | resultWeightList = []
|
| | | itemNeedPlayerLVDict = IpyGameDataPY.GetFuncEvalCfg("AlchemyDiffLV", 2, {})
|
| | | if alchemyDiffLV or itemNeedPlayerLVDict:
|
| | | playerLV = curPlayer.GetLV()
|
| | | # 如果有指定大于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
|
| | | if GetItemClassLV(itemData) > curAlchemyLV + alchemyDiffLV:
|
| | | continue
|
| | | if itemID in itemNeedPlayerLVDict:
|
| | | if playerLV < itemNeedPlayerLVDict[itemID]:
|
| | | continue
|
| | | resultWeightList.append(itemInfo)
|
| | | else:
|
| | | resultWeightList = weightList
|
| | | return resultWeightList
|
| | |
|
| | | ## =======================================================================================
|
| | |
|
| | | def SyncMakeItemAnswer(curPlayer, makeType, isSuccess, makeItemID):
|
| | | def SyncMakeItemAnswer(curPlayer, makeType, isSuccess, makeValue):
|
| | | makeItemAnswer = ChPyNetSendPack.tagMCMakeItemAnswer()
|
| | | makeItemAnswer.Clear()
|
| | | makeItemAnswer.MakeType = makeType
|
| | | makeItemAnswer.Result = isSuccess
|
| | | makeItemAnswer.MakeItemID = makeItemID
|
| | | makeItemAnswer.MakeValue = makeValue
|
| | | NetPackCommon.SendFakePack(curPlayer, makeItemAnswer)
|
| | | return
|
| | |
|