internal void InitList(HabPropertiesCollection hpcShortHeroes) { itemsLV.BeginUpdate(); // init list itemsLV.Items.Clear(); foreach (HabProperties hpsHero in hpcShortHeroes) { string iconName = hpsHero.GetValue("Art") as string; if (String.IsNullOrEmpty(iconName)) { continue; } ListViewItem lvi_Hero = new ListViewItem(); lvi_Hero.ImageKey = iconName; lvi_Hero.Tag = hpsHero; lvi_Hero.Group = itemsLV.Groups[DHLOOKUP.dcHeroesTaverns[hpsHero.name]]; itemsLV.Items.Add(lvi_Hero); } itemsLV.EndUpdate(); captionB.Text = "Heroes (" + itemsLV.Items.Count + ")"; }
internal void InitListByShop(unit shop) { HabPropertiesCollection hpcListItems = new HabPropertiesCollection(); if (shop == null) { InitList(DHLOOKUP.shops); } else { DBSTRINGCOLLECTION itemList; HabPropertiesCollection hpcItemProfiles; if (DHHELPER.IsNewVersionItemShop(shop)) { itemList = shop.sellunits; hpcItemProfiles = DHLOOKUP.hpcUnitProfiles; } else { itemList = shop.sellitems; hpcItemProfiles = DHLOOKUP.hpcItemProfiles; } foreach (string itemID in itemList) { HabProperties hps = hpcItemProfiles[itemID]; hpcListItems.Add(hps); } InitList(hpcListItems); } }
internal void LoadCustomKeys(string filename) { HabPropertiesCollection hpc = new HabPropertiesCollection(); hpc.ReadFromFile(filename); bool hasCommandHotkeys = false; hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdMove", moveTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdStop", stopTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdHoldPos", holdTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdAttack", attackTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdPatrol", patrolTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdSelectSkill", selectSkillTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdCancel", cancelTextBox); saveCommandHotkeysCB.Checked = hasCommandHotkeys; string hotkey; foreach (HabProperties hps in hpc) { hotkey = hps.GetStringValue("Hotkey"); if (!string.IsNullOrEmpty(hotkey)) { dcAbilitiesHotkeys[hps.name] = hotkey; } } if (Current.unit != null) { Current.unit.Updated = true; } }
internal void InitList(HabPropertiesCollection hpcListItems) { this.Width = this.width; itemsLV.BeginUpdate(); // init list itemsLV.Items.Clear(); itemsLV.Groups.Clear(); foreach (HabProperties hpsItem in hpcListItems.Values) { string iconName = hpsItem.GetStringValue("Art"); if (String.IsNullOrEmpty(iconName)) { continue; } ListViewItem lvi_Item = new ListViewItem(); lvi_Item.ImageKey = iconName; lvi_Item.Tag = hpsItem; itemsLV.Items.Add(lvi_Item); } itemsLV.EndUpdate(); DisplayCaption(); }
internal void InitListByState(ListSwitch ls) { if (DHMpqDatabase.UnitSlkDatabase.Count == 0) { return; } HabPropertiesCollection hpcShortHeroes = new HabPropertiesCollection(); switch (ls) { case ListSwitch.All: foreach (unit tavern in DHLOOKUP.taverns) { foreach (string unitID in tavern.sellunits) { HabProperties hps = DHLOOKUP.hpcUnitProfiles[unitID]; hpcShortHeroes.Add(hps); } } break; case ListSwitch.Sentinel: foreach (unit tavern in DHLOOKUP.taverns) { if (tavern.y < 0) { foreach (string unitID in tavern.sellunits) { HabProperties hps = DHLOOKUP.hpcUnitProfiles[unitID]; hpcShortHeroes.Add(hps); } } } break; case ListSwitch.Scourge: foreach (unit tavern in DHLOOKUP.taverns) { if (tavern.y > 0) { foreach (string unitID in tavern.sellunits) { HabProperties hps = DHLOOKUP.hpcUnitProfiles[unitID]; hpcShortHeroes.Add(hps); } } } break; } InitList(hpcShortHeroes); }
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(); }
public DialogResult ShowDialog(HabPropertiesCollection hpcCfg) { this.hpcHeroTagsContainer = hpcCfg; if (!hpcHeroTagsContainer.TryGetValue("HeroTags", out hpsHeroTags)) { hpsHeroTags = new HabProperties(heroes.Count); hpcHeroTagsContainer.AddUnchecked("HeroTags", hpsHeroTags); } heroTagGridView.RowCount = heroes.Count; return(base.ShowDialog()); }
internal void LoadHeroBuild(string filename) { HabPropertiesCollection hpcBuild = new HabPropertiesCollection(); hpcBuild.ReadFromFile(filename); try { HabProperties hpsHero = hpcBuild.GetByOrder(0); // load specified map if current map is empty if (Current.map == null) { string mapfile = hpsHero.GetStringValue("Map"); if (File.Exists(mapfile)) { LoadMap(mapfile); } else { MessageBox.Show( "The map file '" + mapfile + "' specified in this hero build cannot be found." + "\nYou can open this map manually (DotA map->Open...) and then try to load this hero build again"); return; } } // pick specified hero hlForm.PickNewHero(hpsHero.name); if (!Current.unit.IsDisposed) { load_hero_build(hpsHero); } else { // delay this build until the hero // will be found by hero provider hpsProvidedHeroBuild = hpsHero; } UpdateRecentBuild(filename); } catch { MessageBox.Show("Invalid Hero Build file"); return; } }
internal bool TryLoadCommandHotkey(HabPropertiesCollection hpc, string command, TextBox textBox) { HabProperties hps; if (hpc.TryGetValue(command, out hps)) { string hotkey = hps.GetStringValue("Hotkey"); textBox.Text = (hotkey == "512") ? "ESC" : hotkey; textBox.Tag = hotkey; return(true); } return(false); }
internal void LoadHeroBuild(string filename) { HabPropertiesCollection hpcBuild = new HabPropertiesCollection(); hpcBuild.ReadFromFile(filename); try { HabProperties hpsHero = hpcBuild.GetByOrder(0); // load specified map if current map is empty if (Current.map == null) { string mapfile = hpsHero.GetStringValue("Map"); if (File.Exists(mapfile)) LoadMap(mapfile); else { MessageBox.Show( "The map file '" + mapfile + "' specified in this hero build cannot be found." + "\nYou can open this map manually (DotA map->Open...) and then try to load this hero build again"); return; } } // pick specified hero hlForm.PickNewHero(hpsHero.name); if (!Current.unit.IsDisposed) load_hero_build(hpsHero); else // delay this build until the hero // will be found by hero provider hpsProvidedHeroBuild = hpsHero; UpdateRecentBuild(filename); } catch { MessageBox.Show("Invalid Hero Build file"); return; } }
internal bool TryLoadCommandHotkey(HabPropertiesCollection hpc, string command, TextBox textBox) { HabProperties hps; if (hpc.TryGetValue(command, out hps)) { string hotkey = hps.GetStringValue("Hotkey"); textBox.Text = (hotkey == "512") ? "ESC" : hotkey; textBox.Tag = hotkey; return true; } return false; }
internal void LoadCustomKeys(string filename) { HabPropertiesCollection hpc = new HabPropertiesCollection(); hpc.ReadFromFile(filename); bool hasCommandHotkeys = false; hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdMove", moveTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdStop", stopTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdHoldPos", holdTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdAttack", attackTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdPatrol", patrolTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdSelectSkill", selectSkillTextBox); hasCommandHotkeys |= TryLoadCommandHotkey(hpc, "CmdCancel", cancelTextBox); saveCommandHotkeysCB.Checked = hasCommandHotkeys; string hotkey; foreach (HabProperties hps in hpc) { hotkey = hps.GetStringValue("Hotkey"); if (!string.IsNullOrEmpty(hotkey)) dcAbilitiesHotkeys[hps.name] = hotkey; } if (Current.unit != null) Current.unit.Updated = true; }
private void PrepareReplayExport() { if (hpcExportCfg == null) { hpcExportCfg = new HabPropertiesCollection(); hpcExportCfg.ReadFromFile(ReplayExportCfgFileName); } HabProperties hpsExportUI; if (!hpcExportCfg.TryGetValue("UI", out hpsExportUI)) { hpsExportUI = new HabProperties(); hpcExportCfg.Add("UI", hpsExportUI); } originalExport = string.Empty; exportPreviewB.Checked = false; int layout = hpsExportUI.GetIntValue("Layout", -1); if (currentExportLayout == layout) ShowReplayExport(layout); else layoutCmbB.SelectedIndex = layout; replayExportRTB.Font = new Font( hpsExportUI.GetStringValue("FontFamily", "Verdana"), (float)hpsExportUI.GetDoubleValue("FontSize", 10)); fontTextBox.Text = replayExportRTB.Font.FontFamily.Name + " " + replayExportRTB.Font.Size; shortLaneNamesCB.Checked = hpsExportUI.GetIntValue("ShortLaneNames", 0) == 1; exportIconWidthNumUD.Value = (decimal)hpsExportUI.GetIntValue("ImageWidth", 18); }
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 fullDump() { List<string> filelist = new List<string>(3); if (unitsCB.Checked) { HabPropertiesCollection hpcUnits = 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"]); foreach (HabPropertiesCollection hpc in unitHpcList) hpcUnits.Merge(hpc); hpcUnits.SaveToFile(Application.StartupPath + "\\" + "units.txt"); filelist.Add("units.txt"); } if (abilitiesCB.Checked) { HabPropertiesCollection hpcAbilities = new HabPropertiesCollection(); List<HabPropertiesCollection> abilHpcList = new List<HabPropertiesCollection>(); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["Profile"]); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["AbilityData"]); foreach (HabPropertiesCollection hpc in abilHpcList) hpcAbilities.Merge(hpc); hpcAbilities.SaveToFile(Application.StartupPath + "\\" + "abilities.txt"); filelist.Add("abilities.txt"); } if (itemsCB.Checked) { HabPropertiesCollection hpcItems = new HabPropertiesCollection(); List<HabPropertiesCollection> itemHpcList = new List<HabPropertiesCollection>(); itemHpcList.Add(DHMpqDatabase.ItemSlkDatabase["Profile"]); itemHpcList.Add(DHMpqDatabase.ItemSlkDatabase["ItemData"]); foreach (HabPropertiesCollection hpc in itemHpcList) hpcItems.Merge(hpc); hpcItems.SaveToFile(Application.StartupPath + "\\" + "items.txt"); filelist.Add("items.txt"); } if (upgradesCB.Checked) { HabPropertiesCollection hpcUpgrades = new HabPropertiesCollection(); List<HabPropertiesCollection> upgradeHpcList = new List<HabPropertiesCollection>(); upgradeHpcList.Add(DHMpqDatabase.UpgradeSlkDatabase["Profile"]); upgradeHpcList.Add(DHMpqDatabase.UpgradeSlkDatabase["UpgradeData"]); foreach (HabPropertiesCollection hpc in upgradeHpcList) hpcUpgrades.Merge(hpc); hpcUpgrades.SaveToFile(Application.StartupPath + "\\" + "upgrades.txt"); filelist.Add("upgrades.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["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 SaveHeroBuild(string filename) { try { HabPropertiesCollection hpcBuild = new HabPropertiesCollection(); HabProperties hpsHero = new HabProperties(); hpcBuild.Add(Current.unit.codeID, hpsHero); hpsHero["Map"] = Current.map.Name; hpsHero["Level"] = Current.unit.Level; hpsHero["Str"] = Current.unit.get_naked_attr(PrimAttrType.Str); hpsHero["Agi"] = Current.unit.get_naked_attr(PrimAttrType.Agi); hpsHero["Int"] = Current.unit.get_naked_attr(PrimAttrType.Int); ArrayList allAbilities = new ArrayList(); foreach (DBABILITY ability in Current.unit.heroAbilities) if (ability.LearnPoint != null) allAbilities.Add(ability); foreach (DBITEMSLOT itemSlot in Current.unit.Inventory) if (!itemSlot.IsNull) allAbilities.Add(itemSlot.Item); allAbilities.Sort(new AbilityOrItemLearnPointComparer()); HabPropertiesCollection acquisition = new HabPropertiesCollection(allAbilities.Count); for(int i=0; i<allAbilities.Count; i++) { object obj = allAbilities[i]; HabProperties hpsAbilOrItem = new HabProperties(); hpsAbilOrItem.name = i + ""; if (obj is item) { hpsAbilOrItem["codeID"] = (obj as item).codeID; hpsAbilOrItem["slot"] = Current.unit.Inventory.IndexOf(obj as item); } else if (obj is DBABILITY) { hpsAbilOrItem["codeID"] = (obj as DBABILITY).Alias; hpsAbilOrItem["level"] = (obj as DBABILITY).Level; } acquisition.Add(hpsAbilOrItem); } hpsHero["acquisition"] = acquisition; hpsHero["items"] = Current.unit.Inventory.ToString(); hpsHero["abilities"] = Current.unit.heroAbilities.ToString(true); hpcBuild.SaveToFile(filename); } catch { MessageBox.Show("Failed to save Hero Build file"); return; } }
internal void fullDump() { string imageName; if (unitsCB.Checked) { HabPropertiesCollection hpcUnits = new HabPropertiesCollection(); List <HabPropertiesCollection> unitHpcList = new List <HabPropertiesCollection>(); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["Profile"]); unitHpcList.Add(DHMpqDatabase.UnitSlkDatabase["UnitAbilities"]); foreach (HabPropertiesCollection hpc in unitHpcList) { hpcUnits.Merge(hpc); } List <string> unitImages = new List <string>(); foreach (HabProperties hpsUnit in hpcUnits) { imageName = hpsUnit.GetStringValue("Art"); if (!string.IsNullOrEmpty(imageName) && !unitImages.Contains(imageName)) { unitImages.Add(imageName); } } SaveImages(unitImages); } if (abilitiesCB.Checked) { HabPropertiesCollection hpcAbilities = new HabPropertiesCollection(); List <HabPropertiesCollection> abilHpcList = new List <HabPropertiesCollection>(); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["Profile"]); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["AbilityData"]); foreach (HabPropertiesCollection hpc in abilHpcList) { hpcAbilities.Merge(hpc); } List <string> abilityImages = new List <string>(); foreach (HabProperties hpsAbility in hpcAbilities) { imageName = hpsAbility.GetStringValue("Art"); if (!string.IsNullOrEmpty(imageName) && !abilityImages.Contains(imageName)) { abilityImages.Add(imageName); } } SaveImages(abilityImages); } if (itemsCB.Checked) { HabPropertiesCollection hpcItems = new HabPropertiesCollection(); List <HabPropertiesCollection> itemHpcList = new List <HabPropertiesCollection>(); itemHpcList.Add(DHMpqDatabase.ItemSlkDatabase["Profile"]); itemHpcList.Add(DHMpqDatabase.ItemSlkDatabase["ItemData"]); foreach (HabPropertiesCollection hpc in itemHpcList) { hpcItems.Merge(hpc); } List <string> itemImages = new List <string>(); foreach (HabProperties hpsItem in hpcItems) { imageName = hpsItem.GetStringValue("Art"); if (!string.IsNullOrEmpty(imageName) && !itemImages.Contains(imageName)) { itemImages.Add(imageName); } } SaveImages(itemImages); } MessageBox.Show("Images extracted to " + ImageFolder); }
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); }
internal void SaveHeroBuild(string filename) { try { HabPropertiesCollection hpcBuild = new HabPropertiesCollection(); HabProperties hpsHero = new HabProperties(); hpcBuild.Add(Current.unit.codeID, hpsHero); hpsHero["Map"] = Current.map.Name; hpsHero["Level"] = Current.unit.Level; hpsHero["Str"] = Current.unit.get_naked_attr(PrimAttrType.Str); hpsHero["Agi"] = Current.unit.get_naked_attr(PrimAttrType.Agi); hpsHero["Int"] = Current.unit.get_naked_attr(PrimAttrType.Int); ArrayList allAbilities = new ArrayList(); foreach (DBABILITY ability in Current.unit.heroAbilities) { if (ability.LearnPoint != null) { allAbilities.Add(ability); } } foreach (DBITEMSLOT itemSlot in Current.unit.Inventory) { if (!itemSlot.IsNull) { allAbilities.Add(itemSlot.Item); } } allAbilities.Sort(new AbilityOrItemLearnPointComparer()); HabPropertiesCollection acquisition = new HabPropertiesCollection(allAbilities.Count); for (int i = 0; i < allAbilities.Count; i++) { object obj = allAbilities[i]; HabProperties hpsAbilOrItem = new HabProperties(); hpsAbilOrItem.name = i + ""; if (obj is item) { hpsAbilOrItem["codeID"] = (obj as item).codeID; hpsAbilOrItem["slot"] = Current.unit.Inventory.IndexOf(obj as item); } else if (obj is DBABILITY) { hpsAbilOrItem["codeID"] = (obj as DBABILITY).Alias; hpsAbilOrItem["level"] = (obj as DBABILITY).Level; } acquisition.Add(hpsAbilOrItem); } hpsHero["acquisition"] = acquisition; hpsHero["items"] = Current.unit.Inventory.ToString(); hpsHero["abilities"] = Current.unit.heroAbilities.ToString(true); hpcBuild.SaveToFile(filename); } catch { MessageBox.Show("Failed to save Hero Build file"); return; } }
internal void fullDump() { List <string> filelist = new List <string>(3); if (unitsCB.Checked) { HabPropertiesCollection hpcUnits = 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"]); foreach (HabPropertiesCollection hpc in unitHpcList) { hpcUnits.Merge(hpc); } hpcUnits.SaveToFile(Application.StartupPath + "\\" + "units.txt"); filelist.Add("units.txt"); } if (abilitiesCB.Checked) { HabPropertiesCollection hpcAbilities = new HabPropertiesCollection(); List <HabPropertiesCollection> abilHpcList = new List <HabPropertiesCollection>(); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["Profile"]); abilHpcList.Add(DHMpqDatabase.AbilitySlkDatabase["AbilityData"]); foreach (HabPropertiesCollection hpc in abilHpcList) { hpcAbilities.Merge(hpc); } hpcAbilities.SaveToFile(Application.StartupPath + "\\" + "abilities.txt"); filelist.Add("abilities.txt"); } if (itemsCB.Checked) { HabPropertiesCollection hpcItems = new HabPropertiesCollection(); List <HabPropertiesCollection> itemHpcList = new List <HabPropertiesCollection>(); itemHpcList.Add(DHMpqDatabase.ItemSlkDatabase["Profile"]); itemHpcList.Add(DHMpqDatabase.ItemSlkDatabase["ItemData"]); foreach (HabPropertiesCollection hpc in itemHpcList) { hpcItems.Merge(hpc); } hpcItems.SaveToFile(Application.StartupPath + "\\" + "items.txt"); filelist.Add("items.txt"); } if (upgradesCB.Checked) { HabPropertiesCollection hpcUpgrades = new HabPropertiesCollection(); List <HabPropertiesCollection> upgradeHpcList = new List <HabPropertiesCollection>(); upgradeHpcList.Add(DHMpqDatabase.UpgradeSlkDatabase["Profile"]); upgradeHpcList.Add(DHMpqDatabase.UpgradeSlkDatabase["UpgradeData"]); foreach (HabPropertiesCollection hpc in upgradeHpcList) { hpcUpgrades.Merge(hpc); } hpcUpgrades.SaveToFile(Application.StartupPath + "\\" + "upgrades.txt"); filelist.Add("upgrades.txt"); } string filenames = ""; foreach (string filename in filelist) { filenames += " " + filename + ","; } MessageBox.Show("Data dumped to " + Application.StartupPath + "\nFiles:" + filenames.TrimEnd(',')); }