Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show equipped titan #70

Merged
merged 8 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions TF2.CT
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@
<CheatEntry>
<ID>47</ID>
<Description>"UPDATE: Neither of these were the current tick number"</Description>
<LastState Value="" RealAddress="00000000"/>
<GroupHeader>1</GroupHeader>
<CheatEntries>
<CheatEntry>
Expand All @@ -228,7 +227,6 @@
<CheatEntry>
<ID>77</ID>
<Description>"Potential current tick values. Look for increments of 20 or 60 per second"</Description>
<LastState Value="" RealAddress="00000000"/>
<GroupHeader>1</GroupHeader>
<CheatEntries>
<CheatEntry>
Expand Down Expand Up @@ -302,7 +300,6 @@
<CheatEntry>
<ID>78</ID>
<Description>"These ones set themselves to 1 when the match gets out"</Description>
<LastState Value="" RealAddress="00000000"/>
<GroupHeader>1</GroupHeader>
<CheatEntries>
<CheatEntry>
Expand Down Expand Up @@ -352,7 +349,6 @@
<CheatEntry>
<ID>79</ID>
<Description>"These ones set themselves to 0 when the match gets out"</Description>
<LastState Value="" RealAddress="00000000"/>
<GroupHeader>1</GroupHeader>
<CheatEntries>
<CheatEntry>
Expand Down Expand Up @@ -384,7 +380,6 @@
<CheatEntry>
<ID>80</ID>
<Description>"These ones seem to be incrementing by 20"</Description>
<LastState Value="" RealAddress="00000000"/>
<GroupHeader>1</GroupHeader>
<CheatEntries>
<CheatEntry>
Expand Down Expand Up @@ -438,7 +433,7 @@
</CheatEntry>
<CheatEntry>
<ID>84</ID>
<Description>"Currently equpped titan (engine.dll+7A7429)"</Description>
<Description>"Currently equipped titan (engine.dll+7A7429)"</Description>
<VariableType>Byte</VariableType>
<Address>engine.dll+7A7429</Address>
</CheatEntry>
Expand Down
5 changes: 3 additions & 2 deletions titanfall2-rp/GameDetailsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ public static (string, string, Timestamps?, Assets? assets) GetMultiplayerDetail
string gameDetails = tf2Api.GetGameMode().ToFriendlyString();
string gameState = $"{mpStats.GetTeam1Score()}:{mpStats.GetTeam2Score()}";
var timestamps = new Timestamps(gameOpenTimestamp);
var playerInTitan = tf2Api.IsPlayerInTitan();
var assets = new Assets
{
LargeImageKey = tf2Api.GetMultiplayerMapName(),
LargeImageText = tf2Api.GetFriendlyMapName(),
SmallImageKey = tf2Api.GetMultiPlayerGameStats().GetCurrentFaction().GetAssetName(),
SmallImageText = tf2Api.GetMultiPlayerGameStats().GetCurrentFaction().ToFriendlyString(),
SmallImageKey = playerInTitan ? tf2Api.GetTitan().GetAssetName() : tf2Api.GetMultiPlayerGameStats().GetCurrentFaction().GetAssetName(),
SmallImageText = playerInTitan ? tf2Api.GetTitan().ToFriendlyString() : tf2Api.GetMultiPlayerGameStats().GetCurrentFaction().ToFriendlyString(),
};
return (gameDetails, gameState, timestamps, assets);
}
Expand Down
51 changes: 51 additions & 0 deletions titanfall2-rp/Titanfall2API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,57 @@ public int GetPlayerHealth()
return _sharp!.Memory.Read<int>(EngineDllBaseAddress + 0x1122A8DC);
}

/// <summary>
/// Here's the list of addresses that all reflected the pilot being inside a titan:
/// engine.dll+111E18DC
/// engine.dll+111E18E0
/// engine.dll+111E1CB8
/// engine.dll+111E1D10
/// engine.dll+111E1D34
/// engine.dll+111E1DAC
/// engine.dll+111E1DB8
/// engine.dll+111E1DC4
/// engine.dll+1128D850
/// engine.dll+112910F4
/// client.dll+21720D7
/// client.dll+22BFEC9
/// client.dll+22BFED5
/// client.dll+22BFEE5
/// client.dll+22BFF01
/// client.dll+22BFF0D
/// client.dll+22BFF1D
/// client.dll+22BFF39
/// client.dll+22BFF45
/// client.dll+22BFF55
/// client.dll+22C75E5
/// client.dll+22C7605
/// client.dll+22C7780
/// client.dll+22C78A0
/// client.dll+23F5B48
/// client.dll+23F5B68
/// client.dll+23F5B88
/// client.dll+23F5BA8
/// client.dll+23F5BC8
/// client.dll+23F5BE8
/// client.dll+23F5C08
/// client.dll+23F5C28
/// client.dll+23F5C48
/// materialsystem_dx11.dll+1A98090
/// </summary>
/// <returns>true if the pilot is in a titan; else false</returns>
/// <remarks>This shit ain't stable, chief</remarks>
public bool IsPlayerInTitan()
{
_ensureInit();
return _sharp!.Memory.Read<int>(EngineDllBaseAddress + 0x111E18DC) != 0;
}

public Titan GetTitan()
{
_ensureInit();
return TitanMethods.GetTitan(_sharp!.Memory.Read(EngineDllBaseAddress + 0x7A7429, 1)[0]);
}

public int GetPlayerVelocity()
{
_ensureInit();
Expand Down
32 changes: 32 additions & 0 deletions titanfall2-rp/enums/Titan.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace titanfall2_rp.enums
{
public enum Titan
{
Ion,
Scorch,
Northstar,
// ReSharper disable once IdentifierTypo
Ronin,
Tone,
Legion,
Monarch,
}

internal static class TitanMethods
{
public static Titan GetTitan(int titanValue)
{
return (Titan)titanValue;
}

public static string ToFriendlyString(this Titan titan)
{
return titan.ToString();
}

public static string GetAssetName(this Titan titan)
{
return titan.ToString().ToLower();
}
}
}