public static RunStatus StashTransfer() { if (CurrentStashObject == null) { //Find the stash object ZetaDia.Actors.Update(); var objs = ZetaDia.Actors.GetActorsOfType <GizmoPlayerSharedStash>(true, true); if (objs.Any()) { CurrentStashObject = objs.First(); } else { Logger.DBLog.InfoFormat("Failed to find stash.. Moving To Stash Vector"); Navigator.MoveTo(StashV3, "Stash"); } } else if (!UIElements.StashWindow.IsVisible) { if (CurrentStashObject.Distance > 7.5f) { if (!FunkyGame.Hero.IsMoving) { if (CurrentStashObject.Distance > 50f) { ZetaDia.Me.UsePower(SNOPower.Walk, CurrentStashObject.Position, ZetaDia.Me.WorldDynamicId); } else { //Wait until we are not moving to send click again.. if (FunkyGame.Hero.IsMoving) { return(RunStatus.Running); } ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, CurrentStashObject.Position, ZetaDia.Me.WorldDynamicId, CurrentStashObject.ACDGuid); } } } else { CurrentStashObject.Interact(); } } else { if (SortedStashItems.Count == 0) { int itemSlotsFilled = 0; var sortedItems = ZetaDia.Me.Inventory.StashItems.Where(item => !ItemManager.Current.ItemIsProtected(item)).OrderBy(item => !item.IsTwoSquareItem).ThenByDescending(item => item.InventoryRow).ThenByDescending(item => item.InventoryColumn); foreach (var item in sortedItems) { SortedStashItems.Enqueue(item); itemSlotsFilled += item.IsTwoSquareItem ? 2 : 1; if (itemSlotsFilled > 59) { break; } } } else { if (ZetaDia.Me.Inventory.NumFreeBackpackSlots > 1) { if (DateTime.Now.Subtract(LastActionTaken).TotalMilliseconds > RandomWaitTimeMilliseconds) { // ACDItem currentItem=SortedStashItems[0]; ZetaDia.Me.Inventory.QuickWithdraw(SortedStashItems.Dequeue()); LastActionTaken = DateTime.Now; RandomizeWaitTime(); } } else { CurrentStashObject = null; SortedStashItems.Clear(); LastActionTaken = DateTime.Today; OutOfGame.TransferedGear = true; //Delete settings string sFunkyCharacterFolder = Path.Combine(FolderPaths.DemonBuddyPath, "Settings", "FunkyBot", FunkyGame.CurrentAccountName); if (Directory.Exists(sFunkyCharacterFolder)) { string sFunkyCharacterConfigFile = Path.Combine(sFunkyCharacterFolder, FunkyGame.CurrentHeroName + ".cfg"); if (File.Exists(sFunkyCharacterConfigFile)) { File.Delete(sFunkyCharacterConfigFile); } } OutOfGame.NewCharacterName = null; ZetaDia.Service.Party.LeaveGame(true); return(RunStatus.Running); } } } return(RunStatus.Running); }
public static RunStatus StashTransfer() { if (CurrentStashObject == null) { //Find the stash object ZetaDia.Actors.Update(); var objs = ZetaDia.Actors.GetActorsOfType<GizmoPlayerSharedStash>(true, true); if (objs.Any()) { CurrentStashObject = objs.First(); } else { Logger.DBLog.InfoFormat("Failed to find stash.. Moving To Stash Vector"); Navigator.MoveTo(StashV3, "Stash"); } } else if (!UIElements.StashWindow.IsVisible) { if (CurrentStashObject.Distance > 7.5f) { if (!FunkyGame.Hero.IsMoving) { if (CurrentStashObject.Distance > 50f) ZetaDia.Me.UsePower(SNOPower.Walk, CurrentStashObject.Position, ZetaDia.Me.WorldDynamicId); else { //Wait until we are not moving to send click again.. if (FunkyGame.Hero.IsMoving) return RunStatus.Running; ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, CurrentStashObject.Position, ZetaDia.Me.WorldDynamicId, CurrentStashObject.ACDGuid); } } } else CurrentStashObject.Interact(); } else { if (SortedStashItems.Count == 0) { int itemSlotsFilled = 0; var sortedItems = ZetaDia.Me.Inventory.StashItems.Where(item => !ItemManager.Current.ItemIsProtected(item)).OrderBy(item => !item.IsTwoSquareItem).ThenByDescending(item => item.InventoryRow).ThenByDescending(item => item.InventoryColumn); foreach (var item in sortedItems) { SortedStashItems.Enqueue(item); itemSlotsFilled += item.IsTwoSquareItem ? 2 : 1; if (itemSlotsFilled > 59) break; } } else { if (ZetaDia.Me.Inventory.NumFreeBackpackSlots > 1) { if (DateTime.Now.Subtract(LastActionTaken).TotalMilliseconds > RandomWaitTimeMilliseconds) { // ACDItem currentItem=SortedStashItems[0]; ZetaDia.Me.Inventory.QuickWithdraw(SortedStashItems.Dequeue()); LastActionTaken = DateTime.Now; RandomizeWaitTime(); } } else { CurrentStashObject = null; SortedStashItems.Clear(); LastActionTaken = DateTime.Today; OutOfGame.TransferedGear = true; //Delete settings string sFunkyCharacterFolder = Path.Combine(FolderPaths.DemonBuddyPath, "Settings", "FunkyBot", FunkyGame.CurrentAccountName); if (Directory.Exists(sFunkyCharacterFolder)) { string sFunkyCharacterConfigFile = Path.Combine(sFunkyCharacterFolder, FunkyGame.CurrentHeroName + ".cfg"); if (File.Exists(sFunkyCharacterConfigFile)) File.Delete(sFunkyCharacterConfigFile); } OutOfGame.NewCharacterName = null; ZetaDia.Service.Party.LeaveGame(true); return RunStatus.Running; } } } return RunStatus.Running; }