Exemple #1
0
        private void InitializeConstructionSite()
        {
            NWPlaceable site         = (NWPlaceable)GetDialogTarget();
            NWObject    existingFlag = _structure.GetTerritoryFlagOwnerOfLocation(GetDialogTarget().Location);
            Model       model        = GetDialogCustomData <Model>();

            float distance = _.GetDistanceBetween(existingFlag.Object, GetDialogTarget().Object);

            if (!existingFlag.IsValid)
            {
                model.IsTerritoryFlag = true;
            }
            else
            {
                int flagID = _structure.GetTerritoryFlagID(existingFlag);
                model.FlagID = flagID;
                PCTerritoryFlag entity = _structure.GetPCTerritoryFlagByID(flagID);
                if (distance <= entity.StructureBlueprint.MaxBuildDistance || Equals(site.Area, existingFlag))
                {
                    model.IsTerritoryFlag = false;
                }
                else
                {
                    model.IsTerritoryFlag = true;
                }
            }

            model.ConstructionSiteID = _structure.GetConstructionSiteID(site);
            SetDialogCustomData(model);
        }
Exemple #2
0
        private void BuildMainPageHeader()
        {
            Model                   model  = GetDialogCustomData <Model>();
            int                     flagID = model.FlagID;
            PCTerritoryFlag         flag   = _structure.GetPCTerritoryFlagByID(flagID);
            TerritoryStructureCount counts = _structure.GetNumberOfStructuresInTerritory(flagID);

            var    blueprint = flag.StructureBlueprint;
            string header    = _color.Green("Territory Management Menu") + "\n\n"
                               + _color.Green("Vanity Slots: ") + counts.VanityCount + " / " + blueprint.VanityCount + "\n"
                               + _color.Green("Special Slots: ") + counts.SpecialCount + " / " + blueprint.SpecialCount + "\n"
                               + _color.Green("Resource Slots: ") + counts.ResourceCount + " / " + blueprint.ResourceCount + "\n"
                               + _color.Green("Building Slots: ") + counts.BuildingCount + " / " + blueprint.BuildingCount + "\n"
                               + "Please select an option.";

            SetPageHeader("MainPage", header);
        }
Exemple #3
0
        public bool Run(params object[] args)
        {
            NWPlaceable     site   = NWPlaceable.Wrap(Object.OBJECT_SELF);
            NWPlayer        oPC    = NWPlayer.Wrap(_.GetLastUsedBy());
            int             flagID = _structure.GetTerritoryFlagID(site);
            PCTerritoryFlag entity = _structure.GetPCTerritoryFlagByID(flagID);

            if (oPC.GlobalID != entity.PlayerID && !oPC.IsDM)
            {
                oPC.SendMessage("Only the owner of the territory may use this.");
            }
            else
            {
                _dialog.StartConversation(oPC, site, "TerritoryFlag");
            }
            return(true);
        }