using System; using System.IO; using Server; using Server.Gumps; using Server.Mobiles; using Server.Accounting; namespace Server.Gumps { public class VOFTOSGUMP : Gump { private static string _Info; public static string TOS { get { return _Info; } } public static void Initialize() { _Info = LoadFromeFile(); EventSink.Login += new LoginEventHandler(EventSink_Login); } static void EventSink_Login(LoginEventArgs e) { Mobile m = e.Mobile; if (m == null) return; if (m.Player) { PlayerMobile pm = m as PlayerMobile; AccountTag tg = new AccountTag( "TOS", "AGREED" ); if (!pm.Account.Tags.Contains(tg)) { pm.CloseGump(typeof(VOFTOSGUMP)); pm.SendGump(new VOFTOSGUMP()); } } } private static string LoadFromeFile() { if (!File.Exists("Data\\tos.txt")) return "No TOS File was found."; StreamReader reader = null; string tos = ""; try { using (reader = new StreamReader("Data\\tos.txt")) tos = reader.ReadToEnd(); } catch (Exception e) { if (reader != null) reader.Close(); tos = e.ToString(); } finally { if (reader != null) reader.Close(); } return tos; } public VOFTOSGUMP() : base(0, 0) { this.Closable = false; this.Disposable = true; this.Dragable = false; this.Resizable = false; this.AddPage(0); this.AddBackground(17, 11, 471, 408, 2600); this.AddLabel(116, 29, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddCheck(127, 377, 210, 211, false, (int)Buttons.Checkbox1); this.AddLabel(154, 378, 0, @"I Agree"); this.AddCheck(212, 378, 210, 211, false, (int)Buttons.CopyofCheckbox1); this.AddLabel(236, 379, 0, @"I Disagree"); this.AddButton(309, 377, 247, 248, (int)Buttons.Button1, GumpButtonType.Reply, 0); this.AddHtml(41, 60, 425, 309, VOFTOS.TOS, (bool)false, (bool)true); this.AddLabel(116, 30, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(116, 31, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(116, 32, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(116, 33, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(115, 32, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(116, 32, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(117, 32, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(116, 32, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(236, 380, 0, @"I Disagree"); this.AddLabel(116, 33, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(236, 379, 0, @"I Disagree"); this.AddLabel(116, 32, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(236, 378, 0, @"I Disagree"); this.AddLabel(116, 31, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(154, 379, 0, @"I Agree"); this.AddLabel(236, 379, 0, @"I Disagree"); this.AddLabel(116, 32, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(154, 380, 0, @"I Agree"); this.AddLabel(236, 378, 0, @"I Disagree"); this.AddLabel(116, 31, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(154, 380, 0, @"I Agree"); this.AddLabel(236, 378, 0, @"I Disagree"); this.AddLabel(116, 32, 194, @"Vas Ort Flam Terms of Service Agreement"); this.AddLabel(154, 379, 0, @"I Agree"); this.AddLabel(154, 378, 0, @"I Agree"); } public enum Buttons { Checkbox1 = 1, CopyofCheckbox1 = 2, Button1 = 3, } public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { PlayerMobile m = sender.Mobile as PlayerMobile; if (m == null) return; int[] switches = info.Switches; bool disagree = false; bool agree = false; for (int i = 0; i < switches.Length; i++) { if (switches[i] == (int)Buttons.Checkbox1) agree = true; else if (switches[i] == (int)Buttons.CopyofCheckbox1) disagree = true; } if (disagree) { sender.Dispose(); } if (agree) m.Account.SetTag("TOS", "AGREED"); m.SendMessage("Either agree or disagree, but you must choose one or the other!"); m.SendGump(new VOFTOSGUMP()); } } }