Update for BadgePointLimit

This commit is contained in:
Bill 2021-09-06 02:58:09 -04:00
parent 3cd6d56b3e
commit a1e99bf000
3 changed files with 18 additions and 2 deletions

View File

@ -0,0 +1,7 @@
import { INitroLocalizationManager } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from './GetNitroInstance';
export function GetLocalization(): INitroLocalizationManager
{
return GetNitroInstance().localization;
}

View File

@ -5,6 +5,7 @@ export * from './CreateLinkEvent';
export * from './GetCommunication';
export * from './GetConfiguration';
export * from './GetConnection';
export * from './GetLocalization';
export * from './GetNitroInstance';
export * from './GetTicker';
export * from './RemoveLinkEventTracker';

View File

@ -1,6 +1,6 @@
import { AdvancedMap, BadgeReceivedEvent, BadgesEvent, BotAddedToInventoryEvent, BotInventoryMessageEvent, BotRemovedFromInventoryEvent, FurnitureListAddOrUpdateEvent, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListItemParser, FurnitureListRemovedEvent, FurniturePostItPlacedEvent, PetAddedToInventoryEvent, PetData, PetInventoryEvent, PetRemovedFromInventory, RequestBadgesComposer, TradingAcceptEvent, TradingCloseEvent, TradingCompletedEvent, TradingConfirmationEvent, TradingListItemEvent, TradingNotOpenEvent, TradingOpenEvent, TradingOpenFailedEvent, TradingOtherNotAllowedEvent, TradingYouAreNotAllowedEvent, UnseenItemsEvent } from '@nitrots/nitro-renderer';
import { AdvancedMap, BadgePointLimitsEvent, BadgeReceivedEvent, BadgesEvent, BotAddedToInventoryEvent, BotInventoryMessageEvent, BotRemovedFromInventoryEvent, FurnitureListAddOrUpdateEvent, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListItemParser, FurnitureListRemovedEvent, FurniturePostItPlacedEvent, PetAddedToInventoryEvent, PetData, PetInventoryEvent, PetRemovedFromInventory, RequestBadgesComposer, TradingAcceptEvent, TradingCloseEvent, TradingCompletedEvent, TradingConfirmationEvent, TradingListItemEvent, TradingNotOpenEvent, TradingOpenEvent, TradingOpenFailedEvent, TradingOtherNotAllowedEvent, TradingYouAreNotAllowedEvent, UnseenItemsEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback } from 'react';
import { GetRoomSession, GetSessionDataManager } from '../../api';
import { GetLocalization, GetRoomSession, GetSessionDataManager } from '../../api';
import { InventoryBadgesUpdatedEvent } from '../../events';
import { InventoryBadgesRequestEvent } from '../../events/inventory/InventoryBadgesRequestEvent';
import { dispatchUiEvent, useUiEvent } from '../../hooks';
@ -321,6 +321,13 @@ export const InventoryMessageHandler: FC<InventoryMessageHandlerProps> = props =
}
}, [ unseenTracker ]);
const onBadgePointLimitsEvent = useCallback((event: BadgePointLimitsEvent) =>
{
const parser = event.getParser();
for(const data of parser.data) GetLocalization().setBadgePointLimit(data.badgeId, data.limit);
}, []);
CreateMessageHook(FurnitureListAddOrUpdateEvent, onFurnitureListAddOrUpdateEvent);
CreateMessageHook(FurnitureListEvent, onFurnitureListEvent);
CreateMessageHook(FurnitureListInvalidateEvent, onFurnitureListInvalidateEvent);
@ -345,6 +352,7 @@ export const InventoryMessageHandler: FC<InventoryMessageHandlerProps> = props =
CreateMessageHook(TradingOtherNotAllowedEvent, onTradingOtherNotAllowedEvent);
CreateMessageHook(TradingYouAreNotAllowedEvent, onTradingYouAreNotAllowedEvent);
CreateMessageHook(UnseenItemsEvent, onUnseenItemsEvent);
CreateMessageHook(BadgePointLimitsEvent, onBadgePointLimitsEvent);
const onInventoryBadgesRequestEvent = useCallback((event: InventoryBadgesRequestEvent) =>
{