Index: binaries/data/mods/public/art/actors/units/celts/infantry_javelinist_a.xml
===================================================================
--- binaries/data/mods/public/art/actors/units/celts/infantry_javelinist_a.xml	(revision 8776)
+++ binaries/data/mods/public/art/actors/units/celts/infantry_javelinist_a.xml	(working copy)
@@ -33,6 +33,7 @@
         <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
         <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
         <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
+		<animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
       </animations>
       <mesh>skeletal/m_pants.dae</mesh>
       <props>
Index: binaries/data/mods/public/art/actors/units/celts/infantry_javelinist_e.xml
===================================================================
--- binaries/data/mods/public/art/actors/units/celts/infantry_javelinist_e.xml	(revision 8776)
+++ binaries/data/mods/public/art/actors/units/celts/infantry_javelinist_e.xml	(working copy)
@@ -31,6 +31,7 @@
         <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
         <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
         <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
+		<animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
       </animations>
       <mesh>skeletal/m_tights.dae</mesh>
       <props>
Index: binaries/data/mods/public/art/actors/units/celts/infantry_spearman_a.xml
===================================================================
--- binaries/data/mods/public/art/actors/units/celts/infantry_spearman_a.xml	(revision 8776)
+++ binaries/data/mods/public/art/actors/units/celts/infantry_spearman_a.xml	(working copy)
@@ -30,6 +30,7 @@
         <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
         <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
         <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
+		<animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
       </animations>
       <mesh>skeletal/m_pants_celt.dae</mesh>
       <props>
Index: binaries/data/mods/public/art/actors/units/celts/infantry_spearman_e.xml
===================================================================
--- binaries/data/mods/public/art/actors/units/celts/infantry_spearman_e.xml	(revision 8776)
+++ binaries/data/mods/public/art/actors/units/celts/infantry_spearman_e.xml	(working copy)
@@ -31,6 +31,7 @@
         <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
         <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
         <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
+		<animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
       </animations>
       <mesh>skeletal/m_pants_celt.dae</mesh>
       <props>
Index: binaries/data/mods/public/art/actors/units/hellenes/infantry_archer_a.xml
===================================================================
--- binaries/data/mods/public/art/actors/units/hellenes/infantry_archer_a.xml	(revision 8776)
+++ binaries/data/mods/public/art/actors/units/hellenes/infantry_archer_a.xml	(working copy)
@@ -28,6 +28,7 @@
         <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
         <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
         <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
+		<animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
       </animations>
       <mesh>skeletal/m_tunic_short.dae</mesh>
       <props>
Index: binaries/data/mods/public/art/actors/units/hellenes/infantry_archer_e.xml
===================================================================
--- binaries/data/mods/public/art/actors/units/hellenes/infantry_archer_e.xml	(revision 8776)
+++ binaries/data/mods/public/art/actors/units/hellenes/infantry_archer_e.xml	(working copy)
@@ -27,6 +27,7 @@
         <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
         <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
         <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
+		<animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
       </animations>
       <mesh>skeletal/m_tunic_long.dae</mesh>
       <props>
Index: binaries/data/mods/public/art/actors/units/hellenes/infantry_javelinist_a.xml
===================================================================
--- binaries/data/mods/public/art/actors/units/hellenes/infantry_javelinist_a.xml	(revision 8776)
+++ binaries/data/mods/public/art/actors/units/hellenes/infantry_javelinist_a.xml	(working copy)
@@ -30,6 +30,7 @@
 		<animation file="infantry/general/death/inf_05.psa" name="Death" speed="600"/>
         <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
         <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
+		<animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
       </animations>
       <props>
         <prop actor="props/units/heads/floppy_b.xml" attachpoint="helmet"/>
Index: binaries/data/mods/public/art/actors/units/hellenes/infantry_javelinist_e.xml
===================================================================
--- binaries/data/mods/public/art/actors/units/hellenes/infantry_javelinist_e.xml	(revision 8776)
+++ binaries/data/mods/public/art/actors/units/hellenes/infantry_javelinist_e.xml	(working copy)
@@ -30,6 +30,7 @@
         <animation file="infantry/general/death/inf_05.psa" name="Death" speed="600"/>
         <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
         <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
+		<animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
       </animations>
       <mesh>skeletal/m_tunic_long.dae</mesh>
       <props>
Index: binaries/data/mods/public/art/actors/units/hellenes/infantry_spearman_a.xml
===================================================================
--- binaries/data/mods/public/art/actors/units/hellenes/infantry_spearman_a.xml	(revision 8776)
+++ binaries/data/mods/public/art/actors/units/hellenes/infantry_spearman_a.xml	(working copy)
@@ -27,6 +27,7 @@
         <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
         <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
         <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
