Ejemplo n.º 1
0
        public static void WriteSkillReport(SkillType st)
        {
            string s = st.ToString(lng) + " :";

            if (lng == Lang.En)
            {
                if (st.DescriptionEn != "")
                {
                    s += " " + st.DescriptionEn;
                }

                if (st.BasedOn != null)
                {
                    s += " This skill requires " + st.BasedOn.FullNameEn +
                         " [" + st.BasedOn.Name + "] to study.";
                }

                // Production
                ItemTypeArrayList products = new ItemTypeArrayList();
                foreach (ItemType it in ItemType.List)
                {
                    if (it.ProduceSkill != null && it.ProduceSkill.Type == st)
                    {
                        products.Add(it);
                    }
                }
                if (products.Count > 0)
                {
                    s += " A person with this skill may PRODUCE " +
                         products.ToString(lng);
                }

                // Installation
                ItemTypeArrayList installs = new ItemTypeArrayList();
                foreach (ItemType it in ItemType.List)
                {
                    if (it.InstallSkill != null && it.InstallSkill.Type == st)
                    {
                        installs.Add(it);
                    }
                }
                if (installs.Count > 0)
                {
                    s += " A person with this skill can INSTALL and UNINSTALL " +
                         installs.ToString(lng);
                }

                // Building
                BuildingTypeArrayList buildings = new BuildingTypeArrayList();
                foreach (ItemType it in installs)
                {
                    foreach (BuildingType bt in BuildingType.List)
                    {
                        if (!bt.NoBuild && bt.Materials.Count > 0 && bt.Materials[0].Type == it)
                        {
                            buildings.Add(bt);
                        }
                    }
                }
                if (buildings.Count > 0)
                {
                    s += " It allows to BUILD: " + buildings.ToString(lng);
                }

                // Driving
                buildings.Clear();
                foreach (BuildingType bt in BuildingType.List)
                {
                    if (bt.DriveSkill != null && bt.DriveSkill.Type == st)
                    {
                        buildings.Add(bt);
                    }
                }
                if (buildings.Count > 0)
                {
                    s += " A person with this skill can DRIVE " + buildings.ToString(Lang.En);
                }
            }
            else
            {
                if (st.DescriptionRu != "")
                {
                    s += " " + st.DescriptionRu;
                }

                if (st.BasedOn != null)
                {
                    s += " Для изучения необходим навык " +
                         st.BasedOn.ToString(lng) + ".";
                }

                // Production
                ItemTypeArrayList products = new ItemTypeArrayList();
                foreach (ItemType it in ItemType.List)
                {
                    if (it.ProduceSkill != null && it.ProduceSkill.Type == st)
                    {
                        products.Add(it);
                    }
                }
                if (products.Count > 0)
                {
                    s += " Навык позволяет производить предметы: " +
                         products.ToString(lng);
                }

                // Installation
                ItemTypeArrayList installs = new ItemTypeArrayList();
                foreach (ItemType it in ItemType.List)
                {
                    if (it.InstallSkill != null && it.InstallSkill.Type == st)
                    {
                        installs.Add(it);
                    }
                }
                if (installs.Count > 0)
                {
                    s += " Навык позволяет монтировать и демонтировать предметы: " +
                         installs.ToString(lng);
                }

                // Building
                BuildingTypeArrayList buildings = new BuildingTypeArrayList();
                foreach (ItemType it in installs)
                {
                    foreach (BuildingType bt in BuildingType.List)
                    {
                        if (!bt.NoBuild && bt.Materials.Count > 0 && bt.Materials[0].Type == it)
                        {
                            buildings.Add(bt);
                        }
                    }
                }
                if (buildings.Count > 0)
                {
                    s += " С его помощью могут быть построены: " + buildings.ToString(lng);
                }

                // Driving
                buildings.Clear();
                foreach (BuildingType bt in BuildingType.List)
                {
                    if (bt.DriveSkill != null && bt.DriveSkill.Type == st)
                    {
                        buildings.Add(bt);
                    }
                }
                if (buildings.Count > 0)
                {
                    s += " Навык позволяет водить машины: " +
                         buildings.ToString(lng);
                }
            }

            Write(s);
            Write("");
        }