Skip to content

Commit

Permalink
Merge pull request #219 from timiimit/frontend-changes
Browse files Browse the repository at this point in the history
Couple more server list changes
  • Loading branch information
timiimit authored Mar 17, 2023
2 parents 17c23bf + b62540e commit 6ef359f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div>{{ server.matchState }}</div>
<div>
Elapsed Time:
{{ toMinutesSeconds(server.duration) }}
{{ toMinutesSeconds(server.elapsedTime) }}
</div>
</div>
</div>
Expand Down
12 changes: 10 additions & 2 deletions UT4MasterServer.Web/src/pages/Servers/hooks/use-match.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,29 @@ export function useMatch() {
ServerAttribute.uuForcedMutators
] as string;
const forcedMutators = forcedMutatorsString?.split(',') ?? [];
const elapsedTimeRaw = response.attributes[
ServerAttribute.elapsedTime
] as number;
const elapsedTimeAccurate = Math.round(
(Date.now() -
(new Date(response.lastUpdated).getTime() - elapsedTimeRaw * 1000)) /
1000
);
return {
id,
name:
customMatchNames[id] ??
(response.attributes[ServerAttribute.serverName] as string),
gameType: response.attributes[ServerAttribute.gameType] as string,
map: response.attributes[ServerAttribute.mapName] as string,
matchState,
matchState: matchState,
matchStateDisplay: matchStateMap[matchState] ?? matchState,
maxPlayers: response.attributes[ServerAttribute.maxPlayers] as number,
playersOnline: response.attributes[
ServerAttribute.playersOnline
] as number,
duration: response.attributes[ServerAttribute.matchDuration] as number,
elapsedTime: response.attributes[ServerAttribute.elapsedTime] as number,
elapsedTime: elapsedTimeRaw > 0 ? elapsedTimeAccurate : elapsedTimeRaw,
publicPlayers: response.publicPlayers,
mutators,
gameMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export function useServers() {
function serverFilter(r: IMatchmakingResponse) {
return (
r.attributes[ServerAttribute.gameInstance] !== 1 &&
r.attributes[ServerAttribute.serverInstanceGuid] ===
r.attributes[ServerAttribute.hubGuid] &&
r.attributes[ServerAttribute.gameMode] !== 'EMPTY' &&
!hubFilter(r)
);
}
Expand Down

0 comments on commit 6ef359f

Please sign in to comment.