+		<animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
       </animations>
       <mesh>skeletal/m_tunic_short.dae</mesh>
       <props>
Index: binaries/data/mods/public/art/actors/units/hellenes/infantry_spearman_e.xml
===================================================================
--- binaries/data/mods/public/art/actors/units/hellenes/infantry_spearman_e.xml	(revision 8776)
+++ binaries/data/mods/public/art/actors/units/hellenes/infantry_spearman_e.xml	(working copy)
@@ -27,6 +27,7 @@
         <animation file="infantry/general/death/inf_04.psa" name="Death" speed="400"/>
         <animation file="infantry/general/death/inf_06.psa" name="Death" speed="500"/>
         <animation file="infantry/general/death/inf_07.psa" name="Death" speed="400"/>
+		<animation file="biped/not used/inf_salute_c.psa" name="Promotion" speed="288"/>
       </animations>
       <mesh>skeletal/m_tunic_short.dae</mesh>
       <props>
Index: binaries/data/mods/public/gui/session/selection.js
===================================================================
--- binaries/data/mods/public/gui/session/selection.js	(revision 8776)
+++ binaries/data/mods/public/gui/session/selection.js	(working copy)
@@ -190,6 +190,7 @@
 // Update the selection to take care of changes (like units that have been killed)
 EntitySelection.prototype.update = function()
 {
+	this.checkRenamedEntities();
 	for each (var ent in this.selected)
 	{
 		var entState = GetEntityState(ent);
@@ -218,6 +219,31 @@
 	}
 };
 
