| | |
| | | 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 背包格子数
|
| | |
| | | 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:
|
| | |
| | | @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
|
| | |
|