From be57637a1f4cbdaf3e9cfdaa4eaf43864dff9cab Mon Sep 17 00:00:00 2001 From: Mario <100047175+Mariopizza1@users.noreply.github.com> Date: Mon, 13 Feb 2023 00:27:52 +0200 Subject: [PATCH] Update PlaceLauncher.php --- game/PlaceLauncher.php | 48 ++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/game/PlaceLauncher.php b/game/PlaceLauncher.php index 0fc5d1f..e215a0c 100644 --- a/game/PlaceLauncher.php +++ b/game/PlaceLauncher.php @@ -1,23 +1,45 @@ "Wait", - 2 => "Working", + 1 => "0 or 1 is not an error - it is a sign that we should wait", + 2 => "Success", 3 => "Disabled", 4 => "Failed to start", 5 => "Game ended", - 6 => "Full" + 6 => "GAME_FULL", + 10 => "USER_LEFT" ]; -$status = 2; -$ip = "127.0.0.1"; -$port = 53640; -$job = 69; -$response = [ +$token = $_GET["token"]; +$checkifuser = $con->prepare('SELECT COUNT(*) FROM users WHERE token=:token'); // bruh im too lazy to actually make a auto token generator thing and a table so rn this will be temporary +$checkifuser->bindParam(':token', $token); +$checkifuser->execute(); +$momentoftruth = $checkifuser->fetchColumn(); +if ($momentoftruth == 1) { + $status = "2"; + $ip = $AvailableGameservers[1]; + $port = 64989; + $PortForGame = ""; // also pls define this + $job = ""; // we will define this later when we start the job + $placeid = ""; // also define this + // JOB STARTING CODE GOES HERE PLS HELP NOLAN + // anyways after ur done with that + $sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port) VALUES (:jobid, :placeid, :port)'); + $jobid = "not-null"; // this is just a temp workaround + $sendthatjob->bindParam(':jobid', $jobid); + $tempplaceid = "1818"; + $sendthatjob->bindParam(':placeid', $tempplaceid); // another temporary thing since we don't have random token generator thing and token table + $sendthatjob->bindParam(':port', $PortForGame); + $sendthatjob->execute(); + $response = [ "jobId" => $job, "status" => $status, - "joinScriptUrl" => $site["url"]."/game/join?ip=$ip&port=$port&gameid=1818&jobid=$job", - "authenticationUrl" => $site["url"]."/Login/Negotiate.ashx", - "authenticationTicket" => "1", + "joinScriptUrl" => "http://". $soapcfg['url'] ."/game/join?token=". $token ."&jobid=". $job, + "authenticationUrl" => "http://". $soapcfg['url'] ."/Login/Negotiate.ashx", + "authenticationTicket" => $token, "message" => $allstatus[$status] -]; -echo json_encode($response); \ No newline at end of file + ]; + echo json_encode($response); +} else { + header("Location: /"); +}