1111 【BT】支持一键整理过期拍品(同步主干、长尾);
| | |
| | | ("SubCmd", c_ubyte),
|
| | | ("PackType", c_ubyte), #背包类型
|
| | | ("ItemIndex", c_ubyte), #物品在背包中索引
|
| | | ("IsAll", c_ubyte), #是否处理所有过期物品
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.SubCmd = 0x08
|
| | | self.PackType = 0
|
| | | self.ItemIndex = 0
|
| | | self.IsAll = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | 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
|
| | |
|
| | |
| | | ("SubCmd", c_ubyte),
|
| | | ("PackType", c_ubyte), #背包类型
|
| | | ("ItemIndex", c_ubyte), #物品在背包中索引
|
| | | ("IsAll", c_ubyte), #是否处理所有过期物品
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.SubCmd = 0x08
|
| | | self.PackType = 0
|
| | | self.ItemIndex = 0
|
| | | self.IsAll = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | 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
|
| | |
|
| | |
| | |
|
| | | import random
|
| | | import json
|
| | | import time
|
| | | #---------------------------------------------------------------------
|
| | | #导入
|
| | | GameWorld.ImportAll("Script\\Item\\" , "UseItem")
|
| | |
| | | # 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("物品不存在!")
|