121 【武将】武将系统-服务端(寻宝增加最小次数才能产出配置、增加非永久卡保底产出配置;)
| | |
| | | list GridItemRateList2; //每满x次保底产出格子编号饼图 [[概率, 格子编号], ...]
|
| | | dict GridItemRateList3; //第x次必出产出格子编号饼图 {次数:[[概率, 格子编号], ...], ...}
|
| | | list GridItemRateList4; //第x次x抽必出
|
| | | dict AtLeastCntLimitInfo; //最小次数才能产出限制 {格子:至少所需次数才可产出, ...}
|
| | | dict LuckyItemRateInfo; //幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...}
|
| | | dict LuckyItemRateInfoEx; //非永久卡玩家幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...}
|
| | | };
|
| | |
|
| | | //寻宝物品库
|
| | |
| | | Def_PDict_TreasureCountToday = "TreasureCountToday_%s" # 今日寻宝次数, 参数(寻宝类型)
|
| | | Def_PDict_TreasureCountTodayGold = "TreasureCountTodayG_%s" # 今日元宝寻宝次数, 参数(寻宝类型)
|
| | | Def_PDict_TreasureLuck = "TreasureLuck_%s" # 寻宝当前幸运值, 参数(寻宝类型)
|
| | | Def_PDict_TreasureAtleastCnt = "TreasureAtleast_%s_%s" # 至少寻宝次数限制统计, 参数(寻宝类型, 格子)
|
| | | Def_PDict_TreasureCntAward = "TreasureCntAward_%s" # 累计寻宝次数对应物品奖励领奖状态, 参数(寻宝类型)
|
| | | Def_PDict_TreasureGridCnt = "TreasureGridCnt_%s_%s" # 格子对应累计产出次数, 参数(寻宝类型, 格子编号)
|
| | | Def_PDict_TreasureWishSelect = "TreasureWSel_%s_%s_%s" # 心愿物品选择记录, 参数(寻宝类型, 库ID, index) 已选择心愿物品ID
|
| | |
| | | ("list", "GridItemRateList2", 0),
|
| | | ("dict", "GridItemRateList3", 0),
|
| | | ("list", "GridItemRateList4", 0),
|
| | | ("dict", "AtLeastCntLimitInfo", 0),
|
| | | ("dict", "LuckyItemRateInfo", 0),
|
| | | ("dict", "LuckyItemRateInfoEx", 0),
|
| | | ),
|
| | |
|
| | | "TreasureItemLib":(
|
| | |
| | | def GetGridItemRateList2(self): return self.attrTuple[7] # 每满x次保底产出格子编号饼图 [[概率, 格子编号], ...] list
|
| | | def GetGridItemRateList3(self): return self.attrTuple[8] # 第x次必出产出格子编号饼图 {次数:[[概率, 格子编号], ...], ...} dict
|
| | | def GetGridItemRateList4(self): return self.attrTuple[9] # 第x次x抽必出 list
|
| | | def GetLuckyItemRateInfo(self): return self.attrTuple[10] # 幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...} dict |
| | | def GetAtLeastCntLimitInfo(self): return self.attrTuple[10] # 最小次数才能产出限制 {格子:至少所需次数才可产出, ...} dict
|
| | | def GetLuckyItemRateInfo(self): return self.attrTuple[11] # 幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...} dict
|
| | | def GetLuckyItemRateInfoEx(self): return self.attrTuple[12] # 非永久卡玩家幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...} dict |
| | | |
| | | # 寻宝物品库 |
| | | class IPY_TreasureItemLib(): |
| | |
| | | gridNumMaxLimitInfo = setIpyData.GetGridNumMaxLimitInfo()
|
| | | for gridNumStr in gridNumMaxLimitInfo.keys():
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureGridCnt % (treasureType, int(gridNumStr)), 0)
|
| | | |
| | | |
| | | houseList = IpyGameDataPY.GetIpyGameDataList("TreasureHouse", treasureType)
|
| | | if houseList:
|
| | | for hourseIpyData in houseList:
|
| | | for gridNum in hourseIpyData.GetAtLeastCntLimitInfo().items():
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureAtleastCnt % (treasureType, gridNum), 0)
|
| | | |
| | | Sync_TreasureInfo(curPlayer, treasureTypeList)
|
| | | return
|
| | |
|
| | |
| | | return
|
| | |
|
| | | setLuckyGridNum = setIpyData.GetLuckyGridNum() # 标的格子
|
| | | luckyItemRateInfo = ipyData.GetLuckyItemRateInfo()
|
| | | atLeastCntLimitInfo = ipyData.GetAtLeastCntLimitInfo() # 至少需要幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...}
|
| | | atLeastCntLimitDict = {}
|
| | | for gridNum, needAtLeastCnt in atLeastCntLimitInfo.items():
|
| | | curAtLeastCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreasureAtleastCnt % (treasureType, gridNum))
|
| | | atLeastCntLimitDict[gridNum] = [curAtLeastCnt, needAtLeastCnt]
|
| | | GameWorld.DebugLog("atLeastCntLimitDict=%s" % (atLeastCntLimitDict), playerID)
|
| | | luckyItemRateInfo = ipyData.GetLuckyItemRateInfo() # 幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...}
|
| | | if treasureType in TreasureType_HeroCallList:
|
| | | if not PlayerGoldInvest.GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | luckyItemRateInfo = ipyData.GetLuckyItemRateInfoEx()
|
| | | GameWorld.DebugLog("终身卡未开通,武将招募使用内置保底", playerID)
|
| | | luckyItemRateDict = {int(k):v for k, v in luckyItemRateInfo.items()}
|
| | | luckyValueList = sorted(luckyItemRateDict.keys())
|
| | | luckyGridNumList = [] # 幸运格子编号列表
|
| | |
| | | maxLuck = max(luckyValueList) if luckyValueList else 0 # 满幸运值
|
| | | updLuck = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreasureLuck % (treasureType)) # 当前幸运值
|
| | | GameWorld.DebugLog("updLuck=%s,maxLuck=%s,setLuckyGridNum=%s,luckyItemRateDict=%s" % (updLuck, maxLuck, setLuckyGridNum, luckyItemRateDict), playerID)
|
| | | if treasureType in TreasureType_HeroCallList and not PlayerGoldInvest.GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | addLuck = 0
|
| | | GameWorld.DebugLog("终身卡未开通,武将招募不增加幸运", playerID)
|
| | | |
| | | |
| | | curTreasureCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreasureCount % (treasureType)) # 当前已寻宝次数
|
| | | updTreasureCount = curTreasureCount
|
| | |
|
| | |
| | | curRateList = GetRemoveLimitGridRateList(ensureRateList, gridNumCountInfo, gridNumMaxLimitInfo)
|
| | | GameWorld.DebugLog(" 【满%s次数必出饼图】: %s" % (ensureCount, curRateList), playerID)
|
| | |
|
| | | isNormalRate = False
|
| | | doCount = 0
|
| | | while doCount <= 50: # 限制最大次数
|
| | | doCount += 1
|
| | | if doCount > 1 or not curRateList: # 重新随机的默认使用常规饼图
|
| | | curRateList = commItemRateList
|
| | | GameWorld.DebugLog(" 使用常规饼图=%s" % curRateList, playerID)
|
| | | isNormalRate = True
|
| | |
|
| | | gridNum = GameWorld.GetResultByRandomList(curRateList)
|
| | | if gridNum in luckyGridNumList and gridNum in getGridResult:
|
| | | GameWorld.DebugLog(" 幸运物品已经出过,不再重复产出重新随机! gridNum=%s in %s" % (gridNum, getGridResult), playerID)
|
| | | continue
|
| | |
|
| | | # 常规概率的额外逻辑
|
| | | if isNormalRate:
|
| | | # 验证至少所需次数限制
|
| | | if gridNum in atLeastCntLimitDict:
|
| | | curAtLeastCnt, needAtLeastCnt = atLeastCntLimitDict[gridNum]
|
| | | if curAtLeastCnt < needAtLeastCnt:
|
| | | GameWorld.DebugLog(" 该格子未达到最小寻宝次数不产出! gridNum=%s,curAtLeastCnt=%s < %s" |
| | | % (gridNum, curAtLeastCnt, needAtLeastCnt), playerID)
|
| | | continue
|
| | | |
| | | # 心愿库物品,检查心愿预产出
|
| | | gridNumStr = str(gridNum)
|
| | | wishLibID = 0
|
| | |
| | | if gridNum in gridNumCountInfo:
|
| | | gridNumCountInfo[gridNum] = gridNumCountInfo[gridNum] + 1
|
| | | GameWorld.DebugLog(" 【更新产出次数】: gridNum=%s, %s" % (gridNum, gridNumCountInfo), playerID)
|
| | | |
| | | for gNum, atLeastInfo in atLeastCntLimitDict.items():
|
| | | curAtLeastCnt, needAtLeastCnt = atLeastInfo
|
| | | if gNum == gridNum:
|
| | | curAtLeastCnt = 0
|
| | | else:
|
| | | curAtLeastCnt += 1
|
| | | atLeastCntLimitDict[gNum] = [curAtLeastCnt, needAtLeastCnt]
|
| | | GameWorld.DebugLog(" 更新最少所需次数进度: gridNum=%s,%s/%s" % (gNum, curAtLeastCnt, needAtLeastCnt), playerID)
|
| | | |
| | | break
|
| | |
|
| | | GameWorld.DebugLog("寻宝格子结果: getGridResult=%s" % getGridResult, playerID)
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureCount % (treasureType), updTreasureCount)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureCountTodayGold % (treasureType), updTreasureCountTodayGold)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureLuck % (treasureType), updLuck)
|
| | | for gridNum, atLeastInfo in atLeastCntLimitDict.items():
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureAtleastCnt % (treasureType, gridNum), atLeastInfo[0])
|
| | | for gridNum, updCount in gridNumCountInfo.items():
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureGridCnt % (treasureType, gridNum), updCount)
|
| | | if curIndexCount <= maxIndexCount:
|