+/**
+ * Update selection if some selected entities was renamed 
+ * (in case of unit promotion or finishing building structure)
+ */
+EntitySelection.prototype.checkRenamedEntities = function()
+{
+	var renamedEntities = Engine.GuiInterfaceCall("GetRenamedEntities", true);
+	if (renamedEntities.length > 0)
+	{
+		var selectedEntities = this.toList();
+		var removeFromSelectionList = [];
+		var addToSelectionList = [];
+		for each (var renamedEntity in renamedEntities)
+		{
+			if (selectedEntities.indexOf(renamedEntity.oldEntityId) != -1)
+			{
+				removeFromSelectionList.push(renamedEntity.oldEntityId);
+				addToSelectionList.push(renamedEntity.newEntityId);
+			}
+		}
+		this.removeList(removeFromSelectionList);
+		this.addList(addToSelectionList);
+	}
+}
+
 EntitySelection.prototype.addList = function(ents)
 {
 	var selectionSize = this.toList().length;
Index: binaries/data/mods/public/gui/session/selection_details.js
===================================================================
--- binaries/data/mods/public/gui/session/selection_details.js	(revision 8776)
+++ binaries/data/mods/public/gui/session/selection_details.js	(working copy)
@@ -65,7 +65,25 @@
 	{
 		getGUIObjectByName("health").hidden = true;
 	}
+	
+	// Experience
+	if (entState.promotion)
+	{
+		var experienceBar = getGUIObjectByName("experienceBar");
+		var experienceSize = experienceBar.size;
+		experienceSize.rtop = 100 - 100 * Math.max(0, Math.min(1, 1.0 * entState.promotion.curr / entState.promotion.req));
+		experienceBar.size = experienceSize;
 
+		experience = "[font=\"serif-bold-13\"]XP [/font]" + entState.promotion.curr;
+		if (entState.promotion.curr < entState.promotion.req) experience += "/" + entState.promotion.req;
+		getGUIObjectByName("experience").tooltip = experience;
+		getGUIObjectByName("experience").hidden = false;
+	}
+	else
+	{
+		getGUIObjectByName("experience").hidden = true;
+	}
+
 	// Resource stats
 	var resources = "";
 	var resourceType = "";
Index: binaries/data/mods/public/gui/session/session.xml
===================================================================
--- binaries/data/mods/public/gui/session/session.xml	(revision 8776)
+++ binaries/data/mods/public/gui/session/session.xml	(working copy)
@@ -498,6 +498,13 @@
 						<object type="image" sprite="resourceForeground" ghost="true" name="resourceBar"/>
 						<object type="image" sprite="statsBarShader" ghost="true"/>
 					</object>
+					
+					<!-- Experience bar -->
+					<object size="46 0 58 100%" type="image" name="experience" tooltip="XP" tooltip_style="snToolTip">
+						<object type="image" sprite="experienceBackground" ghost="true"/>
+						<object type="image" sprite="experienceForeground" ghost="true" name="experienceBar"/>
+						<object type="image" sprite="statsBarShader" ghost="true"/>
+					</object>
 				</object>
 				
 				<!-- Specific Name -->
Index: binaries/data/mods/public/gui/session/sprites.xml
===================================================================
--- binaries/data/mods/public/gui/session/sprites.xml	(revision 8776)
+++ binaries/data/mods/public/gui/session/sprites.xml	(working copy)
@@ -706,7 +706,15 @@
 	<sprite name="staminaForeground">
 		<image backcolor="blue"/>
 	</sprite>
+	
+	<sprite name="experienceBackground">
+		<image backcolor="darkgray"/>
+	</sprite>
 
+	<sprite name="experienceForeground">
+		<image backcolor="white"/>
+	</sprite>
+
 	<!-- ================================  ================================ -->
 	<!-- Chat -->
 	<!-- ================================  ================================ -->
Index: binaries/data/mods/public/simulation/components/Armour.js
===================================================================
--- binaries/data/mods/public/simulation/components/Armour.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/Armour.js	(working copy)
@@ -19,10 +19,17 @@
 
 Armour.prototype.Init = function()
 {
+	this.invulnerable = false;
 };
 
+Armour.prototype.SetInvulnerability = function(invulnerability)
+{
+	this.invulnerable = invulnerability;
+};
+
 Armour.prototype.TakeDamage = function(hack, pierce, crush)
 {
+	if (this.invulnerable) return { "killed": false };
 	// Adjust damage values based on armour
 	var adjHack = Math.max(0, hack - this.template.Hack);
 	var adjPierce = Math.max(0, pierce - this.template.Pierce);
Index: binaries/data/mods/public/simulation/components/Attack.js
===================================================================
--- binaries/data/mods/public/simulation/components/Attack.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/Attack.js	(working copy)
@@ -205,7 +205,6 @@
 
 /**
  * Called when some units kills something (another unit, building, animal etc)
- * update player statistics only for now
  */
 Attack.prototype.TargetKilled = function(killerEntity, targetEntity)
 {
@@ -213,6 +212,13 @@
 	if (cmpKillerPlayerStatisticsTracker) cmpKillerPlayerStatisticsTracker.KilledEntity(targetEntity);
 	var cmpTargetPlayerStatisticsTracker = QueryOwnerInterface(targetEntity, IID_StatisticsTracker);
 	if (cmpTargetPlayerStatisticsTracker) cmpTargetPlayerStatisticsTracker.LostEntity(targetEntity);
+
+	// if unit can collect loot, lets try to collect it
+	var cmpLooter = Engine.QueryInterface(killerEntity, IID_Looter);
+	if (cmpLooter)
+	{
+		cmpLooter.Collect(targetEntity);
+	}
 }
 
 /**
Index: binaries/data/mods/public/simulation/components/Foundation.js
===================================================================
--- binaries/data/mods/public/simulation/components/Foundation.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/Foundation.js	(working copy)
@@ -121,6 +121,8 @@
 		Engine.PostMessage(this.entity, MT_ConstructionFinished,
 			{ "entity": this.entity, "newentity": building });
 
+		Engine.BroadcastMessage(MT_EntityRenamed, { oldEntityId: this.entity, newEntityId: building });
+			
 		Engine.DestroyEntity(this.entity);
 	}
 };
Index: binaries/data/mods/public/simulation/components/GuiInterface.js
===================================================================
--- binaries/data/mods/public/simulation/components/GuiInterface.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/GuiInterface.js	(working copy)
@@ -1,6 +1,7 @@
 function GuiInterface()
 {
 	this.notifications = [];
+	this.renamedEntities = [];
 }
 
 GuiInterface.prototype.Schema =
@@ -81,6 +82,13 @@
 	return ret;
 };
 
+GuiInterface.prototype.GetRenamedEntities = function(player, clearList)
+{
+	var result = this.renamedEntities.slice();
+	if (clearList) this.renamedEntities = [];
+	return result;	
+};
+
 GuiInterface.prototype.GetEntityState = function(player, ent)
 {
 	var cmpTempMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
@@ -199,6 +207,15 @@
 		};
 	}
 	
+	var cmpPromotion = Engine.QueryInterface(ent, IID_Promotion);
+	if (cmpPromotion)
+	{
+		ret.promotion = {
+			"curr": cmpPromotion.GetCurr(),
+			"req": cmpPromotion.GetReq()
+		};
+	}
+	
 	var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
 	ret.visibility = cmpRangeManager.GetLosVisibility(ent, player);
 
@@ -462,6 +479,11 @@
 	cmpRangeManager.SetDebugOverlay(enabled);
 };
 
+GuiInterface.prototype.OnGlobalEntityRenamed = function(msg)
+{
+	this.renamedEntities.push(msg);
+}
+
 // List the GuiInterface functions that can be safely called by GUI scripts.
 // (GUI scripts are non-deterministic and untrusted, so these functions must be
 // appropriately careful. They are called with a first argument "player", which is
@@ -471,6 +493,7 @@
 	
 	"GetSimulationState": 1,
 	"GetExtendedSimulationState": 1,
+	"GetRenamedEntities": 1,
 	"GetEntityState": 1,
 	"GetTemplateData": 1,
 	"GetNextNotification": 1,
Index: binaries/data/mods/public/simulation/components/Identity.js
===================================================================
--- binaries/data/mods/public/simulation/components/Identity.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/Identity.js	(working copy)
@@ -112,11 +112,14 @@
 
 Identity.prototype.GetRank = function()
 {
-	if (this.template.Rank)
-		return this.template.Rank;
-	return "";
+	return (this.template.Rank || "");
 };
 
+Identity.prototype.SetRank = function(newRank)
+{
+	this.template.Rank = newRank;
+};
+
 Identity.prototype.GetClassesList = function()
 {
 	if (this.template.Classes)
Index: binaries/data/mods/public/simulation/components/interfaces/Messages.js
===================================================================
--- binaries/data/mods/public/simulation/components/interfaces/Messages.js	(revision 0)
+++ binaries/data/mods/public/simulation/components/interfaces/Messages.js	(revision 0)
@@ -0,0 +1,8 @@
+/**
+ * Broadcast message 
+ * sent when one entity is changed to other:
+ * from Foundation component when building constuction is done
+ * and from Promotion component when unit is promoted
+ * Data: { oldEntityId: <integer>, newEntityId: <integer> }
+ */
+Engine.RegisterMessageType("EntityRenamed");
Index: binaries/data/mods/public/simulation/components/Loot.js
===================================================================
--- binaries/data/mods/public/simulation/components/Loot.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/Loot.js	(working copy)
@@ -17,8 +17,19 @@
 		"<element name='metal'><data type='nonNegativeInteger'/></element>" +
 	"</optional>";
 
-/*
- * TODO: this all needs to be designed and implemented
- */
+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);
Index: binaries/data/mods/public/simulation/components/Looter.js
===================================================================
--- binaries/data/mods/public/simulation/components/Looter.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/Looter.js	(working copy)
@@ -3,9 +3,23 @@
 Looter.prototype.Schema =
 	"<empty/>";
 	
-/*
- * TODO: this all needs to be designed and implemented
+/**
+ * Try to collect loot from target entity
  */
- 
+Looter.prototype.Collect = function(targetEntity)
+{
+	var cmpLoot = Engine.QueryInterface(targetEntity, IID_Loot);
+	if (!cmpLoot) return;
+	
+	var xp = cmpLoot.GetXp();
+	if (xp > 0) 
+	{
+		var cmpPromotion = Engine.QueryInterface(this.entity, IID_Promotion);
+		if (cmpPromotion) cmpPromotion.IncreaseXp(xp);
+	}
+	var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player);
+	cmpPlayer.AddResources(cmpLoot.GetResources());
+}
+
 Engine.RegisterComponentType(IID_Looter, "Looter", Looter);
 
