1
0
forked from 0ad/0ad
0ad/binaries/data/mods/public/simulation/components/Loot.js
fcxSanya 7499b23991 Units promotion. Closes #697.
This was SVN commit r9391.
2011-05-02 15:03:01 +00:00

38 lines
970 B
JavaScript

function Loot() {}
Loot.prototype.Schema =
"<optional>" +
"<element name='xp'><data type='nonNegativeInteger'/></element>" +
"</optional>" +
"<optional>" +
"<element name='food'><data type='nonNegativeInteger'/></element>" +
"</optional>" +
"<optional>" +
"<element name='wood'><data type='nonNegativeInteger'/></element>" +
"</optional>" +
"<optional>" +
"<element name='stone'><data type='nonNegativeInteger'/></element>" +
"</optional>" +
"<optional>" +
"<element name='metal'><data type='nonNegativeInteger'/></element>" +
"</optional>";
Loot.prototype.Serialize = null; // we have no dynamic state to save
Loot.prototype.GetXp = function()
{
return this.template.xp;
};
Loot.prototype.GetResources = function()
{
return {
"food": +(this.template.food || 0),
"wood": +(this.template.wood || 0),
"metal": +(this.template.metal || 0),
"stone": +(this.template.stone || 0)
};
};
Engine.RegisterComponentType(IID_Loot, "Loot", Loot);