Skip to content

Commit

Permalink
Merge pull request #223 from MrDave1999/dev
Browse files Browse the repository at this point in the history
9.0.0 Release
  • Loading branch information
MrDave1999 authored Nov 11, 2024
2 parents 8014681 + d993e3d commit 6563624
Show file tree
Hide file tree
Showing 542 changed files with 19,800 additions and 10,401 deletions.
18 changes: 12 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
**/bin
**/obj
**/dependencies
filterscripts/*.amx
ctf-gamemode-windows/
dotnet/runtime/
runtime/
.vscode/
plugins/
.git/
*.exe
*.dll
*.so
logs/
scripts/
screenshots/
tests/
announce.exe
samp-server.exe
samp-npc.exe
announce
samp03svr
samp-npc
server.cfg
server_log.txt
server_log.txt
*.zip
*.rar
73 changes: 44 additions & 29 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,41 +1,56 @@
#
# SA-MP Server Info
#
HOST_NAME=.:: Capture The Flag ::. |Team DeathMatch|
LANGUAGE_NAME=Spanish
GAME_MODE_TEXT=TDM/CTF
MAP_NAME=
WEB_URL=https://www.sa-mp.com/
ServerInfo__HostName=[CTF] Capture The Flag | Team Deathmatch | [TDM]
ServerInfo__LanguageText=English
ServerInfo__GameModeText=CTF/Team Deathmatch [v9.0]
ServerInfo__MapName=RC_Battlefield
ServerInfo__WebUrl=https://github.com/MrDave1999/Capture-The-Flag
ServerInfo__IntroAudioUrl=https://od.lk/s/Nl8yMDg4MTc0NDBf/intro-cs.mp3
# Expressed in seconds.
ServerInfo__FlagAutoReturnTime=120

ServerOwner__Name=MrDave
# Specify the secret key to give me admin.
ServerOwner__SecretKey=

# Expressed in minutes.
CommandCooldowns__Health=3
CommandCooldowns__Armour=3
CommandCooldowns__Coins=3

TopPlayers__RequiredTotalKills=150
TopPlayers__RequiredMaxKillingSpree=10

MariaDB__Server=mariadb
MariaDB__Port=3306
MariaDB__Database=gamemode
MariaDB__UserName=root
MariaDB__Password=123456789

SQLite__DataSource=scripts/sqlite/gamemode.db

HIDDEN_COMMAND=/1234 # Command used to become admin
FLAG_RETURN_TIME=200 # Flag auto-return time
DatabaseProvider=InMemory
CodePageEncoding=cp1252

#
# Connection String
# Alpha team sounds
#
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=gamemode
DB_USERNAME=root
DB_PASSWORD=1234
CONNECTION_STRING=server=${DB_HOST};port=${DB_PORT};username=${DB_USERNAME};password=${DB_PASSWORD};database=${DB_DATABASE};
RedFlagDroppedUrl=https://od.lk/s/Nl8yMDg4MTc0MzNf/red_flag_dropped.mp3
RedFlagReturnedUrl=https://od.lk/s/Nl8yMDg4MTc0MzRf/red_flag_returned.mp3
RedFlagTakenUrl=https://od.lk/s/Nl8yMDg4MTc0MzVf/red_flag_taken.mp3
RedTeamScoresUrl=https://od.lk/s/Nl8yMDg4MTc0MzZf/red_team_scores.mp3

#
# Map Info
# Beta team sounds
#
MAX_TIME_ROUND=1200 # Time must be in seconds
MAX_TIME_LOADING=10 # Time must be in seconds
MAX_SPAWNS=10
# Default values
INTERIOR=0
WEATHER=10
WORLD_TIME=12
BlueFlagDroppedUrl=https://od.lk/s/Nl8yMDg4MTc0Mjlf/blue_flag_dropped.mp3
BlueFlagReturnedUrl=https://od.lk/s/Nl8yMDg4MTc0MzBf/blue_flag_returned.mp3
BlueFlagTakenUrl=https://od.lk/s/Nl8yMDg4MTc0MzFf/blue_flag_taken.mp3
BlueTeamScoresUrl=https://od.lk/s/Nl8yMDg4MTc0MzJf/blue_team_scores.mp3

#
# Primary keys used by docker-compose
#
MAX_PLAYERS=30 # Number of players that can enter the SA-MP Server
LAG_COMP_MODE=1 # Lag Compensation
PORT=7777 # The port to be published by the container
TZ=America/Guayaquil # Time Zone
MaxPlayers=30 # Number of players that can enter the SA-MP Server
LagCompMode=1 # Lag Compensation
Port=7777 # The port to be published by the container
TZ=America/Bogota # Time Zone
MemoryLimit=1g
49 changes: 49 additions & 0 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Upload artifacts

on:
release:
types: [published]
env:
DOTNET_VERSION: '8.x'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Download SA-MP Server
run: wget https://github.com/MrDave1999/samp-server/releases/download/sampserver.v1/samp03.zip
- name: Unzip SA-MP Server
run: unzip samp03.zip -d ctf-gamemode-windows
- name: Move contents of samp03 to root directory
run: |
mv ctf-gamemode-windows/samp03/** ctf-gamemode-windows
rmdir ctf-gamemode-windows/samp03
- name: Add plugins to server.cfg file
run: |
echo "" >> ctf-gamemode-windows/server.cfg
echo "plugins SampSharp streamer" >> ctf-gamemode-windows/server.cfg
- name: Build game mode
run: dotnet publish src/Host -c Release -o bin --framework=net8.0
- name: Copy artifacts
run: |
mkdir ctf-gamemode-windows/plugins ctf-gamemode-windows/filterscripts
cp -r bin ctf-gamemode-windows
cp plugins/*.dll ctf-gamemode-windows/plugins
cp filterscripts/*.amx ctf-gamemode-windows/filterscripts
cp -r scripts ctf-gamemode-windows
- name: Create .env file
run: cp .env.example .env
- name: Copy .env file
run: cp .env ctf-gamemode-windows
- name: Create compressed file
run: zip -r ctf-gamemode-windows.zip ctf-gamemode-windows
- name: Upload artifacts to release
uses: softprops/action-gh-release@v2
with:
files: ctf-gamemode-windows.zip
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CTF CI

on:
push:
branches:
- dev
pull_request:
branches:
- dev
env:
DOTNET_VERSION: '8.x'

jobs:
unit_testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Execute unit tests
run: dotnet test ./tests/Application.Tests/CTF.Application.Tests.csproj -c Release

integration_testing:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb
ports:
- 3306:3306
env:
MARIADB_DATABASE: gamemode
MARIADB_ROOT_PASSWORD: 123456789
options: >-
--name mariadb
--health-cmd="mariadb-admin ping -h localhost"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Check MariaDB version
run: docker exec mariadb mariadb --version
- name: Check SQLite version
run: sqlite3 --version
- name: Import databases
run: |
docker exec -i mariadb mariadb -uroot -p123456789 gamemode < ./scripts/mariadb/gamemode.sql
sqlite3 gamemode.db < ./scripts/sqlite/gamemode.sql
- name: Create .env.test file
run: cp ./tests/Persistence.Tests/.env.test.example ./tests/Persistence.Tests/.env.test
- name: Execute integration tests
run: dotnet test ./tests/Persistence.Tests/Persistence.Tests.csproj -c Release
23 changes: 23 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CTF Deploy

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Deploy using ssh
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
port: 22
script: |
cd Capture-The-Flag
git pull origin main
git status
sudo docker compose up --build -d
23 changes: 14 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# In this directory are all the files to run the game mode
ctf-gamemode-windows/

# Vendor directory for dependencies
/**/dependencies/

# .NET Runtime binaries
dotnet/runtime/
runtime/

# environment variables for development
.env
# environment variables for development and test
**/.env
**/.env.test

# samp server configuration file
server.cfg

# Plugins directory
plugins/

# binaries
*.exe
*.dll
*.so
filterscripts/*.amx
announce.exe
samp-server.exe
samp-npc.exe
announce
samp03svr
samp-npc

# logs
logs/
server_log.txt
crashinfo.txt

Expand All @@ -46,6 +48,9 @@ pawno/
*.user
*.userosscache
*.sln.docstates
*.zip
*.rar
*.db

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/samp-server.exe",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/CaptureTheFlag.csproj",
"${workspaceFolder}/src/Host/CTF.Host.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
"${workspaceFolder}/src/CaptureTheFlag.csproj",
"${workspaceFolder}/src/Host/CTF.Host.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -33,7 +33,7 @@
"watch",
"run",
"--project",
"${workspaceFolder}/src/CaptureTheFlag.csproj"
"${workspaceFolder}/src/Host/CTF.Host.csproj"
],
"problemMatcher": "$msCompile"
}
Expand Down
Loading

0 comments on commit 6563624

Please sign in to comment.