-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1503 from andycandy-de/feature/scripts_20220117
Added new script to print all rooms + improved print of rooms
- Loading branch information
Showing
3 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { FileHelper } from "./FileHelper"; | ||
import { Dungeon } from './ValidateDungeons'; | ||
import { StructurMaskUtils, StructureMaskLineNumbers } from './StructurMaskUtils'; | ||
|
||
|
||
const maskStr = FileHelper.getFile('./contribution/dungeon/layout/structure-mask.json'); | ||
const mask: { rooms: Dungeon[], bossRooms: Dungeon[] } = JSON.parse(maskStr); | ||
const structureMaskLineNumbers: StructureMaskLineNumbers = StructurMaskUtils.getStructureMaskLineNumbers(maskStr); | ||
|
||
console.log("=== ROOMS ==="); | ||
console.log(""); | ||
for (let i = 0; i < mask.rooms.length; ++i) { | ||
console.log(`=== ROOM ${i} at line ${structureMaskLineNumbers.rooms[i]}`); | ||
console.log(""); | ||
console.log(dungeonToString(mask.rooms[i])); | ||
console.log(""); | ||
console.log(""); | ||
} | ||
|
||
|
||
console.log("=== BOSS ROOMS ==="); | ||
console.log(""); | ||
for (let i = 0; i < mask.bossRooms.length; ++i) { | ||
console.log(`=== ROOM ${i} at line ${structureMaskLineNumbers.bossRooms[i]}`); | ||
console.log(""); | ||
console.log(dungeonToString(mask.bossRooms[i])); | ||
console.log(""); | ||
console.log(""); | ||
} | ||
|
||
function dungeonToString(room: Dungeon): string { | ||
const partSize = room.tiles[0].length + 1; | ||
const lines = StructurMaskUtils.chunkString(room.tiles.join(' '), partSize * 15); | ||
return lines.join('\n'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters