示例#1
0
        public void CastSummonCreature(string summonName, TargetAliasResult target)
        {
            Game.RunScript(5000);
            Targeting.ResetTarget();

            CurrentCastingSummon = summonName;
            //World.Player.PrintMessage(summonName);
            Journal.Clear();

            if (!target.IsValid || !new UOObject(target).Exist)
            {
                target = Game.CurrentGame.CurrentHoverStatus;
            }

            if (!target.IsStatic && (!target.IsValid || !new UOObject(target).Exist || new UOObject(target).Distance > 25))
            {
                Magery.TrySetCastingSpell(new CastSpellInfo(StandardSpell.SummonCreature, false, false));
                UO.SummonCreature(summonName);
            }
            else
            {
                Magery.TrySetCastingSpell(new CastSpellInfo(StandardSpell.SummonCreature, false, true));
                UIManager.WaitForMenu(new MenuSelection("What do you want to summon ?", summonName));
                target.WaitTarget();
                UO.Cast("Summ. Creature");

                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"))
                    {
                        Game.PrintMessage("Cant SEE: " + target + " / " + new UOCharacter(target).Exist + " / " + new UOCharacter(target).Name);
                    }
                    else if (Journal.Contains(true, "Target is not in line of sight"))
                    {
                        UO.PrintObject(target, Game.Val_LightPurple, "[Not in sight]");
                    }
                }
            }
        }
示例#2
0
        public static void SupinaRess(string targets)
        {
            UOItem supina = World.Player.Backpack.AllItems.FindType(ItemLibrary.GoldenscaleSupina);


            if (!supina.Exist)
            {
                UOItem stit = World.Player.Backpack.AllItems.FindType(ItemLibrary.GoldenscaleSupina);
                if (!stit.Exist)
                {
                    stit = World.Player.FindType(ItemLibrary.GoldenscaleSupina);
                }

                if (stit.Exist)
                {
                    stit.Use();
                    Game.Wait(200);
                }
                else
                {
                    World.Player.PrintMessage("[ nemas mystik ]", MessageType.Warning);
                    return;
                }
            }

            if (supina.Exist)
            {
                TargetAliasResult alias = Targeting.ParseTargets(targets); //TargetInfo tinfo = Targeting.GetTarget(targets);
                if (alias.IsStatic || alias.IsValid)
                {
                    alias.WaitTarget();
                }
                supina.Use();
            }
            else
            {
                World.Player.PrintMessage("[ nemas supinu ]", MessageType.Warning);
            }
        }
示例#3
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, TargetAliasResult 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)// && !forceScrool)
                {
                    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.IsStatic && (!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, true));

                            target.WaitTarget();
                            //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.IsStatic && (!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, true));
                        target.WaitTarget();
                        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 && target.IsValid)
                                {
                                    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);
        }