diff --git a/play.pokemonshowdown.com/src/panel-chat.tsx b/play.pokemonshowdown.com/src/panel-chat.tsx index df7891aef..7c71e856c 100644 --- a/play.pokemonshowdown.com/src/panel-chat.tsx +++ b/play.pokemonshowdown.com/src/panel-chat.tsx @@ -117,6 +117,16 @@ export class ChatRoom extends PSRoom { if (`${args[2]} `.startsWith('/challenge ')) { this.updateChallenge(args[1], args[2].slice(11)); return; + } else if (args[2].startsWith('/warn ')) { + const reason = args[2].replace('/warn ', ''); + PS.join(`rules-warn` as RoomID, { + args: { + type: 'warn', + message: reason?.trim() || undefined, + }, + parentElem: null, + }); + return; } // falls through case 'c:': diff --git a/play.pokemonshowdown.com/src/panel-popups.tsx b/play.pokemonshowdown.com/src/panel-popups.tsx index 5b98418a2..3c3fee768 100644 --- a/play.pokemonshowdown.com/src/panel-popups.tsx +++ b/play.pokemonshowdown.com/src/panel-popups.tsx @@ -1813,6 +1813,104 @@ class BattleTimerPanel extends PSRoomPanel { } } +class RulesPanel extends PSRoomPanel { + static readonly id = 'rules'; + static readonly routes = ['rules-*']; + static readonly location = 'modal-popup'; + static readonly noURL = true; + static readonly Model = PopupRoom; + declare state: { canClose?: boolean | null, timeLeft?: number | null, timerRef?: any }; + + override componentDidMount() { + super.componentDidMount(); + const args = this.props.room.args; + const isWarn = args?.type === 'warn'; + if (isWarn && args) { + const timerRef = setInterval(() => { + const timeLeft = this.state.timeLeft || 5; + const canClose = timeLeft === 1; + this.setState({ canClose, timeLeft: timeLeft - 1 }); + if (canClose) { + clearInterval(this.state.timerRef); + this.setState({ timerRef: null }); + } + }, 1000); + if (!this.state.timerRef) this.setState({ timerRef }); + } + } + + override render() { + const room = this.props.room; + const type = room.args?.type; + const isWarn = type === 'warn'; + const message = room.args?.message as string || ''; + return +
+ { + isWarn && +

{(BattleLog.escapeHTML(message) || 'You have been warned for breaking the rules.')} +

+ } +

Pokémon Showdown Rules

+

1. Be nice to people. Respect people. Don't be rude or mean to people.

+

2. {' '} + Follow US laws (PS is based in the US). No porn (minors use PS), don't distribute pirated material, {' '} + and don't slander others.

+

3. {' '} +  No sex. Don't discuss anything sexually explicit, not even in private messages, {' '} + not even if you're both adults.

+

4. {' '} +  No cheating. Don't exploit bugs to gain an unfair advantage. {' '} + Don't game the system (by intentionally losing against yourself or a friend in a ladder match, by timerstalling, etc). {' '} + Don't impersonate staff if you're not.

+

5. {' '} + Moderators have discretion to punish any behaviour they deem inappropriate, whether or not it's on this list. {' '} + If you disagree with a moderator ruling, appeal to an administrator (a user with ~ next to their name) or {' '} + Discipline Appeals.

+

(Note: The First Amendment does not apply to PS, since PS is not a government organization.)

+

Chat

+

1. {' '} + Do not spam, flame, or troll. This includes advertising, raiding, {' '} + asking questions with one-word answers in the lobby, {' '} + and flooding the chat such as by copy/pasting logs in the lobby.

+

2. {' '} + Don't call unnecessary attention to yourself. Don't be obnoxious. ALL CAPS and formatting {' '} + are acceptable to emphasize things, but should be used sparingly, not all the time.

+

3. {' '} + No minimodding: don't mod if it's not your job. Don't tell people they'll be muted, {' '} + don't ask for people to be muted, {' '} + and don't talk about whether or not people should be muted ('inb4 mute\, etc). {' '} + This applies to bans and other punishments, too.

+

4. {' '} + We reserve the right to tell you to stop discussing moderator decisions if you become unreasonable or belligerent

+

5. English only, unless specified otherwise.

+

(Note: You can opt out of chat rules in private chat rooms and battle rooms, {' '} + but only if all ROs or players agree to it.)

+ { + !isWarn && <> +

Usernames

+

Your username can be chosen and changed at any time. Keep in mind:

+

1. Usernames may not impersonate a recognized user (a user with %, @, #, or ~ next to their name) {' '} + or a famous person/organization that uses PS or is associated with Pokémon.

+

2. Usernames may not be derogatory or insulting in nature, to an individual or group {' '} + (insulting yourself is okay as long as it's not too serious).

+

3. Usernames may not directly reference sexual activity, or be excessively disgusting.

+

This policy is less restrictive than that of many places, so you might see some "borderline" nicknames {' '} + that might not be accepted elsewhere. You might consider it unfair that they are allowed to keep their {' '} + nickname. The fact remains that their nickname follows the above rules, and {' '} + if you were asked to choose a new name, yours does not.

+ + } +

+
+
; + } +} + PS.addRoomType( UserPanel, UserOptionsPanel, @@ -1831,5 +1929,6 @@ PS.addRoomType( PopupPanel, RoomTabListPanel, BattleOptionsPanel, - BattleTimerPanel + BattleTimerPanel, + RulesPanel );