public static void registrarModuleJogador(Jogador jogador) { //modulo de talento CentralMemory.AddModule(new TalentoModule(jogador.Serial)); //modulo de classe CentralMemory.AddModule(new ClasseModule(jogador.Serial)); //modulo de morte CentralMemory.AddModule(new MorteModule(jogador.Serial)); //modulo de raca CentralMemory.AddModule(new RacaModule(jogador.Serial)); }
public static void AttachLevelables(Serial s) { Type on = SerialType(s); if (on == null) { return; } foreach (KeyValuePair <Type, List <Type> > listed in m_Register) { if (listed.Key == on || on.IsSubclassOf(listed.Key)) { for (int i = 0; i < listed.Value.Count; i++) { CentralMemory.AddModule(s, listed.Value[i]); } } } }
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; } } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 0 || !CSS.Running) { return; } else if (info.ButtonID == 1) { if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Info.School)) { state.Mobile.SendMessage("You are not allowed to cast this spell."); return; } if (!CSpellbook.MobileHasSpell(state.Mobile, m_Info.School, m_Info.Type)) { state.Mobile.SendMessage("You do not have this spell."); return; } Spell spell = SpellInfoRegistry.NewSpell(m_Info.Type, m_Info.School, state.Mobile, null); if (spell == null) { state.Mobile.SendMessage("That spell is disabled."); } else { spell.Cast(); } } else if (info.ButtonID == 2) { //Scribe } else if (info.ButtonID == 3) { if (!CentralMemory.Running) { return; } if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Info.School)) { return; } state.Mobile.SendGump(new IconPlacementGump(m_Book, state.Mobile, 100, 100, 10, m_Info.Icon, m_Info.Type, m_Info.Back, m_Book.School)); } else if (info.ButtonID == 4) { if (!CentralMemory.Running) { return; } string command = info.GetTextEntry(5).Text; if (command == null || command.Length == 0) { if (m_CastCommandModule == null) { state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile)); return; } m_CastCommandModule.RemoveCommandByInfo(m_CastInfo); state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile)); } else { if (m_CastCommandModule == null) { CentralMemory.AddModule(new CastCommandsModule(state.Mobile.Serial, command, m_CastInfo)); state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile)); return; } m_CastCommandModule.Add(command, m_CastInfo); state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile)); } } }