Commit 9d1505fc authored by nanahira's avatar nanahira

new roomlist format

parent c475ce9f
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<mat-option [value]="1">TCG</mat-option> <mat-option [value]="1">TCG</mat-option>
<mat-option [value]="2">OCG & TCG</mat-option> <mat-option [value]="2">OCG & TCG</mat-option>
<mat-option [value]="3">专有卡禁止</mat-option> <mat-option [value]="3">专有卡禁止</mat-option>
<mat-option [value]="4">简体中文</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field class="full-width"> <mat-form-field class="full-width">
...@@ -34,6 +35,15 @@ ...@@ -34,6 +35,15 @@
<mat-option [value]="2">TAG</mat-option> <mat-option [value]="2">TAG</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field class="full-width">
<mat-select placeholder="决斗规则" name="mode" [(ngModel)]="room.options.duel_rule" required>
<mat-option [value]="1">大师规则</mat-option>
<mat-option [value]="2">大师规则2</mat-option>
<mat-option [value]="3">大师规则3</mat-option>
<mat-option [value]="4">新大师规则</mat-option>
<mat-option [value]="5">大师规则2020</mat-option>
</mat-select>
</mat-form-field>
<!--<h2>额外选项</h2>--> <!--<h2>额外选项</h2>-->
<!--<mat-slide-toggle #extra class="example-margin" color="primary">额外选项</mat-slide-toggle>--> <!--<mat-slide-toggle #extra class="example-margin" color="primary">额外选项</mat-slide-toggle>-->
...@@ -50,11 +60,13 @@ ...@@ -50,11 +60,13 @@
</mat-form-field> </mat-form-field>
<mat-checkbox class="full-width" name="room.private" [(ngModel)]="room.private">私密房间</mat-checkbox> <mat-checkbox class="full-width" name="room.private" [(ngModel)]="room.private">私密房间</mat-checkbox>
<mat-checkbox class="full-width" name="room.enable_priority" [(ngModel)]="room.options.enable_priority">旧规则 <!--mat-checkbox class="full-width" name="room.enable_priority" [(ngModel)]="room.options.enable_priority">旧规则
</mat-checkbox> </mat-checkbox-->
<mat-checkbox class="full-width" name="room.no_check_deck" [(ngModel)]="room.options.no_check_deck">不检查卡组</mat-checkbox> <mat-checkbox class="full-width" name="room.no_check_deck" [(ngModel)]="room.options.no_check_deck">不检查卡组</mat-checkbox>
<mat-checkbox class="full-width" name="room.no_shuffle_deck" [(ngModel)]="room.options.no_shuffle_deck">不洗切卡组 <mat-checkbox class="full-width" name="room.no_shuffle_deck" [(ngModel)]="room.options.no_shuffle_deck">不洗切卡组
</mat-checkbox> </mat-checkbox>
<mat-checkbox class="full-width" name="room.no_shuffle_deck" [(ngModel)]="room.options.auto_death">自动加时赛
</mat-checkbox>
<div id="actions"> <div id="actions">
......
...@@ -41,13 +41,14 @@ ...@@ -41,13 +41,14 @@
<ng-container matColumnDef="extra"> <ng-container matColumnDef="extra">
<mat-header-cell *matHeaderCellDef>额外选项</mat-header-cell> <mat-header-cell *matHeaderCellDef>额外选项</mat-header-cell>
<mat-cell *matCellDef="let room"> <mat-cell *matCellDef="let room">
<span *ngIf="room.options.rule != ygopro.default_options.rule">{{{'0': 'OCG', '1': 'TCG', '2': 'O/T', '3': '专有卡禁止'}[room.options.rule]}}</span> <span *ngIf="room.options.rule != ygopro.default_options.rule">{{{'0': 'OCG', '1': 'TCG', '2': 'O/T', '3': '专有卡禁止', '4': '简体中文'}[room.options.rule]}}</span>
<span *ngIf="room.options.start_lp != ygopro.default_options.start_lp">{{room.options.start_lp}} LP</span> <span *ngIf="room.options.start_lp != ygopro.default_options.start_lp">{{room.options.start_lp}} LP</span>
<span *ngIf="room.options.start_hand != ygopro.default_options.start_hand">{{room.options.start_hand}} 初始</span> <span *ngIf="room.options.start_hand != ygopro.default_options.start_hand">{{room.options.start_hand}} 初始</span>
<span *ngIf="room.options.draw_count != ygopro.default_options.draw_count">{{room.options.draw_count}} 抽卡</span> <span *ngIf="room.options.draw_count != ygopro.default_options.draw_count">{{room.options.draw_count}} 抽卡</span>
<span *ngIf="room.options.enable_priority != ygopro.default_options.enable_priority">旧规则</span> <span *ngIf="room.options.duel_rule != ygopro.default_options.duel_rule">大师规则{{room.options.duel_rule}}</span>
<span *ngIf="room.options.no_check_deck != ygopro.default_options.no_check_deck">不检查</span> <span *ngIf="room.options.no_check_deck != ygopro.default_options.no_check_deck">不检查</span>
<span *ngIf="room.options.no_shuffle_deck != ygopro.default_options.no_shuffle_deck">不洗卡</span> <span *ngIf="room.options.no_shuffle_deck != ygopro.default_options.no_shuffle_deck">不洗卡</span>
<span *ngIf="!!room.options.auto_death">自动加时赛</span>
</mat-cell> </mat-cell>
</ng-container> </ng-container>
......
...@@ -47,13 +47,14 @@ ...@@ -47,13 +47,14 @@
<ng-container matColumnDef="extra"> <ng-container matColumnDef="extra">
<mat-header-cell *matHeaderCellDef>额外选项</mat-header-cell> <mat-header-cell *matHeaderCellDef>额外选项</mat-header-cell>
<mat-cell *matCellDef="let room"> <mat-cell *matCellDef="let room">
<span *ngIf="room.options.rule != ygopro.default_options.rule">{{{'0': 'OCG', '1': 'TCG', '2': 'O/T', '3': '专有卡禁止'}[room.options.rule]}}</span> <span *ngIf="room.options.rule != ygopro.default_options.rule">{{{'0': 'OCG', '1': 'TCG', '2': 'O/T', '3': '专有卡禁止', '4': '简体中文'}[room.options.rule]}}</span>
<span *ngIf="room.options.start_lp != ygopro.default_options.start_lp">{{room.options.start_lp}} LP</span> <span *ngIf="room.options.start_lp != ygopro.default_options.start_lp">{{room.options.start_lp}} LP</span>
<span *ngIf="room.options.start_hand != ygopro.default_options.start_hand">{{room.options.start_hand}} 初始</span> <span *ngIf="room.options.start_hand != ygopro.default_options.start_hand">{{room.options.start_hand}} 初始</span>
<span *ngIf="room.options.draw_count != ygopro.default_options.draw_count">{{room.options.draw_count}} 抽卡</span> <span *ngIf="room.options.draw_count != ygopro.default_options.draw_count">{{room.options.draw_count}} 抽卡</span>
<span *ngIf="room.options.enable_priority != ygopro.default_options.enable_priority">旧规则</span> <span *ngIf="room.options.duel_rule != ygopro.default_options.duel_rule">大师规则{{room.options.duel_rule}}</span>
<span *ngIf="room.options.no_check_deck != ygopro.default_options.no_check_deck">不检查</span> <span *ngIf="room.options.no_check_deck != ygopro.default_options.no_check_deck">不检查</span>
<span *ngIf="room.options.no_shuffle_deck != ygopro.default_options.no_shuffle_deck">不洗卡</span> <span *ngIf="room.options.no_shuffle_deck != ygopro.default_options.no_shuffle_deck">不洗卡</span>
<span *ngIf="!!room.options.auto_death">自动加时赛</span>
</mat-cell> </mat-cell>
</ng-container> </ng-container>
......
...@@ -36,22 +36,27 @@ export interface Options { ...@@ -36,22 +36,27 @@ export interface Options {
mode: number; mode: number;
rule: number; rule: number;
start_lp: number; start_lp: number;
start_lp_tag: number;
start_hand: number; start_hand: number;
draw_count: number; draw_count: number;
enable_priority: boolean; duel_rule: number;
no_check_deck: boolean; no_check_deck: boolean;
no_shuffle_deck: boolean; no_shuffle_deck: boolean;
lflist?: number; lflist?: number;
time_limit?: number; time_limit?: number;
auto_death: boolean;
} }
export interface Server { export interface Server {
id?: string; id?: string;
name?: string;
url?: string; url?: string;
address: string; address: string;
port: number; port: number;
hidden?: boolean;
custom?: boolean; custom?: boolean;
replay?: boolean; replay?: boolean;
windbot?: string[];
} }
interface News { interface News {
...@@ -121,13 +126,15 @@ export class YGOProService { ...@@ -121,13 +126,15 @@ export class YGOProService {
mode: 1, mode: 1,
rule: 0, rule: 0,
start_lp: 8000, start_lp: 8000,
start_lp_tag: 16000,
start_hand: 5, start_hand: 5,
draw_count: 1, draw_count: 1,
enable_priority: false, duel_rule: 5,
no_check_deck: false, no_check_deck: false,
no_shuffle_deck: false, no_shuffle_deck: false,
lflist: 0, lflist: 0,
time_limit: 180 time_limit: 180,
auto_death: false
}; };
readonly servers: Server[] = [ readonly servers: Server[] = [
{ {
...@@ -252,15 +259,15 @@ export class YGOProService { ...@@ -252,15 +259,15 @@ export class YGOProService {
create_room(room: Room, host_password: string) { create_room(room: Room, host_password: string) {
const options_buffer = Buffer.alloc(6); const options_buffer = Buffer.alloc(6);
// 建主密码 https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit // 建主密码 https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit
options_buffer.writeUInt8((room.private ? 2 : 1) << 4, 1); options_buffer.writeUInt8(((room.private ? 2 : 1) << 4) |
(room.options.duel_rule << 1) |
(room.options.auto_death ? 0x1 : 0), 1);
options_buffer.writeUInt8( options_buffer.writeUInt8(
(room.options.rule << 5) | room.options.rule << 5 |
(room.options.mode << 3) | room.options.mode << 3 |
(room.options.enable_priority ? 1 << 2 : 0) | (room.options.no_check_deck ? 1 << 1 : 0) |
(room.options.no_check_deck ? 1 << 1 : 0) | (room.options.no_shuffle_deck ? 1 : 0)
(room.options.no_shuffle_deck ? 1 : 0), , 2);
2
);
options_buffer.writeUInt16LE(room.options.start_lp, 3); options_buffer.writeUInt16LE(room.options.start_lp, 3);
options_buffer.writeUInt8((room.options.start_hand << 4) | room.options.draw_count, 5); options_buffer.writeUInt8((room.options.start_hand << 4) | room.options.draw_count, 5);
let checksum = 0; let checksum = 0;
......
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