1- import { Component , OnInit } from '@angular/core' ;
1+ import { Component , OnInit , Version } from '@angular/core' ;
22import { NgbModal , NgbModalOptions } from '@ng-bootstrap/ng-bootstrap' ;
33import { ApiService } from '../../../../api.service' ;
44import { MessageService } from '../../../../message.service' ;
@@ -17,6 +17,7 @@ import {UserService} from 'src/app/user.service';
1717import { V2SymbolChat } from '../model/V2SymbolChat' ;
1818import { ChusanSymbolChat } from '../model/ChusanSymbolChat' ;
1919import { 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 ( ) {
0 commit comments