Print() public static method

public static Print ( string str, bool print = false, MessageType type = MessageType.ChatMessage ) : void
str string
print bool
type MessageType
return void
        public void AddEffect(Unit target, ParticleEffect eff)
        {
            var            handle = target.Handle;
            ParticleEffect effect;

            if (!_effectDictionary.TryGetValue(handle, out effect))
            {
                _effectDictionary.Add(handle, eff);
                Printer.Print($"[{_name}][NewEffect]: {target.Name}");
            }
            else
            {
                effect.Dispose();
                _effectDictionary.Remove(handle);
                AddEffect(target, eff);
                Printer.Print($"[{_name}][Remove&NewEffect]: {target.Name}");
            }
        }
        public void AddEffect(Unit target, ParticleEffect eff, float range)
        {
            var            handle = target.Handle;
            ParticleEffect effect;

            if (!_effectDictionary.TryGetValue(handle, out effect))
            {
                _effectDictionary.Add(handle, eff);
                Printer.Print($"[{_name}][NewEffect]: {target.Name}");
                Game.OnUpdate += args =>
                {
                    if (!Game.IsInGame)
                    {
                        return;
                    }
                    try
                    {
                        if (eff == null || !eff.IsValid || eff.IsDestroyed)
                        {
                            return;
                        }
                        if (target.HasModifier("modifier_boots_of_travel_incoming"))
                        {
                            RemoveEffect(target);
                            return;
                        }
                        var frontPoint = Helper.InFront(Members.MyHero, target, range);
                        eff.SetControlPoint(1, target.Position);
                        eff.SetControlPoint(2, frontPoint);
                    }
                    catch (Exception)
                    {
                    }
                };
            }
            else
            {
                effect.Dispose();
                _effectDictionary.Remove(handle);
                AddEffect(target, eff);
                Printer.Print($"[{_name}][Remove&NewEffect]: {target.Name}");
            }
        }
Ejemplo n.º 3
0
        private static void UpdateItems(EventArgs args)
        {
            if (_updater.Sleeping)
            {
                return;
            }
            _updater.Sleep(500);
            if (!Members.LaserBuff)
            {
                var laserDmg = Members.MyHero.FindSpell("special_bonus_unique_tinker")?.Level > 0;
                Members.LaserBuff = laserDmg;
            }
            var inventory = Members.MyHero.Inventory.Items;

            foreach (var item in inventory.Where(item => !Members.Items.Contains(item.StoredName()) &&
                                                 (item.IsDisable() || item.IsNuke() || item.IsPurge() ||
                                                  item.IsHeal() || item.IsShield() || item.IsSilence() ||
                                                  item.IsSlow() || item.IsSkillShot() ||
                                                  Members.WhiteList.Contains(item.StoredName()))))
            {
                var itsDagon = item.StoredName().Contains("dagon");
                if (itsDagon)
                {
                    var oldDagon = Members.Items.FirstOrDefault(x => x.Contains("dagon"));
                    if (oldDagon != null)
                    {
                        Members.Items.Remove(oldDagon);
                        Members.Menu.Item("itemEnable")
                        .GetValue <PriorityChanger>().Remove(oldDagon);
                        Members.Menu.Item("itemEnable2")
                        .GetValue <AbilityToggler>().Remove(oldDagon);
                    }
                }
                Members.Items.Add(item.StoredName());
                Members.Menu.Item("itemEnable")
                .GetValue <PriorityChanger>().Add(item.StoredName());
                Members.Menu.Item("itemEnable2")
                .GetValue <AbilityToggler>().Add(item.StoredName());
                Printer.Print($"[NewItem]: {item.StoredName()}");
            }
        }
