Commit 7ad9404c authored by Chunchi Che's avatar Chunchi Che

fix small

parent ad1b5533
Pipeline #25776 failed with stages
in 1 minute
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
import { Options } from "./options"; import { Options } from "./options";
enum RoomAction {
CreatePublic = 1,
CreatePrivate = 2,
JoinPublic = 3,
JoinPrivate = 5,
}
export interface Room { export interface Room {
id?: string; id?: string;
title?: string; title?: string;
...@@ -18,7 +25,8 @@ export function getJoinRoomPasswd( ...@@ -18,7 +25,8 @@ export function getJoinRoomPasswd(
_private: boolean = false, _private: boolean = false,
): string { ): string {
const optionsBuffer = new Uint8Array(6); const optionsBuffer = new Uint8Array(6);
optionsBuffer[1] = (_private ? 5 : 3) << 4; optionsBuffer[1] =
(_private ? RoomAction.JoinPrivate : RoomAction.JoinPublic) << 4;
encryptBuffer(optionsBuffer, external_id); encryptBuffer(optionsBuffer, external_id);
...@@ -37,7 +45,7 @@ export function getCreateRoomPasswd( ...@@ -37,7 +45,7 @@ export function getCreateRoomPasswd(
// ref: https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit // ref: https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit
const optionsBuffer = new Uint8Array(6); const optionsBuffer = new Uint8Array(6);
optionsBuffer[1] = optionsBuffer[1] =
((_private ? 2 : 1) << 4) | ((_private ? RoomAction.CreatePrivate : RoomAction.CreatePublic) << 4) |
(options.duel_rule << 1) | (options.duel_rule << 1) |
(options.auto_death ? 0x1 : 0); (options.auto_death ? 0x1 : 0);
......
...@@ -23,6 +23,7 @@ const defaultProps: CustomRoomProps = { ...@@ -23,6 +23,7 @@ const defaultProps: CustomRoomProps = {
export const mcCustomRoomStore = proxy<CustomRoomProps>(defaultProps); export const mcCustomRoomStore = proxy<CustomRoomProps>(defaultProps);
// TODO: support public room
export const CustomRoomContent: React.FC = () => { export const CustomRoomContent: React.FC = () => {
const { message } = App.useApp(); const { message } = App.useApp();
const user = useSnapshot(accountStore).user; const user = useSnapshot(accountStore).user;
......
...@@ -13,6 +13,9 @@ import styles from "./index.module.scss"; ...@@ -13,6 +13,9 @@ import styles from "./index.module.scss";
const NeosConfig = useConfig(); const NeosConfig = useConfig();
const serverConfig = NeosConfig.servers; const serverConfig = NeosConfig.servers;
const KOISHI_INDEX = 0;
const PRERELEASE_INDEX = 3;
const { const {
defaults: { defaultPlayer, defaultPassword }, defaults: { defaultPlayer, defaultPassword },
automation: { isAiMode }, automation: { isAiMode },
...@@ -28,7 +31,6 @@ const defaultProps: Props = { ...@@ -28,7 +31,6 @@ const defaultProps: Props = {
export const matchStore = proxy<Props>(defaultProps); export const matchStore = proxy<Props>(defaultProps);
// TODO: support MC server
export const MatchModal: React.FC = ({}) => { export const MatchModal: React.FC = ({}) => {
const { message } = App.useApp(); const { message } = App.useApp();
const { open } = useSnapshot(matchStore); const { open } = useSnapshot(matchStore);
...@@ -102,11 +104,11 @@ export const MatchModal: React.FC = ({}) => { ...@@ -102,11 +104,11 @@ export const MatchModal: React.FC = ({}) => {
value={serverId} value={serverId}
options={[ options={[
{ {
value: 0, value: KOISHI_INDEX,
label: "Koishi服", label: "Koishi服",
}, },
{ {
value: 3, value: PRERELEASE_INDEX,
label: "超先行服", label: "超先行服",
}, },
]} ]}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment