public bool Run(params object[] args) { NWPlayer oPC = NWPlayer.Wrap(_.GetLastUsedBy()); NWPlaceable objSelf = NWPlaceable.Wrap(Object.OBJECT_SELF); int structureID = _structure.GetPlaceableStructureID(objSelf); PCTerritoryFlagsStructure structure = _structure.GetPCStructureByID(structureID); if (_structure.PlayerHasPermission(oPC, StructurePermission.CanAccessPersistentStorage, structure.PCTerritoryFlagID) || _structure.PlayerHasPermission(oPC, StructurePermission.CanRenameStructures, structure.PCTerritoryFlagID)) { _dialog.StartConversation(oPC, objSelf, "StructureStorage"); } else { oPC.FloatingText("You do not have permission to access this structure."); } return(true); }
private void DoEnterBuilding() { NWPlayer oPC = GetPC(); NWPlaceable door = (NWPlaceable)GetDialogTarget(); int structureID = _structure.GetPlaceableStructureID(door); if (structureID <= 0) { _.FloatingTextStringOnCreature("ERROR: Door doesn't have a structure ID assigned. Notify an admin about this issue.", oPC.Object, FALSE); return; } PCTerritoryFlagsStructure structure = _structure.GetPCStructureByID(structureID); if (structure.BuildingInterior == null) { _.FloatingTextStringOnCreature("ERROR: Could not locate interior object for structure. Notify an admin about this issue.", oPC.Object, FALSE); return; } NWArea instance = GetAreaInstance(structureID); if (instance == null) { PCTerritoryFlag flag = _structure.GetPCTerritoryFlagByBuildingStructureID(structureID); string name = structure.CustomName; if (name == string.Empty) { PlayerCharacter owner = _player.GetPlayerEntity(structure.PCTerritoryFlag.PlayerID); if (flag.ShowOwnerName) { name = owner.CharacterName + "'s Building"; } else { name = "Building"; } } instance = NWArea.Wrap(_.CreateArea(structure.BuildingInterior.AreaResref, "", name)); instance.SetLocalInt("BUILDING_STRUCTURE_ID", structureID); instance.SetLocalInt("TERRITORY_FLAG_ID", flag.PCTerritoryFlagID); // Load structures & construction sites foreach (Data.Entities.ConstructionSite entity in flag.ConstructionSites) { if (entity.IsActive) { _structure.CreateConstructionSiteFromEntity(entity); } } foreach (PCTerritoryFlagsStructure entity in flag.PCTerritoryFlagsStructures) { if (entity.IsActive) { _structure.CreateStructureFromEntity(entity); } } } instance.SetLocalInt("BUILDING_DISABLED", 0); _structure.JumpPCToBuildingInterior(oPC, instance); }