From ed229e08570d6394af15743125d03031b75096be Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 25 五月 2019 15:35:14 +0800
Subject: [PATCH] 6805 【后端】【2.0】副本前端化(给物品虚拟掉落顺序优化,补齐创建物品没有传curPlayer参数)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py            |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py    |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py               |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py                       |   61 ++++++++++++------------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py                    |    4 +-
 6 files changed, 30 insertions(+), 43 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
index 16b5138..c0bbf85 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
@@ -725,7 +725,7 @@
 
     itemControl = ItemControler.PlayerItemControler(curPlayer)
     for itemID, itemCount, isBind in totalItemList:
-        curItemObj = ItemControler.GetOutPutItemObj(itemID, itemCount, False)
+        curItemObj = ItemControler.GetOutPutItemObj(itemID, itemCount, False, curPlayer=curPlayer)
         if not curItemObj:
             continue
         userData = curItemObj.GetUserData()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
index a7b492a..8e71809 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
@@ -615,7 +615,7 @@
 
 def __GivePlayerCompoundItem(curPlayer, packType, newItemID, itemCount, isBind, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, expireTime):
     playerID = curPlayer.GetPlayerID()
-    curSingleItem = ItemControler.GetOutPutItemObj(newItemID, itemCount, False, expireTime)
+    curSingleItem = ItemControler.GetOutPutItemObj(newItemID, itemCount, False, expireTime, curPlayer=curPlayer)
     if not curSingleItem:
         GameWorld.ErrLog("创造物品失败, give item itemid:%s,count:%s" % (newItemID, itemCount), playerID)
         return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py
index 7bd532f..4d1186c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py
@@ -91,7 +91,7 @@
     # 给奖励
     syncItemList = []
     for itemID, itemCount in jobAwardItemList:
-        curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, False)
+        curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, False, curPlayer=curPlayer)
         if not curItem:
             GameWorld.ErrLog("宝箱创建奖励物品异常!chestsItemID=%s,useCnt=%s,itemID=%s,itemCount=%s,isBind=%s" 
                              % (chestsItemID, useCnt, itemID, itemCount, isBind), curPlayer.GetPlayerID())
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 c01ed88..6df6ba0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -496,7 +496,7 @@
         
         if ItemCommon.GetIsEquip(itemData):
             for _ in xrange(itemCount):
-                curItem = ItemControler.GetOutPutItemObj(itemID)
+                curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
                 if curItem:
                     needSpace += 1
                     prizeItemList.append(curItem)
@@ -556,27 +556,6 @@
     #GameWorld.DebugLog("    totalExp=%s,totalMoney=%s,needSpace=%s,jsonItemList=%s" % (totalExp, totalMoney, needSpace, jsonItemList))
     return jsonItemList, totalExp, totalMoney
 
-def DoVirtualItemDrop(curPlayer, dropItemList, dropPosX, dropPosY):
-    ##前端假掉落表现
-    gameMap = GameWorld.GetMap()
-    index = 0
-    for posX, posY in ChConfig.Def_DropItemAreaMatrix:
-        resultX = dropPosX + posX
-        resultY = dropPosY + posY
-        if not gameMap.CanMove(resultX, resultY):
-            #玩家不可移动这个点
-            continue
-        if index > len(dropItemList) - 1:
-            break
-        itemInfo = dropItemList[index]
-        index += 1
-        itemID, itemCount, isAuctionItem = itemInfo
-        curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem)
-        dropItemDataStr = ChItem.GetMapDropItemDataStr(curItem)
-        SendVirtualItemDrop(curPlayer, itemID, resultX, resultY, dropItemDataStr)
-        curItem.Clear()
-    return
-
 def DoMapDropPrizeItem(curPlayer, prizeItemList, npcID, dropPosX, dropPosY, isDropDisperse=True, isOnlySelfSee=True):
     ## 奖励物品真实掉落地图,先拆开分散再掉落
     
@@ -609,7 +588,7 @@
         index += 1
         if isinstance(curItem, list):
             itemID, itemCount, isAuctionItem = curItem
-            curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem)
+            curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
             
         if not curItem:
             continue
@@ -627,7 +606,7 @@
         mapID = GameWorld.GetGameWorld().GetMapID()
         
     playerID = curPlayer.GetPlayerID()
-    mailItemList = []
+    giveItemObjList = []
     virtualItemDropList = []
     itemControl = ItemControler.PlayerItemControler(curPlayer)
     for itemInfo in giveItemList:
@@ -641,17 +620,8 @@
             itemID = curItem.GetItemTypeID()
             itemCount = curItem.GetCount()
             isAuctionItem = ItemControler.GetIsAuctionItem(curItem)
