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

fix small

parent ad1b5533
......@@ -2,6 +2,13 @@
import { Options } from "./options";
enum RoomAction {
CreatePublic = 1,
CreatePrivate = 2,
JoinPublic = 3,
JoinPrivate = 5,
}
export interface Room {
id?: string;
title?: string;
......@@ -18,7 +25,8 @@ export function getJoinRoomPasswd(
_private: boolean = false,
): string {
const optionsBuffer = new Uint8Array(6);
optionsBuffer[1] = (_private ? 5 : 3) << 4;
optionsBuffer[1] =
(_private ? RoomAction.JoinPrivate : RoomAction.JoinPublic) << 4;
encryptBuffer(optionsBuffer, external_id);
......@@ -37,7 +45,7 @@ export function getCreateRoomPasswd(
// ref: https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit
const optionsBuffer = new Uint8Array(6);
optionsBuffer[1] =
((_private ? 2 : 1) << 4) |
((_private ? RoomAction.CreatePrivate : RoomAction.CreatePublic) << 4) |
(options.duel_rule << 1) |
(options.auto_death ? 0x1 : 0);
......
......@@ -23,6 +23,7 @@ const defaultProps: CustomRoomProps = {
export const mcCustomRoomStore = proxy<CustomRoomProps>(defaultProps);
// TODO: support public room
export const CustomRoomContent: React.FC = () => {
const { message } = App.useApp();
const user = useSnapshot(accountStore).user;
......
......@@ -13,6 +13,9 @@ import styles from "./index.module.scss";
const NeosConfig = useConfig();
const serverConfig = NeosConfig.servers;
const KOISHI_INDEX = 0;
const PRERELEASE_INDEX = 3;
const {
defaults: { defaultPlayer, defaultPassword },
automation: { isAiMode },
......@@ -28,7 +31,6 @@ const defaultProps: Props = {
export const matchStore = proxy<Props>(defaultProps);
// TODO: support MC server
export const MatchModal: React.FC = ({}) => {
const { message } = App.useApp();
const { open } = useSnapshot(matchStore);
......@@ -102,11 +104,11 @@ export const MatchModal: React.FC = ({}) => {
value={serverId}
options={[
{
value: 0,
value: KOISHI_INDEX,
label: "Koishi服",
},
{
value: 3,
value: PRERELEASE_INDEX,
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