From 745f5e4f5ca27cb0479695a069e8e89a8f8625a6 Mon Sep 17 00:00:00 2001 From: Adrienne Walker Date: Sat, 1 Aug 2020 10:44:47 -0700 Subject: [PATCH] Remove IntlZoneNames in favor of content types This is part of #1037. --- resources/translations.js | 33 ----------------------------- ui/dps/dps_common.js | 27 ++++++----------------- ui/dps/rdmty/dps.html | 4 +++- ui/dps/xephero/xephero-cactbot.html | 4 +++- ui/jobs/jobs.html | 2 ++ ui/jobs/jobs.js | 24 +++++++++++---------- ui/oopsyraidsy/oopsyraidsy.html | 4 +++- ui/oopsyraidsy/oopsyraidsy.js | 25 +++++++++------------- 8 files changed, 41 insertions(+), 82 deletions(-) diff --git a/resources/translations.js b/resources/translations.js index b577f6f0ff..b1b3a2907e 100644 --- a/resources/translations.js +++ b/resources/translations.js @@ -1,38 +1,5 @@ 'use strict'; -// TODO: remove this in favor of using resources/content_type.js -const IntlZoneNames = { - O1S: /Deltascape V1\.0 \(Savage\)/, - O2S: /Deltascape V2\.0 \(Savage\)/, - O3S: /Deltascape V3\.0 \(Savage\)/, - O4S: /Deltascape V4\.0 \(Savage\)/, - UCU: /The Unending Coil Of Bahamut \(Ultimate\)/, - O5S: /Sigmascape V1\.0 \(Savage\)/, - O6S: /Sigmascape V2\.0 \(Savage\)/, - O7S: /Sigmascape V3\.0 \(Savage\)/, - O8S: /Sigmascape V4\.0 \(Savage\)/, - UWU: /The Weapon's Refrain \(Ultimate\)/, - O9S: /Alphascape V1\.0 \(Savage\)/, - O10S: /Alphascape V2\.0 \(Savage\)/, - O11S: /Alphascape V3\.0 \(Savage\)/, - O12S: /Alphascape V4\.0 \(Savage\)/, - E1S: /Eden's Gate: Resurrection \(Savage\)/, - E2S: /Eden's Gate: Descent \(Savage\)/, - E3S: /Eden's Gate: Inundation \(Savage\)/, - E4S: /Eden's Gate: Sepulture \(Savage\)/, - E5S: /Eden's Verse: Fulmination \(Savage\)/, - E6S: /Eden's Verse: Furor \(Savage\)/, - E7S: /Eden's Verse: Iconoclasm \(Savage\)/, - E8S: /Eden's Verse: Refulgence \(Savage\)/, - PvpSeize: /Seal Rock \(Seize\)/, - PvpSecure: /The Borderland Ruins \(Secure\)/, - PvpShatter: /The Fields Of Glory \(Shatter\)/, - EurekaAnemos: /Eureka Anemos/, - EurekaPagos: /(Eureka Pagos|Unknown Zone \(2Fb\))/, - EurekaPyros: /(Eureka Pyros|Unknown Zone \(31B\))/, - EurekaHydatos: /(Eureka Hydatos|Unknown Zone \(33B\))/, -}; - let LocaleRegex = {}; let LocaleNetRegex = {}; diff --git a/ui/dps/dps_common.js b/ui/dps/dps_common.js index 326f7440a9..aa8d3b46c7 100644 --- a/ui/dps/dps_common.js +++ b/ui/dps/dps_common.js @@ -2,14 +2,9 @@ let Options = { Language: 'en', - IgnoreZones: [ - 'PvpSeize', - 'PvpSecure', - 'PvpShatter', - 'EurekaAnemos', - 'EurekaPagos', - 'EurekaPyros', - 'EurekaHydatos', + IgnoreContentTypes: [ + ContentType.Pvp, + ContentType.Eureka, ], }; @@ -17,7 +12,6 @@ let gIgnoreCurrentZone = false; let gIgnoreCurrentJob = false; let gCurrentJob = null; let gCurrentZone = null; -let gIgnoreZones = []; let gInCombat = false; function InitDpsModule(updateFunc, hideFunc) { @@ -48,13 +42,10 @@ function InitDpsModule(updateFunc, hideFunc) { // Always hide on switching zones. hideFunc(); gCurrentZone = newZone; - gIgnoreCurrentZone = false; - for (let i = 0; i < gIgnoreZones.length; ++i) { - if (gCurrentZone.match(gIgnoreZones[i])) { - gIgnoreCurrentZone = true; - return; - } - } + + const zoneInfo = ZoneInfo[e.zoneID]; + const contentType = zoneInfo ? zoneInfo.contentType : 0; + gIgnoreCurrentZone = Options.IgnoreContentTypes.includes(contentType); }); addOverlayListener('onInCombatChangedEvent', function(e) { @@ -73,8 +64,4 @@ function InitDpsModule(updateFunc, hideFunc) { gIgnoreCurrentJob = true; hideFunc(); }); - - gIgnoreZones = Options.IgnoreZones.map(function(z) { - return IntlZoneNames[z]; - }); } diff --git a/ui/dps/rdmty/dps.html b/ui/dps/rdmty/dps.html index 7b2477a73a..c7864d4859 100644 --- a/ui/dps/rdmty/dps.html +++ b/ui/dps/rdmty/dps.html @@ -5,12 +5,14 @@ + + + - diff --git a/ui/dps/xephero/xephero-cactbot.html b/ui/dps/xephero/xephero-cactbot.html index be3cc288dd..a33a3a6918 100644 --- a/ui/dps/xephero/xephero-cactbot.html +++ b/ui/dps/xephero/xephero-cactbot.html @@ -8,12 +8,14 @@ + + + - diff --git a/ui/jobs/jobs.html b/ui/jobs/jobs.html index 0dfd728d52..b256fb7d8f 100644 --- a/ui/jobs/jobs.html +++ b/ui/jobs/jobs.html @@ -5,6 +5,7 @@ + @@ -16,6 +17,7 @@ + diff --git a/ui/jobs/jobs.js b/ui/jobs/jobs.js index a1a8c55220..7b4a13a502 100644 --- a/ui/jobs/jobs.js +++ b/ui/jobs/jobs.js @@ -2,10 +2,12 @@ // See user/jobs-example.js for documentation. let Options = { - WellFedZones: [ - 'O1S', 'O2S', 'O3S', 'O4S', 'O5S', 'O6S', 'O7S', 'O8S', 'O9S', 'O10S', 'O11S', 'O12S', 'UCU', 'UWU', - 'E1S', 'E2S', 'E3S', 'E4S', 'E5S', 'E6S', 'E7S', 'E8S', + WellFedContentTypes: [ + ContentType.Trials, + ContentType.Raids, + ContentType.UltimateRaids, ], + ShowHPNumber: ['PLD', 'WAR', 'DRK', 'GNB', 'BLU'], ShowMPNumber: ['PLD', 'DRK', 'BLM', 'AST', 'WHM', 'SCH', 'BLU'], @@ -144,7 +146,6 @@ const kMPTickInterval = 3.0; // Regexes to be filled out once we know the player's name. let kComboBreakers = null; -let kWellFedZoneRegex = null; let kYouGainEffectRegex = null; let kYouLoseEffectRegex = null; @@ -314,10 +315,6 @@ function setupComboTracker(callback) { } function setupRegexes(playerName) { - kWellFedZoneRegex = Regexes.anyOf(Options.WellFedZones.map(function(x) { - return IntlZoneNames[x]; - })); - kYouGainEffectRegex = NetRegexes.gainsEffect({ target: playerName }); kYouLoseEffectRegex = NetRegexes.losesEffect({ target: playerName }); kYouUseAbilityRegex = NetRegexes.ability({ source: playerName }); @@ -1060,6 +1057,8 @@ class Bars { this.statChangeFuncMap = {}; this.abilityFuncMap = {}; + this.contentType = 0; + const lang = this.options.ParserLanguage; this.countdownStartRegex = LocaleRegex.countdownStart[lang] || LocaleRegex.countdownStart['en']; this.countdownCancelRegex = LocaleRegex.countdownCancel[lang] || LocaleRegex.countdownCancel['en']; @@ -2344,7 +2343,7 @@ class Bars { UpdateFoodBuff() { // Non-combat jobs don't set up the left buffs list. - if (!this.init || !this.o.leftBuffsList || !this.zone) + if (!this.init || !this.o.leftBuffsList) return; let CanShowWellFedWarning = function() { @@ -2354,7 +2353,8 @@ class Bars { return false; if (this.level < this.options.MaxLevel) return true; - return this.zone.search(kWellFedZoneRegex) >= 0; + + return this.options.WellFedContentTypes.includes(this.contentType); }; // Returns the number of ms until it should be shown. If <= 0, show it. @@ -2408,7 +2408,9 @@ class Bars { } OnChangeZone(e) { - this.zone = e.zoneName; + const zoneInfo = ZoneInfo[e.zoneID]; + this.contentType = zoneInfo ? zoneInfo.contentType : 0; + this.UpdateFoodBuff(); if (this.buffTracker) this.buffTracker.clear(); diff --git a/ui/oopsyraidsy/oopsyraidsy.html b/ui/oopsyraidsy/oopsyraidsy.html index f84e308853..951b94bfaf 100644 --- a/ui/oopsyraidsy/oopsyraidsy.html +++ b/ui/oopsyraidsy/oopsyraidsy.html @@ -5,13 +5,15 @@ - + + + diff --git a/ui/oopsyraidsy/oopsyraidsy.js b/ui/oopsyraidsy/oopsyraidsy.js index da6eea336e..7cfd81de06 100644 --- a/ui/oopsyraidsy/oopsyraidsy.js +++ b/ui/oopsyraidsy/oopsyraidsy.js @@ -4,14 +4,9 @@ let Options = { Triggers: [], PlayerNicks: {}, DisabledTriggers: {}, - IgnoreZones: [ - 'PvpSeize', - 'PvpSecure', - 'PvpShatter', - 'EurekaAnemos', - 'EurekaPagos', - 'EurekaPyros', - 'EurekaHydatos', + IgnoreContentTypes: [ + ContentType.Pvp, + ContentType.Eureka, ], AbilityIdNameMap: { @@ -958,6 +953,10 @@ class DamageTracker { OnChangeZone(e) { this.zoneName = e.zoneName; + + const zoneInfo = ZoneInfo[e.zoneID]; + this.contentType = zoneInfo ? zoneInfo.contentType : 0; + this.ReloadTriggers(); } @@ -1039,13 +1038,9 @@ class DamageTracker { this.healTriggers = []; this.netTriggers = []; - this.ignoreZone = false; - for (let i = 0; i < Options.IgnoreZones.length; ++i) { - if (this.zoneName.match(IntlZoneNames[Options.IgnoreZones[i]])) { - this.ignoreZone = true; - return; - } - } + this.ignoreZone = Options.IgnoreContentTypes.includes(this.contentType); + if (this.ignoreZone) + return; for (let i = 0; i < this.triggerSets.length; ++i) { let set = this.triggerSets[i];