From 6eef71fffc3423f3615fac6ba9bb800b34ac7dc5 Mon Sep 17 00:00:00 2001
From: "E. S." <39125931+ClonkAndre@users.noreply.github.com>
Date: Mon, 2 Dec 2024 22:20:05 +0100
Subject: [PATCH] Ported to IV-SDK .NET
Big time update! Bunch of new stuff added and made better, and of course the IV-SDK .NET port!
---
IV-Presence/IV-Presence.vcxproj.user | 4 -
IVPresence/Classes/DiscordLogger.cs | 62 +
IVPresence/Classes/Json/CustomInterior.cs | 21 +
IVPresence/Classes/Json/CustomRichPresence.cs | 19 +
IVPresence/Classes/Json/EpisodeInfo.cs | 21 +
.../Classes/Json/PredefinedLocations.cs | 49 +
IVPresence/Classes/Json/RadioInfo.cs | 19 +
IVPresence/Classes/Json/TriggerBox.cs | 26 +
IVPresence/Classes/Json/TriggerRange.cs | 26 +
IVPresence/Classes/Logging.cs | 29 +
IVPresence/Classes/ModSettings.cs | 36 +
IVPresence/Enums.cs | 44 +
IVPresence/IVPresence.csproj | 70 +
IVPresence/IVPresence.sln | 22 +
IVPresence/Main.cs | 2265 +++++++++++++++++
IVPresence/Properties/AssemblyInfo.cs | 33 +
IVPresence/packages.config | 6 +
LICENSE | 695 ++++-
README.md | 19 +-
.../IV-Presence}/IV-Presence.sln | 0
.../IV-Presence}/IV-Presence.vcxproj | 0
.../IV-Presence}/IV-Presence.vcxproj.filters | 0
.../IV-Presence}/discord-rpc.lib | Bin
.../IV-Presence}/discord_register.h | 0
.../IV-Presence}/discord_rpc.h | 0
.../IV-Presence}/dllmain.cpp | 0
26 files changed, 3434 insertions(+), 32 deletions(-)
delete mode 100644 IV-Presence/IV-Presence.vcxproj.user
create mode 100644 IVPresence/Classes/DiscordLogger.cs
create mode 100644 IVPresence/Classes/Json/CustomInterior.cs
create mode 100644 IVPresence/Classes/Json/CustomRichPresence.cs
create mode 100644 IVPresence/Classes/Json/EpisodeInfo.cs
create mode 100644 IVPresence/Classes/Json/PredefinedLocations.cs
create mode 100644 IVPresence/Classes/Json/RadioInfo.cs
create mode 100644 IVPresence/Classes/Json/TriggerBox.cs
create mode 100644 IVPresence/Classes/Json/TriggerRange.cs
create mode 100644 IVPresence/Classes/Logging.cs
create mode 100644 IVPresence/Classes/ModSettings.cs
create mode 100644 IVPresence/Enums.cs
create mode 100644 IVPresence/IVPresence.csproj
create mode 100644 IVPresence/IVPresence.sln
create mode 100644 IVPresence/Main.cs
create mode 100644 IVPresence/Properties/AssemblyInfo.cs
create mode 100644 IVPresence/packages.config
rename {IV-Presence => v1.4.1 - ASI/IV-Presence}/IV-Presence.sln (100%)
rename {IV-Presence => v1.4.1 - ASI/IV-Presence}/IV-Presence.vcxproj (100%)
rename {IV-Presence => v1.4.1 - ASI/IV-Presence}/IV-Presence.vcxproj.filters (100%)
rename {IV-Presence => v1.4.1 - ASI/IV-Presence}/discord-rpc.lib (100%)
rename {IV-Presence => v1.4.1 - ASI/IV-Presence}/discord_register.h (100%)
rename {IV-Presence => v1.4.1 - ASI/IV-Presence}/discord_rpc.h (100%)
rename {IV-Presence => v1.4.1 - ASI/IV-Presence}/dllmain.cpp (100%)
diff --git a/IV-Presence/IV-Presence.vcxproj.user b/IV-Presence/IV-Presence.vcxproj.user
deleted file mode 100644
index 88a5509..0000000
--- a/IV-Presence/IV-Presence.vcxproj.user
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/IVPresence/Classes/DiscordLogger.cs b/IVPresence/Classes/DiscordLogger.cs
new file mode 100644
index 0000000..59c3256
--- /dev/null
+++ b/IVPresence/Classes/DiscordLogger.cs
@@ -0,0 +1,62 @@
+using System;
+
+using DiscordRPC.Logging;
+
+namespace IVPresence.Classes
+{
+ internal class DiscordLogger : ILogger
+ {
+
+ #region Properties
+ ///
+ /// The level of logging to apply to this logger.
+ ///
+ public LogLevel Level { get; set; }
+ #endregion
+
+ #region Constructor
+ public DiscordLogger(LogLevel logLevel)
+ {
+ Level = logLevel;
+ }
+ public DiscordLogger()
+ {
+ Level = LogLevel.Info;
+ }
+ #endregion
+
+ public void Trace(string message, params object[] args)
+ {
+ if (Level <= LogLevel.Trace)
+ {
+ string text = "TRACE: " + message;
+ Logging.LogDebug(text, args);
+ }
+ }
+ public void Info(string message, params object[] args)
+ {
+ if (Level <= LogLevel.Info)
+ {
+ string text = "INFO: " + message;
+ Logging.Log(text, args);
+ }
+ }
+ public void Warning(string message, params object[] args)
+ {
+ if (Level <= LogLevel.Warning)
+ {
+ string text = "WARN: " + message;
+ Logging.LogWarning(text, args);
+ }
+ }
+ public void Error(string message, params object[] args)
+ {
+ if (Level <= LogLevel.Error)
+ {
+ string text = "ERR : " + message;
+ Logging.LogError(text, args);
+ }
+ }
+
+ }
+}
diff --git a/IVPresence/Classes/Json/CustomInterior.cs b/IVPresence/Classes/Json/CustomInterior.cs
new file mode 100644
index 0000000..bfdbff5
--- /dev/null
+++ b/IVPresence/Classes/Json/CustomInterior.cs
@@ -0,0 +1,21 @@
+namespace IVPresence.Classes.Json
+{
+ internal class CustomInterior
+ {
+
+ #region Variables
+ public int ModelIndex;
+ public string LargeImageKey;
+ public string DisplayName;
+ public string CustomDetailPresence;
+ #endregion
+
+ #region Constructor
+ public CustomInterior()
+ {
+
+ }
+ #endregion
+
+ }
+}
diff --git a/IVPresence/Classes/Json/CustomRichPresence.cs b/IVPresence/Classes/Json/CustomRichPresence.cs
new file mode 100644
index 0000000..6f8cccd
--- /dev/null
+++ b/IVPresence/Classes/Json/CustomRichPresence.cs
@@ -0,0 +1,19 @@
+namespace IVPresence.Classes.Json
+{
+ internal class CustomRichPresence
+ {
+
+ #region Variables
+ public string LargeImageKey;
+ public string LargeImageText;
+ #endregion
+
+ #region Constructor
+ public CustomRichPresence()
+ {
+
+ }
+ #endregion
+
+ }
+}
diff --git a/IVPresence/Classes/Json/EpisodeInfo.cs b/IVPresence/Classes/Json/EpisodeInfo.cs
new file mode 100644
index 0000000..676ee4a
--- /dev/null
+++ b/IVPresence/Classes/Json/EpisodeInfo.cs
@@ -0,0 +1,21 @@
+namespace IVPresence.Classes.Json
+{
+ internal class EpisodeInfo
+ {
+
+ #region Variables
+ public int ID;
+ public bool IsBaseEpisode;
+ public string ProtagonistName;
+ public string ProtagonistImageKey;
+ #endregion
+
+ #region Constructor
+ public EpisodeInfo()
+ {
+
+ }
+ #endregion
+
+ }
+}
diff --git a/IVPresence/Classes/Json/PredefinedLocations.cs b/IVPresence/Classes/Json/PredefinedLocations.cs
new file mode 100644
index 0000000..f473b51
--- /dev/null
+++ b/IVPresence/Classes/Json/PredefinedLocations.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Numerics;
+
+namespace IVPresence.Classes.Json
+{
+ internal class PredefinedLocations
+ {
+
+ #region Variables
+ public string ID;
+ public TriggerRange RangeTrigger;
+ //public TriggerBox BoxTrigger;
+ public CustomRichPresence CustomRichPresence;
+ #endregion
+
+ #region Constructor
+ ///
+ /// A constructor which sets up this for a .
+ ///
+ /// Just an indentifier for this location so its easier to debug.
+ /// The target position.
+ /// The target range around the given position.
+ public PredefinedLocations(string id, Vector3 pos, float triggerRange)
+ {
+ ID = id;
+ RangeTrigger = new TriggerRange(pos, triggerRange);
+ }
+ /////
+ ///// A constructor which sets up this for a .
+ /////
+ ///// Just an indentifier for this location so its easier to debug.
+ ///// The upper-left position for a 3D box.
+ ///// The lower-right position for a 3D box.
+ //public PredefinedLocations(string id, Vector3 pos1, Vector3 pos2)
+ //{
+ // ID = id;
+ // BoxTrigger = new TriggerBox(pos1, pos2);
+ //}
+ ///
+ /// Default constructor.
+ ///
+ public PredefinedLocations()
+ {
+
+ }
+ #endregion
+
+ }
+}
diff --git a/IVPresence/Classes/Json/RadioInfo.cs b/IVPresence/Classes/Json/RadioInfo.cs
new file mode 100644
index 0000000..faec0b9
--- /dev/null
+++ b/IVPresence/Classes/Json/RadioInfo.cs
@@ -0,0 +1,19 @@
+namespace IVPresence.Classes.Json
+{
+ internal class RadioInfo
+ {
+
+ #region Variables
+ public string RawName;
+ public string DisplayName;
+ #endregion
+
+ #region Constructor
+ public RadioInfo()
+ {
+
+ }
+ #endregion
+
+ }
+}
diff --git a/IVPresence/Classes/Json/TriggerBox.cs b/IVPresence/Classes/Json/TriggerBox.cs
new file mode 100644
index 0000000..d0eae38
--- /dev/null
+++ b/IVPresence/Classes/Json/TriggerBox.cs
@@ -0,0 +1,26 @@
+using System.Numerics;
+
+namespace IVPresence.Classes.Json
+{
+ internal class TriggerBox
+ {
+
+ #region Variables
+ public Vector3 Pos1;
+ public Vector3 Pos2;
+ #endregion
+
+ #region Constructor
+ public TriggerBox(Vector3 pos1, Vector3 pos2)
+ {
+ Pos1 = pos1;
+ Pos2 = pos2;
+ }
+ public TriggerBox()
+ {
+
+ }
+ #endregion
+
+ }
+}
diff --git a/IVPresence/Classes/Json/TriggerRange.cs b/IVPresence/Classes/Json/TriggerRange.cs
new file mode 100644
index 0000000..e355d8b
--- /dev/null
+++ b/IVPresence/Classes/Json/TriggerRange.cs
@@ -0,0 +1,26 @@
+using System.Numerics;
+
+namespace IVPresence.Classes.Json
+{
+ internal class TriggerRange
+ {
+
+ #region Variables
+ public Vector3 Position;
+ public float Range;
+ #endregion
+
+ #region Constructor
+ public TriggerRange(Vector3 pos, float range)
+ {
+ Position = pos;
+ Range = range;
+ }
+ public TriggerRange()
+ {
+
+ }
+ #endregion
+
+ }
+}
diff --git a/IVPresence/Classes/Logging.cs b/IVPresence/Classes/Logging.cs
new file mode 100644
index 0000000..cf371a7
--- /dev/null
+++ b/IVPresence/Classes/Logging.cs
@@ -0,0 +1,29 @@
+using IVSDKDotNet;
+
+namespace IVPresence.Classes
+{
+ internal class Logging
+ {
+
+ public static void Log(string str, params object[] args)
+ {
+ IVGame.Console.Print(string.Format("[IVPresence] {0}", string.Format(str, args)));
+ }
+ public static void LogWarning(string str, params object[] args)
+ {
+ IVGame.Console.PrintWarning(string.Format("[IVPresence] {0}", string.Format(str, args)));
+ }
+ public static void LogError(string str, params object[] args)
+ {
+ IVGame.Console.PrintError(string.Format("[IVPresence] {0}", string.Format(str, args)));
+ }
+
+ public static void LogDebug(string str, params object[] args)
+ {
+#if DEBUG
+ IVGame.Console.Print(string.Format("[IVPresence] [DEBUG] {0}", string.Format(str, args)));
+#endif
+ }
+
+ }
+}
diff --git a/IVPresence/Classes/ModSettings.cs b/IVPresence/Classes/ModSettings.cs
new file mode 100644
index 0000000..a981087
--- /dev/null
+++ b/IVPresence/Classes/ModSettings.cs
@@ -0,0 +1,36 @@
+using IVSDKDotNet;
+
+namespace IVPresence.Classes
+{
+ internal class ModSettings
+ {
+
+ #region Variables
+ // General
+ public static bool LogErrorsToConsole;
+ public static bool AllowOtherModsToSetPresence;
+ public static bool ShowPresenceOfOtherMods;
+
+ // Credits
+ public static bool ShowStatistics;
+
+ // Network
+ public static bool ShowNetworkKillerName;
+ #endregion
+
+ public static void Load(SettingsFile settingsFile)
+ {
+ // General
+ LogErrorsToConsole = settingsFile.GetBoolean("General", "LogErrorsToConsole", true);
+ AllowOtherModsToSetPresence = settingsFile.GetBoolean("General", "AllowOtherModsToSetPresence", true);
+ ShowPresenceOfOtherMods = settingsFile.GetBoolean("General", "ShowPresenceOfOtherMods", true);
+
+ // Credits
+ ShowStatistics = settingsFile.GetBoolean("Credits", "ShowStatistics", true);
+
+ // Network
+ ShowNetworkKillerName = settingsFile.GetBoolean("Network", "ShowNetworkKillerName", true);
+ }
+
+ }
+}
diff --git a/IVPresence/Enums.cs b/IVPresence/Enums.cs
new file mode 100644
index 0000000..52b9f23
--- /dev/null
+++ b/IVPresence/Enums.cs
@@ -0,0 +1,44 @@
+namespace IVPresence
+{
+
+ internal enum TextState
+ {
+ Default = 0,
+ State1 = 1,
+ State2 = 2,
+ State3 = 3,
+ State4 = 4,
+ State5 = 5,
+ State6 = 6,
+ State7 = 7,
+ State8 = 8,
+ State9 = 9,
+ State10 = 10,
+ MAX
+ }
+
+ internal enum CauseOfDeath
+ {
+ Unknown,
+ FallingDamage,
+ FleeingFromCops,
+ FightingCops,
+ Headshot,
+ Fire,
+ Explosion,
+ ExplosionNoobtubed,
+ ExplodingCar,
+ ExplodingBike,
+ ExplodingTruck,
+ ExplodingPetrolPump,
+ }
+
+ internal enum GasStation
+ {
+ None,
+ Ron,
+ GlobeOil,
+ Terroil
+ }
+
+}
diff --git a/IVPresence/IVPresence.csproj b/IVPresence/IVPresence.csproj
new file mode 100644
index 0000000..191e8e5
--- /dev/null
+++ b/IVPresence/IVPresence.csproj
@@ -0,0 +1,70 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {15748350-D229-4BCA-9A68-784D0F0EF350}
+ Library
+ Properties
+ IVPresence
+ IVPresence.ivsdk
+ v4.8
+ 512
+ false
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ packages\ClonksCodingLib.GTAIV.1.9.0.38745\lib\net472\ClonksCodingLib.GTAIV.dll
+
+
+ packages\DiscordRichPresence.1.2.1.24\lib\net45\DiscordRPC.dll
+
+
+ False
+ ..\..\IVSDKDotNet\Release\IVSDKDotNetWrapper.dll
+
+
+ packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/IVPresence/IVPresence.sln b/IVPresence/IVPresence.sln
new file mode 100644
index 0000000..1b30885
--- /dev/null
+++ b/IVPresence/IVPresence.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.12.35514.174 d17.12
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IVPresence", "IVPresence.csproj", "{15748350-D229-4BCA-9A68-784D0F0EF350}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {15748350-D229-4BCA-9A68-784D0F0EF350}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {15748350-D229-4BCA-9A68-784D0F0EF350}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {15748350-D229-4BCA-9A68-784D0F0EF350}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {15748350-D229-4BCA-9A68-784D0F0EF350}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/IVPresence/Main.cs b/IVPresence/Main.cs
new file mode 100644
index 0000000..2339956
--- /dev/null
+++ b/IVPresence/Main.cs
@@ -0,0 +1,2265 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Numerics;
+using System.Linq;
+
+using DiscordRPC;
+using Newtonsoft.Json;
+using CCL.GTAIV;
+using IVPresence.Classes;
+using IVPresence.Classes.Json;
+
+using IVSDKDotNet;
+using IVSDKDotNet.Enums;
+using static IVSDKDotNet.Native.Natives;
+
+namespace IVPresence
+{
+ public class Main : Script
+ {
+
+ #region Variables
+ public bool MenuOpened;
+
+ // Player
+ private uint playerId;
+ private int playerIndex;
+ private int playerHandle;
+ private Vector3 playerPos;
+ private uint playerHealth;
+ private uint playerArmour;
+ private int playerInterior;
+ private bool playerDead;
+ private bool playerIsInAir;
+ private bool playerSwimming;
+ private bool playerInAnyCar;
+ private bool playerPerformingWheelie;
+ private bool playerPerformingStoppie;
+ private uint currentScore;
+ private uint currentWantedLevel;
+ private string currentRadioStationName;
+ private string currentZoneRawName;
+ private string currentZoneDisplayName;
+ private int currentPlayerWeapon;
+
+ private CauseOfDeath causeOfDeath;
+
+ // Pools
+ private IVPool interiorPool;
+
+ // Discord
+ private DiscordRpcClient discordRpcClient;
+ private DiscordLogger discordLogger;
+ private RichPresence discordRichPresence;
+ private bool isDiscordReady;
+
+ private RichPresence customRichPresence;
+ private Guid idOfScriptWhichSetCustomPresence;
+
+ // Timer
+ private Stopwatch wheelieStoppieWatch;
+ private Guid wantedBlinkTimerId;
+ private Guid textSwitchingTimerId;
+
+ // Lists
+ private static Dictionary zoneToIslandDict = new Dictionary()
+ {
+ // Alderney
+ { "WESDY", "Alderney" },
+ { "LEFWO", "Alderney" },
+ { "ALDCI", "Alderney" },
+ { "BERCH", "Alderney" },
+ { "NORMY", "Alderney" },
+ { "ACTRR", "Alderney" },
+ { "PORTU", "Alderney" },
+ { "TUDOR", "Alderney" },
+ { "ACTIP", "Alderney" },
+ { "ALSCF", "Alderney" },
+
+ // Algonquin
+ { "NORWO", "Algonquin" },
+ { "EAHOL", "Algonquin" },
+ { "NOHOL", "Algonquin" },
+ { "VASIH", "Algonquin" },
+ { "LANCA", "Algonquin" },
+ { "MIDPE", "Algonquin" },
+ { "MIDPA", "Algonquin" },
+ { "MIDPW", "Algonquin" },
+ { "PUGAT", "Algonquin" },
+ { "HATGA", "Algonquin" },
+ { "LANCE", "Algonquin" },
+ { "STARJ", "Algonquin" },
+ { "WESMI", "Algonquin" },
+ { "TMEQU", "Algonquin" },
+ { "THTRI", "Algonquin" },
+ { "EASON", "Algonquin" },
+ { "THPRES", "Algonquin" },
+ { "FISSN", "Algonquin" },
+ { "FISSO", "Algonquin" },
+ { "LOWEA", "Algonquin" },
+ { "LITAL", "Algonquin" },
+ { "SUFFO", "Algonquin" },
+ { "CASGC", "Algonquin" },
+ { "CITH" , "Algonquin" },
+ { "CHITO", "Algonquin" },
+ { "THXCH", "Algonquin" },
+ { "CASGR", "Algonquin" },
+
+ // Bohan
+ { "BOULE", "Bohan" },
+ { "NRTGA", "Bohan" },
+ { "LTBAY", "Bohan" },
+ { "FORSI", "Bohan" },
+ { "INSTI", "Bohan" },
+ { "STHBO", "Bohan" },
+ { "CHAPO", "Bohan" },
+
+ // Dukes
+ { "STEIN", "Dukes" },
+ { "MEADP", "Dukes" },
+ { "FRANI", "Dukes" },
+ { "WILLI", "Dukes" },
+ { "MEADH", "Dukes" },
+ { "EISLC", "Dukes" },
+ { "BOAB" , "Dukes" },
+ { "CERHE", "Dukes" },
+ { "BEECW", "Dukes" },
+
+ // Broker
+ { "SCHOL", "Broker" },
+ { "DOWTW", "Broker" },
+ { "ROTTH", "Broker" },
+ { "ESHOO", "Broker" },
+ { "OUTL", "Broker" },
+ { "SUTHS", "Broker" },
+ { "HOBEH", "Broker" },
+ { "FIREP", "Broker" },
+ { "FIISL", "Broker" },
+ { "BEGGA", "Broker" },
+
+ // Happiness Island
+ { "HAPIN", "Happiness Island" },
+
+ // Charge Island
+ { "CHISL", "Charge Island" },
+
+ // Colony Island
+ { "COISL", "Colony Island" },
+
+ // Bridges, tunnels etc TODO
+ { "BRALG", "Liberty City" },
+ { "BRBRO", "Liberty City" },
+ { "BREBB", "Liberty City" },
+ { "BRDBB", "Liberty City" },
+ { "NOWOB", "Liberty City" },
+ { "HIBRG", "Liberty City" },
+ { "LEAPE", "Liberty City" },
+ { "BOTU", "Liberty City" },
+
+ // Liberty City
+ { "LIBERTY", "Liberty City" }
+ };
+ private static Dictionary zoneToIslandDictDCReady = new Dictionary()
+ {
+ // Alderney
+ {"WESDY", "alderney"},
+ {"LEFWO", "alderney"},
+ {"ALDCI", "alderney"},
+ {"BERCH", "alderney"},
+ {"NORMY", "alderney"},
+ {"ACTRR", "alderney"},
+ {"PORTU", "alderney"},
+ {"TUDOR", "alderney"},
+ {"ACTIP", "alderney"},
+ {"ALSCF", "alderney"},
+
+ // Algonquin
+ {"CASGR", "algonquin"},
+ {"THXCH", "algonquin"},
+ {"FISSO", "algonquin"},
+ {"CHITO", "algonquin"},
+ {"CITH", "algonquin"},
+ {"CASGC", "algonquin"},
+ {"SUFFO", "algonquin"},
+ {"LITAL", "algonquin"},
+ {"LOWEA", "algonquin"},
+ {"FISSN", "algonquin"},
+ {"THPRES", "algonquin"},
+ {"EASON", "algonquin"},
+ {"THTRI", "algonquin"},
+ {"TMEQU", "algonquin"},
+ {"WESMI", "algonquin"},
+ {"STARJ", "algonquin"},
+ {"LANCE", "algonquin"},
+ {"HATGA", "algonquin"},
+ {"PUGAT", "algonquin"},
+ {"MIDPW", "algonquin"},
+ {"MIDPA", "algonquin"},
+ {"MIDPE", "algonquin"},
+ {"LANCA", "algonquin"},
+ {"VASIH", "algonquin"},
+ {"NOHOL", "algonquin"},
+ {"EAHOL", "algonquin"},
+ {"NORWO", "algonquin"},
+
+ // Bohan
+ {"STHBO", "bohan"},
+ {"CHAPO", "bohan"},
+ {"FORSI", "bohan"},
+ {"BOULE", "bohan"},
+ {"NRTGA", "bohan"},
+ {"INSTI", "bohan"},
+ {"LTBAY", "bohan"},
+
+ // Broker/Dukes
+ {"STEIN", "broker_dukes"},
+ {"MEADP", "broker_dukes"},
+ {"FRANI", "broker_dukes"},
+ {"WILLI", "broker_dukes"},
+ {"MEADH", "broker_dukes"},
+ {"EISLC", "broker_dukes"},
+ {"BOAB", "broker_dukes"},
+ {"CERHE", "broker_dukes"},
+ {"BEECW", "broker_dukes"},
+ {"SCHOL", "broker_dukes"},
+ {"DOWTW", "broker_dukes"},
+ {"ROTTH", "broker_dukes"},
+ {"ESHOO", "broker_dukes"},
+ {"OUTL", "broker_dukes"},
+ {"SUTHS", "broker_dukes"},
+ {"HOBEH", "broker_dukes"},
+ {"FIREP", "broker_dukes"},
+ {"FIISL", "broker_dukes"},
+ {"BEGGA", "broker_dukes"},
+
+ // Charge Island
+ {"CHISL", "chisl"},
+
+ // Colony Island
+ {"COISL", "coisl"},
+
+ // Happiness Island
+ {"HAPIN", "hapin"},
+
+ // Bridges, tunnels etc TODO
+ {"BRALG", "bralg"},
+ {"BRBRO", "brbro"},
+ {"BREBB", "brebb"},
+ {"BRDBB", "brdbb"},
+ {"NOWOB", "nowob"},
+ {"HIBRG", "hibrg"},
+ {"LEAPE", "leape"},
+ {"BOTU", "botu"},
+
+ // Liberty City
+ {"LIBERTY", "liberty"}
+ };
+ private List radioStationInfos;
+ private List episodeInfos;
+ private List predefinedLocations;
+ private List customInteriors;
+
+ // States
+ private int wantedBlinkState;
+ private object wantedBlinkStateLockObj = new object();
+ private TextState currentTextState;
+ private object textSwitchStateLockObj = new object();
+
+ private bool isAltTabbed;
+ private bool checkedForCauseOfDeath;
+
+ // Eggs
+ private int blackoutTextToShow;
+ private int honkTextToShow;
+ private int deathTextToShow;
+
+ // DEBUG
+#if DEBUG
+ public bool DebuggingWindowOpen = true;
+#endif
+
+ private string currentPredefinedLocation;
+
+ #endregion
+
+ #region Constructor
+ public Main()
+ {
+ // Lists
+ radioStationInfos = new List();
+ episodeInfos = new List();
+ predefinedLocations = new List();
+ customInteriors = new List();
+ //predefinedLocations = new List()
+ //{
+ // new PredefinedLocations("SwingSet", new Vector3(1348.225f, -250.883f, 24.17826f), 10.0f),
+ // new PredefinedLocations("OnTopOfRotterdamHillTower", new Vector3(-313.4718f, -77.74622f, 459.6857f), new Vector3(-254.4818f, -123.194f, 310.5f)),
+ // new PredefinedLocations("InsideStatueOfLiberty", new Vector3(-605.0084f, -752.2288f, 73.98586f), new Vector3(-612.1718f, -751.1531f, 46.31163f)),
+ // new PredefinedLocations("AidenDeathLocation", new Vector3(-1546.964f, 1237.855f, 11.96186f), 10.0f),
+ // new PredefinedLocations("VladDeathLocation", new Vector3(779.5123f, 235.4688f, 4.506213f), 10.0f)
+ //};
+
+ // Other
+ wheelieStoppieWatch = new Stopwatch();
+
+ // IV-SDK .NET stuff
+ RAGE.OnWindowFocusChanged += RAGE_OnWindowFocusChanged;
+ Uninitialize += Main_Uninitialize;
+ Initialized += Main_Initialized;
+ ScriptCommandReceived += Main_ScriptCommandReceived;
+ Drawing += Main_Drawing;
+ OnImGuiRendering += Main_OnImGuiRendering;
+ Tick += Main_Tick;
+ }
+ #endregion
+
+ #region Methods
+ private void LoadEpisodeInfo()
+ {
+ try
+ {
+ string path = string.Format("{0}\\EpisodeInfo.json", ScriptResourceFolder);
+
+ if (!File.Exists(path))
+ {
+ Logging.LogError("Failed to load and add episode info. Details: The 'EpisodeInfo.json' file was not found.");
+ return;
+ }
+
+ episodeInfos.Clear();
+ episodeInfos = JsonConvert.DeserializeObject>(File.ReadAllText(path));
+
+ Logging.Log("Loaded {0} episode info(s).", episodeInfos.Count);
+ }
+ catch (Exception ex)
+ {
+ Logging.LogError("Failed to load and add episode info. Details: {0}", ex);
+ }
+ }
+ private void LoadPredefinedLocations()
+ {
+ try
+ {
+ string path = string.Format("{0}\\PredefinedLocations.json", ScriptResourceFolder);
+
+ if (!File.Exists(path))
+ {
+ Logging.LogError("Failed to load and add predefined locations. Details: The 'PredefinedLocations.json' file was not found.");
+ return;
+ }
+
+ predefinedLocations.Clear();
+ predefinedLocations = JsonConvert.DeserializeObject>(File.ReadAllText(path));
+
+ Logging.Log("Loaded {0} predefined locations(s).", episodeInfos.Count);
+ }
+ catch (Exception ex)
+ {
+ Logging.LogError("Failed to load and add predefined locations. Details: {0}", ex);
+ }
+ }
+ private void LoadRadioStationInfo()
+ {
+ try
+ {
+ string path = string.Format("{0}\\RadioStationInfo.json", ScriptResourceFolder);
+
+ if (!File.Exists(path))
+ {
+ Logging.LogError("Failed to load and add radio stations. Details: The 'RadioStationInfo.json' file was not found.");
+ return;
+ }
+
+ radioStationInfos.Clear();
+ radioStationInfos = JsonConvert.DeserializeObject>(File.ReadAllText(path));
+
+ Logging.Log("Loaded {0} radio station(s).", episodeInfos.Count);
+ }
+ catch (Exception ex)
+ {
+ Logging.LogError("Failed to load and add radio stations. Details: {0}", ex);
+ }
+ }
+ private void LoadCustomInteriors()
+ {
+ try
+ {
+ string path = string.Format("{0}\\CustomInteriors.json", ScriptResourceFolder);
+
+ if (!File.Exists(path))
+ {
+ Logging.LogError("Failed to load and add custom interiors. Details: The 'CustomInteriors.json' file was not found.");
+ return;
+ }
+
+ customInteriors.Clear();
+ customInteriors = JsonConvert.DeserializeObject>(File.ReadAllText(path));
+
+ Logging.Log("Loaded {0} custom interior(s).", episodeInfos.Count);
+ }
+ catch (Exception ex)
+ {
+ Logging.LogError("Failed to load and add custom interiors. Details: {0}", ex);
+ }
+ }
+ private void SaveEpisodeInfo()
+ {
+ try
+ {
+ string path = string.Format("{0}\\EpisodeInfo.json", ScriptResourceFolder);
+
+ File.WriteAllText(path, JsonConvert.SerializeObject(episodeInfos));
+
+ Logging.Log("Loaded {0} episode info(s).", episodeInfos.Count);
+ }
+ catch (Exception ex)
+ {
+ Logging.LogError("Failed to save episode infos. Details: {0}", ex);
+ }
+ }
+ private void SavePredefinedLocations()
+ {
+ try
+ {
+ string path = string.Format("{0}\\PredefinedLocations.json", ScriptResourceFolder);
+
+ File.WriteAllText(path, JsonConvert.SerializeObject(predefinedLocations));
+
+ Logging.Log("Loaded {0} predefined location(s).", predefinedLocations.Count);
+ }
+ catch (Exception ex)
+ {
+ Logging.LogError("Failed to save predefined locations. Details: {0}", ex);
+ }
+ }
+ private void SaveRadioStationInfo()
+ {
+ try
+ {
+ string path = string.Format("{0}\\RadioStationInfo.json", ScriptResourceFolder);
+
+ File.WriteAllText(path, JsonConvert.SerializeObject(radioStationInfos));
+
+ Logging.Log("Loaded {0} radio station(s).", radioStationInfos.Count);
+ }
+ catch (Exception ex)
+ {
+ Logging.LogError("Failed to save radio stations. Details: {0}", ex);
+ }
+ }
+ private void SaveCustomInteriors()
+ {
+ try
+ {
+ string path = string.Format("{0}\\CustomInteriors.json", ScriptResourceFolder);
+
+ File.WriteAllText(path, JsonConvert.SerializeObject(customInteriors));
+
+ Logging.Log("Loaded {0} custom interior(s).", customInteriors.Count);
+ }
+ catch (Exception ex)
+ {
+ Logging.LogError("Failed to save custom interiors. Details: {0}", ex);
+ }
+ }
+
+ private void Prepare()
+ {
+ isDiscordReady = true;
+ discordRpcClient.UpdateStartTime();
+
+ // Start blink timer
+ wantedBlinkTimerId = StartNewTimer(3000, () =>
+ {
+ lock (wantedBlinkStateLockObj)
+ {
+ wantedBlinkState++;
+
+ if (wantedBlinkState > 1)
+ wantedBlinkState = 0;
+ }
+ });
+ textSwitchingTimerId = StartNewTimer(5000, () =>
+ {
+ lock (textSwitchStateLockObj)
+ {
+ currentTextState = (TextState)((int)currentTextState + 1);
+
+ if (currentTextState == TextState.MAX)
+ currentTextState = TextState.Default;
+ }
+ });
+ }
+
+ private void CheckCauseOfDeath()
+ {
+ if (checkedForCauseOfDeath)
+ return;
+
+ // Check if player died while fleeing from the cops
+ if (currentWantedLevel != 0 && playerInAnyCar)
+ {
+ causeOfDeath = CauseOfDeath.FleeingFromCops;
+ checkedForCauseOfDeath = true;
+ return;
+ }
+
+ // Check if player died while fighting the cops
+ if (currentWantedLevel != 0 && currentPlayerWeapon != 0)
+ {
+ causeOfDeath = CauseOfDeath.FightingCops;
+ checkedForCauseOfDeath = true;
+ return;
+ }
+
+ // Check if player died through a HEADSHOT
+ if (WAS_PED_KILLED_BY_HEADSHOT(playerHandle))
+ {
+ causeOfDeath = CauseOfDeath.Headshot;
+ checkedForCauseOfDeath = true;
+ return;
+ }
+
+ // Check if player died through an fire
+ if (IS_CHAR_ON_FIRE(playerHandle))
+ {
+ causeOfDeath = CauseOfDeath.Fire;
+ checkedForCauseOfDeath = true;
+ return;
+ }
+
+ // Check if player died through an explosion
+ // Loop through explosion types and see if there is an explosion with this type in sphere
+ for (int i = 0; i < 24; i++)
+ {
+ // Ignore some explosion types
+ switch (i)
+ {
+ case 1:
+ case 3:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ continue;
+ }
+
+ if (IS_EXPLOSION_IN_SPHERE(i, playerPos, 10f))
+ {
+ // Get explosion which killed player
+ switch ((eExplosion)i)
+ {
+ case eExplosion.EXPLOSION_CAR:
+ causeOfDeath = CauseOfDeath.ExplodingCar;
+ break;
+ case eExplosion.EXPLOSION_BIKE:
+ causeOfDeath = CauseOfDeath.ExplodingBike;
+ break;
+ case eExplosion.EXPLOSION_TRUCK:
+ causeOfDeath = CauseOfDeath.ExplodingTruck;
+ break;
+ case eExplosion.EXPLOSION_PETROL_PUMP:
+ causeOfDeath = CauseOfDeath.ExplodingPetrolPump;
+ break;
+ default:
+
+ if (IVNetwork.IsNetworkGameRunning() && GENERATE_RANDOM_INT_IN_RANGE(0, 100) < 15)
+ causeOfDeath = CauseOfDeath.ExplosionNoobtubed;
+ else
+ causeOfDeath = CauseOfDeath.Explosion;
+
+ break;
+ }
+
+
+ checkedForCauseOfDeath = true;
+ return;
+ }
+ }
+
+ // Check if player died through falling damage
+ if (playerIsInAir)
+ {
+ causeOfDeath = CauseOfDeath.FallingDamage;
+ checkedForCauseOfDeath = true;
+ return;
+ }
+
+ // No cause found
+ causeOfDeath = CauseOfDeath.Unknown;
+ checkedForCauseOfDeath = true;
+ }
+
+ private void SetLargeImageStuff()
+ {
+ // Get name of current zone player is in
+ string zoneName = "UNKNOWN";
+ if (!zoneToIslandDict.TryGetValue(GET_NAME_OF_ZONE(playerPos), out zoneName))
+ {
+ // TODO: Maybe log or something
+ }
+
+ // Interiors: They have the highest priority
+ if (IS_INTERIOR_SCENE())
+ {
+ short interiorModelIndex = GetCurrentInteriorModelIndex();
+
+ if (interiorModelIndex != -1)
+ {
+ // Check for custom interior: This has the highest priority
+ if (FindCustomInterior(interiorModelIndex, out CustomInterior customInterior))
+ {
+ // Set default location incase any of the custom interior details are not specified
+ SetDefaultLocation(zoneName);
+
+ bool hasLargeImageKey = !string.IsNullOrWhiteSpace(customInterior.LargeImageKey);
+ bool hasDisplayName = !string.IsNullOrWhiteSpace(customInterior.DisplayName);
+
+ // Check for custom large image key - If not specified, uses default area image
+ if (hasLargeImageKey)
+ discordRichPresence.Assets.LargeImageKey = customInterior.LargeImageKey;
+
+ if (hasDisplayName)
+ discordRichPresence.Assets.LargeImageText = string.Format("{0} in {1}", customInterior.DisplayName, zoneName);
+ else
+ discordRichPresence.Assets.LargeImageText = string.Format("Building in {0}", zoneName);
+
+ return;
+ }
+ else
+ {
+ // Check which default interior the player is currently in
+ switch (interiorModelIndex)
+ {
+ // General
+ case 4222: // Strip Club Bohan
+ case 5071:
+ case 4654:
+ discordRichPresence.Assets.LargeImageKey = "sc_bohan";
+ discordRichPresence.Assets.LargeImageText = string.Format("Strip Club in {0}", zoneName);
+ return;
+ case 5164: // Strip Club Alderney
+ case 6013:
+ case 5596:
+ discordRichPresence.Assets.LargeImageKey = "sc_alderney";
+ discordRichPresence.Assets.LargeImageText = string.Format("Strip Club in {0}", zoneName);
+ return;
+ case 6422: // Burger Shot
+ case 7126:
+ case 6854:
+ discordRichPresence.Assets.LargeImageKey = "burger_shot";
+ discordRichPresence.Assets.LargeImageText = string.Format("Burger Shot in {0}", zoneName);
+ return;
+ case 6423: // Cluckin Bell
+ case 7127:
+ case 6855:
+ discordRichPresence.Assets.LargeImageKey = "cluckin_bell";
+ discordRichPresence.Assets.LargeImageText = string.Format("Cluckin' Bell in {0}", zoneName);
+ return;
+ case 4385: // Hospital
+ case 5234:
+ case 4817:
+ discordRichPresence.Assets.LargeImageKey = "hospital";
+ discordRichPresence.Assets.LargeImageText = string.Format("Hospital in {0}", zoneName);
+ return;
+ case 5585: // Memory Lanes (Bowling Alley)
+ case 29291:
+ case 27944:
+ discordRichPresence.Assets.LargeImageKey = "memory_lanes";
+ discordRichPresence.Assets.LargeImageText = string.Format("Memory Lanes in {0}", zoneName);
+ return;
+ case 4221: // Steinway Beer Garden (Darts)
+ case 5070:
+ case 4653:
+ discordRichPresence.Assets.LargeImageKey = "steinway_beer_garden";
+ discordRichPresence.Assets.LargeImageText = string.Format("Steinway Beer Garden in {0}", zoneName);
+ return;
+ case 4386: // Homebrew Cafe (Billiard)
+ case 5235:
+ case 4818:
+ discordRichPresence.Assets.LargeImageKey = "homebrew_cafe";
+ discordRichPresence.Assets.LargeImageText = string.Format("Homebrew Cafe in {0}", zoneName);
+ return;
+ case 5067: // Perestroika (Cabaret)
+ case 5916:
+ case 5499:
+ discordRichPresence.Assets.LargeImageKey = "cabaret";
+ discordRichPresence.Assets.LargeImageText = string.Format("Cabaret Perestroika in {0}", zoneName);
+ return;
+ case 6144: // Internet Cafe (tw@)
+ case 6848:
+ case 6576:
+ discordRichPresence.Assets.LargeImageKey = "internet_cafe";
+ discordRichPresence.Assets.LargeImageText = string.Format("tw@ in {0}", zoneName);
+ return;
+ case 6262: // 69th Street Diner
+ discordRichPresence.Assets.LargeImageKey = "69th_street_diner";
+ discordRichPresence.Assets.LargeImageText = string.Format("69th Street Diner in {0}", zoneName);
+ return;
+ case 6821: // Gun Shop
+ case 6822:
+ case 6118:
+ case 6117:
+ case 6550:
+ case 6549:
+ discordRichPresence.Assets.LargeImageKey = "gun_shop";
+ discordRichPresence.Assets.LargeImageText = string.Format("Gun Shop in {0}", zoneName);
+ return;
+ case 6426: // Bohan Sprunk Warehouse
+ discordRichPresence.Assets.LargeImageKey = "bohan_sprunk_warehouse";
+ discordRichPresence.Assets.LargeImageText = string.Format("Sprunk Warehouse in {0}", zoneName);
+ return;
+ case 5584: // Abandoned Sprunk Factory
+ discordRichPresence.Assets.LargeImageKey = "abandoned_sprunk_factory";
+ discordRichPresence.Assets.LargeImageText = string.Format("Abandoned Sprunk Factory in {0}", zoneName);
+ return;
+ case 5919: // Playboy X's Penthouse
+ case 6768:
+ case 6351:
+ discordRichPresence.Assets.LargeImageKey = "pbx_safehouse";
+ discordRichPresence.Assets.LargeImageText = string.Format("Playboy X's Penthouse in {0}", zoneName);
+ return;
+
+ // GTA IV
+ case 4139: // Broker Safehouse
+ discordRichPresence.Assets.LargeImageKey = "gtaiv_broker_safehouse";
+ discordRichPresence.Assets.LargeImageText = string.Format("Safehouse in {0}", zoneName);
+ return;
+ case 5681: // South Bohan Apartment
+ discordRichPresence.Assets.LargeImageKey = "gtaiv_south_bohan_safehouse";
+ discordRichPresence.Assets.LargeImageText = string.Format("Apartment in {0}", zoneName);
+ return;
+ case 5684: // Middle Park East Safehouse
+ discordRichPresence.Assets.LargeImageKey = "gtaiv_middle_park_east_safehouse";
+ discordRichPresence.Assets.LargeImageText = string.Format("Safehouse in {0}", zoneName);
+ return;
+ case 5678: // Alderney Safehouse
+ discordRichPresence.Assets.LargeImageKey = "gtaiv_alderney_safehouse";
+ discordRichPresence.Assets.LargeImageText = string.Format("Safehouse in {0}", zoneName);
+ return;
+
+ // TLaD
+ case 27827: // Clubhouse
+ discordRichPresence.Assets.LargeImageKey = "tlad_the_lost_clubhouse";
+ discordRichPresence.Assets.LargeImageText = string.Format("Clubhouse in {0}", zoneName);
+ return;
+ case 28024: // Brian's Safehouse
+ discordRichPresence.Assets.LargeImageKey = "tlad_brians_safehouse";
+ discordRichPresence.Assets.LargeImageText = string.Format("Safehouse in {0}", zoneName);
+ return;
+ case 29316: // Luis Safehouse
+ discordRichPresence.Assets.LargeImageKey = "tbogt_luis_safehouse";
+ discordRichPresence.Assets.LargeImageText = string.Format("Safehouse in {0}", zoneName);
+ return;
+
+ // TBoGT
+ case 28931: // Maisonette 9
+ discordRichPresence.Assets.LargeImageKey = "maisonette";
+ discordRichPresence.Assets.LargeImageText = string.Format("Maisonette in {0}", zoneName);
+ return;
+ case 29026: // Hercules
+ discordRichPresence.Assets.LargeImageKey = "hercules";
+ discordRichPresence.Assets.LargeImageText = string.Format("Hercules in {0}", zoneName);
+ return;
+ case 28578: // Bahama Mamas
+ discordRichPresence.Assets.LargeImageKey = "bahama_mamas";
+ discordRichPresence.Assets.LargeImageText = string.Format("Bahama Mamas in {0}", zoneName);
+ return;
+ }
+ }
+ }
+
+ discordRichPresence.Assets.LargeImageText = string.Format("Building in {0}", zoneName);
+ return;
+ }
+
+ // Predefined locations: They have priority over the default locations
+ for (int i = 0; i < predefinedLocations.Count; i++)
+ {
+ PredefinedLocations predefinedLocation = predefinedLocations[i];
+
+ if (predefinedLocation.CustomRichPresence == null)
+ continue;
+
+ if (predefinedLocation.RangeTrigger != null)
+ {
+ // Check if player is within the desired range
+ if (Vector3.Distance(playerPos, predefinedLocation.RangeTrigger.Position) < predefinedLocation.RangeTrigger.Range)
+ {
+ currentPredefinedLocation = predefinedLocation.ID;
+
+ // Set custom stuff
+ if (!string.IsNullOrWhiteSpace(predefinedLocation.CustomRichPresence.LargeImageKey))
+ discordRichPresence.Assets.LargeImageKey = predefinedLocation.CustomRichPresence.LargeImageKey;
+ if (!string.IsNullOrWhiteSpace(predefinedLocation.CustomRichPresence.LargeImageText))
+ discordRichPresence.Assets.LargeImageText = predefinedLocation.CustomRichPresence.LargeImageText;
+
+ return;
+ }
+ }
+ //else if (predefinedLocation.BoxTrigger != null)
+ //{
+ // // Check if player is within the desired box
+ // if (IsCharInArea3D(playerHandle, predefinedLocation.BoxTrigger.Pos1, predefinedLocation.BoxTrigger.Pos2))
+ // {
+ // currentPredefinedLocation = predefinedLocation.ID;
+
+ // // Set custom stuff
+ // if (!string.IsNullOrWhiteSpace(predefinedLocation.CustomRichPresence.LargeImageKey))
+ // discordRichPresence.Assets.LargeImageKey = predefinedLocation.CustomRichPresence.LargeImageKey;
+ // if (!string.IsNullOrWhiteSpace(predefinedLocation.CustomRichPresence.LargeImageText))
+ // discordRichPresence.Assets.LargeImageText = predefinedLocation.CustomRichPresence.LargeImageText;
+
+ // return;
+ // }
+ //}
+ }
+
+ currentPredefinedLocation = "";
+
+ // Default locations: Lowest priority
+ SetDefaultLocation(zoneName);
+ }
+ private void SetDefaultLocation(string zoneLocation)
+ {
+ if (zoneToIslandDictDCReady.TryGetValue(currentZoneRawName, out string largeImageKey))
+ {
+ discordRichPresence.Assets.LargeImageKey = largeImageKey;
+ }
+
+ discordRichPresence.Assets.LargeImageText = string.Format("{0} in {1}", currentZoneDisplayName, zoneLocation);
+ }
+ private void SetDefaultInteriorDetails(short modelIndex)
+ {
+ // Check default interiors
+ switch (modelIndex)
+ {
+ case 4222: // Strip Club Bohan
+ case 5071:
+ case 4654:
+ case 5164: // Strip Club Alderney
+ case 6013:
+ case 5596:
+ discordRichPresence.Details = "Enjoying the Strip Club";
+ return;
+ case 6422: // Burger Shot
+ case 7126:
+ case 6854:
+ discordRichPresence.Details = "In Burger Shot";
+ return;
+ case 6423: // Cluckin Bell
+ case 7127:
+ case 6855:
+ discordRichPresence.Details = "In Cluckin' Bell";
+ return;
+ case 4385: // Hospital
+ case 5234:
+ case 4817:
+ discordRichPresence.Details = "In Hospital";
+ return;
+ case 5585: // Memory Lanes (Bowling Alley)
+ case 29291:
+ case 27944:
+ discordRichPresence.Details = "In Bowling Alley";
+ return;
+ case 4221: // Steinway Beer Garden (Darts)
+ case 5070:
+ case 4653:
+ discordRichPresence.Details = "In Steinway's Beer Garden";
+ return;
+ case 4386: // Homebrew Cafe (Billiard)
+ case 5235:
+ case 4818:
+ discordRichPresence.Details = "In Homebrew's Cafe";
+ return;
+ case 5067: // Perestroika (Cabaret)
+ case 5916:
+ case 5499:
+ discordRichPresence.Details = "In Cabaret Perestroika";
+ return;
+ case 6144: // Internet Cafe (tw@)
+ case 6848:
+ case 6576:
+ discordRichPresence.Details = "In tw@";
+ return;
+ case 6262: // 69th Street Diner
+ discordRichPresence.Details = "In 69th Street Diner";
+ return;
+ case 6821: // Gun Shop
+ case 6822:
+ case 6118:
+ case 6117:
+ case 6550:
+ case 6549:
+ discordRichPresence.Details = "In Gun Shop";
+ return;
+
+ case 4139: // GTA IV Broker Safehouse
+ discordRichPresence.Details = "In Broker Safehouse";
+ return;
+ case 5681: // GTA IV South Bohan Apartment
+ discordRichPresence.Details = "In South Bohan Apartment";
+ return;
+ case 5684: // GTA IV Middle Park East Safehouse
+ discordRichPresence.Details = "In Middle Park East Safehouse";
+ return;
+ case 5678: // GTA IV Alderney Safehouse
+ discordRichPresence.Details = "In Alderney Safehouse";
+ return;
+ case 5919: // Playboy X's Penthouse
+ case 6768:
+ case 6351:
+ discordRichPresence.Details = "In Playboy X's Penthouse";
+ return;
+ case 6426: // Bohan Sprunk Warehouse
+ discordRichPresence.Details = "In Bohan's Sprunk Warehouse";
+ return;
+ case 5584: // Abandoned Sprunk Factory
+ discordRichPresence.Details = "In Abandoned Sprunk Factory";
+ return;
+
+ case 27827: // TLaD Clubhouse
+ discordRichPresence.Details = "In Lost MC Clubhouse";
+ return;
+ case 28024: // TLaD Brian's Safehouse
+ discordRichPresence.Details = "In Brian's Safehouse";
+ return;
+ case 29316: // TBoGT Luis Safehouse
+ discordRichPresence.Details = "In Luis Safehouse";
+ return;
+
+ case 28931: // TBoGT Maisonette 9
+ discordRichPresence.Details = "Hanging out in Maisonette 9";
+ return;
+ case 29026: // TBoGT Hercules
+ discordRichPresence.Details = "Hanging out in Hercules";
+ return;
+ case 28578: // TBoGT Bahama Mamas
+ discordRichPresence.Details = "Hanging out in Bahama Mamas";
+ return;
+ }
+
+ // Generic building text
+ discordRichPresence.Details = "Inside a Building";
+
+ if (IsPlayerDoingAMission(out string missionName))
+ {
+ switch ((int)currentTextState % 3)
+ {
+ case 0: // Building location
+ discordRichPresence.State = string.Format("In {0}", currentZoneDisplayName);
+ break;
+ case 1: // Doing a mission or watching cutscene
+ discordRichPresence.State = HAS_CUTSCENE_FINISHED() == false ? "Watching a cutscene" : "Doing a mission";
+ break;
+ case 2: // Mission name
+ discordRichPresence.State = missionName;
+ break;
+ }
+ }
+ else
+ {
+ discordRichPresence.State = string.Format("In {0}", currentZoneDisplayName);
+ }
+ }
+
+ private void SetSingleplayerStuff()
+ {
+ // Get current episode info
+ EpisodeInfo episodeInfo = GetEpisodeInfo(GET_CURRENT_EPISODE());
+ string playerIconKey = episodeInfo.ProtagonistImageKey;
+
+ // Check dead state
+ if (episodeInfo.IsBaseEpisode)
+ {
+ if (playerDead)
+ {
+ playerIconKey = playerIconKey + "_red";
+ }
+ else
+ {
+ // Make player icon blink if wanted
+ if (currentWantedLevel > 0)
+ playerIconKey = playerIconKey + (wantedBlinkState == 0 ? "_red" : "_blue");
+ }
+ }
+
+ // Set small image text - Show different kinds of information based on the currentTextState
+ switch ((int)currentTextState % (currentPlayerWeapon == 0 ? 3 : 4))
+ {
+ case 0: // Protagonist Name
+ discordRichPresence.Assets.SmallImageText = episodeInfo.ProtagonistName;
+ break;
+ case 1: // Health, Armour
+ discordRichPresence.Assets.SmallImageText = string.Format("Health: {0}, Armour: {1}", playerHealth, playerArmour);
+ break;
+ case 2: // Money
+ discordRichPresence.Assets.SmallImageText = string.Format("Money: ${0:N}", currentScore);
+ break;
+ case 3: // Equipped Weapon
+ discordRichPresence.Assets.SmallImageText = string.Format("Equipped Weapon: {0}", NativeGame.GetCommonWeaponName((eWeaponType)currentPlayerWeapon));
+ break;
+
+ }
+
+ // Update
+ discordRichPresence.Assets.SmallImageKey = playerIconKey;
+ }
+ private void SetNetworkStuff()
+ {
+ if (!discordRichPresence.HasParty())
+ discordRichPresence.Party = new Party();
+
+ // Get player stuff
+ string playerName = GET_PLAYER_NAME(playerIndex);
+
+ // Set small image stuff
+ discordRichPresence.Assets.SmallImageKey = IS_CHAR_DEAD(playerHandle) ? "mp_player_red" : "mp_player";
+
+ switch ((NetworkGameMode)NETWORK_GET_GAME_MODE())
+ {
+ // Game modes with a score
+ case NetworkGameMode.Deathmatch:
+ case NetworkGameMode.TLaD_Deathmatch:
+ case NetworkGameMode.TBoGT_Deathmatch:
+ case NetworkGameMode.MafiyaWork:
+ case NetworkGameMode.CarJackCity:
+ case NetworkGameMode.GTARace:
+ case NetworkGameMode.TBoGT_GTARace:
+ case NetworkGameMode.TurfWar:
+ case NetworkGameMode.TLaD_ClubBusiness:
+
+ switch ((int)currentTextState % 3)
+ {
+ case 0: // Player name
+ discordRichPresence.Assets.SmallImageText = playerName;
+ break;
+ case 1: // Current Score
+ discordRichPresence.Assets.SmallImageText = string.Format("Current Score: {0}", currentScore);
+ break;
+ case 2: // Health, Armour
+ discordRichPresence.Assets.SmallImageText = string.Format("Health: {0}, Armour: {1}", playerHealth, playerArmour);
+ break;
+ }
+
+ break;
+
+ // Game modes with a score and a team
+ case NetworkGameMode.TeamDeathmatch:
+ case NetworkGameMode.TLaD_TeamDeathmatch:
+ case NetworkGameMode.TBoGT_TeamDeathmatch:
+ case NetworkGameMode.TeamMafiyaWork:
+ case NetworkGameMode.TeamCarJackCity:
+ case NetworkGameMode.CopsAndCrooks:
+ case NetworkGameMode.TLaD_ChopperVsChopper:
+ case NetworkGameMode.TLaD_WitnessProtection:
+
+ switch ((int)currentTextState % 4)
+ {
+ case 0: // Player name
+ discordRichPresence.Assets.SmallImageText = playerName;
+ break;
+ case 1: // Current Team
+ discordRichPresence.Assets.SmallImageText = string.Format("Current Team: {0}", GET_PLAYER_TEAM((int)GET_PLAYER_ID()));
+ break;
+ case 2: // Current Score
+ discordRichPresence.Assets.SmallImageText = string.Format("Current Score: {0}", currentScore);
+ break;
+ case 3: // Health, Armour
+ discordRichPresence.Assets.SmallImageText = string.Format("Health: {0}, Armour: {1}", playerHealth, playerArmour);
+ break;
+ }
+
+ break;
+
+ // "Normal" game modes
+ case NetworkGameMode.FreeMode:
+ case NetworkGameMode.PartyMode:
+ case NetworkGameMode.Race:
+ case NetworkGameMode.TLaD_Race:
+ case NetworkGameMode.TBoGT_Race:
+ case NetworkGameMode.DealBreaker:
+ case NetworkGameMode.HangmansNoose:
+ case NetworkGameMode.BombDaBaseII:
+ case NetworkGameMode.TLaD_LoneWolfBiker:
+ case NetworkGameMode.TLaD_OwnTheCity:
+
+ switch ((int)currentTextState % 2)
+ {
+ case 0: // Player name
+ discordRichPresence.Assets.SmallImageText = playerName;
+ break;
+ case 1: // Health, Armour
+ discordRichPresence.Assets.SmallImageText = string.Format("Health: {0}, Armour: {1}", playerHealth, playerArmour);
+ break;
+ }
+
+ break;
+ }
+
+ // Set party stuff
+ discordRichPresence.Party.Size = (int)GET_NUMBER_OF_PLAYERS();
+ discordRichPresence.Party.Max = (int)NETWORK_GET_MAX_SLOTS();
+ }
+ private void SetDetailsAndState()
+ {
+ if (IS_PAUSE_MENU_ACTIVE())
+ {
+ discordRichPresence.Details = "In pause menu";
+ discordRichPresence.State = null;
+ return;
+ }
+
+ // Handle player death
+ if (playerDead)
+ {
+
+ if (IVNetwork.IsNetworkSession())
+ {
+ string networkKillerName = GetNameOfNetworkKillerOfPlayer();
+
+ if (string.IsNullOrWhiteSpace(networkKillerName))
+ {
+ discordRichPresence.Details = "About to respawn";
+ }
+ else
+ {
+ switch (deathTextToShow)
+ {
+ case 0:
+ discordRichPresence.Details = string.Format("Was annihilated by {0}", networkKillerName);
+ break;
+ case 1:
+ discordRichPresence.Details = string.Format("Was erased by {0}", networkKillerName);
+ break;
+ case 2:
+ discordRichPresence.Details = string.Format("Was outplayed by {0}", networkKillerName);
+ break;
+ case 3:
+ discordRichPresence.Details = string.Format("Was obliterated by {0}", networkKillerName);
+ break;
+ case 4:
+ discordRichPresence.Details = string.Format("Was silenced by {0}", networkKillerName);
+ break;
+ case 5:
+ discordRichPresence.Details = string.Format("Got crushed by {0}", networkKillerName);
+ break;
+
+ default:
+ discordRichPresence.Details = string.Format("Was killed by {0}", networkKillerName);
+ break;
+ }
+
+ if ((int)currentTextState % 2 == 1)
+ {
+ discordRichPresence.Details = "About to respawn";
+ }
+ }
+
+ discordRichPresence.State = GetDeathCauseDisplayText();
+ }
+ else
+ {
+ discordRichPresence.Details = "About to respawn at hospital";
+ discordRichPresence.State = GetDeathCauseDisplayText();
+ }
+
+ return;
+ }
+ else
+ {
+ deathTextToShow = GENERATE_RANDOM_INT_IN_RANGE(0, 20);
+ }
+
+ // Custom presence: This has the highest priority
+ if (ModSettings.AllowOtherModsToSetPresence)
+ {
+ if (idOfScriptWhichSetCustomPresence != Guid.Empty)
+ {
+ // Check if the script which set the custom presence is still running
+ if (IsScriptRunning(idOfScriptWhichSetCustomPresence))
+ {
+ // Set the custom presence
+ discordRichPresence.Details = customRichPresence.Details;
+ discordRichPresence.State = customRichPresence.State;
+
+ return;
+ }
+ else
+ {
+ // Script is no longer running so we reset stuff
+ idOfScriptWhichSetCustomPresence = Guid.Empty;
+ customRichPresence = null;
+ }
+ }
+ }
+
+ // Other mod stuff: This has the second highest priority
+ if (ModSettings.ShowPresenceOfOtherMods)
+ {
+ if (SendScriptCommand("SimpleHotTub", "GET_IS_IN_HOT_TUB", null, out object result))
+ {
+ if (Convert.ToBoolean(result))
+ {
+ discordRichPresence.Details = "Currently relaxing in a Hot Tub";
+
+ bool commandSentSuccessful = SendScriptCommand("SimpleHotTub", "GET_TOTAL_TIME_IN_HOT_TUB", null, out object timeResult);
+ bool commandSentSuccessful2 = SendScriptCommand("SimpleHotTub", "GET_AMOUNT_OF_PEOPLE_IN_HOT_TUB", null, out object peopleInHotTubResult);
+
+ if (!commandSentSuccessful && !commandSentSuccessful2)
+ {
+ discordRichPresence.State = null;
+ return;
+ }
+
+ // Get total time in Hot Tub
+ int modBy = 0;
+
+ if (commandSentSuccessful)
+ modBy++;
+ if (commandSentSuccessful2)
+ modBy++;
+
+ switch ((int)currentTextState % modBy)
+ {
+ case 0:
+ int peopleInHotTub = Convert.ToInt32(peopleInHotTubResult) - 1;
+
+ if (peopleInHotTub == 0)
+ discordRichPresence.State = "Relaxing all by himself";
+ else
+ discordRichPresence.State = string.Format("Accompanied by {0} other(s)", peopleInHotTub);
+
+ break;
+ case 1:
+ discordRichPresence.State = string.Format("{0} seconds in", TimeSpan.FromTicks(Convert.ToInt64(timeResult)).Seconds);
+ break;
+ }
+
+ return;
+ }
+ }
+ if (SendScriptCommand("SimpleSpeedometer", "get_current_gas_station", null, out result)) // Temporary solution to check if the player is refilling their car
+ {
+ int gasStationIndex = Convert.ToInt32(result);
+
+ if (gasStationIndex != 0)
+ {
+ discordRichPresence.Details = "Refilling their car";
+ discordRichPresence.State = string.Format("At {0}", (GasStation)gasStationIndex);
+ return;
+ }
+ }
+ if (SendScriptCommand("ProjectThunderIV", "is_blackout_active", null, out result))
+ {
+ if (Convert.ToBoolean(result))
+ {
+ switch (blackoutTextToShow)
+ {
+ case 0:
+ discordRichPresence.Details = "Currently blinded by the darkness";
+ break;
+ case 1:
+ discordRichPresence.Details = "We Watch_Dogs now boys";
+ break;
+ case 2:
+ discordRichPresence.Details = "Welcome to LC, Aiden Pearce";
+ break;
+ case 3:
+ discordRichPresence.Details = "It's 1977 in Liberty City again";
+ break;
+ default:
+ discordRichPresence.Details = "Currently witnessing a Blackout";
+ break;
+ }
+ }
+ else
+ {
+ blackoutTextToShow = GENERATE_RANDOM_INT_IN_RANGE(0, 20);
+ }
+
+ return;
+ }
+ }
+
+ // Credits
+ if (!ARE_CREDITS_FINISHED())
+ {
+ discordRichPresence.Details = "Watching end credits";
+
+ // Go through some stats
+ if (ModSettings.ShowStatistics)
+ {
+ switch (currentTextState)
+ {
+ case TextState.Default:
+ discordRichPresence.State = string.Format("{0} kills by headshots", NativeGame.GetIntegerStatistic(eIntStatistic.STAT_KILLS_BY_HEADSHOTS));
+ break;
+ case TextState.State1:
+ discordRichPresence.State = string.Format("{0} deaths", NativeGame.GetIntegerStatistic(eIntStatistic.STAT_PLAYER_SHOT_TO_DEATH));
+ break;
+ case TextState.State2:
+ discordRichPresence.State = string.Format("{0} addiction level", NativeGame.GetIntegerStatistic(eIntStatistic.STAT_ADDICTION_LEVEL));
+ break;
+ case TextState.State3:
+ discordRichPresence.State = string.Format("Cheated {0} times", NativeGame.GetIntegerStatistic(eIntStatistic.STAT_TIMES_CHEATED));
+ break;
+ case TextState.State4:
+ discordRichPresence.State = string.Format("{0} cars stolen", NativeGame.GetIntegerStatistic(eIntStatistic.STAT_CARS_STOLEN));
+ break;
+ case TextState.State5:
+ discordRichPresence.State = string.Format("{0} bullets fired", NativeGame.GetIntegerStatistic(eIntStatistic.STAT_BULLETS_FIRED));
+ break;
+ case TextState.State6:
+ discordRichPresence.State = string.Format("{0} failed missions", NativeGame.GetIntegerStatistic(eIntStatistic.STAT_MISSIONS_FAILED));
+ break;
+ case TextState.State7:
+ discordRichPresence.State = string.Format("{0} prostitute visits", NativeGame.GetIntegerStatistic(eIntStatistic.STAT_PROSTITUTE_VISITS));
+ break;
+ case TextState.State8:
+ discordRichPresence.State = string.Format("{0} completed stunt jumps", NativeGame.GetIntegerStatistic(eIntStatistic.STAT_STUNT_JUMPS_COMPLETED));
+ break;
+ case TextState.State9:
+ discordRichPresence.State = string.Format("Got drunk {0} times", NativeGame.GetIntegerStatistic(eIntStatistic.STAT_TIMES_GOT_DRUNK));
+ break;
+ case TextState.State10:
+ discordRichPresence.State = string.Format("Total progress: {0}%", NativeGame.GetFloatStatistic(eFloatStatistic.STAT_TOTAL_PROGRESS));
+ break;
+ }
+ }
+ else
+ {
+ discordRichPresence.State = null;
+ }
+
+ return;
+ }
+
+ // Swimming
+ if (playerSwimming)
+ {
+ discordRichPresence.Details = string.Format("Swimming through {0}", currentZoneDisplayName);
+
+ // On Mission
+ if (IsPlayerDoingAMission(out string missionName))
+ {
+ switch ((int)currentTextState % 2)
+ {
+ case 0: // Doing a mission
+ discordRichPresence.State = "Doing a mission";
+ break;
+ case 1: // Mission name
+ discordRichPresence.State = missionName;
+ break;
+ }
+ }
+ else
+ {
+ discordRichPresence.State = null;
+ }
+
+ return;
+ }
+
+ // Vehicle
+ if (playerInAnyCar)
+ {
+ GET_CAR_CHAR_IS_USING(playerHandle, out int playerVehicle);
+ GET_CAR_MODEL(playerVehicle, out uint vehicleModel);
+
+ // Check vehicle type
+ if (IS_THIS_MODEL_A_BIKE(vehicleModel))
+ discordRichPresence.Details = string.Format("Motorcycling through {0}", currentZoneDisplayName);
+ else if (IS_THIS_MODEL_A_BOAT(vehicleModel))
+ discordRichPresence.Details = string.Format("Boating through {0}", currentZoneDisplayName);
+ else if (IS_THIS_MODEL_A_CAR(vehicleModel))
+ discordRichPresence.Details = string.Format("Driving through {0}", currentZoneDisplayName);
+ else if (IS_THIS_MODEL_A_HELI(vehicleModel) || IS_THIS_MODEL_A_PLANE(vehicleModel))
+ discordRichPresence.Details = string.Format("Flying over {0}", currentZoneDisplayName);
+ else if (IS_THIS_MODEL_A_TRAIN(vehicleModel))
+ discordRichPresence.Details = string.Format("Taking the train through {0}", currentZoneDisplayName);
+
+ // Get current radio station
+ string radioStationDisplayName = GetCurrentRadioStationDisplayName(false);
+
+ // Get vehicle display name
+ string vehicleDisplayName = GET_DISPLAY_NAME_FROM_VEHICLE_MODEL(vehicleModel);
+
+ if (DOES_TEXT_LABEL_EXIST(vehicleDisplayName))
+ vehicleDisplayName = GET_STRING_FROM_TEXT_FILE(vehicleDisplayName);
+
+ bool isRomansCab = vehicleDisplayName == "Roman's Taxi";
+
+ // Get the speed of the vehicle and convert to MPH
+ GET_CAR_SPEED(playerVehicle, out float currentVehicleSpeedRaw);
+ currentVehicleSpeedRaw = currentVehicleSpeedRaw * 2.23694f;
+ int currentVehicleSpeed = (int)Math.Round(currentVehicleSpeedRaw);
+
+ // Set rich presence
+ if (currentVehicleSpeed == 0)
+ discordRichPresence.State = string.Format("{0} {1}", isRomansCab ? "With" : "With a", vehicleDisplayName);
+ else
+ discordRichPresence.State = string.Format("Going {0} MPH {1} {2}", currentVehicleSpeed, isRomansCab ? "in" : "in a", vehicleDisplayName);
+
+ if (radioStationDisplayName != null)
+ {
+ if ((int)currentTextState % 2 == 1)
+ discordRichPresence.State = radioStationDisplayName;
+ }
+
+ // On Mission
+ bool doingMission = IsPlayerDoingAMission(out string missionName);
+ if (doingMission)
+ {
+ switch ((int)currentTextState % 4)
+ {
+ case 2: // Doing a mission or watching cutscene
+ discordRichPresence.State = HAS_CUTSCENE_FINISHED() == false ? "Watching a cutscene" : "Doing a mission";
+ break;
+ case 3: // Mission name
+ discordRichPresence.State = missionName;
+ break;
+ }
+ }
+
+ // Horn
+ if (IS_PLAYER_PRESSING_HORN(playerIndex))
+ {
+ int index = 2;
+
+ if (radioStationDisplayName != null)
+ index++;
+ if (doingMission)
+ index = index + 2;
+
+ if ((int)currentTextState % index == 0)
+ {
+ switch (honkTextToShow)
+ {
+ case 0:
+ discordRichPresence.State = "Beeping at someone";
+ break;
+ case 1:
+ discordRichPresence.State = "Yoinking the horn";
+ break;
+ case 2:
+ discordRichPresence.State = "Being a New Yorker";
+ break;
+ default:
+ discordRichPresence.State = "Honking the horn";
+ break;
+ }
+ }
+ else
+ {
+ honkTextToShow = GENERATE_RANDOM_INT_IN_RANGE(0, 20);
+ }
+ }
+
+ // Some priority stuff
+ if (IS_PLAYER_PERFORMING_WHEELIE((int)playerId))
+ {
+ discordRichPresence.State = "Performing a wheelie!";
+
+ if ((int)currentTextState % 2 == 1)
+ discordRichPresence.State = string.Format("For {0} seconds", wheelieStoppieWatch.Elapsed.Seconds);
+ }
+ else if (IS_PLAYER_PERFORMING_STOPPIE((int)playerId))
+ {
+ discordRichPresence.State = "Performing a stoppie!";
+
+ if ((int)currentTextState % 2 == 1)
+ discordRichPresence.State = string.Format("For {0} seconds", wheelieStoppieWatch.Elapsed.Seconds);
+ }
+ }
+ // On Foot
+ else
+ {
+ // Interiors: They have the highest priority
+ if (IS_INTERIOR_SCENE())
+ {
+ short interiorModelIndex = GetCurrentInteriorModelIndex();
+
+ if (interiorModelIndex != -1)
+ {
+ // Check for custom interior: This has the highest priority
+ if (FindCustomInterior(interiorModelIndex, out CustomInterior customInterior))
+ {
+ // Set default details
+ SetDefaultInteriorDetails(interiorModelIndex);
+
+ // Then override detail with custom one if specified
+ if (!string.IsNullOrWhiteSpace(customInterior.CustomDetailPresence))
+ discordRichPresence.Details = customInterior.CustomDetailPresence;
+ }
+ else
+ {
+ SetDefaultInteriorDetails(interiorModelIndex);
+ }
+
+ return;
+ }
+ }
+
+ // Other stuff
+ GET_CHAR_SPEED(playerHandle, out float currentCharSpeed);
+ bool isDucking = IS_CHAR_DUCKING(playerHandle);
+
+ if (currentCharSpeed < 1.0f)
+ discordRichPresence.Details = string.Format("{0} in {1}", isDucking ? "Crouching" : "Standing", currentZoneDisplayName);
+ else if (currentCharSpeed >= 1.90f)
+ discordRichPresence.Details = string.Format("Running through {0}", currentZoneDisplayName);
+ else
+ discordRichPresence.Details = string.Format("{0} through {1}", isDucking ? "Sneaking" : "Walking", currentZoneDisplayName);
+
+ // On Mission
+ if (IsPlayerDoingAMission(out string missionName2))
+ {
+ switch ((int)currentTextState % 2)
+ {
+ case 0: // Doing a mission or watching cutscene
+ discordRichPresence.State = HAS_CUTSCENE_FINISHED() == false ? "Watching a cutscene" : "Doing a mission";
+ break;
+ case 1: // Mission name
+ discordRichPresence.State = missionName2;
+ break;
+ }
+ }
+ else
+ {
+ discordRichPresence.State = null;
+ }
+ }
+ }
+ #endregion
+
+ #region Functions
+ private bool IsCharInArea3D(int handle, Vector3 pos1, Vector3 pos2)
+ {
+ return IS_CHAR_IN_AREA_3D(handle, pos2.X, pos2.Y, pos2.Z, pos1.X, pos1.Y, pos1.Z, false);
+ }
+ private EpisodeInfo GetEpisodeInfo(uint id)
+ {
+ return episodeInfos.Where(x => x.ID == id).FirstOrDefault();
+ }
+ private bool FindCustomInterior(short modelIndex, out CustomInterior customInterior)
+ {
+ CustomInterior interior = customInteriors.Where(x => (short)x.ModelIndex == modelIndex).FirstOrDefault();
+
+ if (interior == null)
+ {
+ customInterior = null;
+ return false;
+ }
+
+ customInterior = interior;
+ return true;
+ }
+ private string GetDeathCauseDisplayText()
+ {
+ switch (causeOfDeath)
+ {
+ case CauseOfDeath.FallingDamage: return "Died by falling damage";
+ case CauseOfDeath.FleeingFromCops: return "Died while fleeing from cops";
+ case CauseOfDeath.FightingCops: return "Died while fighting cops";
+ case CauseOfDeath.Headshot: return "Died by headshot";
+ case CauseOfDeath.Fire: return "Burned to death";
+ case CauseOfDeath.Explosion: return "Died by an explosion";
+ case CauseOfDeath.ExplosionNoobtubed: return "Got noobtubed";
+ case CauseOfDeath.ExplodingCar: return "Died by an exploding Vehicle";
+ case CauseOfDeath.ExplodingBike: return "Died by an exploding Bike";
+ case CauseOfDeath.ExplodingTruck: return "Died by an exploding Truck";
+ case CauseOfDeath.ExplodingPetrolPump: return "Died by an exploding Petrol Pump";
+ }
+
+ return null;
+ }
+ private string GetCurrentRadioStationDisplayName(bool onlyGetDisplayName)
+ {
+ if (!string.IsNullOrEmpty(currentRadioStationName))
+ {
+ RadioInfo foundRadioInfo = radioStationInfos.Where(x => x.RawName == currentRadioStationName).FirstOrDefault();
+
+ if (foundRadioInfo == null)
+ return null;
+
+ if (onlyGetDisplayName)
+ return foundRadioInfo.DisplayName;
+ else
+ return "Listening to " + foundRadioInfo.DisplayName;
+ }
+
+ return null;
+ }
+ private string GetNameOfNetworkKillerOfPlayer()
+ {
+ if (!IVNetwork.IsNetworkGameRunning())
+ return null;
+
+ string name = null;
+ int networkKillerOfPlayer = FIND_NETWORK_KILLER_OF_PLAYER((int)playerId);
+
+ if (networkKillerOfPlayer != (int)playerId)
+ {
+ // Check if local player really is dead and then get the name of the network killer
+ if (IS_NETWORK_PLAYER_ACTIVE(networkKillerOfPlayer))
+ {
+ if (IS_PLAYER_DEAD((int)playerId))
+ name = GET_PLAYER_NAME(networkKillerOfPlayer);
+ }
+ }
+
+ return name;
+ }
+ private bool IsPlayerDoingAMission(out string name)
+ {
+ if (!IVTheScripts.IsPlayerOnAMission())
+ {
+ name = null;
+ return false;
+ }
+
+ string missionName = GET_STRING_FROM_TEXT_FILE(IVTheScripts.GetGlobalString(9926));
+
+ if (missionName == "NULL")
+ missionName = "Probably on a hangout";
+
+ name = missionName;
+
+ return true;
+ }
+ private short GetCurrentInteriorModelIndex()
+ {
+ if (playerInterior == 0)
+ return -1;
+
+ UIntPtr ptr = interiorPool.GetAt((uint)playerInterior);
+
+ if (ptr == UIntPtr.Zero)
+ return -1;
+
+ IVEntity interiorEntity = IVInteriorInst.FromUIntPtr(ptr);
+
+ return interiorEntity.ModelIndex;
+ }
+ #endregion
+
+ #region Events
+ private void DiscordRpcClient_OnReady(object sender, DiscordRPC.Message.ReadyMessage args)
+ {
+ Prepare();
+ }
+ private void DiscordRpcClient_OnConnectionFailed(object sender, DiscordRPC.Message.ConnectionFailedMessage args)
+ {
+ Logging.LogWarning("[Discord] Failed to connect!");
+ isDiscordReady = false;
+ }
+ private void DiscordRpcClient_OnError(object sender, DiscordRPC.Message.ErrorMessage args)
+ {
+ if (ModSettings.LogErrorsToConsole)
+ Logging.LogError("[Discord] An error occured! Code: {0}, Message: {1}", args.Code, args.Message);
+ //isDiscordReady = false;
+ }
+
+ private void RAGE_OnWindowFocusChanged(bool focused)
+ {
+ if (!isDiscordReady)
+ return;
+
+ isAltTabbed = !focused;
+
+ if (focused)
+ return;
+
+ discordRichPresence.Details = "Alt-tabbed";
+ discordRichPresence.State = null;
+
+ // Update rich presence
+ discordRpcClient.SetPresence(discordRichPresence);
+ }
+ #endregion
+
+ private void Main_Uninitialize(object sender, EventArgs e)
+ {
+ isDiscordReady = false;
+
+ // Unsubscribe from events
+ RAGE.OnWindowFocusChanged -= RAGE_OnWindowFocusChanged;
+
+ // Stop timers
+ if (wantedBlinkTimerId != Guid.Empty)
+ {
+ AbortTaskOrTimer(wantedBlinkTimerId);
+ wantedBlinkTimerId = Guid.Empty;
+ }
+ if (textSwitchingTimerId != Guid.Empty)
+ {
+ AbortTaskOrTimer(textSwitchingTimerId);
+ textSwitchingTimerId = Guid.Empty;
+ }
+
+ // Cleanup
+ if (discordRpcClient != null)
+ {
+ discordRpcClient.Dispose();
+ discordRpcClient = null;
+ }
+ if (discordRichPresence != null)
+ {
+ discordRichPresence = null;
+ }
+ if (discordLogger != null)
+ {
+ discordLogger = null;
+ }
+ if (interiorPool != null)
+ {
+ interiorPool = null;
+ }
+ if (wheelieStoppieWatch != null)
+ {
+ wheelieStoppieWatch.Stop();
+ wheelieStoppieWatch = null;
+ }
+ }
+ private void Main_Initialized(object sender, EventArgs e)
+ {
+ // Load stuff
+ ModSettings.Load(Settings);
+ LoadEpisodeInfo();
+ LoadPredefinedLocations();
+ LoadRadioStationInfo();
+ LoadCustomInteriors();
+
+ // Init Discord logger
+ discordLogger = new DiscordLogger();
+
+#if DEBUG
+ discordLogger.Level = DiscordRPC.Logging.LogLevel.Trace;
+#else
+ discordLogger.Level = DiscordRPC.Logging.LogLevel.None;
+#endif
+
+ // Init Discord client
+ discordRpcClient = new DiscordRpcClient("888450942394056704", -1, discordLogger, false, null);
+ discordRpcClient.OnReady += DiscordRpcClient_OnReady;
+ discordRpcClient.OnConnectionFailed += DiscordRpcClient_OnConnectionFailed;
+ discordRpcClient.OnError += DiscordRpcClient_OnError;
+ discordRpcClient.SkipIdenticalPresence = true;
+ discordRpcClient.Initialize();
+
+ // Create rich presence object
+ discordRichPresence = new RichPresence();
+ }
+
+ private object Main_ScriptCommandReceived(Script fromScript, object[] args, string command)
+ {
+ if (!isDiscordReady)
+ return null;
+ if (discordRpcClient == null)
+ return null;
+ if (!discordRpcClient.IsInitialized)
+ return null;
+ if (discordRpcClient.CurrentUser == null)
+ return null;
+
+ switch (command)
+ {
+ case "SET_CUSTOM_PRESENCE":
+
+ if (fromScript == null)
+ return false;
+ if (!ModSettings.AllowOtherModsToSetPresence)
+ return false;
+
+ string details = Convert.ToString(args[0]);
+ string state = Convert.ToString(args[1]);
+
+ idOfScriptWhichSetCustomPresence = fromScript.ID;
+
+ customRichPresence = new RichPresence()
+ {
+ Details = details,
+ State = state,
+ };
+
+ return true;
+ case "CLEAR_CUSTOM_PRESENCE":
+ idOfScriptWhichSetCustomPresence = Guid.Empty;
+ customRichPresence = null;
+ break;
+ case "WAS_CUSTOM_PRESENCE_SET": return idOfScriptWhichSetCustomPresence != Guid.Empty && customRichPresence != null;
+
+ case "GET_CURRENT_DISCORD_USER_NAME": return discordRpcClient.CurrentUser.Username;
+ case "GET_CURRENT_DISCORD_USER_DISPLAY_NAME": return discordRpcClient.CurrentUser.DisplayName;
+ case "GET_CURRENT_DISCORD_USER_AVATAR_URL":
+ {
+ User.AvatarFormat format = (User.AvatarFormat)Convert.ToInt32(args[0]);
+ User.AvatarSize size = (User.AvatarSize)Convert.ToInt32(args[1]);
+
+ return discordRpcClient.CurrentUser.GetAvatarURL(format, size);
+ }
+ }
+
+ return null;
+ }
+
+ private void Main_Drawing(object sender, EventArgs e)
+ {
+ discordRpcClient.Invoke();
+ }
+ private void Main_OnImGuiRendering(IntPtr devicePtr, ImGuiIV_DrawingContext ctx)
+ {
+ DebugWindow();
+ MainWindow();
+ }
+ private void DebugWindow()
+ {
+#if DEBUG
+ if (!DebuggingWindowOpen)
+ return;
+
+ if (ImGuiIV.Begin("IV-Presence Debug", ref DebuggingWindowOpen, eImGuiWindowFlags.None, eImGuiWindowFlagsEx.NoMouseEnable))
+ {
+ ImGuiIV.TextDisabled("States");
+ ImGuiIV.TextUnformatted("wantedBlinkState: {0}", wantedBlinkState);
+ ImGuiIV.TextUnformatted("currentTextState: {0} (Mod by 2: {1})", currentTextState, (int)currentTextState % 2);
+
+ ImGuiIV.Spacing(2);
+ ImGuiIV.TextDisabled("Player");
+ ImGuiIV.TextUnformatted("IsInAir: {0}", playerIsInAir);
+ ImGuiIV.TextUnformatted("IsSwimming: {0}", playerSwimming);
+ ImGuiIV.TextUnformatted("CauseOfDeath: {0}", causeOfDeath);
+ ImGuiIV.TextUnformatted("Current Zone: {0}", currentZoneDisplayName);
+ ImGuiIV.TextUnformatted("Current Zone Raw: {0}", currentZoneRawName);
+ ImGuiIV.TextUnformatted("Current Predefined Loc: {0}", currentPredefinedLocation);
+ ImGuiIV.TextUnformatted("Current Interior ModelIndex: {0} (Raw: {1})", GetCurrentInteriorModelIndex(), playerInterior);
+
+ ImGuiIV.Spacing(2);
+ ImGuiIV.TextDisabled("Radio");
+ ImGuiIV.TextUnformatted("currentRadioStationName: {0}", currentRadioStationName);
+ }
+ ImGuiIV.End();
+#endif
+ }
+ private void MainWindow()
+ {
+ if (!MenuOpened)
+ return;
+
+ if (ImGuiIV.Begin("IV-Presence", ref MenuOpened))
+ {
+ if (ImGuiIV.BeginTabBar("##IVPresenceTabBar"))
+ {
+
+ SettingsTab();
+ EpisodeInfoTab();
+ RadioStationsTab();
+ PredefinedLocationsTab();
+ CustomInteriorsTab();
+
+ ImGuiIV.EndTabBar();
+ }
+ }
+ ImGuiIV.End();
+ }
+ private void SettingsTab()
+ {
+ if (ImGuiIV.BeginTabItem("Settings##IVPresence"))
+ {
+ if (ImGuiIV.Button("Reload Settings"))
+ {
+ if (Settings.Load())
+ {
+ ModSettings.Load(Settings);
+ Logging.Log("Settings file of IV-Presence was reloaded!");
+ }
+ else
+ {
+ Logging.LogWarning("Could not reload the settings file of IV-Presence! File might not exists.");
+ }
+ }
+
+ ImGuiIV.Spacing();
+ ImGuiIV.SeparatorText("The Settings");
+
+ ImGuiIV.TextUnformatted("General");
+ ImGuiIV.CheckBox("LogErrorsToConsole", ref ModSettings.LogErrorsToConsole);
+ ImGuiIV.CheckBox("AllowOtherModsToSetPresence", ref ModSettings.AllowOtherModsToSetPresence);
+ ImGuiIV.CheckBox("ShowPresenceOfOtherMods", ref ModSettings.ShowPresenceOfOtherMods);
+
+ ImGuiIV.Spacing(2);
+ ImGuiIV.TextUnformatted("Credits");
+ ImGuiIV.CheckBox("ShowStatistics", ref ModSettings.ShowStatistics);
+
+ ImGuiIV.Spacing(2);
+ ImGuiIV.TextUnformatted("Network");
+ ImGuiIV.CheckBox("ShowNetworkKillerName", ref ModSettings.ShowNetworkKillerName);
+
+ ImGuiIV.EndTabItem();
+ }
+ }
+ private void EpisodeInfoTab()
+ {
+ if (ImGuiIV.BeginTabItem("Episode Info"))
+ {
+ ImGuiIV.SeparatorText("Control");
+ if (ImGuiIV.Button("Save"))
+ {
+ SaveEpisodeInfo();
+ }
+ ImGuiIV.SameLine();
+ if (ImGuiIV.Button("Load"))
+ {
+ LoadEpisodeInfo();
+ }
+
+ ImGuiIV.Spacing(3);
+ ImGuiIV.SeparatorText("Items");
+ if (ImGuiIV.Button("Add new"))
+ {
+ episodeInfos.Add(new EpisodeInfo());
+ }
+ ImGuiIV.TextDisabled("Loaded {0} episode info items", episodeInfos.Count);
+
+ for (int i = 0; i < episodeInfos.Count; i++)
+ {
+ EpisodeInfo episodeInfo = episodeInfos[i];
+
+ if (ImGuiIV.TreeNode(string.Format("{0}##IVPresenceEpisodeInfoNode", i)))
+ {
+ ImGuiIV.SeparatorText("Control");
+ if (ImGuiIV.Button("Delete"))
+ {
+ episodeInfos.RemoveAt(i);
+ i--;
+ ImGuiIV.TreePop();
+ continue;
+ }
+
+ ImGuiIV.SeparatorText("Details");
+ ImGuiIV.SliderInt("ID", ref episodeInfo.ID, 0, 255);
+ ImGuiIV.CheckBox("IsBaseEpisode", ref episodeInfo.IsBaseEpisode);
+ ImGuiIV.InputText("ProtagonistName", ref episodeInfo.ProtagonistName);
+ ImGuiIV.InputText("ProtagonistImageKey", ref episodeInfo.ProtagonistImageKey);
+
+ ImGuiIV.TreePop();
+ }
+ }
+
+ ImGuiIV.EndTabItem();
+ }
+ }
+ private void RadioStationsTab()
+ {
+ if (ImGuiIV.BeginTabItem("Radio Stations"))
+ {
+ ImGuiIV.SeparatorText("Control");
+ if (ImGuiIV.Button("Save"))
+ {
+ SaveRadioStationInfo();
+ }
+ ImGuiIV.SameLine();
+ if (ImGuiIV.Button("Load"))
+ {
+ LoadRadioStationInfo();
+ }
+
+ ImGuiIV.Spacing(3);
+ ImGuiIV.SeparatorText("Items");
+ if (ImGuiIV.Button("Create new"))
+ {
+ radioStationInfos.Add(new RadioInfo());
+ }
+ ImGuiIV.TextDisabled("Loaded {0} radio station items", radioStationInfos.Count);
+
+ for (int i = 0; i < radioStationInfos.Count; i++)
+ {
+ RadioInfo radioInfo = radioStationInfos[i];
+
+ if (ImGuiIV.TreeNode(string.Format("{0}##IVPresenceRadioStationsNode", i)))
+ {
+ ImGuiIV.SeparatorText("Control");
+ if (ImGuiIV.Button("Delete"))
+ {
+ radioStationInfos.RemoveAt(i);
+ i--;
+ ImGuiIV.TreePop();
+ continue;
+ }
+
+ ImGuiIV.SeparatorText("Details");
+ ImGuiIV.InputText("RawName", ref radioInfo.RawName);
+ ImGuiIV.InputText("DisplayName", ref radioInfo.DisplayName);
+
+ ImGuiIV.TreePop();
+ }
+ }
+
+ ImGuiIV.EndTabItem();
+ }
+ }
+ private void PredefinedLocationsTab()
+ {
+ if (ImGuiIV.BeginTabItem("Predefined Locations"))
+ {
+ ImGuiIV.SeparatorText("Control");
+ if (ImGuiIV.Button("Save"))
+ {
+ SavePredefinedLocations();
+ }
+ ImGuiIV.SameLine();
+ if (ImGuiIV.Button("Load"))
+ {
+ LoadPredefinedLocations();
+ }
+
+ ImGuiIV.Spacing(3);
+ ImGuiIV.SeparatorText("Items");
+ if (ImGuiIV.Button("Add new"))
+ {
+ predefinedLocations.Add(new PredefinedLocations());
+ }
+ ImGuiIV.TextDisabled("Loaded {0} predefined locations items", predefinedLocations.Count);
+
+ for (int i = 0; i < predefinedLocations.Count; i++)
+ {
+ PredefinedLocations predefinedLocation = predefinedLocations[i];
+
+ if (ImGuiIV.TreeNode(string.Format("{0}##IVPresencePredefinedLocationsNode", i)))
+ {
+ ImGuiIV.SeparatorText("Control");
+ if (ImGuiIV.Button("Delete"))
+ {
+ predefinedLocations.RemoveAt(i);
+ i--;
+ ImGuiIV.TreePop();
+ continue;
+ }
+
+ ImGuiIV.SeparatorText("Details");
+ ImGuiIV.InputText("ID", ref predefinedLocation.ID);
+
+ if (predefinedLocation.RangeTrigger != null)
+ {
+ if (ImGuiIV.TreeNode(string.Format("RangeTrigger##IVPresencePredefinedLocationsNode")))
+ {
+ if (ImGuiIV.Button("Delete"))
+ {
+ predefinedLocation.RangeTrigger = null;
+ }
+ else
+ {
+ if (ImGuiIV.Button("Set to current pos"))
+ {
+ predefinedLocation.RangeTrigger.Position = playerPos;
+ }
+ ImGuiIV.SameLine();
+ ImGuiIV.DragFloat3("Position", ref predefinedLocation.RangeTrigger.Position);
+ ImGuiIV.DragFloat("Range", ref predefinedLocation.RangeTrigger.Range);
+ }
+
+ ImGuiIV.TreePop();
+ }
+ }
+ else
+ {
+ if (ImGuiIV.Button("Add range trigger"))
+ {
+ predefinedLocation.RangeTrigger = new TriggerRange();
+ }
+ }
+ if (predefinedLocation.CustomRichPresence != null)
+ {
+ if (ImGuiIV.TreeNode(string.Format("CustomRichPresence##IVPresencePredefinedLocationsNode")))
+ {
+ if (ImGuiIV.Button("Delete"))
+ {
+ predefinedLocation.CustomRichPresence = null;
+ }
+ else
+ {
+ ImGuiIV.InputText("LargeImageKey", ref predefinedLocation.CustomRichPresence.LargeImageKey);
+ ImGuiIV.InputText("LargeImageText", ref predefinedLocation.CustomRichPresence.LargeImageText);
+ }
+
+ ImGuiIV.TreePop();
+ }
+ }
+ else
+ {
+ if (ImGuiIV.Button("Add custom rich presence"))
+ {
+ predefinedLocation.CustomRichPresence = new CustomRichPresence();
+ }
+ }
+
+ ImGuiIV.TreePop();
+ }
+ }
+
+ ImGuiIV.EndTabItem();
+ }
+ }
+ private void CustomInteriorsTab()
+ {
+ if (ImGuiIV.BeginTabItem("Custom Interiors"))
+ {
+ ImGuiIV.SeparatorText("Control");
+ if (ImGuiIV.Button("Save"))
+ {
+ SaveCustomInteriors();
+ }
+ ImGuiIV.SameLine();
+ if (ImGuiIV.Button("Load"))
+ {
+ LoadCustomInteriors();
+ }
+
+ ImGuiIV.Spacing(3);
+ ImGuiIV.SeparatorText("Items");
+ if (ImGuiIV.Button("Add new"))
+ {
+ customInteriors.Add(new CustomInterior());
+ }
+ ImGuiIV.TextDisabled("Loaded {0} custom interior items", customInteriors.Count);
+
+ for (int i = 0; i < customInteriors.Count; i++)
+ {
+ CustomInterior customInterior = customInteriors[i];
+
+ if (ImGuiIV.TreeNode(string.Format("{0}##IVPresenceCustomInteriors", i)))
+ {
+ ImGuiIV.SeparatorText("Control");
+ if (ImGuiIV.Button("Delete"))
+ {
+ customInteriors.RemoveAt(i);
+ i--;
+ ImGuiIV.TreePop();
+ continue;
+ }
+
+ ImGuiIV.SeparatorText("Details");
+ if (ImGuiIV.Button("Set to current interior"))
+ {
+ if (playerInterior != 0)
+ {
+ UIntPtr ptr = interiorPool.GetAt((uint)playerInterior);
+
+ if (ptr != UIntPtr.Zero)
+ {
+ IVEntity ent = IVInteriorInst.FromUIntPtr(ptr);
+ customInterior.ModelIndex = ent.ModelIndex;
+ }
+ }
+ }
+ ImGuiIV.SameLine();
+ ImGuiIV.SliderInt("ModelIndex", ref customInterior.ModelIndex, 0, short.MaxValue);
+ ImGuiIV.InputText("LargeImageKey", ref customInterior.LargeImageKey);
+ ImGuiIV.InputText("DisplayName", ref customInterior.DisplayName);
+ ImGuiIV.InputText("CustomDetailPresence", ref customInterior.CustomDetailPresence);
+
+ ImGuiIV.TreePop();
+ }
+ }
+
+ ImGuiIV.EndTabItem();
+ }
+ }
+
+ private void Main_Tick(object sender, EventArgs e)
+ {
+ if (!isDiscordReady)
+ return;
+ if (isAltTabbed)
+ return;
+
+ // Get pools
+ if (interiorPool == null)
+ interiorPool = IVPools.GetInteriorInstPool();
+
+ // Get player stuff
+ playerId = GET_PLAYER_ID();
+ playerIndex = CONVERT_INT_TO_PLAYERINDEX(playerId);
+ GET_PLAYER_CHAR(playerIndex, out playerHandle);
+ GET_CHAR_COORDINATES(playerHandle, out playerPos);
+ GET_CHAR_HEALTH(playerHandle, out playerHealth);
+ GET_CHAR_ARMOUR(playerHandle, out playerArmour);
+ GET_INTERIOR_FROM_CHAR(playerHandle, out playerInterior);
+ playerDead = IS_CHAR_DEAD(playerHandle);
+ playerIsInAir = IS_CHAR_IN_AIR(playerHandle);
+ playerSwimming = IS_CHAR_SWIMMING(playerHandle);
+ playerInAnyCar = IS_CHAR_IN_ANY_CAR(playerHandle);
+ playerPerformingWheelie = IS_PLAYER_PERFORMING_WHEELIE((int)playerId);
+ playerPerformingStoppie = IS_PLAYER_PERFORMING_STOPPIE((int)playerId);
+ STORE_SCORE(playerIndex, out currentScore);
+ STORE_WANTED_LEVEL(playerIndex, out currentWantedLevel);
+ currentRadioStationName = GET_PLAYER_RADIO_STATION_NAME();
+ currentZoneRawName = GET_NAME_OF_ZONE(playerPos);
+ currentZoneDisplayName = GET_STRING_FROM_TEXT_FILE(currentZoneRawName);
+
+ // Check if performing wheelie/stoppie and measure time
+ bool holdingWheelieKey = false;
+ bool holdingStoppieKey = false;
+
+ if (IS_USING_CONTROLLER())
+ {
+ holdingWheelieKey = ImGuiIV.IsKeyDown(eImGuiKey.ImGuiKey_GamepadLStickDown);
+ holdingStoppieKey = ImGuiIV.IsKeyDown(eImGuiKey.ImGuiKey_GamepadLStickUp);
+ }
+ else
+ {
+ holdingWheelieKey = ImGuiIV.IsKeyDown(eImGuiKey.ImGuiKey_LeftCtrl);
+ holdingStoppieKey = ImGuiIV.IsKeyDown(eImGuiKey.ImGuiKey_LeftShift);
+ }
+
+ if ((playerPerformingWheelie && holdingWheelieKey) || (playerPerformingStoppie && holdingStoppieKey))
+ {
+ // Start time measurement
+ if (!wheelieStoppieWatch.IsRunning)
+ wheelieStoppieWatch.Restart();
+ }
+ else
+ {
+ // Stop time measurement
+ wheelieStoppieWatch.Stop();
+ }
+
+ // Check cause of death
+ if (playerDead)
+ {
+ CheckCauseOfDeath();
+ }
+ else
+ {
+ checkedForCauseOfDeath = false;
+ causeOfDeath = CauseOfDeath.Unknown;
+ }
+
+ // We get the current weapon after we checked the cause of death because the player drops the weapon on death so we will never get the "FightingCops" death cause
+ GET_CURRENT_CHAR_WEAPON(playerHandle, out currentPlayerWeapon);
+
+ // Set rich presence
+ if (!discordRichPresence.HasAssets())
+ discordRichPresence.Assets = new Assets();
+
+ SetLargeImageStuff();
+
+ if (!IVNetwork.IsNetworkSession())
+ SetSingleplayerStuff();
+ else
+ SetNetworkStuff();
+
+ SetDetailsAndState();
+
+ // WORKS!!!
+ //discordRichPresence.Assets.LargeImageKey = "https://media.istockphoto.com/id/157030584/vector/thumb-up-emoticon.jpg?s=612x612&w=0&k=20&c=GGl4NM_6_BzvJxLSl7uCDF4Vlo_zHGZVmmqOBIewgKg=";
+
+ // Update rich presence
+ discordRpcClient.SetPresence(discordRichPresence);
+ }
+
+ }
+}
diff --git a/IVPresence/Properties/AssemblyInfo.cs b/IVPresence/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..2ac3033
--- /dev/null
+++ b/IVPresence/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("IVPresence")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("ItsClonkAndre")]
+[assembly: AssemblyProduct("IVPresence")]
+[assembly: AssemblyCopyright("Copyright © ItsClonkAndre 2024-2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("15748350-d229-4bca-9a68-784d0f0ef350")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.5.0.*")]
+//[assembly: AssemblyFileVersion("0.1.0.0")]
diff --git a/IVPresence/packages.config b/IVPresence/packages.config
new file mode 100644
index 0000000..e9483d6
--- /dev/null
+++ b/IVPresence/packages.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 30ce0b5..e62ec04 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,21 +1,674 @@
-MIT License
-
-Copyright (c) 2021 E. S.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/README.md b/README.md
index 2983f43..df16710 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,17 @@
# IV-Presence
-This mod allows you to share your actions from GTA IV to everyone via Discord's Rich Presence feature.
+IV-Presence is an innovative modification for GTA IV that integrates Discord Rich Presence, allowing your friends on Discord to see real-time details about your adventures in Liberty City!
+Immerse yourself in the game while showcasing your activities with dynamic updates on your Discord profile.
-## Requirements
-- GTA IV 1040, 1070 or 1080
-- ASI Loader
+## Features
+- **Dynamic Activity Updates**: Displays your current location, vehicle (including speed), radio station, and whether you’re on a mission or watching a cutscene.
+- **Interior Details**: Shows what type of building you're in, such as a bar, safe house, or clothing store.
+- **Multiplayer Support**: Highlights key multiplayer stats, including the game mode and your killer’s name if you’re taken out.
+- **Customization**: Define custom locations, custom radio stations or custom interiors with personalized Rich Presence details using an intuitive ImGui menu.
+- **Mod Compatibility**: Seamlessly integrates with other mods, such as "Simple Hot Tub", to display unique activities like relaxing in a hot tub.
-## Screenshots
-You can find all screenshots here: https://imgur.com/a/S2w0Sh0
+## Requirements
+- [IV-SDK .NET](https://github.com/ClonkAndre/IV-SDK-DotNet)
+- [ClonksCodingLib.GTAIV](https://github.com/ClonkAndre/ClonksCodingLib.GTAIV)
## Other Links
GTAForums: https://gtaforums.com/topic/975850-iv-presence/
@@ -14,6 +19,6 @@ GTAInside: https://www.gtainside.com/gta4/mods/169787-iv-presence/
LCPDFR.com: https://www.lcpdfr.com/downloads/gta4mods/scripts/36402-iv-presence/
## How to Contribute
-⚠ You will need Zolika's [IV-SDK](https://github.com/Zolika1351/iv-sdk) in order to contribute on this mod. (IV-SDK only supports GTA IV 1070 and 1080. The 1040 version was built using a private SDK)
+⚠ [IV-SDK](https://github.com/Zolika1351/iv-sdk) is needed in order to contribute to pre 1.5 versions of this mod. (IV-SDK only supports GTA IV 1070 and 1080. The 1040 version was built using a private SDK)
Do you have an idea to improve this mod, or did you happen to run into a bug? Please share your idea or the bug you found in the [issues](https://github.com/ClonkAndre/IV-Presence/issues) page, or even better: feel free to fork and contribute to this project with a [Pull Request](https://github.com/ClonkAndre/IV-Presence/pulls).
diff --git a/IV-Presence/IV-Presence.sln b/v1.4.1 - ASI/IV-Presence/IV-Presence.sln
similarity index 100%
rename from IV-Presence/IV-Presence.sln
rename to v1.4.1 - ASI/IV-Presence/IV-Presence.sln
diff --git a/IV-Presence/IV-Presence.vcxproj b/v1.4.1 - ASI/IV-Presence/IV-Presence.vcxproj
similarity index 100%
rename from IV-Presence/IV-Presence.vcxproj
rename to v1.4.1 - ASI/IV-Presence/IV-Presence.vcxproj
diff --git a/IV-Presence/IV-Presence.vcxproj.filters b/v1.4.1 - ASI/IV-Presence/IV-Presence.vcxproj.filters
similarity index 100%
rename from IV-Presence/IV-Presence.vcxproj.filters
rename to v1.4.1 - ASI/IV-Presence/IV-Presence.vcxproj.filters
diff --git a/IV-Presence/discord-rpc.lib b/v1.4.1 - ASI/IV-Presence/discord-rpc.lib
similarity index 100%
rename from IV-Presence/discord-rpc.lib
rename to v1.4.1 - ASI/IV-Presence/discord-rpc.lib
diff --git a/IV-Presence/discord_register.h b/v1.4.1 - ASI/IV-Presence/discord_register.h
similarity index 100%
rename from IV-Presence/discord_register.h
rename to v1.4.1 - ASI/IV-Presence/discord_register.h
diff --git a/IV-Presence/discord_rpc.h b/v1.4.1 - ASI/IV-Presence/discord_rpc.h
similarity index 100%
rename from IV-Presence/discord_rpc.h
rename to v1.4.1 - ASI/IV-Presence/discord_rpc.h
diff --git a/IV-Presence/dllmain.cpp b/v1.4.1 - ASI/IV-Presence/dllmain.cpp
similarity index 100%
rename from IV-Presence/dllmain.cpp
rename to v1.4.1 - ASI/IV-Presence/dllmain.cpp