Commit 87d4a93d authored by 神楽坂玲奈's avatar 神楽坂玲奈

导入存档、修复ygopro模式不对问题。

parent 5fd9ee15
<p>时隔多年,终于又跟</p>
<h2>招人</h2>
<h3>前端工程师</h3>
<p>热爱,圈内优先</p>
<p>HTML5, CSS, JavaScript</p>
<p>至少会一个前端框架 Angular React Vue</p>
<p>坐标上海,全职,不远程,工资面议</p>
<h3>后端工程师</h3>
<p>热爱,圈内优先</p>
<p>会 php、, CSS, JavaScript</p>
<p>至少会一个前端框架 Angular React Vue</p>
<p>坐标上海,全职,不远程,工资面议</p>
<h2>联系我们</h2>
<dl>
<dt>游戏投稿、合作、应聘、侵权投诉</dt>
<dd>business@mycard.com</dd>
<dt>问题反馈</dt>
<dd>support@mycard.moe</dd>
</dl>
\ No newline at end of file
/**
* Created by zh99998 on 16/9/2.
*/
import {Component} from "@angular/core";
@Component({
moduleId: module.id,
selector: 'about',
templateUrl: 'about.component.html',
styleUrls: ['about.component.css'],
})
export class AboutComponent {
}
......@@ -15,6 +15,9 @@
<li *ngIf="loginService.logged_in" [ngClass]="{active: currentPage === 'community'}" class="nav-item">
<a i18n (click)="currentPage='community'" class="nav-link" href="#">社区</a>
</li>
<!--<li *ngIf="loginService.logged_in" [ngClass]="{active: currentPage === 'about'}" class="nav-item">-->
<!--<a i18n (click)="currentPage='about'" class="nav-link" href="#">关于</a>-->
<!--</li>-->
</ul>
<div class="navbar-right">
<div id="update-status">
......@@ -41,6 +44,7 @@
<store class="page" *ngIf="loginService.logged_in" [hidden]="currentPage != 'store'"></store>
<lobby class="page" *ngIf="loginService.logged_in" [hidden]="currentPage != 'lobby'"></lobby>
<webview class="page" *ngIf="loginService.logged_in" [hidden]="currentPage != 'community'" src="https://ygobbs.com" (new-window)="openExternal($event.url)"></webview>
<about class="page" *ngIf="loginService.logged_in" [hidden]="currentPage != 'about'"></about>
<!-- Modal -->
<div class="modal fade" id="settings-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
......
......@@ -13,12 +13,13 @@ import {AppsService} from "./apps.service";
import {SettingsService} from "./settings.sevices";
import {LoginService} from "./login.service";
import {DownloadService} from "./download.service";
import {AboutComponent} from "./about.component";
@NgModule({
imports: [BrowserModule, FormsModule, ReactiveFormsModule, HttpModule],
declarations: [
MyCardComponent, LoginComponent, StoreComponent, LobbyComponent,
AppDetailComponent, RosterComponent, YGOProComponent,
AppDetailComponent, RosterComponent, YGOProComponent, AboutComponent
],
bootstrap: [MyCardComponent],
providers: [
......
......@@ -79,4 +79,8 @@
.actions {
margin-bottom: 1em;
}
dl {
margin-bottom: 0;
}
\ No newline at end of file
......@@ -20,6 +20,31 @@
<button i18n [disabled]="!appsService.allReady(app)" type="button" class="btn btn-secondary" data-toggle="modal" data-target="#game-create-windbot">单人模式</button>
</div>
<!--<div class="actions">-->
<!--<h2 i18n>排位成绩 (测试中)</h2>-->
<!--&lt;!&ndash;{"exp":1839,"exp_rank":"9","pt":2207.2901,"arena_rank":"30","win":"703","lose":"568","draw":5,"all":"1276","ratio":"55.09"}&ndash;&gt;-->
<!--<dl *ngIf="points" class="row">-->
<!--<dt i18n class="col-xs-2">D.P 排名</dt>-->
<!--<dd class="col-xs-1">{{points.arena_rank}}</dd>-->
<!--<dt i18n class="col-xs-2">D.P 胜率</dt>-->
<!--<dd class="col-xs-1">{{points.ratio}}%</dd>-->
<!--<dt i18n class="col-xs-2">胜场</dt>-->
<!--<dd class="col-xs-1">{{points.win}}</dd>-->
<!--<dt i18n class="col-xs-2">负场</dt>-->
<!--<dd class="col-xs-1">{{points.lose}}</dd>-->
<!--<dt i18n class="col-xs-2">平局</dt>-->
<!--<dd class="col-xs-1">{{points.draw}}</dd>-->
<!--<dt i18n class="col-xs-2">总场</dt>-->
<!--<dd class="col-xs-1">{{points.all}}</dd>-->
<!--<dt i18n class="col-xs-2">EXP 排名</dt>-->
<!--<dd class="col-xs-1">{{points.exp_rank}}</dd>-->
<!--<dt i18n class="col-xs-2">EXP</dt>-->
<!--<dd class="col-xs-1">{{points.exp}}</dd>-->
<!--</dl>-->
<!--<a i18n href="https://mycard.moe/ygopro/arena/" target="_blank">更多资料</a>-->
<!--</div>-->
<div class="modal fade" id="game-create-windbot" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
......@@ -62,7 +87,7 @@
<div class="form-group row">
<label i18n for="game-create-rule" class="col-sm-2 form-control-label">卡片允许</label>
<div class="col-sm-10">
<select class="form-control" id="game-create-rule" name="rule" [(ngModel)]="room.rule">
<select class="form-control" id="game-create-rule" name="rule" [(ngModel)]="room.options.rule">
<option i18n value="0">OCG</option>
<option i18n value="1">TCG</option>
<option i18n value="2">OCG & TCG</option>
......@@ -73,7 +98,7 @@
<div class="form-group row">
<label for="game-create-mode" i18n class="col-sm-2 form-control-label">决斗模式</label>
<div class="col-sm-10">
<select class="form-control" id="game-create-mode" name="mode" [(ngModel)]="room.mode">
<select class="form-control" id="game-create-mode" name="mode" [(ngModel)]="room.options.mode">
<option i18n value="0">单局模式</option>
<option i18n value="1">比赛模式</option>
<option i18n value="2">TAG</option>
......@@ -86,33 +111,33 @@
<div class="row">
<label i18n for="game-create-start-lp" class="col-sm-6 form-control-label">初始 LP</label>
<div class="col-sm-6">
<input name="start_lp" type="number" value="8000" min="1" max="65536" class="form-control form-control-sm game-create-extra" id="game-create-start-lp" [(ngModel)]="room.start_lp">
<input name="start_lp" type="number" value="8000" min="1" max="65536" class="form-control form-control-sm game-create-extra" id="game-create-start-lp" [(ngModel)]="room.options.start_lp">
</div>
</div>
<div class="row">
<label i18n for="game-create-start-hand" class="col-sm-6 form-control-label">初始手牌数</label>
<div class="col-sm-6">
<input name="start_hand" type="number" value="5" min="0" max="16" class="form-control form-control-sm game-create-extra" id="game-create-start-hand" [(ngModel)]="room.start_hand">
<input name="start_hand" type="number" value="5" min="0" max="16" class="form-control form-control-sm game-create-extra" id="game-create-start-hand" [(ngModel)]="room.options.start_hand">
</div>
</div>
<div class="row">
<label i18n for="game-create-draw-count" class="col-sm-6 form-control-label">每回合抽卡</label>
<div class="col-sm-6">
<input name="draw_count" type="number" value="1" min="0" max="16" class="form-control form-control-sm game-create-extra" id="game-create-draw-count" [(ngModel)]="room.draw_count">
<input name="draw_count" type="number" value="1" min="0" max="16" class="form-control form-control-sm game-create-extra" id="game-create-draw-count" [(ngModel)]="room.options.draw_count">
</div>
</div>
</div>
<div class="col-sm-5">
<div class="checkbox">
<input id="enable_priority" name="enable_priority" type="checkbox" [(ngModel)]="room.enable_priority">
<input id="enable_priority" name="enable_priority" type="checkbox" [(ngModel)]="room.options.enable_priority">
<label i18n for="enable_priority">允许启动效果优先权</label>
</div>
<div class="checkbox">
<input id="no_check_deck" name="no_check_deck" type="checkbox" [(ngModel)]="room.no_check_deck">
<input id="no_check_deck" name="no_check_deck" type="checkbox" [(ngModel)]="room.options.no_check_deck">
<label i18n for="no_check_deck">不检查卡组</label>
</div>
<div class="checkbox">
<input id="no_shuffle_deck" name="no_shuffle_deck" type="checkbox" [(ngModel)]="room.no_shuffle_deck">
<input id="no_shuffle_deck" name="no_shuffle_deck" type="checkbox" [(ngModel)]="room.options.no_shuffle_deck">
<label for="no_shuffle_deck" i18n>开局不洗卡组</label>
</div>
</div>
......@@ -156,15 +181,15 @@
<td class="users">
<img *ngFor="let user of room.users" class="avatar" [src]="'https://ygobbs.com/user_avatar/ygobbs.com/' + user.username + '/25/1.png'">
</td>
<td class="mode">{{{'0': '单局模式', '1': '比赛模式', '2': 'TAG'}[room.mode]}}</td>
<td class="mode">{{{'0': '单局模式', '1': '比赛模式', '2': 'TAG'}[room.options.mode]}}</td>
<td class="extra">
<span *ngIf="room.rule != default_options.rule">{{{'0': 'OCG', '1': 'TCG', '2': 'O/T', '3': '专有卡禁止'}[room.rule]}}</span>
<span i18n *ngIf="room.start_lp != default_options.start_lp">{{room.start_lp}} LP</span>
<span i18n *ngIf="room.start_hand != default_options.start_hand">{{room.start_hand}} 初始</span>
<span i18n *ngIf="room.draw_count != default_options.draw_count">{{room.draw_count}} 抽卡</span>
<span i18n *ngIf="room.enable_priority != default_options.enable_priority">优先权</span>
<span i18n *ngIf="room.no_check_deck != default_options.no_check_deck">不检查</span>
<span i18n *ngIf="room.no_shuffle_deck != default_options.no_shuffle_deck">不洗卡</span>
<span *ngIf="room.options.rule != default_options.rule">{{{'0': 'OCG', '1': 'TCG', '2': 'O/T', '3': '专有卡禁止'}[room.options.rule]}}</span>
<span i18n *ngIf="room.options.start_lp != default_options.start_lp">{{room.options.start_lp}} LP</span>
<span i18n *ngIf="room.options.start_hand != default_options.start_hand">{{room.options.start_hand}} 初始</span>
<span i18n *ngIf="room.options.draw_count != default_options.draw_count">{{room.options.draw_count}} 抽卡</span>
<span i18n *ngIf="room.options.enable_priority != default_options.enable_priority">优先权</span>
<span i18n *ngIf="room.options.no_check_deck != default_options.no_check_deck">不检查</span>
<span i18n *ngIf="room.options.no_shuffle_deck != default_options.no_shuffle_deck">不洗卡</span>
</td>
</tbody>
</table>
......
......@@ -56,6 +56,10 @@ interface Room {
title?: string
server?: Server
private?: boolean
options: Options;
}
interface Options {
mode: number,
rule: number,
start_lp: number,
......@@ -64,8 +68,25 @@ interface Room {
enable_priority: boolean,
no_check_deck: boolean,
no_shuffle_deck: boolean
lflist?: number;
time_limit?: number
}
interface Points {
exp: number,
exp_rank: number,
pt: number,
arena_rank: number,
win: number,
lose: number,
draw: number,
all: number,
ratio: number
}
let matching: ISubscription | undefined;
let matching_arena: string | undefined;
@Component({
moduleId: module.id,
selector: 'ygopro',
......@@ -80,6 +101,7 @@ export class YGOProComponent implements OnInit {
system_conf: string;
numfont: string[];
textfont: string[];
points: Points;
windbot = ["琪露诺", "谜之剑士LV4", "复制植物", "尼亚"];
......@@ -91,7 +113,7 @@ export class YGOProComponent implements OnInit {
}];
default_options: Room = {
default_options: Options = {
mode: 1,
rule: 0,
start_lp: 8000,
......@@ -99,15 +121,20 @@ export class YGOProComponent implements OnInit {
draw_count: 1,
enable_priority: false,
no_check_deck: false,
no_shuffle_deck: false
no_shuffle_deck: false,
lflist: 0,
time_limit: 180
};
room: Room = Object.assign({title: this.loginService.user.username + '的房间'}, this.default_options);
room: Room = {title: this.loginService.user.username + '的房间', options: Object.assign({}, this.default_options)};
rooms: Room[] = [];
connections: WebSocket[] = [];
matching: ISubscription | undefined;
matching_arena: string | undefined;
constructor(private http: Http, private appsService: AppsService, private loginService: LoginService, private ref: ChangeDetectorRef) {
switch (process.platform) {
case 'darwin':
......@@ -119,6 +146,9 @@ export class YGOProComponent implements OnInit {
this.textfont = [path.join(process.env['SystemRoot'], 'Fonts', 'msyh.ttc'), path.join(process.env['SystemRoot'], 'Fonts', 'msyh.ttf'), path.join(process.env['SystemRoot'], 'Fonts', 'simsun.ttc')];
break;
}
this.matching = matching;
this.matching_arena = matching_arena;
}
async ngOnInit() {
......@@ -138,13 +168,13 @@ export class YGOProComponent implements OnInit {
//console.log(message)
switch (message.event) {
case 'init':
this.rooms = this.rooms.filter(room => room.server != server).concat(message.data.map((data: any) => Object.assign({server: server}, this.default_options, data)));
this.rooms = this.rooms.filter(room => room.server != server).concat(message.data.map((room: Room) => Object.assign({server: server}, room)));
break;
case 'create':
this.rooms.push(Object.assign({server: server}, this.default_options, message.data));
this.rooms.push(Object.assign({server: server}, message.data));
break;
case 'update':
Object.assign(this.rooms.find(room => room.server == server && room.id == message.data.id), this.default_options, message.data);
Object.assign(this.rooms.find(room => room.server == server && room.id == message.data.id), message.data);
break;
case 'delete':
this.rooms.splice(this.rooms.findIndex(room => room.server == server && room.id == message.data), 1);
......@@ -169,6 +199,14 @@ export class YGOProComponent implements OnInit {
if (!(this.decks.includes(this.current_deck))) {
this.current_deck = decks[0];
}
// https://mycard.moe/ygopro/api/user?username=ozxdno
let params = new URLSearchParams();
params.set('username', this.loginService.user.username);
try {
this.points = await this.http.get('https://mycard.moe/ygopro/api/user', {search: params}).map((response) => response.json()).toPromise()
} catch (error) {
console.log(error)
}
};
get_decks(): Promise<string[]> {
......@@ -276,13 +314,13 @@ export class YGOProComponent implements OnInit {
})
};
create_room(options: Room) {
create_room(room: Room) {
let options_buffer = new Buffer(6);
// 建主密码 https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit
options_buffer.writeUInt8((options.private ? 2 : 1) << 4, 1);
options_buffer.writeUInt8(options.rule << 5 | options.mode << 3 | (options.enable_priority ? 1 << 2 : 0) | (options.no_check_deck ? 1 << 1 : 0) | (options.no_shuffle_deck ? 1 : 0), 2);
options_buffer.writeUInt16LE(options.start_lp, 3);
options_buffer.writeUInt8(options.start_hand << 4 | options.draw_count, 5);
options_buffer.writeUInt8((room.private ? 2 : 1) << 4, 1);
options_buffer.writeUInt8(room.options.rule << 5 | room.options.mode << 3 | (room.options.enable_priority ? 1 << 2 : 0) | (room.options.no_check_deck ? 1 << 1 : 0) | (room.options.no_shuffle_deck ? 1 : 0), 2);
options_buffer.writeUInt16LE(room.options.start_lp, 3);
options_buffer.writeUInt8(room.options.start_hand << 4 | room.options.draw_count, 5);
let checksum = 0;
for (let i = 1; i < options_buffer.length; i++) {
checksum -= options_buffer.readUInt8(i)
......@@ -294,7 +332,7 @@ export class YGOProComponent implements OnInit {
options_buffer.writeUInt16LE(options_buffer.readUInt16LE(i) ^ secret, i)
}
let password = options_buffer.toString('base64') + (options.title!).replace(/\s/, String.fromCharCode(0xFEFF));
let password = options_buffer.toString('base64') + (room.title!).replace(/\s/, String.fromCharCode(0xFEFF));
let room_id = crypto.createHash('md5').update(password + this.loginService.user.username).digest('base64').slice(0, 10).replace('+', '-').replace('/', '_');
this.join(password, this.servers[0]);
......@@ -320,16 +358,13 @@ export class YGOProComponent implements OnInit {
this.join(password, room.server!);
}
matching: ISubscription | null;
matching_arena: string | null;
request_match(arena = 'entertain') {
let headers = new Headers();
headers.append("Authorization", "Basic " + new Buffer(this.loginService.user.username + ":" + this.loginService.user.external_id).toString('base64'));
let search = new URLSearchParams();
search.set("arena", arena);
this.matching_arena = arena;
this.matching = this.http.post('https://api.mycard.moe/ygopro/match', null, {
this.matching_arena = matching_arena = arena;
this.matching = matching = this.http.post('https://api.mycard.moe/ygopro/match', null, {
headers: headers,
search: search
}).map(response => response.json())
......@@ -341,15 +376,15 @@ export class YGOProComponent implements OnInit {
}, (error) => {
alert(`匹配失败\n${error}`)
}, () => {
this.matching = null;
this.matching_arena = null;
this.matching = matching = undefined;
this.matching_arena = matching_arena = undefined;
this.ref.detectChanges()
});
}
cancel_match() {
this.matching!.unsubscribe();
this.matching = null;
this.matching_arena = null;
this.matching = matching = undefined;
this.matching_arena = matching_arena = undefined;
}
}
......@@ -2059,17 +2059,13 @@
},
"files": {
"deck/*.ydk": {
"sync": true,
"ignore": true
"sync": true
},
"single/*.lua": {
"sync": true
},
"replay/*.yrp": {
"sync": true
},
"system.conf": {
"ignore": true
}
},
"news": {
......
......@@ -14,7 +14,12 @@
<trans-unit datatype="html" id="c4fc2b3584e7581cddb08bb1ebfa41e601195d5b">
<source>社区</source>
<target>Community</target>
</trans-unit>
<trans-unit datatype="html" id="6ef7c5489cf0504f9a170d1344abb0420312ceeb">
<source>关于</source>
<target>About</target>
</trans-unit>
<trans-unit datatype="html" id="8422ff34db177236e8f54d415b07c972284c36bf">
<source>切换账号</source>
......@@ -289,7 +294,57 @@
<trans-unit datatype="html" id="3768b60a7e2625bb1fc2db37eb8c6b8e4bd99101">
<source>单人模式</source>
<target>Single Mode</target>
</trans-unit>
<trans-unit datatype="html" id="6f0b5aa5478c05ac01323a83854985ac4ee6ecdb">
<source>排位成绩 (测试中)</source>
<target>Rank Result</target>
</trans-unit>
<trans-unit datatype="html" id="c46097c9d5e0501f2dc3a79eaafa0ca8330b0a25">
<source>D.P 排名</source>
<target>D.P Rank</target>
</trans-unit>
<trans-unit datatype="html" id="e7dd051e36eb95e7d6ce704dff0068e1bf5bd81a">
<source>D.P 胜率</source>
<target>Win Rate</target>
</trans-unit>
<trans-unit datatype="html" id="0ce6333a9b6c85ccd57ecdbee84ef7f6f3f51ef4">
<source>胜场</source>
<target>Win</target>
</trans-unit>
<trans-unit datatype="html" id="a89a5c5567bbe1de398b978749b9a1bf6f1281bf">
<source>负场</source>
<target>Lose</target>
</trans-unit>
<trans-unit datatype="html" id="41a0424d676209939f79f70c8ef8aa8a143d3451">
<source>平局</source>
<target>Draw</target>
</trans-unit>
<trans-unit datatype="html" id="3f4d682cd4fc7579e9ea6bd1bddec84dbc35fd50">
<source>总场</source>
<target>Total</target>
</trans-unit>
<trans-unit datatype="html" id="4a893998eefe3a0d103863aac391b5789870c089">
<source>EXP 排名</source>
<target>EXP Rank</target>
</trans-unit>
<trans-unit datatype="html" id="6ec23deac8d2367c3a7a4f27946d0835634514fb">
<source>EXP</source>
<target>EXP</target>
</trans-unit>
<trans-unit datatype="html" id="f5f5d4874301c4b42cdbfab010c953631abbcec9">
<source>更多资料</source>
<target>More Info</target>
</trans-unit>
<trans-unit datatype="html" id="1e64bb9c96dfc2b9cb03179dd0c9f992e0645e5f">
<source>选择对手</source>
......@@ -348,7 +403,7 @@
</trans-unit>
<trans-unit datatype="html" id="d4038dd5d0e9d5139d425fc7bea40e40d965cc5b">
<source>额外选项</source>
<target>Additional Options</target>
<target>Additional Options</target>
</trans-unit>
<trans-unit datatype="html" id="01cfbee3f1d69f5adae299b7b8c8d75034aef53b">
......@@ -396,17 +451,17 @@
<target>Player</target>
</trans-unit>
<trans-unit datatype="html" id="4baa1360b4d635000fc5e14a6e7376f46ace0bd9">
<trans-unit datatype="html" id="8514a93609dc67a44e5b198b53e42fe468f8a81a">
<source><x id="INTERPOLATION"/> LP</source>
<target><x id="INTERPOLATION"/> LP</target>
</trans-unit>
<trans-unit datatype="html" id="1939517ea2b4ff337ce2847302fbcc6f1217d269">
<trans-unit datatype="html" id="4a6f5fb56c2367667232cc46608dc46a282e2e56">
<source><x id="INTERPOLATION"/> 初始</source>
<target><x id="INTERPOLATION"/> Starting</target>
</trans-unit>
<trans-unit datatype="html" id="a19d6d5a2c74d9df73936a17b5c71b2069051b49">
<trans-unit datatype="html" id="cae091ce48a80dbc22d5fde2eea1cbd34e7038c7">
<source><x id="INTERPOLATION"/> 抽卡</source>
<target><x id="INTERPOLATION"/> Draw</target>
......
{
"name": "mycard",
"version": "3.0.8",
"version": "3.0.9",
"description": "mycard",
"keywords": [],
"author": "zh99998 <zh99998@gmail.com>",
......@@ -33,7 +33,7 @@
"electron-is-dev": "latest",
"electron-sudo": "mycard/electron-sudo#mycard",
"font-awesome": "latest",
"glob": "^7.1.1",
"glob": "latest",
"ini": "latest",
"jquery": "latest",
"raw-socket": "latest",
......@@ -42,14 +42,14 @@
"systemjs": "mycard/systemjs#mycard",
"systemjs-plugin-text": "latest",
"tether": "latest",
"vue": "^2.1.6",
"vue": "latest",
"zone.js": "^0.6.26"
},
"devDependencies": {
"@angular/compiler-cli": "latest",
"@angular/platform-server": "latest",
"@types/electron": "latest",
"@types/glob": "^5.0.30",
"@types/glob": "latest",
"@types/ini": "latest",
"@types/node": "latest",
"electron": "latest",
......
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