mirror of
https://github.com/jwetzell/aas-js.git
synced 2026-08-21 21:09:03 +00:00
add soccer parsing
This commit is contained in:
@@ -7,3 +7,4 @@
|
|||||||
- baseball
|
- baseball
|
||||||
- wrestling
|
- wrestling
|
||||||
- auto racing
|
- auto racing
|
||||||
|
- soccer
|
||||||
+17
-2
@@ -50,7 +50,8 @@ class Console {
|
|||||||
break;
|
break;
|
||||||
case 0x16:
|
case 0x16:
|
||||||
this.sport = 'soccer';
|
this.sport = 'soccer';
|
||||||
throw new Error('Soccer is not implemented');
|
this.parseSoccer();
|
||||||
|
break;
|
||||||
case 0x60:
|
case 0x60:
|
||||||
this.sport = 'wrestling';
|
this.sport = 'wrestling';
|
||||||
this.parseWrestling();
|
this.parseWrestling();
|
||||||
@@ -333,13 +334,13 @@ class Console {
|
|||||||
|
|
||||||
parseAutoRacing() {
|
parseAutoRacing() {
|
||||||
if (!this.sportInitialized) {
|
if (!this.sportInitialized) {
|
||||||
|
this.state.positions = [];
|
||||||
this.sportInitialized = true;
|
this.sportInitialized = true;
|
||||||
}
|
}
|
||||||
const seqNum = this.latestPacket.buffer.at(10);
|
const seqNum = this.latestPacket.buffer.at(10);
|
||||||
if (seqNum === 0x11) {
|
if (seqNum === 0x11) {
|
||||||
this.state.lap =
|
this.state.lap =
|
||||||
this.getInt(this.latestPacket.buffer.at(19)) * 100 + this.getInt(this.latestPacket.buffer.at(20));
|
this.getInt(this.latestPacket.buffer.at(19)) * 100 + this.getInt(this.latestPacket.buffer.at(20));
|
||||||
this.state.positions = [];
|
|
||||||
for (let i = 0; i < 10; i += 1) {
|
for (let i = 0; i < 10; i += 1) {
|
||||||
const positionByte = this.latestPacket.buffer.at(21 + i);
|
const positionByte = this.latestPacket.buffer.at(21 + i);
|
||||||
if (positionByte !== 0xaa) {
|
if (positionByte !== 0xaa) {
|
||||||
@@ -349,6 +350,20 @@ class Console {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parseSoccer() {
|
||||||
|
if (!this.sportInitialized) {
|
||||||
|
this.sportInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const seqNum = this.latestPacket.buffer.at(10);
|
||||||
|
if (seqNum === 0x11) {
|
||||||
|
this.state.home.shotsOnGoal = this.getInt(this.latestPacket.buffer.at(16));
|
||||||
|
this.state.guest.shotsOnGoal = this.getInt(this.latestPacket.buffer.at(17));
|
||||||
|
this.state.home.cornerKicks = this.getInt(this.latestPacket.buffer.at(21));
|
||||||
|
this.state.guest.cornerKicks = this.getInt(this.latestPacket.buffer.at(22));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {number} packedNumber
|
* @param {number} packedNumber
|
||||||
|
|||||||
Reference in New Issue
Block a user