Skip to content

Commit ab26d7f

Browse files
committed
feat(chusan): change sub trophies
1 parent a1ab3be commit ab26d7f

File tree

8 files changed

+57
-14
lines changed

8 files changed

+57
-14
lines changed

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"@types/bootstrap": "^5.2.10",
3636
"aegis-web-sdk": "^1.37.1",
3737
"bootstrap": "^5.2.3",
38+
"compare-versions": "^6.1.1",
3839
"cropperjs": "^1.5.13",
3940
"crypto-js": "^4.2.0",
4041
"dompurify": "^3.1.6",

src/app/sega/chunithm/v2/model/V2Profile.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export interface V2Profile {
1717
frameId: number;
1818
characterId: number;
1919
trophyId: number;
20+
trophyIdSub1: number;
21+
trophyIdSub2: number;
2022
playedTutorialBit: number;
2123
firstTutorialCancelNum: number;
2224
masterTutorialCancelNum: number;

src/app/sega/chunithm/v2/v2-rating/v2-rating.component.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ <h2 class="mb-0">{{ "ChuniV2.RatingPage.Best" | translate }}</h2>
8989
</div>
9090
</ng-container>
9191

92-
93-
<ng-template *ngIf="!loadingRecent && recentRating">
92+
<ng-container *ngIf="!loadingRecent && recentRating">
9493
<div class="mb-3 d-flex align-items-center">
9594
<h2 class="mb-0">{{ "ChuniV2.RatingPage.Recent" | translate }}</h2>
9695
<span class="badge bg-primary rounded-pill ms-2">{{ recentTotal / 10 | toRating }}</span>
@@ -102,7 +101,7 @@ <h2 class="mb-0">{{ "ChuniV2.RatingPage.Recent" | translate }}</h2>
102101
</ng-container>
103102
</div>
104103

105-
</ng-template>
104+
</ng-container>
106105

107106
<ng-template #record let-index="index" let-item="item">
108107
<div class="col-12 col-md-6 col-xxl-4">

src/app/sega/chunithm/v2/v2-rating/v2-rating.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {ChusanMusic} from '../model/ChusanMusic';
1010
import {V2SongScoreRankingComponent} from '../v2-song-score-ranking/v2-song-score-ranking.component';
1111
import {NgbOffcanvas} from '@ng-bootstrap/ng-bootstrap';
1212
import {NgxIndexedDBService} from 'ngx-indexed-db';
13+
import {compareVersions} from 'compare-versions';
1314

1415
@Component({
1516
selector: 'app-v2-rating',
@@ -21,16 +22,15 @@ export class V2RatingComponent implements OnInit {
2122
host = environment.assetsHost;
2223
enableImages = environment.enableImages;
2324

24-
romVersion: Version;
25+
romVersion: string;
2526
playerRating: number;
2627
highestRating: number;
2728
calcRating: number;
28-
verseVersion = new Version('2.30.00');
2929
loadingRating = true;
3030
loadingRecent = true;
31-
topRating: RatingItem[] = [];
32-
newRating: RatingItem[] = [];
33-
recentRating: RatingItem[] = [];
31+
topRating: RatingItem[] = undefined;
32+
newRating: RatingItem[] = undefined;
33+
recentRating: RatingItem[] = undefined;
3434
topTotal = 0;
3535
newTotal = 0;
3636
recentTotal = 0;
@@ -49,10 +49,10 @@ export class V2RatingComponent implements OnInit {
4949
const param = new HttpParams().set('aimeId', aimeId);
5050
const profile = await lastValueFrom(this.api.get('api/game/chuni/v2/profile', param));
5151
if (!profile) { return; }
52-
this.romVersion = new Version(profile.lastRomVersion);
52+
this.romVersion = profile.lastRomVersion;
5353
this.playerRating = profile.playerRating;
5454
this.highestRating = profile.highestRating;
55-
if (this.romVersion >= new Version('2.30.00')){
55+
if (compareVersions(this.romVersion, '2.30.00') >= 0){
5656
// b50
5757
const data = await lastValueFrom(this.api.get('api/game/chuni/v2/verse-rating', param));
5858
if (data) {

src/app/sega/chunithm/v2/v2-userbox/v2-userbox.component.ts

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, OnInit} from '@angular/core';
1+
import {Component, OnInit, Version} from '@angular/core';
22
import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
33
import {ApiService} from '../../../../api.service';
44
import {MessageService} from '../../../../message.service';
@@ -17,6 +17,7 @@ import {UserService} from 'src/app/user.service';
1717
import {V2SymbolChat} from '../model/V2SymbolChat';
1818
import {ChusanSymbolChat} from '../model/ChusanSymbolChat';
1919
import {V2SymbolChatSettingComponent} from './v2-symbol-chat-setting/v2-symbol-chat-setting.component';
20+
import {compareVersions} from 'compare-versions';
2021

2122
@Component({
2223
selector: 'app-v2-userbox',
@@ -41,6 +42,7 @@ export class V2UserBoxComponent implements OnInit {
4142

4243
systemVoiceIDs = [34, 0, 1, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 49, 50, 51];
4344
currentAvatarAcc: { category: number, accId: number } = {category: 0, accId: 0};
45+
currentSubTrophyIndex: number;
4446

4547
dialogOptions: NgbModalOptions = {
4648
centered: true,
@@ -71,6 +73,15 @@ export class V2UserBoxComponent implements OnInit {
7173
this.customable = [
7274
{name: 'Nameplate', value: this.getNamePlateName(this.profile.nameplateId), click: () => this.namePlate()},
7375
{name: 'Trophy', value: this.getTrophyName(this.profile.trophyId), click: () => this.trophy()},
76+
];
77+
if (compareVersions(this.profile.lastRomVersion, '2.30.00') >= 0){
78+
this.customable = this.customable.concat([
79+
80+
{name: 'TrophySub1', value: this.getTrophyName(this.profile.trophyIdSub1), click: () => this.trophySub1()},
81+
{name: 'TrophySub2', value: this.getTrophyName(this.profile.trophyIdSub2), click: () => this.trophySub2()},
82+
]);
83+
}
84+
this.customable = this.customable.concat([
7485
{name: 'MapIcon', value: this.getMapIconName(this.profile.mapIconId), click: () => this.mapIcon()},
7586
{name: 'SystemVoice', value: this.getSystemVoiceName(this.profile.voiceId), click: () => this.systemVoice()},
7687
{
@@ -98,7 +109,7 @@ export class V2UserBoxComponent implements OnInit {
98109
click: () => this.avatarAcc(7, this.profile.avatarBack)
99110
},
100111
// { name: 'Frame', value: this.getFrameName(this.profile.frameId), click: () => this.frame() },
101-
];
112+
]);
102113
}
103114

104115
playAudio(id: number) {
@@ -152,7 +163,7 @@ export class V2UserBoxComponent implements OnInit {
152163
];
153164
for (const item of data) {
154165
const symbolChat = value.find(v => v.sceneId === item.sceneId && v.orderId === item.orderId);
155-
if (symbolChat){
166+
if (symbolChat) {
156167
symbolChat.symbolChatId = item.symbolChatId;
157168
}
158169
}
@@ -259,7 +270,15 @@ export class V2UserBoxComponent implements OnInit {
259270
break;
260271
case 3: // Trophy
261272
apiURL = 'api/game/chuni/v2/profile/trophy';
262-
requestBody = {aimeId: this.aimeId, trophyId: itemId};
273+
if (this.currentSubTrophyIndex === 0){
274+
requestBody = {aimeId: this.aimeId, trophyId: itemId};
275+
}
276+
else if (this.currentSubTrophyIndex === 1){
277+
requestBody = {aimeId: this.aimeId, trophyIdSub1: itemId};
278+
}
279+
else if (this.currentSubTrophyIndex === 2){
280+
requestBody = {aimeId: this.aimeId, trophyIdSub2: itemId};
281+
}
263282
break;
264283
case 8: // MapIcon
265284
apiURL = 'api/game/chuni/v2/profile/mapicon';
@@ -289,6 +308,17 @@ export class V2UserBoxComponent implements OnInit {
289308

290309
trophy() {
291310
this.openItemDialog({itemKind: 3, itemId: this.profile.trophyId, showAllItems: this.showAllItems});
311+
this.currentSubTrophyIndex = 0;
312+
}
313+
314+
trophySub1() {
315+
this.openItemDialog({itemKind: 3, itemId: this.profile.trophyIdSub1, showAllItems: this.showAllItems});
316+
this.currentSubTrophyIndex = 1;
317+
}
318+
319+
trophySub2() {
320+
this.openItemDialog({itemKind: 3, itemId: this.profile.trophyIdSub2, showAllItems: this.showAllItems});
321+
this.currentSubTrophyIndex = 2;
292322
}
293323

294324
mapIcon() {

src/assets/i18n/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@
431431
"AvatarFront": "Avatar Front",
432432
"AvatarBack": "Avatar Back",
433433
"Trophy": "Trophy",
434+
"TrophySub1": "Sub Trophy 1",
435+
"TrophySub2": "Sub Trophy 2",
434436
"Frame": "Frame",
435437
"Change": "Change",
436438
"Preview": "Preview",

src/assets/i18n/zh.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@
431431
"AvatarFront": "前面",
432432
"AvatarBack": "背部",
433433
"Trophy": "称号",
434+
"TrophySub1": "副称号1",
435+
"TrophySub2": "副称号2",
434436
"Frame": "框体",
435437
"Change": "更改",
436438
"Preview": "预览",

0 commit comments

Comments
 (0)