public override void Tick(RealmTime time)
{
base.Tick(time);
if (Players.Count > 0)
{
if (!Flags["started"] && !Flags["counting"])
{
foreach (var i in RealmManager.Clients.Values)
i.SendPacket(new TextPacket
{
Stars = -1,
BubbleTime = 0,
Name = "#Announcement",
Text = "A paid arena game has been started. Closing in 1 minute!"
});
Flags["counting"] = true;
Countdown(60);
}
else if (Flags["started"] && !Flags["counting"])
{
if (Enemies.Count < 1 + Pets.Count)
{
Wave++;
if (Wave < 6)
{
RandomBosses = new[] { "Red Demon", "Phoenix Lord", "Henchman of Oryx" };
}
if (Wave > 5 && Wave < 11)
{
RandomBosses = new[]
{"Red Demon", "Phoenix Lord", "Henchman of Oryx", "Stheno the Snake Queen"};
}
if (Wave > 10 && Wave < 16)
{
RandomBosses = new[]
{"Elder Tree", "Stheno the Snake Queen", "Archdemon Malphas", "Septavius the Ghost God"};
}
if (Wave > 15 && Wave < 21)
{
RandomBosses = new[]
{
"Elder Tree", "Archdemon Malphas", "Septavius the Ghost God",
"Thessal the Mermaid Goddess",
"Crystal Prisoner"
};
}
if (Wave > 20 && Wave < 36)
{
RandomBosses = new[]
{
"Thessal the Mermaid Goddess", "Crystal Prisoner", "Tomb Support", "Tomb Defender",
"Tomb Attacker", "Oryx the Mad God 2"
};
}
if (Wave > 35)
{
RandomBosses = new[]
{
"Thessal the Mermaid Goddess", "Crystal Prisoner", "Tomb Support", "Tomb Defender",
"Tomb Attacker", "Oryx the Mad God 2", "Phoenix Wright", "Bridge Sentinel"
};
}
var db = new Database();
//FamePot = (Wave/2)*10/(Players.Count == 1 ? 1 : 2);
if (Players.Count == 1)
{
FamePot = Wave / 2 * 10;
}
else if (Wave % 2 == 1)
{
FamePot = (Wave + 1) / 4 * 10;
}
else
{
FamePot = Wave / 4 * 10;
}
foreach (var i in Players)
{
i.Value.CurrentFame =
i.Value.Client.Account.Stats.Fame = db.UpdateFame(i.Value.Client.Account, FamePot);
i.Value.UpdateCount++;
i.Value.Client.SendPacket(new NotificationPacket
{
Color = new ARGB(0xFFFF6600),
ObjectId = i.Value.Id,
Text = "+" + FamePot + " Fame"
});
if (Math.IEEERemainder(Wave, 15) == 0)
{
i.Value.Credits = i.Value.Client.Account.Credits = db.UpdateCredit(i.Value.Client.Account, 1);
i.Value.UpdateCount++;
}
}
db.Dispose();
var Invincible = new ConditionEffect();
Invincible.Effect = ConditionEffectIndex.Invulnerable;
Invincible.DurationMS = 6000;
var Healing = new ConditionEffect();
Healing.Effect = ConditionEffectIndex.Healing;
Healing.DurationMS = 6000;
foreach (var i in Players)
{
i.Value.Client.SendPacket(new SwitchMusicPacket
{
Music = "Arena"
});
i.Value.ApplyConditionEffect(Invincible, Healing);
}
foreach (var i in Players)
{
try
{
if (!Participants.Contains(i.Value.Client.Account.Name))
Participants.Add(i.Value.Client.Account.Name);
}
catch
{
}
}
Flags["counting"] = true;
Timers.Add(new WorldTimer(1000, (world, t) => Countdown(5)));
}
else
{
foreach (var i in Enemies)
{
if (OutOfBounds(i.Value.X, i.Value.Y))
{
LeaveWorld(i.Value);
}
}
}
}
}
else
{
if (Participants.Count > 0)
{
new Database().AddToArenaLb(Wave, Participants);
Participants.Clear();
}
}
}