Skip to content

Commit

Permalink
Merge pull request PreMiD#1724 from PreMiD/semid/qa/2020-06-10-00-19
Browse files Browse the repository at this point in the history
🤖 Semi-weekly SE
  • Loading branch information
mergify[bot] authored Jun 10, 2020
2 parents d48b748 + 3daee27 commit bf3206f
Show file tree
Hide file tree
Showing 21 changed files with 404 additions and 368 deletions.
4 changes: 2 additions & 2 deletions websites/0-9/20XX/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"en": "20XX is a unique platform MOBA which includes a variety of characters and maps to play on."
},
"service": "20XX",
"version": "1.0.0",
"version": "1.0.1",
"logo": "https://i.imgur.com/yamlw9T.png",
"thumbnail": "https://i.imgur.com/ok9ArGU.jpg",
"color": "#9AD1FD",
Expand All @@ -30,4 +30,4 @@
"value": true
}
]
}
}
81 changes: 44 additions & 37 deletions websites/0-9/20XX/iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,56 +73,63 @@ interface Spawn20XX {
// what map is being played by it's data.
const guessKeys: ItemMap = {
// 'xBound:yBound:camPosX:camPosY:spawnCount:doodadCount': 'mapID'
'32:32:11:15.75:24:36': 'attack',
'32:32:15.5:15.5:29:88': 'combat',
'24:48:11.5:23.5:43:106': 'battle',
'48:48:23:22:62:337': 'big',
'32:32:15.5:15.5:39:78': 'final',
'32:32:14.5:5.5:44:84': 'area',
'32:32:n:48:49': 'location',
'32:32:15:15:56:66': 'position',
'32:32:15.5:15.5:39:57': 'point',
'48:28:23.5:13.5:55:160': 'platform',
'32:32:15.5:15.5:58:57': 'vector',
'32:32:n:33:163': 'dig',
'48:48:23.5:23.5:44:101': 'war',
'32:32:15.5:15.25:46:72': 'unearth',
'48:48:23:23:46:492': 'excavate'
"32:32:11:15.75:24:36": "attack",
"32:32:15.5:15.5:29:88": "combat",
"24:48:11.5:23.5:43:106": "battle",
"48:48:23:22:62:337": "big",
"32:32:15.5:15.5:39:78": "final",
"32:32:14.5:5.5:44:84": "area",
"32:32:n:48:49": "location",
"32:32:15:15:56:66": "position",
"32:32:15.5:15.5:39:57": "point",
"48:28:23.5:13.5:55:160": "platform",
"32:32:15.5:15.5:58:57": "vector",
"32:32:n:33:163": "dig",
"48:48:23.5:23.5:44:101": "war",
"32:32:15.5:15.25:46:72": "unearth",
"48:48:23:23:46:492": "excavate"
};

// Guesses the map via the map object
function guessMap (map: Map20XX): string {
const camera = map.spawns.find((spawn: Spawn20XX) => spawn.type === 'camera');
const cameraKey = camera ? `${camera.pos.x}:${camera.pos.y}` : 'n';
function guessMap(map: Map20XX): string {
const camera = map.spawns.find((spawn: Spawn20XX) => spawn.type === "camera");
const cameraKey = camera ? `${camera.pos.x}:${camera.pos.y}` : "n";
const guessKey = `${map.size.x}:${map.size.y}:${cameraKey}:${map.spawns.length}:${map.doodads.length}`;
return guessKeys[guessKey] || null;
}

iframe.on("UpdateData", async () => {
const main = (window as Window20XX)['main'];
const main = (window as Window20XX)["main"];
if (!main) return;

const data = {
user: main.net.user ? {
displayName: main.net.display,
isGuest: main.net.guest,
username: main.net.user,
isDonator: main.net.type === 1,
rank: main.stats ? main.stats.rank : null
} : null,
user: main.net.user
? {
displayName: main.net.display,
isGuest: main.net.guest,
username: main.net.user,
isDonator: main.net.type === 1,
rank: main.stats ? main.stats.rank : null
}
: null,
serverInfo: main.net.game.info || null,
game: main.game ? {
character: main.game.charSelect,
gameOver: main.game.gameOver,
info: {
...main.game.settings,
players: main.game.ui.score.scores.length
},
score: main.game.ui.score.scores.find((score: Score20XX) => score.name.replace('γ', '') === main.net.display),
map: guessMap(main.game.map)
} : null,
game: main.game
? {
character: main.game.charSelect,
gameOver: main.game.gameOver,
info: {
...main.game.settings,
players: main.game.ui.score.scores.length
},
score: main.game.ui.score.scores.find(
(score: Score20XX) =>
score.name.replace("γ", "") === main.net.display
),
map: guessMap(main.game.map)
}
: null,
nav: main.menu.lastNav
};

iframe.send(data);
});
});
75 changes: 39 additions & 36 deletions websites/0-9/20XX/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,32 @@ interface ItemMap {

// A map of character prefixes with their names.
const characterNameMap: ItemMap = {
box: 'Box',
crt: 'Crate',
qua: 'Quad',
vox: 'Voxel',
blk: 'Block',
crg: 'Cargo',
inf: 'Plus'
box: "Box",
crt: "Crate",
qua: "Quad",
vox: "Voxel",
blk: "Block",
crg: "Cargo",
inf: "Plus"
};

// A map of map IDs with their names.
const mapNameMap: ItemMap = {
attack: 'Attack Area',
battle: 'Battle Field',
big: 'Big Place',
area: '404',
combat: 'Combat Zone',
final: 'Final Destination',
location: 'Last Location',
platform: 'Penultimate Platform',
point: 'Prerequisite Point',
position: 'Primary Position',
vector: 'Veritable Vector',
war: 'War Ground',
dig: 'Dig',
unearth: 'Unearth',
excavate: 'Excavate'
attack: "Attack Area",
battle: "Battle Field",
big: "Big Place",
area: "404",
combat: "Combat Zone",
final: "Final Destination",
location: "Last Location",
platform: "Penultimate Platform",
point: "Prerequisite Point",
position: "Primary Position",
vector: "Veritable Vector",
war: "War Ground",
dig: "Dig",
unearth: "Unearth",
excavate: "Excavate"
};

// The timestamp of the first time a game was detected.
Expand Down Expand Up @@ -105,40 +105,43 @@ presence.on("UpdateData", async () => {
}

if (data20XX.user) {
data.state = `${data20XX.user.displayName} (${data20XX.user.isGuest ? 'guest' : `rank ${data20XX.user.rank}`})`;
data.state = `${data20XX.user.displayName} (${
data20XX.user.isGuest ? "guest" : `rank ${data20XX.user.rank}`
})`;
if (data20XX.serverInfo)
data.state += ` in ${data20XX.serverInfo.location}`;
}

if (data20XX.game) {
data.details = `In-Game - ${data20XX.game.info.gametype} (${data20XX.game.info.players}/${data20XX.game.info.maxplayers})`;

if (!gameStartTimestamp)
gameStartTimestamp = Date.now();

if (!gameStartTimestamp) gameStartTimestamp = Date.now();

// Character
data.smallImageKey = 'char_' + data20XX.game.character.split('_')[0];
data.smallImageText = characterNameMap[data20XX.game.character.split('_')[0]];
data.smallImageKey = "char_" + data20XX.game.character.split("_")[0];
data.smallImageText =
characterNameMap[data20XX.game.character.split("_")[0]];

// Map
if (data20XX.game.map) {
data.largeImageKey = 'map_' + data20XX.game.map;
data.smallImageText = `${mapNameMap[data20XX.game.map]} - ${data.smallImageText}`;
data.largeImageKey = "map_" + data20XX.game.map;
data.smallImageText = `${mapNameMap[data20XX.game.map]} - ${
data.smallImageText
}`;
}

data.startTimestamp = gameStartTimestamp;
} else gameStartTimestamp = null;
} else {
if (location.pathname.endsWith('/help.html'))
if (location.pathname.endsWith("/help.html"))
data.details = "Reading the Help Document";
else if (location.pathname.endsWith('/rules.html'))
else if (location.pathname.endsWith("/rules.html"))
data.details = "Reading the Rules";
else if (location.pathname.endsWith('/tos.html'))
else if (location.pathname.endsWith("/tos.html"))
data.details = "Reading the Terms of Service";
}

if (!await presence.getSetting("showName"))
delete data.state;
if (!(await presence.getSetting("showName"))) delete data.state;

// If data doesn't exist clear else set activity to the presence data
if (data.details == null) {
Expand All @@ -147,4 +150,4 @@ presence.on("UpdateData", async () => {
} else presence.setActivity(data);
});

presence.on("iFrameData", (data: Data20XX) => data20XX = data);
presence.on("iFrameData", (data: Data20XX) => (data20XX = data));
42 changes: 21 additions & 21 deletions websites/A/AIS Play/dist/metadata.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"$schema": "https://schemas.premid.app/metadata/1.0",
"author": {
"name": "Holfz",
"id": "405397046691102740"
},
"service": "AIS Play",
"description": {
"en": "AIS Play is a thailand streaming service offered to a series, television providers, anime, much more"
},
"url": "aisplay.ais.co.th",
"version": "1.0.0",
"logo": "https://i.imgur.com/HQs4uPj.png",
"thumbnail": "https://i.imgur.com/ZYS9jRi.png",
"color": "#B0B72A",
"tags": [
"video",
"media"
],
"iframe": true,
"category": "videos"
}
"$schema": "https://schemas.premid.app/metadata/1.0",
"author": {
"name": "Holfz",
"id": "405397046691102740"
},
"service": "AIS Play",
"description": {
"en": "AIS Play is a thailand streaming service offered to a series, television providers, anime, much more"
},
"url": "aisplay.ais.co.th",
"version": "1.0.1",
"logo": "https://i.imgur.com/HQs4uPj.png",
"thumbnail": "https://i.imgur.com/ZYS9jRi.png",
"color": "#B0B72A",
"tags": [
"video",
"media"
],
"iframe": true,
"category": "videos"
}
26 changes: 15 additions & 11 deletions websites/A/AIS Play/iframe.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
const iframe = new iFrame();

iframe.on("UpdateData", async () => {
const video: HTMLVideoElement = document.querySelector("#vimmi_video_player_html5_api");

if (video != undefined && !isNaN(video.duration)) {
iframe.send({
current: video.currentTime,
duration: video.duration,
paused: video.paused,
isLive: !document.querySelector(".vjs-live-control").classList.contains("vjs-hidden")
});
}
});
const video: HTMLVideoElement = document.querySelector(
"#vimmi_video_player_html5_api"
);

if (video != undefined && !isNaN(video.duration)) {
iframe.send({
current: video.currentTime,
duration: video.duration,
paused: video.paused,
isLive: !document
.querySelector(".vjs-live-control")
.classList.contains("vjs-hidden")
});
}
});
Loading

0 comments on commit bf3206f

Please sign in to comment.