Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
danbastin committed Jan 12, 2025
2 parents 6d3cd18 + bd5ba47 commit 7ea8d3e
Show file tree
Hide file tree
Showing 149 changed files with 27,917 additions and 653 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- uses: php-actions/phpunit@v3
with:
test_suffix: Test.php
args: --testdox tests
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ HostFiles
.idea/
composer.phar
composer.lock
vendor/
vendor/

.phpunit.result.cache
2 changes: 2 additions & 0 deletions APIs/APIParseGamefile.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ function GetArray($handler)
$MGS_P2Sideboard = 3;
$MGS_ReadyToStart = 4;
$MGS_GameStarted = 5;
$MGS_GameOverStatsLogged = 6;
$MGS_StatsLoggedIrreversible = 7;

$FORMAT_CompCC = 1;
$FORMAT_CompBlitz = 3;
Expand Down
7 changes: 3 additions & 4 deletions APIs/CreateGame.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
include "../HostFiles/Redirector.php";
include "../Libraries/HTTPLibraries.php";
include "../Libraries/SHMOPLibraries.php";
include "../WriteLog.php";
include_once "../Libraries/PlayerSettings.php";
include_once '../Assets/patreon-php-master/src/PatreonDictionary.php';
require_once '../Assets/patreon-php-master/src/API.php';
Expand Down Expand Up @@ -122,13 +123,11 @@
include "../MenuFiles/WriteGamefile.php";
WriteGameFile();

$filename = "../Games/" . $gameName . "/gamelog.txt";
$handler = fopen($filename, "w");
fclose($handler);
CreateLog($gameName, "../");

$currentTime = round(microtime(true) * 1000);
$cacheVisibility = ($visibility == "public" ? "1" : "0");
WriteCache($gameName, 1 . "!" . $currentTime . "!" . $currentTime . "!0!-1!" . $currentTime . "!!!" . $cacheVisibility . "!0!0!0!" . FormatCode($format) . "!" . $gameStatus . "!0!0"); //Initialize SHMOP cache for this game
WriteCache($gameName, 1 . "!" . $currentTime . "!" . $currentTime . "!0!-1!" . $currentTime . "!!!" . $cacheVisibility . "!0!0!0!" . FormatCode($format) . "!" . $gameStatus . "!0!0!$currentTime!0!0"); //Initialize SHMOP cache for this game

$playerID = 1;

Expand Down
2 changes: 1 addition & 1 deletion APIs/GetLobbyRefresh.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
$response->isPrivateLobby = ($visibility == "private");
}

$response->gameLog = JSONLog($gameName, $playerID, "../");
$response->gameLog = JSONLog($gameName, "../");

$response->playAudio = ($playerID == 1 && $gameStatus == $MGS_ChooseFirstPlayer ? 1 : 0);

Expand Down
22 changes: 11 additions & 11 deletions APIs/SubmitLobbyInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@
exit;
}

if($action == "Request Chat")
{
$myName = ($playerID == 1 ? $p1uid : $p2uid);
if($playerID == 1) SetCachePiece($gameName, 15, 1);
else if($playerID == 2) SetCachePiece($gameName, 16, 1);
if(GetCachePiece($gameName, 15) != 1 || GetCachePiece($gameName, 16) != 1)
{
WriteLog($myName . " wants to enable chat", path: "../");
}
GamestateUpdated($gameName);
}
// if($action == "Request Chat")
// {
// $myName = ($playerID == 1 ? $p1uid : $p2uid);
// if($playerID == 1) SetCachePiece($gameName, 15, 1);
// else if($playerID == 2) SetCachePiece($gameName, 16, 1);
// if(GetCachePiece($gameName, 15) != 1 || GetCachePiece($gameName, 16) != 1)//if this gets uncommented, these cache keys need to change
// {
// WriteLog($myName . " wants to enable chat", path: "../");
// }
// GamestateUpdated($gameName);
// }

WriteGameFile();

Expand Down
5 changes: 3 additions & 2 deletions APIs/SubmitSideboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
include "../Libraries/PlayerSettings.php";
include "../Libraries/UILibraries2.php";
include "../AI/CombatDummy.php";
include "../WriteLog.php";
include_once "../includes/dbh.inc.php";
include_once "../includes/functions.inc.php";
include_once "../MenuFiles/StartHelper.php";
Expand Down Expand Up @@ -159,7 +160,7 @@
WriteGamestateCache($gameName, $gamestate);

//Set up log file
$filename = "../Games/" . $gameName . "/gamelog.txt";
$filename = LogPath($gameName, "../");
$filepath = "../Games/" . $gameName . "/";
$handler = fopen($filename, "w");
fclose($handler);
Expand All @@ -172,7 +173,7 @@
$format = GetCachePiece($gameName, 13);
$currentPlayer = 0;
$isReplay = 0;
WriteCache($gameName, ($currentUpdate + 1) . "!" . $currentTime . "!" . $currentTime . "!-1!-1!" . $currentTime . "!" . $p1Hero . "!" . $p2Hero . "!" . $visibility . "!" . $isReplay . "!0!0!" . $format . "!" . $MGS_GameStarted . "!0!0"); //Initialize SHMOP cache for this game
WriteCache($gameName, ($currentUpdate + 1) . "!" . $currentTime . "!" . $currentTime . "!-1!-1!" . $currentTime . "!" . $p1Hero . "!" . $p2Hero . "!" . $visibility . "!" . $isReplay . "!0!0!" . $format . "!" . $MGS_GameStarted . "!0!0!$currentTime!0!0"); //Initialize SHMOP cache for this game

ob_start();
$filename = "../Games/" . $gameName . "/gamestate.txt";
Expand Down
Loading

0 comments on commit 7ea8d3e

Please sign in to comment.