Giter VIP home page Giter VIP logo

amongus-protocol's Introduction

i am good at typescript, nim and c#

languages i know in order of profiency, although all at a reasonable level:
- typescript (everything)
- javascript
- c#         (game modding)
- zig        (game development)
- c++        (game hacking, udp sockets)
- c          (udp sockets, language compiler)
- nim

i have used:
- express
- tauri
- vue         (veutify)
- svelte      (sveltekit, routify, svelte-material-ui)
- node.js
- deno
- redis       (caching, game load-balancing)
- mongodb     (mongoose, typegoose)
- discord api (too much, discord.js, made my own library)
- bepinex

i also have *a lot* of experience in among us if that's useful to anyone

amongus-protocol's People

Contributors

3p511on avatar edqx avatar mathmakgakpak avatar przebor avatar tvde1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

amongus-protocol's Issues

TSConfig: esnext and es2020

This is causing a lot of issues in enviroments without any compiation and lts node versions. Consider changing this to something older that will work on all enviroments.

Mistike on Game Code Wikipage

On the wiki page for the Game Code it says:

V1 codes are 4 characters long and V2 codes are 6 characters long and use standard ASCII encoding. V2 codes use a special character map to map the characters to integer values.

I believe it should actually say

V1 codes are 4 characters long and use standard ASCII encoding. V2 codes are 6 characters long and use a special character map to map the characters to integer values.

Running test script throws Join error: 0 - (Forcibly disconnected from server.)

Not quite sure what's happening but running the default test script in my environment is throwing Join error: 0 every single time, steps I used:

Installing

Input

git clone https://github.com/edqx/amongus-protocol

Output

Cloning into 'amongus-protocol'...
remote: Enumerating objects: 59, done.
remote: Counting objects: 100% (59/59), done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 2791 (delta 33), reused 32 (delta 16), pack-reused 2732
Receiving objects: 100% (2791/2791), 865.37 KiB | 1.33 MiB/s, done.
Resolving deltas: 100% (2451/2451), done.

Input

cd amongus-protocol
npm i

Output

> [email protected] postinstall C:\Users\mateu\Documents\GitHub\aptest\amongus-protocol
> npm run build


> [email protected] build C:\Users\mateu\Documents\GitHub\aptest\amongus-protocol
> tsc -p .

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of typedoc@^0.11.1 but none is installed. You must install peer dependencies yourself.

added 52 packages from 396 contributors and audited 52 packages in 33.621s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Running

Input

npm run test

Output

> [email protected] test C:\Users\mateu\Documents\GitHub\aptest\amongus-protocol
> npm run load ts/test/main.ts


> [email protected] load C:\Users\mateu\Documents\GitHub\aptest\amongus-protocol
> node --loader ts-node/esm "ts/test/main.ts"

