Пример #1
0
        private void itemsDGrV_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
        {
            OrderItem item = player.Items.BuildOrders[e.RowIndex];

            switch (e.ColumnIndex)
            {
            case 0:     // Time
                e.Value = timeToString(item.Time);
                break;

            case 1:     // Item Image
                if (DHHELPER.IsNewVersionItem(item.Name))
                {
                    e.Value = DHRC.GetImage(DHFormatter.ToString(DHLOOKUP.hpcUnitProfiles[item.Name, "Art"]));
                }
                else
                {
                    e.Value = DHRC.GetImage(DHFormatter.ToString(DHLOOKUP.hpcItemProfiles[item.Name, "Art"]));
                }
                break;

            case 2:     // Item Name
                if (DHHELPER.IsNewVersionItem(item.Name))
                {
                    e.Value = DHFormatter.ToString(DHLOOKUP.hpcUnitProfiles[item.Name, "Name"]);
                }
                else
                {
                    e.Value = DHFormatter.ToString(DHLOOKUP.hpcItemProfiles[item.Name, "Name"]);
                }
                break;
            }
        }
Пример #2
0
        public void DisplayHero(Player p)
        {
            if (p.Heroes.Count == 0)
            {
                playerNameLabel.Text = p.Name;
                return;
            }

            player = p;
            hero   = p.GetMostUsedHero();

            string imagePath = DHLOOKUP.hpcUnitProfiles[hero.Name, "Art"] as string;

            if (imagePath == null)
            {
                return;
            }

            heroImagePanel.BackgroundImage = DHRC.GetImage(imagePath);

            playerNameLabel.Text = p.Name;
            heroNameLabel.Text   = DHFormatter.ToString(DHLOOKUP.hpcUnitProfiles[hero.Name, "Name"]);

            skillsDGrV.RowCount = hero.Abilities.BuildOrders.Count;
            itemsDGrV.RowCount  = player.Items.BuildOrders.Count;
        }
Пример #3
0
        public static string[] PlayerStatsToLines(List <Player> players)
        {
            List <string> lines = new List <string>(players.Count);

            foreach (Player p in players)
            {
                if (!p.IsComputer && !p.IsObserver)
                {
                    string line = "";

                    line += (p.SlotNo + 1) + "; ";
                    line += p.Name + "; ";

                    if (p.Heroes.Count != 0)
                    {
                        line += DHFormatter.ToString(p.GetMostUsedHeroClass());
                    }

                    line += "; ";

                    line += "" + (int)p.Apm + "; ";
                    line += (p.gameCacheValues.ContainsKey("kills") ? p.getGCValue("kills").ToString() : p.getGCVStringValue("1", "")) + "; ";
                    line += (p.gameCacheValues.ContainsKey("deaths") ? p.getGCValue("deaths").ToString() : p.getGCVStringValue("2", "")) + "; ";

                    line += p.gameCacheValues.ContainsKey("creeps") ? (p.getGCValue("creeps") + "/" + p.getGCValue("denies")) : "";

                    lines.Add(line);
                }
            }

            return(lines.ToArray());
        }
Пример #4
0
        public void showComplexItemToolTip(HabProperties hpsItem, int goldCost)
        {
            UIRichTextEx.Default.ClearText();

            if (hpsItem == null)
            {
                return;
            }

            UIRichTextEx.Default.AddTaggedText(DHFormatter.ToString(hpsItem.GetValue("Tip")), UIFonts.boldArial8, Color.White);//item.ID, UIFonts.boldArial8, Color.White);

            string gold = (goldCost == 0) ? "" : goldCost + "";

            HabProperties hpsItemData = DHMpqDatabase.ItemSlkDatabase["ItemData"][hpsItem.name];

            ShowCopmlexItemPrice(gold);

            tipRTB.Rtf = UIRichTextEx.Default.CloseRtf();

            UIRichTextEx.Default.ClearText();

            UIRichTextEx.Default.AddTaggedText(DHFormatter.ToString(hpsItem.GetValue("UberTip")), UIFonts.boldArial8, Color.White);//item.description.Text, UIFonts.boldArial8, Color.White);

            ubertipRTB.Rtf = UIRichTextEx.Default.CloseRtf();
        }
