public void AttemptStart() { if (!CheckLoggedIn()) { Handeling.Caller.SendGump(new RVSSetup_Main(Handeling)); Handeling.EchoMessage("One or more players have logged out, the duel could not start."); this.Stop(); return; } else if (!AllAlive()) { Handeling.EchoMessage("Not all players are alive, duel start delayed."); RVS_StartTimer tmr = new RVS_StartTimer(Handeling, (C + 1), (A + 1)); this.Stop(); return; } else if (!AllDismounted()) { //Handeling.EchoMessage("Not all participants are dismounted, duel start delayed."); //RVS_StartTimer tmr = new RVS_StartTimer(Handeling, (C + 1), (A + 1)); //this.Stop(); //return; } else if (!NoneFlagged()) { //Handeling.EchoMessage("Some participants have been in combat to recently for the duel to start, duel start delayed."); //RVS_StartTimer tmr = new RVS_StartTimer(Handeling, (C + 1), (A + 1)); //this.Stop(); //return; } else if (!NoneInJail()) { Handeling.EchoMessage("Some participants are in areas where duels cannot take place, duel start delayed."); RVS_StartTimer tmr = new RVS_StartTimer(Handeling, (C + 1), (A + 1)); this.Stop(); return; } RVSController avail = PickRandomArena(); if (avail == null) { avail = ArenaAvaiable(); } if (avail != null) { Handeling.EchoMessage("RVS Duel starting!"); avail.StartRVS(Handeling); return; } else { Handeling.Caller.SendGump(new RVSSetup_Main(Handeling)); Handeling.EchoMessage("No arena's avaiable, please wait before trying to restart the duel."); this.Stop(); return; } }
protected override void OnTick() { if (Handeling.Ended) { this.Stop(); return; } Handeling.EchoMessage(C.ToString()); if (A >= 4) { Handeling.Caller.SendGump(new RVSSetup_Main(Handeling)); Handeling.EchoMessage("RVS starting timed out, please wait."); this.Stop(); return; } if (C >= RVS_Config.RVSStartDelay) { C = 0; AttemptStart(); } else { this.Stop(); RVS_StartTimer tmr = new RVS_StartTimer(Handeling, (C + 1), A); } }
public void UpdateAllPending() { // This sub is used to send all players the required gumps to view the rules of the duel and // eventually accept/decline the duel, after a player has not already accepted the duel they // are sent the gump to accept/decline the duel, if they have accepted the duel, they are // sent the gump to view all the players that have/have not accepted the duel // if all players have accepted the duel this sub will then begin the process of starting the // duel bool start = false; // bool to determine weather to start the duel or not 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 RVS_Team d_team = (RVS_Team)Teams[(int)key.Current]; // creates a variable referencing the currently iterated team for (int i2 = 0; i2 < d_team.Players.Count; ++i2) // creates a second for loop to iterate through all the players in the current teams { object o = (object)d_team.Players[i2]; // creates the currently iterated object in the teams Players variable as an object to be type safe if (o is PlayerMobile) // checks if o is infact a Player, if it isn't it is just an empty slot { PlayerMobile pm = (PlayerMobile)o; // o is a playermobile so we create a variable to reference it as a playermobile if (AllAccepted()) { start = true; pm.CloseGump(typeof(RVSSetup_Pending)); } else if ((bool)d_team.Accepted[pm]) { pm.CloseGump(typeof(RVSSetup_Pending)); pm.SendGump(new RVSSetup_Pending(this)); } else { pm.CloseGump(typeof(RVSSetup_Rules_View)); pm.SendGump(new RVSSetup_Rules_View(this, (int)key.Current, i2)); } } } } if (start) { EchoMessage("RVS Duel Starting...."); StartTimer = new RVS_StartTimer(this, 1, 1); } }
public void AttemptStart() { if (!CheckLoggedIn()) { Handeling.Caller.SendGump(new RVSSetup_Main(Handeling)); Handeling.EchoMessage("One or more players have logged out, the duel could not start."); this.Stop(); return; } else if (!AllAlive()) { Handeling.EchoMessage("Not all players are alive, duel start delayed."); RVS_StartTimer tmr = new RVS_StartTimer(Handeling, (C + 1), (A + 1)); this.Stop(); return; } else if (!AllDismounted()) { //Handeling.EchoMessage("Not all participants are dismounted, duel start delayed."); //RVS_StartTimer tmr = new RVS_StartTimer(Handeling, (C + 1), (A + 1)); //this.Stop(); //return; } else if (!NoneFlagged()) { //Handeling.EchoMessage("Some participants have been in combat to recently for the duel to start, duel start delayed."); //RVS_StartTimer tmr = new RVS_StartTimer(Handeling, (C + 1), (A + 1)); //this.Stop(); //return; } else if (!NoneInJail()) { Handeling.EchoMessage("Some participants are in areas where duels cannot take place, duel start delayed."); RVS_StartTimer tmr = new RVS_StartTimer(Handeling, (C + 1), (A + 1)); this.Stop(); return; } RVSController avail = PickRandomArena(); if (avail == null) avail = ArenaAvaiable(); if (avail != null) { Handeling.EchoMessage("RVS Duel starting!"); avail.StartRVS(Handeling); return; } else { Handeling.Caller.SendGump(new RVSSetup_Main(Handeling)); Handeling.EchoMessage("No arena's avaiable, please wait before trying to restart the duel."); this.Stop(); return; } }