Pet updates

This commit is contained in:
Bill 2021-07-10 21:51:48 -04:00
parent 8ba4a1614d
commit 0dafdbd86e
8 changed files with 53 additions and 9 deletions

View File

@ -13,6 +13,8 @@ import { FurnitureDataDownloader } from './FurnitureDataDownloader';
@singleton() @singleton()
export class FurnitureDataConverter extends Converter export class FurnitureDataConverter extends Converter
{ {
public furnitureData: IFurnitureData = null;
constructor( constructor(
private readonly _furnitureDataDownloader: FurnitureDataDownloader, private readonly _furnitureDataDownloader: FurnitureDataDownloader,
private readonly _configuration: Configuration, private readonly _configuration: Configuration,
@ -47,8 +49,14 @@ export class FurnitureDataConverter extends Converter
const furnitureData = await this.mapXML2JSON(xml); const furnitureData = await this.mapXML2JSON(xml);
this.furnitureData = furnitureData;
furnitureDataString = JSON.stringify(furnitureData); furnitureDataString = JSON.stringify(furnitureData);
} }
else
{
this.furnitureData = JSON.parse(furnitureDataString);
}
const path = directory.path + '/FurnitureData.json'; const path = directory.path + '/FurnitureData.json';

View File

@ -3,9 +3,9 @@ import { IAsset } from './IAsset';
import { IAssetAlias } from './IAssetAlias'; import { IAssetAlias } from './IAssetAlias';
import { IAssetDimension } from './IAssetDimension'; import { IAssetDimension } from './IAssetDimension';
import { IAssetPalette } from './IAssetPalette'; import { IAssetPalette } from './IAssetPalette';
import { ISoundSample } from './ISoundSample';
import { ISpritesheetData } from './spritesheet'; import { ISpritesheetData } from './spritesheet';
import { IAssetVisualizationData } from './visualization'; import { IAssetVisualizationData } from './visualization';
import {ISoundSample} from "./ISoundSample";
export interface IAssetData { export interface IAssetData {
type?: string; type?: string;

View File

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

View File

@ -1,4 +1,5 @@
export interface ISoundSample { export interface ISoundSample
id?: number, {
noPitch?: boolean id?: number;
noPitch?: boolean;
} }

View File

@ -84,6 +84,10 @@ export class AssetMapper extends Mapper
if(paletteXML.id !== undefined) palette.id = paletteXML.id; if(paletteXML.id !== undefined) palette.id = paletteXML.id;
if(paletteXML.source !== undefined) palette.source = paletteXML.source; if(paletteXML.source !== undefined) palette.source = paletteXML.source;
if(paletteXML.master !== undefined) palette.master = paletteXML.master;
if(paletteXML.tags !== undefined) palette.tags = paletteXML.tags;
if(paletteXML.breed !== undefined) palette.breed = paletteXML.breed;
if(paletteXML.colorTag !== undefined) palette.colorTag = paletteXML.colorTag;
if(paletteXML.color1 !== undefined) palette.color1 = paletteXML.color1; if(paletteXML.color1 !== undefined) palette.color1 = paletteXML.color1;
if(paletteXML.color2 !== undefined) palette.color2 = paletteXML.color2; if(paletteXML.color2 !== undefined) palette.color2 = paletteXML.color2;

View File

@ -1,7 +1,6 @@
import {IAssetData} from '../../json'; import { IAssetData } from '../../json';
import {LogicXML} from '../../xml'; import { LogicXML } from '../../xml';
import {Mapper} from './Mapper'; import { Mapper } from './Mapper';
import {ISoundSample} from "../../json/asset/ISoundSample";
export class LogicMapper extends Mapper export class LogicMapper extends Mapper
{ {

View File

@ -2,6 +2,10 @@ export class PaletteXML
{ {
private readonly _id: number; private readonly _id: number;
private readonly _source: string; private readonly _source: string;
private readonly _master: boolean;
private readonly _tags: string[];
private readonly _breed: number;
private readonly _colorTag: number;
private readonly _color1: string; private readonly _color1: string;
private readonly _color2: string; private readonly _color2: string;
@ -13,6 +17,10 @@ export class PaletteXML
{ {
if(attributes.id !== undefined) this._id = parseInt(attributes.id); if(attributes.id !== undefined) this._id = parseInt(attributes.id);
if(attributes.source !== undefined) this._source = attributes.source; if(attributes.source !== undefined) this._source = attributes.source;
if(attributes.master !== undefined) this._master = (attributes.master === 'true') ? true : false;
if(attributes.tags !== undefined) this._tags = attributes.tags.split(',');
if(attributes.breed !== undefined) this._breed = parseInt(attributes.breed);
if(attributes.colortag !== undefined) this._colorTag = parseInt(attributes.colortag);
if(attributes.color1 !== undefined) this._color1 = attributes.color1; if(attributes.color1 !== undefined) this._color1 = attributes.color1;
if(attributes.color2 !== undefined) this._color2 = attributes.color2; if(attributes.color2 !== undefined) this._color2 = attributes.color2;
} }
@ -28,6 +36,26 @@ export class PaletteXML
return this._source; return this._source;
} }
public get master(): boolean
{
return this._master;
}
public get tags(): string[]
{
return this._tags;
}
public get breed(): number
{
return this._breed;
}
public get colorTag(): number
{
return this._colorTag;
}
public get color1(): string public get color1(): string
{ {
return this._color1; return this._color1;

View File

@ -12,7 +12,7 @@ export class DimensionsXML
{ {
if(attributes.x !== undefined) this._x = parseInt(attributes.x); if(attributes.x !== undefined) this._x = parseInt(attributes.x);
if(attributes.y !== undefined) this._y = parseInt(attributes.y); if(attributes.y !== undefined) this._y = parseInt(attributes.y);
if(attributes.z !== undefined) this._z = parseInt(attributes.z); if(attributes.z !== undefined) this._z = parseFloat(attributes.z);
} }
} }