Beispiel #1
0
        public static void MiniHealOrCureSelf()
        {
            Spell s = null;

            if (!ClientCommunication.AllowBit(FeatureBit.BlockHealPoisoned))
            {
                s = Get(1, 4);                   // mini heal
            }
            else
            {
                if (World.Player.Poisoned)
                {
                    s = Get(2, 3);                       // cure
                }
                else
                {
                    s = Get(1, 4);                       // mini heal
                }
            }

            if (s != null)
            {
                if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax)
                {
                    Targeting.TargetSelf(true);
                }
                ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID()));
                s.Cast();
            }
        }
Beispiel #2
0
        internal static void HealOrCureSelfChiva()
        {
            Spell s = null;

            s = Get(20, World.Player.Poisoned ? 1 : 2);

            if (RazorEnhanced.Settings.General.ReadBool("BlockChivalryHealCheckBox"))
            {
                if (World.Player.Hits < World.Player.HitsMax || World.Player.Poisoned)
                {
                    if (s != null)
                    {
                        if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax)
                        {
                            Targeting.TargetSelf(true);
                        }
                        ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID()));
                        s.Cast();
                    }
                }
            }
            else
            {
                if (s != null)
                {
                    if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax)
                    {
                        Targeting.TargetSelf(true);
                    }
                    ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID()));
                    s.Cast();
                }
            }
        }
Beispiel #3
0
        internal static void HealOrCureSelf()
        {
            Spell s = null;

            if (World.Player.Poisoned)
            {
                s = Get(2, 3);                 // cure
            }
            else if (World.Player.Hits + 2 < World.Player.HitsMax)
            {
                if (World.Player.Hits + 30 < World.Player.HitsMax && World.Player.Mana >= 12)
                {
                    s = Get(4, 5);                     // greater heal
                }
                else
                {
                    s = Get(1, 4);                     // mini heal
                }
            }
            else
            {
                if (World.Player.Mana >= 12)
                {
                    s = Get(4, 5);                     // greater heal
                }
                else
                {
                    s = Get(1, 4);                     // mini heal
                }
            }

            if (RazorEnhanced.Settings.General.ReadBool("BlockBigHealCheckBox"))
            {
                if (World.Player.Hits < World.Player.HitsMax || World.Player.Poisoned)
                {
                    if (s != null)
                    {
                        if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax)
                        {
                            Targeting.TargetSelf(true);
                        }
                        ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID()));
                        s.Cast();
                    }
                }
            }
            else
            {
                if (s != null)
                {
                    if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax)
                    {
                        Targeting.TargetSelf(true);
                    }
                    ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID()));
                    s.Cast();
                }
            }
        }
Beispiel #4
0
        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));
        }
Beispiel #5
0
        public static void OnHotKey(ref object state)
        {
            ushort id = (ushort)state;
            Spell  s  = Spell.Get(id);

            if (s != null)
            {
                s.Cast(s.GetID());
            }
        }
Beispiel #6
0
        public static void HealOrCureSelf()
        {
            Spell s = null;

            if (!Client.Instance.AllowBit(FeatureBit.BlockHealPoisoned))
            {
                if (World.Player.Hits + 30 < World.Player.HitsMax && World.Player.Mana >= 12)
                {
                    s = Get(4, 5); // greater heal
                }
                else
                {
                    s = Get(1, 4); // mini heal
                }
            }
            else
            {
                if (World.Player.Poisoned && Client.Instance.AllowBit(FeatureBit.BlockHealPoisoned))
                {
                    s = Get(2, 3); // cure
                }
                else if (World.Player.Hits + 2 < World.Player.HitsMax)
                {
                    if (World.Player.Hits + 30 < World.Player.HitsMax && World.Player.Mana >= 12)
                    {
                        s = Get(4, 5); // greater heal
                    }
                    else
                    {
                        s = Get(1, 4); // mini heal
                    }
                }
                else
                {
                    if (World.Player.Mana >= 12)
                    {
                        s = Get(4, 5); // greater heal
                    }
                    else
                    {
                        s = Get(1, 4); // mini heal
                    }
                }
            }

            if (s != null)
            {
                if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax)
                {
                    Targeting.TargetSelf(true);
                }
                Client.Instance.SendToServer(new CastSpellFromMacro((ushort)s.GetID()));
                s.Cast();
            }
        }
