|
| 1 | +# TibiaAPI |
| 2 | +TibiaAPI is an open-source, cross-platform proxy written in C#. You will need to install .NET Core 3.1 to take full advantage of the code in this repository. |
| 3 | + |
| 4 | +This library serves two main purposes: |
| 5 | +1. Keeping track of protocol changes. |
| 6 | +1. Serving as a means to help and advance Open-Tibia servers (via abilities like map tracking). |
| 7 | + |
| 8 | +TibiaAPI can be used on any platform that supports .NET Standard 2.0. |
| 9 | +That means, by utilizing .NET Core, TibiaAPI can be used on Windows, Linux, and macOS. |
| 10 | +Because of BattlEye, Windows support is limited to official servers not protected by BattlEye (Zuna and Zunera). |
| 11 | +However, currently, TibiaAPI can be used with ANY official server on Linux and macOS. (TibiaAPI is compatible with Open-Tibia servers.) |
| 12 | +Note that because this library is now open-source, and publicly known, it's quite possible that CipSoft/BattlEye will eventually block its use on official BattlEye-protected servers on Linux and macOS. |
| 13 | +I also do NOT recommend using this library with your main account(s) when using it on official servers (always use throwaway accounts) as the risk of banishment/deletion is now possible because of it being open-source. |
| 14 | + |
| 15 | +## Apps |
| 16 | +There are, currently, four official, command-line apps included: `Record`, `Redact`, `Extract`, and `Watch`. |
| 17 | +All of these apps target .NET Core 3.1 so that they can be used cross-platform. |
| 18 | +These apps (including TibiaAPI itself) can be built/run using `dotnet` on the command-line, or with Visual Studio on Windows and macOS. |
| 19 | + |
| 20 | +### Record |
| 21 | +The `Record` app can be used to record your gaming session. |
| 22 | +The recorded session file includes the client version, both client and server packets, and timestamps for each packet. |
| 23 | +The client version is so that the correct .dat file can be loaded, and the timestamps are, mostly, for the `Watch` app. |
| 24 | +Recordings are saved in the following format (UTC time): Day_Month_Year__Hour_Minute_Second.oxr |
| 25 | + |
| 26 | +Unlike `SharpMapTracker`, the Record app only records your session and doesn't create an OTBM file at the same time (you can use the `Extract app` to do that). |
| 27 | +This has two advantages: |
| 28 | +1. You don't get any unncessary latency overhead. |
| 29 | +1. You can reuse your recordings if you want/need to get more data without having to log back in to the game. |
| 30 | + |
| 31 | +By default, the `Record` app listens on port 7171 on your localhost, so all you need to do is modify the `loginWebService` of your client to point to `http://127.0.0.1:7171/`, and change the RSA key to the Open-Tibia public key. |
| 32 | +You can override the listening port by passing `-p/--port` as a command-line paramater. |
| 33 | +For example, `-p=1234`. |
| 34 | + |
| 35 | +By default, the `Record` app will attempt to login to CipSoft's official loginWebService. |
| 36 | +You can override this for use with Open-Tibia servers back passing `-l/--login`. |
| 37 | +For example, `--login=https://my-ot-server.com/login.php`. |
| 38 | + |
| 39 | +By default, the `Record` app will attempt to locate your Tibia package directory based on the default installation location for your operating system. |
| 40 | +This is needed to get the client version and load the .dat file. |
| 41 | +You can override this by passing `-t/--tibiadirectory`. |
| 42 | +For example. `-t=C:\Tibia\packages\Tibia\`. |
| 43 | +Note that if you override this directory you need to target the package directory, not the main directory. |
| 44 | +The package directory includes the `package.json` file and `assets` directory. |
| 45 | + |
| 46 | +Open-Tibia Public RSA Key: |
| 47 | +``` |
| 48 | +9B646903B45B07AC956568D87353BD7165139DD7940703B03E6DD079399661B4A837AA60561D7CCB9452FA0080594909882AB5BCA58A1A1B35F8B1059B72B1212611C6152AD3DBB3CFBEE7ADC142A75D3D75971509C321C5C24A5BD51FD460F01B4E15BEB0DE1930528A5D3F15C1E3CBF5C401D6777E10ACAAB33DBE8D5B7FF5 |
| 49 | +``` |
| 50 | + |
| 51 | +### Redact |
| 52 | +**WARNING** The `Redact` app needs further development to make it completely anonymous. |
| 53 | +For example, player IDs aren't anonymized which means it's possible a CipSoft employee could still identify your character since player IDs are now static. |
| 54 | +It's also possible that I've missed other areas that need to be scrubbed. |
| 55 | + |
| 56 | +The main purpose of the `Redact` app is to anonymize your recording(s) before sharing them. |
| 57 | +It will create a new recording with the same file name as the one you provide with "_redacted" appended to the end. |
| 58 | +Of course, you don't have to redact your recordings before sharing them, but if you don't want others to know your character name you can use this app. |
| 59 | +The `Redact` app will change all player names to "Redacted" in the game window, battlelist, channels, and even NPC messages. |
| 60 | +It also omits various packets that aren't necessary to keep. |
| 61 | +One thing to keep in mind is that redacted recordings may not work properly with the `Watch` app, but should always work with the `Extract` app. |
| 62 | + |
| 63 | +By default, the `Redact` app will remove all client packets. |
| 64 | +However, you can pass `--keepclientpackets` on the command-line to keep client packets in the redacted recording. |
| 65 | +Note that, even with `--keepclientpackets`, some client packets will still be redacted (i.e., the `Login` packet that includes your character name). |
| 66 | + |
| 67 | +Pass `-r/--recording` on the command-line with the recording you want to redact. |
| 68 | +For example, `-r=C:\Recordings\1_2_3__4_5_6.oxr`. |
| 69 | + |
| 70 | +### Extract |
| 71 | +The `Extract` app can be used to convert recordings into OTBM files and extract various information such as messages when looking at items. |
| 72 | + |
| 73 | +Like the `Record` app, the `Extract` app needs to load the .dat file so it will first try locate it by version in the `ClientData` directory, followed by the default directory. |
| 74 | +You can override this with the `-t/--tibiadirectory` parameter. |
| 75 | + |
| 76 | +You can specify a single recording, or a directory of recordings, with the `-r/--recording/--recordings` parameter. |
| 77 | +If specifying a directory of recordings, a new OTBM file will be created for reach recording. |
| 78 | +The format of created OTBM files is (XYZ is login position and date is UTC time): `RecordingFilename__X_Y_Z__Day_Month_Year__Hour_Minute_Second.otbm` |
| 79 | + |
| 80 | +By default, the `Extract` app outputs created OTBM files to the current directory. |
| 81 | +You can override this by passing `-o/--outdirectory` on the command-line. |
| 82 | +e.g., `-o=C:\ExtractedMaps\`. |
| 83 | + |
| 84 | +If you want to stop extraction after a specific time, you can use the `--time/--timestamp` parameter. |
| 85 | +Recording timestamps are in milliseconds, but the time parameter is in seconds. |
| 86 | +So, for example, if you have a recording from a 20 minute session but you only want to extract from the first 5 minutes you would pass: `--time=300`. |
| 87 | + |
| 88 | +Pass `-h/--help` on the command-line to get helpful information. |
| 89 | + |
| 90 | +Pass `--map` on the command-line to create an OTBM file from the recording. |
| 91 | + |
| 92 | +Pass `--items` to extract item data to a local file named `items.txt`. |
| 93 | +Item data is in the format: `ID Position`. |
| 94 | +e.g., `3031 12345,67890,7`. |
| 95 | + |
| 96 | +Pass `--monsters` to extract monster data to a local file named `monsters.txt`. |
| 97 | +Monster data is in the format: `Name Position`. |
| 98 | +e.g., `Rat 54321,09876,8`. |
| 99 | +Note that monsters are tracked by ID, so it's possible to have more than one creature at/near a position if a monster tracked at that position dies and another spawns. |
| 100 | + |
| 101 | +Pass `--npcs` to extract NPC data to a local file named `npcs.txt`. |
| 102 | +NPC data is in the format: `Name Position`. |
| 103 | +e.g., `Cipfried 23545,87986,3`. |
| 104 | + |
| 105 | +Pass `--lookitemtext` to extract the message returned when looking at an item to a local file named `lookitemtext.txt`. |
| 106 | +Look item data is in the format: `ID::Position::Text`. |
| 107 | +e.g., `1234::56789,01234,5::You see an object.\nIt weighs 1 oz.`. |
| 108 | + |
| 109 | +### Watch |
| 110 | +The `Watch` app can be used to watch recordings back in real-time. |
| 111 | +There are currently no controls to pause/play, rewind, fast-forward, etc. |
| 112 | +Once the `Watch` app is running, all you need to do is launch a client that has its `loginWebService` pointing at the same port that the `Watch` app is listening on, and has the RSA key overwritten with the Open-Tiba one. |
| 113 | +You can use any account/email and password to connect and get a character list. |
| 114 | +The character list will contain one entry, your recording. |
| 115 | +Select it and playback will commence. |
| 116 | + |
| 117 | +By default, the `Watch` app (like the `Record` app) listens to login connections from the client on localhost on port 7171. |
| 118 | +You can override this by passing `-p/--port` on the command-line. |
| 119 | + |
| 120 | +Use `-r/--recording` to specify the recording you would like to watch. |
| 121 | + |
| 122 | +## Donate |
| 123 | +If you enjoy the project, and like the work that has been put into it, feel free to donate. Donations aren't necessary, but anything is appreciated. Thanks! |
| 124 | + |
| 125 | +Paypal: PayPal.Me/jo3bingham |
| 126 | + |
| 127 | +Revolut: @josephlh4 |
| 128 | + |
| 129 | +Bitcoin: 1JWuyfeCV4SJtmDv16d3SadV4Nq8xtCB5v |
| 130 | + |
| 131 | +Ethereum: 0xaD4d3650A89a2786B60F86c2980d772aa412741F |
| 132 | + |
| 133 | +XRP: Address: rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg | Tag: 1431977163 |
0 commit comments