public void InitLobbyRegion(int iRegion)
{
var region = this.Regions[iRegion];
var stairs = region.GetPropById(this.Data.StairsPropId);
if (stairs == null)
throw new Exception("Missing stairs prop '" + this.Data.StairsPropId + "'.");
var statue = region.GetProp(a => a.Parameters.Any(x => x.SignalType == SignalType.Touch && x.EventType == EventType.Confirmation));
if (statue == null)
throw new Exception("Missing statue prop '" + this.Data.LastStatuePropId + "'.");
stairs.Behavior = (cr, pr) =>
{
// Indoor_RDungeon_SB marks the start position for the next floor.
var clientEvent = this.Regions[1].GetClientEvent("Indoor_RDungeon_SB");
if (clientEvent == null)
{
Log.Error("Event 'Indoor_RDungeon_SB' not found while trying to warp to '{0}'.", this.Regions[1].Name);
return;
}
// Warp to the second region, the 1st floor.
var regionId = this.Regions[1].Id;
var x = (int)clientEvent.Data.X;
var y = (int)clientEvent.Data.Y;
cr.Warp(regionId, x, y);
};
statue.Behavior = (cr, pr) =>
{
cr.Warp(this.Data.Exit);
if (this.Script != null)
this.Script.OnLeftEarly(this, cr);
};
}