Ejemplo n.º 4
0
        private static void CastCombo(Hero globalTarget, Ability laser, Ability rockets, bool singleCombo = false)
        {
            var myInventory = Members.MyHero.Inventory.Items.ToList();
            var allItems    = myInventory.Where(x =>
                                                Helper.IsItemEnable(x.StoredName()) && x.CanBeCasted()).ToList();
            var distance        = Members.MyHero.Distance2D(globalTarget);
            var daggerCastRange = 1150 + (myInventory.Any(x => x.StoredName() == "item_aether_lens") ? 200 : 0);
            var inventory       =
                allItems.Where(
                    x =>
                    ((x.StoredName() == "item_blink" && distance <= daggerCastRange + CloseRange) ||
                     (x.GetCastRange() > 0 && x.CanHit(globalTarget) /* && distance <= x.GetCastRange() + 150*/) ||
                     (x.GetCastRange() <= 0)) && Utils.SleepCheck($"{x.Handle}+item_usages"))
                .ToList();

            if (laser != null && Helper.IsAbilityEnable(laser.StoredName()) && laser.CanBeCasted() &&
                laser.CanHit(globalTarget) && !_spellSleeper.Sleeping(laser))
            {
                laser.UseAbility(globalTarget);
                _spellSleeper.Sleep(500, laser);
            }
            var slarkMod = globalTarget.HasModifiers(new[] { "modifier_slark_dark_pact", "modifier_slark_dark_pact_pulses" }, false);

            foreach (var item in inventory.OrderByDescending(Helper.PriorityHelper))
            {
                var name = item.StoredName();
                if (name == "item_ethereal_blade")
                {
                    _ethereal.Sleep(1000);
                }
                if (name.Contains("dagon"))
                {
                    if (_ethereal.Sleeping && !globalTarget.HasModifier("modifier_item_ethereal_blade_ethereal"))
                    {
                        continue;
                    }
                }
                if (item.IsAbilityBehavior(AbilityBehavior.NoTarget))
                {
                    item.UseAbility();
                }
                else if (item.IsAbilityBehavior(AbilityBehavior.UnitTarget))
                {
                    if (item.TargetTeamType == TargetTeamType.Enemy || item.TargetTeamType == TargetTeamType.All ||
                        item.TargetTeamType == TargetTeamType.Custom)
                    {
                        if (item.IsDisable())
                        {
                            if (!slarkMod && !globalTarget.IsLinkensProtected())
                            {
                                item.UseAbility(globalTarget);
                            }

                            /*if (item.CastStun(globalTarget))
                             * {
                             *  Utils.Sleep(250, $"{item.Handle}+item_usages");
                             *  continue;
                             * }*/
                        }
                        else if (item.IsSilence())
                        {
                            if (!slarkMod)
                            {
                                if (!globalTarget.IsSilenced())
                                {
                                    item.UseAbility(globalTarget);
                                }
                            }
                        }
                        else if ((item.StoredName().Contains("dagon") || item.StoredName() == "item_ethereal_blade") &&
                                 globalTarget.HasModifiers(
                                     new[]
                        {
                            /*"modifier_templar_assassin_refraction_absorb",
                             * "modifier_templar_assassin_refraction_absorb_stacks",*/
                            "modifier_oracle_fates_edict",
                            "modifier_abaddon_borrowed_time"
                        }, false))
                        {
                            continue;
                        }
                        else
                        {
                            item.UseAbility(globalTarget);
                        }

                        /*item.UseAbility(target);
                         * Print($"[Using]: {item.Name} (3)", print: false);*/
                    }
                    else
                    {
                        item.UseAbility(Members.MyHero);
                    }
                }
                else
                {
                    if (name == "item_blink")
                    {
                        if (singleCombo)
                        {
                            continue;
                        }
                        if (distance > daggerCastRange + CloseRange)
                        {
                            var angle = Members.MyHero.FindAngleBetween(globalTarget.Position, true);
                            var point = new Vector3(
                                (float)
                                (globalTarget.Position.X -
                                 daggerCastRange *
                                 Math.Cos(angle)),
                                (float)
                                (globalTarget.Position.Y -
                                 daggerCastRange *
                                 Math.Sin(angle)),
                                globalTarget.Position.Z);
                            var dist = Members.MyHero.Distance2D(point);
                            if (dist >= MinDistance && dist <= daggerCastRange)
                            {
                                item.UseAbility(point);
                            }
                        }
                        else if (distance > MinDistance)
                        {
                            var angle = Members.MyHero.FindAngleBetween(globalTarget.Position, true);
                            var point = new Vector3(
                                (float)
                                (globalTarget.Position.X -
                                 ExtraDistance *
                                 Math.Cos(angle)),
                                (float)
                                (globalTarget.Position.Y -
                                 ExtraDistance *
                                 Math.Sin(angle)),
                                globalTarget.Position.Z);
                            item.UseAbility(point);
                        }
                    }
                    else
                    {
                        item.UseAbility(globalTarget.NetworkPosition);
                    }
                }
                Utils.Sleep(100, $"{item.Handle}+item_usages");

                #region

                /*var name = item.StoredName();
                 * if (name == "item_ethereal_blade")
                 *  _ethereal.Sleep(500);
                 * if (name.Contains("dagon"))
                 *  if (_ethereal.Sleeping && !globalTarget.HasModifier("modifier_item_ethereal_blade_ethereal"))
                 *      continue;
                 * if (item.IsAbilityBehavior(AbilityBehavior.NoTarget))
                 *  item.UseAbility();
                 * else if (item.IsAbilityBehavior(AbilityBehavior.UnitTarget))
                 *  if (item.TargetTeamType == TargetTeamType.Enemy || item.TargetTeamType == TargetTeamType.All ||
                 *      item.TargetTeamType == TargetTeamType.Custom)
                 *      item.UseAbility(globalTarget);
                 *  else
                 *      item.UseAbility(Members.MyHero);
                 * else
                 * {
                 *  if (name == "item_blink")
                 *  {
                 *      if (singleCombo)
                 *          continue;
                 *      if (distance > 1150 + extraRange)
                 *      {
                 *          var angle = Members.MyHero.FindAngleBetween(globalTarget.Position, true);
                 *          var point = new Vector3(
                 *              (float)
                 *                  (globalTarget.Position.X -
                 *                   CloseRange*
                 *                   Math.Cos(angle)),
                 *              (float)
                 *                  (globalTarget.Position.Y -
                 *                   CloseRange*
                 *                   Math.Sin(angle)),
                 *              globalTarget.Position.Z);
                 *          var dist = Members.MyHero.Distance2D(point);
                 *          if (dist >= MinDistance && dist <= 1150)
                 *              item.UseAbility(point);
                 *      }
                 *      else if (distance > MinDistance)
                 *      {
                 *          var angle = Members.MyHero.FindAngleBetween(globalTarget.Position, true);
                 *          var point = new Vector3(
                 *              (float)
                 *                  (globalTarget.Position.X -
                 *                   ExtraDistance *
                 *                   Math.Cos(angle)),
                 *              (float)
                 *                  (globalTarget.Position.Y -
                 *                   ExtraDistance *
                 *                   Math.Sin(angle)),
                 *              globalTarget.Position.Z);
                 *          item.UseAbility(point);
                 *      }
                 *  }
                 *  else
                 *      item.UseAbility(globalTarget.NetworkPosition);
                 * }
                 *
                 * Utils.Sleep(250, $"{item.Handle}+item_usages");*/

                #endregion
            }
            if (rockets != null && Helper.IsAbilityEnable(rockets.StoredName()) && rockets.CanBeCasted() &&
                distance <= 2500 && !_spellSleeper.Sleeping(rockets) && Helper.CanRockedHit(globalTarget))
            {
                rockets.UseAbility();
                _spellSleeper.Sleep(500, rockets);

                /*if (_ethereal.Sleeping && !globalTarget.HasModifier("modifier_item_ethereal_blade_ethereal"))
                 * {
                 *
                 * }
                 * else
                 * {
                 *  rockets.UseAbility();
                 *  _spellSleeper.Sleep(500, rockets);
                 * }*/
            }
            if (singleCombo)
            {
                return;
            }
            var rearm = Abilities.FindAbility("tinker_rearm");



            if (inventory.Count != 0 || (rockets.CanBeCasted() && Helper.CanRockedHit(globalTarget)) || (laser.CanBeCasted() && laser.CanHit(globalTarget)))
            {
                Printer.Print($"{inventory.Count}");
                return;
            }
            //Printer.Print($"{rearm != null}/{Helper.IsAbilityEnable(rearm.StoredName())}/{rearm.CanBeCasted()}/{!_spellSleeper.Sleeping(rearm)}/{!Members.MyHero.IsChanneling()}");
            if (rearm != null && Helper.IsAbilityEnable(rearm.StoredName()) && rearm.CanBeCasted() && !_spellSleeper.Sleeping(rearm) && !Members.MyHero.IsChanneling())
            {
                rearm.UseAbility();
                //_spellSleeper.Sleep(4000 - rearm.Level * 500, rearm);
                _spellSleeper.Sleep(750, rearm);
                //Printer.Print("use ream");
            }
        }
