forked from WhiteFang5/VMods
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PvELeaderboard] Added a new VMod: PvE leaderboard
- Loading branch information
1 parent
30f0727
commit d34cc81
Showing
15 changed files
with
1,303 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
Oops, something went wrong.