Skip to content

Commit

Permalink
Add Name as a potential value for target bars
Browse files Browse the repository at this point in the history
  • Loading branch information
quisquous committed Sep 11, 2021
1 parent 45d61da commit ef64cd2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions OverlayPlugin.Core/resources/targetbars/targetbars.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const helpText = {
const textOptionsAll = {
English: {
'None': 'None',
'Name': 'Name',
'Current HP': 'CurrentHP',
'Max HP': 'MaxHP',
'Current / Max HP': 'CurrentAndMaxHP',
Expand All @@ -60,6 +61,7 @@ const textOptionsAll = {
},
Chinese: {
'不显示': 'None',
'名称': 'Name',
'当前体力值': 'CurrentHP',
'最大体力值': 'MaxHP',
'当前体力值/最大体力值': 'CurrentAndMaxHP',
Expand All @@ -72,6 +74,7 @@ const textOptionsAll = {
},
German: {
'None': 'None',
'Name': 'Name',
'Aktuelle HP': 'CurrentHP',
'Maximale HP': 'MaxHP',
'Aktuelle / Maximale HP': 'CurrentAndMaxHP',
Expand All @@ -89,13 +92,14 @@ const overlayDataKey = 'targetbars';
const targets = ['Target', 'Focus', 'Hover', 'TargetOfTarget'];

// Values that come directly from a target object.
const rawKeys = ['CurrentHP', 'MaxHP', 'Distance', 'EffectiveDistance'];
const rawStringKeys = ['Name'];
const rawNumberKeys = ['CurrentHP', 'MaxHP', 'Distance', 'EffectiveDistance'];
// Values that need to be calculated.
const otherKeys = ['PercentHP', 'CurrentAndMaxHP', 'TimeToDeath'];
// Values that only exist for the current Target.
const targetOnlyKeys = ['AbsoluteEnmity', 'RelativeEnmity'];

const validKeys = ['None', ...rawKeys, ...otherKeys, ...targetOnlyKeys];
const validKeys = ['None', ...rawStringKeys, ...rawNumberKeys, ...otherKeys, ...targetOnlyKeys];

// Remove enmity from non-target keys.
const textOptionsNonTarget = (() => {
Expand Down Expand Up @@ -128,6 +132,7 @@ const FormatType = {
};

const formatOptionsByKey = {
Name: {},
CurrentHP: {
maximumFractionDigits: 0,
},
Expand Down Expand Up @@ -555,7 +560,14 @@ class BarUI {
return;
}

for (const key of rawKeys) {
for (const key of rawStringKeys) {
if (data[key] === this.lastData[key])
continue;
this.setValue(key, data[key]);
}


for (const key of rawNumberKeys) {
if (data[key] === this.lastData[key])
continue;

Expand Down

0 comments on commit ef64cd2

Please sign in to comment.