From 3facc622190958f02399ea1647159997179d3bf0 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 09 十二月 2020 11:10:15 +0800
Subject: [PATCH] 8605 【港台】【BT】【长尾】【后端】新增限时集字活动(支持脱机掉落)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 5 ++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActCollectWords.py | 115 ++++++++++++++++++++++++++++++++++++++-------------------
2 files changed, 82 insertions(+), 38 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 4a407f6..de23364 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -870,6 +870,11 @@
for dropID in dropIDList:
dropIDCountDict[dropID] = dropIDCountDict.get(dropID, 0) + 1
+ # 集字掉落
+ dropWordsCountDict = PlayerActCollectWords.OnGetDropWordsItemDict(dropPlayer, npcData, killCount)
+ for dropID, dropCount in dropWordsCountDict.items():
+ dropIDCountDict[dropID] = dropIDCountDict.get(dropID, 0) + dropCount
+
auctionIDList = []
if ipyDrop.GetAucionItemCanSell():
for dropID in dropIDCountDict.keys():
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActCollectWords.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActCollectWords.py
index 7f0cbfa..6e59afb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActCollectWords.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActCollectWords.py
@@ -104,48 +104,13 @@
return
for actNum, actName in ActCollectWordsNameDict.items():
-
- actInfo = PyGameData.g_operationActionDict.get(actName, {})
- if not actInfo:
+ randList = __GetDropWordsItemRateList(curPlayer, actName, curNPC)
+ if not randList:
continue
-
- if not actInfo.get(ShareDefine.ActKey_State):
- continue
-
- cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
- ipyData = IpyGameDataPY.GetIpyGameData(actName, cfgID)
- if not ipyData:
- continue
-
- isBoss = ChConfig.IsGameBoss(curNPC)
- playerLV = curPlayer.GetLV()
- npcLV = curNPC.GetLV()
- limitLV = ipyData.GetLVLimit()
- if not isBoss and limitLV and limitLV > playerLV:
- #GameWorld.DebugLog("集字活动玩家等级不足,无法掉落! actNum=%s,cfgID=%s,limitLV=%s" % (actNum, cfgID, limitLV))
- continue
-
- 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
-
- lastDayOnlyExchange = ipyData.GetLastDayOnlyExchange()
- if lastDayOnlyExchange:
- openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
- endDateStr = GameWorld.GetOperationActionDateStr(ipyData.GetEndDate(), openServerDay)
- curDate = GameWorld.GetCurrentTime()
- curDateStr = "%d-%s-%s" % (curDate.year, curDate.month, curDate.day)
- if curDateStr == endDateStr:
- #GameWorld.DebugLog("集字活动最后一天不掉落! %s" % curDateStr)
- continue
-
- randList = ipyData.GetDropItemRateListBoss() if isBoss else ipyData.GetDropItemRateList()
dropItemID = GameWorld.GetResultByRandomList(randList)
if not dropItemID:
continue
- GameWorld.DebugLog("集字活动掉落物品! actNum=%,npcID=%s,dropItemID=%s" % (actNum, curNPC.GetNPCID(), dropItemID))
+ GameWorld.DebugLog(" 集字活动掉落物品! actNum=%s,actName=%s,npcID=%s,dropItemID=%s" % (actNum, actName, curNPC.GetNPCID(), dropItemID))
itemCount = 1 # 默认1个
isAuctionItem = 0 # 非拍品
@@ -153,6 +118,80 @@
return
+def __GetDropWordsItemRateList(curPlayer, actName, npcData):
+ ## 获取掉字饼图列表
+
+ actInfo = PyGameData.g_operationActionDict.get(actName, {})
+ if not actInfo:
+ return
+
+ if not actInfo.get(ShareDefine.ActKey_State):
+ return
+
+ cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
+ ipyData = IpyGameDataPY.GetIpyGameData(actName, cfgID)
+ if not ipyData:
+ return
+
+ isBoss = ChConfig.IsGameBoss(npcData)
+ playerLV = curPlayer.GetLV()
+ npcLV = npcData.GetLV()
+ limitLV = ipyData.GetLVLimit()
+ if not isBoss and limitLV and limitLV > playerLV:
+ #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等级差值过大,无法掉落! actName=%s,cfgID=%s,playerLV(%s) - npcLV(%s) > %s"
+ # % (actName, cfgID, playerLV, npcLV, dropDiffLVLimit))
+ return
+
+ lastDayOnlyExchange = ipyData.GetLastDayOnlyExchange()
+ if lastDayOnlyExchange:
+ openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
+ endDateStr = GameWorld.GetOperationActionDateStr(ipyData.GetEndDate(), openServerDay)
+ curDate = GameWorld.GetCurrentTime()
+ curDateStr = "%d-%s-%s" % (curDate.year, curDate.month, curDate.day)
+ if curDateStr == endDateStr:
+ #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
+
+ 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
+ totalRate = curRate * killCount # 总概率
+ dropCount = totalRate / maxRate # 可掉落数
+ rateEx = totalRate % maxRate # 剩余概率
+ if GameWorld.CanHappen(rateEx, maxRate):
+ dropCount += 1
+ if not dropCount:
+ continue
+
+ dropItemCountDict[dropItemID] = dropItemCountDict.get(dropItemID, 0) + dropCount
+ GameWorld.DebugLog(" 脱机集字活动掉字: actNum=%s,actName=%s,dropItemID=%s,dropCount=%s" % (actNum, actName, dropItemID, dropCount))
+
+ return dropItemCountDict
+
#// AA 09 集字活动兑换 #tagCMActCollectWordsExchange
#
#struct tagCMActCollectWordsExchange
--
Gitblit v1.8.0