Ejemplo n.º 5
0
        private static async Task DoTrash(Hero killStealTarget, CancellationToken cancellationToken, bool isKillSteal = false)
        {
            var target      = killStealTarget;
            var myInventory = new List <Ability>(Members.MyHero.Inventory.Items)
            {
                _laser, _rockets
            };
            var allItems = myInventory.Where(x =>
                                             Helper.IsItemEnableNew(x.StoredName())).ToList();
            var blinkPos  = new Vector3();
            var inventory =
                allItems.Where(
                    x =>
                    ((x.StoredName() == "item_blink" && x.CheckDaggerForUsable(target.Position, out blinkPos) /*&& distance <= daggerCastRange + CloseRange*/) ||
                     (x.GetCastRange() > 0 && x.CanHit(target) /* && distance <= x.GetCastRange() + 150*/ && x.StoredName() != "item_blink") ||
                     (x.GetCastRange() <= 0)) && Utils.SleepCheck($"{x.Handle}+item_usages"))
                .OrderBy(Helper.PriorityHelper)
                .ToList();
            var slarkMod = target.HasModifiers(new[] { "modifier_slark_dark_pact", "modifier_slark_dark_pact_pulses" }, false);

            if (inventory.Any(x => x.StoredName() == "item_ethereal_blade" && x.CanBeCasted() && x.CanHit(target)))
            {
                _ethereal.Sleep(1000);
            }
            foreach (var v in inventory)
            {
                if (v.CanBeCasted() && (v.TargetTeamType == TargetTeamType.None || (v.CanHit(target) && !v.Equals(_rockets)) || (v.Equals(_rockets) && Helper.CanRockedHit(target))))
                {
                    var name = v.StoredName();

                    if (v.DamageType == DamageType.Magical || v.StoredName().Contains("dagon"))
                    {
                        if (_ethereal.Sleeping && !target.HasModifier("modifier_item_ethereal_blade_ethereal"))
                        {
                            continue;
                        }
                    }
                    if (v.IsAbilityBehavior(AbilityBehavior.NoTarget))
                    {
                        await UseAbility(v);
                    }
                    else if (v.IsAbilityBehavior(AbilityBehavior.UnitTarget))
                    {
                        if (v.TargetTeamType == TargetTeamType.Enemy || v.TargetTeamType == TargetTeamType.All ||
                            v.TargetTeamType == TargetTeamType.Custom)
                        {
                            if (v.IsDisable())
                            {
                                if (!slarkMod && !target.IsLinkensProtected())
                                {
                                    await UseAbility(v, target);
                                }
                            }
                            else if (v.IsSilence())
                            {
                                if (!slarkMod)
                                {
                                    if (!target.IsSilenced())
                                    {
                                        await UseAbility(v, target);
                                    }
                                }
                            }
                            else if ((v.DamageType == DamageType.Magical || v.StoredName() == "item_ethereal_blade") &&
                                     target.HasModifiers(
                                         new[]
                            {
                                /*"modifier_templar_assassin_refraction_absorb",
                                 * "modifier_templar_assassin_refraction_absorb_stacks",*/
                                "modifier_oracle_fates_edict",
                                "modifier_abaddon_borrowed_time"
                            }, false))
                            {
                                continue;
                            }
                            else
                            {
                                await UseAbility(v, target);
                            }
                        }
                        else
                        {
                            await UseAbility(v, Members.MyHero);
                        }
                    }
                    else
                    {
                        if (name == "item_blink")
                        {
                            if (isKillSteal)
                            {
                                continue;
                            }
                            Printer.Print("blink!");
                            await UseAbility(v, point : blinkPos);

                            continue;
                        }

                        await UseAbility(v, point : target.NetworkPosition);
                    }
                }
            }
            if (!isKillSteal &&
                inventory.Any(
                    v =>
                    v.CanBeCasted() &&
                    ((v.CanHit(target) && !v.Equals(_rockets)) ||
                     (v.Equals(_rockets) && Helper.CanRockedHit(target)))))
            {
                var count = inventory.Count(
                    v =>
                    v.CanBeCasted() &&
                    ((v.CanHit(target) && !v.Equals(_rockets)) ||
                     (v.Equals(_rockets) && Helper.CanRockedHit(target))));
                Printer.Print("do it again! " + count);
                await Task.Delay(20, cancellationToken);
                await DoTrash(killStealTarget, cancellationToken);
            }
        }
