public static void Add(Entry e) { Load(); for (int i = 0; i < m_Entries.Count; i++) { Entry entry = (Entry) m_Entries[i]; if (((entry.AccountName == e.AccountName) && (entry.Password == e.Password)) && ((entry.ServerID == e.ServerID) && (entry.CharID == e.CharID))) { m_Entries.RemoveAt(i); m_Entries.Insert(0, e); Save(); return; } } m_Entries.Insert(0, e); Save(); }
public override void OnClick() { Entry entry = new Entry { AccountName = this.m_Character.Shard.Account.Username, Password = this.m_Character.Shard.Account.Password, CharID = this.m_Character.Index, CharName = this.m_Character.Name, ServerID = this.m_Character.Shard.Index, ServerName = this.m_Character.Shard.Name, CharProfile = this.m_Character }; Engine.m_QuickLogin = true; Engine.m_QuickEntry = entry; Cursor.Hourglass = true; Gumps.Desktop.Children.Clear(); xGumps.Display("Connecting"); Engine.DrawNow(); string serverHost = NewConfig.ServerHost; int serverPort = NewConfig.ServerPort; NewConfig.ServerHost = this.m_Character.Shard.Account.Server.Address; NewConfig.ServerPort = this.m_Character.Shard.Account.Server.Port; if (Network.Connect()) { NewConfig.ServerHost = serverHost; NewConfig.ServerPort = serverPort; Gumps.Desktop.Children.Clear(); xGumps.Display("AccountVerify"); } else { NewConfig.ServerHost = serverHost; NewConfig.ServerPort = serverPort; Gumps.Desktop.Children.Clear(); xGumps.SetVariable("FailMessage", "Couldn't connect to the login server. Either the server is down, or you've entered an invalid host / port. Check Client.cfg."); xGumps.Display("ConnectionFailed"); Cursor.Hourglass = false; Engine.m_QuickLogin = false; return; } Network.Send(new PLoginSeed()); Network.Send(new PAccount(entry.AccountName, entry.Password)); }
public static void Load() { m_Entries = new ArrayList(); string path = Engine.FileManager.BasePath("Data/Binary/QuickLogin.mul"); if (File.Exists(path)) { BinaryReader bin = new BinaryReader(File.OpenRead(path)); int num = bin.ReadInt32(); for (int i = 0; i < num; i++) { Entry entry = new Entry { AccountName = ReadString(bin), Password = ReadString(bin), ServerID = bin.ReadInt32(), ServerName = ReadString(bin), CharID = bin.ReadInt32(), CharName = ReadString(bin) }; m_Entries.Add(entry); } bin.Close(); } Validate(); }
public static void QuickLogin_OnClick(Gump g) { int tag = (int) g.GetTag("Index"); Entry entry = (Entry) QuickLogin.Entries[tag]; m_QuickLogin = true; m_QuickEntry = entry; Cursor.Hourglass = true; Gumps.Desktop.Children.Clear(); xGumps.Display("Connecting"); DrawNow(); if (Network.Connect()) { Gumps.Desktop.Children.Clear(); xGumps.Display("AccountVerify"); } else { Gumps.Desktop.Children.Clear(); xGumps.SetVariable("FailMessage", "Couldn't connect to the login server. Either the server is down, or you've entered an invalid host / port. Check Client.cfg."); xGumps.Display("ConnectionFailed"); Cursor.Hourglass = false; m_QuickLogin = false; return; } Network.Send(new PLoginSeed()); Network.Send(new PAccount(entry.AccountName, entry.Password)); }
public static void CharSlot_OnClick(Gump Sender) { if (Sender.HasTag("CharID")) { int tag = (int) Sender.GetTag("CharID"); Entry e = new Entry { AccountName = NewConfig.Username, Password = NewConfig.Password, CharID = tag, CharName = m_CharacterNames[tag], ServerID = NewConfig.LastServerID }; for (int i = 0; i < m_Servers.Length; i++) { if (m_Servers[i].ServerID == e.ServerID) { e.ServerName = m_Servers[i].Name; } } QuickLogin.Add(e); Cursor.Hourglass = true; Network.Send(new PCharSelect(m_CharacterNames[tag], tag)); if (Animations.IsLoading) { Gumps.Desktop.Children.Clear(); xGumps.Display("AnimationLoad"); do { DrawNow(); } while (!Animations.WaitLoading()); } Gumps.Desktop.Children.Clear(); xGumps.Display("EnterBritannia"); DrawNow(); } }
private static void Validate(Entry e, int index) { int count = m_Entries.Count; int num2 = index + 1; while (num2 < count) { Entry entry = (Entry) m_Entries[num2]; if (((entry.AccountName == e.AccountName) && (entry.Password == e.Password)) && ((entry.ServerID == e.ServerID) && (entry.CharID == e.CharID))) { m_Entries.RemoveAt(num2); count--; } else { num2++; } } }