Skip to content

Commit

Permalink
[PvELeaderboard] Added a new VMod: PvE leaderboard
Browse files Browse the repository at this point in the history
WhiteFang5 committed Aug 7, 2022

Verified

This commit was signed with the committer’s verified signature.
AcidWeb Paweł Jastrzębski
1 parent 30f0727 commit d34cc81
Showing 15 changed files with 1,303 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -63,3 +63,7 @@

### v1.0.0
* Initial release

## PvE Leaderboard
### v1.0.0
* Initial release
24 changes: 24 additions & 0 deletions PvELeaderboard/Configs/PvELeaderboardConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using BepInEx.Configuration;

namespace VMods.PvELeaderboard
{
public static class PvELeaderboardConfig
{
#region Properties

public static ConfigEntry<bool> PvELeaderboardEnabled { get; private set; }
public static ConfigEntry<int> PvELeaderboardLevelDifference { get; private set; }

#endregion

#region Public Methods

public static void Initialize(ConfigFile config)
{
PvELeaderboardEnabled = config.Bind(nameof(PvELeaderboardConfig), nameof(PvELeaderboardEnabled), false, "Enabled/disable the PvE Leaderboard system.");
PvELeaderboardLevelDifference = config.Bind(nameof(PvELeaderboardConfig), nameof(PvELeaderboardLevelDifference), 10, "The level difference at which the K/D isn't counting anymore for the leaderboard.");
}

#endregion
}
}
64 changes: 64 additions & 0 deletions PvELeaderboard/Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using BepInEx;
using BepInEx.IL2CPP;
using HarmonyLib;
using System.Reflection;
using VMods.Shared;
using Wetstone.API;

namespace VMods.PvELeaderboard
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency("xyz.molenzwiebel.wetstone")]
[Reloadable]
public class Plugin : BasePlugin
{
#region Variables

private Harmony _hooks;

#endregion

#region Public Methods

public sealed override void Load()
{
if(VWorld.IsClient)
{
Log.LogMessage($"{PluginInfo.PLUGIN_NAME} only needs to be installed server side.");
return;
}
Utils.Initialize(Log, PluginInfo.PLUGIN_NAME);

CommandSystemConfig.Initialize(Config);
HighestGearScoreSystemConfig.Initialize(Config);
PvELeaderboardConfig.Initialize(Config);

CommandSystem.Initialize();
HighestGearScoreSystem.Initialize();
PvELeaderboardSystem.Initialize();

_hooks = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly());

Log.LogInfo($"Plugin {PluginInfo.PLUGIN_NAME} (v{PluginInfo.PLUGIN_VERSION}) is loaded!");
}

public sealed override bool Unload()
{
if(VWorld.IsClient)
{
return true;
}
VModStorage.SaveAll();

_hooks?.UnpatchSelf();
PvELeaderboardSystem.Deinitialize();
HighestGearScoreSystem.Deinitialize();
CommandSystem.Deinitialize();
Config.Clear();
Utils.Deinitialize();
return true;
}

#endregion
}
}
Loading

0 comments on commit d34cc81

Please sign in to comment.