コード例 #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);
        }
コード例 #2
0
        public override void Initialize()
        {
            NWPlayer    oPC             = GetPC();
            NWPlaceable door            = (NWPlaceable)GetDialogTarget();
            Location    location        = door.Location;
            NWObject    flag            = _structure.GetTerritoryFlagOwnerOfLocation(location);
            int         territoryFlagID = _structure.GetTerritoryFlagID(flag);
            int         structureID     = _structure.GetPlaceableStructureID(door);
            int         buildingFlagID  = _structure.GetPCTerritoryFlagByBuildingStructureID(structureID).PCTerritoryFlagID;

            // Only players with permission can enter the building
            if (!_structure.PlayerHasPermission(oPC, StructurePermission.CanEnterBuildings, territoryFlagID) &&
                !_structure.PlayerHasPermission(oPC, StructurePermission.CanEnterBuildings, buildingFlagID))
            {
                SetResponseVisible("MainPage", 1, false);
            }

            // Only territory owner or building owner may adjust permissions.
            BuildingOwners owners = _structure.GetBuildingOwners(territoryFlagID, structureID);

            if (oPC.GlobalID != owners.TerritoryOwner &&
                oPC.GlobalID != owners.BuildingOwner)
            {
                SetResponseVisible("MainPage", 3, false);
            }
        }
コード例 #3
0
        public override void Initialize()
        {
            NWPlayer    oPC             = GetPC();
            NWPlaceable door            = (NWPlaceable)GetDialogTarget();
            NWArea      area            = door.Area;
            Location    location        = door.Location;
            NWObject    flag            = _structure.GetTerritoryFlagOwnerOfLocation(location);
            int         territoryFlagID = _structure.GetTerritoryFlagID(flag);
            int         structureID     = _structure.GetPlaceableStructureID(door);

            // Only territory owner or building owner may adjust permissions.
            BuildingOwners owners = _structure.GetBuildingOwners(territoryFlagID, structureID);

            if (oPC.GlobalID != owners.TerritoryOwner &&
                oPC.GlobalID != owners.BuildingOwner)
            {
                SetResponseVisible("MainPage", 3, false);
            }

            if (area.GetLocalInt("IS_BUILDING_PREVIEW") == 1)
            {
                SetResponseVisible("MainPage", 2, false);
                SetResponseVisible("MainPage", 3, false);
            }
        }
コード例 #4
0
ファイル: BuildToolMenu.cs プロジェクト: zunath/Freescape
        public override void Initialize()
        {
            NWPlayer oPC   = GetPC();
            Model    model = GetDialogCustomData <Model>();

            model.TargetLocation = oPC.GetLocalLocation("BUILD_TOOL_LOCATION_TARGET");
            oPC.DeleteLocalLocation("BUILD_TOOL_LOCATION_TARGET");
            model.Flag = _structure.GetTerritoryFlagOwnerOfLocation(model.TargetLocation);
            SetDialogCustomData(model);
            BuildMainMenuResponses(null);
        }