Merge branch 'dev' into avatar-grayscale

This commit is contained in:
Bill 2021-08-31 20:22:35 -04:00
commit 106bad89e4
19 changed files with 231 additions and 38 deletions

View File

@ -0,0 +1,4 @@
import { AlphaFilter } from '@pixi/filter-alpha';
export class NitroAlphaFilter extends AlphaFilter
{}

View File

@ -1,5 +1,6 @@
export * from './INitroPoint';
export * from './NitroAdjustmentFilter';
export * from './NitroAlphaFilter';
export * from './NitroContainer';
export * from './NitroFilter';
export * from './NitroPoint';

View File

@ -352,7 +352,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
return !(isValid);
}
public getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[]): number
public getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[] = null): number
{
if(!this._structure) return 0;
@ -364,6 +364,9 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
for(const part of parts)
{
const set = figureData.getSetType(part);
if(!set) continue;
const setId = container.getPartSetId(part);
const partSet = set.getPartSet(setId);
@ -378,6 +381,8 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
{
const color = palette.getColor(colorId);
if(!color) continue;
clubLevel = Math.max(color.clubLevel, clubLevel);
}
}
@ -389,6 +394,8 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
{
const set = figureData.getSetType(part);
if(!set) continue;
if(parts.indexOf(part) === -1) clubLevel = Math.max(set.optionalFromClubLevel(gender), clubLevel);
}

View File

@ -15,7 +15,7 @@ export interface IAvatarRenderManager extends INitroManager
isFigureContainerReady(container: IAvatarFigureContainer): boolean;
createAvatarImage(figure: string, size: string, gender: string, listener?: IAvatarImageListener, effectListener?: IAvatarEffectListener): IAvatarImage;
downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void;
getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[]): number;
getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts?: string[]): number;
isValidFigureSetForGender(setId: number, gender: string): boolean;
getFigureStringWithFigureIds(k: string, _arg_2: string, _arg_3: number[]): string;
getMandatoryAvatarPartSetIds(k: string, _arg_2: number): string[];

View File

@ -15,7 +15,7 @@ export class PartColor implements IPartColor
this._id = data.id;
this._index = data.index;
this._clubLevel = data.club;
this._clubLevel = (data.club || 0);
this._isSelectable = data.selectable;
this._rgb = parseInt('0x' + data.hexCode, 16);
}

View File

