diff options
| -rw-r--r-- | README.md | 12 | ||||
| -rw-r--r-- | RULES.md | 37 | ||||
| -rw-r--r-- | frontend/src/components/UploadRunDialog.tsx | 29 |
3 files changed, 40 insertions, 38 deletions
| @@ -1,4 +1,4 @@ | |||
| 1 | # Portal 2 Least Portals Hub | 1 | # Least Portals Hub (LPHUB) |
| 2 | 2 | ||
| 3 | ## About LPHUB | 3 | ## About LPHUB |
| 4 | 4 | ||
| @@ -8,11 +8,13 @@ Our comprehensive map library contains detailed, wiki-style information for maps | |||
| 8 | 8 | ||
| 9 | In addition, we host a leaderboard section for each map where users can compare their accomplishments and compete for having the lowest amount of portals possible. Users can upload their records, along with demo proof in order to get on to the leaderboards. | 9 | In addition, we host a leaderboard section for each map where users can compare their accomplishments and compete for having the lowest amount of portals possible. Users can upload their records, along with demo proof in order to get on to the leaderboards. |
| 10 | 10 | ||
| 11 | There's also discussion tabs for each map to act like forum pages in order to talk about possible new routes, alternatives, and overall comments. | ||
| 12 | |||
| 11 | ## Project Team | 13 | ## Project Team |
| 12 | 14 | ||
| 13 | * [@pektezol](https://github.com/pektezol) - Project Lead | 15 | * [@pektezol](https://github.com/pektezol) - Project Lead |
| 14 | * [@Krzyhau](https://github.com/Krzyhau) - Visual Design | 16 | * [@Krzyhau](https://github.com/Krzyhau) - Visual Design |
| 15 | * [@Nidboj132](https://github.com/Nidboj132) - Frontend & Subject Expert | 17 | * [@Nidboj132](https://github.com/Nidboj132) - Subject Expert & Frontend |
| 16 | * [@Oryn](https://github.com/Oryn-Goia) - Subject Expert | 18 | * [@Oryn](https://github.com/Oryn-Goia) - Subject Expert |
| 17 | * [@Wolfboy248](https://github.com/Wolfboy248) - Frontend | 19 | * [@Wolfboy248](https://github.com/Wolfboy248) - Frontend |
| 18 | 20 | ||
| @@ -27,8 +29,8 @@ In addition, we host a leaderboard section for each map where users can compare | |||
| 27 | 29 | ||
| 28 | ## Special Thanks | 30 | ## Special Thanks |
| 29 | 31 | ||
| 30 | * [@UncraftedName](https://github.com/UncraftedName) - For providing the (former) parser that retrieves total portal count and elapsed time from the CM counter found [here](https://github.com/UncraftedName/UntitledParser). | 32 | * [@NeKz](https://github.com/NeKzor) - For being the inspiration of this project and the developer of the former least portals site found [here](https://github.com/NeKzor/lp). Also for creating the [@nekz/sdp](https://github.com/NeKzor/sdp) package for demo parsing in client-side for quick information. |
| 31 | * [@NeKz](https://github.com/NeKzor) - For being the inspiration of this project and the developer of the former least portals site found [here](https://lp.nekz.me/). | 33 | * [@UncraftedName](https://github.com/UncraftedName) - For being a guide to parsing demo files and helping with how to retrieve total portal count and elapsed time from the CM counter with their parser found [here](https://github.com/UncraftedName/UntitledParser). |
| 32 | 34 | ||
| 33 | ## Documentation | 35 | ## Documentation |
| 34 | 36 | ||
| @@ -71,4 +73,4 @@ By using LPHUB, you acknowledge that you have read and understood this disclaime | |||
| 71 | 73 | ||
| 72 | ## Last Update | 74 | ## Last Update |
| 73 | 75 | ||
| 74 | 2024-09-09 \ No newline at end of file | 76 | 2024-10-19 \ No newline at end of file |
| @@ -4,39 +4,40 @@ To compete on the leaderboard, you must adhere to the following rules. Failure t | |||
| 4 | 4 | ||
| 5 | ## Game | 5 | ## Game |
| 6 | 6 | ||
| 7 | All runs must be performed on the latest release of Portal 2. Game files must not be modified in any way (things such as binary or dll files). | 7 | - All runs must be performed on the latest release of Portal 2. Game files must not be modified in any way (things such as binary and/or .dll files). |
| 8 | Launch options that alter game behavior (e.g., `-tickrate`) are prohibited | 8 | - Launch options/commands that alter game behavior (e.g., `-tickrate`) are prohibited. |
| 9 | The use of scripts, cheats, plugins, third-party software, or anything that changes the game's behavior is strictly forbidden. | 9 | - The use of scripts, cheats, plugins, third-party software, or anything that changes the game's behavior is strictly forbidden. |
| 10 | The only allowed plugin is SourceAutoRecord and if used it must be latest version. | 10 | - The only allowed plugin is SourceAutoRecord, and if used, it must be the latest version. |
| 11 | 11 | ||
| 12 | ### Texture Modifications | 12 | ### Texture Modifications |
| 13 | 13 | ||
| 14 | You may modify texture files as long as it doesn't give you any advantage. | 14 | - You may modify texture files as long as it doesn't give you any advantage. |
| 15 | Both `.vtf` and `.vmt` files associated with these textures can be modified. | 15 | Both `.vtf` and `.vmt` files associated with these textures can be modified. |
| 16 | Models cannot be modified as they alter game behaviour | 16 | - Models cannot be modified as they alter game behaviour. |
| 17 | 17 | ||
| 18 | ## Runs | 18 | ## Runs |
| 19 | 19 | ||
| 20 | ### Demos | 20 | ### Demos |
| 21 | 21 | ||
| 22 | Proof of your run must be recorded using demos. To start recording, type `record <demoname>` when entering the map, or use the SAR plugin with the command `sar_record_at 0`. | 22 | - Proof of your run must be recorded using demos. To start recording, type `record <demoname>` when entering the map, or use the SAR plugin with the command `sar_record_at 0`. |
| 23 | A valid demo begins when the player can move and ends when the player touches the end flags. | 23 | - A valid demo begins when the player can move and ends when the player touches the end flags. |
| 24 | For cooperative runs, both players must submit their demos. | 24 | - For cooperative runs, both players must submit their demos. |
| 25 | 25 | ||
| 26 | ### Console Commands & Cheats | 26 | ### Console Commands & Cheats |
| 27 | 27 | ||
| 28 | The use of cheats, including specific console commands, is prohibited. Even if a command is not cheat-protected, it may still invalidate your run. For a full list of banned commands, refer to rules.portal2.sr/#command-list. | 28 | - The use of cheats, including specific console commands, is prohibited. Even if a command is not cheat-protected, it may still invalidate your run. For a full list of banned commands, refer to [rules.portal2.sr/#command-list](https://rules.portal2.sr/#command-list). |
| 29 | Additionally, commands that affect game behavior (e.g., `net_*` commands) are not allowed. | 29 | - Additionally, commands that affect game behavior (e.g., `net_*` commands) are not allowed. |
| 30 | 30 | ||
| 31 | ### Banned Exploits | 31 | ### Banned Exploits |
| 32 | 32 | ||
| 33 | The following exploits are banned: freezing the game window, pause abuse, packet loss manipulation, intentional internet disconnection, and any glitches requiring setup before the run (e.g., moving portals or EHM). | 33 | - The following exploits are banned: freezing the game window, pause abuse, packet loss manipulation, intentional internet disconnection, and any glitches requiring setup before the run (e.g., moving portals or EHM). |
| 34 | If you're unsure whether an exploit is allowed, ask in the Discord server. | 34 | - If you're unsure whether an exploit is allowed, ask in the Discord server. |
| 35 | 35 | ||
| 36 | ### Note | 36 | ## Important Note |
| 37 | 37 | ||
| 38 | The moderation team has the authority to remove any record they believe to be illegitimate. | 38 | - The moderation team has the authority to remove any record they believe to be illegitimate, and/or ban any player they believe to have broken the rules. |
| 39 | If you accidentally submit an illegitimate run, the moderation team will attempt to contact you, and you may receive a warning. | 39 | - If you 'accidentally' submit an illegitimate run, the moderation team will attempt to contact you, and you may receive a warning. However, ignoring their attempts to contact you, deliberately cheating, and/or receiving too many warnings may result in a ban. |
| 40 | However, ignoring their attempts to contact you, deliberately cheating, or receiving too many warnings may result in a ban. | 40 | - Use common sense. You must be really pathetic if you intentionally cheat on least portals of all things. |
| 41 | 41 | ||
| 42 | As this is an open beta, we highly encourage players to test the limits and report any exploits they discover. Your feedback is essential to improving the system and ensuring fair competition. | 42 | ## Last Updated |
| 43 | 2024-10-19 | ||
diff --git a/frontend/src/components/UploadRunDialog.tsx b/frontend/src/components/UploadRunDialog.tsx index b241ed1..b26bbe6 100644 --- a/frontend/src/components/UploadRunDialog.tsx +++ b/frontend/src/components/UploadRunDialog.tsx | |||
| @@ -1,16 +1,12 @@ | |||
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import { UploadRunContent } from '../types/Content'; | 2 | import { UploadRunContent } from '../types/Content'; |
| 3 | import { DemoMessages, ScoreboardTempUpdate, SourceDemoParser, UserMessage } from '@nekz/sdp'; | 3 | import { ScoreboardTempUpdate, SourceDemoParser, NetMessages } from '@nekz/sdp'; |
| 4 | import fs from 'fs'; | ||
| 5 | |||
| 6 | |||
| 7 | 4 | ||
| 8 | import '../css/UploadRunDialog.css'; | 5 | import '../css/UploadRunDialog.css'; |
| 9 | import { Game } from '../types/Game'; | 6 | import { Game } from '../types/Game'; |
| 10 | import { Map } from '../types/Map'; | 7 | import { Map } from '../types/Map'; |
| 11 | import { API } from '../api/Api'; | 8 | import { API } from '../api/Api'; |
| 12 | import { useNavigate } from 'react-router-dom'; | 9 | import { useNavigate } from 'react-router-dom'; |
| 13 | import { SvcUserMessage } from '@nekz/sdp/script/src/types/NetMessages'; | ||
| 14 | 10 | ||
| 15 | interface UploadRunDialogProps { | 11 | interface UploadRunDialogProps { |
| 16 | token?: string; | 12 | token?: string; |
| @@ -108,16 +104,19 @@ const UploadRunDialog: React.FC<UploadRunDialogProps> = ({ token, open, onClose, | |||
| 108 | return | 104 | return |
| 109 | } | 105 | } |
| 110 | } | 106 | } |
| 111 | // const demo = SourceDemoParser.default() | 107 | const demo = SourceDemoParser.default() |
| 112 | // .setOptions({ packets: true }) | 108 | .setOptions({ packets: true }) |
| 113 | // .parse(await uploadRunContent.host_demo.arrayBuffer()); | 109 | .parse(await uploadRunContent.host_demo.arrayBuffer()); |
| 114 | 110 | const scoreboard = demo.findPacket<NetMessages.SvcUserMessage>((message) => { | |
| 115 | // const scoreboardPacket = demo.findPacket(ScoreboardTempUpdate) | 111 | return message instanceof NetMessages.SvcUserMessage && message.userMessage instanceof ScoreboardTempUpdate; |
| 116 | // if (scoreboardPacket) { | 112 | }) |
| 117 | // console.log(scoreboardPacket) | 113 | |
| 118 | // } else { | 114 | if (!scoreboard) { |
| 119 | // console.log("couldnt find scoreboard packet") | 115 | alert("Error while processing demo: Unable to get scoreboard result. Is this not a CM demo?") |
| 120 | // } | 116 | return |
| 117 | } | ||
| 118 | const { portalScore, timeScore } = scoreboard.userMessage?.as<ScoreboardTempUpdate>() ?? {}; | ||
| 119 | console.log(`Portal count: ${portalScore}. Ticks: ${timeScore}.`); | ||
| 121 | if (window.confirm("Are you sure you want to submit this run to LPHUB?")) { | 120 | if (window.confirm("Are you sure you want to submit this run to LPHUB?")) { |
| 122 | const message = await API.post_record(token, uploadRunContent); | 121 | const message = await API.post_record(token, uploadRunContent); |
| 123 | alert(message); | 122 | alert(message); |