public void Load() { string absPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Pb.CurrentProfile.XmlPath), Path); if (ProfileManager.XmlLocation != absPath) { try { Professionbuddy.Debug("Loading Profile :{0}, previous profile was {1}", absPath, ProfileManager.XmlLocation); if (string.IsNullOrEmpty(Path)) { ProfileManager.LoadEmpty(); } else if (System.IO.File.Exists(absPath)) { ProfileManager.LoadNew(absPath); } else { Professionbuddy.Err("Unable to load profile {0}", Path); } } catch { } } }
protected override RunStatus Run(object context) { if (!IsDone) { if (!_timeout.IsRunning) { _timeout.Start(); } try { if (_timeout.ElapsedMilliseconds >= Timeout || CanRunDelegate(null)) { _timeout.Stop(); _timeout.Reset(); Professionbuddy.Debug("Wait Until {0} Completed", Condition); IsDone = true; } else { return(RunStatus.Success); } } catch (Exception ex) { if (ex.GetType() != typeof(ThreadAbortException)) { Professionbuddy.Err("{0}:({1})\n{2}", Pb.Strings["Action_WaitAction_Name"], Condition, ex); } } } return(RunStatus.Failure); }
protected override RunStatus Run(object context) { if (!IsDone) { try { if (Lua.GetReturnVal <int>("if AuctionFrame and AuctionFrame:IsVisible() == 1 then return 1 else return 0 end ", 0) == 0) { MoveToAh(); } else if (Lua.GetReturnVal <int>("if CanSendAuctionQuery('owner') == 1 then return 1 else return 0 end ", 0) == 1) { if (_toScanItemList == null) { _toScanItemList = BuildScanItemList(); _toCancelItemList = new List <AuctionEntry>(); } if (_toScanItemList.Count > 0) { AuctionEntry ae = _toScanItemList[0]; bool scanDone = ScanAh(ref ae); _toScanItemList[0] = ae; // update if (scanDone) { _toCancelItemList.Add(ae); _toScanItemList.RemoveAt(0); } if (_toScanItemList.Count == 0) { Professionbuddy.Debug("Finished scanning for items"); } } else { if (_toCancelItemList.Count == 0) { _toScanItemList = null; IsDone = true; return(RunStatus.Failure); } if (CancelAuction(_toCancelItemList[0])) { _toCancelItemList.RemoveAt(0); } } } return(RunStatus.Success); } catch (Exception ex) { Professionbuddy.Err(ex.ToString()); } } return(RunStatus.Failure); }
bool ScanAh(ref AuctionEntry ae) { bool scanned = false; if (!queueTimer.IsRunning) { string lua = string.Format("QueryAuctionItems(\"{0}\" ,nil,nil,nil,nil,nil,{1}) return 1", ae.Name.ToFormatedUTF8(), page); Lua.GetReturnVal <int>(lua, 0); Professionbuddy.Debug("Searching AH for {0}", ae.Name); queueTimer.Start(); } else if (queueTimer.ElapsedMilliseconds <= 10000) { using (new FrameLock()) { if (Lua.GetReturnVal <int>("if CanSendAuctionQuery('list') == 1 then return 1 else return 0 end ", 0) == 1) { queueTimer.Stop(); queueTimer.Reset(); totalAuctions = Lua.GetReturnVal <int>("return GetNumAuctionItems('list')", 1); string lua = string.Format("local A,totalA= GetNumAuctionItems('list') local me = GetUnitName('player') local auctionInfo = {{{0},{1}}} for index=1, A do local name, _, count,_,_,_,minBid,_, buyoutPrice,_,_,owner,_ = GetAuctionItemInfo('list', index) if name == \"{2}\" and owner ~= me and buyoutPrice > 0 and buyoutPrice/count < auctionInfo[1] then auctionInfo[1] = floor(buyoutPrice/count) end if owner == me then auctionInfo[2] = auctionInfo[2] + 1 end end return unpack(auctionInfo) ", ae.LowestBo, ae.myAuctions, ae.Name.ToFormatedUTF8()); //Logging.Write("****Copy Below this line****"); //Logging.Write(lua); //Logging.Write("****End of copy/paste****"); List <string> retVals = Lua.GetReturnValues(lua); uint.TryParse(retVals[0], out ae.LowestBo); uint.TryParse(retVals[1], out ae.myAuctions); if (++page >= (int)Math.Ceiling((double)totalAuctions / 50)) { scanned = true; } } } } else { scanned = true; } // reset to default values in preparations for next scan if (scanned) { Professionbuddy.Debug("lowest buyout {0}", ae.LowestBo); queueTimer.Stop(); queueTimer.Reset(); totalAuctions = 0; page = 0; } return(scanned); }
bool BuyFromAH(BuyItemEntry bie) { bool done = false; if (!queueTimer.IsRunning) { string lua = string.Format("QueryAuctionItems(\"{0}\" ,nil,nil,nil,nil,nil,{1}) return 1", bie.Name.ToFormatedUTF8(), page); Lua.GetReturnVal <int>(lua, 0); Professionbuddy.Debug("Searching AH for {0}", bie.Name); queueTimer.Start(); } else if (queueTimer.ElapsedMilliseconds <= 10000) { if (Lua.GetReturnVal <int>("if CanSendAuctionQuery('list') == 1 then return 1 else return 0 end ", 0) == 1) { totalAuctions = Lua.GetReturnVal <int>("return GetNumAuctionItems('list')", 1); queueTimer.Stop(); queueTimer.Reset(); if (totalAuctions > 0) { string lua = string.Format("local A,totalA= GetNumAuctionItems('list') local amountBought={0} local want={1} local each={3} local useBid={4} local buyPrice=0 for index=1, A do local name, _, count,_,_,_,minBid,minInc, buyoutPrice,bidNum,isHighBidder,_,_ = GetAuctionItemInfo('list', index) if useBid == 1 and buyoutPrice > each*count and isHighBidder == nil then if bidNum == nil then buyPrice =minBid + minInc else buyPrice = bidNum + minInc end else buyPrice = buyoutPrice end if name == \"{2}\" and buyPrice > 0 and buyPrice <= each*count and amountBought < want then amountBought = amountBought + count PlaceAuctionBid('list', index,buyPrice) end if amountBought >= want then return -1 end end return amountBought", counter, bie.BuyAmount, bie.Name.ToFormatedUTF8(), MaxBuyout.TotalCopper, BidOnItem == true ? 1 : 0); //string lua = string.Format("local A,totalA= GetNumAuctionItems('list') local amountBought={0} local want={1} local each={3} local useBid={4} for index=1, A do local name, _, count,_,_,_,minBid,minIncreament, buyoutPrice,_,_,_,_ = GetAuctionItemInfo('list', index) if name == \"{2}\" and ((buyoutPrice > 0 and buyoutPrice <= each*count) or (useBid==1 and (minBid+minIncreament) <= each*count)) and amountBought < want then amountBought = amountBought + count if useBid==1 and buyoutPrice > each*count then PlaceAuctionBid('list', index, minBid+minIncreament) else PlaceAuctionBid('list', index, buyoutPrice) end end if amountBought >= want then return -1 end end return amountBought", // counter, bie.BuyAmount, bie.Name, MaxBuyout.TotalCopper, BidOnItem == true ? 1 : 0); counter = Lua.GetReturnVal <int>(lua, 0); if (counter == -1 || ++page >= (int)Math.Ceiling((double)totalAuctions / 50)) { done = true; } } else { done = true; } } } else { done = true; } if (done) { queueTimer = new Stopwatch(); totalAuctions = 0; counter = 0; page = 0; } return(done); }
//indexs are {0}=ItemsCounter,NumOfItemToBuy, {1}=ItemID, {2}=maxBuyout, {3}=BidOnItem ? 1 : 0 private bool BuyFromAH(BuyItemEntry bie) { bool done = false; if (!_queueTimer.IsRunning) { string lua = string.Format("QueryAuctionItems(\"{0}\" ,nil,nil,nil,nil,nil,{1}) return 1", bie.Name.ToFormatedUTF8(), _page); Lua.GetReturnVal <int>(lua, 0); Professionbuddy.Debug("Searching AH for {0}", bie.Name); _queueTimer.Start(); } else if (_queueTimer.ElapsedMilliseconds <= 10000) { if (Lua.GetReturnVal <int>("if CanSendAuctionQuery('list') == 1 then return 1 else return 0 end ", 0) == 1) { _totalAuctions = Lua.GetReturnVal <int>("return GetNumAuctionItems('list')", 1); _queueTimer.Stop(); _queueTimer.Reset(); if (_totalAuctions > 0) { string lua = string.Format(BuyFromAHLuaFormat, _counter, bie.BuyAmount, bie.Id, MaxBuyout.TotalCopper, BidOnItem ? 1 : 0); _counter = Lua.GetReturnVal <int>(lua, 0); if (_counter == -1 || ++_page >= (int)Math.Ceiling((double)_totalAuctions / 50)) { done = true; } } else { done = true; } } } else { done = true; } if (done) { _queueTimer = new Stopwatch(); _totalAuctions = 0; _counter = 0; _page = 0; } return(done); }
private bool ScanAh(ref AuctionEntry ae) { bool scanned = false; if (!_queueTimer.IsRunning) { string lua = string.Format("QueryAuctionItems(\"{0}\" ,nil,nil,nil,nil,nil,{1}) return 1", ae.Name.ToFormatedUTF8(), _page); Lua.GetReturnVal <int>(lua, 0); Professionbuddy.Debug("Searching AH for {0}", ae.Name); _queueTimer.Start(); } else if (_queueTimer.ElapsedMilliseconds <= 10000) { using (new FrameLock()) { if ( Lua.GetReturnVal <int>("if CanSendAuctionQuery('list') == 1 then return 1 else return 0 end ", 0) == 1) { _queueTimer.Reset(); _totalAuctions = Lua.GetReturnVal <int>("return GetNumAuctionItems('list')", 1); string lua = string.Format(ScanAHFormatLua, ae.LowestBo, ae.MyAuctions, ae.Id, IgnoreStackSizeBelow, StackSize); List <string> retVals = Lua.GetReturnValues(lua); uint.TryParse(retVals[0], out ae.LowestBo); uint.TryParse(retVals[1], out ae.MyAuctions); if (++_page >= (int)Math.Ceiling((double)_totalAuctions / 50)) { scanned = true; } } } } else { scanned = true; } // reset to default values in preparations for next scan if (scanned) { Professionbuddy.Debug("lowest buyout {0}", ae.LowestBo); _queueTimer.Stop(); _queueTimer.Reset(); _totalAuctions = 0; _page = 0; } return(scanned); }
Dictionary <uint, int> BuildItemList() { Dictionary <uint, int> itemList = new Dictionary <uint, int>(); IEnumerable <WoWItem> tmpItemlist = from item in me.BagItems where !item.IsConjured && !item.IsSoulbound && !item.IsDisabled select item; if (UseCategory) { foreach (WoWItem item in tmpItemlist) { if (!Pb.ProtectedItems.Contains(item.Entry) && item.ItemInfo.ItemClass == Category && subCategoryCheck(item) && !itemList.ContainsKey(item.Entry)) { itemList.Add(item.Entry, Amount); } } } else { string[] entries = ItemID.Split(','); if (entries != null && entries.Length > 0) { foreach (var entry in entries) { uint temp = 0; uint.TryParse(entry.Trim(), out temp); itemList.Add(temp, Amount); } } else { Professionbuddy.Err("No ItemIDs are specified"); IsDone = true; } } Professionbuddy.Debug("List of items to deposit to bank"); foreach (var item in itemList) { Professionbuddy.Debug("Item:{0} Amount:{1}", item.Key, item.Value); } Professionbuddy.Debug("End of list"); return(itemList); }
string GetLocalName(uint id) { Professionbuddy.Debug("Queueing server for Item: {0}", id); return(TradeSkillFrame.GetItemCacheName(id)); }
protected override RunStatus Run(object context) { if (!IsDone) { if (Lua.GetReturnVal <int>("if AuctionFrame and AuctionFrame:IsVisible() then return 1 else return 0 end ", 0) == 0) { MoveToAh(); } else { if (ToScanItemList == null) { ToScanItemList = BuildScanItemList(); ToSellItemList = new List <AuctionEntry>(); } if (ToScanItemList.Count == 0 && ToSellItemList.Count == 0) { ToScanItemList = null; IsDone = true; return(RunStatus.Failure); } if (ToScanItemList.Count > 0) { AuctionEntry ae = ToScanItemList[0]; bool scanDone = ScanAh(ref ae); ToScanItemList[0] = ae; // update if (scanDone) { uint lowestBo = ae.LowestBo; if (lowestBo > MaxBuyout.TotalCopper) { ae.Buyout = MaxBuyout.TotalCopper; } else if (lowestBo < MinBuyout.TotalCopper) { ae.Buyout = MinBuyout.TotalCopper; } else { ae.Buyout = lowestBo - (uint)Math.Ceiling(((double)(lowestBo * UndercutPrecent) / 100d)); } ae.Bid = (uint)((double)(ae.Buyout * BidPrecent) / 100d); bool enoughItemsPosted = AmountType == AmountBasedType.Amount && ae.myAuctions >= Amount; bool tooLowBuyout = !PostIfBelowMinBuyout && lowestBo < MinBuyout.TotalCopper; Professionbuddy.Debug("PB: PostIfBelowMinBuyout:{0} ", PostIfBelowMinBuyout, MinBuyout.TotalCopper); Professionbuddy.Debug("PB: lowestBo:{0} MinBuyout.TotalCopper: {1}", lowestBo, MinBuyout.TotalCopper); Professionbuddy.Debug("PB: tooLowBuyout:{0} enoughItemsPosted: {1}", enoughItemsPosted, enoughItemsPosted); if (!enoughItemsPosted && !tooLowBuyout) { ToSellItemList.Add(ae); } else { Professionbuddy.Log("Skipping {0} since {1}", ae.Name, tooLowBuyout ? string.Format("lowest buyout:{0} is below MinBuyout:{1}", AuctionEntry.GoldString(lowestBo), MinBuyout) : string.Format("{0} items from me are already posted. Max amount is {1}", ae.myAuctions, Amount)); } ToScanItemList.RemoveAt(0); } if (ToScanItemList.Count == 0) { Professionbuddy.Debug("Finished scanning for items"); } } if (ToSellItemList.Count > 0) { if (SellOnAh(ToSellItemList[0])) { Professionbuddy.Log("Selling {0}", ToSellItemList[0]); ToSellItemList.RemoveAt(0); } } } return(RunStatus.Running); } return(RunStatus.Failure); }
const long GbankItemThrottle = 800; // 8 times per sec. protected override RunStatus Run(object context) { if (!IsDone) { if ((Bank == BankType.Guild && !IsGbankFrameVisible) || (Bank == BankType.Personal && !Util.IsBankFrameOpen)) { MoveToBanker(); } else { if (_itemsSW == null) { _itemsSW = new Stopwatch(); _itemsSW.Start(); } else if (_itemsSW.ElapsedMilliseconds < Util.WoWPing * 3) { return(RunStatus.Success); } if (_itemList == null) { _itemList = BuildItemList(); } // no bag space... if (_itemList.Count == 0) { IsDone = true; } else { uint itemID = _itemList.Keys.FirstOrDefault(); bool done; if (Bank == BankType.Personal) { done = PutItemInBank(itemID, _itemList[itemID]); } else { // throttle the amount of items being withdrawn from gbank per sec if (!_gbankItemThrottleSW.IsRunning) { _gbankItemThrottleSW.Start(); } if (_gbankItemThrottleSW.ElapsedMilliseconds < GbankItemThrottle) { return(RunStatus.Success); } _gbankItemThrottleSW.Reset(); _gbankItemThrottleSW.Start(); int ret = PutItemInGBank(itemID, _itemList[itemID], GuildTab); _itemList[itemID] = ret == -1 ? 0 : _itemList[itemID] - ret; done = _itemList[itemID] <= 0; } if (done) { Professionbuddy.Debug("Done Depositing Item:{0} to bank", itemID); _itemList.Remove(itemID); } _itemsSW.Reset(); _itemsSW.Start(); } } if (IsDone) { Professionbuddy.Log("Deposited Items:[{0}] to {1} Bank", ItemID, Bank); } else { return(RunStatus.Success); } } return(RunStatus.Failure); }
protected override RunStatus Run(object context) { if (!IsDone) { if ((Bank == BankType.Guild && !IsGbankFrameVisible) || (Bank == BankType.Personal && !Util.IsBankFrameOpen)) { MoveToBanker(); } else { if (_itemsSW == null) { _itemsSW = new Stopwatch(); _itemsSW.Start(); } else if (_itemsSW.ElapsedMilliseconds < Professionbuddy.Ping * 1.5) { return(RunStatus.Running); } if (ItemList == null) { ItemList = BuildItemList(); } // no bag space... if (ItemList.Count == 0) { IsDone = true; } else { KeyValuePair <uint, int> kv = ItemList.FirstOrDefault(); bool done = false; if (Bank == BankType.Personal) { done = PutItemInBank(kv.Key, kv.Value); } else { done = PutItemInGBank(kv.Key, kv.Value, GuildTab); } if (done) { Professionbuddy.Debug("Done Depositing Item:{0} to bank", kv.Key); ItemList.Remove(kv.Key); } _itemsSW.Reset(); _itemsSW.Start(); } } if (IsDone) { Professionbuddy.Log("Deposited Items:[{0}] to {1} Bank", ItemID, Bank); } else { return(RunStatus.Running); } } return(RunStatus.Failure); }
protected override RunStatus Run(object context) { if (!IsDone) { WoWPoint movetoPoint = _loc; if (MailFrame.Instance == null || !MailFrame.Instance.IsVisible) { if (AutoFindMailBox || movetoPoint == WoWPoint.Zero) { _mailbox = ObjectManager.GetObjectsOfType <WoWGameObject>().Where( o => o.SubType == WoWGameObjectType.Mailbox) .OrderBy(o => o.Distance).FirstOrDefault(); } else { _mailbox = ObjectManager.GetObjectsOfType <WoWGameObject>().Where( o => o.SubType == WoWGameObjectType.Mailbox && o.Location.Distance(_loc) < 10) .OrderBy(o => o.Distance).FirstOrDefault(); } if (_mailbox != null) { movetoPoint = WoWMathHelper.CalculatePointFrom(Me.Location, _mailbox.Location, 3); } if (movetoPoint == WoWPoint.Zero) { Professionbuddy.Err(Pb.Strings["Error_UnableToFindMailbox"]); return(RunStatus.Failure); } if (movetoPoint.Distance(ObjectManager.Me.Location) > 4.5) { Util.MoveTo(movetoPoint); } else if (_mailbox != null) { _mailbox.Interact(); } return(RunStatus.Success); } // Mail Frame is open.. // item split in proceess if (_itemSplitSW.IsRunning && _itemSplitSW.ElapsedMilliseconds <= 2000) { return(RunStatus.Success); } if (_itemList == null) { _itemList = BuildItemList(); } if (_itemList.Count == 0) { //Professionbuddy.Debug("Sending any remaining items already in SendMail item slots. Mail subject will be: {0} ",_mailSubject); Lua.DoString( "for i=1,ATTACHMENTS_MAX_SEND do if GetSendMailItem(i) ~= nil then SendMail (\"{0}\",\"{1}\",'') end end ", CharacterSettings.Instance.MailRecipient.ToFormatedUTF8(), _mailSubject != null ? _mailSubject.ToFormatedUTF8() : " "); //Professionbuddy.Debug("Done sending mail"); IsDone = true; return(RunStatus.Failure); } MailFrame.Instance.SwitchToSendMailTab(); uint itemID = _itemList.Keys.FirstOrDefault(); WoWItem item = Me.BagItems.FirstOrDefault(i => i.Entry == itemID); _mailSubject = item != null ? item.Name : " "; if (string.IsNullOrEmpty(_mailSubject)) { _mailSubject = " "; } Professionbuddy.Debug("MailItem: sending {0}", itemID); int ret = MailItem(itemID, _itemList[itemID]); // we need to wait for item split to finish if ret == 0 // format indexs are MailRecipient=0, Mail subject=1 string mailToLua = string.Format(MailItemsFormat, CharacterSettings.Instance.MailRecipient.ToFormatedUTF8(), _mailSubject.ToFormatedUTF8()); var mailItemsRet = Lua.GetReturnVal <int>(mailToLua, 0); if (ret == 0 || mailItemsRet == 1) { _itemSplitSW.Reset(); _itemSplitSW.Start(); return(RunStatus.Success); } _itemList[itemID] = ret < 0 ? 0 : _itemList[itemID] - ret; bool done = _itemList[itemID] <= 0; if (done) { _itemList.Remove(itemID); } if (IsDone) { Professionbuddy.Log("Done sending {0} via mail", UseCategory ? string.Format("Items that belong to category {0} and subcategory {1}", Category, SubCategory) : string.Format("Items that match Id of {0}", ItemID)); } else { return(RunStatus.Success); } } return(RunStatus.Failure); }
private string GetLocalName(uint id) { Professionbuddy.Debug("Queueing server for Item: {0}", id); return(Util.GetItemCacheName(id)); }
protected override RunStatus Run(object context) { if (!IsDone) { if (!IsRecipe) { CheckTradeskillList(); } if (Casted >= CalculatedRepeat) { if (ObjectManager.Me.IsCasting && ObjectManager.Me.CastingSpell.Id == Entry) { SpellManager.StopCasting(); } _spamControl.Stop(); _spamControl.Reset(); Lua.Events.DetachEvent("UNIT_SPELLCAST_SUCCEEDED", OnUnitSpellCastSucceeded); IsDone = true; return(RunStatus.Failure); } // can't make recipe so stop trying. if (IsRecipe && Recipe.CanRepeatNum2 <= 0) { Professionbuddy.Debug("{0} doesn't have enough material to craft.", SpellName); IsDone = true; return(RunStatus.Failure); } if (Me.IsCasting && Me.CastingSpellId != Entry) { SpellManager.StopCasting(); } // we should confirm the last recipe in list so we don't make an axtra if (!Me.IsFlying && Casted + 1 < CalculatedRepeat || (Casted + 1 == CalculatedRepeat && (Confimed || !_spamControl.IsRunning || (_spamControl.ElapsedMilliseconds >= (_recastTime + (_recastTime / 2)) + _waitTime && !ObjectManager.Me.IsCasting)))) { if (!_spamControl.IsRunning || _spamControl.ElapsedMilliseconds >= _recastTime || (!ObjectManager.Me.IsCasting && _spamControl.ElapsedMilliseconds >= _waitTime)) { if (ObjectManager.Me.IsMoving) { WoWMovement.MoveStop(); } if (!QueueIsRunning) { Lua.Events.AttachEvent("UNIT_SPELLCAST_SUCCEEDED", OnUnitSpellCastSucceeded); QueueIsRunning = true; TreeRoot.StatusText = string.Format("Casting: {0}", IsRecipe ? Recipe.Name : Entry.ToString(CultureInfo.InvariantCulture)); } WoWSpell spell = WoWSpell.FromId((int)Entry); if (spell == null) { Professionbuddy.Err("{0}: {1}", Pb.Strings["Error_UnableToFindSpellWithEntry"], Entry); return(RunStatus.Failure); } _recastTime = spell.CastTime; Professionbuddy.Debug("Casting {0}, recast :{1}", spell.Name, _recastTime); if (CastOnItem) { WoWItem item = TargetedItem; if (item != null) { spell.CastOnItem(item); } else { Professionbuddy.Err("{0}: {1}", Pb.Strings["Error_UnableToFindItemToCastOn"], IsRecipe ? Recipe.Name : Entry.ToString(CultureInfo.InvariantCulture)); IsDone = true; } } else { spell.Cast(); } _waitTime = StyxWoW.WoWClient.Latency * 2; Confimed = false; _spamControl.Reset(); _spamControl.Start(); } } if (!IsDone) { return(RunStatus.Success); } } return(RunStatus.Failure); }
protected override RunStatus Run(object context) { if (!IsDone) { if ((Bank == BankType.Guild && !IsGbankFrameVisible) || (Bank == BankType.Personal && !Util.IsBankFrameOpen)) { MoveToBanker(); } else { if (_itemsSW == null) { _itemsSW = new Stopwatch(); _itemsSW.Start(); } else if (_itemsSW.ElapsedMilliseconds < Util.WoWPing * 3) { return(RunStatus.Running); } if (ItemList == null) { ItemList = BuildItemList(); } // no bag space... if (ItemList.Count == 0) { IsDone = true; } else { KeyValuePair <uint, int> kv = ItemList.FirstOrDefault(); bool done = false; if (Bank == BankType.Personal) { done = PutItemInBank(kv.Key, kv.Value); } else { // throttle the amount of items being withdrawn from gbank per sec if (!_gbankItemThrottleSW.IsRunning) { _gbankItemThrottleSW.Start(); } if (_gbankItemThrottleSW.ElapsedMilliseconds < _gbankItemThrottle) { return(RunStatus.Success); } else { _gbankItemThrottleSW.Reset(); _gbankItemThrottleSW.Start(); } int ret = PutItemInGBank(kv.Key, kv.Value, GuildTab); if (ret == -1 || _numOfItemsDepositedInGB + ret >= Amount) { done = true; } else { _numOfItemsDepositedInGB += ret; done = false; } } if (done) { Professionbuddy.Debug("Done Depositing Item:{0} to bank", kv.Key); ItemList.Remove(kv.Key); } _itemsSW.Reset(); _itemsSW.Start(); } } if (IsDone) { Professionbuddy.Log("Deposited Items:[{0}] to {1} Bank", ItemID, Bank); } else { return(RunStatus.Running); } } return(RunStatus.Failure); }