-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
3,411 additions
and
2,505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Gameap\Http\Responses\GdaemonAPI; | ||
|
||
class GameModResponse implements \JsonSerializable | ||
{ | ||
/** @var \Gameap\Models\GameMod */ | ||
private $gameMod; | ||
|
||
/** @var string */ | ||
private $os; | ||
|
||
public function __construct(\Gameap\Models\GameMod $gameMod, string $os = 'linux') | ||
{ | ||
$this->gameMod = $gameMod; | ||
$this->os = $os; | ||
} | ||
|
||
public function jsonSerialize() | ||
{ | ||
$remoteRepository = ''; | ||
$localRepository = ''; | ||
$defaultStartCmd = ''; | ||
if ($this->os === 'linux') { | ||
$remoteRepository = $this->gameMod->remote_repository_linux; | ||
$localRepository = $this->gameMod->local_repository_linux; | ||
$defaultStartCmd = $this->gameMod->start_cmd_linux; | ||
} elseif ($this->os === 'windows') { | ||
$remoteRepository = $this->gameMod->remote_repository_windows; | ||
$localRepository = $this->gameMod->local_repository_windows; | ||
$defaultStartCmd = $this->gameMod->start_cmd_windows; | ||
} | ||
|
||
return [ | ||
'id' => $this->gameMod->id, | ||
'game_code' => $this->gameMod->game_code, | ||
'name' => $this->gameMod->name, | ||
'vars' => $this->gameMod->vars, | ||
'remote_repository' => $remoteRepository, | ||
'local_repository' => $localRepository, | ||
'default_start_cmd' => $defaultStartCmd, | ||
'default_start_cmd_linux' => $this->gameMod->start_cmd_linux, | ||
'default_start_cmd_windows' => $this->gameMod->start_cmd_windows, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Gameap\Http\Responses\GdaemonAPI; | ||
|
||
use Gameap\Models\Game; | ||
|
||
class GameResponse implements \JsonSerializable | ||
{ | ||
/** @var Game */ | ||
private $game; | ||
|
||
private $os; | ||
|
||
public function __construct(Game $game, string $os = 'linux') | ||
{ | ||
$this->game = $game; | ||
$this->os = $os; | ||
} | ||
|
||
public function jsonSerialize() | ||
{ | ||
$remoteRepository = ''; | ||
$localRepository = ''; | ||
$steamAppId = ''; | ||
|
||
if ($this->os === 'linux') { | ||
$remoteRepository = $this->game->remote_repository_linux; | ||
$localRepository = $this->game->local_repository_linux; | ||
$steamAppId = $this->game->steam_app_id_linux; | ||
} elseif ($this->os === 'windows') { | ||
$remoteRepository = $this->game->remote_repository_windows; | ||
$localRepository = $this->game->local_repository_windows; | ||
$steamAppId = $this->game->steam_app_id_windows; | ||
} | ||
|
||
return [ | ||
'code' => $this->game->code, | ||
'start_code' => $this->game->start_code, | ||
'name' => $this->game->name, | ||
'engine' => $this->game->engine, | ||
'engine_version' => $this->game->engine_version, | ||
'remote_repository' => $remoteRepository, | ||
'local_repository' => $localRepository, | ||
'steam_app_id' => $steamAppId, | ||
'steam_app_set_config' => $this->game->steam_app_set_config, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace Gameap\Http\Responses\GdaemonAPI; | ||
|
||
use Gameap\Models\Game; | ||
use Gameap\Models\GameMod; | ||
use Gameap\Models\Server; | ||
use Symfony\Component\Serializer\SerializerInterface; | ||
|
||
class ServerResponse implements \JsonSerializable | ||
{ | ||
/** @var Server */ | ||
private $server; | ||
|
||
public function __construct(Server $server) | ||
{ | ||
$this->server = $server; | ||
} | ||
|
||
public function jsonSerialize() | ||
{ | ||
$gameModResponse = new GameModResponse($this->server->gameMod, $this->server->dedicatedServer->os); | ||
$gameResponse = new GameResponse($this->server->game, $this->server->dedicatedServer->os); | ||
|
||
return [ | ||
'id' => $this->server->id, | ||
'uuid' => $this->server->uuid, | ||
'uuid_short' => $this->server->uuid_short, | ||
'enabled' => $this->server->enabled, | ||
'installed' => $this->server->installed, | ||
'blocked' => $this->server->blocked, | ||
'name' => $this->server->name, | ||
'ds_id' => $this->server->ds_id, | ||
'game_id' => $this->server->game_id, | ||
'game_mod_id' => $this->server->game_mod_id, | ||
'expires' => $this->server->expires, | ||
'server_ip' => $this->server->server_ip, | ||
'server_port' => $this->server->server_port, | ||
'query_port' => $this->server->query_port, | ||
'rcon_port' => $this->server->rcon_port, | ||
'rcon' => $this->server->rcon, | ||
'dir' => $this->server->dir, | ||
'su_user' => $this->server->su_user, | ||
'cpu_limit' => $this->server->cpu_limit, | ||
'ram_limit' => $this->server->ram_limit, | ||
'net_limit' => $this->server->net_limit, | ||
'start_command' => $this->server->start_command, | ||
'stop_command' => $this->server->stop_command, | ||
'force_stop_command' => $this->server->force_stop_command, | ||
'restart_command' => $this->server->restart_command, | ||
'process_active' => $this->server->process_active, | ||
'last_process_check' => $this->server->last_process_check, | ||
'vars' => $this->server->vars, | ||
'created_at' => $this->server->created_at, | ||
'updated_at' => $this->server->updated_at, | ||
'deleted_at' => $this->server->deleted_at, | ||
'settings' => $this->server->settings, | ||
'game' => $gameResponse->jsonSerialize(), | ||
'game_mod' => $gameModResponse->jsonSerialize(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.