public HistoricalFigure(List<Property> properties, World world) : base(properties, world) { Initialize(); List<string> knownEntitySubProperties = new List<string>() { "entity_id", "link_strength", "link_type", "position_profile_id", "start_year", "end_year" }; List<string> knownReputationSubProperties = new List<string>() { "entity_id", "unsolved_murders", "first_ageless_year", "first_ageless_season_count" }; List<string> knownSiteLinkSubProperties = new List<string>() { "link_type", "site_id", "sub_id", "entity_id" }; foreach(Property property in properties) switch(property.Name) { case "appeared": Appeared = Convert.ToInt32(property.Value); break; case "birth_year": BirthYear = Convert.ToInt32(property.Value); break; case "birth_seconds72": BirthSeconds72 = Convert.ToInt32(property.Value); break; case "death_year": DeathYear = Convert.ToInt32(property.Value); break; case "death_seconds72": DeathSeconds72 = Convert.ToInt32(property.Value); break; case "name": Name = String.Intern(Formatting.InitCaps(property.Value)); break; case "race": Race = String.Intern(Formatting.FormatRace(property.Value)); break; case "caste": Caste = Formatting.InitCaps(property.Value.ToLower().Replace('_', ' ')); break; case "associated_type": AssociatedType = Formatting.InitCaps(property.Value.ToLower().Replace('_', ' ')); break; case "deity": Deity = true; property.Known = true; break; case "skeleton": Skeleton = true; property.Known = true; break; case "force": Force = true; property.Known = true; break; case "zombie": Zombie = true; property.Known = true; break; case "ghost": Ghost = true; property.Known = true; break; case "hf_link": //Will be processed after all HFs have been loaded world.AddHFtoHFLink(this, property); property.Known = true; List<string> knownSubProperties = new List<string>() { "hfid", "link_strength", "link_type" }; foreach (string subPropertyName in knownSubProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) subProperty.Known = true; } break; case "entity_link": case "entity_former_position_link": case "entity_position_link": world.AddHFtoEntityLink(this, property); foreach (string subPropertyName in knownEntitySubProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) subProperty.Known = true; } break; case "entity_reputation": world.AddReputation(this, property); foreach (string subPropertyName in knownReputationSubProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) subProperty.Known = true; } break; case "site_link": world.AddHFtoSiteLink(this, property); foreach (string subPropertyName in knownSiteLinkSubProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) subProperty.Known = true; } break; case "hf_skill": Skills.Add(new Skill(property.SubProperties)); break; case "active_interaction": ActiveInteractions.Add(property.Value); break; case "interaction_knowledge": InteractionKnowledge.Add(property.Value); break; case "animated": Animated = true; property.Known = true; break; case "animated_string": if (AnimatedType != "") throw new Exception("Animated Type already exists."); AnimatedType = Formatting.InitCaps(property.Value); break; case "journey_pet": JourneyPets.Add(Formatting.FormatRace(property.Value)); break; case "goal": Goal = Formatting.InitCaps(property.Value); break; case "sphere": Spheres.Add(property.Value); break; case "current_identity_id": world.AddHFCurrentIdentity(this, Convert.ToInt32(property.Value)); break; case "used_identity_id": world.AddHFUsedIdentity(this, Convert.ToInt32(property.Value)); break; case "ent_pop_id": EntityPopulation = world.GetEntityPopulation(Convert.ToInt32(property.Value)); break; case "holds_artifact": HoldingArtifacts.Add(world.GetArtifact(Convert.ToInt32(property.Value))); break; case "adventurer": Adventurer = true; property.Known = true; break; } if (Name == "") Name = "(Unnamed)"; }
public HistoricalFigure(List <Property> properties, World world) : base(properties, world) { Initialize(); List <string> knownEntitySubProperties = new List <string>() { "entity_id", "link_strength", "link_type", "position_profile_id", "start_year", "end_year" }; List <string> knownReputationSubProperties = new List <string>() { "entity_id", "unsolved_murders", "first_ageless_year", "first_ageless_season_count", "rep_enemy_fighter" }; List <string> knownSiteLinkSubProperties = new List <string>() { "link_type", "site_id", "sub_id", "entity_id" }; List <string> knownEntitySquadLinkProperties = new List <string>() { "squad_id", "squad_position", "entity_id", "start_year", "end_year" }; List <string> knownRelationshipProfileProperties = new List <string>() { "hf_id", "meet_count", "last_meet_year", "last_meet_seconds72", "rep_friendly", "rep_buddy", "rep_grudge" }; foreach (Property property in properties) { switch (property.Name) { case "appeared": Appeared = Convert.ToInt32(property.Value); break; case "birth_year": BirthYear = Convert.ToInt32(property.Value); break; case "birth_seconds72": BirthSeconds72 = Convert.ToInt32(property.Value); break; case "death_year": DeathYear = Convert.ToInt32(property.Value); break; case "death_seconds72": DeathSeconds72 = Convert.ToInt32(property.Value); break; case "name": Name = String.Intern(Formatting.InitCaps(property.Value)); break; case "race": Race = String.Intern(Formatting.FormatRace(property.Value)); break; case "caste": Caste = Formatting.InitCaps(property.Value.ToLower().Replace('_', ' ')); break; case "associated_type": AssociatedType = Formatting.InitCaps(property.Value.ToLower().Replace('_', ' ')); break; case "deity": Deity = true; property.Known = true; break; case "skeleton": Skeleton = true; property.Known = true; break; case "force": Force = true; property.Known = true; break; case "zombie": Zombie = true; property.Known = true; break; case "ghost": Ghost = true; property.Known = true; break; case "hf_link": //Will be processed after all HFs have been loaded world.AddHFtoHFLink(this, property); property.Known = true; List <string> knownSubProperties = new List <string>() { "hfid", "link_strength", "link_type" }; foreach (string subPropertyName in knownSubProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) { subProperty.Known = true; } } break; case "entity_link": case "entity_former_position_link": case "entity_position_link": world.AddHFtoEntityLink(this, property); foreach (string subPropertyName in knownEntitySubProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) { subProperty.Known = true; } } break; case "entity_reputation": world.AddReputation(this, property); foreach (string subPropertyName in knownReputationSubProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) { subProperty.Known = true; } } break; case "entity_squad_link": case "entity_former_squad_link": property.Known = true; foreach (string subPropertyName in knownEntitySquadLinkProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) { subProperty.Known = true; } } break; case "relationship_profile_hf": property.Known = true; foreach (string subPropertyName in knownRelationshipProfileProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) { subProperty.Known = true; } } break; case "site_link": world.AddHFtoSiteLink(this, property); foreach (string subPropertyName in knownSiteLinkSubProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) { subProperty.Known = true; } } break; case "hf_skill": Skills.Add(new Skill(property.SubProperties)); break; case "active_interaction": ActiveInteractions.Add(property.Value); break; case "interaction_knowledge": InteractionKnowledge.Add(property.Value); break; case "animated": Animated = true; property.Known = true; break; case "animated_string": if (AnimatedType != "") { throw new Exception("Animated Type already exists."); } AnimatedType = Formatting.InitCaps(property.Value); break; case "journey_pet": JourneyPets.Add(Formatting.FormatRace(property.Value)); break; case "goal": Goal = Formatting.InitCaps(property.Value); break; case "sphere": Spheres.Add(property.Value); break; case "current_identity_id": world.AddHFCurrentIdentity(this, Convert.ToInt32(property.Value)); break; case "used_identity_id": world.AddHFUsedIdentity(this, Convert.ToInt32(property.Value)); break; case "ent_pop_id": EntityPopulation = world.GetEntityPopulation(Convert.ToInt32(property.Value)); break; case "holds_artifact": HoldingArtifacts.Add(world.GetArtifact(Convert.ToInt32(property.Value))); break; case "adventurer": Adventurer = true; property.Known = true; break; } } if (Name == "") { Name = "(Unnamed)"; } }
public HistoricalFigure(List<Property> properties, World world) : base(properties, world) { Initialize(); foreach(Property property in properties) switch(property.Name) { case "appeared": Appeared = Convert.ToInt32(property.Value); break; case "birth_year": BirthYear = Convert.ToInt32(property.Value); break; case "birth_seconds72": BirthSeconds72 = Convert.ToInt32(property.Value); break; case "death_year": DeathYear = Convert.ToInt32(property.Value); break; case "death_seconds72": DeathSeconds72 = Convert.ToInt32(property.Value); break; case "name": Name = String.Intern(Formatting.InitCaps(property.Value)); break; case "race": Race = String.Intern(Formatting.FormatRace(property.Value)); break; case "caste": Caste = Formatting.InitCaps(property.Value.ToLower().Replace('_', ' ')); break; case "associated_type": AssociatedType = Formatting.InitCaps(property.Value.ToLower().Replace('_', ' ')); break; case "deity": Deity = true; property.Known = true; break; case "skeleton": Skeleton = true; property.Known = true; break; case "force": Force = true; property.Known = true; break; case "zombie": Zombie = true; property.Known = true; break; case "ghost": Ghost = true; property.Known = true; break; case "hf_link": //Will be processed after all HFs have been loaded world.AddHFtoHFLink(this, property); property.Known = true; List<string> knownSubProperties = new List<string>() { "hfid", "link_strength", "link_type" }; foreach (string subPropertyName in knownSubProperties) { Property subProperty = property.SubProperties.FirstOrDefault(property1 => property1.Name == subPropertyName); if (subProperty != null) subProperty.Known = true; } break; case "active_interaction": ActiveInteraction = property.Value; break; case "interaction_knowledge": InteractionKnowledge = property.Value; break; case "animated": Animated = true; property.Known = true; break; case "animated_string": AnimatedType = Formatting.InitCaps(property.Value); break; case "journey_pet": JourneyPet = Formatting.FormatRace(property.Value); break; case "goal": Goal = Formatting.InitCaps(property.Value); break; case "sphere": Spheres.Add(property.Value); break; //Unhandled Properties case "current_identity_id": case "ent_pop_id": case "holds_artifact": case "used_identity_id": property.Known = true; break; case "entity_link": property.Known = true; foreach(Property subProperty in property.SubProperties) switch (subProperty.Name) { case "link_type": case "link_strength": case "entity_id": subProperty.Known = true; break; } break; case "hf_skill": property.Known = true; foreach(Property subProperty in property.SubProperties) switch (subProperty.Name) { case "skill": case "total_ip": subProperty.Known = true; break; } break; case "entity_former_position_link": case "entity_position_link": property.Known = true; foreach(Property subProperty in property.SubProperties) switch (subProperty.Name) { case "position_profile_id": case "entity_id": case "start_year": case "end_year": subProperty.Known = true; break; } break; case "site_link": property.Known = true; foreach(Property subProperty in property.SubProperties) switch (subProperty.Name) { case "link_type": case "site_id": case "sub_id": case "entity_id": subProperty.Known = true; break; } break; case "entity_reputation": property.Known = true; foreach(Property subProperty in property.SubProperties) switch (subProperty.Name) { case "entity_id": case "unsolved_murders": case "first_ageless_year": case "first_ageless_season_count": subProperty.Known = true; break; } break; } if (Name == "") Name = "(Unnamed)"; }