-----------------------------------
--
-- Zone: Temenos (37)
--
-----------------------------------
package.loaded["scripts/zones/Temenos/TextIDs"] = nil;
-----------------------------------

require("scripts/globals/settings");
require("scripts/zones/Temenos/TextIDs");
require("scripts/globals/limbus");

-----------------------------------
-- onInitialize
-----------------------------------

function onInitialize(zone)
SetServerVariable("[Temenos_W_Tower]UniqueID",0);		
SetServerVariable("[Temenos_N_Tower]UniqueID",0);			
SetServerVariable("[Temenos_E_Tower]UniqueID",0);		
SetServerVariable("[C_Temenos_Base]UniqueID",0);		
SetServerVariable("[C_Temenos_Base_II]UniqueID",0);		
SetServerVariable("[C_Temenos_1st]UniqueID",0);			
SetServerVariable("[C_Temenos_2nd]UniqueID",0);			
SetServerVariable("[C_Temenos_3rd]UniqueID",0);
SetServerVariable("[C_Temenos_4th]UniqueID",0);	
SetServerVariable("[C_Temenos_4th_II]UniqueID",0);

zone:registerRegion(1,  378,70,-186    ,382,72,-182); -- 'Temenos_Western_Tower'	380 71 -184
zone:registerRegion(2,  378,70,373    ,382,72,377); -- 'Temenos_Northern_Tower'   380 71 375
zone:registerRegion(3,  378,-4,93    ,382,4,98); -- 'Temenos_Eastern_Tower'    380 -2 96
zone:registerRegion(4,  578,-4,-546    ,582,4,-542); -- 'Central_Temenos_Basement' 580 -2 -544
zone:registerRegion(5,  258,-164,-506    ,262,-160,-502); -- 'Central_Temenos_1st_Floor' 260 -162 -504
zone:registerRegion(6,  18,-4,-546    ,22,4,-542); -- 'Central_Temenos_2nd_Floor' 20 -2 -544
zone:registerRegion(7,  -298,-164,-502    ,-294,-160,-498); -- 'Central_Temenos_3rd_Floor' -296 -162 -500
zone:registerRegion(8,  -542,-4,-586    ,-538,4,-582); -- 'Central_Temenos_4th_Floor'  -540 -2  -584


end;

-----------------------------------		
-- onZoneIn		
-----------------------------------		

function onZoneIn(player,prevZone)		
	cs = -1;	
		player:setPos(580,-1.5,4.452,192);
	return cs;	
end;		

-----------------------------------		
-- onRegionEnter		
-----------------------------------		

function onRegionEnter(player,region)	
  local regionID = region:GetRegionID();
   switch (regionID): caseof {
        [1] = function (x) 
		      if(player:hasStatusEffect(EFFECT_BATTLEFIELD) == false)then 
			      RegisterLimbusInstance(player,1298);
			  end	--create instance 	Temenos_Western_Tower
		end,
		[2] = function (x) 
		      if(player:hasStatusEffect(EFFECT_BATTLEFIELD) == false)then 
			      RegisterLimbusInstance(player,1299);
			  end	--create instance Temenos_Northern_Tower
		end,
		[3] = function (x) 
		      if(player:hasStatusEffect(EFFECT_BATTLEFIELD) == false)then 
			      RegisterLimbusInstance(player,1300);
			  end	--create instance Temenos_Eastern_Tower	  
		end,
		[4] = function (x) 
		      if(player:hasStatusEffect(EFFECT_BATTLEFIELD) == false)then 
			      RegisterLimbusInstance(player,1301);
			  end	--create instance  Central_Temenos_Basement	  
		end,
		[5] = function (x) 
		      if(player:hasStatusEffect(EFFECT_BATTLEFIELD) == false)then 
			      RegisterLimbusInstance(player,1303);
			  end	--create instance Central_Temenos_1st_Floor	  
		end,
		[6] = function (x) 
		      if(player:hasStatusEffect(EFFECT_BATTLEFIELD) == false)then 
			      RegisterLimbusInstance(player,1304);
			  end	--create instance   Central_Temenos_2nd_Floor
		end,
		[7] = function (x) 
		      if(player:hasStatusEffect(EFFECT_BATTLEFIELD) == false)then 
			      RegisterLimbusInstance(player,1305);
			  end	--create instance Central_Temenos_3rd_Floor	  
		end,		
		[8] = function (x) 
		      if(player:hasStatusEffect(EFFECT_BATTLEFIELD) == false)then 
			      RegisterLimbusInstance(player,1306);
			  end	--create instance Central_Temenos_4th_Floor  
		end,	
		}
		
		
end;

	
function onRegionLeave(player,region)
end;
-----------------------------------	
-- onEventUpdate	
-----------------------------------	

function onEventUpdate(player,csid,option)	
	--printf("CSID: %u",csid);
	--printf("RESULT: %u",option);
end;	

-----------------------------------	
-- onEventFinish	
-----------------------------------	

function onEventFinish(player,csid,option)	
	--printf("CSID: %u",csid);
	--printf("RESULT: %u",option);
end;	
