Skip to content

Commit

Permalink
More indents and whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
djc5166 committed Jul 27, 2023
1 parent 66b82de commit 5741d0a
Show file tree
Hide file tree
Showing 5 changed files with 642 additions and 687 deletions.
217 changes: 101 additions & 116 deletions raidboss/06-ew/dragonsongs_reprise_ultimate.js
Original file line number Diff line number Diff line change
@@ -1,133 +1,118 @@
const diveFromGraceStrings =
{
allCircles:
{
en: '#${num} All Circles'
},
hasArrows:
{
en: '#${num} Has Arrows'
},
const diveFromGraceStrings = {
allCircles: {
en: '#${num} All Circles'
},
hasArrows: {
en: '#${num} Has Arrows'
},
};

const enumStrings =
{
cloneDirStr:
{
en: 'Clone ${dir}',
},
dirN: Outputs.north,
dirNE: Outputs.northeast,
dirE: Outputs.east,
dirSE: Outputs.southeast,
dirS: Outputs.south,
dirSW: Outputs.southwest,
dirW: Outputs.west,
dirNW: Outputs.northwest,
unknown: Outputs.unknown,
const enumStrings = {
cloneDirStr: {
en: 'Clone ${dir}',
},
dirN: Outputs.north,
dirNE: Outputs.northeast,
dirE: Outputs.east,
dirSE: Outputs.southeast,
dirS: Outputs.south,
dirSW: Outputs.southwest,
dirW: Outputs.west,
dirNW: Outputs.northwest,
unknown: Outputs.unknown,
};

Options.Triggers.push(
{
id: 'DragonsongsRepriseUltimate-USER',
zoneId: ZoneId.DragonsongsRepriseUltimate,
timelineTriggers: [
id: 'DragonsongsRepriseUltimate-USER',
zoneId: ZoneId.DragonsongsRepriseUltimate,
timelineTriggers: [
{
id: 'P6 Caster LB3',
regex: /Great Wyrmsbreath/,
beforeSeconds: 23,
suppressSeconds: 9999,
infoText: (_data, _matches, output) => output.text(),
outputStrings:
{
text:
{
en: 'Caster LB',
},
id: 'P6 Caster LB3',
regex: /Great Wyrmsbreath/,
beforeSeconds: 23,
suppressSeconds: 9999,
infoText: (_data, _matches, output) => output.text(),
outputStrings: {
text: {
en: 'Caster LB',
},
},
},],
triggers: [
triggers: [
{
id: 'DSR Dive From Grace 1',
type: 'GainsEffect',
netRegex: NetRegexes.gainsEffect( { effectId: ['AC3', 'AC4', 'AC5'] } ),
delaySeconds: 0.5,
suppressSeconds: 9999,
alertText: ( data, _matches, output ) =>
{
if ( !data.diveFromGraceHasArrow[1] )
return output.allCircles( { num: 1 } );
else
return output.hasArrows( { num: 1 } );
},
outputStrings: diveFromGraceStrings,
id: 'DSR Dive From Grace 1',
type: 'GainsEffect',
netRegex: NetRegexes.gainsEffect({ effectId: ['AC3', 'AC4', 'AC5'] }),
delaySeconds: 0.5,
suppressSeconds: 9999,
alertText: (data, _matches, output) => {
if (!data.diveFromGraceHasArrow[1])
return output.allCircles({ num: 1 });
else
return output.hasArrows({ num: 1 });
},
outputStrings: diveFromGraceStrings,
},
{
id: 'DSR Dive From Grace 3',
type: 'GainsEffect',
netRegex: NetRegexes.gainsEffect( { effectId: ['AC3', 'AC4', 'AC5'] } ),
delaySeconds: 10,
suppressSeconds: 9999,
alertText: ( data, _matches, output ) =>
{
if ( !data.diveFromGraceHasArrow[3] )
return output.allCircles( { num: 3 } );
else
return output.hasArrows( { num: 3 } );
},
outputStrings: diveFromGraceStrings,
id: 'DSR Dive From Grace 3',
type: 'GainsEffect',
netRegex: NetRegexes.gainsEffect({ effectId: ['AC3', 'AC4', 'AC5'] }),
delaySeconds: 10,
suppressSeconds: 9999,
alertText: (data, _matches, output) => {
if (!data.diveFromGraceHasArrow[3])
return output.allCircles({ num: 3 });
else
return output.hasArrows({ num: 3 });
},
outputStrings: diveFromGraceStrings,
},
{
id: 'DSR Enum Clone Tether',
type: 'Tether',
netRegex: NetRegexes.tether( { id: '0054', source: 'Nidhogg' } ),
condition: ( data, matches ) => !data.cloneFound,
promise: async ( data, matches ) =>
{
const result = await callOverlayHandler({
call: 'getCombatants',
ids: [parseInt(matches.sourceId, 16)],
});
const thisClone = result.combatants[0];
if ( !thisClone )
{
console.error( `DSR Enum: null data` );
return;
}
id: 'DSR Enum Clone Tether',
type: 'Tether',
netRegex: NetRegexes.tether({ id: '0054', source: 'Nidhogg' }),
condition: (data, _matches) => !data.cloneFound,
promise: async (data, matches) => {
const result = await callOverlayHandler({
call: 'getCombatants',
ids: [parseInt(matches.sourceId, 16)],
});

if ( thisClone.CurrentHP == thisClone.MaxHP )
{
data.cloneFound = true;
data.enumClone = thisClone;
}
},
response: ( data, matches, output ) =>
{
if ( !data.cloneFound )
{
return;
}
const thisClone = result.combatants[0];
if (!thisClone) {
console.error(`DSR Enum: null data`);
return;
}

const centerX = 100;
const centerY = 100;
const x = data.enumClone.PosX - centerX;
const y = data.enumClone.PosY - centerY;
// Dirs: N = 0, NE = 1, ..., NW = 7
const cloneDir = Math.round(4 - 4 * Math.atan2(x, y) / Math.PI) % 8;

const dirStr =
{
0: output.dirN(),
1: output.dirNE(),
2: output.dirE(),
3: output.dirSE(),
4: output.dirS(),
5: output.dirSW(),
6: output.dirW(),
7: output.dirNW(),
}[cloneDir] ?? output.unknown();
return { alertText: output.cloneDirStr( { dir: dirStr } ) };
},
outputStrings: enumStrings,
if (thisClone.CurrentHP == thisClone.MaxHP) {
data.cloneFound = true;
data.enumClone = thisClone;
}
},
response: (data, _matches, output) => {
if (!data.cloneFound) {
return;
}
const centerX = 100;
const centerY = 100;
const x = data.enumClone.PosX - centerX;
const y = data.enumClone.PosY - centerY;
// Dirs: N = 0, NE = 1, ..., NW = 7
const cloneDir = Math.round(4 - 4 * Math.atan2(x, y) / Math.PI) % 8;
const dirStr = {
0: output.dirN(),
1: output.dirNE(),
2: output.dirE(),
3: output.dirSE(),
4: output.dirS(),
5: output.dirSW(),
6: output.dirW(),
7: output.dirNW(),
}[cloneDir] ?? output.unknown();
return { alertText: output.cloneDirStr({ dir: dirStr }) };
},
outputStrings: enumStrings,
},],
});
});

3 changes: 2 additions & 1 deletion raidboss/06-ew/p12s.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,4 +519,5 @@ Options.Triggers.push(
},
},],
}
);
);

