about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorana <ana@ana.st>2021-08-09 15:48:38 +0200
committerana <ana@ana.st>2021-08-09 15:48:38 +0200
commit911f229c23ec6aadb7ba9a36721d016547f061e1 (patch)
tree9025c1bd3e41a15a1c65fcc161a40de3556f2fd2 /src
parent231f854a1a7fe3ac99aecb97121727997cf8f23f (diff)
downloadeureka-marks-911f229c23ec6aadb7ba9a36721d016547f061e1.tar.gz
feat: add logogram drop information
Diffstat (limited to 'src')
-rw-r--r--src/App.svelte52
-rw-r--r--src/EnemyList.svelte86
-rw-r--r--src/bestiary.js24
-rw-r--r--src/pyros.bestiary.js21
4 files changed, 136 insertions, 47 deletions
diff --git a/src/App.svelte b/src/App.svelte
index cd6102b..3a0db7d 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -3,6 +3,7 @@
   import ew from "./ew";
   import { formatUtc } from "./times";
   import { getMatches } from "./bestiary";
+  import EnemyList from "./EnemyList.svelte";
   import day from "dayjs";
   import relativeTime from "dayjs/plugin/relativeTime";
   import { onMount } from "svelte";
@@ -52,7 +53,7 @@
     otherMatches = matches.filter((m) => m.special && !m.uptime.isUp);
   }
 
