Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #7 from VT-DevGiT/devlopement
Browse files Browse the repository at this point in the history
AutoUpdater
  • Loading branch information
warquys authored Jun 14, 2022
2 parents 63603c9 + ed74a6a commit a2e4002
Show file tree
Hide file tree
Showing 51 changed files with 720 additions and 317 deletions.
16 changes: 8 additions & 8 deletions Exemple-Plugin/Exemple-Plugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@
<HintPath>..\packages\Lib.Harmony.2.2.1\lib\net48\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.9.0\lib\net472\Assembly-CSharp.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.9.0\lib\net472\Assembly-CSharp-firstpass.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="LiteDB, Version=5.0.11.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.11\lib\net45\LiteDB.dll</HintPath>
</Reference>
<Reference Include="Mirror, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.9.0\lib\net472\Mirror.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\Mirror.dll</HintPath>
</Reference>
<Reference Include="Synapse, Version=2.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.9.0\lib\net472\Synapse.dll</HintPath>
<Reference Include="Synapse, Version=2.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\Synapse.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -59,13 +59,13 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.9.0\lib\net472\UnityEngine.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.9.0\lib\net472\UnityEngine.CoreModule.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.9.0\lib\net472\UnityEngine.PhysicsModule.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="YamlDotNet, Version=11.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.11.2.1\lib\net45\YamlDotNet.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion Exemple-Plugin/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<packages>
<package id="Lib.Harmony" version="2.2.1" targetFramework="net48" />
<package id="LiteDB" version="5.0.11" targetFramework="net48" />
<package id="SynapseSL" version="2.9.0" targetFramework="net48" />
<package id="SynapseSL" version="2.10.0" targetFramework="net48" />
<package id="YamlDotNet" version="11.2.1" targetFramework="net48" />
</packages>
6 changes: 4 additions & 2 deletions VT-Api/Config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ internal void Init()
NotANumber = "Das Argument muss eine Zahl sein. Beispiel : 1",
RankOver = "GIB ANWEISUNGEN",
RankSame = "GLEICHER RANG",
RankUnder = "FOLGE ANWEISUNGEN"
RankUnder = "FOLGE ANWEISUNGEN",
DefaultDeathMessage = "Du wurdest gertöet von\\n%PlayerName%\\nals\\n%RoleName%"
}, "GERMAN");
VtTranslation.AddTranslation(new VtApiTranslation
{
NoPower = "Tu n'as aucun pouvoir",
NotANumber = "L'argument doit être un nombre. Exemple : 1",
RankOver = "VOUS POUVEZ LUI DONNER DES ORDRES",
RankSame = "MÊME NIVEAU D'ACCRÉDITATION",
RankUnder = "SUIVEZ SES ORDRES"
RankUnder = "SUIVEZ SES ORDRES",
DefaultDeathMessage = "Vous avez été tué par:\\n%PlayerName%\\nen tent que:\\n%RoleName%"

}, "FRENCH");

