From aad0994a8f9fbdb5b9a01c65132c02a79878425a Mon Sep 17 00:00:00 2001 From: Astrologies Date: Mon, 6 Dec 2021 22:35:55 -0500 Subject: [PATCH] game dep chatstyle options --- globals/Dependencies/Games/Game.php | 35 +++++++++++++++ globals/config.php | 1 + html/Game/Join.ashx | 4 +- html/games/config.php | 69 ++++++++++++++++++++++++----- 4 files changed, 97 insertions(+), 12 deletions(-) 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 = ""; } - else - { - WebContextManager::Redirect("config?id={$id}"); - } } } else @@ -307,8 +332,6 @@ if(isset($_GET['id'])) resize(768, 432, $thumbnailuploadDirectory . $thumbnailHash, $_FILES['thumbnail_file']['tmp_name']); setPlaceUsingCustomThumbnail($id); //set not using rendered thumb - - WebContextManager::Redirect("config?id={$id}"); } else { @@ -325,10 +348,10 @@ if(isset($_GET['id'])) setPlaceUsingCustomThumbnail($id); //set not using rendered thumb } - WebContextManager::Redirect("config?id={$id}"); } // ... } + WebContextManager::Redirect("config?id={$id}"); } } @@ -494,14 +517,24 @@ EOT;
+
+
Chat Style
- - + + +
+
+ + +
+
+ +
- +
- +
Max Players
{$gamemaxplayers} @@ -519,6 +552,16 @@ EOT;
+
+
+
Miscellaneous
+
+
+
+ + +
+
If you'd like to use the last Studio position as the Thumbnail, check it below
When you update this place through Studio with this ticked, the Thumbnail will update with the current position
@@ -631,6 +674,10 @@ function checkTick() } checkTick() +$('.sev_check').click(function() { + $('.sev_check').not(this).prop('checked', false); +}); + EOT;