-        jsonItem = ItemCommon.GetJsonItem(curItem)
         dropItemDataStr = ChItem.GetMapDropItemDataStr(curItem)
-        equipInfo = [curItem.GetEquipPlace(), ItemCommon.GetItemClassLV(curItem), curItem.GetItemColor(), 
-                     curItem.GetItemQuality(), curItem.GetUserData()]
-        packIndex = ChConfig.GetItemPackType(curItem.GetType())
-        if not itemControl.PutInItem(packIndex, curItem, event=[ChConfig.ItemGive_Pickup, False, {"NPCID":npcID}]):
-            mailItemList.append(jsonItem)
-            
-        if npcID:
-            serverGroupID = PlayerControl.GetPlayerServerGroupID(curPlayer)
-            SendGameServerGoodItemRecord(mapID, lineID, npcID, curPlayer.GetName(), playerID, itemID, equipInfo, serverGroupID)
+        giveItemObjList.append(curItem)
             
         # 散开掉落
         if isDropDisperse:
@@ -659,10 +629,8 @@
                 virtualItemDropList.append([itemID, dropItemDataStr])
         else:
             virtualItemDropList.append([itemID, dropItemDataStr])
-            
-    if mailItemList:
-        PlayerControl.SendMailByKey(mailTypeKey, [playerID], mailItemList, [mapID])
         
+    # 先通知掉落,再给物品,因为前端表现弹框需要这个顺序需求
     gameMap = GameWorld.GetMap()
     index = 0
     for posX, posY in ChConfig.Def_DropItemAreaMatrix:
@@ -679,6 +647,25 @@
         itemID, dropItemDataStr = virtualItemDropList[index]
         index += 1
         SendVirtualItemDrop(curPlayer, itemID, resultX, resultY, dropItemDataStr)
+        
+    # 再给物品
+    mailItemList = []
+    for itemObj in giveItemObjList:
+        itemID = itemObj.GetItemTypeID()
+        mailItem = ItemCommon.GetMailItemDict(itemObj)
+        equipInfo = [itemObj.GetEquipPlace(), ItemCommon.GetItemClassLV(itemObj), itemObj.GetItemColor(), 
+                     itemObj.GetItemQuality(), itemObj.GetUserData()]
+        packIndex = ChConfig.GetItemPackType(itemObj.GetType())
+        if not itemControl.PutInItem(packIndex, itemObj, event=[ChConfig.ItemGive_Pickup, False, {"NPCID":npcID}]):
+            mailItemList.append(mailItem)
+            
+        if npcID:
+            serverGroupID = PlayerControl.GetPlayerServerGroupID(curPlayer)
+            SendGameServerGoodItemRecord(mapID, lineID, npcID, curPlayer.GetName(), playerID, itemID, equipInfo, serverGroupID)
+         
+    # 放不下的发邮件   
+    if mailItemList:
+        PlayerControl.SendMailByKey(mailTypeKey, [playerID], mailItemList, [mapID])
     return
 
 ################################### NPC掉落 ###################################
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 eea0126..d2b1d95 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
@@ -491,7 +491,7 @@
         ## 装备一件件给
         if ItemCommon.GetIsEquip(curItemData):
             for _ in xrange(dropCount):
-                curItem = ItemControler.GetOutPutItemObj(itemID, 1, isAuctionItem)
+                curItem = ItemControler.GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer)
                 if not curItem:
                     continue
                 if not itemControl.PutInItem(IPY_GameWorld.rptItem, curItem, event=[ChConfig.ItemGive_TJGDropItem, False, {}]):
@@ -500,7 +500,7 @@
                 #记录紫橙装数量用于通知
                 NoteEquip(curPlayer, curItemData.GetItemColor())
         else:
-            curItem = ItemControler.GetOutPutItemObj(itemID, dropCount, isAuctionItem)
+            curItem = ItemControler.GetOutPutItemObj(itemID, dropCount, isAuctionItem, curPlayer=curPlayer)
             if not curItem:
                 continue
             
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py
index 8148ac4..0a9481c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py
@@ -337,7 +337,7 @@
     mailItemList = []
     itemControl = ItemControler.PlayerItemControler(curPlayer)
     for gridNum, itemID, itemCount, isBind in treasureResult:
-        itemObj = ItemControler.GetOutPutItemObj(itemID, itemCount, False)
+        itemObj = ItemControler.GetOutPutItemObj(itemID, itemCount, False, curPlayer=curPlayer)
         mailItemDict = ItemCommon.GetMailItemDict(itemObj)
         
         if int(gridNum) in goodGridNumList:

--
Gitblit v1.8.0