mirror of
https://github.com/billsonnn/nitro-converter.git
synced 2024-11-22 23:50:52 +01:00
Fix .gitignore
This commit is contained in:
parent
cb3e27071e
commit
cca7ac6a26
2
.gitignore
vendored
2
.gitignore
vendored
@ -51,7 +51,7 @@ Thumbs.db
|
||||
*.as
|
||||
*.bin
|
||||
.env
|
||||
assets/
|
||||
/assets
|
||||
|
||||
# Nitro
|
||||
/src/configuration.json
|
||||
|
61
src/common/mapping/xml/asset/assets/AssetXML.ts
Normal file
61
src/common/mapping/xml/asset/assets/AssetXML.ts
Normal file
@ -0,0 +1,61 @@
|
||||
export class AssetXML
|
||||
{
|
||||
private readonly _name: string;
|
||||
private readonly _source: string;
|
||||
private readonly _x: number;
|
||||
private readonly _y: number;
|
||||
private readonly _flipH: boolean;
|
||||
private readonly _flipV: boolean;
|
||||
private readonly _usesPalette: boolean;
|
||||
|
||||
constructor(asset: any)
|
||||
{
|
||||
const attributes = asset.$;
|
||||
|
||||
if(attributes !== undefined)
|
||||
{
|
||||
if(attributes.name !== undefined) this._name = attributes.name;
|
||||
if(attributes.source !== undefined) this._source = attributes.source;
|
||||
if(attributes.x !== undefined) this._x = parseInt(attributes.x);
|
||||
if(attributes.x !== undefined) this._y = parseInt(attributes.y);
|
||||
if(attributes.flipH !== undefined) this._flipH = (attributes.flipH === '1');
|
||||
if(attributes.flipV !== undefined) this._flipV = (attributes.flipV === '1');
|
||||
if(attributes.usesPalette !== undefined) this._usesPalette = (attributes.usesPalette === '1');
|
||||
}
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get source(): string
|
||||
{
|
||||
return this._source;
|
||||
}
|
||||
|
||||
public get x(): number
|
||||
{
|
||||
return this._x;
|
||||
}
|
||||
|
||||
public get y(): number
|
||||
{
|
||||
return this._y;
|
||||
}
|
||||
|
||||
public get flipH(): boolean
|
||||
{
|
||||
return this._flipH;
|
||||
}
|
||||
|
||||
public get flipV(): boolean
|
||||
{
|
||||
return this._flipV;
|
||||
}
|
||||
|
||||
public get usesPalette(): boolean
|
||||
{
|
||||
return this._usesPalette;
|
||||
}
|
||||
}
|
41
src/common/mapping/xml/asset/assets/AssetsXML.ts
Normal file
41
src/common/mapping/xml/asset/assets/AssetsXML.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { AssetXML } from './AssetXML';
|
||||
import { PaletteXML } from './PaletteXML';
|
||||
|
||||
export class AssetsXML
|
||||
{
|
||||
private readonly _assets: AssetXML[];
|
||||
private readonly _palettes: PaletteXML[];
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
if(xml.asset !== undefined)
|
||||
{
|
||||
if(Array.isArray(xml.asset))
|
||||
{
|
||||
this._assets = [];
|
||||
|
||||
for(const asset of xml.asset) this._assets.push(new AssetXML(asset));
|
||||
}
|
||||
}
|
||||
|
||||
if(xml.palette !== undefined)
|
||||
{
|
||||
if(Array.isArray(xml.palette))
|
||||
{
|
||||
this._palettes = [];
|
||||
|
||||
for(const palette of xml.palette) this._palettes.push(new PaletteXML(palette));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public get assets(): AssetXML[]
|
||||
{
|
||||
return this._assets;
|
||||
}
|
||||
|
||||
public get palettes(): PaletteXML[]
|
||||
{
|
||||
return this._palettes;
|
||||
}
|
||||
}
|
68
src/common/mapping/xml/asset/assets/PaletteXML.ts
Normal file
68
src/common/mapping/xml/asset/assets/PaletteXML.ts
Normal file
@ -0,0 +1,68 @@
|
||||
export class PaletteXML
|
||||
{
|
||||
private readonly _id: number;
|
||||
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 _color2: string;
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
const attributes = xml.$;
|
||||
|
||||
if(attributes)
|
||||
{
|
||||
if(attributes.id !== undefined) this._id = parseInt(attributes.id);
|
||||
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.color2 !== undefined) this._color2 = attributes.color2;
|
||||
}
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get source(): string
|
||||
{
|
||||
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
|
||||
{
|
||||
return this._color1;
|
||||
}
|
||||
|
||||
public get color2(): string
|
||||
{
|
||||
return this._color2;
|
||||
}
|
||||
}
|
3
src/common/mapping/xml/asset/assets/index.ts
Normal file
3
src/common/mapping/xml/asset/assets/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './AssetsXML';
|
||||
export * from './AssetXML';
|
||||
export * from './PaletteXML';
|
Loading…
Reference in New Issue
Block a user