Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JIBSIL committed Dec 16, 2023
2 parents 2445c62 + f68e574 commit 5cfeffe
Show file tree
Hide file tree
Showing 35 changed files with 350 additions and 515 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build for linux
run: dotnet publish -r win-x64 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true --configuration Release
- name: Build for windows
run: dotnet publish -r linux-x64 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true --configuration Release
- name: Build for macos
run: dotnet publish -r osx-x64 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true --configuration Release
# upload artifacts
- uses: actions/upload-artifact@v4
with:
name: macOS release
path: /home/runner/work/TABGCommunityServer/TABGCommunityServer/TABGServer/bin/Release/net7.0/osx-x64/publish/TABG
- uses: actions/upload-artifact@v4
with:
name: linux release
path: /home/runner/work/TABGCommunityServer/TABGCommunityServer/TABGServer/bin/Release/net7.0/linux-x64/publish/TABG
- uses: actions/upload-artifact@v4
with:
name: windows release
path: /home/runner/work/TABGCommunityServer/TABGCommunityServer/TABGServer/bin/Release/net7.0/win-x64/publish/TABG.exe
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,38 @@ Welcome to the TABGCommunityServer repository.

Running a TABG Community Server has many advantages (such as being able to access any item in the game, create custom gamemodes, etc). However, consider that the server may require significant resources to run. Make sure you have a decently spec'd computer, or spare PC/server to run it on.

## Creating a Server
## Creating and Running a Server

