From 92b3b66d8af3fda390fbdf875fdf17dd62ecaef6 Mon Sep 17 00:00:00 2001 From: GC <30398469+gc@users.noreply.github.com> Date: Thu, 5 Dec 2024 23:19:03 +1100 Subject: [PATCH] Warped monsters, Zombie pirates, CL items, wiki improvements (#6248) --- biome.json | 3 +- data/authors.json | 28 + docs/astro.config.mjs | 3 +- docs/package.json | 1 - docs/src/components/Footer.astro | 21 +- docs/src/components/Header.astro | 85 + docs/src/components/Leagues.tsx | 134 +- docs/src/components/PreactThemeSelect.tsx | 78 + docs/src/components/Update.astro | 2 +- docs/src/content/docs/osb/Skills/mining.md | 4 +- .../content/docs/osb/combat-achievements.mdx | 25 +- docs/src/content/docs/osb/monsters.mdx | 737 ++- docs/src/env.d.ts | 2 + docs/src/plugins/items.ts | 2 +- docs/src/styles/main.css | 95 +- .../oldschooljs/src/data/monsters_data.json | 118 +- .../src/simulation/monsters/low/index.ts | 6 +- .../monsters/low/t-z/WarpedTerrorbird.ts | 36 + .../monsters/low/t-z/WarpedTortoise.ts | 37 + .../monsters/low/t-z/ZombiePirate.ts | 4 +- pnpm-lock.yaml | 4556 ++++++++++++++++- pnpm-workspace.yaml | 1 + scripts/wiki.ts | 4 +- {docs/src/plugins => scripts/wiki}/authors.ts | 23 +- scripts/wiki/updateAuthors.ts | 38 + src/lib/data/CollectionsExport.ts | 8 +- .../minions/data/killableMonsters/index.ts | 2 +- src/lib/minions/data/killableMonsters/low.ts | 77 +- src/lib/openables.ts | 12 +- src/lib/slayer/slayerUnlocks.ts | 10 +- src/lib/slayer/slayerUtil.ts | 3 + src/lib/slayer/tasks/chaeldarTasks.ts | 7 + src/lib/slayer/tasks/duradelTasks.ts | 7 + src/lib/slayer/tasks/konarTasks.ts | 7 + src/lib/slayer/tasks/krystiliaTasks.ts | 4 +- src/lib/slayer/tasks/mazchnaTasks.ts | 3 +- src/lib/slayer/tasks/nieveTasks.ts | 7 + src/lib/slayer/tasks/turaelTasks.ts | 3 +- src/lib/util/minionUtils.ts | 2 +- .../minionKill/newMinionKill.ts | 2 +- tests/unit/snapshots/cl.OSB.png | Bin 51665 -> 52600 bytes tests/unit/snapshots/clsnapshots.test.ts.snap | 5 +- .../snapshots/slayerUnlocks.snapshot.json | 3 +- 43 files changed, 5995 insertions(+), 210 deletions(-) create mode 100644 data/authors.json create mode 100644 docs/src/components/Header.astro create mode 100644 docs/src/components/PreactThemeSelect.tsx create mode 100644 packages/oldschooljs/src/simulation/monsters/low/t-z/WarpedTerrorbird.ts create mode 100644 packages/oldschooljs/src/simulation/monsters/low/t-z/WarpedTortoise.ts rename {docs/src/plugins => scripts/wiki}/authors.ts (62%) create mode 100644 scripts/wiki/updateAuthors.ts diff --git a/biome.json b/biome.json index 36972ea15eb..8f302d42458 100644 --- a/biome.json +++ b/biome.json @@ -25,7 +25,8 @@ "**/*.md", "**/*.mjs", "**/*.cjs", - "**/*.tsx" + "**/*.tsx", + "**/*.astro" ] }, "vcs": { diff --git a/data/authors.json b/data/authors.json new file mode 100644 index 00000000000..9ece88a273d --- /dev/null +++ b/data/authors.json @@ -0,0 +1,28 @@ +{ + "bso/Monsters/Raids/chambers-of-xeric.md": ["wontonstrips", "Magnaboy"], + "bso/Monsters/Raids/README.md": ["wontonstrips", "Magnaboy"], + "bso/Monsters/Raids/theatre-of-blood-tob.md": ["wontonstrips", "Magnaboy"], + "bso/Monsters/Raids/tombs-of-amascut-toa.md": ["wontonstrips", "Magnaboy"], + "getting-started/wiki.md": ["Magnaboy", "dark", "Jonesey"], + "index.mdx": ["luna", "Magnaboy"], + "osb/Activities/aerial-fishing.md": ["wontonstrips", "Magnaboy"], + "osb/Activities/brimhaven-agility-arena.md": ["Magnaboy", "Justas"], + "osb/Activities/fountain-of-rune.md": ["wontonstrips", "Magnaboy"], + "osb/Activities/guardians-of-the-rift.md": ["wontonstrips", "Magnaboy"], + "osb/Activities/hallowed-sepulchre.md": ["wontonstrips", "Magnaboy"], + "osb/Activities/mage-training-arena.md": ["wontonstrips", "Magnaboy"], + "osb/Activities/mahogany-homes.md": ["wontonstrips", "Magnaboy"], + "osb/Activities/motherlode-mine.md": ["wontonstrips", "Magnaboy"], + "osb/Activities/shooting-stars.md": ["wontonstrips", "Magnaboy"], + "osb/Activities/volcanic-mine.md": ["wontonstrips", "Magnaboy"], + "osb/Activities/wintertodt.md": ["wontonstrips", "Magnaboy"], + "osb/Bosses/the-nightmare.md": ["DayV"], + "osb/combat-achievements.mdx": ["Magnaboy", "DayV", "Jonesey", "Keres"], + "osb/Miscelleanous/charging-items.md": ["wontonstrips", "Magnaboy"], + "osb/Miscelleanous/minion-icons.md": ["wontonstrips"], + "osb/monsters.mdx": ["Magnaboy", "Keres"], + "osb/quests.mdx": ["Magnaboy", "Keres"], + "osb/Raids/toa.mdx": ["wontonstrips", "gamrbing", "Magnaboy"], + "osb/Raids/tob.mdx": ["wontonstrips", "Magnaboy"], + "osb/Skills/mining.md": ["Magnaboy", "dark", "lajnux"] +} diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 6d83d5ea681..f0f944d4430 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -27,7 +27,8 @@ export default defineConfig({ integrations: [ starlight({ components: { - Footer: './src/components/Footer.astro' + Footer: './src/components/Footer.astro', + Header: './src/components/Header.astro' }, title: 'Oldschool.gg Wiki', favicon: 'favicon.ico', diff --git a/docs/package.json b/docs/package.json index 249dd91d07d..ff99b80cdcb 100644 --- a/docs/package.json +++ b/docs/package.json @@ -16,7 +16,6 @@ "@astrojs/tailwind": "^5.1.2", "astro": "^4.16.1", "collapse-white-space": "^2.1.0", - "docs": "link:", "markdown-it": "^14.1.0", "oldschooljs": "workspace:*", "preact": "^10.25.0", diff --git a/docs/src/components/Footer.astro b/docs/src/components/Footer.astro index bb4714c2ddd..9b78698a2d6 100644 --- a/docs/src/components/Footer.astro +++ b/docs/src/components/Footer.astro @@ -1,31 +1,24 @@ --- -import { getAuthors } from "../plugins/authors"; -const authors = (await getAuthors(`src/content/docs/${Astro.props.id}`)); +import authorsJson from '@data/authors.json'; +import { Fragment } from 'preact'; +const authors = authorsJson[Astro.props.id] || []; const editURL = Astro.props.editUrl?.toString(); --- \ No newline at end of file diff --git a/docs/src/components/Header.astro b/docs/src/components/Header.astro new file mode 100644 index 00000000000..8d8cf86d67c --- /dev/null +++ b/docs/src/components/Header.astro @@ -0,0 +1,85 @@ +--- +import LanguageSelect from 'virtual:starlight/components/LanguageSelect'; +import Search from 'virtual:starlight/components/Search'; +import SiteTitle from 'virtual:starlight/components/SiteTitle'; +import SocialIcons from 'virtual:starlight/components/SocialIcons'; +import config from 'virtual:starlight/user-config'; +import { PreactThemeSelect } from './PreactThemeSelect'; + +/** + * Render the `Search` component if Pagefind is enabled or the default search component has been overridden. + */ +const shouldRenderSearch = config.pagefind || config.components.Search !== '@astrojs/starlight/components/Search.astro'; +--- + +
+
+ +
+
+ {shouldRenderSearch && } +
+
+ + + +
+
+ + \ No newline at end of file diff --git a/docs/src/components/Leagues.tsx b/docs/src/components/Leagues.tsx index 32f6184c6a6..722c10d799a 100644 --- a/docs/src/components/Leagues.tsx +++ b/docs/src/components/Leagues.tsx @@ -11,66 +11,121 @@ function toTitleCase(str: string) { const tiers = Object.keys(combatAchievements).map(t => t.toLowerCase()); const allTasksFlat = Object.values(combatAchievements).flatMap((tier: any) => - tier.tasks.map(t => ({ ...t, tier: tier.name.toLowerCase() })) + tier.tasks.map((t: any) => ({ ...t, tier: tier.name.toLowerCase() })) ); + +export type APIUser = { + id: string; + completed_ca_task_ids: number[]; + is_ironman: boolean; + leagues_completed_tasks_ids: number[]; +}; + export function Leagues() { const [tiersBeingShown, setTiersBeingShown] = useState(tiers); const [tasksBeingShown, setTasksBeingShown] = useState(allTasksFlat); + const [hideCompleted, setHideCompleted] = useState(false); const [userID, setUserID] = useState(null); - // const [data, setData] = useState(); + const [data, setData] = useState(null); + const [isLoading, setIsLoading] = useState(false); - // console.log({data}); - // useEffect(() => { - // fetch('https://api.oldschool.gg/') - // .then(response => response.json()) - // .then(data => setData(data)); - // }, []); + useEffect(() => { + setTasksBeingShown( + allTasksFlat.filter(task => { + if (hideCompleted && data?.completed_ca_task_ids.includes(task.id)) return false; + return tiersBeingShown.includes(task.tier); + }) + ); + }, [tiersBeingShown, data, hideCompleted]); useEffect(() => { - setTasksBeingShown(allTasksFlat.filter(task => tiersBeingShown.includes(task.tier))); - }, [tiersBeingShown]); + if (localStorage) { + const storedUserID = localStorage.getItem('userID'); + if (storedUserID) setUserID(storedUserID); + + const storedData = localStorage.getItem(`minion.${storedUserID}`); + if (storedData) setData(JSON.parse(storedData)); + } + }, []); return ( <>
- {/*
-