Пример #5
0
        public static string[] KillsToLines(List <KillInfo> kills)
        {
            string[] lines = new string[kills.Count];

            TimeSpan lastKillTime = TimeSpan.MinValue;

            for (int i = 0; i < kills.Count; i++)
            {
                string   line = "";
                KillInfo ki   = kills[i];

                line += DHFormatter.ToString(ki.Time) + ((ki.Time.TotalSeconds - lastKillTime.TotalSeconds < 8)? "* " : "  ");

                if (ki.Killer != null)
                {
                    line += ki.Killer.Name + " (" + ki.Killer.GetMostUsedHeroClass() + ")";
                }
                else
                {
                    line += "Creeps";
                }

                line    += "  killed  " + ki.Victim.Name + " (" + ki.Victim.GetMostUsedHeroClass() + ")";
                lines[i] = line;

                lastKillTime = ki.Time;
            }

            return(lines);
        }
Пример #6
0
        public void showItemToolTip(HabProperties hpsItem, bool inventory)
        {
            UIRichTextEx.Default.ClearText();

            if (hpsItem == null)
            {
                return;
            }

            UIRichTextEx.Default.AddTaggedText(DHFormatter.ToString(hpsItem.GetValue("Tip")), UIFonts.boldArial8, Color.White);//item.ID, UIFonts.boldArial8, Color.White);

            string gold = null;
            string mana = null;

            HabProperties hpsItemData;

            if (DHHELPER.IsNewVersionItem(hpsItem.name))
            {
                hpsItemData = DHMpqDatabase.UnitSlkDatabase["UnitBalance"][hpsItem.name];
            }
            else
            {
                hpsItemData = DHMpqDatabase.ItemSlkDatabase["ItemData"][hpsItem.name];
            }

            bool  pawnable = DHFormatter.ToBool(hpsItemData.GetValue("pawnable"));
            DBINT goldcost = new DBINT(hpsItemData.GetValue("goldcost"));

            //int goldcost = DHFormatter.ToInt(hpsItemData.GetValue("goldcost"));

            if ((inventory && !pawnable) == false)
            {
                gold = inventory ? (goldcost / 2) + "" : goldcost.Text;
            }

            ShowPrices(mana, gold);

            tipRTB.Rtf = UIRichTextEx.Default.CloseRtf();

            UIRichTextEx.Default.ClearText();

            UIRichTextEx.Default.AddTaggedText(DHFormatter.ToString(hpsItem.GetValue("UberTip")), UIFonts.boldArial8, Color.White);//item.description.Text, UIFonts.boldArial8, Color.White);

            ubertipRTB.Rtf = UIRichTextEx.Default.CloseRtf();
        }
Пример #7
0
        public void showHeroToolTip(HabProperties hpsHero)
        {
            this.Visible = false;
            UIRichTextEx.Default.ClearText();

            if (hpsHero == null)
            {
                return;
            }

            UIRichTextEx.Default.AddTaggedText(DHFormatter.ToString(hpsHero.GetValue("Tip")), UIFonts.boldArial8, Color.White);

            tipRTB.Rtf = UIRichTextEx.Default.CloseRtf();

            ShowPrices(null, hpsHero.GetValue("goldcost") + "");

            UIRichTextEx.Default.ClearText();
            UIRichTextEx.Default.AddTaggedText(DHFormatter.ToString(hpsHero.GetStringListValue("Ubertip")), UIFonts.boldArial8, Color.White);
            ubertipRTB.Rtf = UIRichTextEx.Default.CloseRtf();
        }
Пример #8
0
        public void showItemToolTip(item item, bool inventory)
        {
            UIRichTextEx.Default.ClearText();

            if (item == null)
            {
                return;
            }

            UIRichTextEx.Default.AddTaggedText(item.ID, UIFonts.boldArial8, Color.White);

            string gold = null;
            string mana = null;

            if ((inventory && !item.pawnable) == false)
            {
                gold = inventory ? (item.goldCost / 2) + "" : item.goldCost.Text;
            }

            if (inventory && item.usable)
            {
                foreach (DBABILITY ability in item.abilities)
                {
                    if (ability.IsPassive == false)
                    {
                        mana = ability.Cost.Text;
                        break;
                    }
                }
            }

            ShowPrices(mana, gold);

            tipRTB.Rtf = UIRichTextEx.Default.CloseRtf();

            UIRichTextEx.Default.ClearText();

            UIRichTextEx.Default.AddTaggedText(DHFormatter.ToString(item.description), UIFonts.boldArial8, Color.White);

            ubertipRTB.Rtf = UIRichTextEx.Default.CloseRtf();
        }
