Migrate to new version
This commit is contained in:
parent
3b844211ee
commit
348ecefc5b
|
@ -1,5 +1,5 @@
|
|||
using System.Numerics;
|
||||
using CommunityServerAPI.BattleBitAPI.Server;
|
||||
using BattleBitAPI.Server;
|
||||
|
||||
namespace BattleBitAPI.Common
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using BattleBitAPI.Common;
|
||||
using CommunityServerAPI.BattleBitAPI.Server;
|
||||
using BattleBitAPI.Server;
|
||||
|
||||
namespace BattleBitAPI.Server
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using CommunityServerAPI.BattleBitAPI.Server;
|
||||
using BattleBitAPI.Server;
|
||||
|
||||
namespace BattleBitAPI.Server
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using BattleBitAPI.Common;
|
||||
using CommunityServerAPI.BattleBitAPI.Server;
|
||||
using BattleBitAPI.Server;
|
||||
|
||||
namespace BattleBitAPI.Server
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using CommunityServerAPI.BattleBitAPI.Server;
|
||||
using BattleBitAPI.Server;
|
||||
|
||||
namespace BattleBitAPI.Server
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ using BattleBitAPI.Common.Extentions;
|
|||
using BattleBitAPI.Common.Serialization;
|
||||
using BattleBitAPI.Networking;
|
||||
using CommunityServerAPI.BattleBitAPI;
|
||||
using CommunityServerAPI.BattleBitAPI.Server;
|
||||
using BattleBitAPI.Server;
|
||||
|
||||
namespace BattleBitAPI.Server
|
||||
{
|
||||
|
|
24
Program.cs
24
Program.cs
|
@ -1,8 +1,6 @@
|
|||
using BattleBitAPI;
|
||||
using BattleBitAPI.Common;
|
||||
using BattleBitAPI.Server;
|
||||
using System.Threading.Channels;
|
||||
using System.Xml;
|
||||
|
||||
class Program
|
||||
{
|
||||
|
@ -15,15 +13,15 @@ class Program
|
|||
|
||||
Thread.Sleep(-1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class MyPlayer : Player<MyPlayer>
|
||||
{
|
||||
public int Kills;
|
||||
public int Deaths;
|
||||
public List<MyPlayer> players;
|
||||
}
|
||||
|
||||
class MyGameServer : GameServer<MyPlayer>
|
||||
{
|
||||
private List<MyPlayer> players;
|
||||
|
@ -51,16 +49,19 @@ class MyGameServer : GameServer<MyPlayer>
|
|||
|
||||
public override async Task OnGameStateChanged(GameState oldState, GameState newState)
|
||||
{
|
||||
await Console.Out.WriteLineAsync("Giveup: " + player);
|
||||
await Console.Out.WriteLineAsync("State changed to -> " + newState);
|
||||
}
|
||||
|
||||
public override async Task OnPlayerDied(MyPlayer player)
|
||||
{
|
||||
await Console.Out.WriteLineAsync("Died: " + player);
|
||||
}
|
||||
|
||||
public override async Task OnAPlayerRevivedAnotherPlayer(MyPlayer from, MyPlayer to)
|
||||
{
|
||||
await Console.Out.WriteLineAsync(from + " revived " + to);
|
||||
}
|
||||
|
||||
public override async Task OnPlayerDisconnected(MyPlayer player)
|
||||
{
|
||||
await Console.Out.WriteLineAsync("Disconnected: " + player);
|
||||
|
@ -91,16 +92,17 @@ class MyGameServer : GameServer<MyPlayer>
|
|||
switch (words[0])
|
||||
{
|
||||
case "/tp":
|
||||
// /tp <steamid/name>
|
||||
// /tp <steamid/name> <steamid/name> or /tp <steamid/name> (tp executor to target)
|
||||
var tpTarget = FindPlayerByIdentifier(words[1]);
|
||||
var tpDestination = FindPlayerByIdentifier(words.Length > 2 ? words[2] : player.Name);
|
||||
|
||||
if (tpTarget == null)
|
||||
if (tpTarget == null || tpDestination == null)
|
||||
{
|
||||
player.Message("Player not found!");
|
||||
return false;
|
||||
}
|
||||
|
||||
player.Message("Not implemented yet!");
|
||||
tpTarget.Teleport(tpDestination.Position);
|
||||
break;
|
||||
|
||||
case "/kill":
|
||||
|
@ -170,7 +172,7 @@ class MyGameServer : GameServer<MyPlayer>
|
|||
player.Deaths = 0;
|
||||
}
|
||||
|
||||
public override Task<PlayerStats> OnGetPlayerStats(ulong steamID, PlayerStats officialStats)
|
||||
public override Task OnPlayerJoiningToServer(ulong steamID, PlayerJoiningArguments args)
|
||||
{
|
||||
var stats = new PlayerStats();
|
||||
|
||||
|
@ -184,8 +186,10 @@ class MyGameServer : GameServer<MyPlayer>
|
|||
|
||||
return Task.FromResult(stats);
|
||||
}
|
||||
public override async Task OnAPlayerKilledAnotherPlayer(OnPlayerKillArguments<MyPlayer> args)
|
||||
|
||||
public override async Task OnAPlayerDownedAnotherPlayer(OnPlayerKillArguments<MyPlayer> args)
|
||||
{
|
||||
args.Victim.Kill();
|
||||
args.Killer.Heal(100);
|
||||
args.Killer.Kills++;
|
||||
args.Victim.Deaths++;
|
||||
|
|
Loading…
Reference in New Issue