예제 #1
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);
            }
        }
예제 #2
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);
            }
        }