Esempio n. 1
0
        public Identity(List <Property> properties, World world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "id": Id = Convert.ToInt32(property.Value); break;

                case "name": Name = Formatting.InitCaps(property.Value.Replace("'", "`")); break;

                case "nemesis_id":
                case "histfig_id":
                    HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value));
                    break;

                case "birth_year": BirthYear = Convert.ToInt32(property.Value); break;

                case "birth_second": BirthSeconds72 = Convert.ToInt32(property.Value); break;

                case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "race": Race = world.GetCreatureInfo(property.Value); break;

                case "caste": Caste = string.Intern(Formatting.InitCaps(property.Value.ToLower().Replace('_', ' '))); break;

                case "profession": Profession = string.Intern(Formatting.InitCaps(property.Value.ToLower().Replace('_', ' '))); break;
                }
            }

            HistoricalFigure?.Identities.Add(this);
        }
        public EntityPopulation(List <Property> properties, World world)
            : base(properties, world)
        {
            EntityId = -1;
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "race":
                    var raceCount = property.Value.Split(':');
                    Race  = world.GetCreatureInfo(raceCount[0]);
                    Count = Convert.ToInt32(raceCount[1]);
                    break;

                case "civ_id":
                    EntityId = property.ValueAsInt();
                    break;
                }
            }
        }