Exemple #1
0
        AbilityAffinityType CheckAbilityAffinity(HabProperties hpsAbility, string name, string hotkey, string buttonPos)
        {
            object abilityName;

            if (hpsAbility.TryGetValue("Name", out abilityName) && string.Equals(abilityName as string, name, StringComparison.OrdinalIgnoreCase))
            {
                // used when one ability can be replaced with another same looking ability
                // which leads to invalid hotkeys for that ability (example: Carrion Swarm)
                if ((hpsAbility.GetStringValue("Hotkey") == hotkey) &&
                    (hpsAbility.GetStringValue("Buttonpos") == buttonPos))
                {
                    return(AbilityAffinityType.Clone);
                }
                else
                {
                    // used when hero has multiple abilities with the same name,
                    // which are added by triggers (example: Shadowraze)
                    // NOTE: must be later checked for user-defined hotkey existance to make sure
                    return(AbilityAffinityType.Variation);
                }
            }
            else
            {
                return(AbilityAffinityType.None);
            }
        }
Exemple #2
0
 public object this[string name]
 {
     get
     {
         object obj;
         hpsInitialData.TryGetValue(name, out obj);
         //return hpcLevels["level" + level].GetValue(name);
         return(obj);
     }
     set
     {
         //hpcLevels["level" + level][name] = value;
     }
 }
Exemple #3
0
        internal void UpdateRecentMap(string filename)
        {
            HabProperties hps = DHCFG.Items["RecentMaps"];

            if (filename != null && !hps.ContainsValue(Path.GetFullPath(filename)))
            {
                int length = (hps.Count >= 5) ? hps.Count : (hps.Count + 1);

                for (int i = length; i > 1; i--)
                {
                    hps[i + ""] = hps[(i - 1) + ""];
                }

                hps["1"] = Path.GetFullPath(filename);
            }

            fileToolStripMenuItem.DropDownItems.Clear();

            fileToolStripMenuItem.DropDownItems.Add(openFileToolStripMenuItem);

            if (hps.Count > 0)
            {
                fileToolStripMenuItem.DropDownItems.Add(recentToolStripSeparator);
            }

            object value;
            string key;

            for (int i = 1; i <= hps.Count; i++)
            {
                if (hps.TryGetValue(key = i + "", out value))
                {
                    ToolStripMenuItem tsmi = new ToolStripMenuItem();
                    tsmi.Name   = key;
                    tsmi.Text   = Path.GetFileName(value as string);
                    tsmi.Tag    = value;
                    tsmi.Click += new EventHandler(loadRecentMap_Click);

                    fileToolStripMenuItem.DropDownItems.Add(tsmi);
                }
            }

            fileToolStripMenuItem.DropDownItems.Add(propertiesToolStripSeparator);
            fileToolStripMenuItem.DropDownItems.Add(propertiesToolStripMenuItem);
            fileToolStripMenuItem.DropDownItems.Add(exitToolStripSeparator);
            fileToolStripMenuItem.DropDownItems.Add(exitToolStripMenuItem);
        }
Exemple #4
0
 AbilityAffinityType CheckAbilityAffinity(HabProperties hpsAbility, string name, string hotkey, string buttonPos)
 {
     object abilityName;
     if (hpsAbility.TryGetValue("Name", out abilityName) && string.Equals(abilityName as string, name, StringComparison.OrdinalIgnoreCase))
     {
         // used when one ability can be replaced with another same looking ability
         // which leads to invalid hotkeys for that ability (example: Carrion Swarm)
         if ((hpsAbility.GetStringValue("Hotkey") == hotkey )
             && (hpsAbility.GetStringValue("Buttonpos") == buttonPos))
             return AbilityAffinityType.Clone;
         else
             // used when hero has multiple abilities with the same name,
             // which are added by triggers (example: Shadowraze)
             // NOTE: must be later checked for user-defined hotkey existance to make sure
             return AbilityAffinityType.Variation;
     }
     else
         return AbilityAffinityType.None;
 }