mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-30 14:09:51 +01:00
Compare commits
7
Commits
980fd6e50e
...
16c77f587a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16c77f587a | ||
|
|
a218c791a9 | ||
|
|
dccdf55bfc | ||
|
|
1ba6e70c56 | ||
|
|
0e76184813 | ||
|
|
c674da29d5 | ||
|
|
ba4e6dfd68 |
No files matched your search
+1
-1
Submodule packages/closed updated: 69c3688906...cc81b43447.
@@ -21,21 +21,7 @@ public class BlitzFileProvider : DefaultFileProvider
|
||||
Initialize();
|
||||
Mount();
|
||||
|
||||
string libraryExtension;
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
libraryExtension = "dll";
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
libraryExtension = "so";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Unsupported OS");
|
||||
}
|
||||
|
||||
OodleHelper.DownloadOodleDll($"../../temp/oodle.{libraryExtension}");
|
||||
OodleHelper.Initialize($"../../temp/oodle.{libraryExtension}");
|
||||
// OodleHelper.DownloadOodleDll($"../../temp/oodle.so");
|
||||
OodleHelper.Initialize($"../../temp/oodle.so");
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<RootNamespace>BlitzKit.Game</RootNamespace>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<!-- <RuntimeIdentifier>win-x64</RuntimeIdentifier> -->
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<NodeApiAssemblyJSModuleType>esm</NodeApiAssemblyJSModuleType>
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from "../bin/Debug/net9.0/win-x64/game";
|
||||
export * from "../bin/Debug/net9.0/game";
|
||||
@@ -72,6 +72,11 @@
|
||||
"name": "BlitzKit"
|
||||
},
|
||||
|
||||
"client_unmounted": {
|
||||
"title": "Client-Unmounted Mode",
|
||||
"body": "This version of BlitzKit was compiled without access to an installation of World of Tanks Blitz. Some important features may be missing like tank icons, models, armor, etc."
|
||||
},
|
||||
|
||||
"units": {
|
||||
"hp_min": "{value}hp/min",
|
||||
"s": "{value}s",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,47 @@
|
||||
---
|
||||
import { ExclamationTriangleIcon } from "@radix-ui/react-icons";
|
||||
import { api } from "../core/api/dynamic";
|
||||
import { Heading } from "./Heading";
|
||||
import { Section } from "./Section";
|
||||
import { Text } from "./Text";
|
||||
|
||||
interface Props {
|
||||
locale: string;
|
||||
}
|
||||
|
||||
const { locale } = Astro.props;
|
||||
|
||||
const strings = await api.strings(locale);
|
||||
---
|
||||
|
||||
<style>
|
||||
.card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-3);
|
||||
max-width: 30rem;
|
||||
|
||||
padding: var(--space-4);
|
||||
margin: auto;
|
||||
|
||||
background-color: var(--red-3);
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<Section>
|
||||
<div class="card composable-radius" data-radius="1">
|
||||
<Heading size="4">
|
||||
<div class="title">
|
||||
<ExclamationTriangleIcon width="0.75em" height="0.75em" />
|
||||
{strings.client_unmounted.title}
|
||||
</div>
|
||||
</Heading>
|
||||
<Text>{strings.client_unmounted.body}</Text>
|
||||
</div>
|
||||
</Section>
|
||||
@@ -39,7 +39,7 @@ export function IncrementalLoader<Props extends { key: string }>({
|
||||
<Item key={index} rate={rate} setCount={setCount}>
|
||||
<Component skeleton />
|
||||
</Item>
|
||||
)
|
||||
),
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
gap: var(--space-2);
|
||||
|
||||
overflow: hidden;
|
||||
min-width: var(--tank-card-min-width);
|
||||
|
||||
.icon-wrapper {
|
||||
position: relative;
|
||||
@@ -24,7 +25,6 @@
|
||||
}
|
||||
|
||||
.icon {
|
||||
min-width: var(--tank-card-min-width);
|
||||
aspect-ratio: 4 / 3;
|
||||
position: relative;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { api } from "../../core/api/dynamic";
|
||||
import { clientUnmounted } from "../../core/game/unmounted";
|
||||
import { useAwait } from "../../hooks/useAwait";
|
||||
import { useGameStrings } from "../../hooks/useGameStrings";
|
||||
import { useLocale } from "../../hooks/useLocale";
|
||||
@@ -33,7 +34,9 @@ export function TankCard(props: PropsWithSkeleton<TankCardProps>) {
|
||||
<div
|
||||
className={styles.flag}
|
||||
style={{
|
||||
backgroundImage: `url(/api/nations/${tank!.tank!.nation}/card.webp)`,
|
||||
backgroundImage: clientUnmounted
|
||||
? "url(/api/unmounted/flag.png)"
|
||||
: `url(/api/nations/${tank!.tank!.nation}/card.webp)`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -42,7 +45,9 @@ export function TankCard(props: PropsWithSkeleton<TankCardProps>) {
|
||||
<div
|
||||
className={styles.icon}
|
||||
style={{
|
||||
backgroundImage: `url(/api/tanks/${props.id}.webp)`,
|
||||
backgroundImage: clientUnmounted
|
||||
? "url(/api/unmounted/tank.png)"
|
||||
: `url(/api/tanks/${props.id}.webp)`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export const clientUnmountedResponse = new Response(null, { status: 503 });
|
||||
|
||||
export const notFoundResponse = new Response(null, { status: 404 });
|
||||
@@ -1,5 +1,11 @@
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
import { GameInterface } from "@blitzkit/game";
|
||||
import { clientUnmounted } from "./unmounted";
|
||||
|
||||
export const game = new GameInterface(
|
||||
"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest",
|
||||
);
|
||||
let _game: GameInterface | null = null;
|
||||
|
||||
if (!clientUnmounted) {
|
||||
_game = new GameInterface(assertSecret(import.meta.env.PUBLIC_WOTB_CLIENT));
|
||||
}
|
||||
|
||||
export const game = _game;
|
||||
@@ -0,0 +1,5 @@
|
||||
export const clientUnmounted = !("PUBLIC_WOTB_CLIENT" in import.meta.env);
|
||||
|
||||
if (clientUnmounted) {
|
||||
console.warn("Running in client denied mode...");
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import type { GetStaticPaths } from "astro";
|
||||
import ClientUnmountedWarning from "../../components/ClientUnmountedWarning.astro";
|
||||
import ColorScale from "../../components/ColorScale.astro";
|
||||
import HomeCosmetics from "../../components/HomeCosmetics.astro";
|
||||
import HomeGames from "../../components/HomeGames.astro";
|
||||
@@ -8,6 +9,7 @@ import HomeHero from "../../components/HomeHero.astro";
|
||||
import HomePlayers from "../../components/HomePlayers.astro";
|
||||
import HomeTanks from "../../components/HomeTanks.astro";
|
||||
import HomeTechnical from "../../components/HomeTechnical.astro";
|
||||
import { clientUnmounted } from "../../core/game/unmounted";
|
||||
import { tools } from "../../core/tools/tools";
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
|
||||
@@ -28,6 +30,14 @@ const { locale } = Astro.props;
|
||||
|
||||
{Object.values(tools).map((tool) => <ColorScale color={tool.accent} />)}
|
||||
|
||||
{
|
||||
clientUnmounted && (
|
||||
<>
|
||||
<ColorScale color="red" />
|
||||
<ClientUnmountedWarning {locale} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
<HomeTanks {locale} />
|
||||
<HomePlayers {locale} />
|
||||
<HomeGames {locale} />
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Nation } from "@protos/game/proto/legacy/blitz_static_tank_component";
|
||||
import type { APIContext, GetStaticPaths } from "astro";
|
||||
import { clientUnmountedResponse } from "../../../../core/api/responses";
|
||||
import { game } from "../../../../core/game/game";
|
||||
import { clientUnmounted } from "../../../../core/game/unmounted";
|
||||
|
||||
export const getStaticPaths = (async () => {
|
||||
return Object.values(Nation)
|
||||
@@ -12,9 +14,11 @@ export const getStaticPaths = (async () => {
|
||||
* Even Noah can't save these animals.
|
||||
*/
|
||||
export async function GET({ params }: APIContext<never, { id: string }>) {
|
||||
if (clientUnmounted) return clientUnmountedResponse;
|
||||
|
||||
const enumName = Nation[Number(params.id)];
|
||||
const nationName = enumName.replace("NATION_", "").toLowerCase();
|
||||
const flag = game.flag(nationName);
|
||||
const flag = game!.flag(nationName);
|
||||
|
||||
return new Response(new Uint8Array(flag));
|
||||
}
|
||||
@@ -1,14 +1,21 @@
|
||||
import type { APIContext } from "astro";
|
||||
import { api } from "../../../core/api/dynamic";
|
||||
import {
|
||||
clientUnmountedResponse,
|
||||
notFoundResponse,
|
||||
} from "../../../core/api/responses";
|
||||
import { game } from "../../../core/game/game";
|
||||
import { clientUnmounted } from "../../../core/game/unmounted";
|
||||
|
||||
export { getStaticPaths } from "./[id].json";
|
||||
|
||||
export async function GET({ params }: APIContext<never, { id: string }>) {
|
||||
const tank = await api.tank(params.id);
|
||||
const image = game.tankBigIcon(params.id, tank.tank!.visual_data);
|
||||
if (clientUnmounted) return clientUnmountedResponse;
|
||||
|
||||
if (image.length === 0) return new Response(null, { status: 404 });
|
||||
const tank = await api.tank(params.id);
|
||||
const image = game!.tankBigIcon(params.id, tank.tank!.visual_data);
|
||||
|
||||
if (image.length === 0) return notFoundResponse;
|
||||
|
||||
return new Response(new Uint8Array(image));
|
||||
}
|
||||
Reference in new issue
Block a user