-  function getZoneForecast() {
+  export function getZoneForecast() {
     if ($level >= 20 && $level < 35) {
       return pagosForecast;
     } else if ($level >= 35 && $level < 50) {
@@ -133,56 +134,13 @@
       </h2>
 
       <h5>matches</h5>
-      <ul>
-        {#each upMatches as m (m.name + m.level)}
-          <li>
-            <span class={!m.spawning && "strikethrough"}>
-              <em>(Lv{formatLevel(m)})</em> <strong>{m.name}</strong>
-              ({#if m.mutating}mutates{/if}{#if m.augmenting}augments{/if}
-              {formatUptimeUntil(m.uptime.futureUptime)})
-            </span>
-            {#if !m.spawning}
-              &nbsp;(next spawns {m.nextSpawn
-                ? day(m.nextSpawn.date).fromNow()
-                : "in a long time"}
-            {/if}
-          </li>
-        {/each}
-      </ul>
+      <EnemyList matches={upMatches} type={0} />
 
       <h5>regular enemies</h5>
-      <ul>
-        {#each normalMatches as m (m.name + m.level)}
-          <li>
-            <span class={!m.spawning && "strikethrough"}>
-              <em>(Lv{formatLevel(m)})</em> <strong>{m.name}</strong>
-            </span>
-            {#if !m.spawning}
-              &nbsp;(next spawns {m.nextSpawn
-                ? day(m.nextSpawn.date).fromNow()
-                : "in a long time"})
-            {/if}
-          </li>
-        {/each}
-      </ul>
+      <EnemyList matches={normalMatches} type={2} />
 
       <h5>special enemies that do not mutate/augment right now</h5>
-      <ul>
-        {#each otherMatches as m (m.name + m.level)}
-          <li>
-            <span class={!m.spawning && "strikethrough"}>
-              <em>(Lv{formatLevel(m)})</em> <strong>{m.name}</strong>
-              ({#if m.mutating}mutates{/if}{#if m.augmenting}augments{/if}
-              {formatNextUptime(m.uptime.futureUptime)})
-            </span>
-            {#if !m.spawning}
-              &nbsp;(next spawns {m.nextSpawn
-                ? day(m.nextSpawn.date).fromNow()
-                : "in a long time"})
-            {/if}
-          </li>
-        {/each}
-      </ul>
+      <EnemyList matches={otherMatches} type={1} />
     </div>
     <div class="pure-u-1 pure-u-md-1-4">
       <div class="pure-menu">
diff --git a/src/EnemyList.svelte b/src/EnemyList.svelte
new file mode 100644
index 0000000..e6c096e
--- /dev/null
+++ b/src/EnemyList.svelte
@@ -0,0 +1,86 @@
+<script>
+  export let matches;
+  export let type;
+  import { level, paWeather, pyWeather, hWeather, aWeather } from "./stores";
+  import day from "dayjs";
+  import relativeTime from "dayjs/plugin/relativeTime";
+  day.extend(relativeTime);
+
+  export const TYPES = {
+    UP: 0,
+    DOWN: 1,
+    NO_UPTIME: 2,
+  };
+
+  function formatLevel(m) {
+    if (m.level) {
+      return m.level;
+    } else if (m.levelRange) {
+      return `${m.levelRange[0]}-${m.levelRange[1]}`;
+    }
+    return "??";
+  }
+
+  export function getZoneForecast() {
+    if ($level >= 20 && $level < 35) {
+      return $paWeather;
+    } else if ($level >= 35 && $level < 50) {
+      return $pyWeather;
+    } else if ($level >= 50) {
+      return $hWeather;
+    } else {
+      return $aWeather;
+    }
+  }
+
+  function formatNextUptime(futures) {
+    let i;
+    futures.find((f, idx) => {
+      if (f) i = idx;
+      return f;
+    });
+
+    if (typeof i === "number") {
+      return `in ${day(getZoneForecast()[i + 1].date).fromNow(true)}`;
+    }
+    return "in the far future";
+  }
+
+  function formatUptimeUntil(futures) {
+    let i;
+    futures.find((f, idx) => {
+      if (!f) i = idx;
+      return !f;
+    });
+
+    if (typeof i === "number") {
+      return `for ${day(getZoneForecast()[i + 1].date).fromNow(true)}`;
+    }
+
+    return "for a long time";
+  }
+</script>
+
+<ul>
+  {#each matches as m (m.name + m.level)}
+    <li>
+      <span class={!m.spawning && "strikethrough"}>
+        <em>(Lv{formatLevel(m)})</em> <strong>{m.name}</strong>
+        {#if type !== 2}({#if m.mutating}mutates{/if}{#if m.augmenting}augments{/if}
+          {#if type === TYPES.UP}
+            {formatUptimeUntil(m.uptime.futureUptime)})
+          {:else if type === TYPES.DOWN}
+            {formatNextUptime(m.uptime.futureUptime)})
+          {/if}{/if}
+      </span>
+      {#if !m.spawning}
+        &nbsp;(next spawns {m.nextSpawn
+          ? day(m.nextSpawn.date).fromNow()
+          : "in a long time"})
+      {/if}
+      {#if m.logogram}
+        <span class="highlight">✶ {m.logogram} logogram</span>
+      {/if}
+    </li>
+  {/each}
+</ul>
diff --git a/src/bestiary.js b/src/bestiary.js
index 9a2728c..08b16e1 100644
--- a/src/bestiary.js
+++ b/src/bestiary.js
@@ -25,6 +25,29 @@ export const logograms = {
   OBSCURE: 8,
 };
 
+export function getLogogramName(logogram) {
+  switch (logogram) {
+    case 0:
+      return "Conceptual";
+    case 1:
+      return "Fundamental";
+    case 2:
+      return "Offensive";
+    case 3:
+      return "Protective";
+    case 4:
+      return "Curative";
+    case 5:
+      return "Tactical";
+    case 6:
+      return "Inmical";
+    case 7:
+      return "Mitigative";
+    case 8:
+      return "Obscure";
+  }
+}
+
 export function getMatches(forecast, level) {
   let res = [];
   bestiaries[forecast[0].zone].forEach((b) => {
@@ -40,6 +63,7 @@ export function getMatches(forecast, level) {
         special: b.type > 0,
         mutating: b.type === 1,
         augmenting: b.type === 2,
+        logogram: typeof b.logogram === "number" && getLogogramName(b.logogram),
         spawning:
           !b.spawnConditions ||
           b.spawnConditions.includes(forecast[0].currWeather),
diff --git a/src/pyros.bestiary.js b/src/pyros.bestiary.js
index 2a4ec5e..d9a270a 100644
--- a/src/pyros.bestiary.js
+++ b/src/pyros.bestiary.js
@@ -419,6 +419,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [9],
+    logogram: 0,
   },
   {
     level: 36,
@@ -427,6 +428,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [5],
+    logogram: 0,
   },
   {
     level: 37,
@@ -435,6 +437,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [5],
+    logogram: 0,
   },
   {
     level: 38,
@@ -443,6 +446,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [4],
+    logogram: 0,
   },
   {
     level: 39,
@@ -451,6 +455,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [4],
+    logogram: 0,
   },
   {
     level: 40,
@@ -459,6 +464,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [9],
+    logogram: 0,
   },
   {
     level: 41,
@@ -467,6 +473,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [5],
+    logogram: 1,
   },
   {
     level: 42,
@@ -475,6 +482,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [9],
+    logogram: 0,
   },
   {
     level: 43,
@@ -483,6 +491,7 @@ export default [
     elem: null,
     conditions: { day: [4], night: [4] },
     spawnConditions: [4],
+    logogram: 7,
   },
   {
     level: 44,
@@ -491,6 +500,7 @@ export default [
     elem: null,
     conditions: { day: [4], night: [4] },
     spawnConditions: [4],
+    logogram: 7,
   },
   {
     level: 45,
@@ -499,6 +509,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [9],
+    logogram: 0,
   },
   {
     level: 46,
@@ -507,6 +518,7 @@ export default [
     elem: null,
     conditions: { day: [5], night: [5] },
     spawnConditions: [5],
+    logogram: 7,
   },
   {
     level: 47,
@@ -515,6 +527,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [3, 7],
+    logogram: 0,
   },
   {
     level: 48,
@@ -523,6 +536,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [9],
+    logogram: 0,
   },
   {
     level: 49,
@@ -531,6 +545,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [9],
+    logogram: 0,
   },
   {
     level: 50,
@@ -539,6 +554,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [3, 7],
+    logogram: 0,
   },
   {
     level: 51,
@@ -547,6 +563,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [3, 7],
+    logogram: 0,
   },
   {
     level: 52,
@@ -555,6 +572,7 @@ export default [
     elem: null,
     conditions: { day: [7, 3], night: [7, 3] },
     spawnConditions: [3, 7],
+    logogram: 6,
   },
   {
     level: 53,
@@ -563,6 +581,7 @@ export default [
     elem: null,
     conditions: { day: [], night: [] },
     spawnConditions: [4],
+    logogram: 0,
   },
   {
     level: 54,
@@ -571,6 +590,7 @@ export default [
     elem: null,
     conditions: { day: [5], night: [5] },
     spawnConditions: [5],
+    logogram: 6,
   },
   {
     level: 55,
@@ -579,6 +599,7 @@ export default [
     elem: null,
     conditions: { day: [9], night: [9] },
     spawnConditions: [9],
+    logogram: 6,
   },
   {
     level: 55,