Example #1
0
        public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
        {
            foreach (var memberItem in _items)
            {
                var member = memberItem.Key;
                var item   = memberItem.Value;

                switch (item.Name)
                {
                case "item_gem":
                    OnImportantItemRemoved(new ImportantItemRemovedEventArgs {
                        Member = member, IsGemAdded = true
                    });
                    break;

                case "item_rapier":
                    OnImportantItemRemoved(new ImportantItemRemovedEventArgs {
                        Member = member, IsRapierAdded = true
                    });
                    break;

                case "item_aegis":
                    OnImportantItemRemoved(new ImportantItemRemovedEventArgs {
                        Member = member, IsAegisAdded = true
                    });
                    break;
                }
            }
        }
        public bool EventPredicator(EyeStateEntry prev, EyeStateEntry entry)
        {
            if (prev == null)
            {
                return(false);
            }

            try
            {
                var prevAegisOwner = prev.Members?.FirstOrDefault(m => m.Player != null && m.Items.Slots.Any(i => i.Name == "item_aegis"));
                if (prevAegisOwner == null)
                {
                    return(false);
                }

                var currentAegisOwner =
                    entry?.Members?.FirstOrDefault(m => m.Player != null && m.Items.Slots.Any(i => i.Name == "item_aegis"));
                if (currentAegisOwner == null)
                {
                    return(false);
                }

                return(prevAegisOwner.Hero.SelectedUnit && currentAegisOwner.Hero.SelectedUnit == false);
            }
            catch
            {
                return(false);
            }
        }
Example #3
0
        public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
        {
            var entryGold = combatLogEntry as CombatLogEntryGold;

            var currentTime    = entry.Map.ClockTime;
            var additionalGold = currentTime / 30;
            var predictedGold  = 40 + additionalGold;

            /*|| predictedGold + 2 >= entryGold.Gold &&
             * predictedGold - 2 <= entryGold.Gold*/

            if ((entryGold.Target != "npc_dota_hero_alchemist" ||
                 !(predictedGold * AlchemistBountyRuneMultiplier + 2 >= entryGold.Gold) ||
                 !(predictedGold * AlchemistBountyRuneMultiplier - 2 <= entryGold.Gold)) &&
                (predictedGold + 2 < entryGold.Gold || predictedGold - 2 > entryGold.Gold))
            {
                return;
            }


            /*if (predictedGold + 2 < entryGold.Gold || entryGold.Gold < predictedGold - 2) return;*/

            var member = entry.Members.SearchByHeroName(entryGold.Target);
            var gold   = entryGold.Gold;

            Console.WriteLine($"{member.Hero.Name} got {gold} gold for someone picked up the bounty rune");
            OnPickedUp(new BountyRunePickedupEventAegs {
                Gold = gold, Member = member
            });
        }
Example #4
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     OnModifierAdded(new RuneModifierAddedEventArgs
     {
         Member = entry.Members.SearchByHeroName(_hero),
         Rune   = _rune
     });
 }
Example #5
0
        public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
        {
            var gold = combatLogEntry as CombatLogEntryGold;

            OnGold(new KillsGoldEventArgs {
                Member = entry.Members.SearchByHeroName(gold.Target), Gold = gold.Gold
            });
        }
Example #6
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     if (combatLogEntry == null)
     {
         OnGameStateEventsCountChange(++_gameStateCount);
     }
     else
     {
         OnCombatLogEventsCountChange(++_combatLogCount);
     }
 }
