game dep chatstyle options

This commit is contained in:
Astrologies 2021-12-06 22:35:55 -05:00
parent 69e4cdd724
commit aad0994a8f
4 changed files with 97 additions and 12 deletions

View File

@ -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";
}
}
}
}

View File

@ -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();

View File

@ -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?

View File

@ -1,5 +1,6 @@
<?php
use Alphaland\Games\Game;
use Alphaland\Web\WebContextManager;
$gearsportion = false;
@ -114,6 +115,25 @@ if(isset($_GET['id']))
$commentsstatus = 'checked';
}
$chatclassic = "";
$chatbubble = "";
$chatclassicbubble = "";
switch (Game::GetChatStyle($id))
{
case 0:
$chatclassic = "checked";
break;
case 1:
$chatbubble = "checked";
break;
case 2:
$chatclassicbubble = "checked";
break;
default:
$chatclassicbubble = "checked";
break;
}
$thumbnailstatus = '';
if (isPlaceUsingRender($id))
{
@ -235,6 +255,15 @@ if(isset($_GET['id']))
$c->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 = "<div class='alert alert-danger' role='alert'>".$placepost."</div>";
}
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;
</div>
<hr>
<div class="container text-center">
<hr>
<h5>Chat Style</h5>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" name="comments_checkbox" {$commentsstatus} class="custom-control-input" autocomplete="off" id="comments">
<label class="custom-control-label" for="comments">Comments Enabled</label>
<input type="checkbox" name="chatstyle_classic_checkbox" {$chatclassic} class="custom-control-input sev_check" autocomplete="off" id="chatstyle_classic">
<label class="custom-control-label" for="chatstyle_classic">Classic</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" name="chatstyle_bubble_checkbox" {$chatbubble} class="custom-control-input sev_check" autocomplete="off" id="chatstyle_bubble">
<label class="custom-control-label" for="chatstyle_bubble">Bubble</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" name="chatstyle_classicbubble_checkbox" {$chatclassicbubble} class="custom-control-input sev_check" autocomplete="off" id="chatstyle_classicbubble">
<label class="custom-control-label" for="chatstyle_classicbubble">Classic And Bubble</label>
</div>
</div>
</hr>
<hr>
<div class="container text-center marg-bot-15">
<label for="playerrange" style="float:left;text-align:top;">Max Players</label>
<h5>Max Players</h5>
<input class="form-control-range custom-range" min="1" max="12" name="gdskill[1]" id="gdskill1" value="{$gamemaxplayers}" step="1" type="range" name="placemaxplayers" oninput="Output1.value = gdskill1.value">
<output id="Output1" class="output" style="font-size:18px;">{$gamemaxplayers}</output>
<datalist id="ticks">
@ -519,6 +552,16 @@ EOT;
<option>12</option>
</datalist>
</div>
<hr>
<div class="text-center mb-3">
<h5>Miscellaneous</h5>
</div>
<div class="text-center mb-3">
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" name="comments_checkbox" {$commentsstatus} class="custom-control-input" autocomplete="off" id="comments">
<label class="custom-control-label" for="comments">Comments Enabled</label>
</div>
</div>
<div class="text-center">
<h6>If you'd like to use the last Studio position as the Thumbnail, check it below</h6>
<h6>When you update this place through Studio with this ticked, the Thumbnail will update with the current position</h6>
@ -631,6 +674,10 @@ function checkTick()
}
checkTick()
$('.sev_check').click(function() {
$('.sev_check').not(this).prop('checked', false);
});
</script>
EOT;