hxp
2020-10-19 0109694e42f8eb784aef55436051e2a0f4fae06f
1111 【BT】支持一键整理过期拍品(同步主干、长尾);
3个文件已修改
45 ■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -7207,6 +7207,7 @@
                  ("SubCmd", c_ubyte),
                  ("PackType", c_ubyte),    #背包类型
                  ("ItemIndex", c_ubyte),    #物品在背包中索引
                  ("IsAll", c_ubyte),    #是否处理所有过期物品
                  ]
    def __init__(self):
@@ -7225,6 +7226,7 @@
        self.SubCmd = 0x08
        self.PackType = 0
        self.ItemIndex = 0
        self.IsAll = 0
        return
    def GetLength(self):
@@ -7238,13 +7240,15 @@
                                Cmd:%s,
                                SubCmd:%s,
                                PackType:%d,
                                ItemIndex:%d
                                ItemIndex:%d,
                                IsAll:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.PackType,
                                self.ItemIndex
                                self.ItemIndex,
                                self.IsAll
                                )
        return DumpString
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -7207,6 +7207,7 @@
                  ("SubCmd", c_ubyte),
                  ("PackType", c_ubyte),    #背包类型
                  ("ItemIndex", c_ubyte),    #物品在背包中索引
                  ("IsAll", c_ubyte),    #是否处理所有过期物品
                  ]
    def __init__(self):
@@ -7225,6 +7226,7 @@
        self.SubCmd = 0x08
        self.PackType = 0
        self.ItemIndex = 0
        self.IsAll = 0
        return
    def GetLength(self):
@@ -7238,13 +7240,15 @@
                                Cmd:%s,
                                SubCmd:%s,
                                PackType:%d,
                                ItemIndex:%d
                                ItemIndex:%d,
                                IsAll:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.PackType,
                                self.ItemIndex
                                self.ItemIndex,
                                self.IsAll
                                )
        return DumpString
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
@@ -55,6 +55,7 @@
import random
import json
import time
#---------------------------------------------------------------------
#导入
GameWorld.ImportAll("Script\\Item\\" , "UseItem")
@@ -2034,15 +2035,41 @@
#    tagHead        Head;
#    BYTE        PackType;        //背包类型
#    BYTE        ItemIndex;        //物品在背包中索引
#    BYTE        IsAll;            //是否处理所有过期物品
#};
def OnItemTimeout(index, clientData, tick):
    packType = clientData.PackType
    itemIndex = clientData.ItemIndex
    isAll = clientData.IsAll
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    backPack = curPlayer.GetItemManager().GetPack(packType)
    if not backPack:
        return
    if isAll:
        # 目前仅针对拍品
        GameWorld.DebugLog("=== 一键处理所有过期物品 ===")
        curTime = int(time.time())
        auctionItemTimeout = IpyGameDataPY.GetFuncCfg("AuctionItem", 1)
        for i in xrange(backPack.GetCount()):
            curItem = backPack.GetAt(i)
            if not ItemCommon.CheckItemCanUse(curItem):
                continue
            if not ItemControler.GetIsAuctionItem(curItem):
                continue
            auctionItemCreateTime = curItem.GetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime)
            if not auctionItemCreateTime:
                continue
            if curTime - auctionItemCreateTime < auctionItemTimeout * 3600:
                # 未过期
                continue
            GameWorld.DebugLog("玩家拍品过期: i=%s,itemID=%s" % (i, curItem.GetItemTypeID()), curPlayer.GetPlayerID())
            ItemControler.SetIsAuctionItem(curItem, False, curPlayer)
        # 整理背包
        ItemControler.ResetItem(curPlayer, packType, 0, 0, tick)
        return
    curItem = backPack.GetAt(itemIndex)
    if not ItemCommon.CheckItemCanUse(curItem):
        GameWorld.DebugLog("物品不存在!")