Пример #1
0
        //---------------------------------------------------------------------------------------------

        public void SetCurrentSpellUsage(StandardSpell spell, CastUsage usage)
        {
            if (htSwitch == null)
            {
                htSwitch = new Hashtable();
            }

            htSwitch[spell] = usage;
        }
Пример #2
0
        /// <summary>
        /// Casts the specified spell.
        /// </summary>
        /// <param name="spell">The spell.</param>
        /// <param name="target">The target.</param>
        public static void Cast(StandardSpell spell, Serial target)
        {
            if (target.IsValid)
            {
                WaitTargetObject(target);
            }

            Core.SendToServer(PacketBuilder.CastSpell((byte)spell), true);
        }
Пример #3
0
        public static void UseKPZ(StandardSpell spell, string target)
        {
            UOItem kpz = World.Player.Backpack.AllItems.FindType(0x09B0, 0x0493);

            if (!kpz.Exist)
            {
                kpz = World.Player.Backpack.AllItems.FindType(0x09B0, 0x0494);
            }
            else
            {
                kpz.Use();
                Game.Wait(150);
            }

            if (kpz.Exist)
            {
                if (spell == StandardSpell.Heal || spell == StandardSpell.GreaterHeal)
                {
                    World.Player.PrintMessage("[KPZ << k sobe ]", Game.Val_LightGreen);
                }
                else if (spell == StandardSpell.Protection)
                {
                    World.Player.PrintMessage("[KPZ >> k nemu]", Game.Val_LightGreen);
                }
                else if (spell == StandardSpell.ReactiveArmor)
                {
                    World.Player.PrintMessage("[KPZ <> vymena]", Game.Val_LightGreen);
                }
                else
                {
                    Game.PrintMessage("KPZ invalid spell!", MessageType.Error);
                    return;
                }

                TargetInfo info = Targeting.GetTarget(target);
                if (info.Success && info.TargetType == TargetType.Object && info.Character.Exist)
                {
                    info.Object.PrintMessage("[> KPZ <]", Game.Val_LightGreen);
                    CastResultInfo castInfo = Magery.Current.CastSpell(spell, info, false, false);
                    if (castInfo.Success)
                    {
                        Healing.LastCharacter = info.Character;
                        Game.Wait(250);
                        info.Character.RequestStatus(250);
                    }
                }
            }
            else
            {
                Game.PrintMessage("Nemas u sebe KPZ");
            }
        }
