public GComboBox(string[] List, int Index, int BackID, int NormalID, int OverID, int PressedID, int X, int Y, int Width, int Height, IFont Font, IHue HRegular, IHue HOver) : base(BackID, Width, Height, X, Y, true) { this.m_Index = -1; this.m_BackID = BackID; this.m_Font = Font; this.m_HRegular = HRegular; this.m_HOver = HOver; this.m_Button = new GButton(NormalID, OverID, PressedID, 0, 0, new OnClick(this.OpenList_OnClick)); base.m_Children.Add(this.m_Button); this.m_Button.Center(); this.m_Button.X = ((base.OffsetX + base.UseWidth) - this.m_Button.Width) - 1; this.m_Button.Y++; this.List = List; this.Index = Index; }
public static void ShowCharCreationSkills(int Str, int Dex, int Int, int vSkill1, int vSkill2, int vSkill3, int iSkill1, int iSkill2, int iSkill3) { GButton button2; GVSlider slider; GTextButton button3; GTextButton button4; GTextButton button5; Cursor.Hourglass = false; GBackground toAdd = new GBackground(0xa2c, 0x222, 0x160, 80, 80, true); toAdd.Children.Add(new GImage(0x58b, 0x42, -22)); toAdd.Children.Add(new GImage(0x589, 0x8e, -38)); toAdd.Children.Add(new GImage(0x1580, 0x97, -30)); toAdd.Children.Add(new GButton(0x119c, 120, 0x114, null)); GListBox box = new GListBox(GetFont(9), Hues.Load(0x76b), Hues.Load(0x961), 0xbbc, 40, 0x39, 0xcc, 0xd6, true); Client.Skills skills = Skills; for (int i = 0; i < 0x100; i++) { Skill skill = skills[i]; if (skill == null) { break; } box.AddItem(skill.Name); } box.OnClick = new OnClick(Engine.CharSkill_OnClick); toAdd.Children.Add(box); int num2 = 0x31 - box.ItemCount; if (num2 < 0) { num2 = 0; } GButton button = new GButton(250, 250, 0xfb, box.X + box.Width, box.Y, new OnClick(Engine.ScrollUp_OnClick)); toAdd.Children.Add(button); button2 = new GButton(0xfc, 0xfc, 0xfd, box.X + box.Width, box.Y + box.Height, new OnClick(Engine.ScrollDown_OnClick)) { Y = button2.Y - button2.Height }; toAdd.Children.Add(button2); toAdd.Children.Add(new GBackground(0x100, button.Width, button2.Y - (button.Y + button.Height), button.X, button.Y + button.Height, false)); slider = new GVSlider(0xfe, (box.X + box.Width) + 1, button.Y + button.Height, 13, button2.Y - (button.Y + button.Height), 0.0, 0.0, (double) num2, 1.0) { Y = slider.Y + slider.HalfHeight, Height = slider.Height - (slider.HalfHeight * 2), OnValueChange = new OnValueChange(Engine.ListView_OnValueChange) }; slider.SetTag("ListBox", box); slider.SetValue(0.0, false); toAdd.Children.Add(slider); button.SetTag("Scroller", slider); button2.SetTag("Scroller", slider); toAdd.Children.Add(new GBackground(0xbbc, 0x69, 0x19, 270, 0xba, true)); toAdd.Children.Add(new GBackground(0xbbc, 0x69, 0x19, 270, 0xd8, true)); toAdd.Children.Add(new GBackground(0xbbc, 0x69, 0x19, 270, 0xf6, true)); toAdd.Children.Add(new GLabel("Strength", GetFont(1), Hues.Load(1), 280, 0x38)); toAdd.Children.Add(new GLabel("Dexterity", GetFont(1), Hues.Load(1), 280, 0x56)); toAdd.Children.Add(new GLabel("Intelligence", GetFont(1), Hues.Load(1), 280, 0x74)); int[] numArray = new int[] { 0x39, 0x57, 0x75, 0xc1, 0xdf, 0xfd }; int[] numArray2 = new int[] { Str, Dex, Int, vSkill1, vSkill2, vSkill3 }; double[] numArray3 = new double[] { 10.0, 10.0, 10.0, 0.0, 0.0, 0.0 }; double[] numArray4 = new double[] { 60.0, 60.0, 60.0, 50.0, 50.0, 50.0 }; double[] numArray5 = new double[] { 80.0, 80.0, 80.0, 100.0, 100.0, 100.0 }; GSlider[] sliderArray = new GSlider[6]; GLabel[] labelArray = new GLabel[6]; for (int j = 0; j < 6; j++) { toAdd.Children.Add(new GImage(0xd5, 420, numArray[j])); toAdd.Children.Add(new GBackground(0xd6, 0x4b, 14, 0x1b1, numArray[j], false)); toAdd.Children.Add(new GImage(0xd7, 0x1fc, numArray[j])); GLabel label = new GLabel(numArray2[j].ToString(), GetFont(1), Hues.Load(1), 380, numArray[j] - 1); GSlider slider2 = new GSlider(0xd8, 0x1a8, numArray[j], 0x5d, 14, (double) numArray2[j], numArray3[j], numArray4[j], 1.0) { OnValueChange = new OnValueChange(Engine.UpdateStaticSlider_OnValueChange) }; slider2.SetTag("Static", label); slider2.SetTag("Font", GetFont(1)); slider2.SetTag("Hue", Hues.Load(1)); slider2.SetTag("Max", numArray5[j]); sliderArray[j] = slider2; labelArray[j] = label; toAdd.Children.Add(label); toAdd.Children.Add(slider2); } for (int k = 0; k < 3; k++) { string name = string.Format("Slider{0}", k + 1); sliderArray[0].SetTag(name, sliderArray[k]); sliderArray[1].SetTag(name, sliderArray[k]); sliderArray[2].SetTag(name, sliderArray[k]); sliderArray[3].SetTag(name, sliderArray[k + 3]); sliderArray[4].SetTag(name, sliderArray[k + 3]); sliderArray[5].SetTag(name, sliderArray[k + 3]); } OnClick onClick = new OnClick(Engine.CharSkillBox_OnClick); button3 = new GTextButton((iSkill1 == -1) ? "Click Here" : Skills[iSkill1].Name, GetFont(9), Hues.Load(0x76b), Hues.Load(0x961), 0x113, 0xbf, onClick) { X = 0x112, Y = 0xd1 - button3.Height }; button3.SetTag("List", box); button3.SetTag("Skill", iSkill1); toAdd.Children.Add(button3); button4 = new GTextButton((iSkill2 == -1) ? "Click Here" : Skills[iSkill2].Name, GetFont(9), Hues.Load(0x76b), Hues.Load(0x961), 0x113, 0xbf, onClick) { X = 0x112, Y = 0xef - button4.Height }; button4.SetTag("List", box); button4.SetTag("Skill", iSkill2); toAdd.Children.Add(button4); button5 = new GTextButton((iSkill3 == -1) ? "Click Here" : Skills[iSkill3].Name, GetFont(9), Hues.Load(0x76b), Hues.Load(0x961), 0x113, 0xbf, onClick) { X = 0x112, Y = 0x10d - button5.Height }; button5.SetTag("List", box); button5.SetTag("Skill", iSkill3); toAdd.Children.Add(button5); toAdd.Children.Add(new GHotspot(270, 0xba, 0x69, 0x19, button3)); toAdd.Children.Add(new GHotspot(270, 0xd8, 0x69, 0x19, button4)); toAdd.Children.Add(new GHotspot(270, 0xf6, 0x69, 0x19, button5)); Gumps.Desktop.Children.Clear(); Gumps.Desktop.Children.Add(new GBackground(0x588, ScreenWidth, ScreenHeight, false)); Gumps.Desktop.Children.Add(new GImage(0x157c, 0, 0)); Gumps.Desktop.Children.Add(new GImage(0x15a0, 0, 4)); GButton button6 = new GButton(0x1589, 0x22b, 4, new OnClick(Engine.Quit_OnClick)) { Tooltip = new Tooltip(Strings.GetString("Tooltips.Quit")) }; Gumps.Desktop.Children.Add(button6); GButton button7 = new GButton(0x15a4, 610, 0x1bd, new OnClick(Engine.CharCreationSkillsArrow_OnClick)); button7.SetTag("Strength", labelArray[0]); button7.SetTag("Dexterity", labelArray[1]); button7.SetTag("Intelligence", labelArray[2]); button7.SetTag("vSkill1", labelArray[3]); button7.SetTag("vSkill2", labelArray[4]); button7.SetTag("vSkill3", labelArray[5]); button7.SetTag("iSkill1", button3); button7.SetTag("iSkill2", button4); button7.SetTag("iSkill3", button5); Gumps.Desktop.Children.Add(button7); Gumps.Desktop.Children.Add(toAdd); }
public static void ShowCharCreationProf() { Cursor.Hourglass = false; Gumps.Desktop.Children.Clear(); GBackground toAdd = new GBackground(0xa2c, 0x222, 0x160, 80, 80, true); toAdd.Children.Add(new GImage(0x58b, 0x42, -22)); toAdd.Children.Add(new GImage(0x589, 0x8e, -38)); toAdd.Children.Add(new GImage(0x1580, 0x97, -30)); toAdd.Children.Add(new GButton(0x119c, 120, 0x114, null)); toAdd.Children.Add(new GBackground(0xbbc, 0xcc, 0xd6, 40, 0x39, true)); int num = ((toAdd.UseHeight - 0x13c) + 1) / 2; num += toAdd.OffsetY; string[] strArray = new string[] { "Warrior", "Magician", "Blacksmith", "Advanced" }; int[] numArray = new int[] { 0x15c9, 0x15c1, 0x15b3, 0x15a9 }; int[] numArray2 = new int[] { 0x23, 0x23, 10, 0x19, 10, 0x2d, 60, 10, 10, 60, 10, 10 }; int[] numArray3 = new int[] { 50, 0x2d, 5, 50, 50, 0, 50, 0x2d, 5, 50, 50, 0 }; int[] numArray4 = new int[] { 0x1b, 0x11, 40, 0x19, 0x2e, 0x2b, 7, 0x25, 0x2d, -1, -1, -1 }; for (int i = 0; i < 4; i++) { GLabel label; GButton target = new GButton(numArray[i], numArray[i], numArray[i] + 1, 0x1ad, (num + (i * 0x4f)) + 8, new OnClick(Engine.Profession_OnClick)); target.SetTag("Strength", numArray2[i * 3]); target.SetTag("Dexterity", numArray2[(i * 3) + 1]); target.SetTag("Intelligence", numArray2[(i * 3) + 2]); target.SetTag("vSkill1", numArray3[i * 3]); target.SetTag("vSkill2", numArray3[(i * 3) + 1]); target.SetTag("vSkill3", numArray3[(i * 3) + 2]); target.SetTag("iSkill1", numArray4[i * 3]); target.SetTag("iSkill2", numArray4[(i * 3) + 1]); target.SetTag("iSkill3", numArray4[(i * 3) + 2]); toAdd.Children.Add(new GMouseRouter(0x589, 420, num + (i * 0x4f), target)); toAdd.Children.Add(target); label = new GLabel(strArray[i], GetFont(9), Hues.Load(0x76b), 0, 0) { X = 410 - label.Width, Y = (num + (i * 0x4f)) + ((80 - label.Height) / 2) }; toAdd.Children.Add(label); } Gumps.Desktop.Children.Add(new GBackground(0x588, ScreenWidth, ScreenHeight, false)); Gumps.Desktop.Children.Add(toAdd); Gumps.Desktop.Children.Add(new GImage(0x157c, 0, 0)); Gumps.Desktop.Children.Add(new GImage(0x15a0, 0, 4)); GButton button2 = new GButton(0x1589, 0x22b, 4, new OnClick(Engine.Quit_OnClick)) { Tooltip = new Tooltip(Strings.GetString("Tooltips.Quit")) }; Gumps.Desktop.Children.Add(button2); }
public static void ShowCharCitySelection(int Str, int Dex, int Int, int vSkill1, int vSkill2, int vSkill3, int iSkill1, int iSkill2, int iSkill3, int hSkinTone, int hShirtColor, int hPantsColor, int hHairColor, int hFacialHairColor, string Name, int Gender) { Cursor.Hourglass = false; Point[] pointArray = new Point[] { new Point(0x2c, 0x5e), new Point(190, 0x2f), new Point(0x74, 0x9a), new Point(0x152, 0x6f), new Point(0x8f, 0x102), new Point(0x116, 0xcb), new Point(0x68, 0x15b), new Point(0x2a, 0xc6), new Point(220, 0x54) }; string[] strArray = new string[] { "Yew", "Minoc", "Britain", "Moonglow", "Trinsic", "Magincia", "Jhelom", "Skara Brae", "Vesper" }; Gumps.Desktop.Children.Clear(); Gumps.Desktop.Children.Add(new GBackground(0x588, ScreenWidth, ScreenHeight, false)); Gumps.Desktop.Children.Add(new GImage(0x157c, 0, 0)); Gumps.Desktop.Children.Add(new GImage(0x15a0, 0, 4)); GButton toAdd = new GButton(0x1589, 0x22b, 4, new OnClick(Engine.Quit_OnClick)) { Tooltip = new Tooltip(Strings.GetString("Tooltips.Quit")) }; Gumps.Desktop.Children.Add(toAdd); Gumps.Desktop.Children.Add(new GBackground(0xbbc, 0x9e, 0x16f, 0x1c4, 60, true)); GImage image = new GImage(0x1598, 0x39, 0x31); for (int i = 0; i < 9; i++) { GTextButton button2; GImage image2 = new GImage(0x4b9, pointArray[i].X, pointArray[i].Y); image.Children.Add(image2); button2 = new GTextButton(strArray[i], GetUniFont(0), Hues.Load(0x58), Hues.Load(0x35), pointArray[i].X, 0, new OnClick(Engine.City_OnClick)) { Y = (pointArray[i].Y - button2.Height) - 1 }; if (i == 3) { button2.X = (pointArray[i].X + 14) - button2.Width; } button2.SetTag("Strength", Str); button2.SetTag("Dexterity", Dex); button2.SetTag("Intelligence", Int); button2.SetTag("vSkill1", vSkill1); button2.SetTag("vSkill2", vSkill2); button2.SetTag("vSkill3", vSkill3); button2.SetTag("iSkill1", iSkill1); button2.SetTag("iSkill2", iSkill2); button2.SetTag("iSkill3", iSkill3); button2.SetTag("Skin Tone", hSkinTone); button2.SetTag("Shirt Color", hShirtColor); button2.SetTag("Pants Color", hPantsColor); button2.SetTag("Hair Color", hHairColor); button2.SetTag("Facial Hair Color", hFacialHairColor); button2.SetTag("CityID", i); button2.SetTag("Name", Name); button2.SetTag("Gender", Gender); image.Children.Add(button2); int x = Smallest(image2.X, button2.X); int y = Smallest(image2.Y, button2.Y); int width = Biggest(image2.X + image2.Width, button2.X + button2.Width) - x; int height = Biggest(image2.Y + image2.Height, button2.Y + button2.Height) - y; GHotspot hotspot = new GHotspot(x, y, width, height, button2) { Tooltip = new Tooltip("Click here to enter this city") }; image.Children.Add(hotspot); } Gumps.Desktop.Children.Add(image); }
public static void ShowCharAppearance(int Str, int Dex, int Int, int vSkill1, int vSkill2, int vSkill3, int iSkill1, int iSkill2, int iSkill3) { Cursor.Hourglass = false; Gumps.Desktop.Children.Clear(); Gumps.Desktop.Children.Add(new GBackground(0x588, ScreenWidth, ScreenHeight, false)); Gumps.Desktop.Children.Add(new GImage(0x157c, 0, 0)); Gumps.Desktop.Children.Add(new GImage(0x15a0, 0, 4)); GButton toAdd = new GButton(0x1589, 0x22b, 4, new OnClick(Engine.Quit_OnClick)) { Tooltip = new Tooltip(Strings.GetString("Tooltips.Quit")) }; Gumps.Desktop.Children.Add(toAdd); Gumps.Desktop.Children.Add(new GImage(0x709, 280, 0x35)); GTextBox box = new GTextBox(0, false, 0xf8, 0x4b, 0xd7, 0x10, "Name", GetFont(5), Hues.Load(0x76b), Hues.Load(0x835), Hues.Load(0x25)) { Tooltip = new Tooltip(Strings.GetString("Tooltips.CharCreateName")) }; Gumps.Desktop.Children.Add(new GImage(0x70a, 240, 0x49)); Gumps.Desktop.Children.Add(new GBackground(0x70b, 0xd7, 0x10, 0xf8, 0x49, false)); Gumps.Desktop.Children.Add(new GImage(0x70c, 0x1cf, 0x49)); Gumps.Desktop.Children.Add(box); GImage image = new GImage(0x708, 0xee, 0x62); GButton button2 = new GButton(0x710, 0x48, 320, new OnClick(Engine.CharGender_OnClick)); button2.SetTag("Gender", 0); image.Children.Add(button2); Gumps.Desktop.Children.Add(image); Gumps.Desktop.Children.Add(new GBackground(0xe14, 0x97, 310, 0x52, 0x7d, true)); GBackground background = new GBackground(0xe14, 0x97, 310, 0x1db, 0x7d, true); string[] strArray = new string[] { "Skin Tone", "Shirt Color", "Pants Color", "Hair Color", "Facial Hair Color" }; string[] strArray2 = new string[] { Strings.GetString("Tooltips.CharCreateSkinTone"), Strings.GetString("Tooltips.CharCreateShirtHue"), Strings.GetString("Tooltips.CharCreatePantsHue"), Strings.GetString("Tooltips.CharCreateHairHue"), Strings.GetString("Tooltips.CharCreateFHairHue") }; int[] numArray = new int[] { GetRandomSkinHue(), GetRandomHue(), GetRandomHue(), GetRandomHairHue(), GetRandomHairHue(), GetRandomYellowHue() }; numArray[0] ^= 0x8000; if (!Map.m_ItemFlags[0x1517][TileFlag.PartialHue]) { numArray[1] ^= 0x8000; } if (!Map.m_ItemFlags[0x152e][TileFlag.PartialHue]) { numArray[2] ^= 0x8000; } if (!Map.m_ItemFlags[0x203b][TileFlag.PartialHue]) { numArray[3] ^= 0x8000; } if (!Map.m_ItemFlags[0x2040][TileFlag.PartialHue]) { numArray[4] ^= 0x8000; } if (!Map.m_ItemFlags[0x170f][TileFlag.PartialHue]) { numArray[5] ^= 0x8000; } Gump[] gumpArray = new Gump[] { new GImage(0x761, Hues.Load(numArray[0]), 0, 0), new GImage(0x739, Hues.Load(numArray[1]), 0, 0), new GImage(0x738, Hues.Load(numArray[2]), 0, 0), new GImage(0x753, Hues.Load(numArray[3]), 0, 0), new GImage(0x759, Hues.Load(numArray[4]), 0, 0), new GImage(0x762, Hues.Load(numArray[5]), 0, 0) }; gumpArray[0].SetTag("ItemID", 0); gumpArray[1].SetTag("ItemID", 0x1517); gumpArray[2].SetTag("ItemID", 0x152e); gumpArray[3].SetTag("ItemID", 0x203b); gumpArray[4].SetTag("ItemID", 0x2040); gumpArray[5].SetTag("ItemID", 0x170f); button2.SetTag("Image", gumpArray[0]); int offsetY = background.OffsetY; image.Children.Add(gumpArray[0]); image.Children.Add(gumpArray[5]); image.Children.Add(gumpArray[1]); image.Children.Add(gumpArray[2]); image.Children.Add(gumpArray[4]); image.Children.Add(gumpArray[3]); GButton button3 = new GButton(0x15a4, 610, 0x1bd, new OnClick(Engine.CharCreationAppearanceArrow_OnClick)); button2.SetTag("Image[5]", gumpArray[5]); button2.SetTag("Arrow", button3); UnicodeFont uniFont = GetUniFont(0); for (int i = 0; i < 5; i++) { GTextButton button4 = new GTextButton(strArray[i], uniFont, Hues.Bright, Hues.Load(0x26), background.OffsetX, offsetY, new OnClick(Engine.AppearanceHueProperty_OnClick)) { SpaceWidth = 6 }; offsetY += button4.Height - 2; GHuePreview preview = new GHuePreview(background.OffsetX, offsetY, 100, 0x10, numArray[i], false); offsetY += 0x10; button4.Tooltip = new Tooltip(strArray2[i]); button4.SetTag("Property", strArray[i]); button4.SetTag("Preview", preview); button4.SetTag("Image", gumpArray[i]); button2.SetTag(string.Format("Image[{0}]", i), gumpArray[i]); button3.SetTag(strArray[i], preview); background.Children.Add(button4); background.Children.Add(preview); GHotspot hotspot = new GHotspot(button4.X, button4.Y, Biggest(button4.Width, preview.Width), (preview.Y + preview.Height) - button4.Y, button4) { Tooltip = new Tooltip(strArray2[i]) }; background.Children.Add(hotspot); if (i == 4) { button2.SetTag("HideHS", hotspot); button2.SetTag("HideTB", button4); button2.SetTag("HideHP", preview); } } Gumps.Desktop.Children.Add(background); button3.SetTag("Strength", Str); button3.SetTag("Dexterity", Dex); button3.SetTag("Intelligence", Int); button3.SetTag("vSkill1", vSkill1); button3.SetTag("vSkill2", vSkill2); button3.SetTag("vSkill3", vSkill3); button3.SetTag("iSkill1", iSkill1); button3.SetTag("iSkill2", iSkill2); button3.SetTag("iSkill3", iSkill3); button3.SetTag("Name", box); button3.SetTag("Gender", 0); Gumps.Desktop.Children.Add(button3); }
public static void City_OnClick(Gump Sender) { int tag = (int) Sender.GetTag("Strength"); int num2 = (int) Sender.GetTag("Dexterity"); int num3 = (int) Sender.GetTag("Intelligence"); int num4 = (int) Sender.GetTag("vSkill1"); int num5 = (int) Sender.GetTag("vSkill2"); int num6 = (int) Sender.GetTag("vSkill3"); int num7 = (int) Sender.GetTag("iSkill1"); int num8 = (int) Sender.GetTag("iSkill2"); int num9 = (int) Sender.GetTag("iSkill3"); int num10 = (int) Sender.GetTag("Skin Tone"); int num11 = (int) Sender.GetTag("Shirt Color"); int num12 = (int) Sender.GetTag("Pants Color"); int num13 = (int) Sender.GetTag("Hair Color"); int num14 = (int) Sender.GetTag("Facial Hair Color"); int num15 = (int) Sender.GetTag("CityID"); string name = (string) Sender.GetTag("Name"); int num16 = (int) Sender.GetTag("Gender"); if (((((((num4 + num5) + num6) == 100) && ((num7 != num8) && (num7 != num9))) && ((num8 != num9) && (((tag + num2) + num3) == 80))) && (((name != null) && (name.Length > 1)) && ((num15 >= 0) && (num15 < 9)))) && ((num16 >= 0) && (num16 <= 1))) { GLabel label; Cursor.Hourglass = true; int num17 = 0; for (int i = 0; i < 5; i++) { if ((m_CharacterNames[i] == null) || (m_CharacterNames[i].Length <= 0)) { num17 = i; break; } } Network.Send(new PCreateCharacter(name, (byte) num16, (byte) tag, (byte) num2, (byte) num3, (byte) num7, (byte) num4, (byte) num8, (byte) num5, (byte) num9, (byte) num6, (short) (num10 | 0x8000), 0x203b, (short) (num13 & 0x7fff), 0x2040, (short) (num14 & 0x7fff), (short) num15, (short) num17, Network.ClientIP, (short) (num11 & 0x7fff), (short) (num12 & 0x7fff))); if (Animations.IsLoading) { Gumps.Desktop.Children.Clear(); xGumps.Display("AnimationLoad"); do { DrawNow(); } while (!Animations.WaitLoading()); } Gumps.Desktop.Children.Clear(); GBackground toAdd = new GBackground(0xa2c, 0x164, 0xd4, 0x8e, 0x86, true); label = new GLabel("Entering Britannia..", GetFont(2), Hues.Load(0x75f), 0x74, 0x2a) { X = (toAdd.Width - label.Width) / 2 }; toAdd.Children.Add(label); toAdd.Children.Add(new GButton(0x47e, 0xa4, 170, null)); Gumps.Desktop.Children.Add(new GBackground(0x588, ScreenWidth, ScreenHeight, false)); Gumps.Desktop.Children.Add(toAdd); Gumps.Desktop.Children.Add(new GImage(0x157c, 0, 0)); Gumps.Desktop.Children.Add(new GImage(0x15a0, 0, 4)); GButton button = new GButton(0x1589, 0x22b, 4, new OnClick(Engine.Quit_OnClick)) { Tooltip = new Tooltip(Strings.GetString("Tooltips.Quit")) }; Gumps.Desktop.Children.Add(button); DrawNow(); } }
public static Gump OpenSpellbook(int circle, int lastSpell, Item container) { SpellList necromancerList; container.OpenSB = true; container.Circle = circle; container.LastSpell = lastSpell; circle &= -2; Engine.Sounds.PlaySound(0x55); Engine.DoEvents(); GDragable dragable = new GDragable(GetBookIndex(container.ID), 0, 0); dragable.SetTag("Container", container); dragable.SetTag("Dispose", "Spellbook"); dragable.Children.Add(new GMinimizer()); if (container.SpellbookOffset == 0x65) { necromancerList = NecromancerList; } else if (container.SpellbookOffset == 0xc9) { necromancerList = PaladinList; } else { necromancerList = RegularList; } if ((lastSpell >= necromancerList.Start) && (lastSpell < (necromancerList.Start + necromancerList.Spells.Length))) { int num = (lastSpell - necromancerList.Start) / necromancerList.SpellsPerCircle; int num2 = (lastSpell - necromancerList.Start) % necromancerList.SpellsPerCircle; if ((num >= 0) && (num < necromancerList.Circles)) { if (num == circle) { dragable.Children.Add(new GImage(0x8ad, 0xb8, 2)); dragable.Children.Add(new GImage(0x8af, 0xb7, 0x34 + (num2 * 15))); } else if (num == (circle + 1)) { dragable.Children.Add(new GImage(0x8ae, 0xcc, 3)); dragable.Children.Add(new GImage(0x8b0, 0xcc, 0x34 + (num2 * 15))); } } } dragable.Children.Add(new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 0x6a, 10)); dragable.Children.Add(new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 0x10d, 10)); OnClick clickHandler = new OnClick(Spells.ChangeCircle_OnClick); int[] numArray = new int[] { 0x3a, 0x5d, 130, 0xa4, 0xe3, 260, 0x129, 0x14c }; int[] numArray2 = new int[] { 0x34, 0x34 }; if (necromancerList.DisplayIndex) { for (int j = 0; j < necromancerList.Circles; j++) { GButton toAdd = new GButton(0x8b1 + j, 0x8b1 + j, 0x8b1 + j, numArray[j], 0xaf, clickHandler); toAdd.SetTag("Circle", j); dragable.Children.Add(toAdd); } } if (necromancerList.DisplayCircles) { if (circle > 0) { GButton button2 = new GButton(0x8bb, 0x8bb, 0x8bb, 50, 8, clickHandler); button2.SetTag("Circle", circle - 1); dragable.Children.Add(button2); } if (circle < ((necromancerList.Circles - 1) & -2)) { GButton button3 = new GButton(0x8bc, 0x8bc, 0x8bc, 0x141, 8, clickHandler); button3.SetTag("Circle", circle + 2); dragable.Children.Add(button3); } for (int k = circle; k < (circle + 2); k++) { string str; int x = ((k & 1) == 0) ? 0x3e : 0xe1; if ((k < 0) || (k >= m_Numbers.Length)) { str = "Bad"; } else { str = m_Numbers[k]; } dragable.Children.Add(new GLabel(string.Format("{0} Circle", str), Engine.GetFont(6), Hues.Default, x, 30)); } } int num6 = circle * necromancerList.SpellsPerCircle; int num7 = (circle + 2) * necromancerList.SpellsPerCircle; for (int i = num6; i < num7; i++) { if (((i >= num6) && (i < num7)) && container.GetSpellContained(i)) { int num9 = i / necromancerList.SpellsPerCircle; Spell spellByID = GetSpellByID(container.SpellbookOffset + i); if (spellByID != null) { IntPtr ptr; GSpellName name = new GSpellName(container.SpellbookOffset + i, spellByID.Name, Engine.GetFont(9), Hues.Load(0x288), Hues.Load(0x28b), 0x3e + ((num9 & 1) * 0xa3), numArray2[num9 & 1]); numArray2[(int)(ptr = (IntPtr)(num9 & 1))] = numArray2[(int)ptr] + 15; string str2 = string.Format("{0}\n", spellByID.Name); StringBuilder builder = new StringBuilder(); builder.Append(spellByID.Name); builder.Append('\n'); for (int m = 0; m < spellByID.Power.Length; m++) { builder.Append(spellByID.Power[m].Name); builder.Append(' '); } for (int n = 0; n < spellByID.Reagents.Count; n++) { builder.Append('\n'); Reagent reagent = (Reagent)spellByID.Reagents[n]; builder.Append(reagent.Name); } if (spellByID.Tithing > 0) { builder.Append('\n'); builder.AppendFormat("Tithing: {0}", spellByID.Tithing); } if (spellByID.Mana > 0) { builder.Append('\n'); builder.AppendFormat("Mana: {0}", spellByID.Mana); } if (spellByID.Skill > 0) { builder.Append('\n'); builder.AppendFormat("Skill: {0}", spellByID.Skill); } Tooltip tooltip = new Tooltip(builder.ToString(), true); name.Tooltip = tooltip; dragable.Children.Add(name); } } } return(dragable); }
private static void StringQuery(PacketReader pvSrc) { GDragable dragable; GWrappedLabel label2; int num = pvSrc.ReadInt32(); short num2 = pvSrc.ReadInt16(); int fixedLength = pvSrc.ReadInt16(); string text = pvSrc.ReadString(fixedLength); bool flag = pvSrc.ReadBoolean(); byte num4 = pvSrc.ReadByte(); int num5 = pvSrc.ReadInt32(); int num6 = pvSrc.ReadInt16(); string str2 = pvSrc.ReadString(num6); dragable = new GDragable(0x474, 0, 0) { CanClose = false, Modal = true, X = (Engine.ScreenWidth - dragable.Width) / 2, Y = (Engine.ScreenHeight - dragable.Height) / 2 }; GButton toAdd = new GButton(0x47b, 0x47d, 0x47c, 0x75, 190, new OnClick(Engine.StringQueryOkay_OnClick)); GButton button2 = new GButton(0x478, 0x47a, 0x479, 0xcc, 190, flag ? new OnClick(Engine.StringQueryCancel_OnClick) : null); if (!flag) { button2.Enabled = false; } GImage image = new GImage(0x477, 60, 0x91); GWrappedLabel label = new GWrappedLabel(text, Engine.GetFont(2), Hues.Load(0x455), 60, 0x30, 0x110); label2 = new GWrappedLabel(str2, Engine.GetFont(2), Hues.Load(0x455), 60, 0x30, 0x110) { Y = image.Y - label2.Height }; GTextBox box = new GTextBox(0, false, 0x44, 140, image.Width - 8, image.Height, "", Engine.GetFont(1), Hues.Load(0x455), Hues.Load(0x455), Hues.Load(0x455)); box.Focus(); if (num4 == 1) { box.MaxChars = num5; } toAdd.SetTag("Dialog", dragable); toAdd.SetTag("Serial", num); toAdd.SetTag("Type", num2); toAdd.SetTag("Text", box); button2.SetTag("Dialog", dragable); button2.SetTag("Serial", num); button2.SetTag("Type", num2); dragable.Children.Add(label); dragable.Children.Add(label2); dragable.Children.Add(image); dragable.Children.Add(box); dragable.Children.Add(button2); dragable.Children.Add(toAdd); dragable.m_CanDrag = true; Gumps.Desktop.Children.Add(dragable); }
public static void OpenPaperdoll(Mobile m, string Name, bool canDrag) { if (m != null) { GPaperdoll paperdoll; bool flag = m.Paperdoll != null; bool flag2 = flag && (m_LastOver == m.Paperdoll); bool flag3 = flag && (m_Drag == m.Paperdoll); int num = flag3 ? m_Drag.m_OffsetX : 0; int num2 = flag3 ? m_Drag.m_OffsetY : 0; int index = flag ? m.Paperdoll.Parent.Children.IndexOf(m.Paperdoll) : -1; int x = 0x7fffffff; int y = 5; if (flag) { x = m.Paperdoll.X; y = m.Paperdoll.Y; Destroy(m.Paperdoll); } else if ((m.PaperdollX < 0x7fffffff) && (m.PaperdollY < 0x7fffffff)) { x = m.PaperdollX; y = m.PaperdollY; m.PaperdollX = 0x7fffffff; m.PaperdollY = 0x7fffffff; } OnClick[] clickArray2 = new OnClick[8]; clickArray2[0] = new OnClick(Engine.Help_OnClick); clickArray2[1] = new OnClick(Engine.Options_OnClick); clickArray2[2] = new OnClick(Engine.LogOut_OnClick); clickArray2[3] = new OnClick(Engine.Journal_OnClick); clickArray2[4] = new OnClick(Engine.Skills_OnClick); clickArray2[6] = new OnClick(Engine.AttackModeToggle_OnClick); clickArray2[7] = new OnClick(Engine.Status_OnClick); OnClick[] clickArray = clickArray2; int[] numArray = new int[] { 0x2c, 0x47, 0x62, 0x7c, 0x97, 0xb3, 0xcd, 0xe9 }; int[] numArray3 = new int[] { 0x7ef, 0x7d6, 0x7d9, 0x7dc, 0x7df, 0x7e2, 0, 0x7eb }; numArray3[6] = World.Player.Flags[MobileFlag.Warmode] ? 0x7e8 : 0x7e5; int[] numArray2 = numArray3; if (m.Player) { paperdoll = new GPaperdoll(m, 0x7d0, x, y); if (!flag && (x >= 0x7fffffff)) { paperdoll.X = (Engine.ScreenWidth - paperdoll.Width) - 5; } paperdoll.Children.Add(new GButton(0x7ef, 0x7f1, 0x7f0, 0xb9, 0x2c, null)); GButton[] buttonArray = new GButton[7]; for (int i = 0; i < 7; i++) { buttonArray[i] = new GButton(numArray2[i], numArray2[i] + 2, numArray2[i] + 1, 0xb9, numArray[i], clickArray[i]); buttonArray[i].Enabled = clickArray[i] != null; paperdoll.Children.Add(buttonArray[i]); } } else { paperdoll = new GPaperdoll(m, 0x7d1, x, y); if (!flag && (x >= 0x7fffffff)) { paperdoll.X = (Engine.ScreenWidth - paperdoll.Width) - 5; } } paperdoll.Children.Add(new GVirtueTrigger(m)); GButton toAdd = new GButton(numArray2[7], numArray2[7] + 2, numArray2[7] + 1, 0xb9, numArray[7], clickArray[7]); toAdd.SetTag("Serial", m.Serial); paperdoll.Children.Add(toAdd); int hueID = (ushort) m.Hue; bool flag4 = false; int gender = 0; int body = m.Body; hueID ^= 0x8000; IHue h = Hues.Load(hueID); Engine.m_Animations.Translate(ref body, ref h); switch (body) { case 400: gender = 0; paperdoll.Children.Add(new GImage(12, h, 8, 0x13)); break; case 0x191: gender = 1; paperdoll.Children.Add(new GImage(13, h, 8, 0x13)); break; case 0x192: case 0x193: { GImage image = new GImage((m.Gender == 0) ? 12 : 13, 8, 0x13) { Alpha = 0.25f }; paperdoll.Children.Add(image); flag4 = true; break; } case 0x3db: gender = m.Gender; paperdoll.Children.Add(new GImage((m.Gender == 0) ? 12 : 13, Hues.Load(0x3ea), 8, 0x13)); paperdoll.Children.Add(new GImage(0xee3b, h, 8, 0x13)); break; default: { int paperdollGump = Config.GetPaperdollGump(body); if (paperdollGump != 0) { paperdoll.Children.Add(new GImage(paperdollGump, h, 8, 0x13)); } break; } } paperdoll.Gender = gender; if (flag4) { for (int j = 0; j < m.Equip.Count; j++) { EquipEntry entry = (EquipEntry) m.Equip[j]; if (entry.m_Layer == Layer.OuterTorso) { int iD = entry.m_Item.ID; int hue = entry.m_Item.Hue; int gumpID = GetEquipGumpID(iD, gender, ref hue); GPaperdollItem item = new GPaperdollItem(8, 0x13, gumpID, entry.m_Item.Serial, Hues.GetItemHue(iD, hue), (int) entry.m_Layer, m, canDrag) { Alpha = 0.5f }; paperdoll.Children.Add(item); } } } else { LayerComparer comparer = LayerComparer.Paperdoll; m.Equip.Sort(comparer); for (int k = 0; k < m.Equip.Count; k++) { EquipEntry entry2 = (EquipEntry) m.Equip[k]; if (comparer.IsValid(entry2.m_Layer)) { int itemID = entry2.m_Item.ID; int num17 = entry2.m_Item.Hue; int num18 = GetEquipGumpID(itemID, gender, ref num17); paperdoll.Children.Add(new GPaperdollItem(8, 0x13, num18, entry2.m_Item.Serial, Hues.GetItemHue(itemID, num17), (int) entry2.m_Layer, m, canDrag)); } } m.Equip.Sort(LayerComparer.FromDirection(m.Direction)); } paperdoll.Children.Add(new GProfileScroll(m)); paperdoll.Children.Add(new GWrappedLabel(Name, Engine.GetFont(1), Hues.Load(0x769), 0x27, 0x108, 0xb8)); paperdoll.SetTag("Dispose", "Paperdoll"); paperdoll.SetTag("Serial", m.Serial); if (flag2) { m_LastOver = paperdoll; } if (flag3) { paperdoll.m_IsDragging = true; paperdoll.OffsetX = num; paperdoll.OffsetY = num2; m_Drag = paperdoll; } if (((paperdoll.X + paperdoll.Width) - paperdoll.m_DragClipX) < 0) { paperdoll.X = paperdoll.m_DragClipX - paperdoll.Width; } else if ((paperdoll.X + paperdoll.m_DragClipX) >= Engine.ScreenWidth) { paperdoll.X = Engine.ScreenWidth - paperdoll.m_DragClipX; } if (((paperdoll.Y + paperdoll.Height) - paperdoll.m_DragClipY) < 0) { paperdoll.Y = paperdoll.m_DragClipY - paperdoll.Height; } else if ((paperdoll.Y + paperdoll.m_DragClipY) >= Engine.ScreenHeight) { paperdoll.Y = Engine.ScreenHeight - paperdoll.m_DragClipY; } if (index != -1) { Desktop.Children.Insert(index, paperdoll); } else { Desktop.Children.Add(paperdoll); } m.Paperdoll = paperdoll; } }
public static void MessageBoxOk(string Prompt, bool Modal, OnClick ClickHandler) { GBackground background = new GBackground(0xa2c, 0x164, 0xd4, 0x8e, 0x86, true); GButton toAdd = new GButton(0x481, 0xa4, 170, new OnClick(Gumps.MessageBoxOk_OnClick)); toAdd.SetTag("Dialog", background); toAdd.SetTag("ClickHandler", ClickHandler); GWrappedLabel label = new GWrappedLabel(Prompt, Engine.GetFont(1), Hues.Load(0x76b), background.OffsetX, background.OffsetY, (Engine.ScreenWidth / 2) - (background.OffsetX * 2)); background.Width = label.Width + (background.OffsetX * 2); background.Height = (label.Height + 10) + (background.OffsetY * 2); if (background.Width < 150) { background.Width = 150; } background.Center(); toAdd.X = (background.Width - toAdd.Width) / 2; toAdd.Y = background.Height - background.OffsetY; background.Children.Add(label); background.Children.Add(toAdd); if (Modal) { background.Modal = true; } background.m_CanDrag = true; background.m_QuickDrag = true; m_Desktop.Children.Add(background); }
public static Gump OpenSpellbook(int circle, int lastSpell, Item container) { SpellList necromancerList; container.OpenSB = true; container.Circle = circle; container.LastSpell = lastSpell; circle &= -2; Engine.Sounds.PlaySound(0x55); Engine.DoEvents(); GDragable dragable = new GDragable(GetBookIndex(container.ID), 0, 0); dragable.SetTag("Container", container); dragable.SetTag("Dispose", "Spellbook"); dragable.Children.Add(new GMinimizer()); if (container.SpellbookOffset == 0x65) { necromancerList = NecromancerList; } else if (container.SpellbookOffset == 0xc9) { necromancerList = PaladinList; } else { necromancerList = RegularList; } if ((lastSpell >= necromancerList.Start) && (lastSpell < (necromancerList.Start + necromancerList.Spells.Length))) { int num = (lastSpell - necromancerList.Start) / necromancerList.SpellsPerCircle; int num2 = (lastSpell - necromancerList.Start) % necromancerList.SpellsPerCircle; if ((num >= 0) && (num < necromancerList.Circles)) { if (num == circle) { dragable.Children.Add(new GImage(0x8ad, 0xb8, 2)); dragable.Children.Add(new GImage(0x8af, 0xb7, 0x34 + (num2 * 15))); } else if (num == (circle + 1)) { dragable.Children.Add(new GImage(0x8ae, 0xcc, 3)); dragable.Children.Add(new GImage(0x8b0, 0xcc, 0x34 + (num2 * 15))); } } } dragable.Children.Add(new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 0x6a, 10)); dragable.Children.Add(new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 0x10d, 10)); OnClick clickHandler = new OnClick(Spells.ChangeCircle_OnClick); int[] numArray = new int[] { 0x3a, 0x5d, 130, 0xa4, 0xe3, 260, 0x129, 0x14c }; int[] numArray2 = new int[] { 0x34, 0x34 }; if (necromancerList.DisplayIndex) { for (int j = 0; j < necromancerList.Circles; j++) { GButton toAdd = new GButton(0x8b1 + j, 0x8b1 + j, 0x8b1 + j, numArray[j], 0xaf, clickHandler); toAdd.SetTag("Circle", j); dragable.Children.Add(toAdd); } } if (necromancerList.DisplayCircles) { if (circle > 0) { GButton button2 = new GButton(0x8bb, 0x8bb, 0x8bb, 50, 8, clickHandler); button2.SetTag("Circle", circle - 1); dragable.Children.Add(button2); } if (circle < ((necromancerList.Circles - 1) & -2)) { GButton button3 = new GButton(0x8bc, 0x8bc, 0x8bc, 0x141, 8, clickHandler); button3.SetTag("Circle", circle + 2); dragable.Children.Add(button3); } for (int k = circle; k < (circle + 2); k++) { string str; int x = ((k & 1) == 0) ? 0x3e : 0xe1; if ((k < 0) || (k >= m_Numbers.Length)) { str = "Bad"; } else { str = m_Numbers[k]; } dragable.Children.Add(new GLabel(string.Format("{0} Circle", str), Engine.GetFont(6), Hues.Default, x, 30)); } } int num6 = circle * necromancerList.SpellsPerCircle; int num7 = (circle + 2) * necromancerList.SpellsPerCircle; for (int i = num6; i < num7; i++) { if (((i >= num6) && (i < num7)) && container.GetSpellContained(i)) { int num9 = i / necromancerList.SpellsPerCircle; Spell spellByID = GetSpellByID(container.SpellbookOffset + i); if (spellByID != null) { IntPtr ptr; GSpellName name = new GSpellName(container.SpellbookOffset + i, spellByID.Name, Engine.GetFont(9), Hues.Load(0x288), Hues.Load(0x28b), 0x3e + ((num9 & 1) * 0xa3), numArray2[num9 & 1]); numArray2[(int) (ptr = (IntPtr) (num9 & 1))] = numArray2[(int) ptr] + 15; string str2 = string.Format("{0}\n", spellByID.Name); StringBuilder builder = new StringBuilder(); builder.Append(spellByID.Name); builder.Append('\n'); for (int m = 0; m < spellByID.Power.Length; m++) { builder.Append(spellByID.Power[m].Name); builder.Append(' '); } for (int n = 0; n < spellByID.Reagents.Count; n++) { builder.Append('\n'); Reagent reagent = (Reagent) spellByID.Reagents[n]; builder.Append(reagent.Name); } if (spellByID.Tithing > 0) { builder.Append('\n'); builder.AppendFormat("Tithing: {0}", spellByID.Tithing); } if (spellByID.Mana > 0) { builder.Append('\n'); builder.AppendFormat("Mana: {0}", spellByID.Mana); } if (spellByID.Skill > 0) { builder.Append('\n'); builder.AppendFormat("Skill: {0}", spellByID.Skill); } Tooltip tooltip = new Tooltip(builder.ToString(), true); name.Tooltip = tooltip; dragable.Children.Add(name); } } } return dragable; }
private static bool Parse_Button(XmlTextReader xml, Gump Parent, string Name) { int gumpID = 0; int x = 0; int y = 0; string method = ""; ITooltip tooltip = null; bool @bool = false; bool flag2 = true; bool isEmptyElement = xml.IsEmptyElement; while (xml.MoveToNextAttribute()) { switch (xml.Name) { case "GumpID": { gumpID = GetInt(xml.Value); continue; } case "GumpIDi": { gumpID = Convert.ToInt32(xml.Value); continue; } case "GumpIDh": { gumpID = Convert.ToInt32(xml.Value.Substring(2), 0x10); continue; } case "X": { x = GetInt(xml.Value); continue; } case "Xi": { x = Convert.ToInt32(xml.Value); continue; } case "Xh": { x = Convert.ToInt32(xml.Value.Substring(2), 0x10); continue; } case "Y": { y = GetInt(xml.Value); continue; } case "Yi": { y = Convert.ToInt32(xml.Value); continue; } case "Yh": { y = Convert.ToInt32(xml.Value.Substring(2), 0x10); continue; } case "OnClick": { method = GetString(xml.Value); continue; } case "OnClicks": { method = xml.Value; continue; } case "Tooltip": { tooltip = new Tooltip(GetString(xml.Value)); continue; } case "Tooltips": { tooltip = new Tooltip(xml.Value); continue; } case "CanEnter": { @bool = GetBool(xml.Value); continue; } case "CanEnterb": { @bool = Convert.ToBoolean(xml.Value); continue; } case "Enabled": { flag2 = GetBool(xml.Value); continue; } case "Enabledb": { flag2 = Convert.ToBoolean(xml.Value); continue; } } return false; } OnClick clickHandler = null; try { if (method.Length > 0) { clickHandler = (OnClick) Delegate.CreateDelegate(typeof(OnClick), typeof(Engine), method); } } catch { clickHandler = null; } GButton toAdd = new GButton(gumpID, x, y, clickHandler) { Tooltip = tooltip, CanEnter = @bool, Enabled = flag2 }; Parent.Children.Add(toAdd); if (isEmptyElement) { return true; } while (xml.Read()) { XmlNodeType nodeType = xml.NodeType; if (nodeType != XmlNodeType.Element) { if (nodeType != XmlNodeType.Comment) { return (nodeType == XmlNodeType.EndElement); } } else if (!Parse_Element(xml, toAdd, Name)) { return false; } } return false; }