Ejemplo n.º 6
0
        private static async Task Action(CancellationToken cancellationToken)
        {
            if (IsComboHero)
            {
                if (!IsComboHero)
                {
                    if (_globalTarget != null)
                    {
                        Helper.UnHandleEffect(_globalTarget);
                    }
                    _globalTarget = null;
                    return;
                }
                if (_globalTarget == null || !_globalTarget.IsValid)
                {
                    _globalTarget = Helper.ClosestToMouse(Members.MyHero);
                    return;
                }
                Helper.HandleEffect(_globalTarget);
                if (Members.MyHero.IsChanneling())
                {
                    return;
                }

                await DoTrash(_globalTarget, cancellationToken);

                await Task.Delay(50, cancellationToken);

                Printer.Print("rdy for rearm!");
                var rearm = Abilities.FindAbility("tinker_rearm");
                if (rearm.CanBeCasted())
                {
                    rearm?.UseAbility();
                    var time = (int)(GetRearmTime(rearm) + Game.Ping + rearm.FindCastPoint() * 1000);
                    Printer.Print("rearm!");
                    Log.Debug("Rearm: " + time);
                    await Task.Delay(time, cancellationToken);

                    return;
                }
                if (AutoAttack)
                {
                    if (UseOrbWalkker)
                    {
                        Orbwalking.Orbwalk(_globalTarget, followTarget: true);
                    }
                    else if (!Members.MyHero.IsAttacking() && !_attacker.Sleeping && !_globalTarget.IsAttackImmune())
                    {
                        Members.MyHero.Attack(_globalTarget);
                        _attacker.Sleep(250);
                    }
                }
            }
            else
            {
                if (_globalTarget != null)
                {
                    Helper.UnHandleEffect(_globalTarget);
                }
                _globalTarget = null;
            }


            await Task.Delay(100, cancellationToken);
        }