Index: binaries/data/mods/public/simulation/components/Promotion.js
===================================================================
--- binaries/data/mods/public/simulation/components/Promotion.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/Promotion.js	(working copy)
@@ -6,10 +6,92 @@
 	"</element>" +
 	"<element name='Req'>" +
 		"<data type='positiveInteger'/>" +
-	"</element>";
+	"</element>" + 
+	"<optional>" +
+		"<element name='Curr'>" +
+			"<data type='positiveInteger'/>" +
+		"</element>" +
+	"</optional>";
 
-/*
- * TODO: this all needs to be designed and implemented
- */
+Promotion.prototype.Init = function()
+{
+	this.curr = +(this.template.Curr || 0);
+}
+	
+Promotion.prototype.GetReq = function()
+{
+	return +(this.template.Req);
+};
 
+Promotion.prototype.GetCurr = function()
+{
+	return +(this.curr || 0);
+};
+
+Promotion.prototype.GetPromotedTemplateName = function()
+{
+	if (this.template.Entity) return this.template.Entity;
+	// TODO: check for name with following suffix b -> a -> e
+	return null;
+}
+
+Promotion.prototype.CanPromote = function()
+{
+	var cmpIdentity = Engine.QueryInterface(this.entity, IID_Identity);	
+	if (cmpIdentity.GetRank == "" || cmpIdentity.GetRank == "Elite") return false;
+	if (!this.GetPromotedTemplateName()) return false;
+	return true;
+}
+
+Promotion.prototype.Promote = function()
+{
+	// Create promoted unit entity
+	var promotedUnitEntity = Engine.AddEntity(this.GetPromotedTemplateName());
+		
+	// Copy parameters from current entity to promoted one
+	var cmpCurrentUnitPosition = Engine.QueryInterface(this.entity, IID_Position);
+	var cmpPromotedUnitPosition = Engine.QueryInterface(promotedUnitEntity, IID_Position);
+	var pos = cmpCurrentUnitPosition.GetPosition();
+	cmpPromotedUnitPosition.JumpTo(pos.x, pos.z);
+	var rot = cmpCurrentUnitPosition.GetRotation();
+	cmpPromotedUnitPosition.SetYRotation(rot.y);
+	cmpPromotedUnitPosition.SetXZRotation(rot.x, rot.z);
+	
+	var cmpCurrentUnitOwnership = Engine.QueryInterface(this.entity, IID_Ownership);
+	var cmpPromotedUnitOwnership = Engine.QueryInterface(promotedUnitEntity, IID_Ownership);
+	cmpPromotedUnitOwnership.SetOwner(cmpCurrentUnitOwnership.GetOwner());
+
+	var cmpPromotedUnitPromotion = Engine.QueryInterface(promotedUnitEntity, IID_Promotion);
+	if (cmpPromotedUnitPromotion)
+		cmpPromotedUnitPromotion.IncreaseXp(this.curr - this.template.Req);
+		
+	var cmpCurrentUnitResourceGatherer = Engine.QueryInterface(this.entity, IID_ResourceGatherer);
+	var cmpPromotedUnitResourceGatherer = Engine.QueryInterface(promotedUnitEntity, IID_ResourceGatherer);
+	if (cmpCurrentUnitResourceGatherer && cmpPromotedUnitResourceGatherer)
+	{
+		var carriedResorces = cmpCurrentUnitResourceGatherer.GetCarryingStatus();
+		cmpPromotedUnitResourceGatherer.GiveResources(carriedResorces);
+	}
+	
+	var cmpCurrentUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
+	var cmpPromotedUnitAI = Engine.QueryInterface(promotedUnitEntity, IID_UnitAI);
+	cmpPromotedUnitAI.Cheer();
+	var orders = cmpCurrentUnitAI.GetOrders();
+	cmpPromotedUnitAI.AddOrders(orders);
+	
+	Engine.BroadcastMessage(MT_EntityRenamed, { oldEntityId: this.entity, newEntityId: promotedUnitEntity });
+	
+	// Destroy current entity
+	Engine.DestroyEntity(this.entity);
+}
+
+Promotion.prototype.IncreaseXp = function(amount)
+{
+	this.curr += +(amount);
+	if (this.CanPromote() && this.curr >= this.template.Req)
+	{
+		this.Promote();	
+	}
+}
+
 Engine.RegisterComponentType(IID_Promotion, "Promotion", Promotion);