Пример #4
0
        //---------------------------------------------------------------------------------------------

        public static bool ParseSpell(string spellName, out StandardSpell resultSpell)
        {
            resultSpell = StandardSpell.Unlock;//Misto INVALID

            try
            {
                resultSpell = (StandardSpell)Enum.Parse(typeof(StandardSpell), spellName);
            }
            catch { resultSpell = StandardSpell.Unlock; }

            if (resultSpell == StandardSpell.Unlock)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Пример #5
0
        //---------------------------------------------------------------------------------------------

        public static int GetSpellCircle(StandardSpell spell)
        {
            int result = -1;

            if (spell == StandardSpell.CreateFood || spell == StandardSpell.MagicArrow || spell == StandardSpell.NightSight || spell == StandardSpell.Weaken || spell == StandardSpell.Clumsy || spell == StandardSpell.Feeblemind || spell == StandardSpell.Heal || spell == StandardSpell.ReactiveArmor)
            {
                result = 1;
            }
            else if (spell == StandardSpell.Agility || spell == StandardSpell.Cunning || spell == StandardSpell.Cure || spell == StandardSpell.Harm || spell == StandardSpell.MagicTrap || spell == StandardSpell.MagicUntrap || spell == StandardSpell.Protection || spell == StandardSpell.Strength)
            {
                result = 2;
            }
            else if (spell == StandardSpell.Bless || spell == StandardSpell.Fireball || spell == StandardSpell.MagicLock || spell == StandardSpell.Poison || spell == StandardSpell.Teleport || spell == StandardSpell.Unlock || spell == StandardSpell.WallofStone)
            {
                result = 3;
            }
            else if (spell == StandardSpell.ArchCure || spell == StandardSpell.ArchProtection || spell == StandardSpell.Curse || spell == StandardSpell.FireField || spell == StandardSpell.GreaterHeal || spell == StandardSpell.Lightning || spell == StandardSpell.ManaDrain || spell == StandardSpell.Recall)
            {
                result = 4;
            }
            else if (spell == StandardSpell.BladeSpirit || spell == StandardSpell.DispelField || spell == StandardSpell.Incognito || spell == StandardSpell.Reflection || spell == StandardSpell.MindBlast || spell == StandardSpell.Paralyze || spell == StandardSpell.PoisonField || spell == StandardSpell.SummonCreature)
            {
                result = 5;
            }
            else if (spell == StandardSpell.Dispel || spell == StandardSpell.EnergyBolt || spell == StandardSpell.Explosion || spell == StandardSpell.Invisibility || spell == StandardSpell.Mark || spell == StandardSpell.MassCurse || spell == StandardSpell.ParalyzeField || spell == StandardSpell.Reveal)
            {
                result = 6;
            }
            else if (spell == StandardSpell.ChainLightning || spell == StandardSpell.EnergyField || spell == StandardSpell.FlameStrike || spell == StandardSpell.GateTravel || spell == StandardSpell.ManaVampire || spell == StandardSpell.MassDispel || spell == StandardSpell.MeteorShower || spell == StandardSpell.Polymorph)
            {
                result = 7;
            }
            else if (spell == StandardSpell.EnergyVortex || spell == StandardSpell.Ressurection || spell == StandardSpell.SummonAirElemental || spell == StandardSpell.SummonDaemon || spell == StandardSpell.SummonEarthElemental || spell == StandardSpell.SummonFireElemental || spell == StandardSpell.SummonWaterElemental)
            {
                result = 8;
            }

            return(result);
        }
Пример #6
0
 public UOCharacter IVMAuto(int maxdistance, bool useInMani, StandardSpell secondarySpell)
 {
     return(IVMAuto(maxdistance, useInMani, secondarySpell, true));
 }
Пример #7
0
        //---------------------------------------------------------------------------------------------

        /// <summary>
        /// Obecne kouzleni hlava + svitky, svitky omezena podpora na to co je SpellScrool, co chybi napsat dodela. Nefunguje na nekro kouzla. Pokud je kouzlo vypsano nad hlavou zelene = SVITEK
        /// </summary>
        /// <param name="spell">Kouzlo</param>
        /// <param name="target">Cil = pokud Serial.Invalid resp. null tak vyhodi tercik</param>
        /// <param name="useScrool">Pouzij svitek, pokud je, jinak hlava</param>
        /// <param name="useSwitchHeadScrool">Stridej svitek a hlavu, tj. uchovava si ke kazdemu kouzlo co bylo kouzleno naposled</param>
        /// <param name="silence">Nevypise nad hlavu jmeno kouzla + lvl, pouziva se v kodu kde chcete si vypadt neco extra</param>
        /// <param name="forceScrool">Vynutit svite, pokud neni svitek tak nekouzli a v CastResiltInfu vrat FALSe</param>
        /// <returns></returns>
        public CastResultInfo CastSpell(StandardSpell spell, Serial target, bool useScrool, bool useSwitchHeadScrool, bool silence, bool forceScrool)
        {
            Game.CheckStopBanding();
            Targeting.ResetTarget();
            Journal.Clear();

            CastResultInfo info = new CastResultInfo();

            info.Usage = useScrool ? CastUsage.Scrool : CastUsage.Head;

            if (htSwitch == null)
            {
                htSwitch = new Hashtable();
            }

            int circle = GetSpellCircle(spell);

            UOCharacter ch = new UOCharacter(target);

            if (ch.Exist && String.IsNullOrEmpty(ch.Name))
            {
                ch.Click();
                Game.Wait(50, true);
            }

            if (spell == StandardSpell.SummonCreature && !String.IsNullOrEmpty(this.selectedSummon))
            {
                Game.RunScript(5000);
                this.CastSummonCreature(this.selectedSummon, target);
            }
            else
            {
                if (htSwitch[spell] == null)
                {
                    htSwitch[spell] = info.Usage;
                }
                else if (useSwitchHeadScrool && !forceScrool)
                {
                    CastUsage currentUsage = (CastUsage)htSwitch[spell];
                    if (currentUsage == CastUsage.Head)
                    {
                        info.Usage = CastUsage.Scrool;
                    }
                    else
                    {
                        info.Usage = CastUsage.Head;
                    }
                }

                bool waitForScrool = false;
                if (info.Usage == CastUsage.Scrool && lastScrool.HasValue)
                {
                    double currentTimeout = GetScroolTimeout();
                    double currentTime    = (DateTime.Now - lastScrool.Value).TotalSeconds;

                    if (currentTime < currentTimeout)
                    {
                        waitForScrool = true;
                        if (!forceScrool)
                        {
                            info.Usage = CastUsage.Head;
                        }
                        Game.PrintMessage(String.Format("Scroll za! {0:N1}s", currentTimeout - currentTime));
                    }
                }

                //TODO zjistit Flag na jsem parnutej
                if (info.Usage == CastUsage.Scrool && !waitForScrool)
                {
                    if (SpellScrool.ContainsKey(spell) && World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Exist)
                    {
                        if (!target.IsValid || !new UOObject(target).Exist)
                        {
                            Magery.TrySetCastingSpell(new CastSpellInfo(spell, true, silence));
                            World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Use();

                            if (!Journal.WaitForText(true, 250, "You can't reach that", "You can't cast", "You can't read that"))
                            {
                                lastScrool   = DateTime.Now.AddMilliseconds(-250);
                                info.Usage   = CastUsage.Scrool;
                                info.Success = true;
                            }
                            else if (!forceScrool)
                            {
                                info.Usage = CastUsage.Head;
                            }
                        }
                        else
                        {
                            Magery.TrySetCastingSpell(new CastSpellInfo(spell, true, silence));

                            UO.WaitTargetObject(target);
                            World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Use();

                            if (!Journal.WaitForText(true, 250, "You can't reach that", "You can't cast", "You can't read that"))
                            {
                                lastScrool   = DateTime.Now.AddMilliseconds(-250);
                                info.Usage   = CastUsage.Scrool;
                                info.Success = true;
                            }
                            else if (!forceScrool)
                            {
                                info.Usage = CastUsage.Head;
                            }
                        }
                    }
                    else if (!forceScrool)
                    {
                        info.Usage = CastUsage.Head;
                    }
                }

                ushort color = CalStatusMessage.Val_InfoColor;
                //if (info.Usage == CastUsage.Scrool)
                //{
                //  color = Game.Val_Green;
                //  if (!silence)
                //    World.Player.PrintMessage(spell + " [" + World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Amount + "ks]", color);
                //}

                htSwitch[spell] = info.Usage;

                if (info.Usage == CastUsage.Head)
                {
                    //Game.RunScript(Magery.GetCircleRunscriptTime(Magery.GetSpellCircle(spell)));

                    if (!target.IsValid || !new UOObject(target).Exist || new UOObject(target).Distance > 30)
                    {
                        Magery.TrySetCastingSpell(new CastSpellInfo(spell, false, silence));
                        UO.Cast(spell);
                    }
                    else
                    {
                        Magery.TrySetCastingSpell(new CastSpellInfo(spell, false, silence));
                        UO.Cast(spell, target);

                        if (Journal.WaitForText(true, 150, "You can't see the target", "Target is not in line of sight"))
                        {
                            if (Journal.Contains(true, "You can't see the target"))
                            {
                                info.CantSee = true;

                                Game.PrintMessage("Cant SEE: " + target + " / " + new UOCharacter(target).Exist + " / " + new UOCharacter(target).Name);

                                info.Success = CastSpell(spell, Serial.Invalid, useScrool, useSwitchHeadScrool, silence, forceScrool).Success;
                            }
                            else if (Journal.Contains(true, "Target is not in line of sight"))
                            {
                                info.NoInLineOfSight = true;

                                new UOObject(target).PrintMessage("[Not in sight]", Game.Val_LightPurple);
                            }
                        }
                        else
                        {
                            if (ch.Exist && !silence &&
                                (spell == StandardSpell.Harm ||
                                 spell == StandardSpell.FlameStrike ||
                                 spell == StandardSpell.MagicArrow ||
                                 spell == StandardSpell.Lightning ||
                                 spell == StandardSpell.Clumsy ||
                                 spell == StandardSpell.Curse ||
                                 spell == StandardSpell.EnergyBolt ||
                                 spell == StandardSpell.Feeblemind ||
                                 spell == StandardSpell.MindBlast ||
                                 spell == StandardSpell.Paralyze)
                                )
                            {
                                if (target != World.Player.Serial)
                                {
                                    new UOObject(target).PrintMessage(String.Format("[{0}/{1}]", ch.Hits, ch.MaxHits), ch.Notoriety == Notoriety.Murderer || ch.Notoriety == Notoriety.Enemy ? Game.GetEnemyColorByHits(target) : Game.GetAlieColorByHits(target));
                                }
                            }
                        }
                    }

                    if (Journal.WaitForText(true, 100, "The spell is not in your spellbook"))
                    {
                        info.Success        = false;
                        info.NotInSpellBook = true;
                        Targeting.ResetTarget();
                    }
                    else if (!info.CantReach)
                    {
                        info.Success = true;
                    }
                }
                else
                {
                    Game.PrintMessage(spell + ": " + World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Amount + "");
                }
            }


            return(info);
        }
Пример #8
0
        //---------------------------------------------------------------------------------------------

        public CastResultInfo CastSpell(StandardSpell spell, Serial target, bool useScrool, bool useSwitchHeadScrool, bool silence)
        {
            return(CastSpell(spell, target, useScrool, useSwitchHeadScrool, silence, false));
        }
Пример #9
0
        //---------------------------------------------------------------------------------------------

        public void CastSpell(StandardSpell spell, Serial target)
        {
            this.CastSpell(spell, target, false, false);
        }
Пример #10
0
        //---------------------------------------------------------------------------------------------


        public static string GetSpellShorcut(StandardSpell spell)
        {
            if (spell == StandardSpell.WallofStone)
            {
                return("WoS");
            }
            else if (spell == StandardSpell.EnergyField)
            {
                return("EF");
            }
            else if (spell == StandardSpell.DispelField)
            {
                return("DisFld");
            }
            else if (spell == StandardSpell.EnergyVortex)
            {
                return("EngVort");
            }
            else if (spell == StandardSpell.ChainLightning)
            {
                return("ChainLight");
            }
            else if (spell == StandardSpell.SummonAirElemental)
            {
                return("AirElm");
            }
            else if (spell == StandardSpell.SummonDaemon)
            {
                return("Daemon");
            }
            else if (spell == StandardSpell.SummonEarthElemental)
            {
                return("EarthElm");
            }
            else if (spell == StandardSpell.SummonFireElemental)
            {
                return("FireElm");
            }
            else if (spell == StandardSpell.SummonWaterElemental)
            {
                return("WaterElm");
            }
            else if (spell == StandardSpell.ParalyzeField)
            {
                return("ParaFld");
            }
            else if (spell == StandardSpell.GreaterHeal)
            {
                return("GHeal");
            }
            else if (spell == StandardSpell.Paralyze)
            {
                return("Para");
            }
            else if (spell == StandardSpell.FlameStrike)
            {
                return("KVF");
            }
            else if (spell == StandardSpell.Lightning)
            {
                return("POG");
            }

            return(spell.ToString());
        }
Пример #11
0
 public static void UseKPZ(StandardSpell spell)
 {
     UseKPZ(spell, "hover");
 }
Пример #12
0
 /// <summary>
 /// Casts the specified spell.
 /// </summary>
 /// <param name="spell">The spell.</param>
 public static void Cast(StandardSpell spell)
 {
     Cast(spell, Serial.Invalid);
 }
Пример #13
0
        /// <summary>
        /// Casts the specified spell.
        /// </summary>
        /// <param name="spell">The spell.</param>
        /// <param name="target">The target.</param>
        public static void Cast(StandardSpell spell, Serial target)
        {
            if (target.IsValid)
                WaitTargetObject(target);

            Core.SendToServer(PacketBuilder.CastSpell((byte)spell), true);
        }
Пример #14
0
        //---------------------------------------------------------------------------------------------

        public CastResultInfo CastSpell(StandardSpell spell, TargetAliasResult target, bool useScrool, bool useSwitchHeadScrool)
        {
            return(CastSpell(spell, target, useScrool, useSwitchHeadScrool, false));
        }
Пример #15
0
 public UOCharacter IVMAuto(int maxdistance, bool useInMani, StandardSpell secondarySpell, bool useScroolByHits)
 {
     return(IVMAuto(maxdistance, useInMani, secondarySpell, true, StandardSpell.GreaterHeal));
 }
Пример #16
0
        public UOCharacter IVMAuto(int maxdistance, bool useInMani, StandardSpell secondarySpell, bool useScroolByHits, StandardSpell primarySpell)
        {
            UOCharacter             result   = null;
            List <CharHealPriority> chhpList = GetCharHealPriorityList(maxdistance, false, Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies));
            var sortedList = chhpList.Where(c => !skip.Contains(c.Char.Serial)).ToList();

            if (sortedList.Count == 0)
            {
                skip.Clear();
                sortedList = chhpList;
            }

            if (sortedList.Count > 0)
            {
                bool useScrool = false;

                foreach (CharHealPriority c in sortedList)
                {
                    UOCharacter ch = result = c.Char;
                    //if (ch.Serial != World.Player.Serial)
                    //  LastCharacter = ch;

                    if (String.IsNullOrEmpty(ch.Name))
                    {
                        ch.Click();
                        Game.Wait(150);
                    }

                    CastResultInfo info          = new CastResultInfo();
                    string         spellShortCut = "";
                    if (ch.MaxHits - ch.Hits <= 25 && useInMani)
                    {
                        spellShortCut = "IM";
                        info          = Magery.Current.CastSpell(StandardSpell.Heal, ch, true, false, true);
                    }
                    else
                    {
                        if (useScroolByHits && (c.DamagePerc >= 35 || c.Char.MaxHits <= 90 && c.Damage >= 30 || ch.Serial == World.Player.Serial))
                        {
                            useScrool = true;
                        }

                        //TODO predelat
                        info = Magery.Current.CastSpell(primarySpell, ch, useScrool, false, true, true);
                        if (!info.Success)
                        {
                            if (secondarySpell == StandardSpell.Heal)
                            {
                                spellShortCut = "IM";
                                info          = Magery.Current.CastSpell(StandardSpell.Heal, ch, useScrool, false, true, false);
                            }
                            else if (secondarySpell == StandardSpell.GreaterHeal)
                            {
                                spellShortCut = "IVM";
                                info          = Magery.Current.CastSpell(StandardSpell.GreaterHeal, ch, false, false, true, false);
                            }
                        }
                        else
                        {
                            spellShortCut = primarySpell == StandardSpell.GreaterHeal ? "IVM" : "IM";
                        }
                    }

                    if (info.NoInLineOfSight)
                    {
                        skip.Add(ch.Serial);
                    }
                    else
                    {
                        ushort color = CalStatusMessage.Val_InfoColor;
                        if (info.Usage == CastUsage.Scrool)
                        {
                            color = 0x0048;
                        }

                        ch.PrintMessage("[" + spellShortCut + "...]" + (useScrool ? " (S)" : ""), Game.GetAlieColorByHits(ch.Serial));

                        bool reset = sortedList.Count == 1;

                        if (!reset)
                        {
                            int skipCount = 0;
                            foreach (CharHealPriority chp in sortedList)
                            {
                                if (skip.Contains(chp.Char.Serial))
                                {
                                    skipCount++;
                                }
                            }

                            reset = skipCount == sortedList.Count;
                        }

                        if (reset)
                        {
                            skip = new List <Serial>();
                        }
                    }

                    break;
                }
            }
            else
            {
                Game.PrintMessage("IVMA: " + Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies).Count + " OK");
            }

            return(result);
        }
Пример #17
0
 /// <summary>
 /// Casts the specified spell.
 /// </summary>
 /// <param name="spell">The spell.</param>
 public static void Cast(StandardSpell spell)
 {
     Cast(spell, Serial.Invalid);
 }