diff --git a/globals/Dependencies/Games/Game.php b/globals/Dependencies/Games/Game.php index b427503..25ee396 100644 --- a/globals/Dependencies/Games/Game.php +++ b/globals/Dependencies/Games/Game.php @@ -5,8 +5,43 @@ */ namespace Alphaland\Games { + + use PDO; + class Game { + public static function SetChatStyle(int $assetid, int $enum) + { + if ($enum > -1 && $enum < 3) + { + $update = $GLOBALS['pdo']->prepare("UPDATE assets SET ChatStyleEnum = :enum WHERE id = :i"); + $update->bindParam(":enum", $enum, PDO::PARAM_INT); + $update->bindParam(":i", $assetid, PDO::PARAM_INT); + $update->execute(); + } + } + public static function GetChatStyle(int $assetid) + { + $enum = $GLOBALS['pdo']->prepare("SELECT ChatStyleEnum FROM assets WHERE id = :i"); + $enum->bindParam(":i", $assetid, PDO::PARAM_INT); + $enum->execute(); + return $enum->fetch(PDO::FETCH_OBJ)->ChatStyleEnum; + } + + public static function ConvertChatStyle(int $chatstyle) + { + switch ($chatstyle) + { + case 0: + return "Classic"; + case 1: + return "Bubble"; + case 2: + return "ClassicAndBubble"; + default: + return "ClassicAndBubble"; + } + } } } diff --git a/globals/config.php b/globals/config.php index aa8cf54..0ca9651 100644 --- a/globals/config.php +++ b/globals/config.php @@ -105,6 +105,7 @@ try include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Web/IpRange.php"; include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Web/WebContextManager.php"; include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Common/System.php"; + include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Games/Game.php"; //authenticator $authenticator = new PHPGangsta_GoogleAuthenticator(); diff --git a/html/Game/Join.ashx b/html/Game/Join.ashx index 4c2fd1e..67e2d69 100644 --- a/html/Game/Join.ashx +++ b/html/Game/Join.ashx @@ -5,6 +5,8 @@ Very messy but will clean up */ +use Alphaland\Games\Game; + header("Content-Type: text/plain"); $token = (string)$_GET['ticket']; @@ -73,7 +75,7 @@ if ($_SERVER['HTTP_USER_AGENT'] == $GLOBALS['clientUserAgent']) //user agent res "GameId" => '00000000-0000-0000-0000-000000000000', //not set rn? "PlaceId" => $placeid, "BaseUrl" => $url . "/", - "ChatStyle" => "ClassicAndBubble", //TODO: make an option for this + "ChatStyle" => Game::ConvertChatStyle(Game::GetChatStyle($placeid)), //TODO: make an option for this "VendorId" => 0, //0, dont need this rn? "ScreenShotInfo" => "", //blank, dont need this rn? "VideoInfo" => "", //blank, dont need this rn? diff --git a/html/games/config.php b/html/games/config.php index fa50115..022ad51 100644 --- a/html/games/config.php +++ b/html/games/config.php @@ -1,5 +1,6 @@ bindParam(":i", $id, PDO::PARAM_INT); //catalog id $c->execute(); // ... + + //update place chat style + if (isset($_POST['chatstyle_classic_checkbox'])) { + Game::SetChatStyle($id, 0); + } else if (isset($_POST['chatstyle_bubble_checkbox'])) { + Game::SetChatStyle($id, 1); + } else if (isset($_POST['chatstyle_classicbubble_checkbox'])) { + Game::SetChatStyle($id, 2); + } if (isset($_POST['comments_checkbox'])) { @@ -265,10 +294,6 @@ if(isset($_GET['id'])) if ($placepost !== true) { $alert = "