From ea99ae4d08b7475560dceb9b8fd9a370daab0cbb Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 09 九月 2019 18:54:22 +0800
Subject: [PATCH] 8255 【后端】【主干】拍品可使用及上下架优化(拍品可下架)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini                       |    6 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py               |   57 ++++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py                                    |   57 ++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAuctionHouse.py |   21 +++++
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/AuctionHouse.py                    |   46 ++++++++++-
 5 files changed, 181 insertions(+), 6 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 07975d4..5b4630e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -15908,6 +15908,63 @@
 
 
 #------------------------------------------------------
+# B5 15 拍卖行下架拍品 #tagCMUnsellAuctionItem
+
+class  tagCMUnsellAuctionItem(Structure):
+    Head = tagHead()
+    ItemGUID = ""    #(char ItemGUID[40])
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xB5
+        self.Head.SubCmd = 0x15
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.ItemGUID,_pos = CommFunc.ReadString(_lpData, _pos,40)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xB5
+        self.Head.SubCmd = 0x15
+        self.ItemGUID = ""
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 40
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteString(data, 40, self.ItemGUID)
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                ItemGUID:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.ItemGUID
+                                )
+        return DumpString
+
+
+m_NAtagCMUnsellAuctionItem=tagCMUnsellAuctionItem()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMUnsellAuctionItem.Head.Cmd,m_NAtagCMUnsellAuctionItem.Head.SubCmd))] = m_NAtagCMUnsellAuctionItem
+
+
+#------------------------------------------------------
 # B9 04 修改队伍相关审核状态 #tagCMChangeTeamCheckState
 
 class  tagCMChangeTeamCheckState(Structure):
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/AuctionHouse.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/AuctionHouse.py
index 6ca7fd6..efb3b97 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/AuctionHouse.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/AuctionHouse.py
@@ -52,7 +52,8 @@
 AuctionRecordResult_BidOK, # 竞价成功
 AuctionRecordResult_BidFail, # 竞价失败
 AuctionRecordResult_MoveToWorld, # 仙盟拍品转移到全服拍品
-) = range(6)
+AuctionRecordResult_Unsell, # 下架
+) = range(7)
 
 # 当前拍品归类 0-全服拍品 1-仙盟私有拍品
 AuctionType_World = 0
@@ -847,13 +848,17 @@
             elif playerID:
                 endType = "Return"
                 
-                # 流拍返还物品邮件
+                # 返还物品邮件
                 paramList = []
                 detail = {"ItemGUID":itemGUID}
                 addItemList = [{"ItemID":itemID, "Count":itemCount, "IsAuctionItem":True, "UserData":auctionItem.UserData}]
-                PlayerCompensation.SendMailByKey("PaimaiMail4", [playerID], addItemList, paramList, detail=detail)
-                
-                AddAuctionRecord(auctionItem, AuctionRecordResult_SellFail)
+                # 下架
+                if endEvent == "Unsell":
+                    PlayerCompensation.SendMailByKey("PaimaiMail9", [playerID], addItemList, paramList, detail=detail)
+                    AddAuctionRecord(auctionItem, AuctionRecordResult_Unsell)
+                else:
+                    PlayerCompensation.SendMailByKey("PaimaiMail4", [playerID], addItemList, paramList, detail=detail)
+                    AddAuctionRecord(auctionItem, AuctionRecordResult_SellFail)
             else:
                 endType = "SystemDelete"
                 GameWorld.Log("系统拍品流拍: itemGUID=%s,itemID=%s" % (itemGUID, itemID))
@@ -972,6 +977,12 @@
             
         return
     
+    # 下架拍品
+    elif queryType == "UnsellAuctionItem":
+        itemGUID = queryData[0]
+        __DoUnsellAuctionItem(curPlayer, itemGUID)
+        return
+        
     elif queryType == "ClearAuctionItem":
         __DoGMClearAuctionItem(curPlayer)
         return
@@ -1134,6 +1145,31 @@
             NetPackCommon.SendFakePack(player, infoPack)
     return
 