@ -1,5 +1,5 @@
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration';
import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, AddJukeboxDiskComposer, ApproveNameMessageComposer, ApproveNameMessageEvent, AvailabilityTimeMessageEvent, BadgeReceivedEvent, BonusRareInfoMessageEvent, BuildersClubFurniCountMessageEvent, BuildersClubSubscriptionStatusMessageEvent, BundleDiscountRulesetMessageEvent, ChangeUserNameMessageComposer, ChangeUserNameResultMessageEvent, CheckUserNameMessageComposer, CheckUserNameResultMessageEvent, ClubGiftNotificationEvent, DirectSMSClubBuyAvailableMessageEvent, FigureUpdateEvent, FurnitureGuildInfoComposer, GetBonusRareInfoMessageComposer, GetCatalogPageExpirationComposer, GetCatalogPageWithEarliestExpiryComposer, GetDirectClubBuyAvailableComposer, GetHabboBasicMembershipExtendOfferComposer, GetHabboClubExtendOfferMessageComposer, GetInterstitialMessageComposer, GetJukeboxPlayListMessageComposer, GetLimitedOfferAppearingNextComposer, GetNextTargetedOfferComposer, GetNowPlayingMessageComposer, GetOfficialSongIdMessageComposer, GetRoomAdPurchaseInfoComposer, GetSeasonalCalendarDailyOfferComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetUserSongDisksMessageComposer, HabboClubExtendOfferMessageEvent, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelWillCloseInMinutesEvent, InfoFeedEnableMessageEvent, InterstitialMessageEvent, InterstitialShownMessageComposer, IsOfferGiftableMessageEvent, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, LimitedOfferAppearingNextMessageEvent, MaintenanceStatusMessageEvent, MarkCatalogNewAdditionsPageOpenedComposer, MarketplaceBuyOfferComposer, MarketplaceRedeemCreditsComposer, MarketplaceRequesstItemStatsComposer, MarketplaceRequestComposer, MarketplaceRequestOffersComposer, MarketplaceRequestOwnItemsComposer, MarketplaceTakeItemBackComposer, MysteryBoxKeysEvent, NotEnoughBalanceMessageEvent, NowPlayingMessageEvent, OfficialSongIdMessageEvent, OpenCampaignCalendarDoorAsStaffComposer, OpenCampaignCalendarDoorComposer, PetExperienceEvent, PetMountComposer, PetSupplementComposer, PlayListMessageEvent, PlayListSongAddedMessageEvent, PurchaseBasicMembershipExtensionComposer, PurchaseRoomAdMessageComposer, PurchaseTargetedOfferComposer, PurchaseVipMembershipExtensionComposer, RemoveAllRightsMessageComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RoomAdErrorEvent, RoomAdPurchaseInfoEvent, RoomUnitGiveHandItemPetComposer, SeasonalCalendarDailyOfferMessageEvent, SellablePetPalettesMessageEvent, SetTargetedOfferStateComposer, ShopTargetedOfferViewedComposer, TargetedOfferEvent, TargetedOfferNotFoundEvent, TogglePetBreedingComposer, TogglePetRidingComposer, TraxSongInfoMessageEvent, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer, UserSongDisksInventoryMessageEvent, WardrobeMessageEvent } from './messages';
import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, AddJukeboxDiskComposer, ApproveNameMessageComposer, ApproveNameMessageEvent, AvailabilityTimeMessageEvent, BadgeReceivedEvent, BonusRareInfoMessageEvent, BuildersClubFurniCountMessageEvent, BuildersClubSubscriptionStatusMessageEvent, BundleDiscountRulesetMessageEvent, ChangeUserNameMessageComposer, ChangeUserNameResultMessageEvent, CheckUserNameMessageComposer, CheckUserNameResultMessageEvent, ClubGiftNotificationEvent, DirectSMSClubBuyAvailableMessageEvent, FigureUpdateEvent, FurnitureGroupInfoComposer, GetBonusRareInfoMessageComposer, GetCatalogPageExpirationComposer, GetCatalogPageWithEarliestExpiryComposer, GetDirectClubBuyAvailableComposer, GetHabboBasicMembershipExtendOfferComposer, GetHabboClubExtendOfferMessageComposer, GetInterstitialMessageComposer, GetJukeboxPlayListMessageComposer, GetLimitedOfferAppearingNextComposer, GetNextTargetedOfferComposer, GetNowPlayingMessageComposer, GetOfficialSongIdMessageComposer, GetRoomAdPurchaseInfoComposer, GetSeasonalCalendarDailyOfferComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetUserSongDisksMessageComposer, HabboClubExtendOfferMessageEvent, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelWillCloseInMinutesEvent, InfoFeedEnableMessageEvent, InterstitialMessageEvent, InterstitialShownMessageComposer, IsOfferGiftableMessageEvent, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, LimitedOfferAppearingNextMessageEvent, MaintenanceStatusMessageEvent, MarkCatalogNewAdditionsPageOpenedComposer, MarketplaceBuyOfferComposer, MarketplaceRedeemCreditsComposer, MarketplaceRequesstItemStatsComposer, MarketplaceRequestComposer, MarketplaceRequestOffersComposer, MarketplaceRequestOwnItemsComposer, MarketplaceTakeItemBackComposer, MysteryBoxKeysEvent, NotEnoughBalanceMessageEvent, NowPlayingMessageEvent, OfficialSongIdMessageEvent, OpenCampaignCalendarDoorAsStaffComposer, OpenCampaignCalendarDoorComposer, PetExperienceEvent, PetMountComposer, PetSupplementComposer, PlayListMessageEvent, PlayListSongAddedMessageEvent, PurchaseBasicMembershipExtensionComposer, PurchaseRoomAdMessageComposer, PurchaseTargetedOfferComposer, PurchaseVipMembershipExtensionComposer, RemoveAllRightsMessageComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RoomAdErrorEvent, RoomAdPurchaseInfoEvent, RoomUnitGiveHandItemPetComposer, SeasonalCalendarDailyOfferMessageEvent, SellablePetPalettesMessageEvent, SetTargetedOfferStateComposer, ShopTargetedOfferViewedComposer, TargetedOfferEvent, TargetedOfferNotFoundEvent, TogglePetBreedingComposer, TogglePetRidingComposer, TraxSongInfoMessageEvent, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer, UserSongDisksInventoryMessageEvent, WardrobeMessageEvent } from './messages';
import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent';
import { CfhSanctionMessageEvent, CfhTopicsInitEvent, SanctionStatusEvent } from './messages/incoming/callforhelp';
import { CameraPublishStatusMessageEvent } from './messages/incoming/camera/CameraPublishStatusMessageEvent';
@ -158,6 +158,7 @@ import { FurnitureItemDataEvent } from './messages/incoming/room/furniture/Furni
import { FurnitureStackHeightEvent } from './messages/incoming/room/furniture/FurnitureStackHeightEvent';
import { FurnitureState2Event } from './messages/incoming/room/furniture/FurnitureState2Event';
import { FurnitureStateEvent } from './messages/incoming/room/furniture/FurnitureStateEvent';
import { GroupFurniContextMenuInfoMessageEvent } from './messages/incoming/room/furniture/GroupFurniContextMenuInfoMessageEvent';
import { LoveLockFurniFinishedEvent } from './messages/incoming/room/furniture/LoveLockFurniFinishedEvent';
import { LoveLockFurniFriendConfirmedEvent } from './messages/incoming/room/furniture/LoveLockFurniFriendConfirmedEvent';
import { LoveLockFurniStartEvent } from './messages/incoming/room/furniture/LoveLockFurniStartEvent';
@ -701,6 +702,7 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.LOVELOCK_FURNI_FRIEND_COMFIRMED, LoveLockFurniFriendConfirmedEvent);
this._events.set(IncomingHeader.LOVELOCK_FURNI_START, LoveLockFurniStartEvent);
this._events.set(IncomingHeader.OBJECTS_DATA_UPDATE, ObjectsDataUpdateEvent);
this._events.set(IncomingHeader.FURNITURE_GROUP_CONTEXT_MENU_INFO, GroupFurniContextMenuInfoMessageEvent);
// FLOOR
this._events.set(IncomingHeader.FURNITURE_FLOOR_ADD, FurnitureFloorAddEvent);
@ -1078,7 +1080,7 @@ export class NitroMessages implements IMessageConfiguration
// FURNITURE
this._composers.set(OutgoingHeader.FURNITURE_ALIASES, FurnitureAliasesComposer);
this._composers.set(OutgoingHeader.FURNITURE_GUILD_INFO, FurnitureGuildInfoComposer);
this._composers.set(OutgoingHeader.FURNITURE_GROUP_INFO, FurnitureGroupInfoComposer);
this._composers.set(OutgoingHeader.FURNITURE_PICKUP, FurniturePickupComposer);
this._composers.set(OutgoingHeader.FURNITURE_PLACE, FurniturePlaceComposer);
this._composers.set(OutgoingHeader.ITEM_PAINT, FurniturePlacePaintComposer);

