import { EventEmitter } from '@angular/core' ; import { Component , Input , Output } from '@angular/core' ; @ Component ( { selector : 'app-stat-tier-selection' , templateUrl : './stat-tier-selection.component.html' , styleUrls : [ './stat-tier-selection.component.scss' ] } ) export class StatTierSelectionComponent { readonly TierRange = new Array ( 11 ) ; @ Input ( ) statsByMods : number = 0 ; @ Input ( ) maximumAvailableTier : number = 10 ; @ Input ( ) selectedTier : number = 0 ; @ Input ( ) tooltipTexts : string [ ] = [ ] ; @ Output ( ) selectedTierChange = new EventEmitter < number > ( ) ; constructor ( ) { } setValue ( newValue ) { if ( newValue <= this . maximumAvailableTier ) { this . selectedTier = newValue ; this . selectedTierChange . emit ( newValue ) ; } } isAddedByConfigMods ( index ) { return index > 0 && ( ( ( this . selectedTier - index ) >= 0 && ( this . selectedTier - index ) < this . statsByMods ) || ( this . selectedTier < this . statsByMods && index <= this . statsByMods ) ) ; } getTooltip ( index ) { let tooltip = ( this . tooltipTexts || [ ] ) [ index ] ; if ( this . isAddedByConfigMods ( index ) ) { tooltip += "\n\n~ This tier is added by selected fragments or mods ~" ; } return tooltip ; } }