Expand Down
4 changes: 2 additions & 2 deletions VT-Api/Config/VtApiConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace VT_Api.Config
{
public class VtApiConfiguration : AbstractConfigSection
{
[Description("Juste a stupide Test ¯\\_(ツ)_/¯ ")]
public bool Train { get; set; } = true;
[Description("If active then the plugins and the api this metron is up to date on its own")]
public bool AutoUpdate { get; set; } = true;

}
}
13 changes: 8 additions & 5 deletions VT-Api/Config/VtApiTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ namespace VT_Api.Config
public class VtApiTranslation : IPluginTranslation
{
[Description("Message returned when a player has no power for their role")]
public string NoPower = "You don't have any power";
public string NotANumber = "The argument must be a number. exemple : 1";
public string NoPower { get; set; } = "You don't have any power";
public string NotANumber { get; set; } = "The argument must be a number. exemple : 1";

[Description("The info about levels of accreditation")]
public string RankOver = "GIVE ORDERS";
public string RankSame = "SAME RANK";
public string RankUnder = "FOLLOW ORDERS";
public string RankOver { get; set; } = "GIVE ORDERS";
public string RankSame { get; set; } = "SAME RANK";
public string RankUnder { get; set; } = "FOLLOW ORDERS";

[Description("The death message when you are kill by a custom class of the VT-API")]
public string DefaultDeathMessage { get; set; } = "You were killed by\\n%PlayerName%\\nas\\n%RoleName%";
}
}
2 changes: 2 additions & 0 deletions VT-Api/Core/Behaviour/Display.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,13 @@ public string BuildCustomInfo()
displayWhitHierachy += Config.Config.Get.VtTranslation.ActiveTranslation.RankSame;
}
NetworkLiar.Get.SendDisplayInfo(Player, displayWhitHierachy, new List<Player>() { player });
NetworkLiar.Get.SebdInfoToDisplay(Player, PlayerInfoArea.CustomInfo, Server.Get.Players);
}
}
else
{
NetworkLiar.Get.SendDisplayInfo(Player, display, Server.Get.Players);
NetworkLiar.Get.SebdInfoToDisplay(Player, PlayerInfoArea.CustomInfo, Server.Get.Players);
}
}
#endregion
Expand Down
18 changes: 14 additions & 4 deletions VT-Api/Core/Behaviour/RepeatingBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ public RepeatingBehaviour() : base() { }
#region Methods
public override void Kill()
{
OnDisable();
base.Kill();
try
{
OnDisable();
base.Kill();
}
catch (Exception e)
{
Synapse.Api.Logger.Get.Error($"Vt-Event: RepeatingBehaviour kill faild!!\n{e}\nStackTrace:\n{e.StackTrace}");
}
}

/// <summary>
Expand Down Expand Up @@ -64,8 +71,11 @@ private void ActionExecute()

private void ActionStop()
{
_Started = false;
CancelInvoke("BehaviourAction");
if (_Started)
{
CancelInvoke("BehaviourAction");
_Started = false;
}
}
#endregion
}
Expand Down
1 change: 1 addition & 0 deletions VT-Api/Core/Behaviour/RoundBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public virtual void Kill()
{
try
{
Server.Get.Events.Round.RoundRestartEvent -= Kill;
Destroy(this);
}
catch (Exception e)
Expand Down
4 changes: 2 additions & 2 deletions VT-Api/Core/Command/CommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ public class CommandHandler

internal void Init()
{
RegisterVtCommands();
Synapse.Api.Events.EventHandler.Get.Round.WaitingForPlayersEvent += RegisterSubCommand;

RegisterVtCommands();
}

public static CommandHandler Get { get => VtController.Get.Commands; }
Expand Down Expand Up @@ -101,6 +100,7 @@ private void RegisterVtCommands()
{
if (!_firstLoad)
return;
Logger.Get.Info("Register Command");

RegisterSynapseCommand(new CallPower(), false);
}
Expand Down
2 changes: 1 addition & 1 deletion VT-Api/Core/Command/Commands/CallPower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace VT_Api.Core.Command.Commands
Description = "Call the power of your role",
Usage = "no argument if you want to call your main power, if not add the id of the power",
Permission = "",
Platforms = new[] { Platform.RemoteAdmin, Platform.ServerConsole },
Platforms = new[] { Platform.ServerConsole },
Arguments = new[] { "(powerId)" }
)]
public class CallPower : ISynapseCommand
Expand Down
9 changes: 9 additions & 0 deletions VT-Api/Core/Enum/AudioStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace VT_Api.Core.Enum
{
public enum AudioStatus
{
Stopped,
Playing,
Paused,
}
}
4 changes: 3 additions & 1 deletion VT-Api/Core/Enum/RoleID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ public enum RoleID
/// </summary>
TestClass = 200,
/// <summary>
/// Class201 is only use for dev test or Exemple of code
/// Class 201 is only use for dev test or Exemple of code
/// </summary>
Class201 = 201,
SaphirLeader = 300,
SaphirPrivate = 301,
}
}
1 change: 1 addition & 0 deletions VT-Api/Core/Enum/TeamID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ public enum TeamID
ASI = 17,
AL1 = 18,
GOC = 19,
SAP = 20,
}
}
15 changes: 8 additions & 7 deletions VT-Api/Core/Events/EventArguments/PlayerEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ public class PlayerDamagePostEventArgs : Synapse.Api.Events.EventHandler.ISynaps
public DamageType DamageType { get; internal set; }
public bool Allow { get; set; }
}
public class PlayerDeathPostEventArgs : Synapse.Api.Events.EventHandler.ISynapseEventArgs
{
public Player Killer { get; internal set; }
public Player Victim { get; internal set; }
public DamageType DamageType { get; internal set; }
public bool Allow { get; set; }
}