View File

@ -30,6 +30,7 @@ export class IncomingHeader
public static FURNITURE_FLOOR_UPDATE = 3776;
public static FURNITURE_ITEMDATA = 2202;
public static FURNITURE_STATE = 2376;
public static FURNITURE_GROUP_CONTEXT_MENU_INFO= 3293;
public static GAME_CENTER_ACHIEVEMENTS = 2265;
public static GAME_CENTER_GAME_LIST = 222;
public static GAME_CENTER_STATUS = 2893;

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent';
import { GroupFurniContextMenuInfoMessageParser } from '../../../parser/room/furniture/GroupFurniContextMenuInfoMessageParser';
export class GroupFurniContextMenuInfoMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, GroupFurniContextMenuInfoMessageParser);
}
public getParser(): GroupFurniContextMenuInfoMessageParser
{
return this.parser as GroupFurniContextMenuInfoMessageParser;
}
}

View File

@ -5,6 +5,7 @@ export * from './FurnitureItemDataEvent';
export * from './FurnitureStackHeightEvent';
export * from './FurnitureState2Event';
export * from './FurnitureStateEvent';
export * from './GroupFurniContextMenuInfoMessageEvent';
export * from './LoveLockFurniFinishedEvent';
export * from './LoveLockFurniFriendConfirmedEvent';
export * from './LoveLockFurniStartEvent';

