Skip to content

Commit

Permalink
deploy: 6d9ffe8
Browse files Browse the repository at this point in the history
  • Loading branch information
Askaholic committed Jan 1, 2024
1 parent bad78c2 commit c21153b
Show file tree
Hide file tree
Showing 12 changed files with 1,410 additions and 593 deletions.
227 changes: 186 additions & 41 deletions game_service.html

Large diffs are not rendered by default.

79 changes: 12 additions & 67 deletions gameconnection.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ <h1 class="title">Module <code>server.gameconnection</code></h1>
GameConnectionState,
GameError,
GameState,
ValidityState,
Victory
ValidityState
)
from .games.typedefs import FA
from .player_service import PlayerService
Expand Down Expand Up @@ -163,7 +162,7 @@ <h1 class="title">Module <code>server.gameconnection</code></h1>
&#34;&#34;&#34;
player_state = self.player.state
if player_state == PlayerState.HOSTING:
await self.send_HostGame(self.game.map_folder_name)
await self.send_HostGame(self.game.map.folder_name)
self.game.set_hosted()
# If the player is joining, we connect him to host
# followed by the rest of the players.
Expand Down Expand Up @@ -257,25 +256,7 @@ <h1 class="title">Module <code>server.gameconnection</code></h1>
if not self.is_host():
return

if key == &#34;Victory&#34;:
self.game.gameOptions[&#34;Victory&#34;] = Victory.__members__.get(
value.upper(), None
)
else:
self.game.gameOptions[key] = value

