internal static void SpellBarAction(Gumps.GumpData gd) { int buttonID = gd.buttonid; List <SpellGridItem> items = Settings.SpellGrid.ReadItems(); SpellGridItem item = items[buttonID]; if (item.Group == "Abilities") { if (item.Spell == "Primary") { Player.WeaponPrimarySA(); } if (item.Spell == "Secondary") { Player.WeaponSecondarySA(); } } else if (item.Group == "Script") { Misc.ScriptRun(item.Spell); } else if (item.Group == "Skills") { Player.UseSkill(item.Spell); } else { Spells.Cast(item.Spell); } GumpSpellGrid(); }
internal static void SetSpellGridOrigin(Gumps.GumpData gd) { int buttonID = gd.buttonid; if (buttonID > 0) { int x = ((buttonID % 41) - 1) * 50; int y = (buttonID / 41) * 50; if ((x != Engine.GridX) || (y != Engine.GridY)) { Engine.GridX = x; Settings.General.WriteInt("PosXGrid", Engine.GridX); Engine.GridY = y; Settings.General.WriteInt("PosYGrid", Engine.GridY); Engine.MainWindow.SafeAction(s => { s.GridLocationLabel.Text = "X: " + Engine.GridX + " - Y:" + Engine.GridY; }); } } if (m_save_state) { Open(); } }
internal static void GetSpellGridOrigin() { if (World.Player == null) { return; } m_save_state = m_open; if (m_open) { Close(); } Gumps.GumpData gd = Gumps.CreateGump(false, true, true, false); gd.gumpId = m_spellGridGID; gd.serial = (uint)Player.Serial; Gumps.AddPage(ref gd, 0); Gumps.AddImageTiled(ref gd, 0, 0, 3000, 3000, 2624); Gumps.AddAlphaRegion(ref gd, 0, 0, 3000, 3000); Gumps.AddHtml(ref gd, 320, 215, 350, 85, @"Select a button where you would like the hotbar to open. This position will also be used if you enable auto-open on login.<br>If you have maually moved the hotbar since logging in you may have to logout and login again for this to work", (bool)true, (bool)true); Gumps.AddButton(ref gd, 700, 230, 241, 242, 0, 1, 0); // cancel Gumps.AddButton(ref gd, 700, 260, 247, 248, 0, 1, 0); // options int buttonID = 1; int squareSize = 50; for (int y = 0; y <= 1100; y += squareSize) { for (int x = 0; x <= 2000; x += squareSize) { Gumps.AddButton(ref gd, x, y, 1210, 1209, buttonID++, 1, 0); } } gd.action = SetSpellGridOrigin; Gumps.SendGump(gd, 0, 0); }
internal static void GumpSpellGrid() { List <SpellGridItem> items = Settings.SpellGrid.ReadItems(); int ActiveColor = 32; int InactiveColor = 0; int offset = 3; Gumps.GumpData spellBar = Gumps.CreateGump(false, false, false, false); spellBar.gumpId = (uint)999009999; spellBar.serial = (uint)Player.Serial; Gumps.AddPage(ref spellBar, 0); //Gumps.AddAlphaRegion(ref spellBar, Engine.GridX, Engine.GridY, 300, 300); int y = 0; int x = 0; int index = 0; foreach (SpellGridItem item in items) { int imageid = 0; GroupType g; if (Enum.TryParse <GroupType>(item.Group, out g)) { if (g != GroupType.Empty) { imageid = GetImageID(g, item.Spell); switch (imageid) { case 0: m_panellist[x].Enabled = false; break; case -1: // Script Gumps.AddButton(ref spellBar, Engine.GridX + (x * 50), Engine.GridY + (y * 50), 4502, 2205, index, 1, 0); break; case -2: // Skill Gumps.AddButton(ref spellBar, Engine.GridX + (x * 50), Engine.GridY + (y * 50), 2105, 2205, index, 1, 0); break; default: if (Gumps.IsValid(2353)) { if (item.Spell == "Primary") { if (Player.HasPrimarySpecial) { Gumps.AddImage(ref spellBar, Engine.GridX + (x * 50) + offset, Engine.GridY + (y * 50) + offset, (int)Player.PrimarySpecial, ActiveColor); } else { Gumps.AddImage(ref spellBar, Engine.GridX + (x * 50) + offset, Engine.GridY + (y * 50) + offset, (int)Player.PrimarySpecial, InactiveColor); } } else if (item.Spell == "Secondary") { if (Player.HasSecondarySpecial) { Gumps.AddImage(ref spellBar, Engine.GridX + (x * 50) + offset, Engine.GridY + (y * 50) + offset, (int)Player.SecondarySpecial, ActiveColor); } else { Gumps.AddImage(ref spellBar, Engine.GridX + (x * 50) + offset, Engine.GridY + (y * 50) + offset, (int)Player.SecondarySpecial, InactiveColor); } } else if (Enum.TryParse <SkillIcon>(item.Spell.Replace(" ", ""), out SkillIcon icon)) { if (World.Player.SkillEnabled.Contains(icon)) { Gumps.AddImage(ref spellBar, Engine.GridX + (x * 50) + offset, Engine.GridY + (y * 50) + offset, (int)imageid, ActiveColor); } else { Gumps.AddImage(ref spellBar, Engine.GridX + (x * 50) + offset, Engine.GridY + (y * 50) + offset, (int)imageid, InactiveColor); } } else { Gumps.AddImage(ref spellBar, Engine.GridX + (x * 50) + offset, Engine.GridY + (y * 50) + offset, (int)imageid, 0); } Gumps.AddButton(ref spellBar, Engine.GridX + (x * 50), Engine.GridY + (y * 50), 2353, 2205, index, 1, 0); } else { Gumps.AddButton(ref spellBar, Engine.GridX + (x * 50), Engine.GridY + (y * 50), imageid, 2205, index, 1, 0); } break; } Gumps.AddTooltip(ref spellBar, item.Spell); } } x += 1; if (x >= m_hslot) { x = 0; y += 1; if (y >= m_vslot) { break; } } index++; } spellBar.action = SpellBarAction; Gumps.SendGump(spellBar, (uint)Engine.GridX, (uint)Engine.GridY); }