Index: binaries/data/mods/public/simulation/components/ResourceGatherer.js
===================================================================
--- binaries/data/mods/public/simulation/components/ResourceGatherer.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/ResourceGatherer.js	(working copy)
@@ -81,11 +81,23 @@
 			"amount": this.carrying[type],
 			"max": +this.template.Capacities[type]
 		});
-	}
+	}	
 	return ret;
 };
 
 /**
+ * Used to instantly give resources to unit
+ * @param resources The same structure as returned form GetCarryingStatus
+ */
+ResourceGatherer.prototype.GiveResources = function(resources)
+{
+	for each (var resource in resources)
+	{
+		this.carrying[resource.type] = +(resource.amount);
+	}	
+};
+
+/**
  * Returns the type of one particular resource this unit is
  * currently carrying, or undefined if none.
  */
Index: binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
===================================================================
--- binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js	(working copy)
@@ -5,6 +5,7 @@
 Engine.LoadComponentScript("interfaces/GarrisonHolder.js");
 Engine.LoadComponentScript("interfaces/Health.js");
 Engine.LoadComponentScript("interfaces/Identity.js");
+Engine.LoadComponentScript("interfaces/Promotion.js");
 Engine.LoadComponentScript("interfaces/RallyPoint.js");
 Engine.LoadComponentScript("interfaces/ResourceDropsite.js");
 Engine.LoadComponentScript("interfaces/ResourceGatherer.js");
Index: binaries/data/mods/public/simulation/components/UnitAI.js
===================================================================
--- binaries/data/mods/public/simulation/components/UnitAI.js	(revision 8776)
+++ binaries/data/mods/public/simulation/components/UnitAI.js	(working copy)
@@ -191,6 +191,10 @@
 			this.SetNextState("INDIVIDUAL.GARRISON.GARRISONED");
 		}
 	},
+	
+	"Order.Cheering": function(msg) {
+		this.SetNextState("INDIVIDUAL.CHEERING");
+	},
 
 	// States for the special entity representing a group of units moving in formation:
 	"FORMATIONCONTROLLER": {
@@ -693,6 +697,27 @@
 			},
 		},
 
