예제 #1
0
        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;
        }
예제 #2
0
 public WaypointData(int number, SNOLevelArea levelAreaSnoId, SNOWorld worldSnoId, string name)
 {
     Name           = name;
     Number         = number;
     WorldSnoId     = worldSnoId;
     LevelAreaSnoId = levelAreaSnoId;
 }
예제 #3
0
 public WaitCoroutine(SNOQuest questId, SNOWorld worldSnoId, int milliSeconds)
 {
     _worldId  = worldSnoId;
     _questId  = questId;
     _waitTime = TimeSpan.FromMilliseconds(milliSeconds);
     Id        = Guid.NewGuid();
 }
예제 #4
0
 public MoveThroughDeathGates(SNOQuest questId, SNOWorld worldId, int numberOfGatesToUse = -1)
 {
     _questId    = questId;
     _worldId    = worldId;
     _gatesToUse = numberOfGatesToUse;
     Id          = Guid.NewGuid();
 }
예제 #5
0
 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();
 }
예제 #6
0
 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();
 }
예제 #7
0
 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;
     }
 }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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.");
        }
예제 #12
0
 public static bool IsEntryPortal(SNOWorld currentWorldId, int markerNameHash)
 {
     return(EntryPortalHashNames.ContainsKey(currentWorldId) && EntryPortalHashNames[currentWorldId] == markerNameHash);
 }
예제 #13
0
 public static WaypointData GetWaypointByWorldId(SNOWorld worldId)
 {
     return(Waypoints.FirstOrDefault(o => o.Value.WorldSnoId == worldId).Value);
 }