+def __DoUnsellAuctionItem(curPlayer, itemGUID):
+    ## 下架拍品
+    auctionItem = GetAuctionItem(itemGUID)
+    if not auctionItem:
+        # 拍品不存在
+        PlayerControl.NotifyCode(curPlayer, "Paimai3")
+        return
+    playerID = curPlayer.GetPlayerID()
+    itemID = auctionItem.ItemID
+    if auctionItem.FamilyID:
+        GameWorld.ErrLog("仙盟拍品无法下架!itemGUID=%s,itemID=%s,itemFamilyID=%s" 
+                         % (itemGUID, itemID, auctionItem.FamilyID), playerID)
+        return
+    if auctionItem.PlayerID != playerID:
+        GameWorld.ErrLog("不是玩家自己的拍品无法下架!itemGUID=%s,itemID=%s,itemPlayerID=%s" 
+                         % (itemGUID, itemID, auctionItem.PlayerID), playerID)
+        return
+    if auctionItem.BidderPrice:
+        # 竞价中的拍品不能下架
+        PlayerControl.NotifyCode(curPlayer, "Paimai9")
+        return
+    
+    __EndAuctionItem([auctionItem], "Unsell")
+    return
+
 def __DoPlayerBidAuctionItem(curPlayer, itemGUID, biddingPrice, tick, isOnlyCheck):
     ''' 玩家竞价物品
     @param curPlayer: 竞价的玩家
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index 39a9b11..1ef2ae9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -1036,7 +1036,7 @@
 Writer = hxp
 Releaser = hxp
 RegType = 0
-RegisterPackCount = 2
+RegisterPackCount = 3
 
 PacketCMD_1=0xB5
 PacketSubCMD_1=0x13
@@ -1046,6 +1046,10 @@
 PacketSubCMD_2=0x14
 PacketCallFunc_2=OnBiddingAuctionItem
 
+PacketCMD_3=0xB5
+PacketSubCMD_3=0x15
+PacketCallFunc_3=OnUnsellAuctionItem
+
 ;法宝
 [PlayerMagicWeapon]
 ScriptName = Player\PlayerMagicWeapon.py
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 07975d4..5b4630e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -15908,6 +15908,63 @@
 
 
 #------------------------------------------------------
+# B5 15 拍卖行下架拍品 #tagCMUnsellAuctionItem
+
+class  tagCMUnsellAuctionItem(Structure):
+    Head = tagHead()
+    ItemGUID = ""    #(char ItemGUID[40])
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xB5
+        self.Head.SubCmd = 0x15
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.ItemGUID,_pos = CommFunc.ReadString(_lpData, _pos,40)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xB5
+        self.Head.SubCmd = 0x15
+        self.ItemGUID = ""
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 40
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteString(data, 40, self.ItemGUID)
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                ItemGUID:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.ItemGUID
+                                )
+        return DumpString
+
+
+m_NAtagCMUnsellAuctionItem=tagCMUnsellAuctionItem()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMUnsellAuctionItem.Head.Cmd,m_NAtagCMUnsellAuctionItem.Head.SubCmd))] = m_NAtagCMUnsellAuctionItem
+
+
+#------------------------------------------------------
 # B9 04 修改队伍相关审核状态 #tagCMChangeTeamCheckState
 
 class  tagCMChangeTeamCheckState(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAuctionHouse.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAuctionHouse.py
index 666237d..28d9b81 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAuctionHouse.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAuctionHouse.py
@@ -246,6 +246,27 @@
     __DoAddAuctionItem(None, auctionItemList)
     return
 
+#// B5 15 拍卖行下架拍品 #tagCMUnsellAuctionItem
+#
+#struct    tagCMUnsellAuctionItem
+#{
+#    tagHead    Head;
+#    char    ItemGUID[40];
+#};
+def OnUnsellAuctionItem(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    playerID = curPlayer.GetPlayerID()
+    itemGUID = clientData.ItemGUID
+    
+    # 直接发邮件,这里就不验证背包了
+#    #验证背包空间
+#    if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):
+#        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
+#        return
+    
+    QueryGameServer_AuctionHouse(playerID, "UnsellAuctionItem", [itemGUID])
+    return
+
 def DR_AuctionHouse(curPlayer, eventName, drDict):
     accID = "" if not curPlayer else curPlayer.GetAccID()
     playerID = 0 if not curPlayer else curPlayer.GetPlayerID()

--
Gitblit v1.8.0