Skip to content

Commit

Permalink
jobs: SMN DT changes (OverlayPlugin#241)
Browse files Browse the repository at this point in the history
- Update SMN job memory
- Update Solar Bahamut support 
(not tested due to SMN haven't reach lv100)

---------

Co-authored-by: Maiko Tan <[email protected]>
  • Loading branch information
Echoring and MaikoTan authored Jul 17, 2024
1 parent 5c2b102 commit 026bba3
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 29 deletions.
95 changes: 70 additions & 25 deletions plugin/CactbotEventSource/FFXIVProcessIntl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -570,58 +570,103 @@ public struct ArcanistJobMemory {

[StructLayout(LayoutKind.Explicit)]
public struct SummonerJobMemory {
public enum ActiveArcanum : byte {
None = 0,
Ifrit = 1,
Titan = 2,
Garuda = 3,
}

[Flags]
public enum Stance : byte {
None = 0,
// 0-1 bits: AetherFlows
AetherFlow1 = 1 << 0,
AetherFlow2 = 1 << 1,
AetherFlow3 = AetherFlow1 | AetherFlow2,
// 2 bit: Phoenix Ready
Phoenix = 1 << 2,
// 3 bit: Solar Bahamut Ready
// FIXME: guessed, not tested
SolarBahamut = 1 << 3,
// 4 bit: Unknown
// 5-7 bits: Usable Arcanum
Ruby = 1 << 5, // Fire/Ifrit
Topaz = 1 << 6, // Earth/Titan
Emerald = 1 << 7, // Wind/Garuda
}

[FieldOffset(0x00)]
public ushort tranceMilliseconds;

[FieldOffset(0x02)]
public ushort attunementMilliseconds;

/// <summary>
/// 0x04: 0x17 = Summoned other than Carbuncle, 0x00 = Other Condition
/// </summary>
[NonSerialized]
[FieldOffset(0x04)]
private byte _summonStatus;

/// <summary>
/// (From right to left)
/// 1-2 bits: Active Primal
/// 3-5 bits: Counts of Attunement Stacks
[NonSerialized]
[FieldOffset(0x06)]
public byte attunement;
private byte _attunement;

[NonSerialized]
[FieldOffset(0x07)]
private byte stance;
private Stance stance;

public string[] usableArcanum {
public bool summonStatus {
get {
var arcanums = new List<string>();
if ((stance & 0x20) != 0)
arcanums.Add("Ruby"); // Fire/Ifrit
if ((stance & 0x40) != 0)
arcanums.Add("Topaz"); // Earth/Titan
if ((stance & 0x80) != 0)
arcanums.Add("Emerald"); // Wind/Garuda
return _summonStatus != 0;
}
}

return arcanums.ToArray();
public int attunement {
get {
return (_attunement >> 2) & 0x7; // = 0b111, to get the last 3 bits.
}
}

public string activePrimal {
get {
if ((stance & 0xC) == 0x4)
return "Ifrit";
else if ((stance & 0xC) == 0x8)
return "Titan";
else if ((stance & 0xC) == 0xC)
return "Garuda";
else
return null;
return ((ActiveArcanum)(_attunement & 0x3)).ToString();
}
}

public String nextSummoned {
public string[] usableArcanum {
get {
if ((stance & 0x10) == 0)
return "Bahamut";
else
return "Phoenix";
var arcanums = new List<string>();
foreach (var flag in new List<Stance> { Stance.Ruby, Stance.Topaz, Stance.Emerald }) {
if (stance.HasFlag(flag))
arcanums.Add(flag.ToString());
}

return arcanums.ToArray();
}
}

public string nextSummoned {
get {
foreach (var flag in new List<Stance> { Stance.SolarBahamut, Stance.Phoenix }) {
if (stance.HasFlag(flag))
return flag.ToString();
}
return "Bahamut";
}
}

public int aetherflowStacks {
get {
return stance & 0x3;
return stance.HasFlag(Stance.AetherFlow3) ? 3 :
stance.HasFlag(Stance.AetherFlow2) ? 2 :
stance.HasFlag(Stance.AetherFlow1) ? 1 :
0;
}
}
};
Expand Down
3 changes: 2 additions & 1 deletion types/event.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ export interface JobDetail {
attunement: number;
usableArcanum: ('Ruby' | 'Topaz' | 'Emerald')[];
activePrimal: 'Ifrit' | 'Titan' | 'Garuda' | null;
nextSummoned: 'Bahamut' | 'Phoenix';
nextSummoned: 'Bahamut' | 'Phoenix' | 'SolarBahamut';
summonStatus: boolean;
};
'RDM': {
whiteMana: number;
Expand Down
14 changes: 13 additions & 1 deletion ui/jobs/components/smn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class SMNComponent extends BaseComponent {
}

this.reset();
this.onStatChange({ gcdSpell: this.player.gcdSpell });
}

private _addActiveOnStacks(elements: HTMLDivElement[], stacks: number) {
Expand Down Expand Up @@ -106,6 +107,10 @@ export class SMNComponent extends BaseComponent {
'firebirdready',
jobDetail.nextSummoned === 'Phoenix',
);
this.demiSummoningBox.parentNode.classList.toggle(
'solarbahamutready',
jobDetail.nextSummoned === 'SolarBahamut',
);
this.demiSummoningBox.parentNode.classList.toggle(
'garuda',
jobDetail.activePrimal === 'Garuda',
Expand All @@ -114,11 +119,17 @@ export class SMNComponent extends BaseComponent {
this.demiSummoningBox.parentNode.classList.toggle('ifrit', jobDetail.activePrimal === 'Ifrit');

this.tranceBox.fg = computeBackgroundColorFrom(this.tranceBox, 'smn-color-trance');
if (jobDetail.nextSummoned === 'Phoenix')
if (jobDetail.nextSummoned === 'Phoenix') {
this.tranceBox.fg = computeBackgroundColorFrom(
this.tranceBox,
'smn-color-demisummon.firebirdready',
);
} else if (jobDetail.nextSummoned === 'SolarBahamut') {
this.tranceBox.fg = computeBackgroundColorFrom(
this.tranceBox,
'smn-color-demisummon.solarbahamutready',
);
}

// Arcanum and Attunement Guage
this._addActiveOnStacks(
Expand Down Expand Up @@ -156,6 +167,7 @@ export class SMNComponent extends BaseComponent {
case kAbility.EnergySiphon:
this.energyDrainBox.duration = 60;
break;
case kAbility.SummonSolarBahamut:
case kAbility.SummonBahamut:
case kAbility.SummonPhoenix:
case kAbility.Aethercharge:
Expand Down
1 change: 1 addition & 0 deletions ui/jobs/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export const kAbility = {
DreadwyrmTrance: 'DFD',
SummonBahamut: '1D03',
SummonPhoenix: '64E7',
SummonSolarBahamut: '9080',
// RDM
Verstone: '1D57',
Verfire: '1D56',
Expand Down
3 changes: 2 additions & 1 deletion ui/jobs/jobs.css
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,8 @@ div.justbuffs div#procs-container {
background-color: rgb(60 80 200);
}

.smn-color-demisummon {
.smn-color-demisummon,
.smn-color-demisummon.solarbahamutready {
background-color: rgb(180 200 220);
}

Expand Down
4 changes: 3 additions & 1 deletion ui/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ addOverlayListener('onPlayerChangedEvent', (e) => {
`${detail.jobDetail.aetherflowStacks} | ${detail.jobDetail.tranceMilliseconds} | ${detail.jobDetail.attunement} | ${detail.jobDetail.attunementMilliseconds} | ${
detail
.jobDetail.activePrimal ?? '-'
} | [${detail.jobDetail.usableArcanum.join(', ')}] | ${detail.jobDetail.nextSummoned}`;
} | [${
detail.jobDetail.usableArcanum.join(', ')
}] | ${detail.jobDetail.nextSummoned} | ${detail.jobDetail.summonStatus.toString()}`;
} else if (detail.job === 'SCH' && detail.jobDetail) {
jobInfo.innerText =
`${detail.jobDetail.aetherflowStacks} | ${detail.jobDetail.fairyGauge} | ${detail.jobDetail.fairyStatus} (${detail.jobDetail.fairyMilliseconds})`;
Expand Down

0 comments on commit 026bba3

Please sign in to comment.