Example #7
0
        public EyeController(EyePlayerController playerController)
        {
            _playerController = playerController;

            _network = new EyeServer();

            _networkGameStateListener       = new NetworkGameStateListener(Network);
            _networkCombatLogListener       = new NetworkCombatLogListener(Network);
            _eyeStateListener               = new EyeStateListener(_networkGameStateListener);
            _eyeStateListener.DataReceived += (sender, entry) => _entry = entry;

            _stateEventManager = new EyeStateEventManager(_eyeStateListener, _networkCombatLogListener);
        }
        public bool EventPredicator(EyeStateEntry prev, EyeStateEntry entry)
        {
            if (prev == null)
            {
                return(false);
            }

            try
            {
                /*var prevAegisOwner = prev.Members?.FirstOrDefault(m => m.Player != null && m.Hero.SelectedUnit && m.Items.Slots.Any(i => i.Name == "item_aegis"));
                 * if (prevAegisOwner == null) return false;
                 *
                 * var currentAegisOwner =
                 *  entry.Members?.FirstOrDefault(m => m.Player != null && m.Hero.SelectedUnit && m.Items.Slots.Any(i => i.Name == "item_aegis"));
                 * if (currentAegisOwner == null) return false;
                 *
                 * var prevAegis = prevAegisOwner.Items.Slots.FirstOrDefault(i => i.Name == "item_aegis");
                 * var currentAegis = currentAegisOwner.Items.Slots.FirstOrDefault(i => i.Name == "item_aegis");
                 *
                 * if (prevAegis?.Slot == currentAegis?.Slot) return false;
                 *
                 * _slot = currentAegisOwner.Items.Slots.First(i => i.Name == "item_aegis").Slot;
                 * _member = currentAegisOwner;
                 * return true;*/

                var currentSelectedOwner = entry.Members?.FirstOrDefault(m => m.Hero.SelectedUnit && m.Items.Slots.Any(i => i.Name == "item_aegis"));
                var prevSelectedOwner    = entry.Members?.FirstOrDefault(m => m.Hero.SelectedUnit && m.Items.Slots.Any(i => i.Name == "item_aegis"));

                if (currentSelectedOwner == null || prevSelectedOwner == null ||
                    currentSelectedOwner.Index != prevSelectedOwner.Index)
                {
                    return(false);
                }

                var currentItem = currentSelectedOwner.Items.SearchItemByName("item_aegis");
                var prevItem    = prevSelectedOwner.Items.SearchItemByName("item_aegis");

                if (currentItem.Slot == prevItem.Slot)
                {
                    return(false);
                }

                _member = currentSelectedOwner;
                _slot   = currentItem.Slot;
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
        {
            /*var radiant = entry.Members.Where(m => m.Player.TeamName == "radiant");
             * var dire = entry.Members.Where(m => m.Player.TeamName == "dire");
             *
             * var networthRadiant = radiant.Sum(m => (double)m.Player.NetWorth);
             * var networthDire = dire.Sum(m => (double)m.Player.NetWorth);
             *
             * var networthesRadiant = radiant.Select(member => Math.Round(member.Player.NetWorth / networthRadiant * 100, 1));
             * var networthesDire = dire.Select(member => Math.Round(member.Player.NetWorth / networthDire * 100, 1));
             *
             * Percentages = networthesRadiant.Concat(networthesDire);*/

            Networthes = entry.Members.Select(m => m.Player.NetWorth);
        }
Example #10
0
        public bool EventPredicator(EyeStateEntry prev, EyeStateEntry entry)
        {
            if (prev == null)
            {
                return(false);
            }

            var prevOwner =
                prev.Members?.FirstOrDefault(m => m.Hero != null && m.Hero.SelectedUnit &&
                                             m.Items.Slots.Any(i => i.Name == "item_black_king_bar"));

            if (prevOwner == null)
            {
                return(false);
            }

            var currentOwner = entry.Members[prevOwner.Index];

            return(!currentOwner.Hero.SelectedUnit);

            /*try
             * {
             *  var prevOwners = prev.Members.Where(m => m.Player != null && m.Items.Slots.Any(i => i.Name == "item_black_king_bar")).ToList();
             *  var currentOwners =
             *      entry?.Members.Where(m => m.Player != null && m.Items.Slots.Any(i => i.Name == "item_black_king_bar")).ToList();
             *
             *  if (!prevOwners.Any()) return false;
             *
             *  foreach (var prevOwner in prevOwners)
             *  {
             *      var currentOwner = currentOwners.FirstOrDefault(o => o.Index == prevOwner.Index);
             *      if(currentOwner == null) continue;
             *
             *      if (!prevOwner.Hero.SelectedUnit || currentOwner.Hero.SelectedUnit) continue;
             *
             *      return true;
             *  }
             *
             *  return false;
             * }
             * catch
             * {
             *  return false;
             * }*/
        }
Example #11
0
        public bool EventPredicator(EyeStateEntry prev, EyeStateEntry entry)
        {
            if (prev == null)
            {
                return(false);
            }

            var flag = false;

            _items = new List <KeyValuePair <Members.Member, Items.Item> >();

            foreach (var currentMember in entry.Members)
            {
                var prevMember = prev.Members[currentMember.Index];

                if (currentMember.Items.Slots.All(i => i.Name != "item_gem") &&
                    prevMember.Items.Slots.Any(i => i.Name == "item_gem"))
                {
                    var item = prevMember.Items.SearchItemByName("item_gem");

                    _items.Add(new KeyValuePair <Members.Member, Items.Item>(currentMember, item));
                    flag = true;
                }

                if (currentMember.Items.Slots.All(i => i.Name != "item_rapier") &&
                    prevMember.Items.Slots.Any(i => i.Name == "item_rapier"))
                {
                    var item = prevMember.Items.SearchItemByName("item_rapier");

                    _items.Add(new KeyValuePair <Members.Member, Items.Item>(currentMember, item));
                    flag = true;
                }

                if (currentMember.Items.Slots.All(i => i.Name != "item_aegis") &&
                    prevMember.Items.Slots.Any(i => i.Name == "item_aegis"))
                {
                    var item = prevMember.Items.SearchItemByName("item_aegis");

                    _items.Add(new KeyValuePair <Members.Member, Items.Item>(currentMember, item));
                    flag = true;
                }
            }

            return(flag);
        }
Example #12
0
        public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
        {
            var item = (CombatLogEntryItem)combatLogEntry;

            var seconds = 10;

            switch (item.AbilityLevel)
            {
            case 1:
                seconds = 9;
                break;

            case 2:
                seconds = 8;
                break;

            case 3:
                seconds = 7;
                break;

            case 4:
                seconds = 6;
                break;

            case 5:
                seconds = 5;
                break;

            case 6:
                seconds = 5;
                break;

            default:
                break;
            }

            var args = new BkbUsedEventArgs
            {
                Member  = entry.Members.SearchByHeroName(_hero),
                Seconds = seconds
            };

            OnBkbUsed(args);
        }
Example #13
0
        public bool EventPredicator(EyeStateEntry prev, EyeStateEntry entry)
        {
            if (prev == null)
            {
                return(false);
            }

            var currentOwner =
                entry?.Members?.FirstOrDefault(m => m.Hero != null && m.Hero.SelectedUnit &&
                                               m.Items.Slots.Any(i => i.Name == "item_black_king_bar"));

            if (currentOwner == null)
            {
                return(false);
            }

            var prevOwner = prev.Members[currentOwner.Index];

            if (prevOwner.Hero.SelectedUnit &&
                prevOwner.Items.Slots.Any(i => i.Name == "item_black_king_bar"))
            {
                return(false);
            }

            _member = currentOwner;
            _slot   = currentOwner.Items.Slots.First(i => i.Name == "item_black_king_bar").Slot;
            return(true);


            /*if (prevOwner?.Items != null && prevOwner.Items.Slots.All(i => i.Name != "item_black_king_bar"))
             * {
             *  if (!prevOwner.Hero.SelectedUnit || !currentOwner.Hero.SelectedUnit) continue;
             *
             *  _member = currentOwner;
             *  _slot = currentOwner.Items.Slots.First(i => i.Name == "item_black_king_bar").Slot;
             *  return true;
             * }
             *
             * if (!prevOwner.Hero.SelectedUnit || !currentOwner.Hero.SelectedUnit) continue;
             *
             * _member = currentOwner;
             * _slot = currentOwner.Items.Slots.First(i => i.Name == "item_black_king_bar").Slot;
             * return true;*/
        }
Example #14
0
        public bool EventPredicator(EyeStateEntry prev, EyeStateEntry entry)
        {
            /*if (prev == null || current.Draft != null) return false;
             *
             * try
             * {
             *  var isAegisInPrev = prev.Members.SelectMany(member => member?.Items?.Slots)
             *      .Any(item => item.Name == "item_aegis");
             *  var isAegisInCurrent = current.Members.SelectMany(member => member?.Items?.Slots)
             *      .Any(item => item.Name == "item_aegis");
             *
             *  return isAegisInPrev == false && isAegisInCurrent;
             * }
             * catch
             * {
             *  return false;
             * }*/

            return(false);
        }
Example #15
0
        public bool EventPredicator(EyeStateEntry prev, EyeStateEntry entry)
        {
            if (prev == null)
            {
                return(false);
            }

            if (prev.Map.Paused == false && entry.Map.Paused)
            {
                _state = true;
                return(true);
            }
            if (prev.Map.Paused && entry.Map.Paused == false)
            {
                _state = false;
                return(true);
            }

            return(false);
        }
Example #16
0
        private void EyeStateEntryReceived(object sender, EyeStateEntry entry)
        {
            if (entry.Map == null ||
                entry.Map.State != Map.GameState.DOTA_GAMERULES_STATE_PRE_GAME &&
                entry.Map.State != Map.GameState.DOTA_GAMERULES_STATE_GAME_IN_PROGRESS &&
                entry.Map.State != Map.GameState.DOTA_GAMERULES_STATE_POST_GAME)
            {
                return;
            }

            AddToken(entry.Auth.Token);

            if (entry.Auth.Token != CurrentToken)
            {
                return;
            }

            var prev = default(EyeStateEntry);

            if (_entry != null)
            {
                prev = (EyeStateEntry)_entry.Clone();
            }

            _entry = entry;

            var entryEvents = _events.Where(e => e is IEyeStateEntryEvent);

            foreach (IEyeStateEntryEvent combatlogEvent in entryEvents)
            {
                if (combatlogEvent.EventPredicator(prev, entry))
                {
                    combatlogEvent.Execute(entry, null);
                }
            }
        }
Example #17
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     HeroesDamage = entry.Members.Select(m => m.Player.HeroDamage);
 }
Example #18
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     OnOwnerSlotChanged(new BkbOwnerSlotChangedEventArgs {
         Member = _member, Slot = _slot
     });
 }
