Exemplo n.º 1
0
        private void LoadBlueprintListPageResponses()
        {
            Model model = GetDialogCustomData <Model>();

            ClearPageResponses("BlueprintListPage");
            Location location = GetDialogTarget().Location;
            PCSkill  pcSkill  = _skill.GetPCSkill(GetPC(), SkillType.Construction);

            if (pcSkill == null)
            {
                return;
            }

            PCTerritoryFlag         flag   = _structure.GetPCTerritoryFlagByID(model.FlagID);
            TerritoryStructureCount counts = _structure.GetNumberOfStructuresInTerritory(model.FlagID);

            List <StructureBlueprint> blueprints = _structure.GetStructuresByCategoryAndType(GetPC().GlobalID, model.CategoryID, false, false, false, false); // Territory markers

            if (flag != null && counts.VanityCount < flag.StructureBlueprint.VanityCount)
            {
                blueprints.AddRange(_structure.GetStructuresByCategoryAndType(GetPC().GlobalID, model.CategoryID, true, false, false, false)); // Vanity
            }
            if (flag != null && counts.SpecialCount < flag.StructureBlueprint.SpecialCount)
            {
                blueprints.AddRange(_structure.GetStructuresByCategoryAndType(GetPC().GlobalID, model.CategoryID, false, true, false, false)); // Special
            }
            if (flag != null && counts.ResourceCount < flag.StructureBlueprint.ResourceCount)
            {
                blueprints.AddRange(_structure.GetStructuresByCategoryAndType(GetPC().GlobalID, model.CategoryID, false, false, true, false)); // Resource
            }
            if (flag != null && counts.BuildingCount < flag.StructureBlueprint.BuildingCount)
            {
                blueprints.AddRange(_structure.GetStructuresByCategoryAndType(GetPC().GlobalID, model.CategoryID, false, false, false, true)); // Building
            }

            foreach (StructureBlueprint entity in blueprints)
            {
                string entityName = entity.Name + " (Lvl. " + entity.Level + ")";
                if (model.IsTerritoryFlag)
                {
                    if (_structure.WillBlueprintOverlapWithExistingFlags(location, entity.StructureBlueprintID))
                    {
                        entityName = _color.Red(entityName + " [OVERLAPS]");
                    }
                }
                AddResponseToPage("BlueprintListPage", entityName, entity.IsActive, new Tuple <string, dynamic>(string.Empty, entity.StructureBlueprintID));
            }

            AddResponseToPage("BlueprintListPage", "Back");
        }