if key == &#34;Slots&#34;:
self.game.max_players = int(value)
elif key == &#34;ScenarioFile&#34;:
raw = repr(value)
self.game.map_scenario_path = \
raw.replace(&#34;\\&#34;, &#34;/&#34;).replace(&#34;//&#34;, &#34;/&#34;).replace(&#34;&#39;&#34;, &#34;&#34;)
self.game.map_file_path = &#34;maps/{}.zip&#34;.format(
self.game.map_scenario_path.split(&#34;/&#34;)[2].lower()
)
elif key == &#34;Title&#34;:
with contextlib.suppress(ValueError):
self.game.name = value
await self.game.game_options.set_option(key, value)

self._mark_dirty()

Expand Down Expand Up @@ -368,13 +349,13 @@ <h1 class="title">Module <code>server.gameconnection</code></h1>
async with self._db.acquire() as conn:
result = await conn.execute(
select(coop_map.c.id).where(
coop_map.c.filename == self.game.map_file_path
coop_map.c.filename == self.game.map.file_path
)
)
row = result.fetchone()
if not row:
self._logger.debug(
&#34;can&#39;t find coop map: %s&#34;, self.game.map_file_path
&#34;can&#39;t find coop map: %s&#34;, self.game.map.file_path
)
return
mission = row.id
Expand Down Expand Up @@ -802,7 +783,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
&#34;&#34;&#34;
player_state = self.player.state
if player_state == PlayerState.HOSTING:
await self.send_HostGame(self.game.map_folder_name)
await self.send_HostGame(self.game.map.folder_name)
self.game.set_hosted()
# If the player is joining, we connect him to host
# followed by the rest of the players.
Expand Down Expand Up @@ -896,25 +877,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
if not self.is_host():
return

if key == &#34;Victory&#34;:
self.game.gameOptions[&#34;Victory&#34;] = Victory.__members__.get(
value.upper(), None
)
else:
self.game.gameOptions[key] = value

if key == &#34;Slots&#34;:
self.game.max_players = int(value)
elif key == &#34;ScenarioFile&#34;:
raw = repr(value)
self.game.map_scenario_path = \
raw.replace(&#34;\\&#34;, &#34;/&#34;).replace(&#34;//&#34;, &#34;/&#34;).replace(&#34;&#39;&#34;, &#34;&#34;)
self.game.map_file_path = &#34;maps/{}.zip&#34;.format(
self.game.map_scenario_path.split(&#34;/&#34;)[2].lower()
)
elif key == &#34;Title&#34;:
with contextlib.suppress(ValueError):
self.game.name = value
await self.game.game_options.set_option(key, value)

self._mark_dirty()

Expand Down Expand Up @@ -1007,13 +970,13 @@ <h2 class="section-title" id="header-classes">Classes</h2>
async with self._db.acquire() as conn:
result = await conn.execute(
select(coop_map.c.id).where(
coop_map.c.filename == self.game.map_file_path
coop_map.c.filename == self.game.map.file_path
)
)
row = result.fetchone()
if not row:
self._logger.debug(
&#34;can&#39;t find coop map: %s&#34;, self.game.map_file_path
&#34;can&#39;t find coop map: %s&#34;, self.game.map.file_path
)
return
mission = row.id
Expand Down Expand Up @@ -1704,25 +1667,7 @@ <h3>Methods</h3>
if not self.is_host():
return

if key == &#34;Victory&#34;:
self.game.gameOptions[&#34;Victory&#34;] = Victory.__members__.get(
value.upper(), None
)
else:
self.game.gameOptions[key] = value

if key == &#34;Slots&#34;:
self.game.max_players = int(value)
elif key == &#34;ScenarioFile&#34;:
raw = repr(value)
self.game.map_scenario_path = \
raw.replace(&#34;\\&#34;, &#34;/&#34;).replace(&#34;//&#34;, &#34;/&#34;).replace(&#34;&#39;&#34;, &#34;&#34;)
self.game.map_file_path = &#34;maps/{}.zip&#34;.format(
self.game.map_scenario_path.split(&#34;/&#34;)[2].lower()
)
elif key == &#34;Title&#34;:
with contextlib.suppress(ValueError):
self.game.name = value
await self.game.game_options.set_option(key, value)

self._mark_dirty()</code></pre>
</details>
Expand Down Expand Up @@ -1925,13 +1870,13 @@ <h3>Methods</h3>
async with self._db.acquire() as conn:
result = await conn.execute(
select(coop_map.c.id).where(
coop_map.c.filename == self.game.map_file_path
coop_map.c.filename == self.game.map.file_path
)
)
row = result.fetchone()
if not row:
self._logger.debug(
&#34;can&#39;t find coop map: %s&#34;, self.game.map_file_path
&#34;can&#39;t find coop map: %s&#34;, self.game.map.file_path
)
return
mission = row.id
Expand Down
5 changes: 2 additions & 3 deletions games/coop.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1 class="title">Module <code>server.games.coop</code></h1>
super().__init__(*args, **kwargs)

self.validity = ValidityState.COOP_NOT_RANKED
self.gameOptions.update({
self.game_options.update({
&#34;Victory&#34;: Victory.SANDBOX,
&#34;TeamSpawn&#34;: &#34;fixed&#34;,
&#34;RevealedCivilians&#34;: &#34;No&#34;,
Expand Down Expand Up @@ -99,7 +99,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
super().__init__(*args, **kwargs)

self.validity = ValidityState.COOP_NOT_RANKED
self.gameOptions.update({
self.game_options.update({
&#34;Victory&#34;: Victory.SANDBOX,
&#34;TeamSpawn&#34;: &#34;fixed&#34;,
&#34;RevealedCivilians&#34;: &#34;No&#34;,
Expand Down Expand Up @@ -200,7 +200,6 @@ <h3>Inherited members</h3>
<li><code><a title="server.games.game.Game.is_visible_to_player" href="game.html#server.games.game.Game.is_visible_to_player">is_visible_to_player</a></code></li>
<li><code><a title="server.games.game.Game.launch" href="game.html#server.games.game.Game.launch">launch</a></code></li>
<li><code><a title="server.games.game.Game.load_results" href="game.html#server.games.game.Game.load_results">load_results</a></code></li>
<li><code><a title="server.games.game.Game.map_folder_name" href="game.html#server.games.game.Game.map_folder_name">map_folder_name</a></code></li>
<li><code><a title="server.games.game.Game.persist_results" href="game.html#server.games.game.Game.persist_results">persist_results</a></code></li>
<li><code><a title="server.games.game.Game.players" href="game.html#server.games.game.Game.players">players</a></code></li>
<li><code><a title="server.games.game.Game.remove_game_connection" href="game.html#server.games.game.Game.remove_game_connection">remove_game_connection</a></code></li>
Expand Down
11 changes: 5 additions & 6 deletions games/custom_game.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ <h1 class="title">Module <code>server.games.custom_game</code></h1>
init_mode = InitMode.NORMAL_LOBBY
game_type = GameType.CUSTOM

def __init__(self, id_, *args, **kwargs):
def __init__(self, id, *args, **kwargs):
new_kwargs = {
&#34;rating_type&#34;: RatingType.GLOBAL,
&#34;setup_timeout&#34;: 30
}
new_kwargs.update(kwargs)
super().__init__(id_, *args, **new_kwargs)
super().__init__(id, *args, **new_kwargs)

async def _run_pre_rate_validity_checks(self):
limit = len(self.players) * 60
Expand All @@ -65,7 +65,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<dl>
<dt id="server.games.custom_game.CustomGame"><code class="flex name class">
<span>class <span class="ident">CustomGame</span></span>
<span>(</span><span>id_, *args, **kwargs)</span>
<span>(</span><span>id, *args, **kwargs)</span>
</code></dt>
<dd>
<div class="desc"><p>Object that lasts for the lifetime of a game on FAF.</p></div>
Expand All @@ -78,13 +78,13 @@ <h2 class="section-title" id="header-classes">Classes</h2>
init_mode = InitMode.NORMAL_LOBBY
game_type = GameType.CUSTOM

def __init__(self, id_, *args, **kwargs):
def __init__(self, id, *args, **kwargs):
new_kwargs = {
&#34;rating_type&#34;: RatingType.GLOBAL,
&#34;setup_timeout&#34;: 30
}
new_kwargs.update(kwargs)
super().__init__(id_, *args, **new_kwargs)
super().__init__(id, *args, **new_kwargs)

async def _run_pre_rate_validity_checks(self):
limit = len(self.players) * 60
Expand Down Expand Up @@ -120,7 +120,6 @@ <h3>Inherited members</h3>
<li><code><a title="server.games.game.Game.is_visible_to_player" href="game.html#server.games.game.Game.is_visible_to_player">is_visible_to_player</a></code></li>
<li><code><a title="server.games.game.Game.launch" href="game.html#server.games.game.Game.launch">launch</a></code></li>
<li><code><a title="server.games.game.Game.load_results" href="game.html#server.games.game.Game.load_results">load_results</a></code></li>
<li><code><a title="server.games.game.Game.map_folder_name" href="game.html#server.games.game.Game.map_folder_name">map_folder_name</a></code></li>
<li><code><a title="server.games.game.Game.persist_results" href="game.html#server.games.game.Game.persist_results">persist_results</a></code></li>
<li><code><a title="server.games.game.Game.players" href="game.html#server.games.game.Game.players">players</a></code></li>
<li><code><a title="server.games.game.Game.remove_game_connection" href="game.html#server.games.game.Game.remove_game_connection">remove_game_connection</a></code></li>
Expand Down
Loading

0 comments on commit c21153b

Please sign in to comment.