Пример #9
0
        private void skillsDGrV_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
        {
            OrderItem skill = hero.Abilities.BuildOrders[e.RowIndex];

            switch (e.ColumnIndex)
            {
            case 0:     // Time
                e.Value = timeToString(skill.Time);
                break;

            case 1:                       // Level
                e.Value = "" + skill.Tag; //(e.RowIndex + 1);
                break;

            case 2:     // Skill Image
                e.Value = DHRC.GetImage(DHFormatter.ToString(DHLOOKUP.hpcAbilityProfiles[skill.Name, "Art"]));
                break;

            case 3:     // Skill Name
                e.Value = DHFormatter.ToString(DHLOOKUP.hpcAbilityProfiles[skill.Name, "Name"]) + " - Level " + skill.Count;
                break;
            }
        }
Пример #10
0
        public void ToggleDetailedToolTip(bool isResearching)
        {
            switch (toolTipType)
            {
            case ToolTipType.Skill:
                ABILITYPROFILE ap = tootTipSubject as ABILITYPROFILE;
                if (ap == null)
                {
                    return;
                }

                if (toggleState != 0)
                {
                    showSkillToolTip(ap, isResearching);
                    return;
                }
                else
                {
                    toggleState = 1;
                }

                UIRichTextEx.Default.ClearText();

                ShowPrices(null, null);

                if (ap.Level > 0 && !isResearching)
                {
                    string text;

                    // mana cost
                    text = "" + ap[ap.Level, "Cost"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityStatsString("Cost") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // casting time
                    text = "" + ap[ap.Level, "Cast"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityStatsString("Cast") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // cooldown
                    text = "" + ap[ap.Level, "Cool"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityStatsString("Cool") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // range
                    text = "" + ap[ap.Level, "Rng"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityStatsString("Rng") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // area
                    text = "" + ap[ap.Level, "Area"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityStatsString("Area") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // duration
                    text = "" + ap[ap.Level, "Dur"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityStatsString("Dur") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // hero duration
                    text = "" + ap[ap.Level, "HeroDur"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityStatsString("HeroDur") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    string abilityID = ap.Owner.codeID;

                    // data a
                    text = "" + ap[ap.Level, "DataA"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityDataString(abilityID, "DataA") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // data b
                    text = "" + ap[ap.Level, "DataB"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityDataString(abilityID, "DataB") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // data c
                    text = "" + ap[ap.Level, "DataC"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityDataString(abilityID, "DataC") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // data d
                    text = "" + ap[ap.Level, "DataD"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityDataString(abilityID, "DataD") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // data e
                    text = "" + ap[ap.Level, "DataE"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityDataString(abilityID, "DataE") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // data f
                    text = "" + ap[ap.Level, "DataF"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityDataString(abilityID, "DataF") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // data g
                    text = "" + ap[ap.Level, "DataG"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityDataString(abilityID, "DataG") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }

                    // data h
                    text = "" + ap[ap.Level, "DataH"];
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (!UIRichTextEx.Default.IsEmpty)
                        {
                            UIRichTextEx.Default.AddText("\n");
                        }

                        UIRichTextEx.Default.AddNameValueText(
                            DHSTRINGS.GetWEAbilityDataString(abilityID, "DataH") + ":  ",
                            text,
                            UIFonts.boldArial8, UIColors.toolTipData, Color.White);
                    }
                }
                else
                {
                    UIRichTextEx.Default.AddText("Alias:  ", UIFonts.boldArial8, UIColors.toolTipData);
                    UIRichTextEx.Default.AddText("" + ap.Owner.Alias, Color.White);

                    UIRichTextEx.Default.AddText("\nBase Ability:  ", UIColors.toolTipData);
                    UIRichTextEx.Default.AddText("" + ap.Owner.codeID, Color.White);

                    object value    = DHMpqDatabase.AbilitySlkDatabase["Profile"][ap.Owner.codeID, "Name"];
                    string baseName = DHFormatter.ToString(value);
                    if (!String.IsNullOrEmpty(baseName))
                    {
                        UIRichTextEx.Default.AddText("  (" + baseName + ")", UIColors.activeEffect);
                    }

                    UIRichTextEx.Default.AddText("\nLevels:  ", UIFonts.boldArial8, UIColors.toolTipData);
                    UIRichTextEx.Default.AddText("" + ap.Max_level, Color.White);

                    UIRichTextEx.Default.AddText("\nRequired Hero Level:  ", UIColors.toolTipData);
                    UIRichTextEx.Default.AddText("" + ap[0, "reqLevel"], Color.White);
                }
                ubertipRTB.Rtf = UIRichTextEx.Default.CloseRtf();
                break;
            }

            if (DHCFG.Items["UI"].GetIntValue("ShowDetailModeSwitchTip", 1) == 1)
            {
                switchLabel.Text    = "back: ctrl+d";
                switchLabel.Visible = true;
            }
        }
Пример #11
0
        public void showSkillToolTip(ABILITYPROFILE skill, bool isResearching)
        {
            if (toggleState == 0)
            {
                this.Visible = false;
            }
            else
            {
                toggleState = 0;
            }

            UIRichTextEx.Default.ClearText();

            if (skill == null)
            {
                return;
            }

            toolTipType    = ToolTipType.Skill;
            tootTipSubject = skill;

            if (skill.Level > 0 && !isResearching)
            {
                UIRichTextEx.Default.AddTaggedText(DHFormatter.ToString(skill.Tip), UIFonts.boldArial8, Color.White);
                tipRTB.Rtf = UIRichTextEx.Default.CloseRtf();

                ShowPrices(skill.Cost, null);

                UIRichTextEx.Default.ClearText();

                string ubertip = DHFormatter.ToString(skill.Ubertip);
                ubertip = ExtractAbilityData(ubertip, skill);

                UIRichTextEx.Default.AddTaggedText(ubertip, UIFonts.boldArial8, Color.White);
                ubertipRTB.Rtf = UIRichTextEx.Default.CloseRtf();
            }
            else
            {
                if (isResearching && skill.Level == skill.Max_level)
                {
                    UIRichTextEx.Default.AddTaggedText(DHFormatter.ToString(skill.Tip), UIFonts.boldArial8, Color.White);
                    tipRTB.Rtf = UIRichTextEx.Default.CloseRtf();

                    ShowPrices(null, null);

                    UIRichTextEx.Default.ClearText();

                    UIRichTextEx.Default.AddText("You have completed researching this skill", UIFonts.boldArial8, Color.White);
                }
                else
                {
                    string researchTip = DHFormatter.ToString(skill.Researchtip, (skill.Level + 1));

                    UIRichTextEx.Default.AddTaggedText(researchTip, UIFonts.boldArial8, Color.White);
                    tipRTB.Rtf = UIRichTextEx.Default.CloseRtf();

                    ShowPrices(null, null);

                    UIRichTextEx.Default.ClearText();

                    string researchUbertip = DHFormatter.ToString(skill.Researchubertip);
                    researchUbertip = ExtractAbilityData(researchUbertip, skill);

                    UIRichTextEx.Default.AddTaggedText(researchUbertip, UIFonts.boldArial8, Color.White);
                }

                ubertipRTB.Rtf = UIRichTextEx.Default.CloseRtf();
            }

            if (DHCFG.Items["UI"].GetIntValue("ShowDetailModeSwitchTip", 1) == 1)
            {
                switchLabel.Text    = "details: ctrl+d";
                switchLabel.Visible = true;
            }
        }
Пример #12
0
        public static string[] ChatsToLines(List <ChatInfo> chats)
        {
            string[] lines = new string[chats.Count];

            bool isPaused = false;

            for (int i = 0; i < chats.Count; i++)
            {
                string   line = "";
                ChatInfo ci   = chats[i];

                if (ci.To != TalkTo.System)
                {
                    line += DHFormatter.ToString(ci.Time) + " ";

                    switch (ci.To)
                    {
                    case TalkTo.Allies:
                    case TalkTo.All:
                    case TalkTo.Observers:
                        line += "[" + ci.To.ToString() + "] ";
                        break;

                    default:
                        continue;
                    }

                    line += ci.From.Name + ": " + ci.Message;
                }
                else
                {
                    switch (ci.Message)
                    {
                    case "pause":
                        if (!isPaused)
                        {
                            isPaused = true;
                            line    += DHFormatter.ToString(ci.Time) + " " + ci.From.Name + " " + "paused the game.";
                        }
                        break;

                    case "resume":
                        if (isPaused)
                        {
                            isPaused = false;
                            line    += DHFormatter.ToString(ci.Time) + " " + ci.From.Name + " " + "has resumed the game.";
                        }
                        break;

                    case "save":
                        line += DHFormatter.ToString(ci.Time) + " " + "Game was saved by " + ci.From.Name;
                        break;

                    case "leave":
                        line += DHFormatter.ToString(ci.Time) + " " + ci.From.Name + " " + "has left the game.";
                        break;
                    }
                }

                lines[i] = line;
            }

            return(lines);
        }
Пример #13
0
 public override string ToString()
 {
     return("[" + name + "]" + DHFormatter.ToString(DHLOOKUP.hpcUnitProfiles[name, "Name"]));
 }
Пример #14
0
 public string GetClass()
 {
     return(DHFormatter.ToString(DHLOOKUP.hpcUnitProfiles[name, "Name"]));
 }