public class PlayerDestroyEventArgs : Synapse.Api.Events.EventHandler.ISynapseEventArgs
{
Expand All @@ -36,11 +44,4 @@ public class PlayerSetClassAdvEventArgs : Synapse.Api.Events.EventHandler.ISynap

public RoleType Role { get; internal set; }
}

public class PlayerSetClassEventArgs : Synapse.Api.Events.EventHandler.ISynapseEventArgs
{
public Player Player { get; internal set; }
public int OldID { get; internal set; }
public int NewID { get; internal set; }
}
}
1 change: 1 addition & 0 deletions VT-Api/Core/Events/ItemEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using VT_Api.Core.Events.EventArguments;
using VT_Api.Extension;

namespace VT_Api.Core.Events
{
Expand Down
16 changes: 16 additions & 0 deletions VT-Api/Core/Events/PlayerEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal PlayerEvents() { }

#region Events
public event Synapse.Api.Events.EventHandler.OnSynapseEvent<PlayerDamagePostEventArgs> PlayerDamagePostEvent;
public event Synapse.Api.Events.EventHandler.OnSynapseEvent<PlayerDeathPostEventArgs> PlayerDeathPostEvent;
public event Synapse.Api.Events.EventHandler.OnSynapseEvent<PlayerDestroyEventArgs> PlayerUnloadEvent;
public event Synapse.Api.Events.EventHandler.OnSynapseEvent<PlayerSpeakIntercomEventEventArgs> PlayerSpeakIntercomEvent;
public event Synapse.Api.Events.EventHandler.OnSynapseEvent<PlayerSetClassAdvEventArgs> PlayerSetClassAdvEvent;
Expand All @@ -29,6 +30,21 @@ internal void InvokePlayerSetClassAdvEvent(Player player, RoleType role)
PlayerSetClassAdvEvent?.Invoke(ev);
}

internal void InvokePlayerDeathPostEvent(Player victim, Player killer, DamageType type, ref bool allow)
{
var ev = new PlayerDeathPostEventArgs
{
Allow = allow,
DamageType = type,
Killer = killer,
Victim = victim
};

PlayerDeathPostEvent?.Invoke(ev);

allow = ev.Allow;
}

internal void InvokePlayerSpeakIntercomEvent(Player player, ref bool allow)
{
var ev = new PlayerSpeakIntercomEventEventArgs
Expand Down
12 changes: 10 additions & 2 deletions VT-Api/Core/Items/ItemManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,16 @@ public IWeapon GetWeaponScript(SynapseItem item)
=> item?.ItemData[KeySynapseItemData] as IWeapon;

/// <returns><see langword="false"/> if item ave no script or if <paramref name="item"/> is <see langword="null"/> else return <see langword="true"/></returns>
public bool TryGetScript(SynapseItem item, out IItem script)
=> (script = GetScript(item)) != null;
public bool TryGetScript(SynapseItem item, out IItem script)
{
if (item?.ItemData == null || !item.ItemData.TryGetValue(KeySynapseItemData, out var data))
{
script = null;
return false;
}
script = data as IItem;
return true;
}

/// <returns><see langword="false"/> if item ave no script as a <see cref="IWeapon"> or if <paramref name="item"/> is <see langword="null"/> else return <see langword="true"/></returns>
public bool TryGetWeaponScript(SynapseItem item, out IWeapon script)
Expand Down
Loading

0 comments on commit a2e4002

Please sign in to comment.