forked from PreMiD/Presences
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request PreMiD#3052 from trains2050/master
Add MKPC presence
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"$schema": "https://schemas.premid.app/metadata/1.0", | ||
"author": { | ||
"name": "Liechtenstein", | ||
"id": "471586634899652611" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Wagor", | ||
"id": "310546454693281794" | ||
} | ||
], | ||
"url": "mkpc.malahieude.net", | ||
"description": { | ||
"en": "You might know Mario Kart, the most fun racing game series of all time! Mario Kart PC uses the same base as the original games but is playable on your browser, and for free. Most of the modes from Mario Kart have been included: Grand Prix, VS, Battle mode, Time Trials, and more! There's also a brand new mode: the track builder! Place straight lines and turns, add items, boost panels and more! Everything is customizable! The only limit is your own imagination! You can share your tracks, and try other people's tracks thanks to the sharing tool. Thousands of custom tracks are already available! Finally, you can face players from the whole world thanks to the multiplayer online mode! Climb the rankings and become world champion!", | ||
"fr": "Vous connaissez certainement Mario Kart, le jeu de course le plus fun de tous les temps ! Mario Kart PC reprend les mêmes principes que le jeu original mais il est jouable sur navigateur, et gratuitement. La plupart des modes issus de Mario Kart ont été repris : Grand Prix, courses VS, batailles de ballons, contre-la-montre... Et un dernier mode inédit : l'éditeur de circuits ! Placez les lignes droites et les virages, ajoutez les objets, insérez des accélérateurs... Tout est personnalisable ! Votre imagination est la seule limite ! Vous pouvez également partager vos créations et essayer celles des autres grâce à l'outil de partage. Plusieurs milliers de circuits ont déjà été partagés ! Enfin, il est possible d'affronter les joueurs du monde entier grâce au mode multijoueurs en ligne ! Grimpez dans le classement et devenez champion du monde !" | ||
}, | ||
"service": "MKPC", | ||
"version": "1.0.0", | ||
"logo": "https://imgur.com/T2WTLEM.jpeg", | ||
"thumbnail": "https://imgur.com/LZwSRDe.jpeg", | ||
"color": "#FF001B", | ||
"tags": [ | ||
"game", | ||
"mario", | ||
"kart", | ||
"retro" | ||
], | ||
"category": "games" | ||
} |
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,61 @@ | ||
const presence = new Presence({ | ||
clientId: "812176837748457483" | ||
}), | ||
browsingStamp = Math.floor(Date.now() / 1000); | ||
|
||
let user; | ||
presence.on("UpdateData", async () => { | ||
const presenceData: PresenceData = { | ||
largeImageKey: "logo" | ||
}; | ||
|
||
if (document.location.pathname == "/" | ||
|| document.location.pathname == "/index.php" | ||
|| document.location.pathname == "/fr.php" | ||
|| document.location.pathname == "/en.php") { | ||
presenceData.startTimestamp = browsingStamp; | ||
presenceData.details = "Viewing home page"; | ||
} else if (document.location.pathname == "/forum.php") { | ||
presenceData.startTimestamp = browsingStamp; | ||
presenceData.details = "Viewing the forum's menu"; | ||
presenceData.smallImageKey = "search"; | ||
} else if (document.location.pathname == "index.php") { | ||
presenceData.startTimestamp = browsingStamp; | ||
presenceData.details = "Viewing home page"; | ||
} const elt = document.querySelector("#compteur0 > div") as HTMLElement; | ||
if (elt) { | ||
const lap = elt.innerText.replace(/.+? /g, ""); | ||
presenceData.details = "On: Lap " + lap; | ||
presenceData.buttons = [{ label: "Play Game", url: "https://mkpc.malahieude.net/mariokart.php" }]; | ||
} else if (document.location.pathname == "/mariokart.php") { | ||
presenceData.startTimestamp = browsingStamp; | ||
presenceData.details = "browsing map's"; | ||
presenceData.smallImageKey = "search"; | ||
} else if (document.location.pathname == "/category.php") { | ||
presenceData.startTimestamp = browsingStamp; | ||
user = document.querySelector( | ||
"html > body > main > h1" | ||
); | ||
presenceData.details = "Viewing the following category: " + user.innerHTML; | ||
presenceData.smallImageKey = "search"; | ||
} else if (document.location.pathname == "/topic.php") { | ||
presenceData.startTimestamp = browsingStamp; | ||
user = document.querySelector( | ||
"html > body > main > h1" | ||
); | ||
presenceData.details = "Viewing: " + user.innerHTML; | ||
presenceData.smallImageKey = "search"; | ||
} else if (document.location.pathname == "/profil.php") { | ||
presenceData.startTimestamp = browsingStamp; | ||
user = document.querySelector( | ||
"html > body > main > h1" | ||
); | ||
presenceData.details = "Viewing: " + user.innerHTML; | ||
presenceData.smallImageKey = "search"; | ||
} if (presenceData.details == null) { | ||
presence.setTrayTitle(); | ||
presence.setActivity(); | ||
} else { | ||
presence.setActivity(presenceData); | ||
} | ||
}); |
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,6 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./dist/" | ||
} | ||
} |