(node:17576) ExperimentalWarning: The ESM module loader is experimental.
(node:17576) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(node:17576) UnhandledPromiseRejectionWarning: Error: Join error: 0 (Forcibly disconnected from server. The remote sent a disconnect request.)
    at AmongusClient.<anonymous> (file:///C:/Users/mateu/Documents/GitHub/aptest/amongus-protocol/ts/lib/Client.ts:602:23)
    at Generator.next (<anonymous>)
    at fulfilled (file:///C:/Users/mateu/Documents/GitHub/aptest/amongus-protocol/ts/lib/Client.ts:4:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:17576) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17576) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Env

OS: Windows 10
Node: v12.18.4
TS: 4.0.5 (same as package.json)
ts-node: 9.0.0 (same as package.json)

Error

Error: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.

Code: import {
AmongusClient,
MasterServers,
ColourID,
HatID,
} from "./node_modules/amongus-protocol/js/index"

const server = MasterServers.EU[0];

const client = new AmongusClient({

});

await client.connect(server[0], server[1], "weakeyes");

const game = await client.join(process.argv[2]);

game.me.on("spawn", () => {
game.me.setName("weakeyes");
game.me.setColour(ColourID.Black);
game.me.setHat(HatID.Plague);
});

(I copy pasted the code from the example)

I don't have any experience with typescript can anyone help me?

Error

TypeError: Cannot read property 'GameData' of undefined
at PlayerClient.get PlayerData [as PlayerData] (file:///C:/Users/******/node_modules/amongus-protocol/js/lib/struct/PlayerClient.js:52
:42)

clientver in the Hello packet should be parsed as int32BE instead of int32LE

Not 100% positive on this because honestly I don't fully understand that stuff.

But I was having an issue with the game reporting that I was running an older version of the game and changing the Parser to read the clientver as big endian seemed to fix it.

For context I am using the parser and composer to read/modify the packets being sent from the real game to the server, so I was parsing the Hello packet and then composing it and then sending it to the server. Which resulted in the old game error, even though I wasn't modifying the packet at all.

Specifically the line I'm talking about:

https://github.com/edqx/amongus-protocol/blob/master/ts/lib/Parser.ts#L476

and here it is in the compose function being wrote as big endian:

https://github.com/edqx/amongus-protocol/blob/master/ts/lib/Compose.ts#L428

Question

In Game Class there is a event "murder", Client will emit it only if client kill anyone or any player in game killed anyone ?

Question

So I am trying to use this package but I have come across a couple of errors and I can not seem to solve them so I am looking for help. So I figured out the first to which were to specify es5 in the tsc command as well as to specify --downlevelIteration but I am still left with this error node_modules/amongus-protocol/ts/lib/util/BufferWriter.ts:1:8 - error TS1192: Module '"util"' has no default export. and others similar to it. I would appreciate any help or answer once again thank you for the help I am kind of new to typescript so ya.

Add more versatile logging system

short question:

Problem: debug option being set to false does not guarantee not seeing any messages in the console during run.

  • Solution: add a debug condition check in the ShipStatus component

detailed solution:

  • Actually having one debug option isn't enough to maintain debugging. It would be nice to have a LogLevel enum with bitmasks and a corresponding option to see raw data and/or decoded packets and/or emitted events and/or fired listeners, etc.

Function PlayerData throws error

What I tried to do - make room and get into it, get player name PlayerClient.name() on playerJoin.
File: struct>PlayerClient
Function: PlayerData
Arguments: no arguments
Log, when tried to PlayerClient.PlayerData():
(node:1776) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'PlayerControl' of undefined at PlayerClient.get PlayerData [as PlayerData] (file:///path/to/amongus-protocol/js/lib/struct/PlayerClient.js:47:75) at Game.<anonymous> (file:///path/to/index.js:36:19) at Game.emit (events.js:315:20) at Game._playerJoin (file:///path/to/amongus-protocol/js/lib/struct/Game.js:172:14) at Game.<anonymous> (file:///path/to/amongus-protocol/js/lib/struct/Game.js:179:18) at Generator.next (<anonymous>) at file:///path/to/amongus-protocol/js/lib/struct/Game.js:7:71 at new Promise (<anonymous>) at __awaiter (file:///path/to/amongus-protocol/js/lib/struct/Game.js:3:12) at Game.playerJoin (file:///path/to/amongus-protocol/js/lib/struct/Game.js:175:16)

Install fails horribly [typescript issue]

Here are my logs:

> tsc -p .

ts/index.ts:14:10 - error TS1005: 'from' expected.

14 export * as Packets from "./lib/interfaces/Packets.js"
            ~~

ts/index.ts:14:13 - error TS1005: ';' expected.

14 export * as Packets from "./lib/interfaces/Packets.js"
               ~~~~~~~

ts/index.ts:14:21 - error TS1005: ';' expected.

14 export * as Packets from "./lib/interfaces/Packets.js"
                       ~~~~

ts/index.ts:14:26 - error TS1005: ';' expected.

14 export * as Packets from "./lib/interfaces/Packets.js"
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ts/index.ts:16:10 - error TS1005: 'from' expected.

16 export * as Types from "./lib/interfaces/Types.js"
            ~~

ts/index.ts:16:13 - error TS1005: ';' expected.

16 export * as Types from "./lib/interfaces/Types.js"
               ~~~~~

ts/index.ts:16:19 - error TS1005: ';' expected.

16 export * as Types from "./lib/interfaces/Types.js"
                     ~~~~

ts/index.ts:16:24 - error TS1005: ';' expected.

16 export * as Types from "./lib/interfaces/Types.js"
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~

ts/index.ts:31:10 - error TS1005: 'from' expected.

31 export * as Component from "./components.js"
            ~~

ts/index.ts:31:13 - error TS1005: ';' expected.

31 export * as Component from "./components.js"
               ~~~~~~~~~

ts/index.ts:31:23 - error TS1005: ';' expected.

31 export * as Component from "./components.js"
                         ~~~~

ts/index.ts:31:28 - error TS1005: ';' expected.

31 export * as Component from "./components.js"
                              ~~~~~~~~~~~~~~~~~

ts/index.ts:32:10 - error TS1005: 'from' expected.

32 export * as GameObject from "./objects.js"
            ~~

ts/index.ts:32:13 - error TS1005: ';' expected.

32 export * as GameObject from "./objects.js"
               ~~~~~~~~~~

ts/index.ts:32:24 - error TS1005: ';' expected.

32 export * as GameObject from "./objects.js"
                          ~~~~

ts/index.ts:32:29 - error TS1005: ';' expected.

32 export * as GameObject from "./objects.js"
                               ~~~~~~~~~~~~~~

Not sure what this means as I am not that familiar with TS but I think it might be a version issue?

Node version 12.19.0
NPM version 6.14.8
TSC version 3.7.2

Module '"util"' has no default export.

Error:

>>> tsc -t ES5 --downlevelIteration index.ts                                                                                                                                     
node_modules/amongus-protocol/js/lib/Client.d.ts:2:8 - error TS1192: Module '"dgram"' has no default export.

2 import dgram from "dgram";
         ~~~~~

node_modules/amongus-protocol/js/lib/util/BufferReader.d.ts:2:8 - error TS1192: Module '"util"' has no default export.

2 import util from "util";
         ~~~~

node_modules/amongus-protocol/js/lib/util/BufferReader.d.ts:12:5 - error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.

12     [util.inspect.custom](): Buffer;
       ~~~~~~~~~~~~~~~~~~~~~

node_modules/amongus-protocol/js/lib/util/BufferWriter.d.ts:2:8 - error TS1192: Module '"util"' has no default export.

2 import util from "util";
         ~~~~

node_modules/amongus-protocol/js/lib/util/BufferWriter.d.ts:14:5 - error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.

14     [util.inspect.custom](): Buffer;
       ~~~~~~~~~~~~~~~~~~~~~

node_modules/amongus-protocol/ts/lib/Client.ts:1:8 - error TS1192: Module '"dgram"' has no default export.

1 import dgram from "dgram"
         ~~~~~

node_modules/amongus-protocol/ts/lib/Client.ts:2:8 - error TS1192: Module '"util"' has no default export.

2 import util from "util"
         ~~~~

node_modules/amongus-protocol/ts/lib/util/BufferReader.ts:1:8 - error TS1192: Module '"util"' has no default export.

1 import util from "util"
         ~~~~

node_modules/amongus-protocol/ts/lib/util/BufferWriter.ts:1:8 - error TS1192: Module '"util"' has no default export.

1 import util from "util"
         ~~~~


Found 9 errors.

Node: 15.2.1
NPM: 6.14.9
TS: 4.1.2

ERR_REQUIRE_ESM

code:
import {
AmongusClient,
MasterServers,
ColourID,
HatID,
} from "amongus-protocol"

(async() => {
const server = MasterServers.EU[0];

const client = new AmongusClient({});

await client.connect(server[0], server[1], "weakeyes");

client.search();
//const game = await client.join();

//game.me.on("spawn", () => {
// game.me.setName("weakeyes");
/// game.me.setColour(ColourID.Black);
// game.me.setHat(HatID.Plague);
//});
})
Error:
internal/modules/cjs/loader.js:1031
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/..../amongus/node_modules/amongus-protocol/js/index.js
require() of ES modules is not supported.
require() of /home/...../amongus/node_modules/amongus-protocol/js/index.js from /home/...../amongus/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename /home/..../amongus/node_modules/amongus-protocol/js/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/......./amongus/node_modules/amongus-protocol/package.json.

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1031:13)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/......./amongus/index.js:39:26)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14) {

code: 'ERR_REQUIRE_ESM'
}