+		"CHEERING": {
+			"enter": function() {
+				// Unit is invulnerable while cheering
+				var cmpDamageReceiver = Engine.QueryInterface(this.entity, IID_DamageReceiver);
+				cmpDamageReceiver.SetInvulnerability(true); 
+				this.SelectAnimation("promotion");
+				this.StartTimer(4000, 4000);
+				return false;
+			},
+			
+			"leave": function() {	
+				this.StopTimer();
+				
+			},
+			
+			"Timer": function(msg) {
+				var cmpDamageReceiver = Engine.QueryInterface(this.entity, IID_DamageReceiver);
+				cmpDamageReceiver.SetInvulnerability(false); 
+				this.FinishOrder();
+			},
+		},
 	},
 };
 
@@ -839,18 +864,49 @@
 UnitAI.prototype.PushOrderFront = function(type, data)
 {
 	var order = { "type": type, "data": data };
-	this.orderQueue.unshift(order);
-
-	this.order = order;
-	UnitFsm.ProcessMessage(this, {"type": "Order."+this.order.type, "data": this.order.data});
+	// If current order is cheering then add new order after it 
+	if (this.order && this.order.type == "Cheering")
+	{
+		var cheeringOrder = this.orderQueue.shift();
+		this.orderQueue.unshift(cheeringOrder, order);	
+	}
+	else
+	{
+		this.orderQueue.unshift(order);
+		this.order = order;
+		UnitFsm.ProcessMessage(this, {"type": "Order."+this.order.type, "data": this.order.data});
+	}
 };
 
 UnitAI.prototype.ReplaceOrder = function(type, data)
 {
-	this.orderQueue = [];
-	this.PushOrder(type, data);
+	// If current order is cheering then add new order after it 
+	if (this.order && this.order.type == "Cheering")
+	{
+		var order = { "type": type, "data": data };
+		var cheeringOrder = this.orderQueue.shift();
+		this.orderQueue = [ cheeringOrder, order ];
+	}
+	else
+	{
+		this.orderQueue = [];
+		this.PushOrder(type, data);
+	}
 };
 
+UnitAI.prototype.GetOrders = function()
+{
+	return this.orderQueue.slice();
+}
+
+UnitAI.prototype.AddOrders = function(orders)
+{
+	for each (var order in orders)
+	{
+		this.PushOrder(order.type, order.data);
+	}
+}
+
 UnitAI.prototype.TimerHandler = function(data, lateness)
 {
 	// Reset the timer
@@ -1285,6 +1341,11 @@
 	this.AddOrder("Repair", { "target": target }, queued);
 };
 
