From 5f507dd6b2d8a41922e45751e217cfe835b78203 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 30 八月 2018 16:25:13 +0800
Subject: [PATCH] Fix: 修复封魔坛刷怪报错;

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
index 06baf29..f13b50d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
@@ -51,7 +51,7 @@
 import PlayerGeTui
 import ChEquip
 import QuestCommon
-
+import random
 
 # 可吞噬的装备位
 Def_EatItem_EquipPlace = [
@@ -440,7 +440,8 @@
     
     # 2.物品
     OnTJGDropItems(curPlayer, npcID, killCnt)
-    
+    #任务道具
+    OnTJGDropTaskItems(curPlayer, npcData.GetLV(), killCnt)
     # VIP杀怪加攻
     PlayerVip.DoAddVIPKillLVExp(curPlayer, npcData, killCnt)
     
@@ -558,6 +559,28 @@
     NoteEatEquip(curPlayer, eatCount, giveCnt)
     CheckPackFull(curPlayer)
     
+def OnTJGDropTaskItems(curPlayer, npclv, killCnt):
+    #掉落任务道具
+    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TJGPackFullAfterEat):
+        # 满了不再给物品
+        return
+    dropTaskItemDict = IpyGameDataPY.GetFuncEvalCfg('TJDropTaskItem', 1, {})
+    for missionID, dropInfo in dropTaskItemDict.items():
+        if not curPlayer.FindMission(missionID):
+            continue
+        npclvLimit, itemID, needItemCnt, itemCntFormula = dropInfo
+        if npclv < npclvLimit:
+            continue
+        haveCnt = ItemControler.FindPlayerItemCountByItemID(curPlayer, IPY_GameWorld.rptItem, itemID)
+        giveItemCnt = min(needItemCnt-haveCnt, eval(itemCntFormula))
+        if giveItemCnt <= 0:
+            continue
+        packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, 1)
+        if packSpace < 1:
+            #GameWorld.Log('脱机挂掉落任务道具背包不足! missionID=%s,itemID=%s,giveItemCnt=%s'%(missionID, itemID, giveItemCnt))
+            continue
+        ItemControler.GivePlayerItem(curPlayer, itemID, giveItemCnt, 0, [IPY_GameWorld.rptItem])
+    return
     
 def CheckPackFull(curPlayer):
     if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):

--
Gitblit v1.8.0