From 22093c9745b5e0f322fc36c2178f287b12bd5ef9 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 22 八月 2018 11:48:29 +0800
Subject: [PATCH] Add: 2765 【后端】战斗公式增加防守方参数dMinAtk,dMaxAtk;
---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py |   87 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 76 insertions(+), 11 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 59b7260..2f075dd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -1080,12 +1080,18 @@
             if len(jobItemList) < job:
                 GameWorld.ErrLog("职业物品集合key没有配置对应职业ID: npcID=%s,jobItemKey=%s,job=%s" % (npcID, jobItemKey, job))
                 continue
+            mustDropCount = dropRate / Def_NPCMaxDropRate
+            dropRate = dropRate % Def_NPCMaxDropRate # 基础概率
+            canDropCount = mustDropCount
             doCnt = ItemKeyMaxDropCountDict.get(jobItemKey, 1) # 默认1个
             doCnt = __GetNPCDropDoCountChange(doCnt, doCountRate, doCountAdd)
             for _ in xrange(doCnt):
                 if not GameWorld.CanHappen(dropRate, maxRate=Def_NPCMaxDropRate):
                     continue
-                jobItemID = jobItemList[job - 1]
+                canDropCount += 1
+                
+            jobItemID = jobItemList[job - 1]
+            for _ in xrange(canDropCount):
                 dropItemIDList.append(jobItemID)
                 #GameWorld.DebugLog("掉落自身职业指定物品ID: jobItemKey=%s,jobItemID=%s" % (jobItemKey, jobItemID))
                 
@@ -1102,11 +1108,17 @@
             # 在只掉本职业里的不处理
             if jobItemKey in ItemKeyDropRateJobDict:
                 continue
+            mustDropCount = dropRate / Def_NPCMaxDropRate
+            dropRate = dropRate % Def_NPCMaxDropRate # 基础概率
+            canDropCount = mustDropCount
             doCnt = ItemKeyMaxDropCountDict.get(jobItemKey, 1) # 默认1个
             doCnt = __GetNPCDropDoCountChange(doCnt, doCountRate, doCountAdd)
             for _ in xrange(doCnt):
                 if not GameWorld.CanHappen(dropRate, maxRate=Def_NPCMaxDropRate):
                     continue
+                canDropCount += 1
+                
+            for _ in xrange(canDropCount):
                 randJobItemID = random.choice(jobItemList)
                 dropItemIDList.append(randJobItemID)
                 #GameWorld.DebugLog("掉落随机职业指定物品ID: jobItemKey=%s,randJobItemID=%s" % (jobItemKey, randJobItemID))
@@ -4629,7 +4641,6 @@
                     PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillWorldBoss, 1)
                     # 每日活动
                     PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_WorldBOSS)
-                    PlayerMagicWeapon.SetMWPrivilegeData(curPlayer, ChConfig.MWPrivilege_KillBossAddAttr, 1, True)
                     PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_WorldBOSS, 1)
                     PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_WorldBoss, 1)
                 elif limitIndex == 1: #BOSS之家
@@ -5321,6 +5332,7 @@
 #  @param None
 #  @param None
 def SyncCollectionItemInfo(curPlayer, addExp, addMoney, addZhenQi, syncItemInfoList, collectNPCID=0):
+    return #暂不同步
     if addExp <= 0 and addMoney <= 0 and addZhenQi <= 0 and not syncItemInfoList:
         return
     
@@ -5408,15 +5420,15 @@
         collectNPCIDTimeLimit = ReadChConfig.GetEvalChConfig('CollectNPCIDTimeLimit')
         npcIDList = collectNPCIDTimeLimit.keys()
     
-    if funcTypeList:
-        collection = ChPyNetSendPack.tagMCFuncNPCCollectionCnt()
-        for fType in funcTypeList:
-            todayCollTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcCollTime % fType)
-            collection.Clear()
-            collection.FuncType = fType
-            collection.CollectionCnt = todayCollTime
-            collection.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcBuyTime % fType)
-            NetPackCommon.SendFakePack(curPlayer, collection)
+#    if funcTypeList:
+#        collection = ChPyNetSendPack.tagMCFuncNPCCollectionCnt()
+#        for fType in funcTypeList:
+#            todayCollTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcCollTime % fType)
+#            collection.Clear()
+#            collection.FuncType = fType
+#            collection.CollectionCnt = todayCollTime
+#            collection.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcBuyTime % fType)
+#            NetPackCommon.SendFakePack(curPlayer, collection)
         
     if npcIDList:
         npcIDCollInfo = ChPyNetSendPack.tagMCNPCIDCollectionCntInfo()
@@ -5531,6 +5543,59 @@
     NetPackCommon.SendFakePack(curPlayer, npcInfoPack)
     return
 
+
+## 获取本地图NPC数量
+#  @param queryNPCIDList:查询的NPCID列表
+#  @param tick
+#  @return {NPCID:cnt}
+def GetNPCCntInfo(queryNPCIDList, tick):
+    npcCntDict = {}
+
+    if not queryNPCIDList:
+        return npcCntDict
+    
+    gameNPCManager = GameWorld.GetNPCManager()
+    GameWorld.DebugLog("GetNPCCntInfo...queryNPCIDList=%s" % (str(queryNPCIDList)))
+
+    for index in xrange(gameNPCManager.GetNPCCount()):
+        curNPC = gameNPCManager.GetNPCByIndex(index)
+        curID = curNPC.GetID()
+        if curID == 0:
+            continue
+        
+        curNPCID = curNPC.GetNPCID()
+        
+        if curNPCID not in queryNPCIDList:
+            continue
+        if curNPC.GetCurAction() == IPY_GameWorld.laNPCDie or not curNPC.IsAlive():
+            continue
+        npcCntDict[curNPCID] = npcCntDict.get(curNPCID, 0) + 1
+                
+    GameWorld.DebugLog("    npcCntDict=%s" % (str(npcCntDict)))
+    return npcCntDict
+
+## 同步地图NPC数量信息
+#  @param curPlayer:采集玩家实例
+#  @param mapID:
+#  @param npcInfoDict:
+#  @return None
+def SyncNPCCntInfo(curPlayer, mapID, npcCntDict):
+    npcInfoPack = ChPyNetSendPack.tagMCNPCCntList()
+    npcInfoPack.Clear()
+    npcInfoPack.MapID = mapID
+    npcInfoPack.NPCInfoList = []
+
+    for npcid, npcCnt in npcCntDict.items():
+        npcInfo = ChPyNetSendPack.tagMCNPCCntInfo()
+        npcInfo.Clear()
+        npcInfo.NPCID = npcid
+        npcInfo.Cnt = npcCnt
+        npcInfoPack.NPCInfoList.append(npcInfo)
+        
+    npcInfoPack.NPCInfoCnt = len(npcInfoPack.NPCInfoList)
+    NetPackCommon.SendFakePack(curPlayer, npcInfoPack)
+    return
+
 def SendGameServerGoodItemRecord(mapID, npcID, playerName, playerID, itemID, equipInfo=[]):
     # @param equipInfo: [equipPlace, itemClassLV, itemColor, itemQuality, itemUserData]
 #    GameWorld.DebugLog("检查物品是否发送GameServer: mapID=%s, npcID=%s, playerName=%s, itemID=%s" 
--
Gitblit v1.8.0