From fd7eac0742b3f18203d52312fb705fb30f03bdf4 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 23 八月 2018 14:53:24 +0800
Subject: [PATCH] fix:脱机掉落任务道具

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py |    4 ++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py           |   25 ++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
index 62699e6..0c3ecdd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
@@ -1935,12 +1935,12 @@
     itemID = GameWorld.ToIntDef(curConditionNode.GetAttribute("itemID"), 0)
     if maxItemCnt and itemID: #未收集的道具个数乘以单价
         haveCnt = ItemControler.FindPlayerItemCountByItemID(curPlayer, IPY_GameWorld.rptItem, itemID)
-        conditionValue = max(0, maxItemCnt-haveCnt)*value
+        conditionValue = max(0, maxItemCnt-haveCnt)*conditionValue
         
     conditionType = curConditionNode.GetAttribute("type")
     moneyType = int(curConditionNode.GetAttribute("moneytype"))
     
-    
+    #GameWorld.Log('    conditionValue=%s,maxItemCnt=%s,itemID=%s'%(conditionValue,maxItemCnt,itemID))
     
     goldValue = curPlayer.GetGold()
     goldPaperValue = curPlayer.GetGoldPaper()
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..9a0f892 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
@@ -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