Skip to content

A fork of the native-farsight-module memory reader for League of Legends ported to Python.

License

Notifications You must be signed in to change notification settings

FeldrinH/python-farsight-module

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔭 Farsight 🔭

A simple passive memory reader for Python which aims to retrieve information about League of Legends spectator games which the API does not provide. Ported to Python from https://github.com/floh22/native-farsight-module.

Farsight uses Memory Reading to get information that the Riot API does not expose. Riot's policy in the past has been to allow passive memory reading, which is exactly what this program does, but this may change at any time. Use Farsight at your own risk. Anti Cheat does not ban for programs used during spectate, but it does however run while in a live game. Having Farsight open during a live (non-spectate) game may lead to account bans incase checks to stop it from running fail for some reason. None have been reported so far and League Broadcast has used similar methods for around two years now.


Features

Each memory snapshot produces game state information the moment the snapshot was taken. Each snapshot includes the following:

  1. Game time
  2. Next dragon type to spawn
  3. List of Champions
  4. List of Turrets
  5. List of inhibitors
  6. Misc game objects

Each game object currently has the following data:

  1. Health/Max Health
  2. Mana/Max Mana
  3. Position
  4. Team
  5. Unit Id
  6. Display Name
  7. Current Gold / Total Gold
  8. Level / Experience

(7 and 8 player only)

If you need any extra unit information, create an issue in the form of a feature request. Feature requests should be made to the upstream repo.

Not possible: Aggregate player stats: (Kills, Deaths, Assists, CS, Vision Score)


Installation

Run pip install git+https://github.com/FeldrinH/python-farsight-module.git@main to install latest version.

Note: Installation requires Visual Studio Build Tools 2017 or newer with the C++ desktop development workload.

The library is tested on Python 3.10 and 3.11. Python 3.9 and 3.12+ should be supported, but are untested.


Offsets

Roughly every two weeks League of Legends updates and its memory layout changes slightly, so offsets must be updated.

This Python module uses offsets from https://github.com/floh22/native-farsight-module. See the README in that repository for more info.


Methods

farsight.connect_to_league()

Connects to the League of Legends client. Throws an exception if connecting failed (usually this is because League of Legends is not running).

On first call will find and download memory offsets from https://github.com/floh22/native-farsight-module/tree/main/offsets and champion data from https://raw.communitydragon.org.

Note: Trying to call this while already connected will print a warning and do nothing.

farsight.disconnect_from_league()

Disconnects from the League of Legends client. Generally this should never throw an exception.

Note: Trying to call this while already disconnected will print a warning and do nothing.

farsight.is_ready()

Returns true if you are connected to the League of Legends client and all necessary data has been downloaded.

Note: Being connected does not necessarily mean that the League of Legends client is running. If the League client is closed after connecting then is_ready() will return true until the next call to make_snapshot(), which will automatically disconnect the client if reading fails.

farsight.make_snapshot()

Reads a snapshot of data from the memory of the connected League client and returns it as a dictionary. The full set of returned fields can be seen by printing out the dictionary. The dictionary contains no special values or custom classes and can therefore be safely encoded as JSON.

Throws an exception if reading the memory fails (usually this means the League client has been closed). If reading the memory fails the League client will be automatically disconnected.


Example

Example usage is provided in the example folder of this repo. It currently contains a very basic console logger which connects to LoL and prints snapshots of the read data to the console.


License

Distributed under the MIT License. See LICENSE for more information.

Memory reading logic by Lars Eble, Python bindings by FeldrinH.
This is a standalone project. Riot Games does not endorse or sponsor this project.

About

A fork of the native-farsight-module memory reader for League of Legends ported to Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 86.3%
  • Python 12.8%
  • C 0.9%