diff --git a/src/views/room/events/RoomWidgetUpdateInfostandPetEvent.ts b/src/views/room/events/RoomWidgetUpdateInfostandPetEvent.ts index 5dbdc2ef..1473631d 100644 --- a/src/views/room/events/RoomWidgetUpdateInfostandPetEvent.ts +++ b/src/views/room/events/RoomWidgetUpdateInfostandPetEvent.ts @@ -1,3 +1,4 @@ +import { PetFigureData } from 'nitro-renderer'; import { RoomWidgetUpdateInfostandEvent } from './RoomWidgetUpdateInfostandEvent'; export class RoomWidgetUpdateInfostandPetEvent extends RoomWidgetUpdateInfostandEvent @@ -20,6 +21,8 @@ export class RoomWidgetUpdateInfostandPetEvent extends RoomWidgetUpdateInfostand public image: HTMLImageElement = null; public petType: number = 0; public petBreed: number = 0; + public petFigure: PetFigureData = null; + public posture: string = 'std'; public isOwner: boolean = false; public ownerId: number = -1; public ownerName: string = ''; diff --git a/src/views/room/handlers/RoomWidgetInfostandHandler.ts b/src/views/room/handlers/RoomWidgetInfostandHandler.ts index d1e509f0..ac916114 100644 --- a/src/views/room/handlers/RoomWidgetInfostandHandler.ts +++ b/src/views/room/handlers/RoomWidgetInfostandHandler.ts @@ -1,4 +1,4 @@ -import { IFurnitureData, Nitro, NitroEvent, ObjectDataFactory, PetType, RoomAdsUpdateComposer, RoomControllerLevel, RoomModerationParser, RoomObjectCategory, RoomObjectOperationType, RoomObjectType, RoomObjectVariable, RoomSessionPetInfoUpdateEvent, RoomSessionUserBadgesEvent, RoomTradingLevelEnum, RoomUnitDropHandItemComposer, RoomUnitGiveHandItemComposer, RoomUnitGiveHandItemPetComposer, RoomUserData, RoomWidgetEnumItemExtradataParameter, SecurityLevel, Vector3d } from 'nitro-renderer'; +import { IFurnitureData, Nitro, NitroEvent, ObjectDataFactory, PetFigureData, PetType, RoomAdsUpdateComposer, RoomControllerLevel, RoomModerationParser, RoomObjectCategory, RoomObjectOperationType, RoomObjectType, RoomObjectVariable, RoomSessionPetInfoUpdateEvent, RoomSessionUserBadgesEvent, RoomTradingLevelEnum, RoomUnitDropHandItemComposer, RoomUnitGiveHandItemComposer, RoomUnitGiveHandItemPetComposer, RoomUserData, RoomWidgetEnumItemExtradataParameter, SecurityLevel, Vector3d } from 'nitro-renderer'; import { GetConnection, GetRoomEngine, GetSessionDataManager, IsOwnerOfFurniture } from '../../../api'; import { LocalizeText } from '../../../utils/LocalizeText'; import { RoomWidgetObjectNameEvent, RoomWidgetUpdateEvent, RoomWidgetUpdateInfostandFurniEvent, RoomWidgetUpdateInfostandPetEvent, RoomWidgetUpdateInfostandRentableBotEvent, RoomWidgetUpdateInfostandUserEvent } from '../events'; @@ -598,27 +598,16 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler if(!roomPetData) return; - const figure = roomPetData.figure; - - const petType = this.getPetType(figure); - const petBreed = this.getPetBreed(figure); + const figure = new PetFigureData(roomPetData.figure); let posture: string = null; - if(petType === PetType.MONSTERPLANT) + if(figure.typeId === PetType.MONSTERPLANT) { if(petData.level >= petData._Str_20651) posture = 'std'; else posture = ('grw' + petData.level); } - // var _local_8:String = (_local_4 + ((_local_7 != null) ? ("/posture=" + _local_7) : "")); - // var _local_9:BitmapData = (this._cachedPetImages.getValue(_local_8) as BitmapData); - // if (_local_9 == null) - // { - // _local_9 = this._Str_2641(_local_4, _local_7); - // this._cachedPetImages.add(_local_8, _local_9); - // } - const isOwner = (petData.ownerId === GetSessionDataManager().userId); const infostandEvent = new RoomWidgetUpdateInfostandPetEvent(RoomWidgetUpdateInfostandPetEvent.PET_INFO); @@ -627,8 +616,10 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler infostandEvent.ownerId = petData.ownerId; infostandEvent.ownerName = petData.ownerName; infostandEvent.rarityLevel = petData.rarityLevel; - infostandEvent.petType = petType; - infostandEvent.petBreed = petBreed; + infostandEvent.petType = figure.typeId; + infostandEvent.petBreed = figure.paletteId; + infostandEvent.petFigure = figure; + infostandEvent.posture = posture; infostandEvent.isOwner = isOwner; infostandEvent.roomIndex = roomPetData.roomIndex; infostandEvent.level = petData.level; @@ -748,6 +739,11 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler return this.getPetFigurePart(figure, 1); } + private getPetColor(figure: string): number + { + return this.getPetFigurePart(figure, 2); + } + private getPetFigurePart(figure: string, index: number): number { if(!figure || !figure.length) return -1; diff --git a/src/views/room/widgets/infostand/InfoStandWidgetView.scss b/src/views/room/widgets/infostand/InfoStandWidgetView.scss index b5219a9c..8394c58b 100644 --- a/src/views/room/widgets/infostand/InfoStandWidgetView.scss +++ b/src/views/room/widgets/infostand/InfoStandWidgetView.scss @@ -7,11 +7,12 @@ .nitro-infostand { position: relative; - min-width: 190px; - max-width: 190px; + min-width: 200px; + max-width: 200px; z-index: $infostand-zindex; pointer-events: auto; - box-shadow: inset 0 2px 0 rgba($white, .15), 0 1px 1px rgba($black, .1); + box-shadow: inset 0 2px 0 rgba($white, .15), inset 0 -2px rgba($black, .1), 0 1px rgba($black, .1); + border: 1px solid rgba($black, 0.1); .form-control-sm { height: 25px; @@ -19,14 +20,6 @@ padding: 0.1rem 0.25rem; } - .pet-image { - position: relative; - width: 100%; - height: 130px; - background-repeat: no-repeat; - background-position: center; - } - .body-image { display: flex; align-items: center; @@ -37,6 +30,10 @@ border-radius: 3px; margin-right: 5px; + &.pet { + max-width: 75px; + } + &.bot { background-image: url('../../../../assets/images/infostand/bot_background.png'); background-repeat: no-repeat; @@ -81,6 +78,6 @@ } .pet-stats { - height: 21px; + height: 18px; } } diff --git a/src/views/room/widgets/infostand/views/pet/InfoStandWidgetPetView.tsx b/src/views/room/widgets/infostand/views/pet/InfoStandWidgetPetView.tsx index a9a7f344..f3417924 100644 --- a/src/views/room/widgets/infostand/views/pet/InfoStandWidgetPetView.tsx +++ b/src/views/room/widgets/infostand/views/pet/InfoStandWidgetPetView.tsx @@ -10,48 +10,52 @@ export const InfoStandWidgetPetView: FC = props => if(!petData) return null; return (<> -
+
-
{ petData.name }
+
+ { petData.name }
+ { LocalizeText('pet.breed.' + petData.petType + '.' + petData.petBreed) }
-
+
-
- +
+
-
-
{ LocalizeText('pet.breed.' + petData.petType + '.' + petData.petBreed) }
-
{ LocalizeText('pet.level', ['level', 'maxlevel'], [petData.level.toString(), petData.maximumLevel.toString()]) }
+
+
{ LocalizeText('pet.level', ['level', 'maxlevel'], [petData.level.toString(), petData.maximumLevel.toString()]) }
+
+
{ LocalizeText('infostand.pet.text.happiness') }
+
+
{ petData.happyness + '/' + petData.maximumHappyness }
+
+
+
+
+
{ LocalizeText('infostand.pet.text.experience') }
+
+
{ petData.experience + '/' + petData.levelExperienceGoal }
+
+
+
+
+
{ LocalizeText('infostand.pet.text.energy') }
+
+
{ petData.energy + '/' + petData.maximumEnergy }
+
+
+
-
-
-
{ LocalizeText('infostand.pet.text.happiness') }
-
-
{ petData.happyness + '/' + petData.maximumHappyness }
-
-
+
+
{ LocalizeText('infostand.text.petrespect', ['count'], [petData.respect.toString()]) }
+
{ LocalizeText('pet.age', ['age'], [petData.age.toString()]) }
+
+
+ +
{ LocalizeText('infostand.text.petowner', ['name'], [petData.ownerName]) }
-
-
{ LocalizeText('infostand.pet.text.experience') }
-
-
{ petData.experience + '/' + petData.levelExperienceGoal }
-
-
-
-
-
{ LocalizeText('infostand.pet.text.energy') }
-
-
{ petData.energy + '/' + petData.maximumEnergy }
-
-
-
-
-
{ LocalizeText('infostand.text.petrespect', ['count'], [petData.respect.toString()]) }
-
{ LocalizeText('pet.age', ['age'], [petData.age.toString()]) }
-
{ LocalizeText('infostand.text.petowner', ['name'], [petData.ownerName]) }
);