void Start() { spawnPointsList = spawnPoints.GetComponentsInChildren <Transform>(); helicopter = FindObjectOfType <Helicopter>(); clearArea = GetComponentInChildren <ClearArea>(); ReSpawn(); }
public static async Task <bool> Execute() { try { if (!ZetaDia.IsInGame) { return(false); } if (await ClearArea.Execute()) { Core.Logger.Debug("Clearing"); return(false); } CheckForDBVendoringBug(); if (DateTime.UtcNow < DontAttemptTownRunUntil) { IsVendoring = false; return(false); } // Fix for Campaign quest start of ACT1 if (ZetaDia.CurrentQuest.QuestSnoId == 87700) { return(false); } if (Core.CastStatus.StoneOfRecall.LastResult == CastResult.Casting) { Core.Logger.Verbose(LogCategory.GlobalHandler, "Casting"); return(true); } if (!ShouldStartTownRun()) { IsVendoring = false; return(false); } IsWantingTownRun = true; Core.Logger.Debug("Town run started"); if (ZetaDia.Globals.IsLoadingWorld) { return(true); } if (!ZetaDia.IsInTown) { if (ZetaDia.Me.IsInCombat && !ClearArea.IsClearing && ZetaDia.Actors.GetActorsOfType <DiaUnit>().Any(u => u?.CommonData != null && u.CommonData.IsValid && u.IsAlive && u.IsHostile && u.Distance < 16f)) { ClearArea.Start(); } await GoToTown(); if (!ZetaDia.IsInTown) { if (Core.CastStatus.StoneOfRecall.LastResult == CastResult.Failed) { Core.Logger.Debug("Setting Town Run Cooldown because of cast failure"); DontAttemptTownRunUntil = DateTime.UtcNow.AddSeconds(5); } return(true); } } Core.Logger.Verbose($"Starting Townrun"); IsInTownVendoring = true; while (DateTime.UtcNow.Subtract(ChangeEvents.WorldId.LastChanged).TotalMilliseconds < 2000 || ZetaDia.Globals.IsLoadingWorld || ZetaDia.Globals.WorldSnoId <= 0) { await Coroutine.Yield(); } await Coroutine.Wait(8000, () => Core.Actors.Inventory.Any()); await Coroutine.Yield(); Core.Actors.Update(); Core.Player.Update(); await Coroutine.Sleep(1000); Core.Logger.Debug("Started Town Run Loop"); var checkCycles = 2; while (!Core.Player.IsInventoryLockedForGreaterRift) { Core.Inventory.Backpack.ForEach(i => Core.Logger.Debug($"Backpack Item: {i.Name} ({i.ActorSnoId} / {i.InternalName}) RawItemType={i.RawItemType} TrinityItemType={i.TrinityItemType}")); await Coroutine.Yield(); GameUI.CloseVendorWindow(); await IdentifyItems.Execute(); if (!ZetaDia.IsInGame) { StartedOutOfTown = false; IsWantingTownRun = false; IsInTownVendoring = false; IsVendoring = false; return(false); } if (!await ExtractLegendaryPowers.Execute()) { continue; } if (!await Gamble.Execute()) { continue; } if (!await CubeRaresToLegendary.Execute()) { continue; } if (!await CubeItemsToMaterials.Execute()) { continue; } if (await Any( DropItems.Execute, () => StashItems.Execute(true), SellItems.Execute, SalvageItems.Execute)) { continue; } checkCycles--; if (checkCycles == 0) { break; } } await StashItems.Execute(); await RepairItems.Execute(); Core.Logger.Log("Finished Town Run woo!"); DontAttemptTownRunUntil = DateTime.UtcNow + TimeSpan.FromSeconds(15); if (StartedOutOfTown) { StartedOutOfTown = false; await TakeReturnPortal(); } } finally { IsWantingTownRun = false; IsInTownVendoring = false; IsVendoring = false; } return(false); }
void Start() { spawnPoints = GameObject.Find("PlayerSpawnPoints").GetComponentsInChildren <Transform>(); innerVoice = GetComponentInChildren <InnerVoice>(); clearArea = GetComponentInChildren <ClearArea>(); }
void Start() { spawnPoints = GameObject.Find("PlayerSpawnPoints").GetComponentsInChildren<Transform>(); innerVoice = GetComponentInChildren<InnerVoice>(); clearArea = GetComponentInChildren<ClearArea>(); }
// Use this for initialization void Start() { _spawnPoints = SpawnPoints.GetComponentsInChildren <Transform>(); _clearArea = GetComponent <ClearArea>(); SpawnAgain = true; }