From 09daae185e5a4005076419f98d896f991e39335e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 11 三月 2019 21:30:51 +0800
Subject: [PATCH] 6332 【后端】【2.0】主要是拍品相关规则调整及背包优化(邮件拍品处理,拍品奖励配置格式优化)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py |   45 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
index 591b86d..5010831 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
@@ -29,6 +29,9 @@
 import EventReport
 import ChConfig
 import PlayerControl
+import IpyGameDataPY
+
+import time
 
 ##A5 3B 请求领取补偿#tagCMRequestCompensation
 #  @param index, clientPack, tick
@@ -68,6 +71,7 @@
         GameWorld.DebugLog("    PlayerID %s no found "%curPackData.PlayerID)
         return
     
+    hasAuctionItem = False
     needPackSpaceDict = {}
     isPackSpaceEnough = True
     # 先汇总物品所属背包
@@ -78,9 +82,12 @@
         if not curItemData:
             continue
         
+        isAuctionItem = not curPackItem.IsBind
         packType = ChConfig.GetItemPackType(curItemData.GetType())
-        needSpace = ItemControler.GetItemNeedPackCount(packType, curItemData, curPackItem.Count)
+        needSpace = ItemControler.GetItemNeedPackCount(packType, curItemData, curPackItem.Count, isAuctionItem)
         needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
+        if isAuctionItem:
+            hasAuctionItem = True
             
     GameWorld.DebugLog("    needPackSpaceDict=%s" % str(needPackSpaceDict))
     for packType, needSpace in needPackSpaceDict.items():
@@ -88,6 +95,28 @@
             PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [packType])
             isPackSpaceEnough = False
             break
+        
+    auctionItemTimeout = False
+    auctionItemCreateTime = 0
+    if hasAuctionItem:
+        auctionItemValidTimesMax = IpyGameDataPY.GetFuncCfg("AuctionItem", 1) * 3600 # 拍品有效时长
+        auctionItemValidTimesMail = IpyGameDataPY.GetFuncCfg("AuctionItem", 2) * 3600 # 邮件拍品附加有效时长
+        auctionItemValidTimesTotal = auctionItemValidTimesMail + auctionItemValidTimesMax
+        mailCreateTimeStr = curPackData.CreateTime
+        mailCreateTime = GameWorld.ChangeTimeStrToNum(mailCreateTimeStr)
+        curTime = int(time.time())
+        passTime = curTime - mailCreateTime
+        if passTime <= auctionItemValidTimesMail:
+            GameWorld.DebugLog("邮件拍品领取时间在附加保护时长内,拍品创建时间即领取邮件时间开始算!passTime(%s) <= auctionItemValidTimesMail(%s)" % (passTime, auctionItemValidTimesMail))
+            pass
+        elif auctionItemValidTimesMail < passTime < auctionItemValidTimesTotal:
+            auctionItemCreateTime = curTime - (passTime - auctionItemValidTimesMail)
+            GameWorld.DebugLog("邮件拍品领取时间超过邮件保护时间,拍品创建时间需扣除领取时的溢出时间!auctionItemValidTimesMail(%s) < passTime(%s) < auctionItemValidTimesTotal(%s), auctionItemCreateTime=%s" 
+                               % (auctionItemValidTimesMail, passTime, auctionItemValidTimesTotal, GameWorld.ChangeTimeNumToStr(auctionItemCreateTime)))
+        elif passTime >= auctionItemValidTimesMax:
+            auctionItemTimeout = True
+            GameWorld.DebugLog("邮件中的拍品已过期,将自动转为非拍品!passTime(%s) >= auctionItemValidTimesMax(%s)" 
+                               % (passTime, auctionItemValidTimesMax))
             
     #背包空间不足
     if not isPackSpaceEnough:
@@ -108,13 +137,11 @@
     for i in xrange(curPackData.Count):
         curPackItem = curPackData.Items[i]
         itemID = curPackItem.ItemID
+        isAuctionItem = not curPackItem.IsBind and not auctionItemTimeout
         if ItemControler.GetAppointItemRealID(itemID):
-            #定制物品
-            ItemControler.GivePlayerItem(curPlayer, itemID, curPackItem.Count, 0, [IPY_GameWorld.rptItem], 
-                                         event=[ChConfig.ItemGive_Mail, False, {"MailGUID":curPackData.GUID}])
-            continue
-        
-        curCreateItem = ItemCommon.CreateSingleItem(itemID, curPackItem.Count, not curPackItem.IsBind)
+            curCreateItem = ItemControler.GetItemByData(ItemControler.GetAppointItemDictData(itemID, isAuctionItem))
+        else:
+            curCreateItem = ItemCommon.CreateSingleItem(itemID, curPackItem.Count, isAuctionItem)
         if not curCreateItem:
             GameWorld.ErrLog("OnGMRequestCompensationResult CreateSingleItem %s Err "%itemID)
             continue
@@ -125,6 +152,10 @@
             #设置UserData
             UserData = "%s"%UserDataDict
             curCreateItem.SetUserData(UserData, len(UserData))
+            
+        if isAuctionItem and auctionItemCreateTime:
+            curCreateItem.SetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime, auctionItemCreateTime)
+            
         ItemCommon.MakeEquipGS(curCreateItem)
         #放入玩家背包
         ItemControler.PlayerItemControler(curPlayer).PutInItem(IPY_GameWorld.rptItem, curCreateItem, 

--
Gitblit v1.8.0