Creating a server is as simple. Just follow these steps:
1. Clone the repository using the "Download as ZIP" button or `git clone`.
2. Open the project in Visual Studio 2022 and press the green play button at the top
2. Open the project in [Visual Studio 2022](https://visualstudio.microsoft.com/) and press the green play button at the top, you may need to install .NET 7.0 runtime when opening the project for the first time.
3. If you wish to run it outside of Visual Studio, build it using "Build Solution" in the top Build menu.

Running the server if built:

Locate the "TABGCommunityServer" folder and go to TABGServer\bin\Debug\net7.0
Here you will find the executable "TABGCommunityServer.exe". Run this and the server will start.

Joining with a client is slightly harder as we don't have patching software released for the client yet.

First, get your server listed on a community server list (listed at the bottom of this page) or host your own list.

Instructions on how to do that, as well as how to patch the client to use a community server list, are on our sister repository [TABGServerProxy](https://github.com/JIBSIL/TABGServersProxy)

## Chat Commands:

The following commands can be typed in chat:
* `/kill victimid killerid victimname` (for example: `/kill 0 0 PLAYERNAME`)
* `/give itemid itemamount` (for example: `/give 123 1` NOTE: you have to add the quantity at the end of the command otherwise you will not receive the item)
* `/notification`
* `/kit`
* `/coords`
* `/broadcast MESSAGE`
* `/revive`
* `/heal`
* `/state PLAYERSTATE`
* `/gamestate flying/waiting/started/countdown` (countdown has an integer argument of how many seconds to count down)

## FAQ:
**I'd rather dip my hand into a nest of angry hornets than patch the client. What do I do?**
Ask your friend for a Assembly-CSharp.dll file, and follow the "Disabling AntiCheat and Running" section [here](https://github.com/JIBSIL/TABGServersProxy)
Expand Down
8 changes: 4 additions & 4 deletions TABG.sln → TABGCommunityServer.sln
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32630.194
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TABG", "TABGServer\TABG.csproj", "{1A0856FF-D2A8-411A-9A3B-0DF6565A29CC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TABGCommunityServer", "TABGServer\TABGCommunityServer.csproj", "{1A0856FF-D2A8-411A-9A3B-0DF6565A29CC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TABGEmulationClient", "TABGEmulationClient\TABGEmulationClient.csproj", "{96146C19-33BC-45B4-8E11-13EEBD46F6D9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TABGEmulationClient", "TABGEmulationClient\TABGEmulationClient.csproj", "{96146C19-33BC-45B4-8E11-13EEBD46F6D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
28 changes: 14 additions & 14 deletions TABGServer/AdminCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
using System.Text;
using System.Threading.Tasks;

namespace TABG
namespace TABGCommunityServer
{
internal class AdminCommandHandler
{
private string command;
public bool shouldSendPacket = false;
public ClientEventCode code;
public EventCode code;
public string? notification;
public byte[] packetData;
private byte executor;
Expand Down Expand Up @@ -66,7 +66,7 @@ public void Handle(PlayerConcurencyHandler playerConncurencyHandler)

this.shouldSendPacket = true;
this.packetData = new PlayerHandler().KillPlayer(victim, killer, victimName);
this.code = ClientEventCode.PlayerDead;
this.code = EventCode.PlayerDead;

return;

Expand All @@ -93,7 +93,7 @@ public void Handle(PlayerConcurencyHandler playerConncurencyHandler)

this.shouldSendPacket = true;
this.packetData = new PlayerHandler().GiveItem(itemid, amount);
this.code = ClientEventCode.PlayerLootRecieved;
this.code = EventCode.PlayerLootRecieved;

return;
} catch(Exception error)
Expand All @@ -104,21 +104,21 @@ public void Handle(PlayerConcurencyHandler playerConncurencyHandler)
case "notification":
this.packetData = new PlayerHandler().SendNotification(executor, "WELCOME - RUNNING COMMUNITY SERVER V1.TEST");
this.shouldSendPacket = true;
this.code = ClientEventCode.PlayerDead;
this.code = EventCode.PlayerDead;
return;
case "kit":
Console.WriteLine("Giving kit to player " + executor);
this.packetData = new PlayerHandler().GiveGear();
this.shouldSendPacket = true;
this.code = ClientEventCode.PlayerLootRecieved;
this.code = EventCode.PlayerLootRecieved;
this.notification = "You got the default kit!";
return;
case "coords":
var executorData = playerConncurencyHandler.Players[executor];
var loc = executorData.Location;
string notif = "COORDS- X: " + loc.X.ToString() + " Y: " + loc.Y.ToString() + " Z: " + loc.Z.ToString();
this.packetData = new PlayerHandler().SendNotification(executor, notif);
this.code = ClientEventCode.PlayerDead;
this.code = EventCode.PlayerDead;
this.shouldSendPacket = true;
return;
case "broadcast":
Expand All @@ -129,15 +129,15 @@ public void Handle(PlayerConcurencyHandler playerConncurencyHandler)
}
foreach (var item in playerConncurencyHandler.Players)
{
item.Value.PendingBroadcastPackets.Add(new Packet(ClientEventCode.PlayerDead, new PlayerHandler().SendNotification(item.Value.Id, "ANNOUNCE: " + parts[1])));
item.Value.PendingBroadcastPackets.Add(new Packet(EventCode.PlayerDead, new PlayerHandler().SendNotification(item.Value.Id, "ANNOUNCE: " + parts[1])));
}
return;
case "revive":
this.shouldSendPacket = false;
foreach (var item in playerConncurencyHandler.Players)
{
item.Value.PendingBroadcastPackets.Add(new Packet(ClientEventCode.ReviveState, new PlayerHandler().RevivePlayer(executor)));
item.Value.PendingBroadcastPackets.Add(new Packet(ClientEventCode.PlayerHealed, new PlayerHandler().SetPlayerHealth(executor, 100f)));
item.Value.PendingBroadcastPackets.Add(new Packet(EventCode.ReviveState, new PlayerHandler().RevivePlayer(executor)));
item.Value.PendingBroadcastPackets.Add(new Packet(EventCode.PlayerHealed, new PlayerHandler().SetPlayerHealth(executor, 100f)));
}
this.notification = "You were revived by SERVER";
return;
Expand All @@ -156,7 +156,7 @@ public void Handle(PlayerConcurencyHandler playerConncurencyHandler)
}
foreach (var item in playerConncurencyHandler.Players)
{
item.Value.PendingBroadcastPackets.Add(new Packet(ClientEventCode.PlayerHealed, new PlayerHandler().SetPlayerHealth(executor, health)));
item.Value.PendingBroadcastPackets.Add(new Packet(EventCode.PlayerHealed, new PlayerHandler().SetPlayerHealth(executor, health)));
}
this.notification = "Healed!";
return;
Expand All @@ -168,7 +168,7 @@ public void Handle(PlayerConcurencyHandler playerConncurencyHandler)

foreach (var item in playerConncurencyHandler.Players)
{
item.Value.PendingBroadcastPackets.Add(new Packet(ClientEventCode.PlayerEnteredChunk, new PlayerHandler().SimulateChunkEnter(playerConncurencyHandler, executor, playerState, playerHealth)));
item.Value.PendingBroadcastPackets.Add(new Packet(EventCode.PlayerEnteredChunk, new PlayerHandler().SimulateChunkEnter(playerConncurencyHandler, executor, playerState, playerHealth)));
}
this.notification = "Player state changed!";
} catch(Exception e)
Expand All @@ -185,7 +185,7 @@ public void Handle(PlayerConcurencyHandler playerConncurencyHandler)
}

// broadcast instead of send
this.code = ClientEventCode.GameStateChanged;
this.code = EventCode.GameStateChanged;

switch (parts[1])
{
Expand All @@ -209,7 +209,7 @@ public void Handle(PlayerConcurencyHandler playerConncurencyHandler)
}

this.packetData = new PlayerHandler().SendNotification(executor, "GAME STATE CHANGED!");
this.code = ClientEventCode.PlayerDead;
this.code = EventCode.PlayerDead;
this.shouldSendPacket = true;
return;
default: return;
Expand Down
Loading

0 comments on commit 5cfeffe

Please sign in to comment.