View File

@ -231,7 +231,7 @@ export class OutgoingHeader
public static UNIT_GIVE_HANDITEM_PET = 2768;
public static PET_MOUNT = 1036;
public static PET_SUPPLEMENT = 749;
public static FURNITURE_GUILD_INFO = 2651;
public static FURNITURE_GROUP_INFO = 2651;
public static ACHIEVEMENT_RESOLUTION_OPEN = 359;
public static USE_PET_PRODUCT = 1328;
public static REMOVE_PET_SADDLE = 186;

View File

@ -1,8 +1,8 @@
import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer';
export class FurnitureGuildInfoComposer implements IMessageComposer<ConstructorParameters<typeof FurnitureGuildInfoComposer>>
export class FurnitureGroupInfoComposer implements IMessageComposer<ConstructorParameters<typeof FurnitureGroupInfoComposer>>
{
private _data: ConstructorParameters<typeof FurnitureGuildInfoComposer>;
private _data: ConstructorParameters<typeof FurnitureGroupInfoComposer>;
constructor(objectId: number, guildId: number)
{

View File

@ -1,7 +1,7 @@
export * from './dimmer';
export * from './floor';
export * from './FurnitureAliasesComposer';
export * from './FurnitureGuildInfoComposer';
export * from './FurnitureGroupInfoComposer';
export * from './FurniturePickupComposer';
export * from './FurniturePlaceComposer';
export * from './FurniturePlacePaintComposer';

View File

@ -0,0 +1,67 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../core';
export class GroupFurniContextMenuInfoMessageParser implements IMessageParser
{
private _objectId: number;
private _guildId: number;
private _guildName: string;
private _guildHomeRoomId: number;
private _userIsMember: boolean;
private _guildHasReadableForum: boolean;
public flush(): boolean
{
this._objectId = 0;
this._guildId = 0;
this._guildName = null;
this._guildHomeRoomId = 0;
this._userIsMember = false;
this._guildHasReadableForum = false;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._objectId = wrapper.readInt();
this._guildId = wrapper.readInt();
this._guildName = wrapper.readString();
this._guildHomeRoomId = wrapper.readInt();
this._userIsMember = wrapper.readBoolean();
this._guildHasReadableForum = wrapper.readBoolean();
return true;
}
public get objectId(): number
{
return this._objectId;
}
public get guildId(): number
{
return this._guildId;
}
public get guildName(): string
{
return this._guildName;
}
public get guildHomeRoomId(): number
{
return this._guildHomeRoomId;
}
public get userIsMember(): boolean
{
return this._userIsMember;
}
public get guildHasReadableForum(): boolean
{
return this._guildHasReadableForum;
}
}

View File

@ -5,6 +5,7 @@ export * from './FurnitureItemDataParser';
export * from './FurnitureStackHeightParser';
export * from './FurnitureState2Parser';
export * from './FurnitureStateParser';
export * from './GroupFurniContextMenuInfoMessageParser';
export * from './LoveLockFurniFinishedParser';
export * from './LoveLockFurniFriendConfirmedParser';
export * from './LoveLockFurniStartParser';

View File

@ -5,22 +5,22 @@ export class HabboGroupEntryData
private _groupId: number;
private _groupName: string;
private _badgeCode: string;
private _Str_6751: string;
private _Str_6979: string;
private _colorA: string;
private _colorB: string;
private _favourite: boolean;
private _ownerId: number;
private _Str_19808: boolean;
private _hasForum: boolean;
constructor(wrapper: IMessageDataWrapper)
{
this._groupId = wrapper.readInt();
this._groupName = wrapper.readString();
this._badgeCode = wrapper.readString();
this._Str_6751 = wrapper.readString();
this._Str_6979 = wrapper.readString();
this._colorA = wrapper.readString();
this._colorB = wrapper.readString();
this._favourite = wrapper.readBoolean();
this._ownerId = wrapper.readInt();
this._Str_19808 = wrapper.readBoolean();
this._hasForum = wrapper.readBoolean();
}
public get groupId(): number
@ -38,14 +38,14 @@ export class HabboGroupEntryData
return this._badgeCode;
}
public get _Str_5845(): string
public get colorA(): string
{
return this._Str_6751;
return this._colorA;
}
public get _Str_6659(): string
public get colorB(): string
{
return this._Str_6979;
return this._colorB;
}
public get favourite(): boolean
@ -58,8 +58,8 @@ export class HabboGroupEntryData
return this._ownerId;
}
public get _Str_21674(): boolean
public get hasForum(): boolean
{
return this._Str_19808;
return this._hasForum;
}
}

