Example #1
0
        internal string ExtractAbilityData(string text, ABILITYPROFILE profile)
        {
            // ...<AOcr,DataA1>...

            while (true)
            {
                int start = text.IndexOf('<');
                if (start == -1) break;

                int end = text.IndexOf('>', start);
                if (end == -1) break;

                int length = (end - start) - 1; // кол-во символов между скобками
                if (length == 0) break;

                int data = text.IndexOf(',', start+1, length);
                if (data == -1) break;

                string dataFullString = text.Substring(data + 1, (end - data) - 1);
                if (dataFullString.Length < 6) break;

                // DataA
                string dataName = dataFullString.Substring(0, 5);

                // 1
                string dataLevel = dataFullString.Substring(5);

                // get ability data value for specified level
                object value = profile.Owner[dataLevel, dataName];

                text = text.Replace(text.Substring(start, length + 2), value + "");
            }

            return text;
        }
Example #2
0
        internal void PlaceResearchAbility(Button c, ABILITYPROFILE ability, bool isAvailable)
        {
            if (ability != null)
            {
                c.FlatAppearance.BorderColor = Color.Black;
                c.FlatAppearance.BorderSize = 0;

                c.BackgroundImage = isAvailable ? ability.ResearchImage : ability.DisabledResearchImage;
                c.Tag = ability;

                if (showHotKeys)
                {
                    string hotkey;
                    if (!ckForm.dcAbilitiesHotkeys.TryGetValue(ability.codeID, out hotkey))
                        hotkey = ability.ResearchHotkey.Trim('"');

                    c.Text = hotkey;
                }
                else
                    c.Text = (ability.Level != 0) ? ability.Level.ToString() : "";
            }
            else
            {
                c.FlatAppearance.BorderColor = Color.Black;
                c.FlatAppearance.BorderSize = 0;
                c.BackgroundImage = null;
                c.Tag = null;
                c.Text = "";
            }
        }
Example #3
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;
            }
        }
Example #4
0
        internal void PlaceAbility(Button c, ABILITYPROFILE ability)
        {
            if (ability != null)
            {
                if (!ability.IsPassive && ((ability.AbilityState & AbilityState.PermanentlyActivated)!=0))
                {
                    c.FlatAppearance.BorderColor = UIColors.activeAbility;
                    c.FlatAppearance.BorderSize = 2;
                }
                else
                {
                    c.FlatAppearance.BorderColor = Color.Black;
                    c.FlatAppearance.BorderSize = 0;
                }

                c.BackgroundImage = ability.IsOnCooldown ?  ability.DisabledResearchImage : ability.Image;
                c.Tag = ability;

                if (showHotKeys)
                {
                    string hotkey;
                    if (!ckForm.dcAbilitiesHotkeys.TryGetValue(ability.codeID, out hotkey))
                        hotkey = ability.Hotkey;

                    c.Text = hotkey;
                }
                else
                    c.Text = (ability.Level != 0) ? ability.Level.ToString() : "";
            }
            else
            {
                c.FlatAppearance.BorderColor = Color.Black;
                c.FlatAppearance.BorderSize = 0;
                c.BackgroundImage = null;
                c.Tag = null;
                c.Text = "";
            }
        }