Class representing item information
Inheritance: Node
 public void SetItems(Items items)
 {
     this.items = items;
 }
Beispiel #2
0
        private void OnNewGameState(GameState gs)
        {
            gs_dump = gs;

            if (gs.IsSpectator)
            {
                playing = false;
            }
            else
            {
                abilities = gs.Abilities;
                items     = gs.Items;
                playing   = true;
                clockTime = gs.Map.ClockTime;
                alive     = gs.Hero.IsAlive;
                wardsCD   = gs.Map.Ward_Purchase_Cooldown;
                if (wardsCD > 0)
                {
                    warnWards = true;
                }
                if (clockTime % 2 == 1)
                {
                    canTimeTrigger = true;
                }
                if (alive)
                {
                    //URSA AGHS
                    if (mainForm.StunBreakUlt() && gs.Hero.Name == "npc_dota_hero_ursa" && gs.Hero.IsStunned && items.InventoryContains("item_ultimate_scepter"))
                    {
                        if (items.InventoryIndexOf("item_ultimate_scepter") < 6)
                        {
                            ActionExecuter.ExecuteAbility("R", "", mainForm.QuickCast(), this, true);
                        }
                    }
                    //ABBA ULT
                    if (mainForm.StunBreakUlt() && gs.Hero.Name == "npc_dota_hero_abaddon" && (gs.Hero.IsStunned || gs.Hero.IsBreak))
                    {
                        ActionExecuter.ExecuteAbility("R", "", mainForm.QuickCast(), this, true);
                    }
                    //AEON DISK

                    /*if (main form check field && gs.Items.InventoryContains("item_aeon_disk"))
                     * {
                     *  int index = items.InventoryIndexOf("item_aeon_disk");
                     *  Item aeonDisk = gs.Items.GetInventoryAt(index);
                     *  if (aeonDisk.Cooldown > 0 && canAeonDiskTrigger && index < 6)
                     *  {
                     *      if (mainForm.SelectHero()) KBMHelper.SelectHero(VirtualKeyCode.F1);
                     *      ActionExecuter.ExecuteItem("item_black_king_bar", "", mainForm.QuickCast(), this, true);
                     *      canAeonDiskTrigger = false;
                     *  }
                     *  if (aeonDisk.Cooldown == 0)
                     *  {
                     *      canAeonDiskTrigger = true;
                     *  }
                     * }*/
                    //DROW AURA
                    if (mainForm.DrowAura() && gs.Hero.Name == "npc_dota_hero_drow_ranger")
                    {
                        ActionExecuter.ExecuteAbility("E", "", mainForm.QuickCast(), this, true);
                    }

                    if (mainForm.Buckler())
                    {
                        ActionExecuter.ExecuteItem("item_buckler", "", mainForm.QuickCast(), this, true);
                    }
                    //LINKENS AND AM AGHS
                    if (((mainForm.AmAghs() && gs.Hero.Name == "npc_dota_hero_antimage" && items.InventoryContains("item_ultimate_scepter")) || items.InventoryContains("item_sphere")) && mainForm.Linkens())
                    {
                        string name;
                        int    cd    = 0;
                        int    index = 6;
                        if (items.InventoryContains("item_sphere"))
                        {
                            name  = "item_sphere";
                            index = items.InventoryIndexOf(name);
                            cd    = items.GetInventoryAt(index).Cooldown;
                            if (index > 5 && mainForm.AmAghs() && gs.Hero.Name == "npc_dota_hero_antimage")
                            {
                                name  = "item_ultimate_scepter";
                                index = items.InventoryIndexOf(name);
                                cd    = abilities[2].Cooldown;
                            }
                        }
                        else
                        {
                            name  = "item_ultimate_scepter";
                            index = items.InventoryIndexOf(name);
                            cd    = abilities[2].Cooldown;
                        }

                        if (canSphereTrigger && index < 6 && cd > 0)
                        {
                            SimpleParser(mainForm.LinkensActions());

                            canSphereTrigger = false;
                        }

                        if (cd == 0)
                        {
                            canSphereTrigger = true;
                        }
                    }

                    if (gs.Hero.IsSilenced && mainForm.Silenced())
                    {
                        SimpleParser(mainForm.SilencedActions());
                    }
                    if ((gs.Hero.IsMuted || gs.Hero.IsBreak) && mainForm.MutedBreak())
                    {
                        SimpleParser(mainForm.MutedBreakActions());
                    }
                    if (gs.Hero.IsDisarmed && mainForm.Disarmed())
                    {
                        SimpleParser(mainForm.DisarmedActions());
                    }
                    if (mainForm.HP() && (gs.Hero.Health <= mainForm.MinHP() || gs.Hero.HealthPercent <= mainForm.MinHPPercent()))
                    {
                        SimpleParser(mainForm.HPActions());
                    }
                    if (mainForm.Mana() && (gs.Hero.Mana <= mainForm.MinMana() || gs.Hero.ManaPercent <= mainForm.MinManaPercent()))
                    {
                        SimpleParser(mainForm.ManaActions());
                    }
                    if ((gs.Hero.IsStunned /*|| gs.Hero.IsHexed*/) && mainForm.Disabled())
                    {
                        SimpleParser(mainForm.DisabledActions());
                    }
                }
            }
        }