Skip to content

Commit

Permalink
Remove IntlZoneNames in favor of content types
Browse files Browse the repository at this point in the history
This is part of #1037.
  • Loading branch information
quisquous committed Aug 1, 2020
1 parent c4b13ad commit 745f5e4
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 82 deletions.
33 changes: 0 additions & 33 deletions resources/translations.js
Original file line number Diff line number Diff line change
@@ -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 = {};

Expand Down
27 changes: 7 additions & 20 deletions ui/dps/dps_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,16 @@

let Options = {
Language: 'en',
IgnoreZones: [
'PvpSeize',
'PvpSecure',
'PvpShatter',
'EurekaAnemos',
'EurekaPagos',
'EurekaPyros',
'EurekaHydatos',
IgnoreContentTypes: [
ContentType.Pvp,
ContentType.Eureka,
],
};

let gIgnoreCurrentZone = false;
let gIgnoreCurrentJob = false;
let gCurrentJob = null;
let gCurrentZone = null;
let gIgnoreZones = [];
let gInCombat = false;

function InitDpsModule(updateFunc, hideFunc) {
Expand Down Expand Up @@ -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) {
Expand All @@ -73,8 +64,4 @@ function InitDpsModule(updateFunc, hideFunc) {
gIgnoreCurrentJob = true;
hideFunc();
});

gIgnoreZones = Options.IgnoreZones.map(function(z) {
return IntlZoneNames[z];
});
}
4 changes: 3 additions & 1 deletion ui/dps/rdmty/dps.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
<title></title>
<link rel="stylesheet" href="../../../resources/resize_handle.css">
<script src="../../../resources/common.js"></script>
<script src="../../../resources/content_type.js"></script>
<script src="../../../resources/regexes.js"></script>
<script src="../../../resources/netregexes.js"></script>
<script src="../../../resources/user_config.js"></script>
<script src="../../../resources/translations.js"></script>
<script src="../../../resources/zone_id.js"></script>
<script src="../../../resources/zone_info.js"></script>
<script src="../../../resources/fights.js"></script>
<script src="../../../resources/translations.js"></script>
<script src="../../../resources/resize_handle.js"></script>
<script src="../../../resources/lib/lodash.min.js"></script>
<script src="../../../resources/lib/react.min.js"></script>
Expand Down
4 changes: 3 additions & 1 deletion ui/dps/xephero/xephero-cactbot.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
<script type="text/javascript" src="https://unpkg.com/jquery@1.11.3/dist/jquery.min.js"></script>

<script src="../../../resources/common.js"></script>
<script src="../../../resources/content_type.js"></script>
<script src="../../../resources/regexes.js"></script>
<script src="../../../resources/netregexes.js"></script>
<script src="../../../resources/user_config.js"></script>
<script src="../../../resources/translations.js"></script>
<script src="../../../resources/zone_id.js"></script>
<script src="../../../resources/zone_info.js"></script>
<script src="../../../resources/fights.js"></script>
<script src="../../../resources/translations.js"></script>
<script src="../dps_common.js"></script>
<script src="dps_phase_tracker.js"></script>
<script src="xephero.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions ui/jobs/jobs.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<link rel="stylesheet" href="../../resources/defaults.css">
<link rel="stylesheet" href="../../resources/resize_handle.css">
<script src="../../resources/common.js"></script>
<script src="../../resources/content_type.js"></script>
<script src="../../resources/effect_id.js"></script>
<script src="../../resources/regexes.js"></script>
<script src="../../resources/netregexes.js"></script>
Expand All @@ -16,6 +17,7 @@
<script src="../../resources/widgetlist.js"></script>
<script src="../../resources/user_config.js"></script>
<script src="../../resources/translations.js"></script>
<script src="../../resources/zone_info.js"></script>

<link rel="stylesheet" href="jobs.css">
<script src="jobs.js"></script>
Expand Down
24 changes: 13 additions & 11 deletions ui/jobs/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 });
Expand Down Expand Up @@ -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'];
Expand Down Expand Up @@ -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() {
Expand All @@ -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.
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion ui/oopsyraidsy/oopsyraidsy.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
<link rel="stylesheet" href="../../resources/defaults.css">
<link rel="stylesheet" href="../../resources/resize_handle.css">
<script src="../../resources/common.js"></script>
<script src="../../resources/zone_id.js"></script>
<script src="../../resources/content_type.js"></script>
<script src="../../resources/party.js"></script>
<script src="../../resources/regexes.js"></script>
<script src="../../resources/netregexes.js"></script>
<script src="../../resources/resize_handle.js"></script>
<script src="../../resources/user_config.js"></script>
<script src="../../resources/translations.js"></script>
<script src="../../resources/zone_id.js"></script>
<script src="../../resources/zone_info.js"></script>

<link rel="stylesheet" type="text/css" href="oopsyraidsy.css">
<script src="oopsyraidsy_config.js"></script>
Expand Down
25 changes: 10 additions & 15 deletions ui/oopsyraidsy/oopsyraidsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ let Options = {
Triggers: [],
PlayerNicks: {},
DisabledTriggers: {},
IgnoreZones: [
'PvpSeize',
'PvpSecure',
'PvpShatter',
'EurekaAnemos',
'EurekaPagos',
'EurekaPyros',
'EurekaHydatos',
IgnoreContentTypes: [
ContentType.Pvp,
ContentType.Eureka,
],

AbilityIdNameMap: {
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 745f5e4

Please sign in to comment.