View File

@ -11,7 +11,7 @@ import { IRoomGeometry } from '../../room/utils/IRoomGeometry';
import { IVector3D } from '../../room/utils/IVector3D';
import { RoomEnterEffect } from '../../room/utils/RoomEnterEffect';
import { Vector3d } from '../../room/utils/Vector3d';
import { FurnitureGuildInfoComposer, SetObjectDataMessageComposer } from '../communication';
import { FurnitureGroupInfoComposer, SetObjectDataMessageComposer } from '../communication';
import { BotPlaceComposer } from '../communication/messages/outgoing/room/engine/BotPlaceComposer';
import { GetItemDataComposer } from '../communication/messages/outgoing/room/engine/GetItemDataComposer';
import { PetMoveComposer } from '../communication/messages/outgoing/room/engine/PetMoveComposer';
@ -814,7 +814,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
eventDispatcher.dispatchEvent(new RoomEngineUseProductEvent(RoomEngineUseProductEvent.USE_PRODUCT_FROM_ROOM, roomId, objectId, objectCategory));
return;
case RoomObjectWidgetRequestEvent.GUILD_FURNI_CONTEXT_MENU:
this._roomEngine.connection.send(new FurnitureGuildInfoComposer(event.objectId, event.object.model.getValue<number>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_GUILD_ID)));
this._roomEngine.connection.send(new FurnitureGroupInfoComposer(event.objectId, event.object.model.getValue<number>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_GUILD_ID)));
return;
case RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG:
eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG, roomId, objectId, objectCategory));

View File

@ -50,7 +50,7 @@ export class RoomObjectVariable
public static FURNITURE_COLOR: string = 'furniture_color';
public static FURNITURE_LIFT_AMOUNT: string = 'furniure_lift_amount';
public static FURNITURE_GUILD_CUSTOMIZED_GUILD_ID: string = 'furniture_guild_customized_guild_id';
public static FURNITURE_GUILD_CUSTOMIZED_BADGE: string = 'furniture_guild_customized_badge';
public static FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME: string = 'furniture_guild_customized_asset_name';
public static FURNITURE_GUILD_CUSTOMIZED_COLOR_1: string = 'furniture_guild_customized_color_1';
public static FURNITURE_GUILD_CUSTOMIZED_COLOR_2: string = 'furniture_guild_customized_color_2';
public static FURNITURE_STATE_UPDATE_TIME: string = 'furniture_state_update_time';

View File

