public void ReceiveCharacterList(ref StackDataReader p) { ParseCharacterList(ref p); ParseCities(ref p); World.ClientFeatures.SetFlags((CharacterListFlags)p.ReadUInt32BE()); CurrentLoginStep = LoginSteps.CharacterSelection; uint charToSelect = 0; bool haveAnyCharacter = false; bool canLogin = CanAutologin; if (_autoLogin) { _autoLogin = false; } string lastCharName = LastCharacterManager.GetLastCharacter(Account, World.ServerName); for (byte i = 0; i < Characters.Length; i++) { if (Characters[i].Length > 0) { haveAnyCharacter = true; if (Characters[i] == lastCharName) { charToSelect = i; break; } } } if (canLogin && haveAnyCharacter) { SelectCharacter(charToSelect); } else if (!haveAnyCharacter) { StartCharCreation(); } }
public CharacterSelectionGump() : base(0, 0) { CanCloseWithRightClick = false; int posInList = 0; int yOffset = 150; int yBonus = 0; int listTitleY = 106; LoginScene loginScene = Client.Game.GetScene <LoginScene>(); string lastCharName = LastCharacterManager.GetLastCharacter(LoginScene.Account, World.ServerName); string lastSelected = loginScene.Characters.FirstOrDefault(o => o == lastCharName); LockedFeatureFlags f = World.ClientLockedFeatures.Flags; CharacterListFlags ff = World.ClientFeatures.Flags; if (Client.Version >= ClientVersion.CV_6040 || Client.Version >= ClientVersion.CV_5020 && loginScene.Characters.Length > 5) { listTitleY = 96; yOffset = 125; yBonus = 45; } if (!string.IsNullOrEmpty(lastSelected)) { _selectedCharacter = (uint)Array.IndexOf(loginScene.Characters, lastSelected); } else if (loginScene.Characters.Length > 0) { _selectedCharacter = 0; } Add ( new ResizePic(0x0A28) { X = 160, Y = 70, Width = 408, Height = 343 + yBonus }, 1 ); bool isAsianLang = string.Compare(Settings.GlobalSettings.Language, "CHT", StringComparison.InvariantCultureIgnoreCase) == 0 || string.Compare(Settings.GlobalSettings.Language, "KOR", StringComparison.InvariantCultureIgnoreCase) == 0 || string.Compare(Settings.GlobalSettings.Language, "JPN", StringComparison.InvariantCultureIgnoreCase) == 0; bool unicode = isAsianLang; byte font = (byte)(isAsianLang ? 1 : 2); ushort hue = (ushort)(isAsianLang ? 0xFFFF : 0x0386); Add ( new Label(ClilocLoader.Instance.GetString(3000050, "Character Selection"), unicode, hue, font: font) { X = 267, Y = listTitleY }, 1 ); for (int i = 0, valid = 0; i < loginScene.Characters.Length; i++) { string character = loginScene.Characters[i]; if (!string.IsNullOrEmpty(character)) { valid++; if (valid > World.ClientFeatures.MaxChars) { break; } if (World.ClientLockedFeatures.Flags != 0 && !World.ClientLockedFeatures.CharSlots7) { if (valid == 6 && !World.ClientLockedFeatures.CharSlots6) { break; } } Add ( new CharacterEntryGump((uint)i, character, SelectCharacter, LoginCharacter) { X = 224, Y = yOffset + posInList * 40, Hue = i == _selectedCharacter ? SELECTED_COLOR : NORMAL_COLOR }, 1 ); posInList++; } } if (CanCreateChar(loginScene)) { Add ( new Button((int)Buttons.New, 0x159D, 0x159F, 0x159E) { X = 224, Y = 350 + yBonus, ButtonAction = ButtonAction.Activate }, 1 ); } Add ( new Button((int)Buttons.Delete, 0x159A, 0x159C, 0x159B) { X = 442, Y = 350 + yBonus, ButtonAction = ButtonAction.Activate }, 1 ); Add ( new Button((int)Buttons.Prev, 0x15A1, 0x15A3, 0x15A2) { X = 586, Y = 445, ButtonAction = ButtonAction.Activate }, 1 ); Add ( new Button((int)Buttons.Next, 0x15A4, 0x15A6, 0x15A5) { X = 610, Y = 445, ButtonAction = ButtonAction.Activate }, 1 ); AcceptKeyboardInput = true; ChangePage(1); }