Skip to content

Commit

Permalink
Update Presets v3.10 and Changed Buildblocker for All Buildings (#325)
Browse files Browse the repository at this point in the history
* Changed Anno 1800 BuildBlocker Process that will fix #60 and Part 1 #323
Update Presets to version 3.10:
* Added Tourists DLC Icons
* Added Tourists DLC Ornaments to the Presets Tree
* Added Tourists DLC Buildings to Presets Tree
* Added Tourists DLC Buildings to Color.json (v1.0.0.9)
Anno Designer (for next Version)
* Added translation for Tourist DLC Presets Tree Menu's

* Fix : Palace on the right tree menu
Fix : Missing Residence Icons : Arctic and New World

* Adjused the Test of BuildingBockProvider
Incase of this tests, i commented out the "wait for a key" in the program iit self

* - adjusted german localization

* - optimized images (1,80 MB -> 1,56 MB)

Co-authored-by: Sting Mcray <[email protected]>
Co-authored-by: FroggieFrog <[email protected]>
  • Loading branch information
3 people authored May 29, 2021
1 parent d7eb0fe commit 01850aa
Show file tree
Hide file tree
Showing 89 changed files with 153 additions and 76 deletions.
30 changes: 25 additions & 5 deletions AnnoDesigner/Localization/TreeLocalization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ static TreeLocalization()
{ "RiverBuildings", "River Buildings" },
{ "PermittedBuildings", "Permitted Buildings" },
{ "22DocklandsOrnaments", "22 Docklands Ornaments" },
{ "DocklandsModules", "Docklands Modules" }
{ "DocklandsModules", "Docklands Modules" },
{ "Orchard", "Orchard" },
{ "Restaurant", "Restaurant" },
{ "(17)Tourists", "(17) Tourists"},
{ "23TouristOrnaments", "23 Tourist Ornaments"}
}
},
{
Expand Down Expand Up @@ -248,7 +252,11 @@ static TreeLocalization()
{ "RiverBuildings", "Flussgebäude" },
{ "PermittedBuildings", "Erlaubte Gebäude" },
{ "22DocklandsOrnaments","22 Speicherstadt Verzierungen" },
{ "DocklandsModules", "Speicherstadt Module" }
{ "DocklandsModules", "Speicherstadt Module" },
{ "Orchard", "Obstgarten" },
{ "Restaurant", "Restaurant" },
{ "(17)Tourists", "(17) Touristen"},
{ "23TouristOrnaments", "23 Touristische Ornamente"}
}
},
{
Expand Down Expand Up @@ -360,7 +368,11 @@ static TreeLocalization()
{ "RiverBuildings", "Bâtiments fluviaux" },
{ "PermittedBuildings", "Bâtiments autorisés" },
{ "22DocklandsOrnaments", "22 Ornements de Docklands" },
{ "DocklandsModules", "Modules Docklands" }
{ "DocklandsModules", "Modules Docklands" },
{ "Orchard", "Verger"},
{ "Restaurant", "Restaurant" },
{ "(17)Tourists", "(17) Touristes"},
{ "23TouristOrnaments", "23 Ornements Touristiques"}
}
},
{
Expand Down Expand Up @@ -472,7 +484,11 @@ static TreeLocalization()
{ "RiverBuildings", "Budynki nadrzeczne" },
{ "PermittedBuildings", "Dozwolone budynki" },
{ "22DocklandsOrnaments", "22 Ornamenty Docklands" },
{ "DocklandsModules", "Moduły Docklands" }
{ "DocklandsModules", "Moduły Docklands" },
{ "Orchard", "Sad" },
{ "Restaurant", "Restauracja" },
{ "(17)Tourists", "(17) Turyści"},
{ "23TouristOrnaments", "22 Ozdoby Turystyczne"}
}
},
{
Expand Down Expand Up @@ -584,7 +600,11 @@ static TreeLocalization()
{ "RiverBuildings", "Речные здания" },
{ "PermittedBuildings", "Разрешенные здания" },
{ "22DocklandsOrnaments", "22 Докленды Украшения" },
{ "DocklandsModules", "Модули Доклендов" }
{ "DocklandsModules", "Модули Доклендов" },
{ "Orchard", "Сад"},
{ "Restaurant", "Ресторан" },
{ "(17)Tourists", "(17) Туристы"},
{ "23TouristOrnaments", "23 Туристические орнаменты"}
}
},
};
Expand Down
Binary file added AnnoDesigner/icons/A7_age_of_exploration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_banana_surprise.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified AnnoDesigner/icons/A7_bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_berliner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_black_muscovy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_brioche_royale.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_cellulose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_cherry_tree_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_cherry_tree_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_cherry_wood.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_cinamon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_citrus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_coconut.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_daiquiri_tropic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_eclair.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_eiffel_tower.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_eiffel_tower_skin_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_eiffel_tower_skin_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_enbesa_sunrise.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_fish_and_chips.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_flower_bed_corner_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_flower_bed_cross_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AnnoDesigner/icons/A7_flower_bed_cross_yellow.png
Binary file added AnnoDesigner/icons/A7_flower_bed_end_purple.png
Binary file added AnnoDesigner/icons/A7_flower_bed_end_red.png
Binary file added AnnoDesigner/icons/A7_flower_bed_end_yellow.png
Binary file added AnnoDesigner/icons/A7_flower_bed_straight_red.png
Binary file added AnnoDesigner/icons/A7_flower_bed_tcross_red.png
Binary file added AnnoDesigner/icons/A7_glogg.png
Binary file added AnnoDesigner/icons/A7_goulash.png
Binary file added AnnoDesigner/icons/A7_homarde_lit_de_terrorir.png
Binary file modified AnnoDesigner/icons/A7_hotel.png
Binary file added AnnoDesigner/icons/A7_jam.png
Binary file added AnnoDesigner/icons/A7_lemonade.png
Binary file added AnnoDesigner/icons/A7_lobster_fume.png
Binary file added AnnoDesigner/icons/A7_marmelade_review.png
Binary file added AnnoDesigner/icons/A7_montmatre.png
Binary file added AnnoDesigner/icons/A7_multifactory_chemistry.png
Binary file added AnnoDesigner/icons/A7_palmier_biscuit.png
Binary file added AnnoDesigner/icons/A7_plantation.png
Binary file added AnnoDesigner/icons/A7_plantation_sa.png
Binary file added AnnoDesigner/icons/A7_resident_Explorers.png
Binary file added AnnoDesigner/icons/A7_resident_Technicians.png
Binary file added AnnoDesigner/icons/A7_resident_jornalero.png
Binary file added AnnoDesigner/icons/A7_resident_obrera.png
Binary file added AnnoDesigner/icons/A7_resident_tourist.png
Binary file modified AnnoDesigner/icons/A7_restaurant.png
Binary file added AnnoDesigner/icons/A7_schnitzel.png
Binary file added AnnoDesigner/icons/A7_shampoo.png
Binary file added AnnoDesigner/icons/A7_souvenir.png
Binary file added AnnoDesigner/icons/A7_trifle_tower.png
Binary file added AnnoDesigner/icons/A7_venison_ragout.png
Binary file added AnnoDesigner/icons/A7_venison_tartare.png
Binary file added AnnoDesigner/icons/A7_wood_resin.png
2 changes: 1 addition & 1 deletion PresetParser/Anno1800/NewOrnamentsGroup1800.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static (string Faction, string Group, string Template) GetNewOrnamentsGro
if (identifierName.IsPartOf(ChangeOrnamentToParkFountains_1800)) { factionName = "Ornaments"; groupName = "04 Park Fountains"; templateName = "OrnamentalBuilding_Park"; }
if (identifierName.IsPartOf(ChangeOrnamentToParkStatues_1800)) { factionName = "Ornaments"; groupName = "05 Park Statues"; templateName = "OrnamentalBuilding_Park"; }
if (identifierName.IsPartOf(ChangeOrnamentToParkDecorations_1800)) { factionName = "Ornaments"; groupName = "06 Park Decorations"; templateName = "OrnamentalBuilding_Park"; }
if (identifierName.IsPartOf(ChangeOrnamentToCityPaths_1800) && identifierName != "Palace") { factionName = "Ornaments"; groupName = "07 City Paths"; }
if (identifierName.IsPartOf(ChangeOrnamentToCityPaths_1800)) { factionName = "Ornaments"; groupName = "07 City Paths"; }
if (identifierName.IsPartOf(ChangeOrnamentToCityFences_1800)) { factionName = "Ornaments"; groupName = "08 City Fences"; }
if (identifierName.IsPartOf(ChangeOrnamentToCityStatues_1800)) { factionName = "Ornaments"; groupName = "09 City Statues"; }
if (identifierName.IsPartOf(ChangeOrnamentToCityDecorations_1800)) { factionName = "Ornaments"; groupName = "10 City Decorations"; }
Expand Down
132 changes: 76 additions & 56 deletions PresetParser/BuildingBlockProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
Expand Down Expand Up @@ -44,34 +46,88 @@ private bool ParseBuildingBlockerForAnno1800(XmlDocument ifoDocument, IBuildingI
{
try
{
XmlNode node = ifoDocument.FirstChild?[BUILDBLOCKER].FirstChild;

//check of the node contains data
if (string.IsNullOrEmpty(node?.InnerText))
var xf = 0;
var zf = 0;
string xc, zc = ""; // just information for checking line calculated mode

// Change since 25-05-2021 - Fixing measurements of Buildings Buildblockers.
// Insttead of taking one XF * 2 and ZF * 2, it will check now the differences between 2 given XF's and ZF's
// Get all 4 [Position] childs from xml .ifo document
XmlNode node1 = ifoDocument.FirstChild?[BUILDBLOCKER].FirstChild;
XmlNode node2 = ifoDocument.FirstChild?[BUILDBLOCKER].FirstChild.NextSibling;
XmlNode node3 = ifoDocument.FirstChild?[BUILDBLOCKER].FirstChild.NextSibling.NextSibling;
XmlNode node4 = ifoDocument.FirstChild?[BUILDBLOCKER].FirstChild.NextSibling.NextSibling.NextSibling;

//check of the nodes contains data
if (string.IsNullOrEmpty(node1?.InnerText) || string.IsNullOrEmpty(node2?.InnerText) || string.IsNullOrEmpty(node3?.InnerText) || string.IsNullOrEmpty(node4?.InnerText))
{
Console.WriteLine("-'X' and 'Z' are both 'Null' - Building will be skipped!");
return false;
}

building.BuildBlocker = new SerializableDictionary<int>();

string xfNormal = node["xf"].InnerText;
string zfNormal = node["zf"].InnerText;
var xf = ParseBuildingBlockerNumber(xfNormal);
var zf = ParseBuildingBlockerNumber(zfNormal);
//Convert the strings to a Variable and replace the "." for a "," to keep calculatable numbers
var xfNormal1 = Convert.ToDouble(node1["xf"].InnerText.Replace(".", ","));
var zfNormal1 = Convert.ToDouble(node1["zf"].InnerText.Replace(".", ","));
var xfNormal2 = Convert.ToDouble(node2["xf"].InnerText.Replace(".", ","));
var zfNormal2 = Convert.ToDouble(node2["zf"].InnerText.Replace(".", ","));
var xfNormal3 = Convert.ToDouble(node3["xf"].InnerText.Replace(".", ","));
var zfNormal3 = Convert.ToDouble(node3["zf"].InnerText.Replace(".", ","));
var xfNormal4 = Convert.ToDouble(node4["xf"].InnerText.Replace(".", ","));
var zfNormal4 = Convert.ToDouble(node4["zf"].InnerText.Replace(".", ","));

// Calculation mode check highest number minus lowest number
// example 1: 9 - -2 = 11
// example 2: 2,5 - -2,5 = 5
// This will give the right BuildBlocker[X] and BuildBlocker[Y] for all buildings from anno 1800

// XF Calculation
if (xfNormal1 > xfNormal3)
{
xf = Convert.ToInt32(xfNormal1 - xfNormal3);
xc = "MA";// just information for checking line calculated mode
} else
{
xf = Convert.ToInt32(xfNormal3 - xfNormal1);
xc = "MB";// just information for checking line calculated mode
}

//Adjust size of buildings.
//Some buildings have wrong values in the game data.
//So those values are adjusted to the real values from inside the game.
//The check is performed by the identifier of a building (CASE SENSITIVE).
switch (building.Identifier)
// zf Calculation
if (zfNormal1 > zfNormal2)
{
zf = Convert.ToInt32(zfNormal1 - zfNormal2);
zc = "MA";// just information for checking line calculated mode
}
else if (zfNormal1 == zfNormal2)
{
if (zfNormal1 > zfNormal3)
{
zf = Convert.ToInt32(zfNormal1 - zfNormal3);
zc = "MB";// just information for checking line calculated mode
}
else
{
zf = Convert.ToInt32(zfNormal3 - zfNormal1);
zc = "MD";// just information for checking line calculated mode
}
}
else
{
case "Palace_Module_05 (gate)": xf = 3; zf = 3; break;
case "Harbor_arctic_01 (Depot)": xf = 11; zf = 4; break;
case "River_colony02_01 (Clay Harvester)":
case "River_colony02_02 (Paper Mill)":
case "River_colony02_03 (Water Pump)": xf = 9; zf = 5; break;
zf = Convert.ToInt32(zfNormal2 - zfNormal1);
zc = "MC";// just information for checking line calculated mode
}


if ((xf == 0 || zf == 0) && building.Identifier != "Trail_05x05") {
//when something goes wrong on the measurements, report and stop till a key is hit
Console.WriteLine("MEASUREMENTS GOING WRONG!!! CHECK THIS BUILDING");
Console.WriteLine(" Node 1 - XF: {0} | ZF: {1} ;\n Node 2 - XF: {2} | ZF: {3} ;\n Node 3 - XF: {4} | ZF: {5} ;\n Node 4 - XF: {6} | ZF: {7}", xfNormal1, zfNormal1, xfNormal2, zfNormal2, xfNormal3, zfNormal3, xfNormal4, zfNormal4);
Console.WriteLine("Building measurement is : {0} x {1} (Method {2} and {3})", xf, zf, xc, zc);
Console.WriteLine("Press a key to continue");
//Console.ReadKey();
}

//if both values are zero, then skip building
if (xf < 1 && zf < 1)
{
Expand All @@ -81,7 +137,7 @@ private bool ParseBuildingBlockerForAnno1800(XmlDocument ifoDocument, IBuildingI

if (xf > 0)
{
building.BuildBlocker[X] = xf;
building.BuildBlocker[X] = Math.Abs(xf);
}
else
{
Expand All @@ -90,7 +146,7 @@ private bool ParseBuildingBlockerForAnno1800(XmlDocument ifoDocument, IBuildingI

if (zf > 0)
{
building.BuildBlocker[Z] = zf;
building.BuildBlocker[Z] = Math.Abs(zf);
}
else
{
Expand Down Expand Up @@ -184,41 +240,5 @@ private bool ParseBuildingBlocker(XmlDocument ifoDocument, IBuildingInfo buildin
return true;
}

private static int ParseBuildingBlockerNumber(string number)
{
int result;

if (number.Contains(BUILDING_BLOCKER_SEPARATOR))
{
var xz = number.Split(BUILDING_BLOCKER_SEPARATOR);
//Console.WriteLine("1: {0} 2: {1}", xz[0], xz[1]);
int xz1 = Math.Abs(Convert.ToInt32(xz[0]));
double xz2 = Math.Abs(Convert.ToInt32(xz[1]));
//Console.WriteLine("xz1: {0} xz2: {1}", xz1, xz2);
var countNumberLenght = xz[1].Length;
//Console.WriteLine("lebght= {0}", countNumberLenght);

int i = 0;
while (i < countNumberLenght)
{
xz2 = xz2 / 10;
//Console.WriteLine("{0}", xz2);
i++;
}

xz1 = xz1 * 2;
xz2 = xz2 * 2;

result = xz1 + Convert.ToInt32(xz2);
}
else
{
result = Math.Abs(Convert.ToInt32(number));
result = result * 2;
}

return result;
}

}
}
Loading

0 comments on commit 01850aa

Please sign in to comment.