static Spell() { ArrayList list = new ArrayList(); string filename = Path.Combine( Config.GetInstallDirectory(), "spells.def" ); m_SpellsByPower = new Hashtable( 64 + 10 + 16 ); m_SpellsByID = new Hashtable( 64 + 10 + 16 ); if ( !File.Exists( filename ) ) { MessageBox.Show( Engine.ActiveWindow, Language.GetString( LocString.NoSpells ), "Spells.def", MessageBoxButtons.OK, MessageBoxIcon.Warning ); return; } using ( StreamReader reader = new StreamReader( filename ) ) { string line; while ( (line=reader.ReadLine()) != null ) { line = line.Trim(); if ( line.Length <= 0 || line[0] == '#' ) continue; string[] split = line.Split( '|' ); try { if ( split.Length >= 5 ) { string[] reags = new string[split.Length-5]; for(int i=5;i<split.Length;i++) reags[i-5] = split[i].ToLower().Trim(); Spell s = new Spell( split[0].Trim()[0], Convert.ToInt32( split[1].Trim() ), Convert.ToInt32( split[2].Trim() ), /*split[3].Trim(),*/ split[4].Trim(), reags ); m_SpellsByID[s.GetID()] = s; if ( s.WordsOfPower != null && s.WordsOfPower.Trim().Length > 0 ) m_SpellsByPower[s.WordsOfPower] = s; } } catch { } } } HotKeyCallback = new HotKeyCallbackState( OnHotKey ); foreach ( Spell s in m_SpellsByID.Values ) HotKey.Add( HKCategory.Spells, HKSubCat.SpellOffset+s.Circle, s.Name, HotKeyCallback, (ushort)s.GetID() ); HotKey.Add( HKCategory.Spells, LocString.HealOrCureSelf, new HotKeyCallback( HealOrCureSelf ) ); HotKey.Add( HKCategory.Spells, LocString.MiniHealOrCureSelf, new HotKeyCallback( MiniHealOrCureSelf ) ); }
internal static Spell Get(int circle, int num) { return(Get(Spell.ToID(circle, num))); }
private static bool CheckHealPoisonTarg(uint targID, Serial ser) { if (World.Player == null) { return(false); } if (targID == m_SpellTargID && ser.IsMobile && (World.Player.LastSpell == Spell.ToID(1, 4) || World.Player.LastSpell == Spell.ToID(4, 5)) && Config.GetBool("BlockHealPoison") && Client.Instance.AllowBit(FeatureBit.BlockHealPoisoned)) { Mobile m = World.FindMobile(ser); if (m != null && m.Poisoned) { World.Player.SendMessage(MsgLevel.Warning, LocString.HealPoisonBlocked); return(true); } } return(false); }
static Spell() { string filename = Path.Combine(Config.GetInstallDirectory(), "spells.def"); m_SpellsByPower = new Dictionary <string, Spell>(64 + 10 + 16); m_SpellsByID = new Dictionary <int, Spell>(64 + 10 + 16); m_SpellsByName = new Dictionary <string, Spell>(64 + 10 + 16); if (!File.Exists(filename)) { MessageBox.Show(Engine.ActiveWindow, Language.GetString(LocString.NoSpells), "Spells.def", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } using (StreamReader reader = new StreamReader(filename)) { string line; while ((line = reader.ReadLine()) != null) { line = line.Trim(); if (line.Length <= 0 || line[0] == '#') { continue; } string[] split = line.Split('|'); try { if (split.Length >= 5) { string[] reags = new string[split.Length - 5]; for (int i = 5; i < split.Length; i++) { reags[i - 5] = split[i].ToLower().Trim(); } Spell s = new Spell(split[0].Trim()[0], Convert.ToInt32(split[1].Trim()), Convert.ToInt32(split[2].Trim()), /*split[3].Trim(),*/ split[4].Trim(), reags); m_SpellsByID[s.GetID()] = s; line = Language.GetString(s.Name); if (string.IsNullOrEmpty(line)) { line = split[3].Trim(); } if (!string.IsNullOrEmpty(line)) { m_SpellsByName[line.ToLower()] = s; } if (s.WordsOfPower != null && s.WordsOfPower.Trim().Length > 0) { m_SpellsByPower[s.WordsOfPower] = s; } } } catch { } } } HotKeyCallback = new HotKeyCallbackState(OnHotKey); foreach (Spell s in m_SpellsByID.Values) { HotKey.Add(HKCategory.Spells, HKSubCat.SpellOffset + s.Circle, s.Name, HotKeyCallback, (ushort)s.GetID()); } HotKey.Add(HKCategory.Spells, LocString.HealOrCureSelf, new HotKeyCallback(HealOrCureSelf)); HotKey.Add(HKCategory.Spells, LocString.MiniHealOrCureSelf, new HotKeyCallback(MiniHealOrCureSelf)); HotKey.Add(HKCategory.Spells, LocString.GHealOrCureSelf, new HotKeyCallback(GHealOrCureSelf)); HotKey.Add(HKCategory.Spells, LocString.Interrupt, new HotKeyCallback(Interrupt)); }