Beispiel #7
0
        public static void HealOrCureSelf()
        {
            Spell s = null;

            if (!ClientCommunication.AllowBit(FeatureBit.BlockHealPoisoned))
            {
                if (World.Player.Hits + 30 < World.Player.HitsMax && World.Player.Mana >= 12)
                {
                    s = Get(4, 5);                       // greater heal
                }
                else
                {
                    s = Get(1, 4);                       // mini heal
                }
            }
            else
            {
                if (World.Player.Poisoned && ClientCommunication.AllowBit(FeatureBit.BlockHealPoisoned))
                {
                    s = Get(2, 3);                       // cure
                }
                else if (World.Player.Hits + 2 < World.Player.HitsMax)
                {
                    if (World.Player.Hits + 30 < World.Player.HitsMax && World.Player.Mana >= 12)
                    {
                        s = Get(4, 5);                           // greater heal
                    }
                    else
                    {
                        s = Get(1, 4);                           // mini heal
                    }
                }
                else
                {
                    if (World.Player.Mana >= 12)
                    {
                        s = Get(4, 5);                           // greater heal
                    }
                    else
                    {
                        s = Get(1, 4);                           // mini heal
                    }
                }
            }

            if (s != null)
            {
                if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax)
                {
                    Targeting.TargetSelf(true);
                }
                s.Cast(s.GetID());
            }
        }
Beispiel #8
0
        static Spell()
        {
            //string filename = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Definitions/spells.def");
            string filename = Path.Combine(Assistant.Engine.RootPath, "Definitions/spells.def");

            m_SpellsByPower = new Dictionary <string, Spell>(64 + 10 + 16);
            m_SpellsByID    = new Dictionary <int, Spell>(64 + 10 + 16);

            if (!File.Exists(filename))
            {
                //Engine.MainWindow.SafeAction({ MessageBox.Show(Engine.ActiveWindow, Language.GetString(LocString.NoSpells), "Spells.def", MessageBoxButtons.OK, MessageBoxIcon.Warning); });
                MessageBox.Show(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
                    {
                    }
                }
            }
        }
Beispiel #9
0
        public static void Initialize()
        {
            string filename = Path.Combine(Engine.UOFilePath, "spells.def");

            m_SpellsByPower = new Dictionary <string, Spell>(64 + 10 + 16);
            m_SpellsByID    = new Dictionary <int, Spell>(64 + 10 + 16);

            if (!File.Exists(filename))
            {
                MessageBox.Show("CEUO", "No 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
                    {
                    }
                }
            }
        }
Beispiel #10
0
        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 ) );
        }
Beispiel #11
0
        internal static void MiniHealOrCureSelf()
        {
            Spell s = null;

            s = World.Player.Poisoned ? Get(2, 3) : Get(1, 4);

            if (RazorEnhanced.Settings.General.ReadBool("BlockMiniHealCheckBox"))
            {
                if (World.Player.Hits < World.Player.HitsMax || World.Player.Poisoned)
                {
                    if (s != null)
                    {
                        if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax)
                        {
                            Targeting.TargetSelf(true);
                        }
                        Assistant.Client.Instance.SendToServer(new CastSpellFromMacro((ushort)s.GetID()));
                        s.Cast();
                    }
                }
            }
            else
            {
                if (s != null)
                {
                    if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax)
                    {
                        Targeting.TargetSelf(true);
                    }
                    Assistant.Client.Instance.SendToServer(new CastSpellFromMacro((ushort)s.GetID()));
                    s.Cast();
                }
            }
        }