private void Race_ValueChanged(object sender, EventArgs e) { CurrentColorOption.Clear(); HandleGenreChange(); RaceType race = GetSelectedRace(); CharacterListFlags flags = World.ClientFeatures.Flags; LockedFeatureFlags locks = World.ClientLockedFeatures.Flags; bool allowElf = (flags & CharacterListFlags.CLF_ELVEN_RACE) != 0 && (locks & LockedFeatureFlags.MondainsLegacy) != 0; bool allowGarg = (locks & LockedFeatureFlags.StygianAbyss) != 0; if (race == RaceType.ELF && !allowElf) { _nextButton.IsEnabled = false; _nextButton.Hue = 944; } else if (race == RaceType.GARGOYLE && !allowGarg) { _nextButton.IsEnabled = false; _nextButton.Hue = 944; } else { _nextButton.IsEnabled = true; _nextButton.Hue = 0; } }
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 lastSelected = loginScene.Characters.FirstOrDefault(o => o == Settings.GlobalSettings.LastCharacterName); 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 ); Add ( new Label(ClilocLoader.Instance.GetString(3000050, "Character Selection"), false, 0x0386, font: 2) { 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 = posInList == _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); }
public void SetFlags(LockedFeatureFlags flags) { Flags = flags; }