public virtual void On_ShutDown(ShutdownEventArgs args) { for (int i = 0; i < Duel_Config.Controllers.Count; ++i) { DuelController d = (DuelController)Duel_Config.Controllers[i]; if (d.HasStarted && d.Handeling != null) { d.EndDuel(0); } } }
public void EndSelf() { if (Ended) { return; } if (InProgress) { Controller.EndDuel(0); } Ended = true; IEnumerator key = Teams.Keys.GetEnumerator(); // creates the key variable so we can iterate through the Teams dictionary for (int i = 0; i < Teams.Count; ++i) // Iterates through the Teams dictionary using a for loop { key.MoveNext(); // Moves the enumerator to its next item Duel_Team d_team = (Duel_Team)Teams[(int)key.Current]; // creates a variable referencing the currently iterated team for (int i2 = 0; i2 < d_team.Players.Count; ++i2) { object o = (object)d_team.Players[i2]; if (o is PlayerMobile) { PlayerMobile pm = (PlayerMobile)d_team.Players[i2]; RefundBuyIn(pm); pm.CloseGump(typeof(DuelSetup_Main)); pm.CloseGump(typeof(DuelSetup_Pending)); pm.CloseGump(typeof(DuelSetup_ParticipantSetup)); pm.CloseGump(typeof(DuelSetup_AddParticipant)); pm.CloseGump(typeof(DuelSetup_Rules_View)); pm.CloseGump(typeof(DuelSetup_ViewParticipants)); pm.CloseGump(typeof(DuelSetup_Rules_Armor_View)); pm.CloseGump(typeof(DuelSetup_Rules_Combat_View)); pm.CloseGump(typeof(DuelSetup_Rules_Items_View)); pm.CloseGump(typeof(DuelSetup_Rules_Skills_View)); pm.CloseGump(typeof(DuelSetup_Rules_Weapons_View)); pm.CloseGump(typeof(DuelSetup_Rules_Spells_View)); pm.CloseGump(typeof(DuelSetup_Rules_Spells_1st_View)); pm.CloseGump(typeof(DuelSetup_Rules_Spells_2nd_View)); pm.CloseGump(typeof(DuelSetup_Rules_Spells_3rd_View)); pm.CloseGump(typeof(DuelSetup_Rules_Spells_4th_View)); pm.CloseGump(typeof(DuelSetup_Rules_Spells_5th_View)); pm.CloseGump(typeof(DuelSetup_Rules_Spells_6th_View)); pm.CloseGump(typeof(DuelSetup_Rules_Spells_7th_View)); pm.CloseGump(typeof(DuelSetup_Rules_Spells_8th_View)); } } } EchoMessage(String.Format("The duel has been cancelled.")); if (Duel_Config.Registry.Contains(this)) { Duel_Config.Registry.Remove(this); } }