~ruther/NosSmooth

ref: ae8291c08efb23c06d599143c666b2d632d9c3d1 NosSmooth/Local/NosSmooth.LocalBinding/Structs/SceneManager.cs -rw-r--r-- 1.6 KiB
ae8291c0 — František Boháček feat(localclient): cancel walk command handling if nostale returns false on walk 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
//  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;

/// <summary>
/// Represents nostale scene manager struct.
/// </summary>
public class SceneManager
{
    private readonly IMemory _memory;
    private readonly IntPtr _sceneManager;

    /// <summary>
    /// Initializes a new instance of the <see cref="SceneManager"/> class.
    /// </summary>
    /// <param name="memory">The memory.</param>
    /// <param name="sceneManager">The pointer to the scene manager.</param>
    public SceneManager(IMemory memory, IntPtr sceneManager)
    {
        _memory = memory;
        _sceneManager = sceneManager;
    }

    /// <summary>
    /// Gets the player list.
    /// </summary>
    public MapObjBaseList PlayerList => new MapObjBaseList(_memory, ReadPtr(_sceneManager + 0xC));

    /// <summary>
    /// Gets the monster list.
    /// </summary>
    public MapObjBaseList MonsterList => new MapObjBaseList(_memory, ReadPtr(_sceneManager + 0x10));

    /// <summary>
    /// Gets the npc list.
    /// </summary>
    public MapObjBaseList NpcList => new MapObjBaseList(_memory, ReadPtr(_sceneManager + 0x14));

    /// <summary>
    /// Gets the item list.
    /// </summary>
    public MapObjBaseList ItemList => new MapObjBaseList(_memory, ReadPtr(_sceneManager + 0x18));

    private IntPtr ReadPtr(IntPtr ptr)
    {
        _memory.Read(ptr, out IntPtr read);
        return read;
    }
}
Do not follow this link