public void Update() { var currentFrame = ZetaDia.Memory.Executor.FrameCount; if (!ZetaDia.IsInGame) { return; } var gameId = ZetaDia.Service.CurrentGameId; if (_gameId != gameId) { s_logger.Debug($"[{nameof(Update)}] Game Change Detected"); ZetaDia.Actors.Update(); _gameId = gameId; return; } if (ZetaDia.Actors.Me == null || !ZetaDia.Actors.Me.IsFullyValid()) { ZetaDia.Actors.Update(); } ActivePlayerRActorId = ZetaDia.ActivePlayerRActorId; ActivePlayerPosition = ZetaDia.Me.Position; UpdateRActors(); UpdateInventory(); LastUpdatedFrame = currentFrame; LastWorldSnoId = ZetaDia.Globals.WorldSnoId; }
public WaypointData(int number, SNOLevelArea levelAreaSnoId, SNOWorld worldSnoId, string name) { Name = name; Number = number; WorldSnoId = worldSnoId; LevelAreaSnoId = levelAreaSnoId; }
public WaitCoroutine(SNOQuest questId, SNOWorld worldSnoId, int milliSeconds) { _worldId = worldSnoId; _questId = questId; _waitTime = TimeSpan.FromMilliseconds(milliSeconds); Id = Guid.NewGuid(); }
public MoveThroughDeathGates(SNOQuest questId, SNOWorld worldId, int numberOfGatesToUse = -1) { _questId = questId; _worldId = worldId; _gatesToUse = numberOfGatesToUse; Id = Guid.NewGuid(); }
public MoveToSceneCoroutine(SNOQuest questId, SNOWorld worldId, string sceneName, bool zergSafe = false, bool explore = true) { _questId = questId; _worldId = worldId; SceneName = sceneName; _zergEnabled = zergSafe; _explore = explore; Id = Guid.NewGuid(); }
public MoveToSceneCoroutine(SNOQuest questId, SNOWorld worldId, int sceneSnoId, bool zergSafe = false, bool explore = true) { _questId = questId; _worldId = worldId; SceneName = ZetaDia.SNO.LookupSNOName(SNOGroup.Scene, sceneSnoId); _zergEnabled = zergSafe; _explore = explore; Id = Guid.NewGuid(); }
public static void Start() { if (!IsClearing) { Core.Logger.Log("Started Clearing Area"); IsClearing = true; TrinityTownRun.IsVendoring = false; Combat.TrinityCombat.CombatMode = CombatMode.KillAll; StartWorld = ZetaDia.Globals.WorldSnoId; StartPosition = ZetaDia.Me.Position; } }
public SceneData CreateSceneData(IEnumerable <WorldScene> addedScenes, SNOWorld worldId) { var scenes = addedScenes.Select(scene => new SceneDataEntry { SceneHash = scene.HashName, ExplorationNodes = scene.Nodes, }).Cast <ISceneDataEntry>().ToList(); var sceneData = new SceneData { WorldDynamicId = worldId, Scenes = scenes }; return(sceneData); }
public static ExplorationGrid GetWorldGrid(SNOWorld worldDynamicId) { var worldId = ZetaDia.Globals.WorldId; if (_lastGrid?.Value?.WorldDynamicId == worldId) { var cur = _currentGrid; _currentGrid = _lastGrid; _lastGrid = cur; } if (_currentGrid?.Value == null || worldId != _currentGrid.Value.WorldDynamicId) { _lastGrid = _currentGrid; _currentGrid = new Lazy <ExplorationGrid>(() => new ExplorationGrid()); } return(_currentGrid.Value); }
public static async Task <bool> UsePortal(SNOActor actorSNO, SNOWorld sourceWorldDynamicId) { if (_usePortalCoroutine == null || _usePortalActorSNO != actorSNO || _usePortalSourceWorldDynamicId != sourceWorldDynamicId) { _usePortalCoroutine = new UsePortalCoroutine(actorSNO, sourceWorldDynamicId); _usePortalActorSNO = actorSNO; _usePortalSourceWorldDynamicId = sourceWorldDynamicId; } if (!await _usePortalCoroutine.GetCoroutine()) { return(false); } _usePortalCoroutine = null; return(true); }
public void Update() { var currentWorldId = ZetaDia.Globals.WorldId; if (currentWorldId <= 0) { return; } if (_currentWorld != currentWorldId) { if (!ZetaDia.IsInGame) { s_logger.Debug($"[{nameof(Update)}] Left Game..."); Reset(); return; } if (ZetaDia.Globals.IsLoadingWorld) { s_logger.Debug($"[{nameof(Update)}] World loading..."); return; } s_logger.Information($"[{nameof(Update)}] World has changed from {_currentWorld} to {currentWorldId}."); _currentWorld = currentWorldId; Reset(); } var addedScenes = new List <WorldScene>(); List <Scene> newScenes; try { newScenes = ZetaDia.Scenes .Where(s => s.IsAlmostValid() && !CurrentWorldSceneIds.Contains(s.GetSceneNameString())).ToList(); } catch (NullReferenceException) { return; } catch (PartialReadWriteException) { return; } SNOWorld worldId = 0; foreach (var scene in newScenes) { try { if (!scene.IsAlmostValid()) { continue; } var sceneHashName = scene.GetSceneNameString(); worldId = scene.Mesh.WorldId; var subScene = scene.Mesh.SubScene; if (scene.IsAlmostValid() && scene.Mesh.ParentSceneId <= 0 && worldId == currentWorldId) { if (scene.Mesh.Zone.GridSquares.Length <= 1 && (subScene != null && !subScene.HasGridSquares())) { continue; } var adventurerScene = new WorldScene(scene, ExplorationData.ExplorationNodeBoxSize, ExplorationData.ExplorationNodeBoxTolerance); if (adventurerScene.Cells.Count > 0) { CurrentWorldScenes.Add(adventurerScene); addedScenes.Add(adventurerScene); } } CurrentWorldSceneIds.Add(sceneHashName); } catch (NullReferenceException) { } } if (addedScenes.Count <= 0) { return; } s_logger.Information($"[{nameof(Update)}] Found {addedScenes.Count} new scenes."); var sceneData = CreateSceneData(addedScenes, worldId); foreach (var grid in GridStore.GetCurrentGrids()) { grid.Update(sceneData); } if (CurrentScene != null) { foreach (var scene in CurrentWorldScenes.Where(s => !s.HasPlayerConnection)) { if (scene == CurrentScene || CurrentScene.IsConnected(scene)) { scene.HasPlayerConnection = true; } } } ScenesAdded?.Invoke(addedScenes); s_logger.Information($"[{nameof(Update)}] Updates Finished."); }
public static bool IsEntryPortal(SNOWorld currentWorldId, int markerNameHash) { return(EntryPortalHashNames.ContainsKey(currentWorldId) && EntryPortalHashNames[currentWorldId] == markerNameHash); }
public static WaypointData GetWaypointByWorldId(SNOWorld worldId) { return(Waypoints.FirstOrDefault(o => o.Value.WorldSnoId == worldId).Value); }