public static void SendGumpThreaded(PlayerMobile to) { if (to.AntiMacroGump && m_GumpDictionary.ContainsKey(to)) { AntiMacroGump oldGump = m_GumpDictionary[to]; m_GumpDictionary.Remove(to); //Close existing gump if it exists if (to.HasGump(typeof(AntiMacroGump))) to.CloseGump(typeof(AntiMacroGump)); to.SendGump(new AntiMacroGump(oldGump) ); return; } if ( !MySQLManager.SQLEnabled) { to.SendGump(new OldAntiMacroGump(to)); return; } AntiMacroGump gump = new AntiMacroGump(to); new Thread(gump.ThreadedGump).Start(); }
private AntiMacroGump(AntiMacroGump oldGump) : base(0, 0) { m_Owner = oldGump.m_Owner; m_Seed = oldGump.m_Seed; m_TriesLeft = oldGump.m_TriesLeft; m_TotalTriesLeft = oldGump.m_TotalTriesLeft; m_MacroTimer = oldGump.m_MacroTimer; InitiateGump(); if (m_GumpDictionary.ContainsKey(m_Owner)) m_GumpDictionary[m_Owner] = this; else m_GumpDictionary.Add(m_Owner, this); }
public NewMacroTimer(AntiMacroGump starterGump, TimeSpan duration) : base(duration) { m_From = starterGump.m_Owner; m_From.AntiMacroGump = true; m_From.SendAsciiMessage(33, string.Format("You now have {0} seconds to respond before you are killed.", duration.TotalSeconds)); m_From.Frozen = true; m_From.CantWalk = true; }
private void ThreadedValidation() { if (!MySQLManager.ValidateInput(m_Owner, m_Answer, m_TriesLeft)) { if (m_TriesLeft == 1) new KillTimer(m_Owner).Start(); //Dirty fix to fix any possible threaded issues. if (m_TotalTriesLeft <= 0) //So people can't spam and eventually enter the correct answer { m_Owner.SendAsciiMessage("You have entered the incorrect answer too many times and you will now need to page staff to get unfrozen"); m_Owner.AntiMacroGump = false; return; } if (m_TriesLeft > 0) m_TriesLeft--; m_TotalTriesLeft--; m_Owner.SendAsciiMessage("Wrong answer!"); AntiMacroGump newGump = new AntiMacroGump(this); m_Owner.SendGump(newGump); //We dont want to end the timer and free the owner return; } //End the timer if (m_MacroTimer != null) { m_MacroTimer.Stop(); m_MacroTimer = null; } FreeOwner(); m_Owner.SendAsciiMessage(string.Format("Thank you {0} for validating your presence. Have a nice day!", m_Owner.Name)); m_Owner.CantWalk = false; if (m_Owner.Frozen) m_Owner.Frozen = false; }