Ejemplo n.º 7
0
        private static async Task DoTrash(Hero killStealTarget, CancellationToken cancellationToken, bool isKillSteal = false)
        {
            var target      = killStealTarget;
            var myInventory = new List <Ability>(Members.MyHero.Inventory.Items)
            {
                _laser, _rockets
            };
            var allItems = myInventory.Where(x =>
                                             Helper.IsItemEnableNew(x.StoredName())).ToList();
            var distance        = (int)(Members.MyHero.Distance2D(target) - target.HullRadius * 2);
            var daggerCastRange = 1150 + (myInventory.Any(x => x.StoredName() == "item_aether_lens") ? 220 : 0);

            if (!Members.ExtraRange)
            {
                Members.ExtraRange =
                    Members.MyHero.Spellbook()
                    .Spells.Any(x => x.StoredName() == "special_bonus_cast_range_75" && x.Level > 0);
            }
            if (Members.ExtraRange)
            {
                daggerCastRange += 75;
            }
            daggerCastRange = Math.Min(distance, daggerCastRange);
            var inventory =
                allItems.Where(
                    x =>
                    ((x.StoredName() == "item_blink" /*&& distance <= daggerCastRange + CloseRange*/) ||
                     (x.GetCastRange() > 0 && x.CanHit(target) /* && distance <= x.GetCastRange() + 150*/) ||
                     (x.GetCastRange() <= 0)) && Utils.SleepCheck($"{x.Handle}+item_usages"))
                .OrderBy(Helper.PriorityHelper)
                .ToList();
            var slarkMod = target.HasModifiers(new[] { "modifier_slark_dark_pact", "modifier_slark_dark_pact_pulses" }, false);

            if (inventory.Any(x => x.StoredName() == "item_ethereal_blade" && x.CanBeCasted() && x.CanHit(target)))
            {
                _ethereal.Sleep(1000);
            }
            foreach (var v in inventory)
            {
                if (v.CanBeCasted() && (v.TargetTeamType == TargetTeamType.None || (v.CanHit(target) && !v.Equals(_rockets)) || (v.Equals(_rockets) && Helper.CanRockedHit(target))))
                {
                    var name = v.StoredName();

                    if (v.DamageType == DamageType.Magical || v.StoredName().Contains("dagon"))
                    {
                        if (_ethereal.Sleeping && !target.HasModifier("modifier_item_ethereal_blade_ethereal"))
                        {
                            continue;
                        }
                    }
                    if (v.IsAbilityBehavior(AbilityBehavior.NoTarget))
                    {
                        await UseAbility(v);
                    }
                    else if (v.IsAbilityBehavior(AbilityBehavior.UnitTarget))
                    {
                        if (v.TargetTeamType == TargetTeamType.Enemy || v.TargetTeamType == TargetTeamType.All ||
                            v.TargetTeamType == TargetTeamType.Custom)
                        {
                            if (v.IsDisable())
                            {
                                if (!slarkMod && !target.IsLinkensProtected())
                                {
                                    await UseAbility(v, target);
                                }
                            }
                            else if (v.IsSilence())
                            {
                                if (!slarkMod)
                                {
                                    if (!target.IsSilenced())
                                    {
                                        await UseAbility(v, target);
                                    }
                                }
                            }
                            else if ((v.DamageType == DamageType.Magical || v.StoredName() == "item_ethereal_blade") &&
                                     target.HasModifiers(
                                         new[]
                            {
                                /*"modifier_templar_assassin_refraction_absorb",
                                 * "modifier_templar_assassin_refraction_absorb_stacks",*/
                                "modifier_oracle_fates_edict",
                                "modifier_abaddon_borrowed_time"
                            }, false))
                            {
                                continue;
                            }
                            else
                            {
                                await UseAbility(v, target);
                            }
                        }
                        else
                        {
                            await UseAbility(v, Members.MyHero);
                        }
                    }
                    else
                    {
                        if (name == "item_blink")
                        {
                            if (isKillSteal)
                            {
                                continue;
                            }
                            var angle = Members.MyHero.FindAngleBetween(target.Position, true);
                            var point = new Vector3(
                                (float)
                                (Members.MyHero.Position.X +
                                 daggerCastRange *
                                 Math.Cos(angle)),
                                (float)
                                (Members.MyHero.Position.Y +
                                 daggerCastRange *
                                 Math.Sin(angle)),
                                Members.MyHero.Position.Z);
                            await UseAbility(v, point : point);

                            continue;
                        }

                        await UseAbility(v, point : target.NetworkPosition);
                    }
                }
            }
            if (!isKillSteal &&
                inventory.Any(
                    v =>
                    v.CanBeCasted() &&
                    ((v.CanHit(target) && !v.Equals(_rockets)) ||
                     (v.Equals(_rockets) && Helper.CanRockedHit(target)))))
            {
                var count = inventory.Count(
                    v =>
                    v.CanBeCasted() &&
                    ((v.CanHit(target) && !v.Equals(_rockets)) ||
                     (v.Equals(_rockets) && Helper.CanRockedHit(target))));
                Printer.Print("do it again! " + count);
                await Task.Delay(20, cancellationToken);
                await DoTrash(killStealTarget, cancellationToken);
            }
        }