public void showStatusToolTip(ToolStripItem tsItem) { UIRichTextEx.Default.ClearText(); if (tsItem == null) { return; } ABILITYPROFILE ability = tsItem.Tag as ABILITYPROFILE; if (ability == null) { return; } UIRichTextEx.Default.AddTaggedText(ability.Tip, UIFonts.boldArial8, Color.Lime); UIRichTextEx.Default.AddLineInterval(); if (ability.Max_level != 1) { UIRichTextEx.Default.AddText("Level: ", UIFonts.boldArial8, Color.Gray); UIRichTextEx.Default.AddText(ability.Level + "", UIFonts.boldArial8, Color.White); UIRichTextEx.Default.AddLineInterval(); } string ubertip = ability.Ubertip + ""; ubertip = ubertip.Replace(";", ";\n"); UIRichTextEx.Default.AddText(ubertip, UIFonts.boldArial8, Color.White); contentRTB.Rtf = UIRichTextEx.Default.CloseRtf(); }
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); }
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; }
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; } }
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; } }
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; } }
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 = ""; } }
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 = ""; } }