| | |
| | | return
|
| | |
|
| | | for actNum, actName in ActCollectWordsNameDict.items():
|
| | | randList = __GetDropWordsItemRateList(curPlayer, actName, curNPC)
|
| | | if not randList:
|
| | | continue
|
| | | dropItemID = GameWorld.GetResultByRandomList(randList)
|
| | | if not dropItemID:
|
| | | continue
|
| | | GameWorld.DebugLog(" 集字活动掉落物品! actNum=%s,actName=%s,npcID=%s,dropItemID=%s" % (actNum, actName, curNPC.GetNPCID(), dropItemID))
|
| | | |
| | | itemCount = 1 # 默认1个
|
| | | isAuctionItem = 0 # 非拍品
|
| | | ItemControler.GivePlayerItem(curPlayer, dropItemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem])
|
| | | |
| | | return
|
| | |
|
| | | def __GetDropWordsItemRateList(curPlayer, actName, npcData):
|
| | | ## 获取掉字饼图列表
|
| | |
|
| | | actInfo = PyGameData.g_operationActionDict.get(actName, {})
|
| | | if not actInfo:
|
| | | continue
|
| | | return
|
| | |
|
| | | if not actInfo.get(ShareDefine.ActKey_State):
|
| | | continue
|
| | | return
|
| | |
|
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData(actName, cfgID)
|
| | | if not ipyData:
|
| | | continue
|
| | | return
|
| | |
|
| | | isBoss = ChConfig.IsGameBoss(curNPC)
|
| | | isBoss = ChConfig.IsGameBoss(npcData)
|
| | | playerLV = curPlayer.GetLV()
|
| | | npcLV = curNPC.GetLV()
|
| | | npcLV = npcData.GetLV()
|
| | | limitLV = ipyData.GetLVLimit()
|
| | | if not isBoss and limitLV and limitLV > playerLV:
|
| | | #GameWorld.DebugLog("集字活动玩家等级不足,无法掉落! actNum=%s,cfgID=%s,limitLV=%s" % (actNum, cfgID, limitLV))
|
| | | continue
|
| | | #GameWorld.DebugLog(" 集字活动玩家等级不足,无法掉落! actName=%s,cfgID=%s,limitLV=%s" % (actName, cfgID, limitLV))
|
| | | return
|
| | |
|
| | | dropDiffLVLimit = ipyData.GetDropDiffLVLimit()
|
| | | if not isBoss and dropDiffLVLimit and (playerLV - npcLV) > dropDiffLVLimit:
|
| | | #GameWorld.DebugLog("集字活动玩家等级与NPC等级差值过大,无法掉落! actNum=%s,cfgID=%s,playerLV(%s) - npcLV(%s) > %s" |
| | | # % (actNum, cfgID, playerLV, npcLV, dropDiffLVLimit))
|
| | | continue
|
| | | #GameWorld.DebugLog(" 集字活动玩家等级与NPC等级差值过大,无法掉落! actName=%s,cfgID=%s,playerLV(%s) - npcLV(%s) > %s" |
| | | # % (actName, cfgID, playerLV, npcLV, dropDiffLVLimit))
|
| | | return
|
| | |
|
| | | lastDayOnlyExchange = ipyData.GetLastDayOnlyExchange()
|
| | | if lastDayOnlyExchange:
|
| | |
| | | curDate = GameWorld.GetCurrentTime()
|
| | | curDateStr = "%d-%s-%s" % (curDate.year, curDate.month, curDate.day)
|
| | | if curDateStr == endDateStr:
|
| | | #GameWorld.DebugLog("集字活动最后一天不掉落! %s" % curDateStr)
|
| | | #GameWorld.DebugLog(" 集字活动最后一天不掉落! actName=%s,cfgID=%s, %s" % (actName, cfgID, curDateStr))
|
| | | return
|
| | | |
| | | return ipyData.GetDropItemRateListBoss() if isBoss else ipyData.GetDropItemRateList()
|
| | |
|
| | | def OnGetDropWordsItemDict(curPlayer, npcData, killCount):
|
| | | ## 获取脱机掉落物品
|
| | | |
| | | dropItemCountDict = {}
|
| | | for actNum, actName in ActCollectWordsNameDict.items():
|
| | | |
| | | dropRateList = __GetDropWordsItemRateList(curPlayer, actName, npcData)
|
| | | if not dropRateList:
|
| | | continue
|
| | |
|
| | | randList = ipyData.GetDropItemRateListBoss() if isBoss else ipyData.GetDropItemRateList()
|
| | | dropItemID = GameWorld.GetResultByRandomList(randList)
|
| | | preRate = 0
|
| | | maxRate = dropRateList[-1][0]
|
| | | for rateInfo in dropRateList:
|
| | | rate, dropItemID = rateInfo
|
| | | curRate = rate - preRate
|
| | | if not curRate:
|
| | | break
|
| | | preRate = rate
|
| | | if not dropItemID:
|
| | | continue
|
| | | GameWorld.DebugLog("集字活动掉落物品! actNum=%,npcID=%s,dropItemID=%s" % (actNum, curNPC.GetNPCID(), dropItemID))
|
| | | totalRate = curRate * killCount # 总概率
|
| | | dropCount = totalRate / maxRate # 可掉落数
|
| | | rateEx = totalRate % maxRate # 剩余概率
|
| | | if GameWorld.CanHappen(rateEx, maxRate):
|
| | | dropCount += 1
|
| | | if not dropCount:
|
| | | continue
|
| | |
|
| | | itemCount = 1 # 默认1个
|
| | | isAuctionItem = 0 # 非拍品
|
| | | ItemControler.GivePlayerItem(curPlayer, dropItemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem])
|
| | | dropItemCountDict[dropItemID] = dropItemCountDict.get(dropItemID, 0) + dropCount
|
| | | GameWorld.DebugLog(" 脱机集字活动掉字: actNum=%s,actName=%s,dropItemID=%s,dropCount=%s" % (actNum, actName, dropItemID, dropCount))
|
| | |
|
| | | return
|
| | | return dropItemCountDict
|
| | |
|
| | | #// AA 09 集字活动兑换 #tagCMActCollectWordsExchange
|
| | | #
|