Update test.php

This commit is contained in:
Mario 2023-05-22 13:20:03 +03:00 committed by GitHub
parent df96461ca0
commit 7e0bf54cba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 196 additions and 199 deletions

View File

@ -1,4 +1,5 @@
<?php <?php
// THIS IS A TEST DO NOT INCLUDE IN PRODUCTION
require_once 'core/config.php'; require_once 'core/config.php';
require_once 'core/classes.php'; require_once 'core/classes.php';
function generateRandomJobId() { function generateRandomJobId() {
@ -24,41 +25,37 @@ function generateRandomString($length = 25) {
} }
return $randomString; return $randomString;
} }
$accesstoken = 'test'; $accesstoken = generateRandomString(70);
$port = rand(5000,5999); $port = rand(5000,5999);
$jobid = generateRandomJobId(); $jobid = generateRandomJobId();
$zero = 0; $placeid = 1818;
$false = 'false'; $ip = $AvailableGameservers["1"];
$sixty = '60';
$address = '192.168.1.130';
$two = '2';
$one = '1';
$RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("127.0.0.1", 64989); $RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("127.0.0.1", 64989);
$script = ' $script = 'print("Starting gameserver at placeid: '. $placeid .' on port: '. $port .' with JobID: '. $jobid .'")
-- Start Game Script Arguments -- Start Game Script Arguments
local placeId = '. "1818" .' local placeId = '. $placeid .'
local port = '. $port .' local port = '. $port .'
local gameId = "'. $jobid .'" local gameId = "'. $jobid .'"
local sleeptime = '. $zero .' local sleeptime = 0
local access = "'. $accesstoken .'" local access = "'. $accesstoken .'"
local deprecated = '. $false .' local deprecated = false
local timeout = '. $sixty .' local timeout = 60
local machineAddress = "'. $address .'" local machineAddress = "'. $ip .'"
local gsmInterval = '. $two .' local gsmInterval = 2
local baseUrl = "sierraf.tk" local baseUrl = "sierraf.tk"
local maxPlayers = '. $sixty .' local maxPlayers = 60
local maxGameInstances = '. $one .' local maxGameInstances = 1
local injectScriptAssetID = '. $zero .' local injectScriptAssetID = 0
local apiKey = "'. $accesstoken .'" local apiKey = "'. $accesstoken .'"
local libraryRegistrationScriptAssetID = '. $zero .' local libraryRegistrationScriptAssetID = 0
local deprecated_pingTimesReportInterval = '. $two .' local deprecated_pingTimesReportInterval = 2
local gameCode = '. "0000" .' local gameCode = 0
local universeId = "'. $jobid .'" local universeId = "'. $jobid .'"
local preferredPlayerCapacity = '. $sixty .' local preferredPlayerCapacity = 60
local matchmakingContextId = '. $zero .' local matchmakingContextId = 0
local placeVisitAccessKey = "'. $accesstoken .'" local placeVisitAccessKey = "'. $accesstoken .'"
local assetGameSubdomain = "assetgame" local assetGameSubdomain = "assetgame"
local protocol = "'. "https://" .'" local protocol = "https://"
-----------------------------------"CUSTOM" SHARED CODE---------------------------------- -----------------------------------"CUSTOM" SHARED CODE----------------------------------
@ -78,6 +75,7 @@ $RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("127.0.0.1", 64989);
local assetId = placeId -- might be able to remove this now local assetId = placeId -- might be able to remove this now
local url = nil local url = nil
local assetGameUrl = nil local assetGameUrl = nil
local accesstoken = placeVisitAccessKey
if baseUrl~=nil and protocol ~= nil then if baseUrl~=nil and protocol ~= nil then
url = protocol .. "www." .. baseUrl --baseUrl is actually the domain, no leading . url = protocol .. "www." .. baseUrl --baseUrl is actually the domain, no leading .
assetGameUrl = protocol .. assetGameSubdomain .. "." .. baseUrl assetGameUrl = protocol .. assetGameSubdomain .. "." .. baseUrl
@ -109,7 +107,7 @@ $RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("127.0.0.1", 64989);
pcall(function() game:GetService("Players"):SetAbuseReportUrl(url .. "/AbuseReport/InGameChatHandler.ashx") end) pcall(function() game:GetService("Players"):SetAbuseReportUrl(url .. "/AbuseReport/InGameChatHandler.ashx") end)
pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(assetGameUrl .. "/Asset/") end) pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(assetGameUrl .. "/Asset/") end)
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(url .. "/") end) pcall(function() game:GetService("ContentProvider"):SetBaseUrl(url .. "/") end)
pcall(function() game:GetService("Players"):SetChatFilterUrl(assetGameUrl .. "/Game/ChatFilter.ashx") end) -- pcall(function() game:GetService("Players"):SetChatFilterUrl(assetGameUrl .. "/Game/ChatFilter.ashx") end)
if gameCode then if gameCode then
game:SetVIPServerId(tostring(gameCode)) game:SetVIPServerId(tostring(gameCode))
@ -165,7 +163,7 @@ $RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("127.0.0.1", 64989);
-- game:HttpGet(assetGameUrl .. "/Game/ClientPresence.ashx?action=connect&PlaceID=" .. placeId .. "&UserID=" .. player.userId) -- game:HttpGet(assetGameUrl .. "/Game/ClientPresence.ashx?action=connect&PlaceID=" .. placeId .. "&UserID=" .. player.userId)
if not isCloudEdit then if not isCloudEdit then
-- game:HttpPost(assetGameUrl .. "/Game/PlaceVisit.ashx?UserID=" .. player.userId .. "&AssociatedPlaceID=" .. placeId .. "&placeVisitAccessKey=" .. placeVisitAccessKey .. "&IsTeleport=" .. didTeleportIn, "") game:HttpPost(assetGameUrl .. "/Game/PlaceVisit.ashx?UserID=" .. player.userId .. "&AssociatedPlaceID=" .. placeId .. "&placeVisitAccessKey=" .. placeVisitAccessKey .. "&IsTeleport=" .. didTeleportIn, "")
end end
end end
end) end)
@ -177,7 +175,7 @@ $RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("127.0.0.1", 64989);
if player.Teleported then isTeleportingOut = "True" end if player.Teleported then isTeleportingOut = "True" end
if assetGameUrl and access and placeId and player and player.userId then if assetGameUrl and access and placeId and player and player.userId then
-- game:HttpGet(assetGameUrl .. "/Game/ClientPresence.ashx?action=disconnect&PlaceID=" .. placeId .. "&UserID=" .. player.userId .. "&IsTeleport=" .. isTeleportingOut) game:HttpGet(assetGameUrl .. "/Game/ClientPresence.ashx?action=disconnect&PlaceID=" .. placeId .. "&UserID=" .. player.userId .. "&IsTeleport=" .. isTeleportingOut .. "&placeVisitAccessKey=" .. accesstoken)
end end
end) end)
@ -187,7 +185,7 @@ $RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("127.0.0.1", 64989);
wait() wait()
-- load the game -- load the game
game:Load(assetGameUrl .. "/asset/?id=" .. placeId) game:Load(assetGameUrl .. "/asset/?id=" .. placeId .. "&accesstoken=" .. accesstoken)
end end
-- Configure CloudEdit saving after place has been loaded -- Configure CloudEdit saving after place has been loaded
@ -233,4 +231,3 @@ $RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("127.0.0.1", 64989);
$job = new Roblox\Grid\Rcc\Job($jobid, 99999999999); // pls only set to this amount WHEN ur hosting a gameserver when ur rendering do like 10 minutes $job = new Roblox\Grid\Rcc\Job($jobid, 99999999999); // pls only set to this amount WHEN ur hosting a gameserver when ur rendering do like 10 minutes
$funny = new Roblox\Grid\Rcc\ScriptExecution("Script".rand(1,getrandmax()), $script); $funny = new Roblox\Grid\Rcc\ScriptExecution("Script".rand(1,getrandmax()), $script);
$result = $RCCServiceSoap->OpenJob($job, $funny); $result = $RCCServiceSoap->OpenJob($job, $funny);
echo '<pre>' . var_export($RCCServiceSoap, true) . '</pre>';