| | |
| | | TreasureType_Gubao, # 古宝寻宝 5
|
| | | ) = range(1, 1 + 5)
|
| | |
|
| | | TreasureType_HeroComm = 11 # 英雄招募 - 普通
|
| | | #TreasureType_HeroComm = 11 # 英雄招募 - 普通
|
| | | TreasureType_HeroHigh = 12 # 英雄招募 - 高级
|
| | | TreasureType_HeroScore = 13 # 英雄招募 - 积分
|
| | | #武将招募的所有类型
|
| | | TreasureType_HeroCallList = [TreasureType_HeroComm, TreasureType_HeroHigh, TreasureType_HeroScore]
|
| | | TreasureType_HeroCallList = [TreasureType_HeroHigh, TreasureType_HeroScore]
|
| | |
|
| | | #活动寻宝类型
|
| | | ActType_HeroAppear = 1 # 武将登场
|
| | |
| | | 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
|
| | |
|
| | | def ResetLifeCardLucky(curPlayer):
|
| | | treasureTypeList = []
|
| | | for treasureType in TreasureType_HeroCallList:
|
| | | if treasureType in treasureTypeList:
|
| | | continue
|
| | | houseList = IpyGameDataPY.GetIpyGameDataList("TreasureHouse", treasureType)
|
| | | if not houseList:
|
| | | continue
|
| | | for hourseIpyData in houseList:
|
| | | if hourseIpyData.GetLuckyItemRateInfoEx():
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureLuck % (treasureType), 0)
|
| | | treasureTypeList.append(treasureType)
|
| | | GameWorld.DebugLog("开通永久卡重置武将招募永久卡幸运值! treasureType=%s" % treasureType)
|
| | | break
|
| | | if not treasureTypeList:
|
| | | return
|
| | | 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:
|
| | |
| | | PlayerTask.AddTaskValue(curPlayer, ChConfig.TaskType_HeroCall, treasureCount)
|
| | | PlayerActivity.AddDailyTaskValue(curPlayer, ChConfig.DailyTask_HeroCall, treasureCount)
|
| | | heroCallCnt = GetHeroCallCnt(curPlayer)
|
| | | if OpenServerActivity.GetOSAState(curPlayer, ShareDefine.Def_BT_OSA_HeroCall) == 1:
|
| | | PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_OSA_HeroCall, heroCallCnt)
|
| | | OpenServerActivity.UpdOSA_HeroCallBillboard(curPlayer, heroCallCnt)
|
| | | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_OSAHeroCall, heroCallCnt)
|
| | |
|
| | | PlayerActLunhuidian.AddLunhuidianValue(curPlayer, PlayerActLunhuidian.AwardType_Treasure, treasureType, treasureCount)
|
| | |
| | | if gridNum in notifyGridNumList and notifyKeyDict:
|
| | | notifyKey = notifyKeyDict.get(gridNum, notifyKeyDict.get(0, ""))
|
| | | if itemObj.GetType() == ChConfig.Def_ItemType_Hero:
|
| | | if PlayerHero.GetHeroActivite(curPlayer, itemID):
|
| | | if treasureType in TreasureType_HeroCallList and PlayerHero.GetHeroActivite(curPlayer, itemID):
|
| | | notifyKey = ""
|
| | | GameWorld.DebugLog("招募武将非首次获得的不广播了! itemID=%s" % itemID, playerID)
|
| | | elif notifyKey:
|
| | |
| | | GameWorld.DebugLog(" 公共免费心愿次数! gridNum=%s,wishLibID=%s,preOutTotal=%s,canFreeCnt=%s"
|
| | | % (gridNum, wishLibID, preOutTotal, canFreeCnt), playerID)
|
| | |
|
| | | if preOutTotal >= canFreeCnt:
|
| | | if treasureType in TreasureType_HeroCallList and PlayerGoldInvest.GetInvestState(curPlayer, ChConfig.InvestType_Month):
|
| | | GameWorld.DebugLog(" 月卡特权心愿免费")
|
| | | elif preOutTotal >= canFreeCnt:
|
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreasureWishUseItem % (treasureType, wishLibID)):
|
| | | GameWorld.DebugLog(" 玩家心愿卡未启用,走默认随机规则! gridNum=%s,wishLibID=%s" % (gridNum, wishLibID), playerID)
|
| | | return
|