import { Component } from '@angular/core' ; import { PopoverController } from '@ionic/angular' ; import { GameService } from '../game.service' ; import { EquipmentItemPopover } from '../_shared/equipment/equipmentitem.popover' ; import { IItem , ItemSlot , ServerEventName } from '../../../shared/interfaces' ; import { SocketClusterService } from '../socket-cluster.service' ; @ Component ( { selector : 'app-equipment' , templateUrl : './equipment.page.html' , styleUrls : [ './equipment.page.scss' ] , } ) export class EquipmentPage { public slots = [ 'body' , 'charm' , 'feet' , 'finger' , 'hands' , 'head' , 'legs' , 'mainhand' , 'neck' , 'offhand' , 'providence' , 'soul' , 'trinket' ] ; constructor ( private popoverCtrl , private socketService , public gameService ) { } public canHideSlot ( slot ) { return slot === 'soul' || slot === 'providence' ; } public async openItemMenu ( $event , item , slot ) { const popover = await this . popoverCtrl . create ( { component : EquipmentItemPopover , componentProps : { item , slot , somethingElseCallback : ( chosenItem ) => { this . socketService . emit ( ServerEventName . ItemEquip , { itemId : chosenItem . id } ) ; } , unequipCallback : ( ) => { this . socketService . emit ( ServerEventName . ItemUnequip , { itemSlot : item . type } ) ; } , lockCallback : ( chosenItem , isLocked ) => { if ( isLocked ) { this . socketService . emit ( ServerEventName . ItemLock , { itemSlot : chosenItem . type } ) ; } else { this . socketService . emit ( ServerEventName . ItemUnlock , { itemSlot : chosenItem . type } ) ; } } , salvageCallback : ( ) => { this . socketService . emit ( ServerEventName . ItemSalvage , { itemId : item . id , itemSlot : item . type } ) ; } } , event : $event , translucent : true } ) ; return await popover . present ( ) ; } }