예제 #1
0
        private static void InitNewSubMenu(Hero hero, string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                Printer.PrintError("[AutoDisable] InitNewSubMenu (name==null)");
                return;
            }
            if (hero == null)
            {
                Printer.PrintError("[AutoDisable] InitNewSubMenu (hero==null)");
                return;
            }
            var item = new Menu(name, hero.ClassId + name);

            Menus[hero.Player.Id].AddSubMenu(item);
            item.AddItem(
                new MenuItem("text1" + hero.ClassId + name, "Abilities:")).SetFontColor(Color.GhostWhite);
            item.AddItem(
                new MenuItem("abilityEnable" + hero.ClassId + name, "").SetValue(
                    new AbilityToggler(new Dictionary <string, bool>())));
            foreach (var spell in Members.Spells)
            {
                item.Item("abilityEnable" + hero.ClassId + name).GetValue <AbilityToggler>().Add(spell);
            }
            item.AddItem(
                new MenuItem("text2" + hero.ClassId + name, "Items:")).SetFontColor(Color.GhostWhite);
            item.AddItem(
                new MenuItem("itemEnable" + hero.ClassId + name, "").SetValue(
                    new AbilityToggler(new Dictionary <string, bool>())));
            foreach (var spell in Members.Items)
            {
                item.Item("itemEnable" + hero.ClassId + name).GetValue <AbilityToggler>().Add(spell);
            }
        }
예제 #2
0
 public static bool TryToInitNewHero(Hero hero)
 {
     if (hero == null)
     {
         Printer.PrintError("[AutoDisable] TryToInitNewHero (hero==null)");
         return(false);
     }
     if (hero.Player == null)
     {
         return(false);
     }
     if (HeroesInSystem.Contains(hero))
     {
         return(true);
     }
     if (Menus[hero.Player.Id] != null)
     {
         return(true);
     }
     HeroesInSystem.Add(hero);
     Menus[hero.Player.Id] = new Menu("", hero.ClassId.ToString(), false, hero.StoredName());
     _heroes.AddSubMenu(Menus[hero.Player.Id]);
     foreach (var ability in hero.Spellbook.Spells.Where(x => x.IsShield() || x.IsDisable()))
     {
         var item = new Menu("", hero.ClassId + ability.StoredName(), false, ability.StoredName());
         Menus[hero.Player.Id].AddSubMenu(item);
         item.AddItem(
             new MenuItem("text1" + hero.ClassId + ability.StoredName(), "Abilities:")).SetFontColor(Color.GhostWhite);
         item.AddItem(
             new MenuItem("abilityEnable" + hero.ClassId + ability.StoredName(), "").SetValue(
                 new AbilityToggler(new Dictionary <string, bool>())));
         foreach (var spell in Members.Spells)
         {
             item.Item("abilityEnable" + hero.ClassId + ability.StoredName()).GetValue <AbilityToggler>().Add(spell);
         }
         item.AddItem(
             new MenuItem("text2" + hero.ClassId + ability.StoredName(), "Items:")).SetFontColor(Color.GhostWhite);
         item.AddItem(
             new MenuItem("itemEnable" + hero.ClassId + ability.StoredName(), "").SetValue(
                 new AbilityToggler(new Dictionary <string, bool>())));
         foreach (var spell in Members.Items)
         {
             item.Item("itemEnable" + hero.ClassId + ability.StoredName()).GetValue <AbilityToggler>().Add(spell);
         }
     }
     InitAbility(hero, "item_force_staff");
     InitAbility(hero, "item_blink");
     InitNewSubMenu(hero, "Angry Disabler");
     return(true);
 }
예제 #3
0
 public static void UpdateAbility(string storedName)
 {
     if (string.IsNullOrEmpty(storedName))
     {
         Printer.PrintError("[AutoDisable] UpdateAbility");
         return;
     }
     foreach (var hero in HeroesInSystem)
     {
         foreach (var ability in hero.Spellbook.Spells.Where(x => x.IsShield() || x.IsDisable()))
         {
             Menu.Item("abilityEnable" + hero.ClassId + ability.StoredName()).GetValue <AbilityToggler>().Add(storedName);
         }
     }
 }
예제 #4
0
 public static void UpdateItem(string storedName)
 {
     if (storedName == null)
     {
         Printer.PrintError("[AutoDisable] UpdateItem");
         return;
     }
     foreach (var hero in HeroesInSystem)
     {
         foreach (var ability in hero.Inventory.Items.Where(x => x.IsShield() || x.IsDisable()))
         {
             Menu.Item("itemEnable" + hero.ClassId + ability.StoredName()).GetValue <AbilityToggler>().Add(storedName);
         }
         Menu.Item("itemEnable" + hero.ClassId + "item_blink").GetValue <AbilityToggler>().Add(storedName);
         Menu.Item("itemEnable" + hero.ClassId + "item_force_staff").GetValue <AbilityToggler>().Add(storedName);
     }
 }
예제 #5
0
 public static void RemoveItem(string storedName)
 {
     if (string.IsNullOrEmpty(storedName))
     {
         Printer.PrintError("[AutoDisable] RemoveItem");
         return;
     }
     foreach (var hero in HeroesInSystem)
     {
         if (hero == null || !hero.IsValid)
         {
             continue;
         }
         foreach (var ability in hero.Spellbook.Spells.Where(x => x != null && x.IsValid && (x.IsShield() || x.IsDisable())))
         {
             Menu.Item("itemEnable" + hero.ClassId + ability.StoredName()).GetValue <AbilityToggler>().Remove(storedName);
         }
         Menu.Item("itemEnable" + hero.ClassId + "item_blink").GetValue <AbilityToggler>().Remove(storedName);
         Menu.Item("itemEnable" + hero.ClassId + "item_force_staff").GetValue <AbilityToggler>().Remove(storedName);
     }
 }