Skip to content

Commit

Permalink
Merge pull request #3 from ClonkAndre/dev
Browse files Browse the repository at this point in the history
Move dev into main
  • Loading branch information
ClonkAndre authored Dec 2, 2024
2 parents 5fa153b + 6eef71f commit 5e1fc12
Show file tree
Hide file tree
Showing 26 changed files with 3,434 additions and 32 deletions.
4 changes: 0 additions & 4 deletions IV-Presence/IV-Presence.vcxproj.user

This file was deleted.

62 changes: 62 additions & 0 deletions IVPresence/Classes/DiscordLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;

using DiscordRPC.Logging;

namespace IVPresence.Classes
{
internal class DiscordLogger : ILogger
{

#region Properties
/// <summary>
/// The level of logging to apply to this logger.
/// </summary>
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);
}
}

}
}
21 changes: 21 additions & 0 deletions IVPresence/Classes/Json/CustomInterior.cs
Original file line number Diff line number Diff line change
@@ -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

}
}
19 changes: 19 additions & 0 deletions IVPresence/Classes/Json/CustomRichPresence.cs
Original file line number Diff line number Diff line change
@@ -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

}
}
21 changes: 21 additions & 0 deletions IVPresence/Classes/Json/EpisodeInfo.cs
Original file line number Diff line number Diff line change
@@ -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

}
}
49 changes: 49 additions & 0 deletions IVPresence/Classes/Json/PredefinedLocations.cs
Original file line number Diff line number Diff line change
@@ -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
/// <summary>
/// A constructor which sets up this <see cref="PredefinedLocations"/> for a <see cref="TriggerRange"/>.
/// </summary>
/// <param name="id">Just an indentifier for this location so its easier to debug.</param>
/// <param name="pos">The target position.</param>
/// <param name="triggerRange">The target range around the given position.</param>
public PredefinedLocations(string id, Vector3 pos, float triggerRange)
{
ID = id;
RangeTrigger = new TriggerRange(pos, triggerRange);
}
///// <summary>
///// A constructor which sets up this <see cref="PredefinedLocations"/> for a <see cref="TriggerBox"/>.
///// </summary>
///// <param name="id">Just an indentifier for this location so its easier to debug.</param>
///// <param name="pos1">The upper-left position for a 3D box.</param>
///// <param name="pos2">The lower-right position for a 3D box.</param>
//public PredefinedLocations(string id, Vector3 pos1, Vector3 pos2)
//{
// ID = id;
// BoxTrigger = new TriggerBox(pos1, pos2);
//}
/// <summary>
/// Default constructor.
/// </summary>
public PredefinedLocations()
{

}
#endregion

}
}
19 changes: 19 additions & 0 deletions IVPresence/Classes/Json/RadioInfo.cs
Original file line number Diff line number Diff line change
@@ -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

}
}
26 changes: 26 additions & 0 deletions IVPresence/Classes/Json/TriggerBox.cs
Original file line number Diff line number Diff line change
@@ -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

}
}
26 changes: 26 additions & 0 deletions IVPresence/Classes/Json/TriggerRange.cs
Original file line number Diff line number Diff line change
@@ -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

}
}
29 changes: 29 additions & 0 deletions IVPresence/Classes/Logging.cs
Original file line number Diff line number Diff line change
@@ -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
}

}
}
36 changes: 36 additions & 0 deletions IVPresence/Classes/ModSettings.cs
Original file line number Diff line number Diff line change
@@ -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);
}

}
}
44 changes: 44 additions & 0 deletions IVPresence/Enums.cs
Original file line number Diff line number Diff line change
@@ -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
}

}
Loading

0 comments on commit 5e1fc12

Please sign in to comment.