public override void OnResponse(NetState state, RelayInfo info) { if (!CSS.Running || !CentralMemory.Running) { return; } switch (info.ButtonID) { case 1: { IconsModule mod = new IconsModule(state.Mobile.Serial, m_Info); CentralMemory.AppendModule(state.Mobile.Serial, (Module)mod, true); state.Mobile.SendMessage("That icon has been removed and will not open again."); break; } case 2: { if (!Multis.DesignContext.Check(state.Mobile)) { state.Mobile.SendMessage("You cannot cast while customizing!"); state.Mobile.SendGump(new SpellIconGump(m_Info)); return; } if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Info.SpellType)) { state.Mobile.SendMessage("You are not allowed to cast this spell."); return; } if (!CSpellbook.MobileHasSpell(state.Mobile, m_Info.School, m_Info.SpellType)) { state.Mobile.SendMessage("You do not have this spell."); goto case 1; } Spell spell = SpellInfoRegistry.NewSpell(m_Info.SpellType, m_Info.School, state.Mobile, null); if (spell != null) { spell.Cast(); } else { state.Mobile.SendMessage("This spell has been disabled."); goto case 1; } state.Mobile.SendGump(new SpellIconGump(m_Info)); break; } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { //Apply case 1: { if (!CentralMemory.Running) { from.SendMessage("There is no Central Memory! Please page an Admin to assist."); return; } IconInfo ii = new IconInfo(m_Spell, m_Icon, m_X, m_Y, m_Background, m_School); if (!CentralMemory.ContainsModule(from.Serial, typeof(IconsModule))) { CentralMemory.AddModule(from.Serial, typeof(IconsModule)); } IconsModule im = new IconsModule(from.Serial); im.Add(ii); CentralMemory.AppendModule(from.Serial, (Module)im, false); from.SendGump(new SpellIconGump(ii)); break; } //Move case 2: { TextRelay xrelay = info.GetTextEntry(7); TextRelay yrelay = info.GetTextEntry(8); string xstring = (xrelay == null ? null : xrelay.Text.Trim()); string ystring = (yrelay == null ? null : yrelay.Text.Trim()); if (xstring == null || xstring.Length == 0 || ystring == null || ystring.Length == 0) { from.SendMessage("Please enter a X coordinate in the top box and a Y coordinate in the bottom box"); } else { int x = m_X; int y = m_Y; try { x = Int32.Parse(xstring); y = Int32.Parse(ystring); m_X = x; m_Y = y; } catch { from.SendMessage("Please enter a X coordinate in the top box and a Y coordinate in the bottom box"); } } if (m_X < 0) { m_X = 0; from.SendMessage("You cannot go any farther left"); } if (m_Y < 0) { m_Y = 0; from.SendMessage("You cannot go any farther up"); } from.CloseGump(typeof(IconPlacementGump)); from.SendGump(new IconPlacementGump(m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School)); break; } //Up case 3: { MakeI(info); from.CloseGump(typeof(IconPlacementGump)); if ((m_Y - m_I) < 0) { m_Y = 0; from.SendMessage("You cannot go any farther up"); from.SendGump(new IconPlacementGump(m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School)); } else { from.SendGump(new IconPlacementGump(m_Book, from, m_X, (m_Y - m_I), m_I, m_Icon, m_Spell, m_Background, m_School)); } break; } //Right case 4: { MakeI(info); from.CloseGump(typeof(IconPlacementGump)); from.SendGump(new IconPlacementGump(m_Book, from, (m_X + m_I), m_Y, m_I, m_Icon, m_Spell, m_Background, m_School)); break; } //Down case 5: { MakeI(info); from.CloseGump(typeof(IconPlacementGump)); from.SendGump(new IconPlacementGump(m_Book, from, m_X, (m_Y + m_I), m_I, m_Icon, m_Spell, m_Background, m_School)); break; } //Left case 6: { MakeI(info); from.CloseGump(typeof(IconPlacementGump)); if ((m_X - m_I) < 0) { m_X = 0; from.SendMessage("You cannot go any farther left"); from.SendGump(new IconPlacementGump(m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School)); } else { from.SendGump(new IconPlacementGump(m_Book, from, (m_X - m_I), m_Y, m_I, m_Icon, m_Spell, m_Background, m_School)); } break; } } }