NosSmooth.Injector 2.0.0

dotnet add package NosSmooth.Injector --version 2.0.0                
NuGet\Install-Package NosSmooth.Injector -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NosSmooth.Injector" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NosSmooth.Injector --version 2.0.0                
#r "nuget: NosSmooth.Injector, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NosSmooth.Injector as a Cake Addin
#addin nuget:?package=NosSmooth.Injector&version=2.0.0

// Install NosSmooth.Injector as a Cake Tool
#tool nuget:?package=NosSmooth.Injector&version=2.0.0                

NosSmooth.Local

NosSmooth is a multi-platform library for NosTale packets, data, game state and such. See the main repository at NosSmooth. NosSmooth.Local contains libraries for the regular NosTale client such as memory mapping and NosSmooth client implementation for handling the packets. NosSmooth.Local is Windows-only (at least not tested on Linux as I was not able to get NosTale running on Linux correctly)

NosSmooth.Local contains bindings to parts of game memory and some functions that may be called or hooked. It contains a client using these bindings to receive and send packets, to obtain received and sent packets. Injector for injecting NosSmooth into the process is included as well.

See samples in the src/Samples folder.

Features

Bindings (hooks, memory mapping)

For accessing memory and functions, NosSmooth.LocalBinding can be used. LocalBinding uses Reloaded.Memory and Reloaded.Hooks. If a function is hooked, it may be canceled.

Reading NosTale memory may be done in an external process. NosBrowserManager may be used. It first have to be initialized by calling NosBrowserManager.Initialize(). Don't forget to check the result to know when something was not found in the memory. If something cannot be found, other things will still be initialized so if you don't use the part that wasn't loaded, your program may still work.

To bind inside of a NosTale process and use or hook functions, use NosBindingManager. Same as NosBrowserManager, initialization has to be called. NosBindingManager.Initialize. It initializes NosBrowserManager and IHookManager.

To obtain found functions and register event handlers for hooked functions, use IHookManager.

Configuration

For configuring patterns and offsets of objects, options for each object are exposed, ie. PlayerManagerOptions, PetManagerOptions.

If you want to configure what functions should be hooked and patterns to find them in memory, use HookManagerOptions. There is a builder for these options added. When using dependency injection, ConfigureHooks on IServiceCollection can be used, see:

.ConfigureHooks(b => b
  .HookFocus(focus => focus
      .MemoryPattern("73 00 00 00 55 8b ec b9 05 00 00 00")
      .Offset(4)))
Calling NosTale functions

Classes with hooks can be used for calling the functions. It is important to use NosTale functions from NosTale thread. If you don't do that, you may run into fatal errors, exceptions and the game may crash. For calling functions on NosTale thread, NosThreadSynchronizer may be used.

It is a class located in LocalBinding project. For it to work, PeriodicHook has to be hooked. Periodic hook can be any function that is called periodically from NosTale thread. (in case the current pattern did not work and new periodic function had to be retrieved)

Client

To use all features of NosSmooth such as packet responders, obtaining game state etc., you will need an instance of INostaleClient. NosSmooth.LocalClient implements INostaleClient using NosSmooth.LocalBinding.

The client supports receiving and sending packets as well as implementing walk and attack commands. The attack command focues current entity. Support for cancelling commands by using user operation may be added by hooking all functions. Cancelling user action is possible as well when the correct arguments are passed to the command itself.

Injector

NosSmooth uses .NET 7 and as NosTale is 32-bit process, Native dll cannot be created for .NET 7 as far as I know. That means any library created in .NET 5+ will have to be injected using a custom library that runs the .net runtime. That is why NosSmooth.Inject has been created. It is a c++ library that can run .NET runtime and call a method inside .NET code.

If you want to inject NosSmooth into NosTale, see https://github.com/Rutherther/NosSmooth.Local/wiki/How-to-inject-NosSmooth-to-NosTale.

Injecting multiple NosSmooth instances into NosTale

If you are going to hook any functions (such as packet recv, send for working with INostaleClient, these are hooked by default), another program that would try to hook these methods probably won't work. That is why you won't be able to use programs by other people when using NosSmooth.Local.

For using other program with NosSmooth, you may use packet capture instead of injection. See NosSmooth.Pcap. Pcap has its limitations, you won't be able to send or receive packets. Use that if you need to observe only. There are other options. If the program you want to use does not have to be injected, but can be used by communicating with NosTale using some kind of communication means such as tcp or named pipes, you may implement protocol of that application using NosSmooth. I have already implemented some means of communication in NosSmooth.Comms.

Using multiple instances of NosSmooth is possible by using NosSmooth.Extensions.SharedBinding with some restrictions. SharedBinding wraps NosSmooth hooks and gives the hooks out to any instance that connects. When using dependency injection, call ShareNosSmooth() on service collection. That will share the hooks, NosTale data, packet types and NosBrowserManager. Every NosSmooth instance has to use sharing in order to make sharing work correctly.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NosSmooth.Injector:

Package Downloads
NosSmooth.Comms.Local

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 310 2/24/2023
1.1.2 267 2/15/2023
1.1.1 318 2/14/2023
1.1.0 305 2/5/2023
1.0.3 430 1/31/2023
1.0.2 269 1/31/2023
1.0.1 285 1/31/2023
1.0.0 320 1/21/2023

Inject with possibility to return an integer and pass in arbitrary arguments.