示例#1
0
        private static void writeTitleInfo(StreamWriter writer, FactionInfo faction, HashSet <string> dupChecker)
        {
            string ck2Title = faction.getCK2Title();

            int size1 = dupChecker.Count;

            dupChecker.Add(ck2Title);
            int size2 = dupChecker.Count;

            if (size1 == size2)
            {
                return;
            }

            if (ck2Title != null && faction.getIsNewTitle())
            {
                Color color = faction.getColor();
                writer.WriteLine(ck2Title + " = {");
                writer.WriteLine("\tcolor={ " + color.R + " " + color.G + " " + color.B + " }");
                if (faction.getCK2Title() == "e_wre")
                {
                    writer.WriteLine("\tshort_name=yes");
                }
                writer.WriteLine("}");
            }
        }
示例#2
0
        private static void writeProvinceHistory(AttilaRegionInfo attilaRegion, CK2CountyRegionInfo ck2County, ReligionsInfo religions)
        {
            //Remove ifs if going province specific
            if (attilaRegion.getIsBurned())
            {
                return;
            }
            FactionInfo faction = attilaRegion.getOwningFaction();

            if (faction.getID().Contains("fact_separatist") || faction.getID().Contains("fact_rebel"))
            {
                return;
            }
            string           filename   = ck2County.getFilename();
            string           outputPath = ImportantPaths.getOutputPath() + "\\history\\provinces\\" + filename;
            HashSet <String> baronies   = ck2County.getBaronies();

            using (StreamWriter writer = File.CreateText(outputPath)) {
                writer.WriteLine("# " + filename.Substring(0, filename.Length - 4));
                writer.WriteLine("");
                writer.WriteLine("# County Title");
                writer.WriteLine("title = " + ck2County.getID());
                writer.WriteLine("");
                writer.WriteLine("# Settlements");
                writer.WriteLine("max_settlements = " + ck2County.getMaxSettlements());
                bool wroteBarony = false;
                foreach (String barony in baronies)
                {
                    if (wroteBarony == false)
                    {
                        writer.WriteLine(barony + " = castle");
                        wroteBarony = true;
                    }
                    else
                    {
                        writer.WriteLine("#" + barony + " = castle");
                    }
                }
                writer.WriteLine("");
                writer.WriteLine("# Misc");
                string culture = faction.getOwner().getCulture();
                writer.WriteLine("culture = " + culture);
                //writer.WriteLine("culture = " + attilaRegion.getIDStr());
                writer.WriteLine("religion = " + religions.getCK2Religion(attilaRegion.getMostPowerfulReligion()));
                writer.WriteLine("");
                writer.WriteLine("# History");
            }
        }
示例#3
0
        private void readRegionXML(string regionXML, FactionsInfo factions)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(regionXML);
            XmlNode root    = doc.DocumentElement;
            int     nodePos = 0;

            for (XmlNode node = root.FirstChild; node != null; node = node.NextSibling)
            {
                if (node.Name == "rec" || node.Name == "xml_include" || node.Name == "traits")
                {
                    continue;
                }
                if (nodePos == 0)
                {
                    idNum = Int32.Parse(node.InnerText);
                }
                else if (nodePos == 1)
                {
                    idStr = node.InnerText;
                }
                else if (nodePos == 10)
                {
                    int         ownerNumID = Int32.Parse(node.InnerText);
                    FactionInfo faction    = factions.getFactionByNumID(ownerNumID);
                    if (faction != null)
                    {
                        this.owningFaction = faction;
                    }
                }
                else if (nodePos == 23)
                {
                    if (node.Name == "yes")
                    {
                        burned = true;
                    }
                    else
                    {
                        burned = false;
                    }
                }
                nodePos++;
            }
            //string regionSlotPath = importantPaths.getSavegameXMLPath() + "\\region_slot\\" + idStr + "-0.xml";
            //readRegionSlot0(regionSlotPath);
        }
示例#4
0
 private static void outputAdjectives(StreamWriter writer, FactionInfo faction)
 {
     //if (faction.getCK2Title() == "e_persia") return;
     if (faction.getIsNewTitle())
     {
         string id      = faction.getCK2Title() + "_adj";
         string english = faction.getAdjective();
         string line    = LocalisationFormatter.format(id, english);
         writer.WriteLine(line);
     }
     else
     {
         string id = "correction_" + faction.getCK2Title() + "_adj";
         id = id.ToUpper();
         string english = faction.getAdjective();
         string line    = LocalisationFormatter.format(id, english);
         writer.WriteLine(line);
     }
 }