// // SceneManager.cs // // Copyright (c) František Boháček. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Reloaded.Memory.Sources; namespace NosSmooth.LocalBinding.Structs; /// /// Represents nostale scene manager struct. /// public class SceneManager { private readonly IMemory _memory; private readonly IntPtr _sceneManager; /// /// Initializes a new instance of the class. /// /// The memory. /// The pointer to the scene manager. public SceneManager(IMemory memory, IntPtr sceneManager) { _memory = memory; _sceneManager = sceneManager; } /// /// Gets the player list. /// public MapObjBaseList PlayerList => new MapObjBaseList(_memory, ReadPtr(_sceneManager + 0xC)); /// /// Gets the monster list. /// public MapObjBaseList MonsterList => new MapObjBaseList(_memory, ReadPtr(_sceneManager + 0x10)); /// /// Gets the npc list. /// public MapObjBaseList NpcList => new MapObjBaseList(_memory, ReadPtr(_sceneManager + 0x14)); /// /// Gets the item list. /// public MapObjBaseList ItemList => new MapObjBaseList(_memory, ReadPtr(_sceneManager + 0x18)); /// /// Gets the entity that is currently being followed by the player. /// public MapBaseObj? FollowEntity { get { var ptr = ReadPtr(_sceneManager + 0x48); if (ptr == IntPtr.Zero) { return null; } return new MapBaseObj(_memory, ptr); } } private IntPtr ReadPtr(IntPtr ptr) { _memory.Read(ptr, out IntPtr read); return read; } }