Can anyone help me?

Proper Tut?

I wanted to use it, but it didn't work. i never use TypeScript, so maybe it is because of that, but when i try to compile it, or install with npm it gives out errors and does't work.

ExpirementalWarning

Error:
node:7619) ExperimentalWarning: The ESM module loader is experimental.
file:///home/....../amongus/index.js:38
exports.__esModule = true;
^

ReferenceError: exports is not defined
at file:///home/...../amongus/index.js:38:1
at ModuleJob.run (internal/modules/esm/module_job.js:146:37)
at async Loader.import (internal/modules/esm/loader.js:182:24)
at async Object.loadESM (internal/process/esm_loader.js:84:5)

TypeError: Cannot read property 'PlayerControl' of undefined

When i host a game via your module and i try to join the lobby with my phone i get this error

Complete Error:
(node:3380) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'PlayerControl' of undefined
at Game. (file:///C:/Users/Rohit/Desktop/Other/AmongUS2/node_modules/amongus-protocol/js/lib/struct/Game.js:168:65)
at Generator.next ()
at file:///C:/Users/Rohit/Desktop/Other/AmongUS2/node_modules/amongus-protocol/js/lib/struct/Game.js:7:71
at new Promise ()
at __awaiter (file:///C:/Users/Rohit/Desktop/Other/AmongUS2/node_modules/amongus-protocol/js/lib/struct/Game.js:3:12)
at Game.setStartCounter (file:///C:/Users/Rohit/Desktop/Other/AmongUS2/node_modules/amongus-protocol/js/lib/struct/Game.js:156:16)
at Game. (file:///C:/Users/Rohit/Desktop/Other/AmongUS2/node_modules/amongus-protocol/js/lib/struct/Game.js:189:22)
at Generator.next ()
at file:///C:/Users/Rohit/Desktop/Other/AmongUS2/node_modules/amongus-protocol/js/lib/struct/Game.js:7:71

Unexpected token '?'

(node:5000) ExperimentalWarning: The ESM module loader is experimental.
file:///C:/Users/......./Desktop/AmongUS/node_modules/amongus-protocol/js/lib/Client.js:420
if (options.doSpawn ?? true) {
^

SyntaxError: Unexpected token '?'
at Loader.moduleStrategy (internal/modules/esm/translators.js:81:18)

Can only vote once

After I call the vote function for the first time, I can't vote again (even skipping).

voting in meetings crashes bot

My current code:

game.on("startMeeting", () => {
    log("Meeting");
    setTimeout(() => {
      log("Voted");
      console.log(game.options.emergencyCooldown);
      game.me.vote(game.me);
    }, game.options.emergencyCooldown * 1500);
  });

The bot does not vote in the meeting, but leaves the game. Among us says that "user has left due to an error", but there are no errors in the console.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.