70 changes: 36 additions & 34 deletions raidboss/06-ew/p2s.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
const harmaMarkers = [
'0095',
'0098',
'0095',
'0098',
];

Options.Triggers.push(
{
id: 'AsphodelosTheSecondCircleSavage-USER',
zoneId: ZoneId.AsphodelosTheSecondCircleSavage,
triggers: [
{
id: 'AsphodelosTheSecondCircleSavage-USER',
zoneId: ZoneId.AsphodelosTheSecondCircleSavage,
triggers: [
{
id: 'P2S Kampeos Harma Marker Collect',
type: 'HeadMarker',
netRegex: NetRegexes.headMarker(),
condition: (data, matches) => { return harmaMarkers.includes( (parseInt(matches.id, 16) - data.decOffset).toString(16).toUpperCase().padStart(4, '0')); },
run: (data, matches) => (data.marks ??= []).push(matches),
},
{
id: 'P2S Kampeos Harma Marker',
type: 'HeadMarker',
netRegex: NetRegexes.headMarker({capture: false}),
delaySeconds: (data) => data.marks?.length >= 2 ? 0 : 0.5,
response: (data, matches, output) =>
{
output.responseOutputStrings = {
marks: {
en: 'Marks: ${player1}, ${player2}',
},
unknown: Outputs.unknown
};
id: 'P2S Kampeos Harma Marker Collect',
type: 'HeadMarker',
netRegex: NetRegexes.headMarker(),
condition: (data, matches) => { return harmaMarkers.includes((parseInt(matches.id, 16) - data.decOffset).toString(16).toUpperCase().padStart(4, '0')); },
run: (data, matches) => (data.marks ??= []).push(matches),
},
{
id: 'P2S Kampeos Harma Marker',
type: 'HeadMarker',
netRegex: NetRegexes.headMarker({ capture: false }),
delaySeconds: (data) => data.marks?.length >= 2 ? 0 : 0.5,
response: (data, _matches, output) => {
output.responseOutputStrings = {
marks: {
en: 'Marks: ${player1}, ${player2}',
},
unknown: Outputs.unknown
};

if (data.marks === undefined)
return;
if (data.marks === undefined)
return;

const markText = output.marks({ player1: data.ShortName(data.marks[0].target), player2: data.ShortName(data.marks[1].target) });
return { infoText: markText,
tts: markText };
},
run: (data) => delete data.marks
},],
}
const markText = output.marks({ player1: data.ShortName(data.marks[0].target),
player2: data.ShortName(data.marks[1].target) });
return {
infoText: markText,
tts: markText
};
},
run: (data) => delete data.marks
},],
}
);

Loading

0 comments on commit 5741d0a

Please sign in to comment.