eventargs
This commit is contained in:
parent
06a1516d6c
commit
82377c9119
|
@ -0,0 +1,23 @@
|
|||
using System.Net;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class GameServerConnectingEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// IP of incoming connection
|
||||
/// </summary>
|
||||
public IPAddress IPAddress { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to allow the connection or not.
|
||||
/// </summary>
|
||||
public bool Allow { get; set; }
|
||||
|
||||
internal GameServerConnectingEventArgs(IPAddress ipAddress)
|
||||
{
|
||||
IPAddress = ipAddress;
|
||||
Allow = true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using BattleBitAPI.Common;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class GetPlayerStatsEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The player's SteamID
|
||||
/// </summary>
|
||||
public ulong SteamID { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The player's stats (which you can modify)
|
||||
/// </summary>
|
||||
public PlayerStats PlayerStats { get; set; }
|
||||
|
||||
internal GetPlayerStatsEventArgs(ulong steamID, PlayerStats playerStats)
|
||||
{
|
||||
SteamID = steamID;
|
||||
PlayerStats = playerStats;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using BattleBitAPI.Common;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class PlayerChangedRoleEventArgs<TPlayer> where TPlayer : Player
|
||||
{
|
||||
/// <summary>
|
||||
/// The player who changed role.
|
||||
/// </summary>
|
||||
public TPlayer Player { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The new role of the player.
|
||||
/// </summary>
|
||||
public GameRole Role { get; init; }
|
||||
|
||||
internal PlayerChangedRoleEventArgs(TPlayer player, GameRole role)
|
||||
{
|
||||
Player = player;
|
||||
Role = role;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using BattleBitAPI.Common;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class PlayerChangedTeamEventArgs<TPlayer> where TPlayer : Player
|
||||
{
|
||||
/// <summary>
|
||||
/// The player who joined a team.
|
||||
/// </summary>
|
||||
public TPlayer Player { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The new team which the player joined.
|
||||
/// </summary>
|
||||
public Team Team { get; init; }
|
||||
|
||||
internal PlayerChangedTeamEventArgs(TPlayer player, Team team)
|
||||
{
|
||||
Player = player;
|
||||
Team = team;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using BattleBitAPI.Common;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class PlayerJoinedSquadEventArgs<TPlayer> where TPlayer : Player
|
||||
{
|
||||
/// <summary>
|
||||
/// The player who joined the squad.
|
||||
/// </summary>
|
||||
public TPlayer Player { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The squad the player joined.
|
||||
/// </summary>
|
||||
public Squads Squads { get; }
|
||||
|
||||
internal PlayerJoinedSquadEventArgs(TPlayer player, Squads squad)
|
||||
{
|
||||
Player = player;
|
||||
Squads = squad;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System.Numerics;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class PlayerKilledPlayerEventArgs<TPlayer> where TPlayer : Player
|
||||
{
|
||||
/// <summary>
|
||||
/// The killer.
|
||||
/// </summary>
|
||||
public TPlayer Killer { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The position of the killer.
|
||||
/// </summary>
|
||||
public Vector3 KillerPosition { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The target.
|
||||
/// </summary>
|
||||
public TPlayer Target { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The position of the target.
|
||||
/// </summary>
|
||||
public Vector3 TargetPosition { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The tool used to kill the target.
|
||||
/// </summary>
|
||||
public string Tool { get; init; }
|
||||
|
||||
internal PlayerKilledPlayerEventArgs(TPlayer killer, Vector3 killerPosition, TPlayer target, Vector3 targetPosition, string tool)
|
||||
{
|
||||
Killer = killer;
|
||||
KillerPosition = killerPosition;
|
||||
Target = target;
|
||||
TargetPosition = targetPosition;
|
||||
Tool = tool;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using BattleBitAPI.Common;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class PlayerLeftSquadEventArgs<TPlayer> where TPlayer : Player
|
||||
{
|
||||
/// <summary>
|
||||
/// The player who left the squad.
|
||||
/// </summary>
|
||||
public TPlayer Player { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The squad the player left.
|
||||
/// </summary>
|
||||
public Squads Squads { get; }
|
||||
|
||||
internal PlayerLeftSquadEventArgs(TPlayer player, Squads squad)
|
||||
{
|
||||
Player = player;
|
||||
Squads = squad;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
using BattleBitAPI.Common;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class PlayerReportedEventArgs<TPlayer> where TPlayer : Player
|
||||
{
|
||||
/// <summary>
|
||||
/// The player who made the report.
|
||||
/// </summary>
|
||||
public TPlayer Reporter { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The player being reported.
|
||||
/// </summary>
|
||||
public TPlayer Reported { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The report reason.
|
||||
/// </summary>
|
||||
public ReportReason Reason { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Additional details about the report.
|
||||
/// </summary>
|
||||
public string Detail { get; init; }
|
||||
|
||||
internal PlayerReportedEventArgs(TPlayer reporter, TPlayer reported, ReportReason reason, string detail)
|
||||
{
|
||||
Reporter = reporter;
|
||||
Reported = reported;
|
||||
Reason = reason;
|
||||
Detail = detail;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
using BattleBitAPI.Common;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class PlayerRequestingToChangeRoleEventArgs<TPlayer> where TPlayer : Player
|
||||
{
|
||||
/// <summary>
|
||||
/// The player requesting.
|
||||
/// </summary>
|
||||
public TPlayer Player { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The role the player asking to change.
|
||||
/// </summary>
|
||||
public GameRole Role { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to allow the player to change role or not.
|
||||
/// </summary>
|
||||
public bool Allow { get; set; }
|
||||
|
||||
internal PlayerRequestingToChangeRoleEventArgs(TPlayer player, GameRole role)
|
||||
{
|
||||
Player = player;
|
||||
Role = role;
|
||||
Allow = true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using BattleBitAPI.Common;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class PlayerSpawningEventArgs<TPlayer> where TPlayer : Player
|
||||
{
|
||||
/// <summary>
|
||||
/// The player who is spawning.
|
||||
/// </summary>
|
||||
public TPlayer Player { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The spawn request (which you can modify).
|
||||
/// </summary>
|
||||
public PlayerSpawnRequest Request { get; set; }
|
||||
|
||||
internal PlayerSpawningEventArgs(TPlayer player, PlayerSpawnRequest request)
|
||||
{
|
||||
Player = player;
|
||||
Request = request;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using BattleBitAPI.Common;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
/// <remarks>
|
||||
/// Player: The player that typed the message <br/>
|
||||
/// ChatChannel: The channel the message was sent <br/>
|
||||
/// string - Message: The message<br/>
|
||||
/// </remarks>
|
||||
public class PlayerTypedMessageEventArgs<TPlayer> where TPlayer : Player
|
||||
{
|
||||
public TPlayer Player { get; init; }
|
||||
public ChatChannel ChatChannel { get; init; }
|
||||
public string Message { get; init; }
|
||||
|
||||
internal PlayerTypedMessageEventArgs(TPlayer player, ChatChannel chatChannel, string message)
|
||||
{
|
||||
Player = player;
|
||||
ChatChannel = chatChannel;
|
||||
Message = message;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using BattleBitAPI.Common;
|
||||
|
||||
namespace BattleBitAPI.Server.EventArgs
|
||||
{
|
||||
public class SavingPlayerStatsEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The player's SteamID
|
||||
/// </summary>
|
||||
public ulong SteamID { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The player's stats
|
||||
/// </summary>
|
||||
public PlayerStats PlayerStats { get; init; }
|
||||
|
||||
internal SavingPlayerStatsEventArgs(ulong steamID, PlayerStats playerStats)
|
||||
{
|
||||
SteamID = steamID;
|
||||
PlayerStats = playerStats;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@ using System.Net.Sockets;
|
|||
using System.Numerics;
|
||||
using BattleBitAPI.Common;
|
||||
using BattleBitAPI.Common.Extentions;
|
||||
using BattleBitAPI.Common.Serialization;
|
||||
using BattleBitAPI.Networking;
|
||||
using BattleBitAPI.Server.EventArgs;
|
||||
using CommunityServerAPI.BattleBitAPI;
|
||||
|
||||
namespace BattleBitAPI.Server
|
||||
|
@ -26,15 +26,7 @@ namespace BattleBitAPI.Server
|
|||
/// Fired when an attempt made to connect to the server.<br/>
|
||||
/// Default, any connection attempt will be accepted
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// IPAddress: IP of incoming connection <br/>
|
||||
/// </remarks>
|
||||
///
|
||||
/// <value>
|
||||
/// Returns: true if allow connection, false if deny the connection.
|
||||
/// </value>
|
||||
public Func<IPAddress, Task<bool>> OnGameServerConnecting { get; set; }
|
||||
public Func<GameServerConnectingEventArgs, Task> OnGameServerConnecting { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a game server connects.
|
||||
|
@ -86,118 +78,52 @@ namespace BattleBitAPI.Server
|
|||
/// <summary>
|
||||
/// Fired when a player types a message to text chat.<br/>
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Player: The player that typed the message <br/>
|
||||
/// ChatChannel: The channel the message was sent <br/>
|
||||
/// string - Message: The message<br/>
|
||||
/// </remarks>
|
||||
public Func<TPlayer, ChatChannel, string, Task> OnPlayerTypedMessage { get; set; }
|
||||
public Func<PlayerTypedMessageEventArgs<TPlayer>, Task> OnPlayerTypedMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a player kills another player.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Player: The killer player<br/>
|
||||
/// Vector3: The position of killer<br/>
|
||||
/// Player: The target player that got killed<br/>
|
||||
/// Vector3: The target player's position<br/>
|
||||
/// string - Tool: The tool user to kill the player<br/>
|
||||
/// </remarks>
|
||||
public Func<TPlayer, Vector3, TPlayer, Vector3, string, Task> OnAPlayerKilledAnotherPlayer { get; set; }
|
||||
public Func<PlayerKilledPlayerEventArgs<TPlayer>, Task> OnAPlayerKilledAnotherPlayer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when game server requests the stats of a player, this function should return in 3000ms or player will not able to join to server.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// ulong - SteamID of the player<br/>
|
||||
/// PlayerStats - The official stats of the player<br/>
|
||||
/// </remarks>
|
||||
/// <value>
|
||||
/// Returns: The modified stats of the player.
|
||||
/// </value>
|
||||
public Func<ulong, PlayerStats, Task<PlayerStats>> OnGetPlayerStats { get; set; }
|
||||
public Func<GetPlayerStatsEventArgs, Task> OnGetPlayerStats { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when game server requests to save the stats of a player.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// ulong - SteamID of the player<br/>
|
||||
/// PlayerStats - Stats of the player<br/>
|
||||
/// </remarks>
|
||||
/// <value>
|
||||
/// Returns: The stats of the player.
|
||||
/// </value>
|
||||
public Func<ulong, PlayerStats, Task> OnSavePlayerStats { get; set; }
|
||||
public Func<SavingPlayerStatsEventArgs, Task> OnSavePlayerStats { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a player requests server to change role.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// TPlayer - The player requesting<br/>
|
||||
/// GameRole - The role the player asking to change<br/>
|
||||
/// </remarks>
|
||||
/// <value>
|
||||
/// Returns: True if you accept if, false if you don't.
|
||||
/// </value>
|
||||
public Func<TPlayer, GameRole, Task<bool>> OnPlayerRequestingToChangeRole { get; set; }
|
||||
public Func<PlayerRequestingToChangeRoleEventArgs<TPlayer>, Task> OnPlayerRequestingToChangeRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a player changes their game role.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// TPlayer - The player<br/>
|
||||
/// GameRole - The new role of the player<br/>
|
||||
/// </remarks>
|
||||
public Func<TPlayer, GameRole, Task> OnPlayerChangedRole { get; set; }
|
||||
public Func<PlayerChangedRoleEventArgs<TPlayer>, Task> OnPlayerChangedRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a player joins a squad.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// TPlayer - The player<br/>
|
||||
/// Squads - The squad player joined<br/>
|
||||
/// </remarks>
|
||||
public Func<TPlayer, Squads, Task> OnPlayerJoinedASquad { get; set; }
|
||||
public Func<PlayerJoinedSquadEventArgs<TPlayer>, Task> OnPlayerJoinedASquad { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a player leaves their squad.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// TPlayer - The player<br/>
|
||||
/// Squads - The squad that player left<br/>
|
||||
/// </remarks>
|
||||
public Func<TPlayer, Squads, Task> OnPlayerLeftSquad { get; set; }
|
||||
public Func<PlayerLeftSquadEventArgs<TPlayer>, Task> OnPlayerLeftSquad { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a player changes team.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// TPlayer - The player<br/>
|
||||
/// Team - The new team that player joined<br/>
|
||||
/// </remarks>
|
||||
public Func<TPlayer, Team, Task> OnPlayerChangedTeam { get; set; }
|
||||
public Func<PlayerChangedTeamEventArgs<TPlayer>, Task> OnPlayerChangedTeam { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a player is spawning.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// TPlayer - The player<br/>
|
||||
/// PlayerSpawnRequest - The request<br/>
|
||||
/// </remarks>
|
||||
/// <value>
|
||||
/// Returns: The new spawn response
|
||||
/// </value>
|
||||
public Func<TPlayer, PlayerSpawnRequest, Task<PlayerSpawnRequest>> OnPlayerSpawning { get; set; }
|
||||
public Func<PlayerSpawningEventArgs<TPlayer>, Task> OnPlayerSpawning { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a player is spawns
|
||||
|
@ -220,24 +146,11 @@ namespace BattleBitAPI.Server
|
|||
/// <summary>
|
||||
/// Fired when a player reports another player.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// TPlayer - The reporter player<br/>
|
||||
/// TPlayer - The reported player<br/>
|
||||
/// ReportReason - The reason of report<br/>
|
||||
/// String - Additional detail<br/>
|
||||
/// </remarks>
|
||||
public Func<TPlayer, TPlayer, ReportReason, string, Task> OnPlayerReported { get; set; }
|
||||
public Func<PlayerReportedEventArgs<TPlayer>, Task> OnPlayerReported { get; set; }
|
||||
|
||||
// --- Private ---
|
||||
private TcpListener mSocket;
|
||||
private Dictionary<ulong, GameServer> mActiveConnections;
|
||||
|
||||
// --- Construction ---
|
||||
public ServerListener()
|
||||
{
|
||||
this.mActiveConnections = new Dictionary<ulong, GameServer>(16);
|
||||
}
|
||||
private Dictionary<ulong, GameServer> mActiveConnections = new(16);
|
||||
|
||||
// --- Starting ---
|
||||
public void Start(IPAddress bindIP, int port)
|
||||
|
@ -290,13 +203,18 @@ namespace BattleBitAPI.Server
|
|||
mInternalOnClientConnecting(client);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task mInternalOnClientConnecting(TcpClient client)
|
||||
{
|
||||
var ip = (client.Client.RemoteEndPoint as IPEndPoint).Address;
|
||||
|
||||
bool allow = true;
|
||||
if (OnGameServerConnecting != null)
|
||||
allow = await OnGameServerConnecting(ip);
|
||||
{
|
||||
var args = new GameServerConnectingEventArgs(ip);
|
||||
await OnGameServerConnecting(args);
|
||||
allow = args.Allow;
|
||||
}
|
||||
|
||||
if (!allow)
|
||||
{
|
||||
|
@ -804,7 +722,7 @@ namespace BattleBitAPI.Server
|
|||
if (stream.TryReadString(out var msg))
|
||||
{
|
||||
if (OnPlayerTypedMessage != null)
|
||||
await OnPlayerTypedMessage.Invoke((TPlayer)player, chat, msg);
|
||||
await OnPlayerTypedMessage.Invoke(new PlayerTypedMessageEventArgs<TPlayer>((TPlayer)player, chat, msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -825,7 +743,7 @@ namespace BattleBitAPI.Server
|
|||
if (resources.TryGetPlayer(killer, out var killerClient))
|
||||
if (resources.TryGetPlayer(victim, out var victimClient))
|
||||
if (OnAPlayerKilledAnotherPlayer != null)
|
||||
await OnAPlayerKilledAnotherPlayer.Invoke((TPlayer)killerClient, killerPos, (TPlayer)victimClient, victimPos, tool);
|
||||
await OnAPlayerKilledAnotherPlayer.Invoke(new PlayerKilledPlayerEventArgs<TPlayer>((TPlayer)killerClient, killerPos, (TPlayer)victimClient, victimPos, tool));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -841,7 +759,11 @@ namespace BattleBitAPI.Server
|
|||
stats.Read(stream);
|
||||
|
||||
if (OnGetPlayerStats != null)
|
||||
stats = await OnGetPlayerStats.Invoke(steamID, stats);
|
||||
{
|
||||
var args = new GetPlayerStatsEventArgs(steamID, stats);
|
||||
await OnGetPlayerStats.Invoke(args);
|
||||
stats = args.PlayerStats;
|
||||
}
|
||||
|
||||
using (var response = Common.Serialization.Stream.Get())
|
||||
{
|
||||
|
@ -862,7 +784,7 @@ namespace BattleBitAPI.Server
|
|||
stats.Read(stream);
|
||||
|
||||
if (OnSavePlayerStats != null)
|
||||
await OnSavePlayerStats.Invoke(steamID, stats);
|
||||
await OnSavePlayerStats.Invoke(new SavingPlayerStatsEventArgs(steamID, stats));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -878,7 +800,11 @@ namespace BattleBitAPI.Server
|
|||
bool accepted = true;
|
||||
|
||||
if (OnPlayerRequestingToChangeRole != null)
|
||||
accepted = await OnPlayerRequestingToChangeRole.Invoke((TPlayer)client, role);
|
||||
{
|
||||
var args = new PlayerRequestingToChangeRoleEventArgs<TPlayer>((TPlayer)client, role);
|
||||
await OnPlayerRequestingToChangeRole.Invoke(args);
|
||||
accepted = args.Allow;
|
||||
}
|
||||
|
||||
if (accepted)
|
||||
server.SetRoleTo(steamID, role);
|
||||
|
@ -897,7 +823,7 @@ namespace BattleBitAPI.Server
|
|||
{
|
||||
client.Role = role;
|
||||
if (OnPlayerChangedRole != null)
|
||||
await OnPlayerChangedRole.Invoke((TPlayer)client, role);
|
||||
await OnPlayerChangedRole.Invoke(new PlayerChangedRoleEventArgs<TPlayer>((TPlayer)client, role));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -913,7 +839,7 @@ namespace BattleBitAPI.Server
|
|||
{
|
||||
client.Squad = squad;
|
||||
if (OnPlayerJoinedASquad != null)
|
||||
await OnPlayerJoinedASquad.Invoke((TPlayer)client, squad);
|
||||
await OnPlayerJoinedASquad.Invoke(new PlayerJoinedSquadEventArgs<TPlayer>((TPlayer)client, squad));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -932,11 +858,11 @@ namespace BattleBitAPI.Server
|
|||
client.Role = GameRole.Assault;
|
||||
|
||||
if (OnPlayerLeftSquad != null)
|
||||
await OnPlayerLeftSquad.Invoke((TPlayer)client, oldSquad);
|
||||
await OnPlayerLeftSquad.Invoke(new PlayerLeftSquadEventArgs<TPlayer>((TPlayer)client, oldSquad));
|
||||
|
||||
if (oldRole != GameRole.Assault)
|
||||
if (OnPlayerChangedRole != null)
|
||||
await OnPlayerChangedRole.Invoke((TPlayer)client, GameRole.Assault);
|
||||
await OnPlayerChangedRole.Invoke(new PlayerChangedRoleEventArgs<TPlayer>((TPlayer)client, GameRole.Assault));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -952,7 +878,7 @@ namespace BattleBitAPI.Server
|
|||
{
|
||||
client.Team = team;
|
||||
if (OnPlayerChangedTeam != null)
|
||||
await OnPlayerChangedTeam.Invoke((TPlayer)client, team);
|
||||
await OnPlayerChangedTeam.Invoke(new PlayerChangedTeamEventArgs<TPlayer>((TPlayer)client, team));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -968,8 +894,12 @@ namespace BattleBitAPI.Server
|
|||
ushort vehicleID = stream.ReadUInt16();
|
||||
|
||||
if (resources.TryGetPlayer(steamID, out var client))
|
||||
if (this.OnPlayerSpawning != null)
|
||||
request = await OnPlayerSpawning.Invoke((TPlayer)client, request);
|
||||
if (OnPlayerSpawning != null)
|
||||
{
|
||||
var args = new PlayerSpawningEventArgs<TPlayer>((TPlayer)client, request);
|
||||
await OnPlayerSpawning.Invoke(args);
|
||||
request = args.Request;
|
||||
}
|
||||
|
||||
//Respond back.
|
||||
using (var response = Common.Serialization.Stream.Get())
|
||||
|
@ -997,7 +927,7 @@ namespace BattleBitAPI.Server
|
|||
if (resources.TryGetPlayer(reported, out var reportedClient))
|
||||
{
|
||||
if (OnPlayerReported != null)
|
||||
await OnPlayerReported.Invoke((TPlayer)reporterClient, (TPlayer)reportedClient, reason, additionalInfo);
|
||||
await OnPlayerReported.Invoke(new PlayerReportedEventArgs<TPlayer>((TPlayer)reporterClient, (TPlayer)reportedClient, reason, additionalInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\BattleBit\\BattleBitRemastered\\Servers\\CommunityServerAPI\\BattleBit-Community-Server-API\\CommunityServerAPI.csproj": {}
|
||||
"D:\\repos\\battlebit\\CommunityAPI\\CommunityServerAPI.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\BattleBit\\BattleBitRemastered\\Servers\\CommunityServerAPI\\BattleBit-Community-Server-API\\CommunityServerAPI.csproj": {
|
||||
"D:\\repos\\battlebit\\CommunityAPI\\CommunityServerAPI.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\BattleBit\\BattleBitRemastered\\Servers\\CommunityServerAPI\\BattleBit-Community-Server-API\\CommunityServerAPI.csproj",
|
||||
"projectUniqueName": "D:\\repos\\battlebit\\CommunityAPI\\CommunityServerAPI.csproj",
|
||||
"projectName": "CommunityServerAPI",
|
||||
"projectPath": "C:\\BattleBit\\BattleBitRemastered\\Servers\\CommunityServerAPI\\BattleBit-Community-Server-API\\CommunityServerAPI.csproj",
|
||||
"packagesPath": "C:\\Users\\Oki\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\BattleBit\\BattleBitRemastered\\Servers\\CommunityServerAPI\\BattleBit-Community-Server-API\\obj\\",
|
||||
"projectPath": "D:\\repos\\battlebit\\CommunityAPI\\CommunityServerAPI.csproj",
|
||||
"packagesPath": "C:\\Users\\notfail\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\repos\\battlebit\\CommunityAPI\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\Oki\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Users\\notfail\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
|
@ -50,12 +50,30 @@
|
|||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"downloadDependencies": [
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App.Ref",
|
||||
"version": "[6.0.15, 6.0.15]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Host.win-x64",
|
||||
"version": "[6.0.15, 6.0.15]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Ref",
|
||||
"version": "[6.0.15, 6.0.15]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.WindowsDesktop.App.Ref",
|
||||
"version": "[6.0.15, 6.0.15]"
|
||||
}
|
||||
],
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.201\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.202\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Oki\.nuget\packages\</NuGetPackageFolders>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\notfail\.nuget\packages\</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.5.0</NuGetToolVersion>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.6.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Oki\.nuget\packages\" />
|
||||
<SourceRoot Include="C:\Users\notfail\.nuget\packages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,7 +1,6 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
|
|
@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
|
|||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = CommunityServerAPI
|
||||
build_property.ProjectDir = C:\BattleBit\BattleBitRemastered\Servers\CommunityServerAPI\BattleBit-Community-Server-API\
|
||||
build_property.ProjectDir = D:\repos\battlebit\CommunityAPI\
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -8,19 +8,19 @@
|
|||
"net6.0": []
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\Oki\\.nuget\\packages\\": {}
|
||||
"C:\\Users\\notfail\\.nuget\\packages\\": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\BattleBit\\BattleBitRemastered\\Servers\\CommunityServerAPI\\BattleBit-Community-Server-API\\CommunityServerAPI.csproj",
|
||||
"projectUniqueName": "D:\\repos\\battlebit\\CommunityAPI\\CommunityServerAPI.csproj",
|
||||
"projectName": "CommunityServerAPI",
|
||||
"projectPath": "C:\\BattleBit\\BattleBitRemastered\\Servers\\CommunityServerAPI\\BattleBit-Community-Server-API\\CommunityServerAPI.csproj",
|
||||
"packagesPath": "C:\\Users\\Oki\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\BattleBit\\BattleBitRemastered\\Servers\\CommunityServerAPI\\BattleBit-Community-Server-API\\obj\\",
|
||||
"projectPath": "D:\\repos\\battlebit\\CommunityAPI\\CommunityServerAPI.csproj",
|
||||
"packagesPath": "C:\\Users\\notfail\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\repos\\battlebit\\CommunityAPI\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\Oki\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Users\\notfail\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
|
@ -56,12 +56,30 @@
|
|||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"downloadDependencies": [
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App.Ref",
|
||||
"version": "[6.0.15, 6.0.15]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Host.win-x64",
|
||||
"version": "[6.0.15, 6.0.15]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Ref",
|
||||
"version": "[6.0.15, 6.0.15]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.WindowsDesktop.App.Ref",
|
||||
"version": "[6.0.15, 6.0.15]"
|
||||
}
|
||||
],
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.201\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.202\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "pUUV0vYUBKisP9wHLyg+4LLgPpJ6nV59j98jNphsryg3WNDca7+wrgNUZlRnXogF4/FlbIby2tBboJ+SQRQCGA==",
|
||||
"dgSpecHash": "TIgvbarIBImeWO/dRuIof5UqXcjh4EueyEdyEhjQrb0slOU5ZWnsz15fjd/eBP9Z+v9EwI2cV1FiGobOQgN8bw==",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\BattleBit\\BattleBitRemastered\\Servers\\CommunityServerAPI\\BattleBit-Community-Server-API\\CommunityServerAPI.csproj",
|
||||
"expectedPackageFiles": [],
|
||||
"projectFilePath": "D:\\repos\\battlebit\\CommunityAPI\\CommunityServerAPI.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\notfail\\.nuget\\packages\\microsoft.netcore.app.ref\\6.0.15\\microsoft.netcore.app.ref.6.0.15.nupkg.sha512",
|
||||
"C:\\Users\\notfail\\.nuget\\packages\\microsoft.windowsdesktop.app.ref\\6.0.15\\microsoft.windowsdesktop.app.ref.6.0.15.nupkg.sha512",
|
||||
"C:\\Users\\notfail\\.nuget\\packages\\microsoft.aspnetcore.app.ref\\6.0.15\\microsoft.aspnetcore.app.ref.6.0.15.nupkg.sha512",
|
||||
"C:\\Users\\notfail\\.nuget\\packages\\microsoft.netcore.app.host.win-x64\\6.0.15\\microsoft.netcore.app.host.win-x64.6.0.15.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
Loading…
Reference in New Issue