protected void ShootFirework(Location location, FireworkType type, string message)
{
var region = ChannelServer.Instance.World.GetRegion(location.RegionId);
if (region == null)
{
Log.Warning(this.GetType().Name + ".ShootFirework: Unknown region.");
return;
}
if (message == null)
message = "";
var delay = 500;
var rnd = RandomProvider.Get();
var height = rnd.Between(750, 2000);
var heightf = height / 100f;
var prop = new Prop(208, location.RegionId, location.X, location.Y, 0);
prop.DisappearTime = DateTime.Now.AddMilliseconds(20000 + delay);
region.AddProp(prop);
Task.Delay(delay).ContinueWith(__ =>
{
prop.Xml.SetAttributeValue("height", height);
prop.Xml.SetAttributeValue("message", message + " (" + heightf.ToString("0.##") + "m)");
prop.Xml.SetAttributeValue("type", (int)type);
prop.Xml.SetAttributeValue("seed", Interlocked.Increment(ref _fireworkSeed));
Send.PropUpdate(prop);
});
}