Add missing pet data

This commit is contained in:
Bill 2021-07-10 22:45:05 -04:00
parent a62df1f59a
commit 17062cb786
4 changed files with 34 additions and 2 deletions

View File

@ -2,6 +2,10 @@ export interface IAssetPalette
{
id?: number;
source?: string;
master?: boolean;
tags?: string[];
breed?: number;
colorTag?: number;
color1?: string;
color2?: string;
rgb?: [ number, number, number ][];

View File

@ -77,6 +77,7 @@ export interface IRoomEngine extends INitroManager
selectRoomObject(roomId: number, objectId: number, objectCategory: number): void;
cancelRoomObjectInsert(): void;
getPetColorResult(petIndex: number, paletteIndex: number): PetColorResult;
getPetColorResultsForTag(petIndex: number, tagName: string): PetColorResult[];
cancelRoomObjectPlacement(): void;
getFurnitureFloorName(typeId: number): string;
useRoomObject(objectId: number, category: number): boolean;

View File

@ -262,6 +262,22 @@ export class RoomContentLoader implements IFurnitureDataListener
return colorResults.get(paletteIndex);
}
public getPetColorResultsForTag(petIndex: number, tagName: string): PetColorResult[]
{
const colorResults = this._petColors.get(petIndex);
const results: PetColorResult[] = [];
if(colorResults)
{
for(const result of colorResults.values())
{
if(result.tag === tagName) results.push(result);
}
}
return results;
}
public getCollection(name: string): IGraphicAssetCollection
{
if(!name) return null;
@ -327,12 +343,16 @@ export class RoomContentLoader implements IFurnitureDataListener
for(const key of keys)
{
const palette = collection.getPalette(key);
const paletteData = data.palettes[key];
const breed = 0;
const primaryColor = palette.primaryColor;
const secondaryColor = palette.secondaryColor;
const breed = ((paletteData.breed !== undefined) ? paletteData.breed : 0);
const tag = ((paletteData.colorTag !== undefined) ? paletteData.colorTag : -1);
const master = ((paletteData.master !== undefined) ? paletteData.master : false);
const layerTags = ((paletteData.tags !== undefined) ? paletteData.tags : []);
palettes.set(parseInt(key), new PetColorResult(primaryColor, secondaryColor, breed, -1, key, false, []));
palettes.set(parseInt(key), new PetColorResult(primaryColor, secondaryColor, breed, tag, key, master, layerTags));
}
this._petColors.set(petIndex, palettes);

View File

@ -3551,6 +3551,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
return this._roomContentLoader.getPetColorResult(petIndex, paletteIndex);
}
public getPetColorResultsForTag(petIndex: number, tagName: string): PetColorResult[]
{
if(!this._roomContentLoader) return null;
return this._roomContentLoader.getPetColorResultsForTag(petIndex, tagName);
}
public modifyRoomObjectData(objectId: number, objectCategory: number, colorHex: string, text: string): boolean
{
if(!this._roomObjectEventHandler || (objectCategory !== RoomObjectCategory.WALL)) return false;