private void load_hero_build(HabProperties hpsHero) { // set level Current.unit.Level = hpsHero.GetIntValue("Level"); // set stats Current.unit.set_naked_attr(PrimAttrType.Str, hpsHero.GetIntValue("Str")); Current.unit.set_naked_attr(PrimAttrType.Agi, hpsHero.GetIntValue("Agi")); Current.unit.set_naked_attr(PrimAttrType.Int, hpsHero.GetIntValue("Int")); // get aquisition order HabPropertiesCollection hpcAcquisition = hpsHero.GetHpcValue("acquisition"); // items List <string> items = hpsHero.GetStringListValue("items"); // abilities List <string> abilities = hpsHero.GetStringListValue("abilities"); // process acquisition order // make sure triggers will not screw things up Current.unit.Inventory.DisableMessages(); for (int i = 0; i < hpcAcquisition.Count; i++) { HabProperties hpsAcquired = hpcAcquisition[i + ""]; string codeID = hpsAcquired.GetStringValue("codeID"); if (items.Contains(codeID)) { Current.unit.Inventory.put_item(new item(codeID), hpsAcquired.GetIntValue("slot")); } else if (abilities.Contains(codeID)) { DBABILITY ability = Current.unit.heroAbilities.GetByAlias(codeID); int level = hpsAcquired.GetIntValue("level"); for (int j = 1; j <= level; j++) { ability.Level = j; } } } // restore original state Current.unit.Inventory.EnableMessages(); UpdateHeroLeveling(); }
internal UPGRADEPROFILE(DBUPGRADE u) { owner = u; hpsInitialData = DHMpqDatabase.UpgradeSlkDatabase["Profile"][u.codeID]; //////////////////////// // get codeID //////////////////////// this.m_codeID = hpsInitialData.name; //////////////////////// // get name //////////////////////// this.name = hpsInitialData.GetStringListValue("Name"); //////////////////////// // get tip //////////////////////// tip = hpsInitialData.GetStringListValue("Tip"); //////////////////////// // get ubertip //////////////////////// ubertip = hpsInitialData.GetStringListValue("Ubertip"); //////////////////////// // get hotkey //////////////////////// this.hotkey = hpsInitialData.GetStringValue("Hotkey"); //////////////////////// // get slot priority //////////////////////// List <string> buttonpos = hpsInitialData.GetStringListValue("Buttonpos"); slotPriority = RecordSlotComparer.get_slot(Convert.ToInt32(buttonpos[0]), Convert.ToInt32(buttonpos[1])); //////////////////////// // get art //////////////////////// this.art = hpsInitialData.GetStringListValue("Art"); }
internal Dictionary <string, List <KeyValuePair <string, AbilityAffinityType> > > CollectAffinedAbilities() { SplashScreen splashScreen = new SplashScreen(); splashScreen.Show(); splashScreen.ShowText("Collecting affined abilities..."); int progressCounter = 0; Dictionary <string, List <KeyValuePair <string, AbilityAffinityType> > > result = new Dictionary <string, List <KeyValuePair <string, AbilityAffinityType> > >((IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase); foreach (string heroID in DHLOOKUP.dcHeroesTaverns.Keys) { HabProperties hpsHeroAbilities = DHLOOKUP.hpcUnitAbilities[heroID]; List <string> abilList = hpsHeroAbilities.GetStringListValue("heroAbilList"); foreach (string abilID in abilList) { if (!result.ContainsKey(abilID)) { HabProperties hpsAbilityProfile = DHLOOKUP.hpcAbilityProfiles[abilID]; string name = hpsAbilityProfile.GetStringValue("Name"); string hotkey = hpsAbilityProfile.GetStringValue("Hotkey"); if (hotkey == "") { hotkey = hpsAbilityProfile.GetStringValue("Researchhotkey").Trim('"'); } string buttonPos = hpsAbilityProfile.GetStringValue("Buttonpos"); List <KeyValuePair <string, AbilityAffinityType> > affinedAbilities = new List <KeyValuePair <string, AbilityAffinityType> >(); foreach (HabProperties hpsAbility in DHLOOKUP.hpcAbilityProfiles) { if (!DHLOOKUP.dcAbilitiesHeroes.ContainsKey(hpsAbility.name)) { AbilityAffinityType affinityType = CheckAbilityAffinity(hpsAbility, name, hotkey, buttonPos); if (affinityType != AbilityAffinityType.None) { affinedAbilities.Add(new KeyValuePair <string, AbilityAffinityType>(hpsAbility.name, affinityType)); } } } // save affined abilities for current ability result.Add(abilID, affinedAbilities); } } splashScreen.ShowProgress((double)progressCounter++, (double)DHLOOKUP.dcHeroesTaverns.Keys.Count); } splashScreen.Close(); return(result); }
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(); }
internal void SaveCustomKeys(string filename) { FileStream file = File.Create(filename); using (StreamWriter sr = new StreamWriter(file)) { if (saveCommandHotkeysCB.Checked) { sr.WriteLine("////////////"); sr.WriteLine("// Command Hotkeys"); sr.WriteLine("////////////"); sr.WriteLine("[CmdMove]"); sr.WriteLine("Tip=Move (|cffffcc00" + moveTextBox.Text + "|r)"); sr.WriteLine("Hotkey=" + moveTextBox.Tag + ""); sr.WriteLine(""); sr.WriteLine("[CmdStop]"); sr.WriteLine("Tip=Stop (|cffffcc00" + stopTextBox.Text + "|r)"); sr.WriteLine("Hotkey=" + stopTextBox.Tag + ""); sr.WriteLine(""); sr.WriteLine("[CmdHoldPos]"); sr.WriteLine("Tip=Hold Position (|cffffcc00" + holdTextBox.Text + "|r)"); sr.WriteLine("Hotkey=" + holdTextBox.Tag + ""); sr.WriteLine(""); sr.WriteLine("[CmdAttack]"); sr.WriteLine("Tip=Attack (|cffffcc00" + attackTextBox.Text + "|r)"); sr.WriteLine("Hotkey=" + attackTextBox.Tag + ""); sr.WriteLine(""); sr.WriteLine("[CmdPatrol]"); sr.WriteLine("Tip=Patrol (|cffffcc00" + patrolTextBox.Text + "|r)"); sr.WriteLine("Hotkey=" + patrolTextBox.Tag + ""); sr.WriteLine(""); sr.WriteLine("[CmdSelectSkill]"); sr.WriteLine("Tip=Hero Abilities (|cffffcc00" + selectSkillTextBox.Text + "|r)"); sr.WriteLine("Hotkey=" + selectSkillTextBox.Tag + ""); sr.WriteLine(""); sr.WriteLine("[CmdCancel]"); sr.WriteLine("Tip=Cancel (|cffffcc00" + cancelTextBox.Text + "|r)"); sr.WriteLine("Hotkey=" + cancelTextBox.Tag + ""); sr.WriteLine(""); } foreach (string heroID in DHLOOKUP.dcHeroesTaverns.Keys) { HabProperties hpsHeroProfile = DHLOOKUP.hpcUnitProfiles[heroID]; HabProperties hpsHeroAbilities = DHLOOKUP.hpcUnitAbilities[heroID]; List <string> abilList = hpsHeroAbilities.GetStringListValue("heroAbilList"); string output = ""; string name; string hotkey; foreach (string abilID in abilList) { name = DHLOOKUP.hpcAbilityProfiles.GetStringValue(abilID, "Name").Trim('"'); List <KeyValuePair <string, AbilityAffinityType> > affinedAbilities = dcAffinedAbilites[abilID]; // get user-defined hotkey for that ability if (!dcAbilitiesHotkeys.TryGetValue(abilID, out hotkey)) { // if hotkey was not found, check clones of that ability foreach (KeyValuePair <string, AbilityAffinityType> kvp in affinedAbilities) { if (kvp.Value == AbilityAffinityType.Clone && dcAbilitiesHotkeys.TryGetValue(kvp.Key, out hotkey)) { break; } } } // if user-defined hotkey for this ability exists if (hotkey != null) { // write hotkey for this ability output += GetCustomKeyStringForAbility(abilID, name, hotkey); // now check ability clones and write same hotkey for them foreach (KeyValuePair <string, AbilityAffinityType> kvp in affinedAbilities) { if (kvp.Value == AbilityAffinityType.Clone) { output += GetCustomKeyStringForAbility(kvp.Key, name, hotkey); } } } // check for ability variations and write their own user-defined hotkey foreach (KeyValuePair <string, AbilityAffinityType> kvp in affinedAbilities) { if (kvp.Value == AbilityAffinityType.Variation) { if (dcAbilitiesHotkeys.TryGetValue(kvp.Key, out hotkey)) { output += GetCustomKeyStringForAbility(kvp.Key, name, hotkey); } } } } /*if (dcAbilitiesHotkeys.TryGetValue(abilID, out hotkey)) * { * HabProperties hpsAbilityProfile = DHLOOKUP.hpcAbilityProfiles[abilID]; * * output += "\r\n// " + hpsAbilityProfile.GetStringValue("Name").Trim('"'); * output += "\r\n[" + abilID + "]"; * output += "\r\nHotkey=" + hotkey; * output += "\r\nResearchhotkey=" + hotkey; * output += "\r\nUnhotkey=" + hotkey; * output += "\r\n"; * * output += GetAbilityClones(hpsAbilityProfile, hotkey); * output += GetAbilityVariations(hpsAbilityProfile); * }*/ if (output.Length > 0) { sr.WriteLine("////////////"); sr.WriteLine("// " + hpsHeroProfile.GetStringValue("Name").Trim('"')); sr.WriteLine("////////////"); sr.WriteLine(output); } } } }
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(); }
internal void compactDump() { HabPropertiesCollection hpcHeroes = new HabPropertiesCollection(); List<HabPropertiesCollection> unitHpcList = new List<HabPropertiesCollection>(); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["Profile"]); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["UnitData"]); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["UnitWeapons"]); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["UnitBalance"]); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["UnitAbilities"]); HabPropertiesCollection hpcAbilities = new HabPropertiesCollection(); List<HabPropertiesCollection> abilHpcList = new List<HabPropertiesCollection>(); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["Profile"]); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["AbilityData"]); foreach (unit tavern in DHLOOKUP.taverns) foreach (string unitID in tavern.sellunits) { HabProperties hps = new HabProperties(); foreach (HabPropertiesCollection hpc in unitHpcList) hps.Merge(hpc[unitID]); hps.name = unitID; List<string> abils = hps.GetStringListValue("heroAbilList"); foreach (string abilID in abils) if (!hpcAbilities.ContainsKey(abilID)) { HabProperties hpsAbilData = new HabProperties(); foreach (HabPropertiesCollection hpcAbilData in abilHpcList) hpsAbilData.Merge(hpcAbilData[abilID]); hpsAbilData.name = abilID; hpcAbilities.Add(hpsAbilData); } hpcHeroes.Add(hps); } List<string> filelist = new List<string>(2); if (heroesCB.Checked) { hpcHeroes.SaveToFile(Application.StartupPath + "\\" + "heroes.txt"); filelist.Add("heroes.txt"); } if (heroesAbilsCB.Checked) { hpcAbilities.SaveToFile(Application.StartupPath + "\\" + "heroes_abilities.txt"); filelist.Add("heroes_abilities.txt"); } string filenames = ""; foreach (string filename in filelist) filenames += " " + filename + ","; MessageBox.Show("Data dumped to " + Application.StartupPath + "\nFiles:" + filenames.TrimEnd(',')); }
internal void compactDump() { HabPropertiesCollection hpcHeroes = new HabPropertiesCollection(); List <HabPropertiesCollection> unitHpcList = new List <HabPropertiesCollection>(); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["Profile"]); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["UnitAbilities"]); List <string> unitImages = new List <string>(); HabPropertiesCollection hpcAbilities = new HabPropertiesCollection(); List <HabPropertiesCollection> abilHpcList = new List <HabPropertiesCollection>(); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["Profile"]); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["AbilityData"]); List <string> abilityImages = new List <string>(); string imageName; foreach (unit tavern in DHLOOKUP.taverns) { foreach (string unitID in tavern.sellunits) { HabProperties hps = new HabProperties(); foreach (HabPropertiesCollection hpc in unitHpcList) { hps.Merge(hpc[unitID]); } hps.name = unitID; imageName = hps.GetStringValue("Art"); if (!string.IsNullOrEmpty(imageName) && !unitImages.Contains(imageName)) { unitImages.Add(imageName); } List <string> abils = hps.GetStringListValue("heroAbilList"); foreach (string abilID in abils) { if (!hpcAbilities.ContainsKey(abilID)) { HabProperties hpsAbilData = new HabProperties(); foreach (HabPropertiesCollection hpcAbilData in abilHpcList) { hpsAbilData.Merge(hpcAbilData[abilID]); } imageName = hpsAbilData.GetStringValue("Art"); if (!string.IsNullOrEmpty(imageName) && !abilityImages.Contains(imageName)) { abilityImages.Add(imageName); } hpsAbilData.name = abilID; hpcAbilities.Add(hpsAbilData); } } hpcHeroes.Add(hps); } } List <string> filelist = new List <string>(2); if (heroesCB.Checked) { SaveImages(unitImages); } if (heroesAbilsCB.Checked) { SaveImages(abilityImages); } MessageBox.Show("Images extracted to " + ImageFolder); }
private void load_hero_build(HabProperties hpsHero) { // set level Current.unit.Level = hpsHero.GetIntValue("Level"); // set stats Current.unit.set_naked_attr(PrimAttrType.Str, hpsHero.GetIntValue("Str")); Current.unit.set_naked_attr(PrimAttrType.Agi, hpsHero.GetIntValue("Agi")); Current.unit.set_naked_attr(PrimAttrType.Int, hpsHero.GetIntValue("Int")); // get aquisition order HabPropertiesCollection hpcAcquisition = hpsHero.GetHpcValue("acquisition"); // items List<string> items = hpsHero.GetStringListValue("items"); // abilities List<string> abilities = hpsHero.GetStringListValue("abilities"); // process acquisition order // make sure triggers will not screw things up Current.unit.Inventory.DisableMessages(); for (int i = 0; i < hpcAcquisition.Count; i++) { HabProperties hpsAcquired = hpcAcquisition[i + ""]; string codeID = hpsAcquired.GetStringValue("codeID"); if (items.Contains(codeID)) Current.unit.Inventory.put_item(new item(codeID), hpsAcquired.GetIntValue("slot")); else if (abilities.Contains(codeID)) { DBABILITY ability = Current.unit.heroAbilities.GetByAlias(codeID); int level = hpsAcquired.GetIntValue("level"); for (int j = 1; j <= level; j++) ability.Level = j; } } // restore original state Current.unit.Inventory.EnableMessages(); UpdateHeroLeveling(); }
internal void compactDump() { HabPropertiesCollection hpcHeroes = new HabPropertiesCollection(); List <HabPropertiesCollection> unitHpcList = new List <HabPropertiesCollection>(); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["Profile"]); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["UnitData"]); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["UnitWeapons"]); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["UnitBalance"]); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["UnitAbilities"]); HabPropertiesCollection hpcAbilities = new HabPropertiesCollection(); List <HabPropertiesCollection> abilHpcList = new List <HabPropertiesCollection>(); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["Profile"]); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["AbilityData"]); foreach (unit tavern in DHLOOKUP.taverns) { foreach (string unitID in tavern.sellunits) { HabProperties hps = new HabProperties(); foreach (HabPropertiesCollection hpc in unitHpcList) { hps.Merge(hpc[unitID]); } hps.name = unitID; List <string> abils = hps.GetStringListValue("heroAbilList"); foreach (string abilID in abils) { if (!hpcAbilities.ContainsKey(abilID)) { HabProperties hpsAbilData = new HabProperties(); foreach (HabPropertiesCollection hpcAbilData in abilHpcList) { hpsAbilData.Merge(hpcAbilData[abilID]); } hpsAbilData.name = abilID; hpcAbilities.Add(hpsAbilData); } } hpcHeroes.Add(hps); } } List <string> filelist = new List <string>(2); if (heroesCB.Checked) { hpcHeroes.SaveToFile(Application.StartupPath + "\\" + "heroes.txt"); filelist.Add("heroes.txt"); } if (heroesAbilsCB.Checked) { hpcAbilities.SaveToFile(Application.StartupPath + "\\" + "heroes_abilities.txt"); filelist.Add("heroes_abilities.txt"); } string filenames = ""; foreach (string filename in filelist) { filenames += " " + filename + ","; } MessageBox.Show("Data dumped to " + Application.StartupPath + "\nFiles:" + filenames.TrimEnd(',')); }