Repository navigation
Expand file tree
/
Copy pathmain.js
More file actions
677 lines (623 loc) · 26.2 KB
/
Copy pathmain.js
File metadata and controls
677 lines (623 loc) · 26.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
// I GOT A LOT OF USEFUL INFORMATION FROM https://heck.aeroluna.dev/ THEY HELPED ME A TON!!!
import { info } from 'node:console';
import fs from 'node:fs'
const colors = {
reset: "\x1b[0m",
red: "\x1b[31m",
green: "\x1b[32m",
yellow: "\x1b[33m",
blue: "\x1b[34m",
magenta: "\x1b[35m",
cyan: "\x1b[36m",
bold: "\x1b[1m",
};
console.log(colors.green, "[OK] Started " + import.meta.filename, colors.reset)
async function fileExists(path) {
try {
await fs.promises.access(path);
console.log(colors.green, `[OK] ${path} found!`, colors.reset)
return true;
} catch (err) {
console.log(colors.magenta, `[CRITICAL] VVV Wrong file name? File does not exist? VVV`, colors.reset)
console.error(err)
console.log(colors.magenta, `[CRITICAL] ^^^ Wrong file name? File does not exist? ^^^`, colors.reset)
return false;
}
}
let difficulty
let data
let diffJSON
let infoJSON
let nameOfInfo
/**
*
* @param {string} diff - Pass in the name of the difficulty you want to edit with modmapper
*/
export async function setDifficulty(diff) {
difficulty = diff
const found = await fileExists(difficulty)
if (found) {
data = fs.readFileSync(difficulty, "utf-8")
diffJSON = JSON.parse(data)
// erasing previous custom data
diffJSON.customData = {}
diffJSON.customData.customEvents = []
diffJSON.customData.environment = []
diffJSON.colorNotes.forEach(note => {
delete note.customData
})
diffJSON.basicBeatmapEvents.forEach(event => {
delete event.customData
})
diffJSON.customData.materials = {}
diffJSON.basicBeatmapEvents = []
}
else {
console.log(colors.magenta, `[CRITICAL] Could not find ${difficulty} in the current directonary`, colors.reset)
return;
}
}
/**
* @typedef {Object} PlayerOptions
* @property {boolean} [_reduceDebris]
* @property {boolean} [_noTextsAndHuds]
* @property {boolean} [_noFailEffects]
* @property {boolean} [_advancedHud]
* @property {boolean} [_autoRestart]
* @property {number} [_saberTrailIntensity]
* @property {boolean} [_hideNoteSpawnEffect]
* @property {boolean} [_adaptiveSfx]
* @property {"AllEffects"|"StrobeFilter"|"NoEffects"} [_environmentEffectsFilterDefaultPreset]
* @property {"AllEffects"|"StrobeFilter"|"NoEffects"} [_environmentEffectsFilterExpertPlusPreset]
*/
/**
* @typedef {Object} Environments
* @property {boolean} [_overrideEnvironments] - Turn Environment override on or off.
*/
/**
* @typedef {Object} GraphicsSettings
* @property {number} [_mirrorGraphicsSettings] - Set the quality of the mirror. 0-3 0 being off and 3 being highest.
* @property {boolean} [_mainEffectGraphicsSettings] - Turn on or off Bloom Post Process
* @property {number} [_smokeGraphicsSettings] - Enable or disable the smoke effect. 0 being off and 1 being on.
* @property {boolean} [_burnMarkTrailsEnabled] - Hidden setting: Hides burn trails left by sabers.
* @property {boolean} [_screenDisplacementEffectsEnabled] - Enable or disable screen distortion effects.
* @property {number} [_maxShockwaveParticles] - Sets the max shockwave particles. 0-2
*/
/**
* @typedef {Object} Settings
* @property {PlayerOptions} [_playerOptions]
* @property {Environments} [environments]
* @property {GraphicsSettings} [graphics]
*/
/**
* @typedef {Object} requirements
* @property {(
* "Noodle Extensions" |
* "Chroma" |
* "Mapping Extensions"
* )[]} [requirements]
* @property {*} [Chroma]
*/
/**
* @typedef {Object} infoProperties
* @property {"DefaultEnvironment"|"BigMirrorEnvironment"|"TriangleEnvironment"|"NiceEnvironment"|"KDAEnvironment"|"MonstercatEnvironment"|"DragonsEnvironment"|"OriginsEnvironment"|"CrabRaveEnvironment"|"PanicEnvironment"|"RocketEnvironment"|"GreenDayEnvironment"|"TimbalandEnvironment"|"FitBeatEnvironment"|"LinkinParkEnvironment"|"BTSEnvironment"|"BillieEnvironment"|"GagaEnvironment"} [environment] - What environment should the beat map use? This overwrite is disabled if the player has environment override turned on.
* @property {string} [difficultyLabel] - What is the name of the diff? Example: from "Expert+" to "Brr brr patapiem"
* @property {string} [warnings] - Warn the user about certein things.
* @property {string} [information] - Say something the user should know :3
* @property {Settings} [settings] - Allows you to suggest settings when starting the map.
* @property {any} [requirements] - HAS TO BE A ARRAY. Set the requirements of the map. "Chroma", "Noodle Extensions", "Mapping Exensions".
*/
/**
* Allows you to set information about the beat map. Documentation: https://heck.aeroluna.dev/settings/
* @param {string} file - Info.dat is the default, you should not have to change it from the template.
* @param {infoProperties} properties Information you can set for the map
*/
export async function setInformation(file, properties) {
if (fileExists(file) && properties) {
nameOfInfo = file
data = fs.readFileSync(file, "utf-8")
infoJSON = JSON.parse(data)
if (properties.environment) {
infoJSON._environmentName = properties.environment
infoJSON._environmentNames = [properties.environment]
}
if (infoJSON._difficultyBeatmapSets[0]._difficultyBeatmaps) {
let mapsArr = infoJSON._difficultyBeatmapSets[0]._difficultyBeatmaps
for (let i = 0; i < mapsArr.length; i++) {
mapsArr[0]._customData = {
_settings: properties.settings,
_difficultyLabel: properties.difficultyLabel,
_warnings: properties.warnings,
_information: properties.information,
// _playerOptions: properties.playerOptions,
_graphics: properties.graphics,
_requirements: properties.requirements
}
}
}
}
}
// --- NOTES ---
/**
* @typedef {Object} noteAnimationProperties
* @property {boolean} [spawnEffect] - Should the note have a spawn effect? Either true or false. Default = true
* @property {boolean} [disableNoteGravity] - When true, notes will no longer do their animation where they float up. Default = false
* @property {boolean} [disableNoteLook] - When true, notes will no longer rotate towards the player. Default = false
* @property {boolean} [disableBadCutDirection] - When true, the note cannot be cut from wrong direction. Default = false
* @property {boolean} [disableBadCutSpeed] - When true, the note cannot be cut with insufficient speed. Default = false
* @property {boolean} [disableBadCutSaberType] - When true, the note cannot be cut with the wrong saber. Default = false
* @property {string} [link] - When cut, all notes with the same link string will also be cut.
* @property {boolean} [uninteractable] - When true, the note/wall cannot be interacted with. This means notes cannot be cut and walls will not interact with sabers/putting your head in the wall. Notes will still count towards your score.
* @property {string} [track] - A very powerful property. Assigns a track to an object. You can animate a track so that all of the objects assigned to that track get animated as well at the same time.
* @property {{
* position?: [][]
* localPosition?: [][]
* offsetPosition?: [][]
* definitePosition?: [][]
* rotation?: [][]
* localRotation?: [][]
* offsetWorldRotation?: [][]
* dissolve?: [][]
* dissolveArrow?: [][]
* scale?: [][]
* }} [animation]
*/
/**
* Animates a note | Recommended to use with a for loop
* @param {number} beat - The beat the note is on that you want to animate
* @param {noteAnimationProperties} properties - How should the note behave?
*/
export function animateNote(beat, properties) {
if (diffJSON.colorNotes.forEach(note => {
if (note.b == beat) {
note.customData = properties
}
}));
}
/**
* Animates a set of notes in between 2 beats(INCLUSIVE) using a for loop
* @param {number} beat1 - The start beat
* @param {number} beat2 - The end beat
* @param {noteAnimationProperties} properties - How should the note behave?
*/
export function animateNoteInBetween(beat1, beat2, properties) {
if (properties) {
for (const note of diffJSON.colorNotes) {
if (note.b >= beat1 && note.b <= beat2) {
note.customData = properties
}
}
}
}
// --- TRACKS ---
/**
* @typedef {Object} animateTrackProperties
* @property {string} track - What track should be animated?
* @property {number} duration - How many beats should the track animation last?
* @property {number} beat - On what beat should the animation start?
* @property {number} [repeat] - How many times does this animation repeat?
* @property {{
* position?: [][]
* localPosition?: [][]
* offsetPosition?: [][]
* definitePosition?: [][]
* rotation?: [][]
* localRotation?: [][]
* offsetWorldRotation?: [][]
* dissolve?: [][]
* dissolveArrow?: [][]
* scale?: [][]
* }} animation
*/
/**
* Animates a track
* @param {animateTrackProperties} properties
*/
export function animateTrack(properties) {
if (diffJSON && properties) {
const b = properties.beat
const t = "AnimateTrack"
const d = {
track: properties.track,
...properties.animation,
duration: properties.duration,
easing: properties.animation.easing,
repeat: properties.repeat
}
const newProperties = {
b,
t,
d,
}
diffJSON.customData.customEvents.push(newProperties)
}
}
// --- ENVIRONMENT ---
/**
* @typedef {"Regex"|"Exact"|"Contains"|"StartsWith"|"EndsWith"} LookupMethod
*/
/**
* @typedef {Object} modifyEnvironmentProperties
* @property {string} id - Enter the id of the EnvironmentObject
* @property {LookupMethod} lookupMethod - What method should be used to look up the object? Regex, Exact, Contains, StartsWith, EndsWith. Default = Regex
* @property {number} [duplicate] - How many duplicates should be made of the object?
* @property {boolean} [active] - Should the object activated? | true or false. Default = true
* @property {any} [position] - Where should the object be positioned?
* @property {any} [rotation] - How should the object be rotated?
* @property {any} [scale] - How big should the object be?
* @property {any} [localPosition] - Where should the object be positioned relitive to it's set position?
* @property {any} [localRotation] - How should the object be rotated relative to it's set rotation??
* @property {any} [track] - What track should be assigned to the object?
* @property {{
* ILightWithId?: {
* lightID?: number
* type?: number
* }
* BloomFogEnvironment?: {
* attenuation?: number
* startY?: number
* height?: number
* }
* TubeBloomPrePassLight?: {
* colorAlphaMultiplier?: number
* bloomFogIntensityMultiplier?: number
* }
* }} [components]
*/
/**
* Used to modify(NOT ANIMATE) objects in the environment. It can be pretty complicated. For more information and guides go to the modmapper wiki(Doesn't exist yet)
* @param {modifyEnvironmentProperties} properties
*/
export function modifyEnvironment(properties) {
if (diffJSON && properties) {
diffJSON.customData.environment.push(properties)
}
}
// --- LIGHTS ---
/**
* @typedef {Object} lightEventProperties
* @property {number} [lightID] - What ID does the light event get?
* @property {number} [brightness] - How bright should the light be? 1 is default brightness but can go way above or below.
* @property {any} [color] - What color should the light be? You can set this is chromapper or manually do it here. Look at the wiki on how you should input colors.
* @property {string} [easing] - What easing style should the light event have?
* @property {string} [lerpType] - What lerping should the light even have? Either "RGB" or "HSV"
* @property {number} [type] - Type of lighting event. 0 = off, 1 = on, 2 = flash, 3 = fade, 4 = transition.I think idk 67420
* @property {number} [eventLane] - What should the event type be? (What lane?)
*/
/**
*
* @param {number} beat - What beat should the new light event be placed at?
* @param {lightEventProperties} properties - properties n' stuff
*/
export function addLightEvent(beat, properties) {
if (diffJSON && properties) {
let newLightEvent = {
b: beat,
i: properties.type,
et: properties.eventLane,
f: properties.brightness,
customData: {
color: properties.color,
easing: properties.easing,
lightID: properties.lightID,
lerpType: properties.lerpType
}
}
diffJSON.basicBeatmapEvents.push(newLightEvent)
}
}
/**
*
* @param {number} beat - Where should the light event start?
* @param {number} step How many beats are skipped before place the next one?
* @param {number} amount How many light events should be place?
* @param {lightEventProperties} properties - 6742069 brr brr patapiem
*/
export function addLightEventInBetween(beat, step, amount, properties) {
if (beat || beat == 0) {
if (diffJSON && step && amount && properties) {
const end = (step * amount) + beat
for (let start = beat; start <= end; start += step) {
addLightEvent(start, {
brightness: properties.brightness,
color: properties.color,
easing: properties.easing,
eventLane: properties.eventLane,
lerpType: properties.lerpType,
type: properties.type,
lightID: properties.lightID
})
}
}
}
}
/**
* Used to edit a light event at a certain beat, recommended to use with a for loop or with modmapper.getlightinbetween().foreach().
* @param {number} beat - At what beat should the light even take place?
* @param {lightEventProperties} properties - What properties should the light event have?
* @param {number} [et] - What lane does the event have to be in?
*/
export function editLightEvent(beat, properties, et) {
if (diffJSON && properties) {
diffJSON.basicBeatmapEvents.forEach(event => {
if (!et && et != 0) {
if (event.b == beat) {
event.i = properties.type ?? event.i
event.f = properties.brightness ?? event.f
event.et = properties.eventLane ?? event.et
event.customData = {
color: properties.color,
lightID: properties.lightID,
easing: properties.easing,
lerpType: properties.lerpType
}
}
}
else if (et || et == 0) {
if (event.b == beat && event.et == et) {
event.i = properties.type ?? event.i
event.f = properties.brightness ?? event.f
event.et = properties.eventLane ?? event.et
event.customData = {
color: properties.color,
lightID: properties.lightID,
easing: properties.easing,
lerpType: properties.lerpType
}
}
}
})
}
}
/**
* Allows you to edit light events in between 2 beats(INVLUSIVE)
* @param {number} beat1 - INCLUSIVE start beat
* @param {number} beat2 - INCLUSIVE end beat
* @param {lightEventProperties} properties - Some properties stuff idk lolol 67
*/
export function editLightEventInBetween(beat1, beat2, properties) {
if (diffJSON && properties && beat1 && beat2) {
diffJSON.basicBeatmapEvents.forEach((event) => {
if (event.b >= beat1 && event.b <= beat2) {
event.i = properties.eventType
event.f = properties.brightness
event.et = properties.type
let newProperties = {
color: properties.color,
lightID: properties.lightID,
easing: properties.easing,
lerpType: properties.lerpType
}
event.customData = newProperties
}
})
}
}
/**
* Returns all of the data of the light event on the given beat.
* @param {number} beat - What beat is the light event located at?
*/
export function getLightEvent(beat) {
if (diffJSON && beat || diffJSON && beat == 0) {
const result = diffJSON.basicBeatmapEvents.find(event => event.b === beat)
return diffJSON.basicBeatmapEvents.find(event => event.b === beat)
}
}
/**
* Returns all of the data of the light event on the given beat.
* @param {number} beat - What beat is the light event located at?
*/
export function getLightEventInBetween(beat1, beat2) {
const events = []
if (diffJSON && beat1 && beat2 || diffJSON && beat1 == 0 && beat2) {
diffJSON.basicBeatmapEvents.forEach((event) => {
if (event.b >= beat1 && event.b <= beat2) {
events.push(event)
}
})
return events
}
}
// --- GEOMETRY ---
/**
* @typedef {Object} materialProperties
* @property {String} name - What is the name of this material?
* @property {Array<number>} color - What color should the material have? This color will be the color of your geometry object.
* @property {string} track - What track should be assigned to the material? You can use the track to animate the color later on.
* @property {"Standard"|"Glowing"|"OpaqueLight"|"TransparentLight"|"BaseWater"|"BTSPillar"|"BillieWater"|"WaterfallMirror"|"InterscopeConcrete"|"InterscopeCar"} shader - What shader should the material have?
*/
/**
* Adds a material to the material that you can use on a geometry object. Geometry objects REQUIRE a material.
* @param {materialProperties} properties - What properties should the material have?
*/
export function addMaterial(properties) {
if (diffJSON && properties) {
diffJSON.customData.materials[properties.name] = {
color: properties.color,
shader: properties.shader,
track: properties.track
}
}
}
/**
* @typedef {object} geometryProperties
* @property {number} [id] - What ID should be assigned to the object?
* @property {number} [duplicate] - How many duplicates should be made? Don't defind to modify the original.
* @property {LookupMethod} [lookupMethod] - How should the game search for the object?
* @property {track} [track] - What track should be assigned to the object?
* @property {Array<number>} [position] - Where should the object be positioned?
* @property {Array<number>} [rotation] - How should the object be rotated?
* @property {Array<number>} [localPosition] - How should the object be positioned relative to its set position?
* @property {Array<number>} [localRotation] - How should the object be rotated relative to its set rotation?
* @property {Array<number>} [scale] - How big should the material be?
* @property {{
* type: string
* material: {
* color: Array<number>
* shader: string
* }
* }} geometry - Defind the shape and set the material of the object. Shapes: Sphere, Capsule, Plane, Cylinder, Cube, Quad, Triangle.
* @property {{
* ILightWithId: {
* lightID: number
* type: number
* }
* }} components - Set the lighting stuff (WIP)
*/
/**
* Make a new geometry object.
* @param {geometryProperties} properties - What properties does the object have?
*/
export function addGeometry(properties) {
if (diffJSON && properties) {
let newProperties = {
id: properties.id,
lookupMethod: properties.lookupMethod,
components: properties.components,
duplicate: properties.duplicate,
geometry: properties.geometry,
position: properties.position,
track: properties.track,
rotation: properties.rotation,
localPosition: properties.localPosition,
localRotation: properties.localRotation,
scale: properties.scale
}
diffJSON.customData.environment.push(newProperties)
}
}
// --- BLENDER ---
/**
* @typedef {Object} blenderMaterialProperties
* @property {"Standard"|"Glowing"|"OpaqueLight"|"TransparentLight"|"BaseWater"|"BTSPillar"|"BillieWater"|"WaterfallMirror"|"InterscopeConcrete"|"InterscopeCar"} shader - What shader should the model have?
* @property {Array<number>} color - What color is the material?
*/
/**
* @typedef {Object} rmmodelProperties
* @property {Array<number>} position
* @property {Array<number>} rotation
* @property {Array<number>} scale
* @property {string} track
* @property {blenderMaterialProperties} material
*/
let takenModelNumberTracks = []
/**
* Used to import blender stuff in beat saber
* @param {number} beat - At what beat should the model be loaded in?
* @param {number} endBeat - At what beat should the model be unloaded?
* @param {any} rmmodelName - Name of the file. <YOUR_FILE_NAME>.rmmodel
* @param {rmmodelProperties} properties - Some properties you can set.
*/
export function blenderImport(beat, endBeat, rmmodelName, properties) {
if (diffJSON && fileExists(rmmodelName)) {
let t = 0
while (takenModelNumberTracks.includes(t)) {
t++;
}
const data = fs.readFileSync(rmmodelName, "utf-8")
const rmmodelJSON = JSON.parse(data)
if (rmmodelJSON.objects) {
const underWorld = 999999999
rmmodelJSON.objects.forEach((object) => {
if (!properties.position) {
properties.position = [0, -underWorld, 0]
} else {
properties.position[0] = properties.position[0]
properties.position[1] = properties.position[1] - underWorld
properties.position[2] = properties.position[2]
}
if (!properties.rotation) {
properties.rotation = [0, 0, 0]
}
if (!properties.scale) {
properties.scale = [1, 1, 1]
}
if (!properties.material) {
properties.material = {
material: {
color: [0, 1, 0, 0.5],
shader: "Standard" // TransparentLight, Standard??
}
}
}
const finalPos = object.position.map((v, i) => v + properties.position[i])
addGeometry({
geometry: {
type: "Cube",
material: properties.material
},
position: object.position.map((v, i) => v + properties.position[i]),
rotation: object.rotation.map((v, i) => v + properties.rotation[i]),
scale: object.scale.map((v, i) => v + properties.scale[i]),
track: `[${t}]ModMapperObjectTrack`
})
animateTrack({
track: `[${t}]ModMapperObjectTrack`,
duration: 1,
beat: beat,
animation: {
position: [
[finalPos[0], finalPos[1] + underWorld, finalPos[2], 0]
]
}
})
animateTrack({
track: `[${t}]ModMapperObjectTrack`,
duration: 1,
beat: endBeat,
animation: {
position: [
[finalPos[0], finalPos[1], finalPos[2], 0]
]
}
})
takenModelNumberTracks.push(t)
t++;
})
}
}
}
// --- TOOLS ---
/**
* Used to calculate the amount of events you need to stop at the end beat
* @param {number} beat - Starting beat
* @param {number} step Step between beats
* @param {number} endBeat Ending beat
* @returns The calculated amount of events you need to stop at the end beat
*/
export function calculateAmount(beat, step, endBeat) {
if (beat || beat == 0) {
if (step, endBeat) {
return (endBeat - beat) / step
}
}
}
export function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min
}
// --- WRITING TO FILE ---
/**
* Writes the custom data to the file you have set with modmapper.setDifficulty. Also writes the custom information to info.dat.
*/
export function writeToFile() {
if (diffJSON) {
console.log(colors.yellow, `[WARNING] writing to ${difficulty}...`, colors.reset)
fs.writeFileSync(
difficulty,
JSON.stringify(diffJSON, null, 4)
);
if (nameOfInfo) {
console.log(colors.yellow, `[WARNING] writing to ${nameOfInfo}...`, colors.reset)
fs.writeFileSync(
nameOfInfo,
JSON.stringify(infoJSON, null, 4)
);
console.log(colors.green, `[OK] Succesfully written to ${nameOfInfo}`, colors.reset)
}
console.log(colors.green, `[OK] Succesfully written to ${difficulty}`, colors.reset)
}
else {
console.log(colors.red, `[ERROR] Error writing to ${difficulty}, did you set the correct difficulty name?`, colors.reset)
return
}
}