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); } }
public override void Initialize() { Model model = GetDialogCustomData <Model>(); // Buildings - get flag ID from the area if (GetDialogTarget().GetLocalInt("IS_BUILDING_DOOR") == 1) { int structureID = _structure.GetPlaceableStructureID((NWPlaceable)GetDialogTarget()); if (structureID <= 0) { model.FlagID = GetDialogTarget().Area.GetLocalInt("TERRITORY_FLAG_ID"); } else { var flag = _structure.GetPCTerritoryFlagByBuildingStructureID(structureID); model.FlagID = flag.PCTerritoryFlagID; } // Razing is disabled for buildings SetResponseVisible("MainPage", 4, false); // Raze territory } // Regular territories - get flag ID from the territory flag object else { int flagID = _structure.GetTerritoryFlagID(GetDialogTarget()); model.FlagID = flagID; model.FlagMarker = (NWPlaceable)GetDialogTarget(); } SetDialogCustomData(model); BuildMainPageHeader(); }