You've already forked Epicnabbo-Catalogus-Updated-Daily
Add coolui test
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
import { GetAssetManager, GetAvatarRenderManager, GetCommunication, GetConfiguration, GetLocalizationManager, GetRoomEngine, GetRoomSessionManager, GetSessionDataManager, GetSoundManager, GetStage, GetTexturePool, GetTicker, HabboWebTools, LegacyExternalInterface, LoadGameUrlEvent, NitroLogger, NitroVersion, PrepareRenderer } from '@nitrots/nitro-renderer';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { GetUIVersion } from './api';
|
||||
import { Base } from './common';
|
||||
import { LoadingView } from './components/loading/LoadingView';
|
||||
import { MainView } from './components/MainView';
|
||||
import { useMessageEvent } from './hooks';
|
||||
|
||||
NitroVersion.UI_VERSION = GetUIVersion();
|
||||
|
||||
export const App: FC<{}> = props =>
|
||||
{
|
||||
const [ isReady, setIsReady ] = useState(false);
|
||||
|
||||
useMessageEvent<LoadGameUrlEvent>(LoadGameUrlEvent, event =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
if(!parser) return;
|
||||
|
||||
LegacyExternalInterface.callGame('showGame', parser.url);
|
||||
});
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
const prepare = async (width: number, height: number) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if(!window.NitroConfig) throw new Error('NitroConfig is not defined!');
|
||||
|
||||
const renderer = await PrepareRenderer({
|
||||
width: Math.floor(width),
|
||||
height: Math.floor(height),
|
||||
resolution: window.devicePixelRatio,
|
||||
autoDensity: true,
|
||||
backgroundAlpha: 0,
|
||||
preference: 'webgl',
|
||||
eventMode: 'none',
|
||||
failIfMajorPerformanceCaveat: false,
|
||||
roundPixels: true,
|
||||
useBackBuffer: true // Enable back buffer for blend filters
|
||||
});
|
||||
|
||||
await GetConfiguration().init();
|
||||
|
||||
GetTicker().maxFPS = GetConfiguration().getValue<number>('system.fps.max', 24);
|
||||
NitroLogger.LOG_DEBUG = GetConfiguration().getValue<boolean>('system.log.debug', true);
|
||||
NitroLogger.LOG_WARN = GetConfiguration().getValue<boolean>('system.log.warn', false);
|
||||
NitroLogger.LOG_ERROR = GetConfiguration().getValue<boolean>('system.log.error', false);
|
||||
NitroLogger.LOG_EVENTS = GetConfiguration().getValue<boolean>('system.log.events', false);
|
||||
NitroLogger.LOG_PACKETS = GetConfiguration().getValue<boolean>('system.log.packets', false);
|
||||
|
||||
const assetUrls = GetConfiguration().getValue<string[]>('preload.assets.urls').map(url => GetConfiguration().interpolate(url)) ?? [];
|
||||
|
||||
await Promise.all(
|
||||
[
|
||||
GetAssetManager().downloadAssets(assetUrls),
|
||||
GetLocalizationManager().init(),
|
||||
GetAvatarRenderManager().init(),
|
||||
GetSoundManager().init(),
|
||||
GetSessionDataManager().init(),
|
||||
GetRoomSessionManager().init()
|
||||
]
|
||||
);
|
||||
|
||||
await GetRoomEngine().init();
|
||||
await GetCommunication().init();
|
||||
|
||||
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []);
|
||||
|
||||
HabboWebTools.sendHeartBeat();
|
||||
|
||||
setInterval(() => HabboWebTools.sendHeartBeat(), 10000);
|
||||
|
||||
GetTicker().add(ticker => GetRoomEngine().update(ticker));
|
||||
GetTicker().add(ticker => renderer.render(GetStage()));
|
||||
GetTicker().add(ticker => GetTexturePool().run());
|
||||
|
||||
setIsReady(true);
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
NitroLogger.error(err);
|
||||
}
|
||||
};
|
||||
|
||||
prepare(window.innerWidth, window.innerHeight);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Base fit overflow="hidden" className={ !(window.devicePixelRatio % 1) && 'image-rendering-pixelated' }>
|
||||
{ !isReady &&
|
||||
<LoadingView /> }
|
||||
{ isReady && <MainView /> }
|
||||
<Base id="draggable-windows-container" />
|
||||
</Base>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
import { NitroVersion } from '@nitrots/nitro-renderer';
|
||||
|
||||
export const GetRendererVersion = () => NitroVersion.RENDERER_VERSION;
|
||||
@@ -0,0 +1 @@
|
||||
export const GetUIVersion = () => '2.2.0';
|
||||
@@ -0,0 +1,40 @@
|
||||
import { AchievementData } from '@nitrots/nitro-renderer';
|
||||
import { AchievementUtilities } from './AchievementUtilities';
|
||||
import { IAchievementCategory } from './IAchievementCategory';
|
||||
|
||||
export class AchievementCategory implements IAchievementCategory
|
||||
{
|
||||
private _code: string;
|
||||
private _achievements: AchievementData[];
|
||||
|
||||
constructor(code: string)
|
||||
{
|
||||
this._code = code;
|
||||
this._achievements = [];
|
||||
}
|
||||
|
||||
public getProgress(): number
|
||||
{
|
||||
return AchievementUtilities.getAchievementCategoryProgress(this);
|
||||
}
|
||||
|
||||
public getMaxProgress(): number
|
||||
{
|
||||
return AchievementUtilities.getAchievementCategoryMaxProgress(this);
|
||||
}
|
||||
|
||||
public get code(): string
|
||||
{
|
||||
return this._code;
|
||||
}
|
||||
|
||||
public get achievements(): AchievementData[]
|
||||
{
|
||||
return this._achievements;
|
||||
}
|
||||
|
||||
public set achievements(achievements: AchievementData[])
|
||||
{
|
||||
this._achievements = achievements;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
import { AchievementData, GetLocalizationManager } from '@nitrots/nitro-renderer';
|
||||
import { GetConfigurationValue } from '../nitro';
|
||||
import { IAchievementCategory } from './IAchievementCategory';
|
||||
|
||||
export class AchievementUtilities
|
||||
{
|
||||
public static getAchievementBadgeCode(achievement: AchievementData): string
|
||||
{
|
||||
if(!achievement) return null;
|
||||
|
||||
let badgeId = achievement.badgeId;
|
||||
|
||||
if(!achievement.finalLevel) badgeId = GetLocalizationManager().getPreviousLevelBadgeId(badgeId);
|
||||
|
||||
return badgeId;
|
||||
}
|
||||
|
||||
public static getAchievementCategoryImageUrl(category: IAchievementCategory, progress: number = null, icon: boolean = false): string
|
||||
{
|
||||
const imageUrl = GetConfigurationValue<string>('achievements.images.url');
|
||||
|
||||
let imageName = icon ? 'achicon_' : 'achcategory_';
|
||||
|
||||
imageName += category.code;
|
||||
|
||||
if(progress !== null) imageName += `_${ ((progress > 0) ? 'active' : 'inactive') }`;
|
||||
|
||||
return imageUrl.replace('%image%', imageName);
|
||||
}
|
||||
|
||||
public static getAchievementCategoryMaxProgress(category: IAchievementCategory): number
|
||||
{
|
||||
if(!category) return 0;
|
||||
|
||||
let progress = 0;
|
||||
|
||||
for(const achievement of category.achievements)
|
||||
{
|
||||
progress += achievement.levelCount;
|
||||
}
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
public static getAchievementCategoryProgress(category: IAchievementCategory): number
|
||||
{
|
||||
if(!category) return 0;
|
||||
|
||||
let progress = 0;
|
||||
|
||||
for(const achievement of category.achievements) progress += (achievement.finalLevel ? achievement.level : (achievement.level - 1));
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
public static getAchievementCategoryTotalUnseen(category: IAchievementCategory): number
|
||||
{
|
||||
if(!category) return 0;
|
||||
|
||||
let unseen = 0;
|
||||
|
||||
for(const achievement of category.achievements) ((achievement.unseen > 0) && unseen++);
|
||||
|
||||
return unseen;
|
||||
}
|
||||
|
||||
public static getAchievementHasStarted(achievement: AchievementData): boolean
|
||||
{
|
||||
if(!achievement) return false;
|
||||
|
||||
if(achievement.finalLevel || ((achievement.level - 1) > 0)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static getAchievementIsIgnored(achievement: AchievementData): boolean
|
||||
{
|
||||
if(!achievement) return false;
|
||||
|
||||
const ignored = GetConfigurationValue<string[]>('achievements.unseen.ignored');
|
||||
const value = achievement.badgeId.replace(/[0-9]/g, '');
|
||||
const index = ignored.indexOf(value);
|
||||
|
||||
if(index >= 0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static getAchievementLevel(achievement: AchievementData): number
|
||||
{
|
||||
if(!achievement) return 0;
|
||||
|
||||
if(achievement.finalLevel) return achievement.level;
|
||||
|
||||
return (achievement.level - 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { AchievementData } from '@nitrots/nitro-renderer';
|
||||
|
||||
export interface IAchievementCategory
|
||||
{
|
||||
code: string;
|
||||
achievements: AchievementData[];
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './AchievementCategory';
|
||||
export * from './AchievementUtilities';
|
||||
export * from './IAchievementCategory';
|
||||
@@ -0,0 +1,7 @@
|
||||
export class AvatarEditorAction
|
||||
{
|
||||
public static ACTION_SAVE: string = 'AEA_ACTION_SAVE';
|
||||
public static ACTION_CLEAR: string = 'AEA_ACTION_CLEAR';
|
||||
public static ACTION_RESET: string = 'AEA_ACTION_RESET';
|
||||
public static ACTION_RANDOMIZE: string = 'AEA_ACTION_RANDOMIZE';
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { IPartColor } from '@nitrots/nitro-renderer';
|
||||
|
||||
export const AvatarEditorColorSorter = (a: IPartColor, b: IPartColor) =>
|
||||
{
|
||||
const clubLevelA = (!a ? -1 : a.clubLevel);
|
||||
const clubLevelB = (!b ? -1 : b.clubLevel);
|
||||
|
||||
if(clubLevelA < clubLevelB) return -1;
|
||||
|
||||
if(clubLevelA > clubLevelB) return 1;
|
||||
|
||||
if(a.index < b.index) return -1;
|
||||
|
||||
if(a.index > b.index) return 1;
|
||||
|
||||
return 0;
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
import { IFigurePartSet } from '@nitrots/nitro-renderer';
|
||||
|
||||
export const AvatarEditorPartSorter = (hcFirst: boolean) =>
|
||||
{
|
||||
return (a: { partSet: IFigurePartSet, usesColor: boolean, isClear?: boolean }, b: { partSet: IFigurePartSet, usesColor: boolean, isClear?: boolean }) =>
|
||||
{
|
||||
const clubLevelA = (!a.partSet ? -1 : a.partSet.clubLevel);
|
||||
const clubLevelB = (!b.partSet ? -1 : b.partSet.clubLevel);
|
||||
const isSellableA = (!a.partSet ? false : a.partSet.isSellable);
|
||||
const isSellableB = (!b.partSet ? false : b.partSet.isSellable);
|
||||
|
||||
if(isSellableA && !isSellableB) return 1;
|
||||
|
||||
if(isSellableB && !isSellableA) return -1;
|
||||
|
||||
if(hcFirst)
|
||||
{
|
||||
if(clubLevelA > clubLevelB) return -1;
|
||||
|
||||
if(clubLevelA < clubLevelB) return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(clubLevelA < clubLevelB) return -1;
|
||||
|
||||
if(clubLevelA > clubLevelB) return 1;
|
||||
}
|
||||
|
||||
if(a.partSet.id < b.partSet.id) return -1;
|
||||
|
||||
if(a.partSet.id > b.partSet.id) return 1;
|
||||
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,196 @@
|
||||
import { AvatarFigurePartType, AvatarScaleType, AvatarSetType, GetAssetManager, GetAvatarRenderManager, IFigurePart, IGraphicAsset, IPartColor, NitroAlphaFilter, NitroContainer, NitroRectangle, NitroSprite, TextureUtils } from '@nitrots/nitro-renderer';
|
||||
import { IAvatarEditorCategoryPartItem } from './IAvatarEditorCategoryPartItem';
|
||||
|
||||
export class AvatarEditorThumbnailsHelper
|
||||
{
|
||||
private static THUMBNAIL_CACHE: Map<string, string> = new Map();
|
||||
private static THUMB_DIRECTIONS: number[] = [ 2, 6, 0, 4, 3, 1 ];
|
||||
private static ALPHA_FILTER: NitroAlphaFilter = new NitroAlphaFilter({ alpha: 0.2 });
|
||||
private static DRAW_ORDER: string[] = [
|
||||
AvatarFigurePartType.LEFT_HAND_ITEM,
|
||||
AvatarFigurePartType.LEFT_HAND,
|
||||
AvatarFigurePartType.LEFT_SLEEVE,
|
||||
AvatarFigurePartType.LEFT_COAT_SLEEVE,
|
||||
AvatarFigurePartType.BODY,
|
||||
AvatarFigurePartType.SHOES,
|
||||
AvatarFigurePartType.LEGS,
|
||||
AvatarFigurePartType.CHEST,
|
||||
AvatarFigurePartType.CHEST_ACCESSORY,
|
||||
AvatarFigurePartType.COAT_CHEST,
|
||||
AvatarFigurePartType.CHEST_PRINT,
|
||||
AvatarFigurePartType.WAIST_ACCESSORY,
|
||||
AvatarFigurePartType.RIGHT_HAND,
|
||||
AvatarFigurePartType.RIGHT_SLEEVE,
|
||||
AvatarFigurePartType.RIGHT_COAT_SLEEVE,
|
||||
AvatarFigurePartType.HEAD,
|
||||
AvatarFigurePartType.FACE,
|
||||
AvatarFigurePartType.EYES,
|
||||
AvatarFigurePartType.HAIR,
|
||||
AvatarFigurePartType.HAIR_BIG,
|
||||
AvatarFigurePartType.FACE_ACCESSORY,
|
||||
AvatarFigurePartType.EYE_ACCESSORY,
|
||||
AvatarFigurePartType.HEAD_ACCESSORY,
|
||||
AvatarFigurePartType.HEAD_ACCESSORY_EXTRA,
|
||||
AvatarFigurePartType.RIGHT_HAND_ITEM,
|
||||
];
|
||||
|
||||
private static getThumbnailKey(setType: string, part: IAvatarEditorCategoryPartItem): string
|
||||
{
|
||||
return `${ setType }-${ part.partSet.id }`;
|
||||
}
|
||||
|
||||
public static clearCache(): void
|
||||
{
|
||||
this.THUMBNAIL_CACHE.clear();
|
||||
}
|
||||
|
||||
public static async build(setType: string, part: IAvatarEditorCategoryPartItem, useColors: boolean, partColors: IPartColor[], isDisabled: boolean = false): Promise<string>
|
||||
{
|
||||
if(!setType || !setType.length || !part || !part.partSet || !part.partSet.parts || !part.partSet.parts.length) return null;
|
||||
|
||||
const thumbnailKey = this.getThumbnailKey(setType, part);
|
||||
const cached = this.THUMBNAIL_CACHE.get(thumbnailKey);
|
||||
|
||||
if(cached) return cached;
|
||||
|
||||
const buildContainer = (part: IAvatarEditorCategoryPartItem, useColors: boolean, partColors: IPartColor[], isDisabled: boolean = false) =>
|
||||
{
|
||||
const container = new NitroContainer();
|
||||
const parts = part.partSet.parts.concat().sort(this.sortByDrawOrder);
|
||||
|
||||
for(const part of parts)
|
||||
{
|
||||
if(!part) continue;
|
||||
|
||||
let asset: IGraphicAsset = null;
|
||||
let direction = 0;
|
||||
let hasAsset = false;
|
||||
|
||||
while(!hasAsset && (direction < AvatarEditorThumbnailsHelper.THUMB_DIRECTIONS.length))
|
||||
{
|
||||
const assetName = `${ AvatarFigurePartType.SCALE }_${ AvatarFigurePartType.STD }_${ part.type }_${ part.id }_${ AvatarEditorThumbnailsHelper.THUMB_DIRECTIONS[direction] }_${ AvatarFigurePartType.DEFAULT_FRAME }`;
|
||||
|
||||
asset = GetAssetManager().getAsset(assetName);
|
||||
|
||||
if(asset && asset.texture)
|
||||
{
|
||||
hasAsset = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
direction++;
|
||||
}
|
||||
}
|
||||
|
||||
if(!hasAsset)
|
||||
{
|
||||
console.log(`${ AvatarFigurePartType.SCALE }_${ AvatarFigurePartType.STD }_${ part.type }_${ part.id }`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const x = asset.offsetX;
|
||||
const y = asset.offsetY;
|
||||
|
||||
const sprite = new NitroSprite(asset.texture);
|
||||
|
||||
sprite.position.set(x, y);
|
||||
|
||||
if(useColors && (part.colorLayerIndex > 0) && partColors && partColors.length)
|
||||
{
|
||||
const color = partColors[(part.colorLayerIndex - 1)];
|
||||
|
||||
if(color) sprite.tint = color.rgb;
|
||||
}
|
||||
|
||||
if(isDisabled) container.filters = [ AvatarEditorThumbnailsHelper.ALPHA_FILTER ];
|
||||
|
||||
container.addChild(sprite);
|
||||
}
|
||||
|
||||
return container;
|
||||
};
|
||||
|
||||
return new Promise(async (resolve, reject) =>
|
||||
{
|
||||
const resetFigure = async (figure: string) =>
|
||||
{
|
||||
const container = buildContainer(part, useColors, partColors, isDisabled);
|
||||
const imageUrl = await TextureUtils.generateImageUrl(container);
|
||||
|
||||
AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl);
|
||||
|
||||
resolve(imageUrl);
|
||||
};
|
||||
|
||||
const figureContainer = GetAvatarRenderManager().createFigureContainer(`${ setType }-${ part.partSet.id }`);
|
||||
|
||||
if(!GetAvatarRenderManager().isFigureContainerReady(figureContainer))
|
||||
{
|
||||
GetAvatarRenderManager().downloadAvatarFigure(figureContainer, {
|
||||
resetFigure,
|
||||
dispose: null,
|
||||
disposed: false
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
resetFigure(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static async buildForFace(figureString: string, isDisabled: boolean = false): Promise<string>
|
||||
{
|
||||
if(!figureString || !figureString.length) return null;
|
||||
|
||||
const thumbnailKey = figureString;
|
||||
const cached = this.THUMBNAIL_CACHE.get(thumbnailKey);
|
||||
|
||||
if(cached) return cached;
|
||||
|
||||
return new Promise(async (resolve, reject) =>
|
||||
{
|
||||
const resetFigure = async (figure: string) =>
|
||||
{
|
||||
const avatarImage = GetAvatarRenderManager().createAvatarImage(figure, AvatarScaleType.LARGE, null, { resetFigure, dispose: null, disposed: false });
|
||||
|
||||
if(avatarImage.isPlaceholder()) return;
|
||||
|
||||
const texture = avatarImage.processAsTexture(AvatarSetType.HEAD, false);
|
||||
const sprite = new NitroSprite(texture);
|
||||
|
||||
if(isDisabled) sprite.filters = [ AvatarEditorThumbnailsHelper.ALPHA_FILTER ];
|
||||
|
||||
const imageUrl = await TextureUtils.generateImageUrl({
|
||||
target: sprite,
|
||||
frame: new NitroRectangle(0, 0, texture.width, texture.height)
|
||||
});
|
||||
|
||||
sprite.destroy();
|
||||
avatarImage.dispose();
|
||||
|
||||
AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl);
|
||||
|
||||
resolve(imageUrl);
|
||||
};
|
||||
|
||||
resetFigure(figureString);
|
||||
});
|
||||
}
|
||||
|
||||
private static sortByDrawOrder(a: IFigurePart, b: IFigurePart): number
|
||||
{
|
||||
const indexA = AvatarEditorThumbnailsHelper.DRAW_ORDER.indexOf(a.type);
|
||||
const indexB = AvatarEditorThumbnailsHelper.DRAW_ORDER.indexOf(b.type);
|
||||
|
||||
if(indexA < indexB) return -1;
|
||||
|
||||
if(indexA > indexB) return 1;
|
||||
|
||||
if(a.index < b.index) return -1;
|
||||
|
||||
if(a.index > b.index) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { IPartColor } from '@nitrots/nitro-renderer';
|
||||
import { IAvatarEditorCategoryPartItem } from './IAvatarEditorCategoryPartItem';
|
||||
|
||||
export interface IAvatarEditorCategory
|
||||
{
|
||||
setType: string;
|
||||
partItems: IAvatarEditorCategoryPartItem[];
|
||||
colorItems: IPartColor[][];
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { IFigurePartSet } from '@nitrots/nitro-renderer';
|
||||
|
||||
export interface IAvatarEditorCategoryPartItem
|
||||
{
|
||||
id?: number;
|
||||
partSet?: IFigurePartSet;
|
||||
usesColor?: boolean;
|
||||
maxPaletteCount?: number;
|
||||
isClear?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from './AvatarEditorAction';
|
||||
export * from './AvatarEditorColorSorter';
|
||||
export * from './AvatarEditorPartSorter';
|
||||
export * from './AvatarEditorThumbnailsHelper';
|
||||
export * from './IAvatarEditorCategory';
|
||||
export * from './IAvatarEditorCategoryPartItem';
|
||||
@@ -0,0 +1,5 @@
|
||||
export class CameraEditorTabs
|
||||
{
|
||||
public static readonly COLORMATRIX: string = 'colormatrix';
|
||||
public static readonly COMPOSITE: string = 'composite';
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { NitroTexture } from '@nitrots/nitro-renderer';
|
||||
|
||||
export class CameraPicture
|
||||
{
|
||||
constructor(
|
||||
public texture: NitroTexture,
|
||||
public imageUrl: string)
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export class CameraPictureThumbnail
|
||||
{
|
||||
constructor(
|
||||
public effectName: string,
|
||||
public thumbnailUrl: string)
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './CameraEditorTabs';
|
||||
export * from './CameraPicture';
|
||||
export * from './CameraPictureThumbnail';
|
||||
@@ -0,0 +1,30 @@
|
||||
import { ICalendarItem } from './ICalendarItem';
|
||||
|
||||
export class CalendarItem implements ICalendarItem
|
||||
{
|
||||
private _productName: string;
|
||||
private _customImage: string;
|
||||
private _furnitureClassName: string;
|
||||
|
||||
constructor(productName: string, customImage: string, furnitureClassName: string)
|
||||
{
|
||||
this._productName = productName;
|
||||
this._customImage = customImage;
|
||||
this._furnitureClassName = furnitureClassName;
|
||||
}
|
||||
|
||||
public get productName(): string
|
||||
{
|
||||
return this._productName;
|
||||
}
|
||||
|
||||
public get customImage(): string
|
||||
{
|
||||
return this._customImage;
|
||||
}
|
||||
|
||||
public get furnitureClassName(): string
|
||||
{
|
||||
return this._furnitureClassName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export class CalendarItemState
|
||||
{
|
||||
public static readonly STATE_UNLOCKED = 1;
|
||||
public static readonly STATE_LOCKED_AVAILABLE = 2;
|
||||
public static readonly STATE_LOCKED_EXPIRED = 3;
|
||||
public static readonly STATE_LOCKED_FUTURE = 4;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export interface ICalendarItem
|
||||
{
|
||||
readonly productName: string;
|
||||
readonly customImage: string;
|
||||
readonly furnitureClassName: string;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './CalendarItem';
|
||||
export * from './CalendarItemState';
|
||||
export * from './ICalendarItem';
|
||||
@@ -0,0 +1,10 @@
|
||||
export class BuilderFurniPlaceableStatus
|
||||
{
|
||||
public static OKAY: number = 0;
|
||||
public static MISSING_OFFER: number = 1;
|
||||
public static FURNI_LIMIT_REACHED: number = 2;
|
||||
public static NOT_IN_ROOM: number = 3;
|
||||
public static NOT_ROOM_OWNER: number = 4;
|
||||
public static GUILD_ROOM: number = 5;
|
||||
public static VISITORS_IN_ROOM: number = 6;
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
import { NodeData } from '@nitrots/nitro-renderer';
|
||||
import { ICatalogNode } from './ICatalogNode';
|
||||
|
||||
export class CatalogNode implements ICatalogNode
|
||||
{
|
||||
private _depth: number = 0;
|
||||
private _localization: string = '';
|
||||
private _pageId: number = -1;
|
||||
private _pageName: string = '';
|
||||
private _iconId: number = 0;
|
||||
private _children: ICatalogNode[];
|
||||
private _offerIds: number[];
|
||||
private _parent: ICatalogNode;
|
||||
private _isVisible: boolean;
|
||||
private _isActive: boolean;
|
||||
private _isOpen: boolean;
|
||||
|
||||
constructor(node: NodeData, depth: number, parent: ICatalogNode)
|
||||
{
|
||||
this._depth = depth;
|
||||
this._parent = parent;
|
||||
this._localization = node.localization;
|
||||
this._pageId = node.pageId;
|
||||
this._pageName = node.pageName;
|
||||
this._iconId = node.icon;
|
||||
this._children = [];
|
||||
this._offerIds = node.offerIds;
|
||||
this._isVisible = node.visible;
|
||||
this._isActive = false;
|
||||
this._isOpen = false;
|
||||
}
|
||||
|
||||
public activate(): void
|
||||
{
|
||||
this._isActive = true;
|
||||
}
|
||||
|
||||
public deactivate(): void
|
||||
{
|
||||
this._isActive = false;
|
||||
}
|
||||
|
||||
public open(): void
|
||||
{
|
||||
this._isOpen = true;
|
||||
}
|
||||
|
||||
public close(): void
|
||||
{
|
||||
this._isOpen = false;
|
||||
}
|
||||
|
||||
public addChild(child: ICatalogNode):void
|
||||
{
|
||||
if(!child) return;
|
||||
|
||||
this._children.push(child);
|
||||
}
|
||||
|
||||
public get depth(): number
|
||||
{
|
||||
return this._depth;
|
||||
}
|
||||
|
||||
public get isBranch(): boolean
|
||||
{
|
||||
return (this._children.length > 0);
|
||||
}
|
||||
|
||||
public get isLeaf(): boolean
|
||||
{
|
||||
return (this._children.length === 0);
|
||||
}
|
||||
|
||||
public get localization(): string
|
||||
{
|
||||
return this._localization;
|
||||
}
|
||||
|
||||
public get pageId(): number
|
||||
{
|
||||
return this._pageId;
|
||||
}
|
||||
|
||||
public get pageName(): string
|
||||
{
|
||||
return this._pageName;
|
||||
}
|
||||
|
||||
public get iconId(): number
|
||||
{
|
||||
return this._iconId;
|
||||
}
|
||||
|
||||
public get children(): ICatalogNode[]
|
||||
{
|
||||
return this._children;
|
||||
}
|
||||
|
||||
public get offerIds(): number[]
|
||||
{
|
||||
return this._offerIds;
|
||||
}
|
||||
|
||||
public get parent(): ICatalogNode
|
||||
{
|
||||
return this._parent;
|
||||
}
|
||||
|
||||
public get isVisible(): boolean
|
||||
{
|
||||
return this._isVisible;
|
||||
}
|
||||
|
||||
public get isActive(): boolean
|
||||
{
|
||||
return this._isActive;
|
||||
}
|
||||
|
||||
public get isOpen(): boolean
|
||||
{
|
||||
return this._isOpen;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { ICatalogPage } from './ICatalogPage';
|
||||
import { IPageLocalization } from './IPageLocalization';
|
||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
||||
|
||||
export class CatalogPage implements ICatalogPage
|
||||
{
|
||||
public static MODE_NORMAL: number = 0;
|
||||
|
||||
private _pageId: number;
|
||||
private _layoutCode: string;
|
||||
private _localization: IPageLocalization;
|
||||
private _offers: IPurchasableOffer[];
|
||||
private _acceptSeasonCurrencyAsCredits: boolean;
|
||||
private _mode: number;
|
||||
|
||||
constructor(pageId: number, layoutCode: string, localization: IPageLocalization, offers: IPurchasableOffer[], acceptSeasonCurrencyAsCredits: boolean, mode: number = -1)
|
||||
{
|
||||
this._pageId = pageId;
|
||||
this._layoutCode = layoutCode;
|
||||
this._localization = localization;
|
||||
this._offers = offers;
|
||||
this._acceptSeasonCurrencyAsCredits = acceptSeasonCurrencyAsCredits;
|
||||
|
||||
for(const offer of offers) (offer.page = this);
|
||||
|
||||
if(mode === -1) this._mode = CatalogPage.MODE_NORMAL;
|
||||
else this._mode = mode;
|
||||
}
|
||||
|
||||
public get pageId(): number
|
||||
{
|
||||
return this._pageId;
|
||||
}
|
||||
|
||||
public get layoutCode(): string
|
||||
{
|
||||
return this._layoutCode;
|
||||
}
|
||||
|
||||
public get localization(): IPageLocalization
|
||||
{
|
||||
return this._localization;
|
||||
}
|
||||
|
||||
public get offers(): IPurchasableOffer[]
|
||||
{
|
||||
return this._offers;
|
||||
}
|
||||
|
||||
public get acceptSeasonCurrencyAsCredits(): boolean
|
||||
{
|
||||
return this._acceptSeasonCurrencyAsCredits;
|
||||
}
|
||||
|
||||
public get mode(): number
|
||||
{
|
||||
return this._mode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
export class CatalogPageName
|
||||
{
|
||||
public static DUCKET_INFO: string = 'ducket_info';
|
||||
public static CREDITS: string = 'credits';
|
||||
public static AVATAR_EFFECTS: string = 'avatar_effects';
|
||||
public static HC_MEMBERSHIP: string = 'hc_membership';
|
||||
public static CLUB_GIFTS: string = 'club_gifts';
|
||||
public static LIMITED_SOLD: string = 'limited_sold';
|
||||
public static PET_ACCESSORIES: string = 'pet_accessories';
|
||||
public static TRAX_SONGS: string = 'trax_songs';
|
||||
public static NEW_ADDITIONS: string = 'new_additions';
|
||||
public static QUEST_SHELL: string = 'quest_shell';
|
||||
public static QUEST_SNOWFLAKES: string = 'quest_snowflakes';
|
||||
public static VAL_QUESTS: string = 'val_quests';
|
||||
public static GUILD_CUSTOM_FURNI: string = 'guild_custom_furni';
|
||||
public static GIFT_SHOP: string = 'gift_shop';
|
||||
public static HORSE_STYLES: string = 'horse_styles';
|
||||
public static HORSE_SHOE: string = 'horse_shoe';
|
||||
public static SET_EASTER: string = 'set_easter';
|
||||
public static ECOTRON_TRANSFORM: string = 'ecotron_transform';
|
||||
public static LOYALTY_INFO: string = 'loyalty_info';
|
||||
public static ROOM_BUNDLES: string = 'room_bundles';
|
||||
public static ROOM_BUNDLES_MOBILE: string = 'room_bundles_mobile';
|
||||
public static HABBO_CLUB_DESKTOP: string = 'habbo_club_desktop';
|
||||
public static MOBILE_SUBSCRIPTIONS: string = 'mobile_subscriptions';
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { SellablePetPaletteData } from '@nitrots/nitro-renderer';
|
||||
|
||||
export class CatalogPetPalette
|
||||
{
|
||||
constructor(
|
||||
public readonly breed: string,
|
||||
public readonly palettes: SellablePetPaletteData[]
|
||||
)
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export class CatalogPurchaseState
|
||||
{
|
||||
public static NONE = 0;
|
||||
public static CONFIRM = 1;
|
||||
public static PURCHASE = 2;
|
||||
public static NO_CREDITS = 3;
|
||||
public static NO_POINTS = 4;
|
||||
public static SOLD_OUT = 5;
|
||||
public static FAILED = 6;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export class CatalogType
|
||||
{
|
||||
public static NORMAL: string = 'NORMAL';
|
||||
public static BUILDER: string = 'BUILDERS_CLUB';
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
import { GetRoomEngine, SellablePetPaletteData } from '@nitrots/nitro-renderer';
|
||||
import { ICatalogNode } from './ICatalogNode';
|
||||
|
||||
export const GetPixelEffectIcon = (id: number) =>
|
||||
{
|
||||
return '';
|
||||
};
|
||||
|
||||
export const GetSubscriptionProductIcon = (id: number) =>
|
||||
{
|
||||
return '';
|
||||
};
|
||||
|
||||
export const GetOfferNodes = (offerNodes: Map<number, ICatalogNode[]>, offerId: number) =>
|
||||
{
|
||||
const nodes = offerNodes.get(offerId);
|
||||
const allowedNodes: ICatalogNode[] = [];
|
||||
|
||||
if(nodes && nodes.length)
|
||||
{
|
||||
for(const node of nodes)
|
||||
{
|
||||
if(!node.isVisible) continue;
|
||||
|
||||
allowedNodes.push(node);
|
||||
}
|
||||
}
|
||||
|
||||
return allowedNodes;
|
||||
};
|
||||
|
||||
export const FilterCatalogNode = (search: string, furniLines: string[], node: ICatalogNode, nodes: ICatalogNode[]) =>
|
||||
{
|
||||
if(node.isVisible && (node.pageId > 0))
|
||||
{
|
||||
let nodeAdded = false;
|
||||
|
||||
const hayStack = [ node.pageName, node.localization ].join(' ').toLowerCase().replace(/ /gi, '');
|
||||
|
||||
if(hayStack.indexOf(search) > -1)
|
||||
{
|
||||
nodes.push(node);
|
||||
|
||||
nodeAdded = true;
|
||||
}
|
||||
|
||||
if(!nodeAdded)
|
||||
{
|
||||
for(const furniLine of furniLines)
|
||||
{
|
||||
if(hayStack.indexOf(furniLine) >= 0)
|
||||
{
|
||||
nodes.push(node);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(const child of node.children) FilterCatalogNode(search, furniLines, child, nodes);
|
||||
};
|
||||
|
||||
export function GetPetIndexFromLocalization(localization: string)
|
||||
{
|
||||
if(!localization.length) return 0;
|
||||
|
||||
let index = (localization.length - 1);
|
||||
|
||||
while(index >= 0)
|
||||
{
|
||||
if(isNaN(parseInt(localization.charAt(index)))) break;
|
||||
|
||||
index--;
|
||||
}
|
||||
|
||||
if(index > 0) return parseInt(localization.substring(index + 1));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
export function GetPetAvailableColors(petIndex: number, palettes: SellablePetPaletteData[]): number[][]
|
||||
{
|
||||
switch(petIndex)
|
||||
{
|
||||
case 0:
|
||||
return [ [ 16743226 ], [ 16750435 ], [ 16764339 ], [ 0xF59500 ], [ 16498012 ], [ 16704690 ], [ 0xEDD400 ], [ 16115545 ], [ 16513201 ], [ 8694111 ], [ 11585939 ], [ 14413767 ], [ 6664599 ], [ 9553845 ], [ 12971486 ], [ 8358322 ], [ 10002885 ], [ 13292268 ], [ 10780600 ], [ 12623573 ], [ 14403561 ], [ 12418717 ], [ 14327229 ], [ 15517403 ], [ 14515069 ], [ 15764368 ], [ 16366271 ], [ 0xABABAB ], [ 0xD4D4D4 ], [ 0xFFFFFF ], [ 14256481 ], [ 14656129 ], [ 15848130 ], [ 14005087 ], [ 14337152 ], [ 15918540 ], [ 15118118 ], [ 15531929 ], [ 9764857 ], [ 11258085 ] ];
|
||||
case 1:
|
||||
return [ [ 16743226 ], [ 16750435 ], [ 16764339 ], [ 0xF59500 ], [ 16498012 ], [ 16704690 ], [ 0xEDD400 ], [ 16115545 ], [ 16513201 ], [ 8694111 ], [ 11585939 ], [ 14413767 ], [ 6664599 ], [ 9553845 ], [ 12971486 ], [ 8358322 ], [ 10002885 ], [ 13292268 ], [ 10780600 ], [ 12623573 ], [ 14403561 ], [ 12418717 ], [ 14327229 ], [ 15517403 ], [ 14515069 ], [ 15764368 ], [ 16366271 ], [ 0xABABAB ], [ 0xD4D4D4 ], [ 0xFFFFFF ], [ 14256481 ], [ 14656129 ], [ 15848130 ], [ 14005087 ], [ 14337152 ], [ 15918540 ], [ 15118118 ], [ 15531929 ], [ 9764857 ], [ 11258085 ] ];
|
||||
case 2:
|
||||
return [ [ 16579283 ], [ 15378351 ], [ 8830016 ], [ 15257125 ], [ 9340985 ], [ 8949607 ], [ 6198292 ], [ 8703620 ], [ 9889626 ], [ 8972045 ], [ 12161285 ], [ 13162269 ], [ 8620113 ], [ 12616503 ], [ 8628101 ], [ 0xD2FF00 ], [ 9764857 ] ];
|
||||
case 3:
|
||||
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ] ];
|
||||
case 4:
|
||||
return [ [ 0xFFFFFF ], [ 16053490 ], [ 15464440 ], [ 16248792 ], [ 15396319 ], [ 15007487 ] ];
|
||||
case 5:
|
||||
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ] ];
|
||||
case 6:
|
||||
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ], [ 16767177 ], [ 16770205 ], [ 16751331 ] ];
|
||||
case 7:
|
||||
return [ [ 0xCCCCCC ], [ 0xAEAEAE ], [ 16751331 ], [ 10149119 ], [ 16763290 ], [ 16743786 ] ];
|
||||
default: {
|
||||
const colors: number[][] = [];
|
||||
|
||||
for(const palette of palettes)
|
||||
{
|
||||
const petColorResult = GetRoomEngine().getPetColorResult(petIndex, palette.paletteId);
|
||||
|
||||
if(!petColorResult) continue;
|
||||
|
||||
if(petColorResult.primaryColor === petColorResult.secondaryColor)
|
||||
{
|
||||
colors.push([ petColorResult.primaryColor ]);
|
||||
}
|
||||
else
|
||||
{
|
||||
colors.push([ petColorResult.primaryColor, petColorResult.secondaryColor ]);
|
||||
}
|
||||
}
|
||||
|
||||
return colors;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
import { GetProductOfferComposer, IFurnitureData } from '@nitrots/nitro-renderer';
|
||||
import { GetProductDataForLocalization, SendMessageComposer } from '../nitro';
|
||||
import { ICatalogPage } from './ICatalogPage';
|
||||
import { IProduct } from './IProduct';
|
||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
||||
import { Offer } from './Offer';
|
||||
import { Product } from './Product';
|
||||
|
||||
export class FurnitureOffer implements IPurchasableOffer
|
||||
{
|
||||
private _furniData:IFurnitureData;
|
||||
private _page: ICatalogPage;
|
||||
private _product: IProduct;
|
||||
|
||||
constructor(furniData: IFurnitureData)
|
||||
{
|
||||
this._furniData = furniData;
|
||||
this._product = (new Product(this._furniData.type, this._furniData.id, this._furniData.customParams, 1, GetProductDataForLocalization(this._furniData.className), this._furniData) as IProduct);
|
||||
}
|
||||
|
||||
public activate(): void
|
||||
{
|
||||
SendMessageComposer(new GetProductOfferComposer((this._furniData.rentOfferId > -1) ? this._furniData.rentOfferId : this._furniData.purchaseOfferId));
|
||||
}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return (this.isRentOffer) ? this._furniData.rentOfferId : this._furniData.purchaseOfferId;
|
||||
}
|
||||
|
||||
public get priceInActivityPoints(): number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public get activityPointType(): number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public get priceInCredits(): number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public get page(): ICatalogPage
|
||||
{
|
||||
return this._page;
|
||||
}
|
||||
|
||||
public set page(page: ICatalogPage)
|
||||
{
|
||||
this._page = page;
|
||||
}
|
||||
|
||||
public get priceType(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public get product(): IProduct
|
||||
{
|
||||
return this._product;
|
||||
}
|
||||
|
||||
public get products(): IProduct[]
|
||||
{
|
||||
return [ this._product ];
|
||||
}
|
||||
|
||||
public get localizationId(): string
|
||||
{
|
||||
return 'roomItem.name.' + this._furniData.id;
|
||||
}
|
||||
|
||||
public get bundlePurchaseAllowed(): boolean
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public get isRentOffer(): boolean
|
||||
{
|
||||
return (this._furniData.rentOfferId > -1);
|
||||
}
|
||||
|
||||
public get giftable(): boolean
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public get pricingModel(): string
|
||||
{
|
||||
return Offer.PRICING_MODEL_FURNITURE;
|
||||
}
|
||||
|
||||
public get clubLevel(): number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public get badgeCode(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public get localizationName(): string
|
||||
{
|
||||
return this._furniData.name;
|
||||
}
|
||||
|
||||
public get localizationDescription(): string
|
||||
{
|
||||
return this._furniData.description;
|
||||
}
|
||||
|
||||
public get isLazy(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { GetRoomEngine } from '@nitrots/nitro-renderer';
|
||||
import { ProductTypeEnum } from './ProductTypeEnum';
|
||||
|
||||
export const GetImageIconUrlForProduct = (productType: string, productClassId: number, extraData: string = null) =>
|
||||
{
|
||||
let imageUrl: string = null;
|
||||
|
||||
switch(productType.toLocaleLowerCase())
|
||||
{
|
||||
case ProductTypeEnum.FLOOR:
|
||||
imageUrl = GetRoomEngine().getFurnitureFloorIconUrl(productClassId);
|
||||
break;
|
||||
case ProductTypeEnum.WALL:
|
||||
imageUrl = GetRoomEngine().getFurnitureWallIconUrl(productClassId, extraData);
|
||||
break;
|
||||
}
|
||||
|
||||
return imageUrl;
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
import { GiftWrappingConfigurationParser } from '@nitrots/nitro-renderer';
|
||||
|
||||
export class GiftWrappingConfiguration
|
||||
{
|
||||
private _isEnabled: boolean = false;
|
||||
private _price: number = null;
|
||||
private _stuffTypes: number[] = null;
|
||||
private _boxTypes: number[] = null;
|
||||
private _ribbonTypes: number[] = null;
|
||||
private _defaultStuffTypes: number[] = null;
|
||||
|
||||
constructor(parser: GiftWrappingConfigurationParser)
|
||||
{
|
||||
this._isEnabled = parser.isEnabled;
|
||||
this._price = parser.price;
|
||||
this._boxTypes = parser.boxTypes;
|
||||
this._ribbonTypes = parser.ribbonTypes;
|
||||
this._stuffTypes = parser.giftWrappers;
|
||||
this._defaultStuffTypes = parser.giftFurnis;
|
||||
}
|
||||
|
||||
public get isEnabled(): boolean
|
||||
{
|
||||
return this._isEnabled;
|
||||
}
|
||||
|
||||
public get price(): number
|
||||
{
|
||||
return this._price;
|
||||
}
|
||||
|
||||
public get stuffTypes(): number[]
|
||||
{
|
||||
return this._stuffTypes;
|
||||
}
|
||||
|
||||
public get boxTypes(): number[]
|
||||
{
|
||||
return this._boxTypes;
|
||||
}
|
||||
|
||||
public get ribbonTypes(): number[]
|
||||
{
|
||||
return this._ribbonTypes;
|
||||
}
|
||||
|
||||
public get defaultStuffTypes(): number[]
|
||||
{
|
||||
return this._defaultStuffTypes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
export interface ICatalogNode
|
||||
{
|
||||
activate(): void;
|
||||
deactivate(): void;
|
||||
open(): void;
|
||||
close(): void;
|
||||
addChild(node: ICatalogNode): void;
|
||||
readonly depth: number;
|
||||
readonly isBranch: boolean;
|
||||
readonly isLeaf: boolean;
|
||||
readonly localization: string;
|
||||
readonly pageId: number;
|
||||
readonly pageName: string;
|
||||
readonly iconId: number;
|
||||
readonly children: ICatalogNode[];
|
||||
readonly offerIds: number[];
|
||||
readonly parent: ICatalogNode;
|
||||
readonly isVisible: boolean;
|
||||
readonly isActive: boolean;
|
||||
readonly isOpen: boolean;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { ClubGiftInfoParser, ClubOfferData, HabboGroupEntryData, MarketplaceConfigurationMessageParser } from '@nitrots/nitro-renderer';
|
||||
import { CatalogPetPalette } from './CatalogPetPalette';
|
||||
import { GiftWrappingConfiguration } from './GiftWrappingConfiguration';
|
||||
|
||||
export interface ICatalogOptions
|
||||
{
|
||||
groups?: HabboGroupEntryData[];
|
||||
petPalettes?: CatalogPetPalette[];
|
||||
clubOffers?: ClubOfferData[];
|
||||
clubGifts?: ClubGiftInfoParser;
|
||||
giftConfiguration?: GiftWrappingConfiguration;
|
||||
marketplaceConfiguration?: MarketplaceConfigurationMessageParser;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { IPageLocalization } from './IPageLocalization';
|
||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
||||
|
||||
export interface ICatalogPage
|
||||
{
|
||||
readonly pageId: number;
|
||||
readonly layoutCode: string;
|
||||
readonly localization: IPageLocalization;
|
||||
readonly offers: IPurchasableOffer[];
|
||||
readonly acceptSeasonCurrencyAsCredits: boolean;
|
||||
readonly mode: number;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export interface IMarketplaceSearchOptions
|
||||
{
|
||||
query: string;
|
||||
type: number;
|
||||
minPrice: number;
|
||||
maxPrice: number;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface IPageLocalization
|
||||
{
|
||||
getText(index: number): string
|
||||
getImage(index: number): string
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IFurnitureData, IProductData } from '@nitrots/nitro-renderer';
|
||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
||||
|
||||
export interface IProduct
|
||||
{
|
||||
getIconUrl(offer?: IPurchasableOffer): string;
|
||||
productType: string;
|
||||
productClassId: number;
|
||||
extraParam: string;
|
||||
productCount: number;
|
||||
productData: IProductData;
|
||||
furnitureData: IFurnitureData;
|
||||
isUniqueLimitedItem: boolean;
|
||||
uniqueLimitedItemSeriesSize: number;
|
||||
uniqueLimitedItemsLeft: number;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ICatalogPage } from './ICatalogPage';
|
||||
import { IProduct } from './IProduct';
|
||||
|
||||
export interface IPurchasableOffer
|
||||
{
|
||||
activate(): void;
|
||||
clubLevel: number;
|
||||
page: ICatalogPage;
|
||||
offerId: number;
|
||||
localizationId: string;
|
||||
priceInCredits: number;
|
||||
priceInActivityPoints: number;
|
||||
activityPointType: number;
|
||||
giftable: boolean;
|
||||
product: IProduct;
|
||||
pricingModel: string;
|
||||
priceType: string;
|
||||
bundlePurchaseAllowed: boolean;
|
||||
isRentOffer: boolean;
|
||||
badgeCode: string;
|
||||
localizationName: string;
|
||||
localizationDescription: string;
|
||||
isLazy: boolean;
|
||||
products: IProduct[];
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { IObjectData } from '@nitrots/nitro-renderer';
|
||||
|
||||
export interface IPurchaseOptions
|
||||
{
|
||||
quantity?: number;
|
||||
extraData?: string;
|
||||
extraParamRequired?: boolean;
|
||||
previewStuffData?: IObjectData;
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
import { IObjectData } from '@nitrots/nitro-renderer';
|
||||
|
||||
export class MarketplaceOfferData
|
||||
{
|
||||
public static readonly TYPE_FLOOR: number = 1;
|
||||
public static readonly TYPE_WALL: number = 2;
|
||||
|
||||
private _offerId: number;
|
||||
private _furniId: number;
|
||||
private _furniType: number;
|
||||
private _extraData: string;
|
||||
private _stuffData: IObjectData;
|
||||
private _price: number;
|
||||
private _averagePrice: number;
|
||||
private _imageCallback: number;
|
||||
private _status: number;
|
||||
private _timeLeftMinutes: number = -1;
|
||||
private _offerCount: number;
|
||||
private _image: string;
|
||||
|
||||
constructor(offerId: number, furniId: number, furniType: number, extraData: string, stuffData: IObjectData, price: number, status: number, averagePrice: number, offerCount: number = -1)
|
||||
{
|
||||
this._offerId = offerId;
|
||||
this._furniId = furniId;
|
||||
this._furniType = furniType;
|
||||
this._extraData = extraData;
|
||||
this._stuffData = stuffData;
|
||||
this._price = price;
|
||||
this._status = status;
|
||||
this._averagePrice = averagePrice;
|
||||
this._offerCount = offerCount;
|
||||
}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return this._offerId;
|
||||
}
|
||||
|
||||
public set offerId(offerId: number)
|
||||
{
|
||||
this._offerId = offerId;
|
||||
}
|
||||
|
||||
public get furniId(): number
|
||||
{
|
||||
return this._furniId;
|
||||
}
|
||||
|
||||
public get furniType(): number
|
||||
{
|
||||
return this._furniType;
|
||||
}
|
||||
|
||||
public get extraData(): string
|
||||
{
|
||||
return this._extraData;
|
||||
}
|
||||
|
||||
public get stuffData(): IObjectData
|
||||
{
|
||||
return this._stuffData;
|
||||
}
|
||||
|
||||
public get price(): number
|
||||
{
|
||||
return this._price;
|
||||
}
|
||||
|
||||
public set price(price: number)
|
||||
{
|
||||
this._price = price;
|
||||
}
|
||||
|
||||
public get averagePrice(): number
|
||||
{
|
||||
return this._averagePrice;
|
||||
}
|
||||
|
||||
public get image(): string
|
||||
{
|
||||
return this._image;
|
||||
}
|
||||
|
||||
public set image(image: string)
|
||||
{
|
||||
this._image = image;
|
||||
}
|
||||
|
||||
public get imageCallback(): number
|
||||
{
|
||||
return this._imageCallback;
|
||||
}
|
||||
|
||||
public set imageCallback(callback: number)
|
||||
{
|
||||
this._imageCallback = callback;
|
||||
}
|
||||
|
||||
public get status(): number
|
||||
{
|
||||
return this._status;
|
||||
}
|
||||
|
||||
public get timeLeftMinutes(): number
|
||||
{
|
||||
return this._timeLeftMinutes;
|
||||
}
|
||||
|
||||
public set timeLeftMinutes(minutes: number)
|
||||
{
|
||||
this._timeLeftMinutes = minutes;
|
||||
}
|
||||
|
||||
public get offerCount(): number
|
||||
{
|
||||
return this._offerCount;
|
||||
}
|
||||
|
||||
public set offerCount(count: number)
|
||||
{
|
||||
this._offerCount = count;
|
||||
}
|
||||
|
||||
public get isUniqueLimitedItem(): boolean
|
||||
{
|
||||
return (this.stuffData && (this.stuffData.uniqueSeries > 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export class MarketPlaceOfferState
|
||||
{
|
||||
public static readonly ONGOING = 1;
|
||||
public static readonly ONGOING_OWN = 1;
|
||||
public static readonly SOLD = 2;
|
||||
public static readonly EXPIRED = 3;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export class MarketplaceSearchType
|
||||
{
|
||||
public static readonly BY_ACTIVITY = 1;
|
||||
public static readonly BY_VALUE = 2;
|
||||
public static readonly ADVANCED = 3;
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
import { GetFurnitureData, GetProductDataForLocalization, LocalizeText, ProductTypeEnum } from '..';
|
||||
import { ICatalogPage } from './ICatalogPage';
|
||||
import { IProduct } from './IProduct';
|
||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
||||
import { Product } from './Product';
|
||||
|
||||
export class Offer implements IPurchasableOffer
|
||||
{
|
||||
public static PRICING_MODEL_UNKNOWN: string = 'pricing_model_unknown';
|
||||
public static PRICING_MODEL_SINGLE: string = 'pricing_model_single';
|
||||
public static PRICING_MODEL_MULTI: string = 'pricing_model_multi';
|
||||
public static PRICING_MODEL_BUNDLE: string = 'pricing_model_bundle';
|
||||
public static PRICING_MODEL_FURNITURE: string = 'pricing_model_furniture';
|
||||
public static PRICE_TYPE_NONE: string = 'price_type_none';
|
||||
public static PRICE_TYPE_CREDITS: string = 'price_type_credits';
|
||||
public static PRICE_TYPE_ACTIVITYPOINTS: string = 'price_type_activitypoints';
|
||||
public static PRICE_TYPE_CREDITS_ACTIVITYPOINTS: string = 'price_type_credits_and_activitypoints';
|
||||
|
||||
private _pricingModel: string;
|
||||
private _priceType: string;
|
||||
private _offerId: number;
|
||||
private _localizationId: string;
|
||||
private _priceInCredits: number;
|
||||
private _priceInActivityPoints: number;
|
||||
private _activityPointType: number;
|
||||
private _giftable: boolean;
|
||||
private _isRentOffer: boolean;
|
||||
private _page: ICatalogPage;
|
||||
private _clubLevel: number = 0;
|
||||
private _products: IProduct[];
|
||||
private _badgeCode: string;
|
||||
private _bundlePurchaseAllowed: boolean = false;
|
||||
|
||||
constructor(offerId: number, localizationId: string, isRentOffer: boolean, priceInCredits: number, priceInActivityPoints: number, activityPointType: number, giftable: boolean, clubLevel: number, products: IProduct[], bundlePurchaseAllowed: boolean)
|
||||
{
|
||||
this._offerId = offerId;
|
||||
this._localizationId = localizationId;
|
||||
this._isRentOffer = isRentOffer;
|
||||
this._priceInCredits = priceInCredits;
|
||||
this._priceInActivityPoints = priceInActivityPoints;
|
||||
this._activityPointType = activityPointType;
|
||||
this._giftable = giftable;
|
||||
this._clubLevel = clubLevel;
|
||||
this._products = products;
|
||||
this._bundlePurchaseAllowed = bundlePurchaseAllowed;
|
||||
|
||||
this.setPricingModelForProducts();
|
||||
this.setPricingType();
|
||||
|
||||
for(const product of products)
|
||||
{
|
||||
if(product.productType === ProductTypeEnum.BADGE)
|
||||
{
|
||||
this._badgeCode = product.extraParam;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public activate(): void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public get clubLevel(): number
|
||||
{
|
||||
return this._clubLevel;
|
||||
}
|
||||
|
||||
public get page(): ICatalogPage
|
||||
{
|
||||
return this._page;
|
||||
}
|
||||
|
||||
public set page(k: ICatalogPage)
|
||||
{
|
||||
this._page = k;
|
||||
}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return this._offerId;
|
||||
}
|
||||
|
||||
public get localizationId(): string
|
||||
{
|
||||
return this._localizationId;
|
||||
}
|
||||
|
||||
public get priceInCredits(): number
|
||||
{
|
||||
return this._priceInCredits;
|
||||
}
|
||||
|
||||
public get priceInActivityPoints(): number
|
||||
{
|
||||
return this._priceInActivityPoints;
|
||||
}
|
||||
|
||||
public get activityPointType(): number
|
||||
{
|
||||
return this._activityPointType;
|
||||
}
|
||||
|
||||
public get giftable(): boolean
|
||||
{
|
||||
return this._giftable;
|
||||
}
|
||||
|
||||
public get product(): IProduct
|
||||
{
|
||||
if(!this._products || !this._products.length) return null;
|
||||
|
||||
if(this._products.length === 1) return this._products[0];
|
||||
|
||||
const products = Product.stripAddonProducts(this._products);
|
||||
|
||||
if(products.length) return products[0];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public get pricingModel(): string
|
||||
{
|
||||
return this._pricingModel;
|
||||
}
|
||||
|
||||
public get priceType(): string
|
||||
{
|
||||
return this._priceType;
|
||||
}
|
||||
|
||||
public get bundlePurchaseAllowed(): boolean
|
||||
{
|
||||
return this._bundlePurchaseAllowed;
|
||||
}
|
||||
|
||||
public get isRentOffer(): boolean
|
||||
{
|
||||
return this._isRentOffer;
|
||||
}
|
||||
|
||||
public get badgeCode(): string
|
||||
{
|
||||
return this._badgeCode;
|
||||
}
|
||||
|
||||
public get localizationName(): string
|
||||
{
|
||||
const productData = GetProductDataForLocalization(this._localizationId);
|
||||
|
||||
if(productData) return productData.name;
|
||||
|
||||
return LocalizeText(this._localizationId);
|
||||
}
|
||||
|
||||
public get localizationDescription(): string
|
||||
{
|
||||
const productData = GetProductDataForLocalization(this._localizationId);
|
||||
|
||||
if(productData) return productData.description;
|
||||
|
||||
return LocalizeText(this._localizationId);
|
||||
}
|
||||
|
||||
public get isLazy(): boolean
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public get products(): IProduct[]
|
||||
{
|
||||
return this._products;
|
||||
}
|
||||
|
||||
private setPricingModelForProducts(): void
|
||||
{
|
||||
const products = Product.stripAddonProducts(this._products);
|
||||
|
||||
if(products.length === 1)
|
||||
{
|
||||
if(products[0].productCount === 1)
|
||||
{
|
||||
this._pricingModel = Offer.PRICING_MODEL_SINGLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._pricingModel = Offer.PRICING_MODEL_MULTI;
|
||||
}
|
||||
}
|
||||
|
||||
else if(products.length > 1)
|
||||
{
|
||||
this._pricingModel = Offer.PRICING_MODEL_BUNDLE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
this._pricingModel = Offer.PRICING_MODEL_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
private setPricingType(): void
|
||||
{
|
||||
if((this._priceInCredits > 0) && (this._priceInActivityPoints > 0))
|
||||
{
|
||||
this._priceType = Offer.PRICE_TYPE_CREDITS_ACTIVITYPOINTS;
|
||||
}
|
||||
|
||||
else if(this._priceInCredits > 0)
|
||||
{
|
||||
this._priceType = Offer.PRICE_TYPE_CREDITS;
|
||||
}
|
||||
|
||||
else if(this._priceInActivityPoints > 0)
|
||||
{
|
||||
this._priceType = Offer.PRICE_TYPE_ACTIVITYPOINTS;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
this._priceType = Offer.PRICE_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
public clone(): IPurchasableOffer
|
||||
{
|
||||
const products: IProduct[] = [];
|
||||
const productData = GetProductDataForLocalization(this.localizationId);
|
||||
|
||||
for(const product of this._products)
|
||||
{
|
||||
const furnitureData = GetFurnitureData(product.productClassId, product.productType);
|
||||
|
||||
products.push(new Product(product.productType, product.productClassId, product.extraParam, product.productCount, productData, furnitureData));
|
||||
}
|
||||
|
||||
const offer = new Offer(this.offerId, this.localizationId, this.isRentOffer, this.priceInCredits, this.priceInActivityPoints, this.activityPointType, this.giftable, this.clubLevel, products, this.bundlePurchaseAllowed);
|
||||
|
||||
offer.page = this.page;
|
||||
|
||||
return offer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { GetConfigurationValue } from '../nitro';
|
||||
import { IPageLocalization } from './IPageLocalization';
|
||||
|
||||
export class PageLocalization implements IPageLocalization
|
||||
{
|
||||
private _images: string[];
|
||||
private _texts: string[];
|
||||
|
||||
constructor(images: string[], texts: string[])
|
||||
{
|
||||
this._images = images;
|
||||
this._texts = texts;
|
||||
}
|
||||
|
||||
public getText(index: number): string
|
||||
{
|
||||
let message = (this._texts[index] || '');
|
||||
|
||||
if(message && message.length) message = message.replace(/\r\n|\r|\n/g, '<br />');
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
public getImage(index: number): string
|
||||
{
|
||||
const imageName = (this._images[index] || '');
|
||||
|
||||
if(!imageName || !imageName.length) return null;
|
||||
|
||||
let assetUrl = GetConfigurationValue<string>('catalog.asset.image.url');
|
||||
|
||||
assetUrl = assetUrl.replace('%name%', imageName);
|
||||
|
||||
return assetUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { IFurnitureData, IProductData } from '@nitrots/nitro-renderer';
|
||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
||||
|
||||
export class PlacedObjectPurchaseData
|
||||
{
|
||||
constructor(
|
||||
public readonly roomId: number,
|
||||
public readonly objectId: number,
|
||||
public readonly category: number,
|
||||
public readonly wallLocation: string,
|
||||
public readonly x: number,
|
||||
public readonly y: number,
|
||||
public readonly direction: number,
|
||||
public readonly offer: IPurchasableOffer)
|
||||
{}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return this.offer.offerId;
|
||||
}
|
||||
|
||||
public get productClassId(): number
|
||||
{
|
||||
return this.offer.product.productClassId;
|
||||
}
|
||||
|
||||
public get productData(): IProductData
|
||||
{
|
||||
return this.offer.product.productData;
|
||||
}
|
||||
|
||||
public get furniData(): IFurnitureData
|
||||
{
|
||||
return this.offer.product.furnitureData;
|
||||
}
|
||||
|
||||
public get extraParam(): string
|
||||
{
|
||||
return this.offer.product.extraParam;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
import { GetRoomEngine, GetSessionDataManager, IFurnitureData, IObjectData, IProductData } from '@nitrots/nitro-renderer';
|
||||
import { GetConfigurationValue } from '../nitro';
|
||||
import { GetPixelEffectIcon, GetSubscriptionProductIcon } from './CatalogUtilities';
|
||||
import { IProduct } from './IProduct';
|
||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
||||
import { ProductTypeEnum } from './ProductTypeEnum';
|
||||
|
||||
export class Product implements IProduct
|
||||
{
|
||||
public static EFFECT_CLASSID_NINJA_DISAPPEAR: number = 108;
|
||||
|
||||
private _productType: string;
|
||||
private _productClassId: number;
|
||||
private _extraParam: string;
|
||||
private _productCount: number;
|
||||
private _productData: IProductData;
|
||||
private _furnitureData: IFurnitureData;
|
||||
private _isUniqueLimitedItem: boolean;
|
||||
private _uniqueLimitedItemSeriesSize: number;
|
||||
private _uniqueLimitedItemsLeft: number;
|
||||
|
||||
constructor(productType: string, productClassId: number, extraParam: string, productCount: number, productData: IProductData, furnitureData: IFurnitureData, isUniqueLimitedItem: boolean = false, uniqueLimitedItemSeriesSize: number = 0, uniqueLimitedItemsLeft: number = 0)
|
||||
{
|
||||
this._productType = productType.toLowerCase();
|
||||
this._productClassId = productClassId;
|
||||
this._extraParam = extraParam;
|
||||
this._productCount = productCount;
|
||||
this._productData = productData;
|
||||
this._furnitureData = furnitureData;
|
||||
this._isUniqueLimitedItem = isUniqueLimitedItem;
|
||||
this._uniqueLimitedItemSeriesSize = uniqueLimitedItemSeriesSize;
|
||||
this._uniqueLimitedItemsLeft = uniqueLimitedItemsLeft;
|
||||
}
|
||||
|
||||
public static stripAddonProducts(products: IProduct[]): IProduct[]
|
||||
{
|
||||
if(products.length === 1) return products;
|
||||
|
||||
return products.filter(product => ((product.productType !== ProductTypeEnum.BADGE) && (product.productType !== ProductTypeEnum.EFFECT) && (product.productClassId !== Product.EFFECT_CLASSID_NINJA_DISAPPEAR)));
|
||||
}
|
||||
|
||||
public getIconUrl(offer: IPurchasableOffer = null, stuffData: IObjectData = null): string
|
||||
{
|
||||
switch(this._productType)
|
||||
{
|
||||
case ProductTypeEnum.FLOOR:
|
||||
return GetRoomEngine().getFurnitureFloorIconUrl(this.productClassId);
|
||||
case ProductTypeEnum.WALL: {
|
||||
if(offer && this._furnitureData)
|
||||
{
|
||||
let iconName = '';
|
||||
|
||||
switch(this._furnitureData.className)
|
||||
{
|
||||
case 'floor':
|
||||
iconName = [ 'th', this._furnitureData.className, offer.product.extraParam ].join('_');
|
||||
break;
|
||||
case 'wallpaper':
|
||||
iconName = [ 'th', 'wall', offer.product.extraParam ].join('_');
|
||||
break;
|
||||
case 'landscape':
|
||||
iconName = [ 'th', this._furnitureData.className, (offer.product.extraParam || '').replace('.', '_'), '001' ].join('_');
|
||||
break;
|
||||
}
|
||||
|
||||
if(iconName !== '')
|
||||
{
|
||||
const assetUrl = GetConfigurationValue<string>('catalog.asset.url');
|
||||
|
||||
return `${ assetUrl }/${ iconName }.png`;
|
||||
}
|
||||
}
|
||||
|
||||
return GetRoomEngine().getFurnitureWallIconUrl(this.productClassId, this._extraParam);
|
||||
}
|
||||
case ProductTypeEnum.EFFECT:
|
||||
return GetPixelEffectIcon(this.productClassId);
|
||||
case ProductTypeEnum.HABBO_CLUB:
|
||||
return GetSubscriptionProductIcon(this.productClassId);
|
||||
case ProductTypeEnum.BADGE:
|
||||
return GetSessionDataManager().getBadgeUrl(this._extraParam);
|
||||
case ProductTypeEnum.ROBOT:
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public get productType(): string
|
||||
{
|
||||
return this._productType;
|
||||
}
|
||||
|
||||
public get productClassId(): number
|
||||
{
|
||||
return this._productClassId;
|
||||
}
|
||||
|
||||
public get extraParam(): string
|
||||
{
|
||||
return this._extraParam;
|
||||
}
|
||||
|
||||
public set extraParam(extraParam: string)
|
||||
{
|
||||
this._extraParam = extraParam;
|
||||
}
|
||||
|
||||
public get productCount(): number
|
||||
{
|
||||
return this._productCount;
|
||||
}
|
||||
|
||||
public get productData(): IProductData
|
||||
{
|
||||
return this._productData;
|
||||
}
|
||||
|
||||
public get furnitureData(): IFurnitureData
|
||||
{
|
||||
return this._furnitureData;
|
||||
}
|
||||
|
||||
public get isUniqueLimitedItem(): boolean
|
||||
{
|
||||
return this._isUniqueLimitedItem;
|
||||
}
|
||||
|
||||
public get uniqueLimitedItemSeriesSize(): number
|
||||
{
|
||||
return this._uniqueLimitedItemSeriesSize;
|
||||
}
|
||||
|
||||
public get uniqueLimitedItemsLeft(): number
|
||||
{
|
||||
return this._uniqueLimitedItemsLeft;
|
||||
}
|
||||
|
||||
public set uniqueLimitedItemsLeft(uniqueLimitedItemsLeft: number)
|
||||
{
|
||||
this._uniqueLimitedItemsLeft = uniqueLimitedItemsLeft;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export class ProductTypeEnum
|
||||
{
|
||||
public static WALL: string = 'i';
|
||||
public static FLOOR: string = 's';
|
||||
public static EFFECT: string = 'e';
|
||||
public static HABBO_CLUB: string = 'h';
|
||||
public static BADGE: string = 'b';
|
||||
public static GAME_TOKEN: string = 'GAME_TOKEN';
|
||||
public static PET: string = 'p';
|
||||
public static ROBOT: string = 'r';
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
export class RequestedPage
|
||||
{
|
||||
public static REQUEST_TYPE_NONE: number = 0;
|
||||
public static REQUEST_TYPE_ID: number = 1;
|
||||
public static REQUEST_TYPE_OFFER: number = 2;
|
||||
public static REQUEST_TYPE_NAME: number = 3;
|
||||
|
||||
private _requestType: number;
|
||||
private _requestById: number;
|
||||
private _requestedByOfferId: number;
|
||||
private _requestByName: string;
|
||||
|
||||
constructor()
|
||||
{
|
||||
this._requestType = RequestedPage.REQUEST_TYPE_NONE;
|
||||
}
|
||||
|
||||
public resetRequest():void
|
||||
{
|
||||
this._requestType = RequestedPage.REQUEST_TYPE_NONE;
|
||||
this._requestById = -1;
|
||||
this._requestedByOfferId = -1;
|
||||
this._requestByName = null;
|
||||
}
|
||||
|
||||
public get requestType(): number
|
||||
{
|
||||
return this._requestType;
|
||||
}
|
||||
|
||||
public get requestById(): number
|
||||
{
|
||||
return this._requestById;
|
||||
}
|
||||
|
||||
public set requestById(id: number)
|
||||
{
|
||||
this._requestType = RequestedPage.REQUEST_TYPE_ID;
|
||||
this._requestById = id;
|
||||
}
|
||||
|
||||
public get requestedByOfferId(): number
|
||||
{
|
||||
return this._requestedByOfferId;
|
||||
}
|
||||
|
||||
public set requestedByOfferId(offerId: number)
|
||||
{
|
||||
this._requestType = RequestedPage.REQUEST_TYPE_OFFER;
|
||||
this._requestedByOfferId = offerId;
|
||||
}
|
||||
|
||||
public get requestByName(): string
|
||||
{
|
||||
return this._requestByName;
|
||||
}
|
||||
|
||||
public set requestByName(name: string)
|
||||
{
|
||||
this._requestType = RequestedPage.REQUEST_TYPE_NAME;
|
||||
this._requestByName = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { ICatalogNode } from './ICatalogNode';
|
||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
||||
|
||||
export class SearchResult
|
||||
{
|
||||
constructor(
|
||||
public readonly searchValue: string,
|
||||
public readonly offers: IPurchasableOffer[],
|
||||
public readonly filteredNodes: ICatalogNode[])
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
export * from './BuilderFurniPlaceableStatus';
|
||||
export * from './CatalogNode';
|
||||
export * from './CatalogPage';
|
||||
export * from './CatalogPageName';
|
||||
export * from './CatalogPetPalette';
|
||||
export * from './CatalogPurchaseState';
|
||||
export * from './CatalogType';
|
||||
export * from './CatalogUtilities';
|
||||
export * from './FurnitureOffer';
|
||||
export * from './GetImageIconUrlForProduct';
|
||||
export * from './GiftWrappingConfiguration';
|
||||
export * from './ICatalogNode';
|
||||
export * from './ICatalogOptions';
|
||||
export * from './ICatalogPage';
|
||||
export * from './IMarketplaceSearchOptions';
|
||||
export * from './IPageLocalization';
|
||||
export * from './IProduct';
|
||||
export * from './IPurchasableOffer';
|
||||
export * from './IPurchaseOptions';
|
||||
export * from './MarketplaceOfferData';
|
||||
export * from './MarketplaceOfferState';
|
||||
export * from './MarketplaceSearchType';
|
||||
export * from './Offer';
|
||||
export * from './PageLocalization';
|
||||
export * from './PlacedObjectPurchaseData';
|
||||
export * from './Product';
|
||||
export * from './ProductTypeEnum';
|
||||
export * from './RequestedPage';
|
||||
export * from './SearchResult';
|
||||
@@ -0,0 +1,6 @@
|
||||
export class ChatEntryType
|
||||
{
|
||||
public static TYPE_CHAT = 1;
|
||||
public static TYPE_ROOM_INFO = 2;
|
||||
public static TYPE_IM = 3;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export const ChatHistoryCurrentDate = () =>
|
||||
{
|
||||
const currentTime = new Date();
|
||||
|
||||
return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`;
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
export interface IChatEntry
|
||||
{
|
||||
id: number;
|
||||
webId: number;
|
||||
entityId: number;
|
||||
name: string;
|
||||
look?: string;
|
||||
message?: string;
|
||||
entityType?: number;
|
||||
style?: number;
|
||||
chatType?: number;
|
||||
imageUrl?: string;
|
||||
color?: string;
|
||||
roomId: number;
|
||||
timestamp: string;
|
||||
type: number;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface IRoomHistoryEntry
|
||||
{
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export const MessengerHistoryCurrentDate = (secondsSinceNow: number = 0) =>
|
||||
{
|
||||
const currentTime = secondsSinceNow ? new Date(Date.now() - secondsSinceNow * 1000) : new Date();
|
||||
|
||||
return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
export * from './ChatEntryType';
|
||||
export * from './ChatHistoryCurrentDate';
|
||||
export * from './IChatEntry';
|
||||
export * from './IRoomHistoryEntry';
|
||||
export * from './MessengerHistoryCurrentDate';
|
||||
@@ -0,0 +1,3 @@
|
||||
import { IEventDispatcher, NitroEvent } from '@nitrots/nitro-renderer';
|
||||
|
||||
export const DispatchEvent = (eventDispatcher: IEventDispatcher, event: NitroEvent) => eventDispatcher.dispatchEvent(event);
|
||||
@@ -0,0 +1,4 @@
|
||||
import { GetEventDispatcher, NitroEvent } from '@nitrots/nitro-renderer';
|
||||
import { DispatchEvent } from './DispatchEvent';
|
||||
|
||||
export const DispatchMainEvent = (event: NitroEvent) => DispatchEvent(GetEventDispatcher(), event);
|
||||
@@ -0,0 +1,5 @@
|
||||
import { NitroEvent } from '@nitrots/nitro-renderer';
|
||||
import { DispatchEvent } from './DispatchEvent';
|
||||
import { UI_EVENT_DISPATCHER } from './UI_EVENT_DISPATCHER';
|
||||
|
||||
export const DispatchUiEvent = (event: NitroEvent) => DispatchEvent(UI_EVENT_DISPATCHER, event);
|
||||
@@ -0,0 +1,3 @@
|
||||
import { EventDispatcher, IEventDispatcher } from '@nitrots/nitro-renderer';
|
||||
|
||||
export const UI_EVENT_DISPATCHER: IEventDispatcher = new EventDispatcher();
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from './DispatchEvent';
|
||||
export * from './DispatchMainEvent';
|
||||
export * from './DispatchUiEvent';
|
||||
export * from './UI_EVENT_DISPATCHER';
|
||||
@@ -0,0 +1,13 @@
|
||||
import { IGroupChatData } from './IGroupChatData';
|
||||
|
||||
export const GetGroupChatData = (extraData: string) =>
|
||||
{
|
||||
if(!extraData || !extraData.length) return null;
|
||||
|
||||
const splitData = extraData.split('/');
|
||||
const username = splitData[0];
|
||||
const figure = splitData[1];
|
||||
const userId = parseInt(splitData[2]);
|
||||
|
||||
return ({ username: username, figure: figure, userId: userId } as IGroupChatData);
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
export interface IGroupChatData
|
||||
{
|
||||
username: string;
|
||||
figure: string;
|
||||
userId: number;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { FriendParser } from '@nitrots/nitro-renderer';
|
||||
|
||||
export class MessengerFriend
|
||||
{
|
||||
public static RELATIONSHIP_NONE: number = 0;
|
||||
public static RELATIONSHIP_HEART: number = 1;
|
||||
public static RELATIONSHIP_SMILE: number = 2;
|
||||
public static RELATIONSHIP_BOBBA: number = 3;
|
||||
|
||||
public id: number = -1;
|
||||
public name: string = null;
|
||||
public gender: number = 0;
|
||||
public online: boolean = false;
|
||||
public followingAllowed: boolean = false;
|
||||
public figure: string = null;
|
||||
public categoryId: number = 0;
|
||||
public motto: string = null;
|
||||
public realName: string = null;
|
||||
public lastAccess: string = null;
|
||||
public persistedMessageUser: boolean = false;
|
||||
public vipMember: boolean = false;
|
||||
public pocketHabboUser: boolean = false;
|
||||
public relationshipStatus: number = -1;
|
||||
public unread: number = 0;
|
||||
|
||||
public populate(parser: FriendParser): void
|
||||
{
|
||||
this.id = parser.id;
|
||||
this.name = parser.name;
|
||||
this.gender = parser.gender;
|
||||
this.online = parser.online;
|
||||
this.followingAllowed = parser.followingAllowed;
|
||||
this.figure = parser.figure;
|
||||
this.categoryId = parser.categoryId;
|
||||
this.motto = parser.motto;
|
||||
this.realName = parser.realName;
|
||||
this.lastAccess = parser.lastAccess;
|
||||
this.persistedMessageUser = parser.persistedMessageUser;
|
||||
this.vipMember = parser.vipMember;
|
||||
this.pocketHabboUser = parser.pocketHabboUser;
|
||||
this.relationshipStatus = parser.relationshipStatus;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export class MessengerGroupType
|
||||
{
|
||||
public static readonly GROUP_CHAT = 0;
|
||||
public static readonly PRIVATE_CHAT = 1;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export class MessengerIconState
|
||||
{
|
||||
public static HIDDEN: number = 0;
|
||||
public static SHOW: number = 1;
|
||||
public static UNREAD: number = 2;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { FriendRequestData } from '@nitrots/nitro-renderer';
|
||||
|
||||
export class MessengerRequest
|
||||
{
|
||||
private _id: number;
|
||||
private _name: string;
|
||||
private _requesterUserId: number;
|
||||
private _figureString: string;
|
||||
|
||||
public populate(data: FriendRequestData): boolean
|
||||
{
|
||||
if(!data) return false;
|
||||
|
||||
this._id = data.requestId;
|
||||
this._name = data.requesterName;
|
||||
this._figureString = data.figureString;
|
||||
this._requesterUserId = data.requesterUserId;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get requesterUserId(): number
|
||||
{
|
||||
return this._requesterUserId;
|
||||
}
|
||||
|
||||
public get figureString(): string
|
||||
{
|
||||
return this._figureString;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { FriendCategoryData } from '@nitrots/nitro-renderer';
|
||||
|
||||
export class MessengerSettings
|
||||
{
|
||||
constructor(
|
||||
public userFriendLimit: number = 0,
|
||||
public normalFriendLimit: number = 0,
|
||||
public extendedFriendLimit: number = 0,
|
||||
public categories: FriendCategoryData[] = [])
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import { GetGroupChatData } from './GetGroupChatData';
|
||||
import { MessengerFriend } from './MessengerFriend';
|
||||
import { MessengerGroupType } from './MessengerGroupType';
|
||||
import { MessengerThreadChat } from './MessengerThreadChat';
|
||||
import { MessengerThreadChatGroup } from './MessengerThreadChatGroup';
|
||||
|
||||
export class MessengerThread
|
||||
{
|
||||
public static MESSAGE_RECEIVED: string = 'MT_MESSAGE_RECEIVED';
|
||||
public static THREAD_ID: number = 0;
|
||||
|
||||
private _threadId: number;
|
||||
private _participant: MessengerFriend;
|
||||
private _groups: MessengerThreadChatGroup[];
|
||||
private _lastUpdated: Date;
|
||||
private _unreadCount: number;
|
||||
|
||||
constructor(participant: MessengerFriend)
|
||||
{
|
||||
this._threadId = ++MessengerThread.THREAD_ID;
|
||||
this._participant = participant;
|
||||
this._groups = [];
|
||||
this._lastUpdated = new Date();
|
||||
this._unreadCount = 0;
|
||||
}
|
||||
|
||||
public addMessage(senderId: number, message: string, secondsSinceSent: number = 0, extraData: string = null, type: number = 0): MessengerThreadChat
|
||||
{
|
||||
const isGroupChat = (senderId < 0 && extraData);
|
||||
const userId = isGroupChat ? GetGroupChatData(extraData).userId : senderId;
|
||||
|
||||
const group = this.getLastGroup(userId);
|
||||
|
||||
if(!group) return;
|
||||
|
||||
if(isGroupChat) group.type = MessengerGroupType.GROUP_CHAT;
|
||||
|
||||
const chat = new MessengerThreadChat(senderId, message, secondsSinceSent, extraData, type);
|
||||
|
||||
group.addChat(chat);
|
||||
|
||||
this._lastUpdated = new Date();
|
||||
|
||||
this._unreadCount++;
|
||||
|
||||
return chat;
|
||||
}
|
||||
|
||||
private getLastGroup(userId: number): MessengerThreadChatGroup
|
||||
{
|
||||
let group = this._groups[(this._groups.length - 1)];
|
||||
|
||||
if(group && (group.userId === userId)) return group;
|
||||
|
||||
group = new MessengerThreadChatGroup(userId);
|
||||
|
||||
this._groups.push(group);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
public setRead(): void
|
||||
{
|
||||
this._unreadCount = 0;
|
||||
}
|
||||
|
||||
public get threadId(): number
|
||||
{
|
||||
return this._threadId;
|
||||
}
|
||||
|
||||
public get participant(): MessengerFriend
|
||||
{
|
||||
return this._participant;
|
||||
}
|
||||
|
||||
public get groups(): MessengerThreadChatGroup[]
|
||||
{
|
||||
return this._groups;
|
||||
}
|
||||
|
||||
public get lastUpdated(): Date
|
||||
{
|
||||
return this._lastUpdated;
|
||||
}
|
||||
|
||||
public get unreadCount(): number
|
||||
{
|
||||
return this._unreadCount;
|
||||
}
|
||||
|
||||
public get unread(): boolean
|
||||
{
|
||||
return (this._unreadCount > 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
export class MessengerThreadChat
|
||||
{
|
||||
public static CHAT: number = 0;
|
||||
public static ROOM_INVITE: number = 1;
|
||||
public static STATUS_NOTIFICATION: number = 2;
|
||||
public static SECURITY_NOTIFICATION: number = 3;
|
||||
|
||||
private _type: number;
|
||||
private _senderId: number;
|
||||
private _message: string;
|
||||
private _secondsSinceSent: number;
|
||||
private _extraData: string;
|
||||
private _date: Date;
|
||||
|
||||
constructor(senderId: number, message: string, secondsSinceSent: number = 0, extraData: string = null, type: number = 0)
|
||||
{
|
||||
this._type = type;
|
||||
this._senderId = senderId;
|
||||
this._message = message;
|
||||
this._secondsSinceSent = secondsSinceSent;
|
||||
this._extraData = extraData;
|
||||
this._date = new Date();
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public get senderId(): number
|
||||
{
|
||||
return this._senderId;
|
||||
}
|
||||
|
||||
public get message(): string
|
||||
{
|
||||
return this._message;
|
||||
}
|
||||
|
||||
public get secondsSinceSent(): number
|
||||
{
|
||||
return this._secondsSinceSent;
|
||||
}
|
||||
|
||||
public get extraData(): string
|
||||
{
|
||||
return this._extraData;
|
||||
}
|
||||
|
||||
public get date(): Date
|
||||
{
|
||||
return this._date;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { MessengerGroupType } from './MessengerGroupType';
|
||||
import { MessengerThreadChat } from './MessengerThreadChat';
|
||||
|
||||
export class MessengerThreadChatGroup
|
||||
{
|
||||
private _userId: number;
|
||||
private _chats: MessengerThreadChat[];
|
||||
private _type: number;
|
||||
|
||||
constructor(userId: number, type = MessengerGroupType.PRIVATE_CHAT)
|
||||
{
|
||||
this._userId = userId;
|
||||
this._chats = [];
|
||||
this._type = type;
|
||||
}
|
||||
|
||||
public addChat(message: MessengerThreadChat): void
|
||||
{
|
||||
this._chats.push(message);
|
||||
}
|
||||
|
||||
public get userId(): number
|
||||
{
|
||||
return this._userId;
|
||||
}
|
||||
|
||||
public get chats(): MessengerThreadChat[]
|
||||
{
|
||||
return this._chats;
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public set type(type: number)
|
||||
{
|
||||
this._type = type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { CreateLinkEvent } from '@nitrots/nitro-renderer';
|
||||
|
||||
export function OpenMessengerChat(friendId: number = 0): void
|
||||
{
|
||||
if(friendId === 0) CreateLinkEvent('friends-messenger/toggle');
|
||||
else CreateLinkEvent(`friends-messenger/${ friendId }`);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export * from './GetGroupChatData';
|
||||
export * from './IGroupChatData';
|
||||
export * from './MessengerFriend';
|
||||
export * from './MessengerGroupType';
|
||||
export * from './MessengerIconState';
|
||||
export * from './MessengerRequest';
|
||||
export * from './MessengerSettings';
|
||||
export * from './MessengerThread';
|
||||
export * from './MessengerThreadChat';
|
||||
export * from './MessengerThreadChatGroup';
|
||||
export * from './OpenMessengerChat';
|
||||
@@ -0,0 +1,7 @@
|
||||
import { GroupInformationComposer } from '@nitrots/nitro-renderer';
|
||||
import { SendMessageComposer } from '../nitro';
|
||||
|
||||
export function GetGroupInformation(groupId: number): void
|
||||
{
|
||||
SendMessageComposer(new GroupInformationComposer(groupId, true));
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { CreateLinkEvent } from '@nitrots/nitro-renderer';
|
||||
|
||||
export function GetGroupManager(groupId: number): void
|
||||
{
|
||||
CreateLinkEvent(`groups/manage/${ groupId }`);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { CreateLinkEvent } from '@nitrots/nitro-renderer';
|
||||
|
||||
export function GetGroupMembers(groupId: number, levelId?: number): void
|
||||
{
|
||||
if(!levelId) CreateLinkEvent(`group-members/${ groupId }`);
|
||||
else CreateLinkEvent(`group-members/${ groupId }/${ levelId }`);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
export class GroupBadgePart
|
||||
{
|
||||
public static BASE: string = 'b';
|
||||
public static SYMBOL: string = 's';
|
||||
|
||||
public type: string;
|
||||
public key: number;
|
||||
public color: number;
|
||||
public position: number;
|
||||
|
||||
constructor(type: string, key?: number, color?: number, position?: number)
|
||||
{
|
||||
this.type = type;
|
||||
this.key = key ? key : 0;
|
||||
this.color = color ? color : 0;
|
||||
this.position = position ? position : 4;
|
||||
}
|
||||
|
||||
public get code(): string
|
||||
{
|
||||
if((this.key === 0) && (this.type !== GroupBadgePart.BASE)) return null;
|
||||
|
||||
return GroupBadgePart.getCode(this.type, this.key, this.color, this.position);
|
||||
}
|
||||
|
||||
public static getCode(type: string, key: number, color: number, position: number): string
|
||||
{
|
||||
return type + (key < 10 ? '0' : '') + key + (color < 10 ? '0' : '') + color + position;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export class GroupMembershipType
|
||||
{
|
||||
public static NOT_MEMBER: number = 0;
|
||||
public static MEMBER: number = 1;
|
||||
public static REQUEST_PENDING: number = 2;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export class GroupType
|
||||
{
|
||||
public static REGULAR: number = 0;
|
||||
public static EXCLUSIVE: number = 1;
|
||||
public static PRIVATE: number = 2;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export interface IGroupCustomize
|
||||
{
|
||||
badgeBases: { id: number, images: string[] }[];
|
||||
badgeSymbols: { id: number, images: string[] }[];
|
||||
badgePartColors: { id: number, color: string }[];
|
||||
groupColorsA: { id: number, color: string }[];
|
||||
groupColorsB: { id: number, color: string }[];
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { GroupBadgePart } from './GroupBadgePart';
|
||||
|
||||
export interface IGroupData
|
||||
{
|
||||
groupId: number;
|
||||
groupName: string;
|
||||
groupDescription: string;
|
||||
groupHomeroomId: number;
|
||||
groupState: number;
|
||||
groupCanMembersDecorate: boolean;
|
||||
groupColors: number[];
|
||||
groupBadgeParts: GroupBadgePart[];
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { GroupFavoriteComposer, GroupUnfavoriteComposer, HabboGroupEntryData } from '@nitrots/nitro-renderer';
|
||||
import { SendMessageComposer } from '../nitro';
|
||||
|
||||
export const ToggleFavoriteGroup = (group: HabboGroupEntryData) =>
|
||||
{
|
||||
SendMessageComposer(group.favourite ? new GroupUnfavoriteComposer(group.groupId) : new GroupFavoriteComposer(group.groupId));
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
import { GroupJoinComposer } from '@nitrots/nitro-renderer';
|
||||
import { SendMessageComposer } from '../nitro';
|
||||
|
||||
export const TryJoinGroup = (groupId: number) => SendMessageComposer(new GroupJoinComposer(groupId));
|
||||
@@ -0,0 +1,10 @@
|
||||
export * from './GetGroupInformation';
|
||||
export * from './GetGroupManager';
|
||||
export * from './GetGroupMembers';
|
||||
export * from './GroupBadgePart';
|
||||
export * from './GroupMembershipType';
|
||||
export * from './GroupType';
|
||||
export * from './IGroupCustomize';
|
||||
export * from './IGroupData';
|
||||
export * from './ToggleFavoriteGroup';
|
||||
export * from './TryJoinGroup';
|
||||
@@ -0,0 +1,23 @@
|
||||
export class GuideSessionState
|
||||
{
|
||||
public static readonly NONE: string = 'NONE';
|
||||
public static readonly ERROR: string = 'ERROR';
|
||||
public static readonly REJECTED: string = 'REJECTED';
|
||||
public static readonly USER_CREATE: string = 'USER_CREATE';
|
||||
public static readonly USER_PENDING: string = 'USER_PENDING';
|
||||
public static readonly USER_ONGOING: string = 'USER_ONGOING';
|
||||
public static readonly USER_FEEDBACK: string = 'USER_FEEDBACK';
|
||||
public static readonly USER_NO_HELPERS: string = 'USER_NO_HELPERS';
|
||||
public static readonly USER_SOMETHING_WRONG: string = 'USER_SOMETHING_WRONG';
|
||||
public static readonly USER_THANKS: string = 'USER_THANKS';
|
||||
public static readonly USER_GUIDE_DISCONNECTED: string = 'USER_GUIDE_DISCONNECTED';
|
||||
public static readonly GUIDE_TOOL_MENU: string = 'GUIDE_TOOL_MENU';
|
||||
public static readonly GUIDE_ACCEPT: string = 'GUIDE_ACCEPT';
|
||||
public static readonly GUIDE_ONGOING: string = 'GUIDE_ONGOING';
|
||||
public static readonly GUIDE_CLOSED: string = 'GUIDE_CLOSED';
|
||||
public static readonly GUARDIAN_CHAT_REVIEW_ACCEPT: string = 'GUARDIAN_CHAT_REVIEW_ACCEPT';
|
||||
public static readonly GUARDIAN_CHAT_REVIEW_WAIT_FOR_VOTERS: string = 'GUARDIAN_CHAT_REVIEW_WAIT_FOR_VOTERS';
|
||||
public static readonly GUARDIAN_CHAT_REVIEW_VOTE: string = 'GUARDIAN_CHAT_REVIEW_VOTE';
|
||||
public static readonly GUARDIAN_CHAT_REVIEW_WAIT_FOR_RESULTS: string = 'GUARDIAN_CHAT_REVIEW_WAIT_FOR_RESULTS';
|
||||
public static readonly GUARDIAN_CHAT_REVIEW_RESULTS: string = 'GUARDIAN_CHAT_REVIEW_RESULTS';
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
export class GuideToolMessage
|
||||
{
|
||||
private _message: string;
|
||||
private _roomId: number;
|
||||
|
||||
constructor(message: string, roomId?: number)
|
||||
{
|
||||
this._message = message;
|
||||
this._roomId = roomId;
|
||||
}
|
||||
|
||||
public get message(): string
|
||||
{
|
||||
return this._message;
|
||||
}
|
||||
|
||||
public get roomId(): number
|
||||
{
|
||||
return this._roomId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { GuideToolMessage } from './GuideToolMessage';
|
||||
|
||||
export class GuideToolMessageGroup
|
||||
{
|
||||
private _userId: number;
|
||||
private _messages: GuideToolMessage[];
|
||||
|
||||
constructor(userId: number)
|
||||
{
|
||||
this._userId = userId;
|
||||
this._messages = [];
|
||||
}
|
||||
|
||||
public addChat(message: GuideToolMessage): void
|
||||
{
|
||||
this._messages.push(message);
|
||||
}
|
||||
|
||||
public get userId(): number
|
||||
{
|
||||
return this._userId;
|
||||
}
|
||||
|
||||
public get messages(): GuideToolMessage[]
|
||||
{
|
||||
return this._messages;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './GuideSessionState';
|
||||
export * from './GuideToolMessage';
|
||||
export * from './GuideToolMessageGroup';
|
||||
@@ -0,0 +1,6 @@
|
||||
export class ClubStatus
|
||||
{
|
||||
public static ACTIVE: string = 'active';
|
||||
public static NONE: string = 'none';
|
||||
public static EXPIRED: string = 'expired';
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
const DEFAULT_BADGE: string = 'HC1';
|
||||
const BADGES: string[] = [ 'ACH_VipHC1', 'ACH_VipHC2', 'ACH_VipHC3', 'ACH_VipHC4', 'ACH_VipHC5', 'HC1', 'HC2', 'HC3', 'HC4', 'HC5' ];
|
||||
|
||||
export const GetClubBadge = (badgeCodes: string[]) =>
|
||||
{
|
||||
let badgeCode: string = null;
|
||||
|
||||
BADGES.forEach(badge => ((badgeCodes.indexOf(badge) > -1) && (badgeCode = badge)));
|
||||
|
||||
return (badgeCode || DEFAULT_BADGE);
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './ClubStatus';
|
||||
export * from './GetClubBadge';
|
||||
@@ -0,0 +1,5 @@
|
||||
export class CallForHelpResult
|
||||
{
|
||||
public static readonly TOO_MANY_PENDING_CALLS_CODE = 1;
|
||||
public static readonly HAS_ABUSIVE_CALL_CODE = 2;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export const GetCloseReasonKey = (code: number) =>
|
||||
{
|
||||
if(code === 1) return 'useless';
|
||||
|
||||
if(code === 2) return 'abusive';
|
||||
|
||||
return 'resolved';
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
import { IChatEntry } from '../chat-history';
|
||||
|
||||
export interface IHelpReport
|
||||
{
|
||||
reportType: number;
|
||||
reportedUserId: number;
|
||||
reportedChats: IChatEntry[];
|
||||
cfhCategory: number;
|
||||
cfhTopic: number;
|
||||
roomId: number;
|
||||
roomName: string;
|
||||
groupId: number;
|
||||
threadId: number;
|
||||
messageId: number;
|
||||
extraData: string;
|
||||
roomObjectId: number;
|
||||
message: string;
|
||||
currentStep: number;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface IReportedUser
|
||||
{
|
||||
id: number;
|
||||
username: string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export class ReportState
|
||||
{
|
||||
public static readonly SELECT_USER = 0;
|
||||
public static readonly SELECT_CHATS = 1;
|
||||
public static readonly SELECT_TOPICS = 2;
|
||||
public static readonly INPUT_REPORT_MESSAGE = 3;
|
||||
public static readonly REPORT_SUMMARY = 4;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export class ReportType
|
||||
{
|
||||
public static readonly EMERGENCY = 1;
|
||||
public static readonly GUIDE = 2;
|
||||
public static readonly IM = 3;
|
||||
public static readonly ROOM = 4;
|
||||
public static readonly BULLY = 6;
|
||||
public static readonly THREAD = 7;
|
||||
public static readonly MESSAGE = 8;
|
||||
public static readonly PHOTO = 9;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from './CallForHelpResult';
|
||||
export * from './GetCloseReasonKey';
|
||||
export * from './IHelpReport';
|
||||
export * from './IReportedUser';
|
||||
export * from './ReportState';
|
||||
export * from './ReportType';
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user