Example #19
0
 public bool EventPredicator(EyeStateEntry prev, EyeStateEntry entry)
 {
     return(prev.Map.State == Map.GameState.DOTA_GAMERULES_STATE_GAME_IN_PROGRESS &&
            entry.Map.State == Map.GameState.DOTA_GAMERULES_STATE_POST_GAME);
 }
Example #20
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     OnGameEnded();
 }
Example #21
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     OnStateChanged(_state);
 }
Example #22
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     OnAegisOwnerUnselected();
 }
Example #23
0
        public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
        {
            var member = entry.Members.First(m => m.Items.Slots.Any(i => i.Name == "item_aegis"));

            OnAegisTaken(member);
        }
Example #24
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     OnAegisOwnerSelected(new AegisOwnerSelectedEventArgs {
         Member = _member, Slot = _slot
     });
 }
Example #25
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     OnGameStarted(combatLogEntry.Timestamp);
 }
Example #26
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     HeroesWardsPlaced = entry.Members.Select(m => m.Player.WardsPlaced);
 }
Example #27
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     SupportGold = entry.Members.Select(m => m.Player.SupportGoldSpent);
 }
Example #28
0
 public bool EventPredicator(EyeStateEntry prev, EyeStateEntry entry)
 {
     return(true);
 }
Example #29
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     Stacks = entry.Members.Select(m => m.Player.CampsStacked);
 }
Example #30
0
 public void Execute(EyeStateEntry entry, CombatLogEntry combatLogEntry)
 {
     OnModifierAdded(entry.Members.SearchByHeroName(_hero));
 }