+UnitAI.prototype.Cheer = function()
+{
+	this.AddOrder("Cheering", null, false);
+};
+
 UnitAI.prototype.SetStance = function(stance)
 {
 	if (g_Stances[stance])
Index: binaries/data/mods/public/simulation/templates/template_unit.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_unit.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/template_unit.xml	(working copy)
@@ -83,4 +83,5 @@
     <RetainInFog>false</RetainInFog>
     <AlwaysVisible>false</AlwaysVisible>
   </Vision>
+  <Looter />
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_a.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_a.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_a.xml	(working copy)
@@ -4,7 +4,7 @@
 	<Rank>Advanced</Rank>
   </Identity>
   <Promotion>
-    <Entity>celt_cavalry_javelinist_e</Entity>
+    <Entity>units/celt_cavalry_javelinist_e</Entity>
   </Promotion>
   <ResourceGatherer>
     <BaseSpeed>0.75</BaseSpeed>
Index: binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_b.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_b.xml	(working copy)
@@ -8,7 +8,7 @@
     <Icon>units/celt_cavalry_javelinist.png</Icon>
   </Identity>
   <Promotion>
-    <Entity>celt_cavalry_javelinist_a</Entity>
+    <Entity>units/celt_cavalry_javelinist_a</Entity>
   </Promotion>
   <Armour>
     <Hack>2.0</Hack>
Index: binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_e.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_e.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_cavalry_javelinist_e.xml	(working copy)
@@ -29,4 +29,5 @@
   <VisualActor>
     <Actor>units/celts/cavalry_javelinist_e.xml</Actor>
   </VisualActor>
+  <Promotion disable="" />
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_a.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_a.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_a.xml	(working copy)
@@ -4,7 +4,7 @@
 	<Rank>Advanced</Rank>
   </Identity>
   <Promotion>
-    <Entity>celt_cavalry_spearman_e</Entity>
+    <Entity>units/celt_cavalry_spearman_e</Entity>
   </Promotion>
   <ResourceGatherer>
     <BaseSpeed>0.75</BaseSpeed>
Index: binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_b.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_b.xml	(working copy)
@@ -10,7 +10,7 @@
     <Icon>units/celt_cavalry_spearman.png</Icon>
   </Identity>
   <Promotion>
-    <Entity>celt_cavalry_spearman_a</Entity>
+    <Entity>units/celt_cavalry_spearman_a</Entity>
   </Promotion>
   <Cost>
     <BuildTime>10</BuildTime>
Index: binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_e.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_e.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_cavalry_spearman_e.xml	(working copy)
@@ -28,4 +28,5 @@
   <VisualActor>
     <Actor>units/celts/cavalry_spearman_e.xml</Actor>
   </VisualActor>
+  <Promotion disable="" />
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_a.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_a.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_a.xml	(working copy)
@@ -4,7 +4,7 @@
 	<Rank>Advanced</Rank>
   </Identity>
   <Promotion>
-    <Entity>celt_cavalry_swordsman_e</Entity>
+    <Entity>units/celt_cavalry_swordsman_e</Entity>
   </Promotion>
   <ResourceGatherer>
     <BaseSpeed>0.75</BaseSpeed>
Index: binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_b.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_b.xml	(working copy)
@@ -8,7 +8,7 @@
     <Icon>units/celt_cavalry_swordsman.png</Icon>
   </Identity>
   <Promotion>
-    <Entity>celt_cavalry_swordsman_a</Entity>
+    <Entity>units/celt_cavalry_swordsman_a</Entity>
   </Promotion>
   <Armour>
     <Hack>3.0</Hack>
Index: binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_e.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_e.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_cavalry_swordsman_e.xml	(working copy)
@@ -31,4 +31,5 @@
   <VisualActor>
     <Actor>units/celts/cavalry_swordsman_e.xml</Actor>
   </VisualActor>
+  <Promotion disable="" />
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_a.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_a.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_a.xml	(working copy)
@@ -4,7 +4,7 @@
 	<Rank>Advanced</Rank>
   </Identity>
   <Promotion>
-    <Entity>celt_infantry_javelinist_e</Entity>
+    <Entity>units/celt_infantry_javelinist_e</Entity>
   </Promotion>
   <ResourceGatherer>
     <BaseSpeed>0.75</BaseSpeed>
Index: binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_b.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_b.xml	(working copy)
@@ -8,7 +8,7 @@
     <Icon>units/celt_infantry_javelinist.png</Icon>
   </Identity>
   <Promotion>
-    <Entity>celt_infantry_javelinist_a</Entity>
+    <Entity>units/celt_infantry_javelinist_a</Entity>
   </Promotion>
   <Armour>
     <Hack>2.0</Hack>
Index: binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_e.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_e.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_infantry_javelinist_e.xml	(working copy)
@@ -29,4 +29,5 @@
   <VisualActor>
     <Actor>units/celts/infantry_javelinist_e.xml</Actor>
   </VisualActor>
+  <Promotion disable="" />
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_a.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_a.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_a.xml	(working copy)
@@ -4,7 +4,7 @@
 	<Rank>Advanced</Rank>
   </Identity>
   <Promotion>
-    <Entity>celt_infantry_spearman_e</Entity>
+    <Entity>units/celt_infantry_spearman_e</Entity>
   </Promotion>
   <ResourceGatherer>
     <BaseSpeed>0.75</BaseSpeed>
Index: binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_b.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_b.xml	(working copy)
@@ -8,7 +8,7 @@
     <Icon>units/celt_infantry_spearman.png</Icon>
   </Identity>
   <Promotion>
-    <Entity>celt_infantry_spearman_a</Entity>
+    <Entity>units/celt_infantry_spearman_a</Entity>
   </Promotion>
   <Armour>
     <Hack>3.0</Hack>
Index: binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_e.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_e.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/celt_infantry_spearman_e.xml	(working copy)
@@ -33,4 +33,5 @@
   <VisualActor>
     <Actor>units/celts/infantry_spearman_e.xml</Actor>
   </VisualActor>
+  <Promotion disable="" />
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_a.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_a.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_a.xml	(working copy)
@@ -4,7 +4,7 @@
 	<Rank>Advanced</Rank>
   </Identity>
   <Promotion>
-    <Entity>hele_cavalry_javelinist_e</Entity>
+    <Entity>units/hele_cavalry_javelinist_e</Entity>
   </Promotion>
   <ResourceGatherer>
     <BaseSpeed>0.75</BaseSpeed>
Index: binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_b.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_b.xml	(working copy)
@@ -8,7 +8,7 @@
     <Icon>units/hele_cavalry_javelinist.png</Icon>
   </Identity>
   <Promotion>
-    <Entity>hele_cavalry_javelinist_a</Entity>
+    <Entity>units/hele_cavalry_javelinist_a</Entity>
   </Promotion>
   <Vision>
     <Range>110</Range>
Index: binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_e.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_e.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_cavalry_javelinist_e.xml	(working copy)
@@ -29,5 +29,5 @@
   <VisualActor>
     <Actor>units/hellenes/cavalry_javelinist_e.xml</Actor>
   </VisualActor>
-
+  <Promotion disable="" />
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_a.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_a.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_a.xml	(working copy)
@@ -4,7 +4,7 @@
 	<Rank>Advanced</Rank>
   </Identity>
   <Promotion>
-    <Entity>hele_cavalry_swordsman_e</Entity>
+    <Entity>units/hele_cavalry_swordsman_e</Entity>
   </Promotion>
   <ResourceGatherer>
     <BaseSpeed>0.75</BaseSpeed>
Index: binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_b.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_b.xml	(working copy)
@@ -8,7 +8,7 @@
     <Icon>units/hele_cavalry_swordsman.png</Icon>
   </Identity>
   <Promotion>
-    <Entity>hele_cavalry_swordsman_a</Entity>
+    <Entity>units/hele_cavalry_swordsman_a</Entity>
   </Promotion>
   <Vision>
     <Range>110</Range>
Index: binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_e.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_e.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_cavalry_swordsman_e.xml	(working copy)
@@ -31,5 +31,5 @@
   <VisualActor>
     <Actor>units/hellenes/cavalry_swordsman_e.xml</Actor>
   </VisualActor>
-
+  <Promotion disable="" />
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_a.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_a.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_a.xml	(working copy)
@@ -4,7 +4,7 @@
 	<Rank>Advanced</Rank>
   </Identity>
   <Promotion>
-    <Entity>hele_infantry_archer_e</Entity>
+    <Entity>units/hele_infantry_archer_e</Entity>
   </Promotion>
   <ResourceGatherer>
     <BaseSpeed>0.75</BaseSpeed>
Index: binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_b.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_b.xml	(working copy)
@@ -9,7 +9,7 @@
     <Icon>units/hele_infantry_archer.png</Icon>
   </Identity>
   <Promotion>
-    <Entity>hele_infantry_archer_a</Entity>
+    <Entity>units/hele_infantry_archer_a</Entity>
   </Promotion>
   <Cost>
     <Resources>
Index: binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_e.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_e.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_infantry_archer_e.xml	(working copy)
@@ -33,4 +33,5 @@
   <VisualActor>
     <Actor>units/hellenes/infantry_archer_e.xml</Actor>
   </VisualActor>
+  <Promotion disable="" />
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_a.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_a.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_a.xml	(working copy)
@@ -4,7 +4,7 @@
 	<Rank>Advanced</Rank>
   </Identity>
   <Promotion>
-    <Entity>hele_infantry_javelinist_e</Entity>
+    <Entity>units/hele_infantry_javelinist_e</Entity>
   </Promotion>
   <ResourceGatherer>
     <BaseSpeed>0.75</BaseSpeed>
Index: binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_b.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_b.xml	(working copy)
@@ -8,7 +8,7 @@
     <Icon>units/hele_infantry_javelinist.png</Icon>
   </Identity>
   <Promotion>
-    <Entity>hele_infantry_javelinist_a</Entity>
+    <Entity>units/hele_infantry_javelinist_a</Entity>
   </Promotion>
   <Cost>
     <Resources>
Index: binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_e.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_e.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_infantry_javelinist_e.xml	(working copy)
@@ -22,4 +22,5 @@
   <VisualActor>
     <Actor>units/hellenes/infantry_javelinist_e.xml</Actor>
   </VisualActor>
+  <Promotion disable="" />
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_a.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_a.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_a.xml	(working copy)
@@ -4,7 +4,7 @@
 	<Rank>Advanced</Rank>
   </Identity>
   <Promotion>
-    <Entity>hele_infantry_spearman_e</Entity>
+    <Entity>units/hele_infantry_spearman_e</Entity>
   </Promotion>
   <ResourceGatherer>
     <BaseSpeed>0.75</BaseSpeed>
Index: binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_b.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_b.xml	(working copy)
@@ -8,7 +8,7 @@
     <Icon>units/hele_infantry_spearman.png</Icon>
   </Identity>
   <Promotion>
-    <Entity>hele_infantry_spearman_a</Entity>
+    <Entity>units/hele_infantry_spearman_a</Entity>
   </Promotion>
   <Cost>
     <Resources>
Index: binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_e.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_e.xml	(revision 8776)
+++ binaries/data/mods/public/simulation/templates/units/hele_infantry_spearman_e.xml	(working copy)
@@ -33,5 +33,5 @@
   <VisualActor>
     <Actor>units/hellenes/infantry_spearman_e.xml</Actor>
   </VisualActor>
-  
+  <Promotion disable="" />
 </Entity>
