private void DeleteCharacter(LoginScene loginScene) { var charName = loginScene.Characters[_selectedCharacter]; if (!string.IsNullOrEmpty(charName)) { var existing = Children.OfType <LoadingGump>().FirstOrDefault(); if (existing != null) { RemoveChildren(existing); } var text = Cliloc.GetString(1080033).Replace("~1_NAME~", charName); AddChildren(new LoadingGump(text, LoadingGump.Buttons.OK | LoadingGump.Buttons.Cancel, buttonID => { if (buttonID == (int)LoadingGump.Buttons.OK) { loginScene.DeleteCharacter(_selectedCharacter); } else { ChangePage(1); } }), 2); ChangePage(2); } }
private LoadingGump GetLoadingScreen() { var labelText = "No Text"; var showButtons = LoadingGump.Buttons.None; if (!loginScene.LoginRejectionReason.HasValue) { switch (loginScene.CurrentLoginStep) { case LoginScene.LoginStep.Connecting: labelText = Cliloc.GetString(3000002); // "Connecting..." break; case LoginScene.LoginStep.VerifyingAccount: labelText = Cliloc.GetString(3000003); // "Verifying Account..." break; case LoginScene.LoginStep.LoginInToServer: labelText = Cliloc.GetString(3000053); // logging into shard break; case LoginScene.LoginStep.EnteringBritania: labelText = Cliloc.GetString(3000001); // Entering Britania... break; } } else { switch (loginScene.LoginRejectionReason.Value) { case LoginScene.LoginRejectionReasons.BadPassword: case LoginScene.LoginRejectionReasons.InvalidAccountPassword: labelText = Cliloc.GetString(3000036); // Incorrect username and/or password. break; case LoginScene.LoginRejectionReasons.AccountInUse: labelText = Cliloc.GetString(3000034); // Someone is already using this account. break; case LoginScene.LoginRejectionReasons.AccountBlocked: labelText = Cliloc.GetString(3000035); // Your account has been blocked / banned break; case LoginScene.LoginRejectionReasons.IdleExceeded: labelText = Cliloc.GetString(3000004); // Login idle period exceeded (I use "Connection lost") break; case LoginScene.LoginRejectionReasons.BadCommuncation: labelText = Cliloc.GetString(3000037); // Communication problem. break; } showButtons = LoadingGump.Buttons.OK; } return(new LoadingGump(labelText, showButtons, OnLoadingGumpButtonClick)); }
private bool ValidateCharacter(PlayerMobile character) { if (string.IsNullOrEmpty(character.Name)) { Service.Get <CharCreationGump>().ShowMessage(Cliloc.GetString(3000612)); return(false); } return(true); }
private bool ValidateValues() { var duplicated = _skills.Where(o => o.SelectedIndex != -1).GroupBy(o => o.SelectedIndex).Where(o => o.Count() > 1).Count(); if (duplicated > 0) { Service.Get <CharCreationGump>().ShowMessage(Cliloc.GetString(1080032)); return(false); } return(true); }
public CustomColorPicker(Layer layer, int label, ushort[] pallet, int rows, int columns) { Width = 121; Height = 25; _cellW = 125 / columns; _cellH = 280 / rows; _columns = columns; _layer = layer; AddChildren(new Label(Cliloc.GetString(label), false, 0x07F4, font: 9) { X = 0, Y = 0 }); AddChildren(_colorPicker = new ColorPickerBox(1, 15, 1, 1, 121, 23, pallet)); _colorPicker.MouseClick += ColorPicker_MouseClick; _colorPickerBox = new ColorPickerBox(489, 141, rows, columns, _cellW, _cellH, pallet); _colorPickerBox.MouseOver += _colorPicker_MouseMove; }
public CharacterSelectionGump() : base(0, 0) { bool testField = FileManager.ClientVersion >= ClientVersions.CV_305D; int posInList = 0; int yOffset = 150; int yBonus = 0; int listTitleY = 106; if (FileManager.ClientVersion >= ClientVersions.CV_6040) { listTitleY = 96; yOffset = 125; yBonus = 45; } LoginScene loginScene = Engine.SceneManager.GetScene <LoginScene>(); var lastSelected = loginScene.Characters.FirstOrDefault(o => o == Service.Get <Settings>().LastCharacterName); if (lastSelected != null) { _selectedCharacter = (uint)Array.IndexOf(loginScene.Characters, lastSelected); } else if (loginScene.Characters.Length > 0) { _selectedCharacter = 0; } AddChildren(new ResizePic(0x0A28) { X = 160, Y = 70, Width = 408, Height = 343 + yBonus }, 1); AddChildren(new Label(Cliloc.GetString(3000050), false, 0x0386, font: 2) { X = 267, Y = listTitleY }, 1); for (int i = 0; i < loginScene.Characters.Length; i++) { string character = loginScene.Characters[i]; if (!string.IsNullOrEmpty(character)) { AddChildren(new CharacterEntryGump((uint)i, character, SelectCharacter, LoginCharacter) { X = 224, Y = yOffset + posInList * 40, Hue = posInList == _selectedCharacter ? SELECTED_COLOR : NORMAL_COLOR }, 1); posInList++; } } if (loginScene.Characters.Any(string.IsNullOrEmpty)) { AddChildren(new Button((int)Buttons.New, 0x159D, 0x159F, 0x159E) { X = 224, Y = 350 + yBonus, ButtonAction = ButtonAction.Activate }, 1); } AddChildren(new Button((int)Buttons.Delete, 0x159A, 0x159C, 0x159B) { X = 442, Y = 350 + yBonus, ButtonAction = ButtonAction.Activate }, 1); AddChildren(new Button((int)Buttons.Prev, 0x15A1, 0x15A3, 0x15A2) { X = 586, Y = 445, ButtonAction = ButtonAction.Activate }, 1); AddChildren(new Button((int)Buttons.Next, 0x15A4, 0x15A6, 0x15A5) { X = 610, Y = 445, ButtonAction = ButtonAction.Activate }, 1); ChangePage(1); }
public ServerSelectionGump() : base(0, 0) { AddChildren(new Button((int)Buttons.Prev, 0x15A1, 0x15A3, 0x15A2) { X = 586, Y = 445, ButtonAction = ButtonAction.Activate }); AddChildren(new Button((int)Buttons.Next, 0x15A4, 0x15A6, 0x15A5) { X = 610, Y = 445, ButtonAction = ButtonAction.Activate }); if (FileManager.ClientVersion >= ClientVersions.CV_500A) { ushort textColor = 0xFFFF; AddChildren(new Label(Cliloc.GetString(1044579), true, textColor, font: 1) { X = 155, Y = 70 }); // "Select which shard to play on:" AddChildren(new Label(Cliloc.GetString(1044577), true, textColor, font: 1) { X = 400, Y = 70 }); // "Latency:" AddChildren(new Label(Cliloc.GetString(1044578), true, textColor, font: 1) { X = 470, Y = 70 }); // "Packet Loss:" AddChildren(new Label(Cliloc.GetString(1044580), true, textColor, font: 1) { X = 153, Y = 368 }); // "Sort by:" } else { ushort textColor = 0x0481; AddChildren(new Label("Select which shard to play on:", true, textColor, font: 9) { X = 155, Y = 70 }); AddChildren(new Label("Latency:", true, textColor, font: 9) { X = 400, Y = 70 }); AddChildren(new Label("Packet Loss:", true, textColor, font: 9) { X = 470, Y = 70 }); AddChildren(new Label("Sort by:", true, textColor, font: 9) { X = 153, Y = 368 }); } AddChildren(new Button((int)Buttons.SortTimeZone, 0x093B, 0x093C, 0x093D) { X = 230, Y = 366 }); AddChildren(new Button((int)Buttons.SortFull, 0x093E, 0x093F, 0x0940) { X = 338, Y = 366 }); AddChildren(new Button((int)Buttons.SortConnection, 0x0941, 0x0942, 0x0943) { X = 446, Y = 366 }); // World Pic Bg AddChildren(new GumpPic(150, 390, 0x0589, 0)); // Earth AddChildren(new Button((int)Buttons.Earth, 0x15E8, 0x15EA, 0x15E9) { X = 160, Y = 400 }); // Sever Scroll Area Bg AddChildren(new ResizePic(0x0DAC) { X = 150, Y = 90, Width = 393 - 14, Height = 271 }); // Sever Scroll Area ScrollArea scrollArea = new ScrollArea(150, 90, 393, 271, true); LoginScene loginScene = Service.Get <LoginScene>(); foreach (ServerListEntry server in loginScene.Servers) { scrollArea.AddChildren(new ServerEntryGump(server)); } AddChildren(scrollArea); if (loginScene.Servers.Count() > 0) { if (loginScene.Servers.Last().Index < loginScene.Servers.Count()) { AddChildren(new Label(loginScene.Servers.Last().Name, false, 0x0481, font: 9) { X = 243, Y = 420 }); } else { AddChildren(new Label(loginScene.Servers.First().Name, false, 0x0481, font: 9) { X = 243, Y = 420 }); } } }
private void HandleGenreChange() { bool isFemale = _femaleRadio.IsChecked; var race = GetSelectedRace(); CurrentOption[Layer.Beard] = 1; CurrentOption[Layer.Hair] = 1; if (_paperDoll != null) { RemoveChildren(_paperDoll); } if (_hairCombobox != null) { RemoveChildren(_hairCombobox); RemoveChildren(_hairLabel); } if (_facialCombobox != null) { RemoveChildren(_facialCombobox); RemoveChildren(_facialLabel); } foreach (var customPicker in Children.OfType <CustomColorPicker>().ToList()) { RemoveChildren(customPicker); } CharacterCreationValues.ComboContent content; // Hair content = CharacterCreationValues.GetHairComboContent(isFemale, race); AddChildren(_hairLabel = new Label(Cliloc.GetString(race == RaceType.GARGOYLE ? 1112309 : 3000121), false, 0x07F4, font: 9) { X = 98, Y = 142 }, 1); AddChildren(_hairCombobox = new Combobox(97, 155, 120, content.Labels, CurrentOption[Layer.Hair]), 1); _hairCombobox.OnOptionSelected += Hair_OnOptionSelected; // Facial Hair if (!isFemale && race != RaceType.ELF) { content = CharacterCreationValues.GetFacialHairComboContent(race); AddChildren(_facialLabel = new Label(Cliloc.GetString(race == RaceType.GARGOYLE ? 1112511 : 3000122), false, 0x07F4, font: 9) { X = 98, Y = 186 }, 1); AddChildren(_facialCombobox = new Combobox(97, 199, 120, content.Labels, CurrentOption[Layer.Beard]), 1); _facialCombobox.OnOptionSelected += Facial_OnOptionSelected; } else { _facialCombobox = null; _facialLabel = null; } // Skin ushort[] pallet = CharacterCreationValues.GetSkinPallet(race); AddCustomColorPicker(489, 141, pallet, Layer.Invalid, 3000183, 8, pallet.Length >> 3); // Shirt Color AddCustomColorPicker(489, 183, null, Layer.Shirt, 3000440, 10, 20); // Pants Color if (race != RaceType.GARGOYLE) { AddCustomColorPicker(489, 225, null, Layer.Pants, 3000441, 10, 20); } // Hair pallet = CharacterCreationValues.GetHairPallet(race); AddCustomColorPicker(489, 267, pallet, Layer.Hair, race == RaceType.GARGOYLE ? 1112322 : 3000184, 8, pallet.Length >> 3); if (!isFemale && race != RaceType.ELF) { // Facial pallet = CharacterCreationValues.GetHairPallet(race); AddCustomColorPicker(489, 309, pallet, Layer.Beard, race == RaceType.GARGOYLE ? 1112512 : 3000446, 8, pallet.Length >> 3); } _character = CreateCharacter(isFemale, race); UpdateEquipments(); AddChildren(_paperDoll = new PaperDollInteractable(262, 135, _character) { AcceptMouseInput = false }, 1); }
public CreateCharTradeGump(PlayerMobile character) : base(0, 0) { _character = character; foreach (var skill in _character.Skills) { _character.UpdateSkill(skill.Index, 0, 0, Lock.Locked, 0); } AddChildren(new ResizePic(2600) { X = 100, Y = 80, Width = 470, Height = 372 }); // center menu with fancy top // public GumpPic(AControl parent, int x, int y, int gumpID, int hue) AddChildren(new GumpPic(291, 42, 0x0589, 0)); AddChildren(new GumpPic(214, 58, 0x058B, 0)); AddChildren(new GumpPic(300, 51, 0x15A9, 0)); // title text //TextLabelAscii(AControl parent, int x, int y, int font, int hue, string text, int width = 400) AddChildren(new Label(Cliloc.GetString(3000326), false, 0x0386, font: 2) { X = 148, Y = 132 }); // strength, dexterity, intelligence AddChildren(new Label(Cliloc.GetString(3000111), false, 1, font: 1) { X = 158, Y = 170 }); AddChildren(new Label(Cliloc.GetString(3000112), false, 1, font: 1) { X = 158, Y = 250 }); AddChildren(new Label(Cliloc.GetString(3000113), false, 1, font: 1) { X = 158, Y = 330 }); // sliders for attributes _attributeSliders = new HSliderBar[3]; var values = FileManager.ClientVersion >= ClientVersions.CV_70160 ? 15 : 10; AddChildren(_attributeSliders[0] = new HSliderBar(164, 196, 93, 10, 60, 60, HSliderBarStyle.MetalWidgetRecessedBar, true)); AddChildren(_attributeSliders[1] = new HSliderBar(164, 276, 93, 10, 60, values, HSliderBarStyle.MetalWidgetRecessedBar, true)); AddChildren(_attributeSliders[2] = new HSliderBar(164, 356, 93, 10, 60, values, HSliderBarStyle.MetalWidgetRecessedBar, true)); var skillCount = 3; var initialValue = 50; if (FileManager.ClientVersion >= ClientVersions.CV_70160) { skillCount = 4; initialValue = 30; } string[] skillList = Skills.SkillNames; int y = 172; _skillSliders = new HSliderBar[skillCount]; _skills = new Combobox[skillCount]; for (var i = 0; i < skillCount; i++) { if (FileManager.ClientVersion < ClientVersions.CV_70160 && i == 2) { initialValue = 0; } AddChildren(_skills[i] = new Combobox(344, y, 182, skillList, -1, 200, false, "Click here")); AddChildren(_skillSliders[i] = new HSliderBar(344, y + 32, 93, 0, 50, initialValue, HSliderBarStyle.MetalWidgetRecessedBar, true)); y += 70; } AddChildren(new Button((int)Buttons.Prev, 0x15A1, 0x15A3, 0x15A2) { X = 586, Y = 445, ButtonAction = ButtonAction.Activate }); AddChildren(new Button((int)Buttons.Next, 0x15A4, 0x15A6, 0x15A5) { X = 610, Y = 445, ButtonAction = ButtonAction.Activate }); for (int i = 0; i < _attributeSliders.Length; i++) { for (int j = 0; j < _attributeSliders.Length; j++) { if (i != j) { _attributeSliders[i].AddParisSlider(_attributeSliders[j]); } } } for (int i = 0; i < _skillSliders.Length; i++) { for (int j = 0; j < _skillSliders.Length; j++) { if (i != j) { _skillSliders[i].AddParisSlider(_skillSliders[j]); } } } }
public PopupMenuGump(PopupMenuData data) : base(0, 0) { _data = data; CloseIfClickOutside = true; //ControlInfo.IsModal = true; //ControlInfo.ModalClickOutsideAreaClosesThisControl = true; CanMove = false; ResizePic pic = new ResizePic(0x0A3C) { IsTransparent = true, Alpha = 0.25f }; AddChildren(pic); int offsetY = 10; bool arrowAdded = false; int width = 0, height = 20; foreach (PopupMenuItem item in data.Items) { string text = Cliloc.GetString(item.Cliloc); Label label = new Label(text, true, item.Hue, font: 1) { X = 10, Y = offsetY }; HitBox box = new HitBox(10, offsetY, label.Width, label.Height) { IsTransparent = true, Tag = item.Index }; box.MouseClick += (sender, e) => { if (e.Button == MouseButton.Left) { HitBox l = (HitBox)sender; GameActions.ResponsePopupMenu(_data.Serial, (ushort)l.Tag); Dispose(); } }; AddChildren(box); AddChildren(label); if ((item.Flags & 0x02) != 0 && !arrowAdded) { arrowAdded = true; // TODO: wat? AddChildren(new Button(0, 0x15E6, 0x15E2, 0x15E2) { X = 20, Y = offsetY }); height += 20; } offsetY += label.Height; if (!arrowAdded) { height += label.Height; if (width < label.Width) { width = label.Width; } } } width += 20; if (height <= 10 || width <= 20) { Dispose(); } else { pic.Width = width; pic.Height = height; foreach (HitBox box in FindControls <HitBox>()) { box.Width = width - 20; } } }
public CharacterSelectionGump() : base(0, 0) { bool testField = FileManager.ClientVersion >= ClientVersions.CV_305D; int posInList = 0; int yOffset = 150; int yBonus = 0; int listTitleY = 106; if (FileManager.ClientVersion >= ClientVersions.CV_6040) { listTitleY = 96; yOffset = 125; yBonus = 45; } AddChildren(new ResizePic(0x0A28) { X = 160, Y = 70, Width = 408, Height = 343 + yBonus }, 1); AddChildren(new Label(Cliloc.GetString(3000050), false, 0x0386, font: 2) { X = 267, Y = listTitleY }, 1); LoginScene loginScene = Service.Get <LoginScene>(); foreach (CharacterListEntry character in loginScene.Characters) { AddChildren(new CharacterEntryGump((uint)posInList, character, SelectCharacter, LoginCharacter) { X = 224, Y = yOffset + posInList * 40, Hue = posInList == 0 ? SELECTED_COLOR : NORMAL_COLOR }, 1); posInList++; } if (loginScene.Characters.Any(o => string.IsNullOrEmpty(o.Name))) { AddChildren(new Button((int)Buttons.New, 0x159D, 0x159F, 0x159E) { X = 224, Y = 350 + yBonus, ButtonAction = ButtonAction.Activate }, 1); } AddChildren(new Button((int)Buttons.Delete, 0x159A, 0x159C, 0x159B) { X = 442, Y = 350 + yBonus, ButtonAction = ButtonAction.Activate }, 1); AddChildren(new Button((int)Buttons.Prev, 0x15A1, 0x15A3, 0x15A2) { X = 586, Y = 445, ButtonAction = ButtonAction.Activate }, 1); AddChildren(new Button((int)Buttons.Next, 0x15A4, 0x15A6, 0x15A5) { X = 610, Y = 445, ButtonAction = ButtonAction.Activate }, 1); if (loginScene.Characters.Length > 0) { _selectedCharacter = 0; } ChangePage(1); }