├── src ├── Constants.ts ├── react-app-env.d.ts ├── sounds │ └── warning-beep.mp3 ├── worker.ts ├── types │ ├── alltypes.d.ts │ ├── airbase.ts │ └── entity.ts ├── mgrs.d.ts ├── dcs │ ├── maps │ │ ├── Marianas.ts │ │ ├── Kola.ts │ │ ├── Sinai.ts │ │ ├── Syria.ts │ │ ├── Nevada.ts │ │ ├── Afghanistan.ts │ │ ├── Normandy.ts │ │ ├── Caucasus.ts │ │ ├── Falklands.ts │ │ ├── TheChannel.ts │ │ ├── PersianGulf.ts │ │ └── DCSMap.ts │ └── aircraft.ts ├── index.css ├── index.tsx ├── stores │ ├── HackStore.tsx │ ├── SettingsStore.tsx │ ├── EntityMetadataStore.tsx │ ├── ProfileStore.tsx │ ├── ServerStore.tsx │ ├── TrackStore.tsx │ └── AlertStore.tsx ├── index.html ├── hooks │ ├── useKeyPress.tsx │ ├── useRenderCombatZones.tsx │ └── useRenderGroundUnits.tsx ├── components │ ├── MapIcon.tsx │ ├── ScratchPad.tsx │ ├── DetailedCoords.tsx │ ├── ProfileTagList.tsx │ ├── MissionTimer.tsx │ ├── QuestConsoleTab.tsx │ ├── ProfileSettings.tsx │ ├── MapSettings.tsx │ ├── MapEntity.tsx │ └── DrawConsoleTab.tsx ├── DCSBattlegroundClient.ts ├── tacview │ └── client.go ├── data │ └── airbases │ │ ├── marianaislands.json │ │ ├── kola.json │ │ ├── afghanistan.json │ │ ├── thechannel.json │ │ ├── nevada.json │ │ └── caucasus.json ├── DataSaver.ts ├── App.tsx └── util.tsx ├── dist ├── .gitignore ├── favicon.ico ├── Dot Cross.cur ├── connected.png ├── notconnected.png ├── images │ └── control │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 5.png │ │ ├── 2_2.png │ │ ├── 5_1.png │ │ ├── kedu.png │ │ ├── close-2.png │ │ ├── ico-dot.png │ │ ├── layer.png │ │ ├── infownd-close.png │ │ └── infownd-close-hover.png └── Map-Marker-Ball-Chartreuse-icon.png ├── winres ├── icon.png ├── icon16.png └── winres.json ├── rsrc_windows_386.syso ├── rsrc_windows_amd64.syso ├── assets.go ├── postcss.config.js ├── .ci ├── init.ts └── entrypoint.ts ├── .gitignore ├── tailwind.config.js ├── dep └── maptalks │ ├── README.md │ ├── package.json │ └── LICENSE ├── server ├── postgres_client.go ├── tacview_client.go ├── config.go ├── static.go └── state.go ├── tsconfig.json ├── go.mod ├── cmd └── dcsbg-server │ └── main.go ├── webpack.config.js ├── example.config.json ├── docs └── API.md ├── tacview └── client.go ├── package.json ├── README.md └── go.sum /src/Constants.ts: -------------------------------------------------------------------------------- 1 | export const FONT_FAMILY = "arial"; 2 | -------------------------------------------------------------------------------- /dist/.gitignore: -------------------------------------------------------------------------------- 1 | /index.html 2 | /*.css 3 | /*.js 4 | /*.txt 5 | /*.mp3 6 | -------------------------------------------------------------------------------- /dist/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/favicon.ico -------------------------------------------------------------------------------- /winres/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/winres/icon.png -------------------------------------------------------------------------------- /dist/Dot Cross.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/Dot Cross.cur -------------------------------------------------------------------------------- /dist/connected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/connected.png -------------------------------------------------------------------------------- /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | declare module "*.mp3"; 3 | -------------------------------------------------------------------------------- /winres/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/winres/icon16.png -------------------------------------------------------------------------------- /dist/notconnected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/notconnected.png -------------------------------------------------------------------------------- /rsrc_windows_386.syso: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/rsrc_windows_386.syso -------------------------------------------------------------------------------- /rsrc_windows_amd64.syso: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/rsrc_windows_amd64.syso -------------------------------------------------------------------------------- /dist/images/control/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/1.png -------------------------------------------------------------------------------- /dist/images/control/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/2.png -------------------------------------------------------------------------------- /dist/images/control/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/3.png -------------------------------------------------------------------------------- /dist/images/control/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/5.png -------------------------------------------------------------------------------- /assets.go: -------------------------------------------------------------------------------- 1 | package sneaker 2 | 3 | import ( 4 | "embed" 5 | ) 6 | 7 | //go:embed dist/* 8 | var Static embed.FS 9 | -------------------------------------------------------------------------------- /dist/images/control/2_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/2_2.png -------------------------------------------------------------------------------- /dist/images/control/5_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/5_1.png -------------------------------------------------------------------------------- /dist/images/control/kedu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/kedu.png -------------------------------------------------------------------------------- /src/sounds/warning-beep.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/src/sounds/warning-beep.mp3 -------------------------------------------------------------------------------- /dist/images/control/close-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/close-2.png -------------------------------------------------------------------------------- /dist/images/control/ico-dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/ico-dot.png -------------------------------------------------------------------------------- /dist/images/control/layer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/layer.png -------------------------------------------------------------------------------- /dist/images/control/infownd-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/infownd-close.png -------------------------------------------------------------------------------- /dist/Map-Marker-Ball-Chartreuse-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/Map-Marker-Ball-Chartreuse-icon.png -------------------------------------------------------------------------------- /src/worker.ts: -------------------------------------------------------------------------------- 1 | const ctx: Worker = self as any; 2 | 3 | ctx.onmessage = ({ data }) => { 4 | console.log("Worker data: ", data); 5 | }; 6 | -------------------------------------------------------------------------------- /dist/images/control/infownd-close-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frigondin/DCSBattleground/HEAD/dist/images/control/infownd-close-hover.png -------------------------------------------------------------------------------- /src/types/alltypes.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-rounded-image'; 2 | declare module 'maptalks.animatemarker'; 3 | //declare module 'maptalks'; 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/mgrs.d.ts: -------------------------------------------------------------------------------- 1 | declare module "mgrs" { 2 | export function forward(ll: [number, number], accuracy?: number): string; 3 | export function toPoint(mgrs: string): [number, number]; 4 | } 5 | -------------------------------------------------------------------------------- /src/dcs/maps/Marianas.ts: -------------------------------------------------------------------------------- 1 | import { DCSMap } from "./DCSMap"; 2 | 3 | export const Marianas: DCSMap = { 4 | name: "Marianas", 5 | center: [16.21, 145.40], 6 | magDec: 0, 7 | airports: [], 8 | }; 9 | -------------------------------------------------------------------------------- /src/dcs/maps/Kola.ts: -------------------------------------------------------------------------------- 1 | import KolaAirBases from "../../data/airbases/kola.json"; 2 | import { convertRawAirBaseData, DCSMap } from "./DCSMap"; 3 | 4 | export const Kola: DCSMap = { 5 | name: "Kola", 6 | center: [67, 26], 7 | magDec: 13, 8 | airports: convertRawAirBaseData(KolaAirBases), 9 | }; -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | "postcss-fontpath": { checkFiles: true, ie8Fix: true }, 4 | tailwindcss: "tailwind.config.js", 5 | //'@fullhuman/postcss-purgecss': process.env.NODE_ENV === 'development', 6 | autoprefixer: {}, 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /src/dcs/maps/Sinai.ts: -------------------------------------------------------------------------------- 1 | import SinaiAirBases from "../../data/airbases/sinaimap.json"; 2 | import { convertRawAirBaseData, DCSMap } from "./DCSMap"; 3 | 4 | export const Sinai: DCSMap = { 5 | name: "Sinai", 6 | center: [30, 32], 7 | magDec: 5, 8 | airports: convertRawAirBaseData(SinaiAirBases), 9 | }; 10 | -------------------------------------------------------------------------------- /src/dcs/maps/Syria.ts: -------------------------------------------------------------------------------- 1 | import SyriaAirBases from "../../data/airbases/syria.json"; 2 | import { convertRawAirBaseData, DCSMap } from "./DCSMap"; 3 | 4 | export const Syria: DCSMap = { 5 | name: "Syria", 6 | center: [35.57, 35.69], 7 | magDec: 5, 8 | airports: convertRawAirBaseData(SyriaAirBases), 9 | }; 10 | -------------------------------------------------------------------------------- /src/dcs/maps/Nevada.ts: -------------------------------------------------------------------------------- 1 | import NevadaAirBases from "../../data/airbases/nevada.json"; 2 | import { convertRawAirBaseData, DCSMap } from "./DCSMap"; 3 | 4 | export const Nevada: DCSMap = { 5 | name: "Nevada", 6 | center: [37.5, -115.15], 7 | magDec: 11, 8 | airports: convertRawAirBaseData(NevadaAirBases), 9 | }; 10 | -------------------------------------------------------------------------------- /src/dcs/maps/Afghanistan.ts: -------------------------------------------------------------------------------- 1 | import AfghanistanAirBases from "../../data/airbases/afghanistan.json"; 2 | import { convertRawAirBaseData, DCSMap } from "./DCSMap"; 3 | 4 | export const Afghanistan: DCSMap = { 5 | name: "Afghanistan", 6 | center: [33, 64], 7 | magDec: 3, 8 | airports: convertRawAirBaseData(AfghanistanAirBases), 9 | }; -------------------------------------------------------------------------------- /src/dcs/maps/Normandy.ts: -------------------------------------------------------------------------------- 1 | import NormandyAirBases from "../../data/airbases/normandy.json"; 2 | import { convertRawAirBaseData, DCSMap } from "./DCSMap"; 3 | 4 | export const Normandy: DCSMap = { 5 | name: "Normandy", 6 | center: [50.12, 0.3], 7 | magDec: 1, 8 | airports: convertRawAirBaseData(NormandyAirBases), 9 | }; 10 | -------------------------------------------------------------------------------- /src/dcs/maps/Caucasus.ts: -------------------------------------------------------------------------------- 1 | import CaucasusAirBases from "../../data/airbases/caucasus.json"; 2 | import { convertRawAirBaseData, DCSMap } from "./DCSMap"; 3 | 4 | export const Caucasus: DCSMap = { 5 | name: "Caucasus", 6 | center: [43.53, 41.11], 7 | magDec: -6, 8 | airports: convertRawAirBaseData(CaucasusAirBases), 9 | }; 10 | -------------------------------------------------------------------------------- /.ci/init.ts: -------------------------------------------------------------------------------- 1 | import { GithubCheckRunPlugin } from "pkg/buildy/github@1/plugins.ts"; 2 | import { registerPlugin, Workspace } from "runtime/core.ts"; 3 | 4 | export async function setup(ws: Workspace) { 5 | registerPlugin( 6 | new GithubCheckRunPlugin({ 7 | repositorySlug: "b1naryth1ef/sneaker", 8 | }), 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /src/dcs/maps/Falklands.ts: -------------------------------------------------------------------------------- 1 | import FalklandsAirBases from "../../data/airbases/falklands.json"; 2 | import { convertRawAirBaseData, DCSMap } from "./DCSMap"; 3 | 4 | export const Falklands: DCSMap = { 5 | name: "Falklands", 6 | center: [-52.05, -64.42], 7 | magDec: 6, 8 | airports: convertRawAirBaseData(FalklandsAirBases), 9 | }; 10 | -------------------------------------------------------------------------------- /src/dcs/maps/TheChannel.ts: -------------------------------------------------------------------------------- 1 | import TheChannelAirBases from "../../data/airbases/thechannel.json"; 2 | import { convertRawAirBaseData, DCSMap } from "./DCSMap"; 3 | 4 | export const TheChannel: DCSMap = { 5 | name: "TheChannel", 6 | center: [50.52, 1.35], 7 | magDec: 1, 8 | airports: convertRawAirBaseData(TheChannelAirBases), 9 | }; 10 | -------------------------------------------------------------------------------- /src/dcs/maps/PersianGulf.ts: -------------------------------------------------------------------------------- 1 | import PersianGulfAirBases from "../../data/airbases/persiangulf.json"; 2 | import { convertRawAirBaseData, DCSMap } from "./DCSMap"; 3 | 4 | export const PersianGulf: DCSMap = { 5 | name: "Persian Gulf", 6 | center: [26.10, 55.48], 7 | magDec: 2, 8 | airports: convertRawAirBaseData(PersianGulfAirBases), 9 | }; 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /.pnp 3 | .pnp.js 4 | /build 5 | .DS_Store 6 | .env.local 7 | .env.development.local 8 | .env.test.local 9 | .env.production.local 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | /scratch.txt 14 | /config.json 15 | /DCSBattleground.exe 16 | /DCSBattleground 17 | /sneaker-server 18 | /state.json 19 | *.bak 20 | *.exe -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | /* Chrome, Safari and Opera */ 6 | .no-scrollbar::-webkit-scrollbar { 7 | display: none; 8 | } 9 | 10 | .no-scrollbar { 11 | -ms-overflow-style: none; /* IE and Edge */ 12 | scrollbar-width: none; /* Firefox */ 13 | } 14 | 15 | .ReactCollapse--collapse { 16 | transition: height 500ms; 17 | } -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import { BrowserRouter } from "react-router-dom"; 4 | import App from "./App"; 5 | import { dataSaverLoop } from "./DataSaver"; 6 | import "./index.css"; 7 | 8 | setTimeout(dataSaverLoop, 5000); 9 | 10 | ReactDOM.render( 11 | 12 | 13 | , 14 | document.getElementById("root") 15 | ); 16 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-undef 2 | module.exports = { 3 | content: ["./src/**/*.{js,jsx,ts,tsx}", "./src/index.html"], 4 | safelist: { 5 | standard: [], 6 | }, 7 | darkMode: 'media', // or 'media' or 'class' 8 | theme: {}, 9 | variants: { 10 | extend: { 11 | "border-b": ["hover"], 12 | }, 13 | }, 14 | plugins: [ 15 | require('tailwind-scrollbar'), 16 | ], 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /src/types/airbase.ts: -------------------------------------------------------------------------------- 1 | export type RawRunwayData = { 2 | Name: number; 3 | course: number; 4 | length: number; 5 | width: number; 6 | }; 7 | 8 | export type RawAirbaseData = { 9 | callsign: string; 10 | cat: number; 11 | desc: { 12 | attributes: Record; 13 | category: number; 14 | displayName: string; 15 | life: number; 16 | typeName: string; 17 | }; 18 | point: [number, number, number]; 19 | id: number; 20 | runways: Array; 21 | }; 22 | -------------------------------------------------------------------------------- /dep/maptalks/README.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | > `npm install --save @types/maptalks` 3 | 4 | # Summary 5 | This package contains type definitions for maptalks (https://github.com/maptalks/maptalks.js). 6 | 7 | # Details 8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/maptalks. 9 | 10 | ### Additional Details 11 | * Last updated: Thu, 08 Jul 2021 16:23:58 GMT 12 | * Dependencies: none 13 | * Global values: none 14 | 15 | # Credits 16 | These definitions were written by [Yu Yan](https://github.com/yanyu510). 17 | -------------------------------------------------------------------------------- /server/postgres_client.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "fmt" 5 | "database/sql" 6 | //"net/http" 7 | //"log" 8 | _ "github.com/lib/pq" 9 | ) 10 | 11 | var db *sql.DB 12 | 13 | func initDB(config *Config) { 14 | var err error 15 | 16 | if config.Serverbot { 17 | connStr := config.Database 18 | db, err = sql.Open("postgres", connStr) 19 | 20 | if err != nil { 21 | panic(err) 22 | } 23 | 24 | if err = db.Ping(); err != nil { 25 | panic(err) 26 | } 27 | // this will be printed in the terminal, confirming the connection to the database 28 | fmt.Println("The database is connected") 29 | } 30 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext", "webworker"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "esModuleInterop": true, 8 | "allowSyntheticDefaultImports": true, 9 | "strict": true, 10 | "forceConsistentCasingInFileNames": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "module": "esnext", 13 | "moduleResolution": "node", 14 | "resolveJsonModule": true, 15 | "isolatedModules": false, 16 | "noEmit": false, 17 | "jsx": "react-jsx", 18 | "downlevelIteration": true 19 | }, 20 | "include": ["src"] 21 | } 22 | -------------------------------------------------------------------------------- /src/stores/HackStore.tsx: -------------------------------------------------------------------------------- 1 | import Immutable from "immutable"; 2 | import create from "zustand"; 3 | 4 | type HackStoreData = { 5 | hacks: Immutable.Set; 6 | }; 7 | export const hackStore = create(() => { 8 | return { hacks: Immutable.Set() }; 9 | }); 10 | 11 | export function pushHack(): number { 12 | const startAt = new Date().getTime(); 13 | hackStore.setState((state) => { 14 | return { hacks: state.hacks.add(startAt) }; 15 | }); 16 | return startAt; 17 | } 18 | 19 | export function popHack(hackTime: number) { 20 | hackStore.setState((state) => { 21 | return { hacks: state.hacks.remove(hackTime) }; 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DCS Battleground 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /src/hooks/useKeyPress.tsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | 3 | export function useKeyPress(targetKey: string) { 4 | const [keyPressed, setKeyPressed] = useState(false); 5 | 6 | const onDown = ({ key }: KeyboardEvent) => { 7 | if (key === targetKey) { 8 | setKeyPressed(true); 9 | } 10 | }; 11 | 12 | const onUp = ({ key }: KeyboardEvent) => { 13 | if (key === targetKey) { 14 | setKeyPressed(false); 15 | } 16 | }; 17 | 18 | useEffect(() => { 19 | window.addEventListener("keydown", onDown); 20 | window.addEventListener("keyup", onUp); 21 | return () => { 22 | window.removeEventListener("keydown", onDown); 23 | window.removeEventListener("keyup", onUp); 24 | }; 25 | }, []); 26 | return keyPressed; 27 | } 28 | -------------------------------------------------------------------------------- /dep/maptalks/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@types/maptalks", 3 | "version": "0.49.1", 4 | "description": "TypeScript definitions for maptalks", 5 | "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/maptalks", 6 | "license": "MIT", 7 | "contributors": [ 8 | { 9 | "name": "Yu Yan", 10 | "url": "https://github.com/yanyu510", 11 | "githubUsername": "yanyu510" 12 | } 13 | ], 14 | "main": "", 15 | "types": "index.d.ts", 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", 19 | "directory": "types/maptalks" 20 | }, 21 | "scripts": {}, 22 | "dependencies": {}, 23 | "typesPublisherContentHash": "1d0e094c9a2ede9ab0a4cb92a892c4a7a799b507c1f5545c89035606e154b66c", 24 | "typeScriptVersion": "3.6" 25 | } -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/b1naryth1ef/sneaker 2 | 3 | go 1.23.4 4 | 5 | require ( 6 | github.com/alioygur/gores v1.2.2 7 | github.com/b1naryth1ef/jambon v0.0.4-0.20220527200438-d39a4cc60cbe 8 | github.com/bwmarrin/discordgo v0.23.3-0.20211228023845-29269347e820 9 | github.com/go-chi/chi/v5 v5.0.7 10 | github.com/go-chi/cors v1.2.0 11 | github.com/google/uuid v1.3.0 12 | github.com/lib/pq v1.10.7 13 | github.com/realTristan/disgoauth v1.0.2 14 | github.com/spkg/bom v1.0.0 15 | github.com/urfave/cli/v2 v2.3.0 16 | ) 17 | 18 | require ( 19 | github.com/akavel/rsrc v0.10.2 // indirect 20 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect 21 | github.com/gorilla/websocket v1.4.2 // indirect 22 | github.com/russross/blackfriday/v2 v2.0.1 // indirect 23 | github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect 24 | golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect 25 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect 26 | ) 27 | -------------------------------------------------------------------------------- /src/components/MapIcon.tsx: -------------------------------------------------------------------------------- 1 | import ms from "milsymbol"; 2 | import React from "react"; 3 | import { Entity } from "../types/entity"; 4 | 5 | export const colorMode: ms.ColorMode = ms.ColorMode( 6 | "#ffffff", 7 | "#17c2f6", 8 | "#ff8080", 9 | "#FDE68A", 10 | "#ffffff" 11 | ); 12 | 13 | export function MapIcon({ 14 | obj, 15 | className, 16 | size, 17 | }: { 18 | obj: Entity | string; 19 | className?: string; 20 | size?: number; 21 | }): JSX.Element { 22 | if (typeof obj === "object" && obj.types.length === 0) { 23 | return <>; 24 | } 25 | 26 | const svg = new ms.Symbol(typeof obj === "object" ? obj.sidc : obj, { 27 | size: size || 26, 28 | frame: true, 29 | fill: false, 30 | colorMode: colorMode, 31 | strokeWidth: 8, 32 | }).asSVG(); 33 | return ( 34 | 39 | ); 40 | } 41 | -------------------------------------------------------------------------------- /src/dcs/maps/DCSMap.ts: -------------------------------------------------------------------------------- 1 | import { RawAirbaseData } from "../../types/airbase"; 2 | 3 | export type DCSMap = { 4 | name: string; 5 | center: [number, number]; 6 | magDec: number; 7 | airports: Array; 8 | }; 9 | 10 | export type Airport = { 11 | name: string; 12 | // latitude, longitude, elevation (ft) 13 | position: [number, number, number]; 14 | runways?: Array; 15 | }; 16 | 17 | export type Runway = { 18 | heading: number; 19 | ils?: number; 20 | }; 21 | 22 | export function convertRawAirBaseData( 23 | airBaseData: Record, 24 | ): Array { 25 | return (Object.values(airBaseData) as Array) 26 | .map( 27 | (it) => { 28 | return { 29 | name: it.callsign, 30 | position: it.point, 31 | runways: it.runways.map((rw) => { 32 | return { 33 | heading: Math.round(rw.course), 34 | }; 35 | }), 36 | }; 37 | }, 38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /server/tacview_client.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "fmt" 5 | //"strconv" 6 | 7 | "github.com/b1naryth1ef/jambon/tacview" 8 | //"./tacview" 9 | ) 10 | 11 | type TacViewClient struct { 12 | host string 13 | port int 14 | password string 15 | } 16 | 17 | func NewTacViewClient(host string, port int, password string) *TacViewClient { 18 | if port == 0 { 19 | port = 42674 20 | } 21 | //fmt.Println(host) 22 | //fmt.Println(strconv.Itoa(port)) 23 | //fmt.Println(password) 24 | 25 | return &TacViewClient{host: host, port: port, password: password} 26 | } 27 | 28 | 29 | func (c *TacViewClient) Start() (*tacview.Header, chan *tacview.TimeFrame, error) { 30 | reader, err := tacview.NewRealTimeReader(fmt.Sprintf("%s:%d", c.host, c.port), "dcsbgserver", c.password) 31 | if err != nil { 32 | //fmt.Println(err) 33 | return nil, nil, err 34 | } 35 | 36 | data := make(chan *tacview.TimeFrame, 1) 37 | go reader.ProcessTimeFrames(1, data) 38 | return &reader.Header, data, nil 39 | } 40 | -------------------------------------------------------------------------------- /src/stores/SettingsStore.tsx: -------------------------------------------------------------------------------- 1 | import create from "zustand"; 2 | 3 | export enum GroundUnitMode { 4 | FRIENDLY = "friendly", 5 | ENEMY = "enemy", 6 | } 7 | 8 | export enum FlightUnitMode { 9 | FRIENDLY = "friendly", 10 | ENEMY = "enemy", 11 | } 12 | 13 | export type SettingsStoreData = { 14 | map: { 15 | showTrackIcons?: boolean; 16 | showTrackLabels?: boolean; 17 | trackTrailLength?: number; 18 | groundUnitMode?: GroundUnitMode; 19 | }; 20 | }; 21 | 22 | export const settingsStore = create(() => { 23 | const localData = localStorage.getItem("settings"); 24 | if (localData) { 25 | return JSON.parse(localData) as SettingsStoreData; 26 | } 27 | return { 28 | map: { 29 | showTrackIcons: true, 30 | showTrackLabels: true, 31 | trackTrailLength: 9, 32 | groundUnitMode: GroundUnitMode.ENEMY, 33 | }, 34 | }; 35 | }); 36 | 37 | settingsStore.subscribe((state) => { 38 | localStorage.setItem("settings", JSON.stringify(state)); 39 | }); 40 | -------------------------------------------------------------------------------- /src/components/ScratchPad.tsx: -------------------------------------------------------------------------------- 1 | import { throttle } from "lodash"; 2 | import { useEffect, useState } from "react"; 3 | import { BiX } from "react-icons/bi"; 4 | 5 | export default function ScratchPad({ close }: { close: () => void }) { 6 | const [contents, setContents] = useState( 7 | localStorage.getItem("scratchpad") || "" 8 | ); 9 | 10 | useEffect( 11 | throttle(() => { 12 | localStorage.setItem("scratchpad", contents); 13 | }, 250), 14 | [contents] 15 | ); 16 | 17 | return ( 18 |
19 |
20 |
Scratch Pad
21 | 24 |
25 |