@ -1,4 +1,9 @@
import { IRoomGeometry, RoomSpriteMouseEvent } from '../../../../../room';
import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage';
import { Nitro } from '../../../../Nitro';
import { MouseEventType } from '../../../../ui';
import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent } from '../../../events';
import { ObjectGroupBadgeUpdateMessage, ObjectSelectedMessage } from '../../../messages';
import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage';
import { StringDataType } from '../../data/type/StringDataType';
import { RoomObjectVariable } from '../../RoomObjectVariable';
@ -11,6 +16,17 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
public static COLOR1_KEY: number = 3;
public static COLOR2_KEY: number = 4;
public getEventTypes(): string[]
{
const types = [
RoomObjectBadgeAssetEvent.LOAD_BADGE,
RoomObjectWidgetRequestEvent.GUILD_FURNI_CONTEXT_MENU,
RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU
];
return this.mergeTypes(super.getEventTypes(), types);
}
public processUpdateMessage(message: RoomObjectUpdateMessage): void
{
super.processUpdateMessage(message);
@ -26,6 +42,24 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
this.updateColors(data.getValue(FurnitureGuildCustomizedLogic.COLOR1_KEY), data.getValue(FurnitureGuildCustomizedLogic.COLOR2_KEY));
}
}
else if(message instanceof ObjectGroupBadgeUpdateMessage)
{
if(message.assetName !== 'loading_icon')
{
this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME, message.assetName);
this.update(Nitro.instance.time);
}
}
else if(message instanceof ObjectSelectedMessage)
{
if(!message.selected)
{
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object));
}
}
}
protected updateGroupId(id: string): void
@ -35,7 +69,7 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
private updateBadge(badge: string): void
{
this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_BADGE, badge);
this.eventDispatcher.dispatchEvent(new RoomObjectBadgeAssetEvent(RoomObjectBadgeAssetEvent.LOAD_BADGE, this.object, badge, true));
}
public updateColors(color1: string, color2: string): void
@ -43,4 +77,22 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_1, parseInt(color1, 16));
this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_2, parseInt(color2, 16));
}
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.MOUSE_CLICK:
this.openContextMenu();
}
super.mouseEvent(event, geometry);
}
private openContextMenu(): void
{
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.GUILD_FURNI_CONTEXT_MENU, this.object));
}
}

View File

@ -1,13 +1,19 @@
import { IGraphicAsset, IRoomObjectSprite } from '../../../../../room';
import { RoomObjectVariable } from '../../RoomObjectVariable';
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
export class FurnitureGuildCustomizedVisualization extends FurnitureAnimatedVisualization
{
public static PRIMARY_COLOUR_SPRITE_TAG: string = 'COLOR1';
public static SECONDARY_COLOUR_SPRITE_TAG: string = 'COLOR2';
public static BADGE: string = 'BADGE';
public static DEFAULT_COLOR_1: number = 0xEEEEEE;
public static DEFAULT_COLOR_2: number = 0x4B4B4B;
private _color1: number;
private _color2: number;
private _badgeAssetNameNormalScale: string;
private _badgeAssetNameSmallScale: string;
constructor()
{
@ -15,13 +21,24 @@ export class FurnitureGuildCustomizedVisualization extends FurnitureAnimatedVisu
this._color1 = FurnitureGuildCustomizedVisualization.DEFAULT_COLOR_1;
this._color2 = FurnitureGuildCustomizedVisualization.DEFAULT_COLOR_2;
this._badgeAssetNameNormalScale = '';
this._badgeAssetNameSmallScale = '';
}
protected updateModel(scale: number): boolean
{
const flag = super.updateModel(scale);
if(!flag) return false;
if(this._badgeAssetNameNormalScale === '')
{
const assetName = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME);
if(assetName)
{
this._badgeAssetNameNormalScale = assetName;
this._badgeAssetNameSmallScale = (this._badgeAssetNameNormalScale + '_32');
}
}
this._color1 = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_1);
this._color2 = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_2);
@ -35,10 +52,34 @@ export class FurnitureGuildCustomizedVisualization extends FurnitureAnimatedVisu
switch(tag)
{
case 'COLOR1': return this._color1;
case 'COLOR2': return this._color2;
case FurnitureGuildCustomizedVisualization.PRIMARY_COLOUR_SPRITE_TAG: return this._color1;
case FurnitureGuildCustomizedVisualization.SECONDARY_COLOUR_SPRITE_TAG: return this._color2;
}
return super.getLayerColor(scale, layerId, colorId);
}
public getSpriteAssetName(scale: number, layerId: number): string
{
const tag = this.getLayerTag(scale, this._direction, layerId);
if(tag === FurnitureGuildCustomizedVisualization.BADGE)
{
if(scale === 32) return this._badgeAssetNameSmallScale;
return this._badgeAssetNameNormalScale;
}
return super.getSpriteAssetName(scale, layerId);
}
protected getLibraryAssetNameForSprite(asset: IGraphicAsset, sprite: IRoomObjectSprite): string
{
if(sprite.tag === FurnitureGuildCustomizedVisualization.BADGE)
{
return '%group.badge.url%' + sprite.libraryAssetName.replace('badge_', '');
}
return super.getLibraryAssetNameForSprite(asset, sprite);
}
}