Skip to content

Commit d44ac51

Browse files
committed
done tier decoding but not encoding
1 parent f7ede56 commit d44ac51

12 files changed

+469
-69
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + React + TS</title>
7+
<title>Tiers of Heck - Web</title>
88
</head>
99
<body>
1010
<div id="root"></div>

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13+
"pako": "^2.1.0",
1314
"react": "^18.2.0",
1415
"react-dom": "^18.2.0"
1516
},
1617
"devDependencies": {
18+
"@types/pako": "^2.0.3",
1719
"@types/react": "^18.2.66",
1820
"@types/react-dom": "^18.2.22",
1921
"@typescript-eslint/eslint-plugin": "^7.2.0",

src/App.css

+7-30
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,19 @@
11
#root {
2-
max-width: 1280px;
32
margin: 0 auto;
4-
padding: 2rem;
3+
/* padding: 2rem; */
54
text-align: center;
65
}
76

8-
.logo {
9-
height: 6em;
10-
padding: 1.5em;
11-
will-change: filter;
12-
transition: filter 300ms;
13-
}
14-
.logo:hover {
15-
filter: drop-shadow(0 0 2em #646cffaa);
16-
}
17-
.logo.react:hover {
18-
filter: drop-shadow(0 0 2em #61dafbaa);
19-
}
20-
21-
@keyframes logo-spin {
22-
from {
23-
transform: rotate(0deg);
24-
}
25-
to {
26-
transform: rotate(360deg);
27-
}
28-
}
29-
30-
@media (prefers-reduced-motion: no-preference) {
31-
a:nth-of-type(2) .logo {
32-
animation: logo-spin infinite 20s linear;
33-
}
34-
}
35-
367
.card {
378
padding: 2em;
389
}
3910

4011
.read-the-docs {
4112
color: #888;
4213
}
14+
15+
.centered-display {
16+
display: grid;
17+
grid-row: 1fr 5fr;
18+
padding: 0;
19+
}

src/App.tsx

+28-23
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
1-
import { useState } from 'react'
2-
import reactLogo from './assets/react.svg'
3-
import viteLogo from '/vite.svg'
1+
import { useRef, useState } from 'react'
42
import './App.css'
3+
import { tier, decodeTier } from './tiers'
4+
import Header from './Header';
5+
import BadCode from './BadCode';
56

67
function App() {
7-
const [count, setCount] = useState(0)
8+
const codeInput = useRef<HTMLInputElement>(null)
9+
const [currentTier, setCurrentTier] = useState<tier | null>(null);
10+
11+
function updateTier() {
12+
var code = codeInput.current?.value || null
13+
if(!code) {
14+
setCurrentTier(null)
15+
return
16+
}
17+
18+
var tier = decodeTier(code)
19+
if(!tier) {
20+
setCurrentTier(null)
21+
return
22+
}
23+
24+
setCurrentTier(tier)
25+
}
826

927
return (
1028
<>
11-
<div>
12-
<a href="https://vitejs.dev" target="_blank">
13-
<img src={viteLogo} className="logo" alt="Vite logo" />
14-
</a>
15-
<a href="https://react.dev" target="_blank">
16-
<img src={reactLogo} className="logo react" alt="React logo" />
17-
</a>
18-
</div>
19-
<h1>Vite + React</h1>
20-
<div className="card">
21-
<button onClick={() => setCount((count) => count + 1)}>
22-
count is {count}
23-
</button>
24-
<p>
25-
Edit <code>src/App.tsx</code> and save to test HMR
26-
</p>
29+
<Header inputRef={codeInput} updateFun={updateTier} />
30+
31+
<div className='centered-display'>
32+
{!currentTier ? <BadCode /> : <div>
33+
<span>{JSON.stringify(currentTier, null, 4)}</span>
34+
</div>}
2735
</div>
28-
<p className="read-the-docs">
29-
Click on the Vite and React logos to learn more
30-
</p>
3136
</>
3237
)
3338
}

src/BadCode.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function BadCode() {
2+
return <h1>bad</h1>
3+
}
4+
5+
export default BadCode

src/Header.css

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.header {
2+
/* position: fixed;
3+
top: 0;
4+
left: 0;
5+
width: 100%; */
6+
7+
background-color: indigo;
8+
9+
padding: 15px;
10+
margin-bottom: 30px;
11+
display: grid;
12+
grid-template-columns: 1fr 1fr 3fr 1fr;
13+
column-gap: 15px;
14+
}
15+
16+
.header > span {
17+
font-weight: bold;
18+
font-size: larger;
19+
display: inline-flex;
20+
align-items: center;
21+
justify-content: center;
22+
}
23+
24+
25+
.code-input {
26+
height: 2em;
27+
width: 100%;
28+
text-align: center;
29+
}

src/Header.tsx

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { RefObject } from "react"
2+
import "./Header.css"
3+
4+
function Header(props: {inputRef: RefObject<HTMLInputElement>, updateFun: VoidFunction}) {
5+
return <>
6+
<div className="header">
7+
<p></p>
8+
<span>Code:</span>
9+
<span>
10+
<input placeholder="Enter codes here..."
11+
className="code-input"
12+
type="text"
13+
autoComplete="off"
14+
autoCorrect="off"
15+
autoFocus={true}
16+
ref={props.inputRef}
17+
onChange={props.updateFun} />
18+
</span>
19+
</div>
20+
</>
21+
}
22+
23+
export default Header

src/index.css

-15
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ a:hover {
2424

2525
body {
2626
margin: 0;
27-
display: flex;
28-
place-items: center;
29-
min-width: 320px;
3027
min-height: 100vh;
3128
}
3229

@@ -54,15 +51,3 @@ button:focus-visible {
5451
outline: 4px auto -webkit-focus-ring-color;
5552
}
5653

57-
@media (prefers-color-scheme: light) {
58-
:root {
59-
color: #213547;
60-
background-color: #ffffff;
61-
}
62-
a:hover {
63-
color: #747bff;
64-
}
65-
button {
66-
background-color: #f9f9f9;
67-
}
68-
}

src/names.ts

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
// These have to be updated from the Serialization[Map/Enemy/Weapon/Modifier]Name
2+
// enums in the game's assembly. *pain*
3+
4+
export const maps = [
5+
"Launch",
6+
"Smash",
7+
"Skull",
8+
"Arachnobatics",
9+
"BigWheel",
10+
"BoxingTowers",
11+
"Cargo",
12+
"SpaceRock",
13+
"TheBiggerSpinner",
14+
"Cove",
15+
"Balance",
16+
"Fungi",
17+
"Hecksagon",
18+
"Float",
19+
"Core",
20+
"Polaris",
21+
"Ribs",
22+
"Compactor",
23+
"TickTac",
24+
"Pachinko",
25+
"Shuffle",
26+
"Lift",
27+
"TrashBarrage",
28+
"DeadWeight",
29+
"Humdrum",
30+
"Bouncer",
31+
"Dagobert",
32+
"Tribune",
33+
"Arachnitects",
34+
"Swings",
35+
"Hanging",
36+
"AntDomain",
37+
"NonPlayable",
38+
"RockLoop",
39+
"UpDown",
40+
"Pillars",
41+
"Summer1",
42+
"Summer2",
43+
"Summer3",
44+
"Summer4",
45+
"Summer5",
46+
"Summer6",
47+
"Summer7",
48+
"Anniversary1",
49+
"Anniversary2",
50+
"Anniversary3",
51+
"Anniversary4",
52+
"Community1",
53+
"Community2",
54+
"Community3",
55+
"Community4",
56+
"PANOPTICON",
57+
"Reactor",
58+
"Shackle",
59+
"Arme",
60+
"FN"
61+
]
62+
63+
export const enemies = [
64+
"Khepri",
65+
"PowerKhepri",
66+
"ExplodingRoller",
67+
"PowerRoller",
68+
"Roller",
69+
"HornetVariant",
70+
"HornetShaman",
71+
"PowerWaspShield",
72+
"PowerWasp",
73+
"ShieldedHornet",
74+
"ShieldedWasp",
75+
"Wasp",
76+
"MeleeWhisp",
77+
"PowerMeleeWhisp",
78+
"PowerWhisp",
79+
"Whisp",
80+
"FriendlyWasp"
81+
]
82+
83+
export const modifiers = [
84+
"Adrenaline",
85+
"Aerodynamics",
86+
"BeamingTech",
87+
"BiggerBoom",
88+
"Blademaster",
89+
"CoolExplosions",
90+
"Efficiency",
91+
"FairWeapons",
92+
"FastLegs",
93+
"FeebleEnemies",
94+
"Insulation",
95+
"Interference",
96+
"InvadingAi",
97+
"KnockbackSuspension",
98+
"HalvedAmmo",
99+
"StartingHealthOverride",
100+
"Lightweight",
101+
"MoreBoom",
102+
"MoreGuns",
103+
"MoreParticleBlades",
104+
"MuscleArms",
105+
"Nothing",
106+
"Objectification",
107+
"ParticleTechnology",
108+
"Picky",
109+
"PositiveEncouragement",
110+
"PowerWeb",
111+
"SafetyBubbles",
112+
"SafetyNet",
113+
"SelectiveBlindness",
114+
"SizeMatters",
115+
"SlowEnemies",
116+
"SpiderStorage",
117+
"StrongLegs",
118+
"SupplyChain",
119+
"ThickBlades",
120+
"AmmoOverdrive",
121+
"DeathZoneOverride",
122+
"NoWebbing",
123+
"WeaponRespawnOverride",
124+
"TooCool",
125+
"Vacuum",
126+
"MirrorLasers",
127+
"LightSteps",
128+
"Beeplomacy",
129+
"AstralHeckhound"
130+
]
131+
132+
export const weapons = [
133+
"BigGrenade",
134+
"BigParticleBlade",
135+
"BurstLauncher",
136+
"DeathRay",
137+
"DoubleParticleBlade",
138+
"DoubleRailvolver",
139+
"GrenadeLauncher",
140+
"Grenade",
141+
"HeckSaw",
142+
"KhepriStaff",
143+
"LaserCannon",
144+
"LaserCube",
145+
"Mine",
146+
"MiniShotgun",
147+
"BeachBall",
148+
"FireworkLauncher",
149+
"Flare",
150+
"Flashlight",
151+
"ParticleBladeLauncher",
152+
"ParticleBlade",
153+
"ParticleSpear",
154+
"PerArmedGrenade",
155+
"PreArmedParticleBlade",
156+
"Railvolver",
157+
"RocketLauncher",
158+
"Shotgun",
159+
"AutoShotgun",
160+
"GravityGrenade",
161+
"GravitySaw",
162+
"BoomStick",
163+
"DeathCube",
164+
"Snowballs"
165+
]

0 commit comments

Comments
 (0)