Update PlaceLauncher.php

This commit is contained in:
Mario 2023-02-27 00:12:26 +02:00 committed by GitHub
parent 935fee821f
commit 898114647c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 118 additions and 110 deletions

View File

@ -64,7 +64,7 @@ if ($momentoftruth == 1) {
]; ];
echo json_encode($response); echo json_encode($response);
} else if ($okcheck == 0) { } else if ($okcheck == 0) {
$passedplacelauncher = '1'; $passedplacelauncher = '0'; // IF THIS IS 0 THEN IT MEANS PLACELAUNCHER HASN'T PASSED MAKE SURE THIS IS ONLY IN UR TESTING
$hahatroll = $con->prepare('UPDATE tokens SET passedplacelauncher = :passedplacelauncher WHERE token=:token'); $hahatroll = $con->prepare('UPDATE tokens SET passedplacelauncher = :passedplacelauncher WHERE token=:token');
$hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher); $hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher);
$hahatroll->bindParam(':token', $token); $hahatroll->bindParam(':token', $token);
@ -84,6 +84,15 @@ if ($momentoftruth == 1) {
return $p1."-".$p2."-".$p3."-".$p4."-".$p5; return $p1."-".$p2."-".$p3."-".$p4."-".$p5;
} }
$jobid = generateRandomJobId(); $jobid = generateRandomJobId();
function generateRandomString($length = 25) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[random_int(0, $charactersLength - 1)];
}
return $randomString;
}
$port = rand(5000,5999); $port = rand(5000,5999);
$checkport = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token AND passedplacelauncher=:passed'); $checkport = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token AND passedplacelauncher=:passed');
$checkport->bindParam(':token', $token); $checkport->bindParam(':token', $token);
@ -94,117 +103,116 @@ if ($momentoftruth == 1) {
$port = rand(5000,5999); // great heavens if this ever happens report to me $port = rand(5000,5999); // great heavens if this ever happens report to me
die("How did we get here?"); die("How did we get here?");
} else if ($okbrahh == 0) { } else if ($okbrahh == 0) {
$RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("127.0.0.1", 64989); $accesstoken = generateRandomString(500);
$script = ' echo $accesstoken;
------------------- UTILITY FUNCTIONS -------------------------- $okaccesstoken = $con->prepare('INSERT INTO accesstokens (ip, accesstoken, placeid) VALUES (:ip, :accesstoken, :placeid)');
$okaccesstoken->bindParam(':ip', $AvailableGameservers[1]);
$okaccesstoken->bindParam(':accesstoken', $accesstoken);
$okaccesstoken->bindParam(':placeid', $placeid);
$okaccesstoken->execute();
$RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("192.168.1.129", 64989);
$https = "https://";
$script = 'print("Starting a new gameserver with JobID: " .. "' . $jobid . '" .. " and PlaceID: " .. "' . $placeid . '")
local placeId = ' . (int)$placeid . '
function waitForChild(parent, childName) local url = "'. $https . $soapcfg['url'] . '"
while true do local accesstoken = "' . $accesstoken . '"
local child = parent:findFirstChild(childName)
if child then ------------------- UTILITY FUNCTIONS --------------------------
return child function waitForChild(parent, childName)
while true do
local child = parent:findFirstChild(childName)
if child then
return child
end
parent.ChildAdded:wait()
end
end end
parent.ChildAdded:wait() -----------------------------------END UTILITY FUNCTIONS -------------------------
end -----------------------------------"CUSTOM" SHARED CODE----------------------------------
end pcall(function() settings().Network.UseInstancePacketCache = true end)
pcall(function() settings().Network.UsePhysicsPacketCache = true end)
-----------------------------------END UTILITY FUNCTIONS ------------------------- --pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.FIFO end)
pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError end)
-----------------------------------"CUSTOM" SHARED CODE---------------------------------- --settings().Network.PhysicsSend = 1 -- 1==RoundRobin
--settings().Network.PhysicsSend = Enum.PhysicsSendMethod.ErrorComputation2
pcall(function() settings().Network.UseInstancePacketCache = true end) settings().Network.PhysicsSend = Enum.PhysicsSendMethod.TopNErrors
pcall(function() settings().Network.UsePhysicsPacketCache = true end) settings().Network.ExperimentalPhysicsEnabled = true
--pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.FIFO end) settings().Network.WaitingForCharacterLogRate = 100
pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError end) pcall(function() settings().Diagnostics:LegacyScriptMode() end)
-----------------------------------START GAME SHARED SCRIPT------------------------------
--settings().Network.PhysicsSend = 1 -- 1==RoundRobin local assetId = placeId -- might be able to remove this now
--settings().Network.PhysicsSend = Enum.PhysicsSendMethod.ErrorComputation2 local scriptContext = game:GetService("ScriptContext")
settings().Network.PhysicsSend = Enum.PhysicsSendMethod.TopNErrors pcall(function() scriptContext:AddStarterScript(37801172) end)
settings().Network.ExperimentalPhysicsEnabled = true scriptContext.ScriptsDisabled = true
settings().Network.WaitingForCharacterLogRate = 100 game:SetPlaceID(assetId, false)
pcall(function() settings().Diagnostics:LegacyScriptMode() end) game:GetService("ChangeHistoryService"):SetEnabled(false)
-- establish this peer as the Server
-----------------------------------START GAME SHARED SCRIPT------------------------------ local ns = game:GetService("NetworkServer")
if url~=nil then
local assetId = '. $placeid .' -- might be able to remove this now pcall(function() game:GetService("Players"):SetAbuseReportUrl(url .. "/AbuseReport/InGameChatHandler.ashx") end)
pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(url .. "/Asset/") end)
local scriptContext = game:GetService("ScriptContext") pcall(function() game:GetService("ContentProvider"):SetBaseUrl(url .. "/") end)
pcall(function() scriptContext:AddStarterScript(37801172) end) --pcall(function() game:GetService("Players"):SetChatFilterUrl(url .. "/Game/ChatFilter.ashx") end)
scriptContext.ScriptsDisabled = true game:GetService("BadgeService"):SetPlaceId(placeId)
game:GetService("BadgeService"):SetIsBadgeLegalUrl("")
game:SetPlaceID(assetId, false) game:GetService("InsertService"):SetBaseSetsUrl(url .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base")
game:GetService("ChangeHistoryService"):SetEnabled(false) game:GetService("InsertService"):SetUserSetsUrl(url .. "/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d")
game:GetService("InsertService"):SetCollectionUrl(url .. "/Game/Tools/InsertAsset.ashx?sid=%d")
-- establish this peer as the Server game:GetService("InsertService"):SetAssetUrl(url .. "/Asset/?id=%d")
local ns = game:GetService("NetworkServer") game:GetService("InsertService"):SetAssetVersionUrl(url .. "/Asset/?assetversionid=%d")
if url~=nil then pcall(function() loadfile(url .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end)
pcall(function() game:GetService("Players"):SetAbuseReportUrl(url .. "/AbuseReport/InGameChatHandler.ashx") end)
pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(url .. "/Asset/") end) -- pcall(function()
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(url .. "/") end) -- if access then
pcall(function() game:GetService("Players"):SetChatFilterUrl(url .. "/Game/ChatFilter.ashx") end) -- loadfile(url .. "/Game/PlaceSpecificScript.ashx?PlaceId=" .. placeId .. "&" .. access)()
-- end
game:GetService("BadgeService"):SetPlaceId("1818") -- end)
end
game:GetService("BadgeService"):SetIsBadgeLegalUrl("") pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end)
game:GetService("InsertService"):SetBaseSetsUrl(url .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base") settings().Diagnostics.LuaRamLimit = 0
game:GetService("InsertService"):SetUserSetsUrl(url .. "/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d") --settings().Network:SetThroughputSensitivity(0.08, 0.01)
game:GetService("InsertService"):SetCollectionUrl(url .. "/Game/Tools/InsertAsset.ashx?sid=%d") --settings().Network.SendRate = 35
game:GetService("InsertService"):SetAssetUrl(url .. "/Asset/?id=%d") --settings().Network.PhysicsSend = 0 -- 1==RoundRobin
game:GetService("InsertService"):SetAssetVersionUrl(url .. "/Asset/?assetversionid=%d") game:GetService("Players").PlayerAdded:connect(function(player)
// if game.Players.NumPlayers ~= 0 then
pcall(function() loadfile(url .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end) // print(game:HttpGet("'. $https . $soapcfg['url'] . '/api/UpdatePlayerCount?accesstoken=" .. accesstoken .. "&playercount=" .. game.Players.NumPlayers))
// print("Successfully Updated Player count for JobID: " . "' . $jobid . '")
-- pcall(function() // else
-- if access then // print(game:HttpGet("'. $https . $soapcfg['url'] . '/api/CloseJob?accesstoken=" .. accesstoken))
-- loadfile(url .. "/Game/PlaceSpecificScript.ashx?PlaceId=" .. placeId .. "&" .. access)() // print("Job ID: " .. "' . $jobid . '" .. " is closing due to no active players.")
-- end // end
-- end) print("Player " .. player.userId .. " added")
end end)
game:GetService("Players").PlayerRemoving:connect(function(player)
--pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end) // if game.Players.NumPlayers ~= 0 then
settings().Diagnostics.LuaRamLimit = 0 // print(game:HttpGet("'. $https . $soapcfg['url'] . '/api/UpdatePlayerCount?accesstoken=" .. accesstoken .. "&playercount=" .. game.Players.NumPlayers))
--settings().Network:SetThroughputSensitivity(0.08, 0.01) // print("Successfully Updated Player count for JobID: " . "' . $jobid . '")
--settings().Network.SendRate = 35 // else
--settings().Network.PhysicsSend = 0 -- 1==RoundRobin // print(game:HttpGet("'. $https . $soapcfg['url'] . '/api/CloseJob?accesstoken=" .. accesstoken))
// print("Job ID: " .. "' . $jobid . '" .. " is closing due to no active players.")
// end
game:GetService("Players").PlayerAdded:connect(function(player) print("Player " .. player.userId .. " leaving")
print("Player " .. player.userId .. " added") end)
end) if placeId~=nil and url~=nil then
-- yield so that file load happens in the heartbeat thread
game:GetService("Players").PlayerRemoving:connect(function(player) wait()
print("Player " .. player.userId .. " leaving")
end) -- load the game
game:Load(url .. "/asset/?id=" .. placeId .. "?accesstoken=" .. accesstoken)
if placeId~=nil and url~=nil then end
-- yield so that file load happens in the heartbeat thread -- Now start the connection
wait() ns:Start(' . $port . ')
scriptContext:SetTimeout(10)
-- load the game scriptContext.ScriptsDisabled = false
game:Load(url .. "/asset/?id=" .. placeId) ------------------------------END START GAME SHARED SCRIPT--------------------------
end -- StartGame --
game:GetService("RunService"):Run()
-- Now start the connection ';
ns:Start('. $port .') $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);
$result = $RCCServiceSoap->OpenJob($job, $funny);
scriptContext:SetTimeout(10)
scriptContext.ScriptsDisabled = false
------------------------------END START GAME SHARED SCRIPT--------------------------
-- StartGame --
game:GetService("RunService"):Run()
';
$job = new Roblox\Grid\Rcc\Job($jobid, 9999999999); // 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", $script);
$result = $RCCServiceSoap->BatchJob($job, $funny);
$sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port, ip) VALUES (:jobid, :placeid, :port, :ip)'); $sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port, ip) VALUES (:jobid, :placeid, :port, :ip)');
$sendthatjob->bindParam(':jobid', $jobid); $sendthatjob->bindParam(':jobid', $jobid);
$sendthatjob->bindParam(':placeid', $placeid); // another temporary thing since we don't have random token generator thing and token table $sendthatjob->bindParam(':placeid', $placeid); // another temporary thing since we don't have random token generator thing and token table