yolkbot 0.0.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/browser/build/global.js +3 -0
- package/browser/build/module.js +3 -0
- package/dist/api.js +3 -0
- package/dist/bot/GamePlayer.js +3 -0
- package/dist/bot.js +3 -0
- package/dist/comm/Codes.js +3 -0
- package/dist/comm/CommIn.js +3 -0
- package/dist/comm/CommOut.js +3 -0
- package/dist/comm/OutBuffer.js +3 -0
- package/dist/comm/Pool.js +3 -0
- package/dist/comm/index.js +3 -0
- package/dist/constants/challenges.js +3 -0
- package/dist/constants/changelog.js +3 -0
- package/dist/constants/codes.js +3 -0
- package/dist/constants/guns.js +3 -0
- package/dist/constants/housePromo.js +3 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/items.js +3 -0
- package/dist/constants/language.js +3 -0
- package/dist/constants/maps.js +3 -0
- package/dist/constants/shellNews.js +3 -0
- package/dist/constants/shellYoutube.js +3 -0
- package/dist/constants/shopItems.js +3 -0
- package/dist/constants/sounds.js +3 -0
- package/dist/dispatches/BootPlayerDispatch.js +3 -0
- package/dist/dispatches/ChatDispatch.js +3 -0
- package/dist/dispatches/FireDispatch.js +3 -0
- package/dist/dispatches/GameOptionsDispatch.js +3 -0
- package/dist/dispatches/GoToAmmoDispatch.js +3 -0
- package/dist/dispatches/GoToCoopDispatch.js +3 -0
- package/dist/dispatches/GoToGrenadeDispatch.js +3 -0
- package/dist/dispatches/GoToPlayerDispatch.js +3 -0
- package/dist/dispatches/GoToSpatulaDispatch.js +3 -0
- package/dist/dispatches/LookAtDispatch.js +3 -0
- package/dist/dispatches/LookAtPosDispatch.js +3 -0
- package/dist/dispatches/MeleeDispatch.js +3 -0
- package/dist/dispatches/MovementDispatch.js +3 -0
- package/dist/dispatches/PauseDispatch.js +3 -0
- package/dist/dispatches/ReloadDispatch.js +3 -0
- package/dist/dispatches/ReportPlayerDispatch.js +3 -0
- package/dist/dispatches/SaveLoadoutDispatch.js +3 -0
- package/dist/dispatches/SpawnDispatch.js +3 -0
- package/dist/dispatches/SwapWeaponDispatch.js +3 -0
- package/dist/dispatches/SwitchTeamDispatch.js +3 -0
- package/dist/dispatches/ThrowGrenadeDispatch.js +3 -0
- package/dist/dispatches/index.js +3 -0
- package/dist/globals.js +3 -0
- package/dist/index.js +10 -0
- package/dist/matchmaker.js +3 -0
- package/dist/pathing/astar.js +3 -0
- package/dist/pathing/binaryheap.js +3 -0
- package/dist/pathing/mapnode.js +3 -0
- package/dist/socket.js +3 -0
- package/dist/types/api.d.ts +14 -0
- package/dist/types/bot/GamePlayer.d.ts +119 -0
- package/dist/types/bot.d.ts +331 -0
- package/dist/types/comm/Codes.d.ts +21 -0
- package/dist/types/comm/CommIn.d.ts +22 -0
- package/dist/types/comm/CommOut.d.ts +10 -0
- package/dist/types/comm/OutBuffer.d.ts +24 -0
- package/dist/types/comm/Pool.d.ts +20 -0
- package/dist/types/comm/index.d.ts +16 -0
- package/dist/types/constants/challenges.d.ts +19 -0
- package/dist/types/constants/changelog.d.ts +7 -0
- package/dist/types/constants/codes.d.ts +52 -0
- package/dist/types/constants/guns.d.ts +248 -0
- package/dist/types/constants/housePromo.d.ts +40 -0
- package/dist/types/constants/index.d.ts +123 -0
- package/dist/types/constants/items.d.ts +21 -0
- package/dist/types/constants/language.d.ts +3 -0
- package/dist/types/constants/maps.d.ts +98 -0
- package/dist/types/constants/shellNews.d.ts +12 -0
- package/dist/types/constants/shellYoutube.d.ts +12 -0
- package/dist/types/constants/shopItems.d.ts +15 -0
- package/dist/types/constants/sounds.d.ts +10 -0
- package/dist/types/dispatches/BootPlayerDispatch.d.ts +12 -0
- package/dist/types/dispatches/ChatDispatch.d.ts +10 -0
- package/dist/types/dispatches/FireDispatch.d.ts +10 -0
- package/dist/types/dispatches/GameOptionsDispatch.d.ts +8 -0
- package/dist/types/dispatches/GoToAmmoDispatch.d.ts +8 -0
- package/dist/types/dispatches/GoToCoopDispatch.d.ts +8 -0
- package/dist/types/dispatches/GoToGrenadeDispatch.d.ts +8 -0
- package/dist/types/dispatches/GoToPlayerDispatch.d.ts +11 -0
- package/dist/types/dispatches/GoToSpatulaDispatch.d.ts +8 -0
- package/dist/types/dispatches/LookAtDispatch.d.ts +14 -0
- package/dist/types/dispatches/LookAtPosDispatch.d.ts +18 -0
- package/dist/types/dispatches/MeleeDispatch.d.ts +8 -0
- package/dist/types/dispatches/MovementDispatch.d.ts +12 -0
- package/dist/types/dispatches/PauseDispatch.d.ts +8 -0
- package/dist/types/dispatches/ReloadDispatch.d.ts +8 -0
- package/dist/types/dispatches/ReportPlayerDispatch.d.ts +22 -0
- package/dist/types/dispatches/SaveLoadoutDispatch.d.ts +34 -0
- package/dist/types/dispatches/SpawnDispatch.d.ts +8 -0
- package/dist/types/dispatches/SwapWeaponDispatch.d.ts +8 -0
- package/dist/types/dispatches/SwitchTeamDispatch.d.ts +8 -0
- package/dist/types/dispatches/ThrowGrenadeDispatch.d.ts +10 -0
- package/dist/types/dispatches/index.d.ts +174 -0
- package/dist/types/matchmaker.d.ts +72 -0
- package/dist/types/socket.d.ts +7 -0
- package/dist/types/util.d.ts +4 -0
- package/dist/util.js +3 -0
- package/package.json +102 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
import{loginAnonymously as h}from"./api.js";import{GameModes as r,PlayTypes as c,ProxiesEnabled as d}from"./constants/index.js";import a from"./socket.js";class f{connected=!1;onceConnected=[];proxy=null;sessionId="";onListeners=new Map;onceListeners=new Map;#e=!1;constructor(e={}){if(e.instance||(e.instance="shellshock.io"),e.protocol||(e.protocol="wss"),e.sessionId||e.noLogin?this.sessionId=e.sessionId:this.#o(e.instance),e.proxy&&!d)throw new Error("proxies do not work and hence are not supported in the browser");e.proxy&&(this.proxy=e.proxy),this.#i(e.instance,e.protocol,e.noLogin)}async#i(e,i,s){const t=async()=>{try{this.ws=new a(`${i}://${e}/matchmaker/`,this.proxy),this.ws.onerror=async o=>(console.error(o),await new Promise(n=>setTimeout(n,100)),await t())}catch{await new Promise(o=>setTimeout(o,100)),await t()}};await t(),this.ws.onopen=()=>{this.connected=!0,this.ws.onerror=null,(this.sessionId||s)&&this.onceConnected.forEach(o=>o())},this.ws.onmessage=o=>{const n=JSON.parse(o.data);this.#s("msg",n)},this.ws.onclose=()=>{this.#e||(this.connected=!1,this.#i(e))}}async#o(e){const i=await h(this.proxy,e);(!i||typeof i=="string")&&this.#s("authFail",i),this.sessionId=i.sessionId,this.connected&&this.onceConnected.forEach(s=>s())}send(e){this.ws.send(JSON.stringify(e))}async waitForConnect(){return new Promise(e=>{this.connected?e():this.onceConnected.push(e)})}async getRegions(){return await this.waitForConnect(),new Promise(e=>{const i=s=>{s.command=="regionList"&&(this.regionList=s.regionList,this.off("msg",i),e(s.regionList))};this.on("msg",i),this.ws.onerror=s=>{throw new Error("failed to get regions",s)},this.ws.send(JSON.stringify({command:"regionList"}))})}async findPublicGame(e={}){if(await this.waitForConnect(),!e.region)throw new Error("did not specify a region in findGame, use <Matchmaker>.getRegions() for a list");if(this.regionList&&!this.regionList.find(s=>s.id==e.region))throw new Error("did not find region in regionList, if you are attempting to force a region, avoid calling getRegions()");if(!e.mode)throw new Error("did not specify a mode in findGame");if(r[e.mode]===void 0)throw new Error("invalid mode in findGame, see GameModes for a list");return new Promise(i=>{const s={command:"findGame",region:e.region,playType:c.joinPublic,gameType:r[e.mode],sessionId:this.sessionId},t=o=>{o.command=="gameFound"&&(this.off("msg",t),i(o))};this.on("msg",t),this.ws.send(JSON.stringify(s))})}getRandomRegion(){if(!this.regionList)throw new Error("called getRandomRegion() without region list cached, use <Matchmaker>.getRegions() before getRandomRegion()");return this.regionList[Math.floor(Math.random()*this.regionList.length)].id}getRandomGameMode(){const e=Object.keys(r);return e[Math.floor(Math.random()*e.length)]}close(){this.#e=!0,this.ws.close()}on(e,i){this.onListeners.has(e)||this.onListeners.set(e,[]),this.onListeners.get(e).push(i)}once(e,i){this.onceListeners.has(e)||this.onceListeners.set(e,[]),this.onceListeners.get(e).push(i)}off(e,i){this.onListeners.has(e)&&this.onListeners.set(e,this.onListeners.get(e).filter(s=>s!==i)),this.onceListeners.has(e)&&this.onceListeners.set(e,this.onceListeners.get(e).filter(s=>s!==i))}#s(e,...i){this.onListeners.has(e)&&this.onListeners.get(e).forEach(s=>s(...i)),this.onceListeners.has(e)&&(this.onceListeners.get(e).forEach(s=>s(...i)),this.onceListeners.delete(e))}}var L=f;export{f as Matchmaker,L as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
import{BinaryHeap as u}from"./binaryheap.js";class a{constructor(e){this.list=e}heuristic(e,i){return Math.abs(e.x-i.x)+Math.abs(e.y-i.y)+Math.abs(e.z-i.z)}reversePath(e){const i=[];for(;e.parent;)i.push(e),e=e.parent;return i.reverse(),i}path(e,i){this.list.clean();const r=new u(s=>s.f),n=[];for(e.h=this.heuristic(e,i),e.g=0,e.f=e.g+e.h,r.push(e);r.size()!=0;){const s=r.pop();if(s===i)return this.reversePath(s);n.push(s);const c=s.links;for(let h=0;h<c.length;h++){const t=c[h];if(n.includes(t))continue;const o=s.g+1,l=t.visited;(!l||o<t.g)&&(t.visited=!0,t.parent=s,t.g=o,t.h=this.heuristic(t.position,i.position),t.f=t.g+t.h,l?r.rescoreElement(t):r.push(t))}}return null}}export{a as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
class r{constructor(t){this.content=[],this.scoreFunction=t}push(t){this.content.push(t),this.bubbleUp(this.content.length-1)}rescoreElement(t){this.sinkDown(this.content.indexOf(t))}pop(){const t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.sinkDown(0)),t}remove(t){const e=this.content.length;for(let n=0;n<e;n++){if(this.content[n]!=t)continue;const i=this.content.pop();if(n==e-1)break;this.content[n]=i,this.bubbleUp(n),this.sinkDown(n);break}}size(){return this.content.length}bubbleUp(t){const e=this.content[t],n=this.scoreFunction(e);for(;t>0;){const i=Math.floor((t+1)/2)-1,o=this.content[i];if(n>=this.scoreFunction(o))break;this.content[i]=e,this.content[t]=o,t=i}}includes(t){return this.content.includes(t)}sinkDown(t){const e=this.content.length,n=this.content[t],i=this.scoreFunction(n);for(;;){const o=(t+1)*2,c=o-1;let s=null,h;if(c<e){const l=this.content[c];h=this.scoreFunction(l),h<i&&(s=c)}if(o<e){const l=this.content[o];this.scoreFunction(l)<(s==null?i:h)&&(s=o)}if(s==null)break;this.content[t]=this.content[s],this.content[s]=n,t=s}}}var b=r;export{r as BinaryHeap,b as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
class d{list=[];constructor(t){const i={};for(const s of Object.keys(t.data))for(const e of t.data[s])i[e.x<<16|e.y<<8|e.z]=!0,this.list.push(new c(s,e));for(let s=0;s<t.width;s++)for(let e=0;e<t.height;e++)for(let h=0;h<t.depth;h++)i[s<<16|e<<8|h]||this.list.push(new c("SPECIAL.air.none",{x:s,y:e,z:h}));const n=new Map;for(const s of this.list)n.set(s.positionStr,s);for(const s of this.list){const e=[{x:s.x+1,y:s.y,z:s.z},{x:s.x-1,y:s.y,z:s.z},{x:s.x,y:s.y+1,z:s.z},{x:s.x,y:s.y-1,z:s.z},{x:s.x,y:s.y,z:s.z+1},{x:s.x,y:s.y,z:s.z-1}];for(const h of e){const r=`${h.x},${h.y},${h.z}`,a=n.get(r);a&&s.canLink(a,this)&&s.links.push(a)}}}at(t,i,n){if(!this.nodeMap){this.nodeMap=new Map;for(const e of this.list){const h=`${e.x},${e.y},${e.z}`;this.nodeMap.set(h,e)}}const s=`${t},${i},${n}`;return this.nodeMap.get(s)}clean(){for(const t of this.list)t.f=0,t.g=0,t.h=0,t.visited=void 0,t.parent=void 0,t.closed=void 0}hasLineOfSight(t,i){const n=i.x-t.x,s=i.y-t.y,e=i.z-t.z,h=Math.max(Math.abs(n),Math.abs(s),Math.abs(e)),r=n/h,a=s/h,y=e/h;let l=t.x,o=t.y,f=t.z;for(let u=0;u<=h;u++){const x=this.at(Math.round(l),Math.round(o),Math.round(f));if(x&&x.isSolid())return!1;l+=r,o+=a,f+=y}return!0}}class c{constructor(t,i){this.x=i.x,this.y=i.y,this.z=i.z,this.positionStr=`${this.x},${this.y},${this.z}`,this.position={x:this.x,y:this.y,z:this.z},this.meshType=t.split(".").pop(),this.f=0,this.g=0,this.h=0,this.visited=void 0,this.parent=void 0,this.closed=void 0,this.links=[],this.isStair()&&(i.ry?this.ry=i.ry:this.ry=0)}isSolid(){return this.meshType=="full"}canWalkThrough(){return this.meshType=="none"||this.meshType=="ladder"}canWalkOn(){return this.meshType=="full"}isLadder(){return this.meshType=="ladder"}isStair(){return this.meshType=="wedge"}isAir(){return this.meshType=="none"}canLink(t,i){const n=this.x-t.x,s=this.z-t.z,e=this.y-t.y,h=Math.abs(n),r=Math.abs(e),a=Math.abs(s);if(h+r+a===0||h+a>1||this.isSolid()||t.isSolid())return!1;const y=i.at(this.x,this.y-1,this.z),l=i.at(t.x,t.y-1,t.z);if(!y||!l)return!1;const o={0:{x:0,z:-1},1:{x:-1,z:0},2:{x:0,z:1},3:{x:1,z:0}};switch(this.meshType){case"none":return!!(e===1&&t.canWalkThrough()||(y.canWalkOn()||y.isLadder())&&(t.meshType==="none"||t.meshType==="ladder"&&r===0||t.meshType==="wedge"&&e===0&&n===-o[t.ry].x&&s===-o[t.ry].z));case"ladder":return!!(r===1&&t.canWalkThrough()||r===0&&y.canWalkOn()||t.meshType==="ladder"&&(r===1||y.canWalkOn()&&l.canWalkOn()));case"wedge":return this.x+o[this.ry].x===t.x&&this.z+o[this.ry].z===t.z&&this.y+1===t.y||this.x-o[this.ry].x===t.x&&this.z-o[this.ry].z===t.z&&(this.y===t.y||this.y-1===t.y);default:return!1}}flatCenter(){return{x:this.x+.5,y:this.y+0,z:this.z+.5}}flatRadialDistance(t){const i=this.flatCenter();return Math.hypot(i.x-t.x,i.z-t.z)}}var p=c;export{c as MapNode,d as NodeList,p as default};
|
package/dist/socket.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
import r from"./globals.js";import{IsBrowser as t,UserAgent as n}from"./constants/index.js";class o extends r.WebSocket{constructor(e,s){t?super(e):super(e,{agent:s?new r.SocksProxyAgent(s):void 0,headers:{"user-agent":n,"accept-language":"en-US,en;q=0.9"}})}}var l=o;export{l as default};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface QueryRequest {
|
|
2
|
+
cmd: string;
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface QueryResponse {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function queryServices(request: QueryRequest, proxy?: string, instance?: string): Promise<QueryResponse | string>;
|
|
11
|
+
export function loginWithCredentials(email: string, password: string, proxy?: string, instance?: string): Promise<QueryResponse | string>;
|
|
12
|
+
export function loginWithRefreshToken(refreshToken: string, proxy?: string, instance?: string): Promise<QueryResponse | string>;
|
|
13
|
+
export function loginAnonymously(proxy?: string, instance?: string): Promise<QueryResponse | string>;
|
|
14
|
+
export function createAccount(email: string, password: string, proxy?: string, instance?: string): Promise<QueryResponse | string>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { AnyGun, Cluck9mm } from '../constants/guns';
|
|
2
|
+
import { Item } from '../constants/items';
|
|
3
|
+
|
|
4
|
+
export interface Position {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
z: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface View {
|
|
11
|
+
yaw: number;
|
|
12
|
+
pitch: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Character {
|
|
16
|
+
eggColor: string;
|
|
17
|
+
primaryGun: Item | number;
|
|
18
|
+
secondaryGun: Item | number;
|
|
19
|
+
stamp: Item | number;
|
|
20
|
+
hat: Item | number;
|
|
21
|
+
grenade: Item | number;
|
|
22
|
+
melee: Item | number;
|
|
23
|
+
stampPos: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface PlayerStats {
|
|
30
|
+
killsInGame: number;
|
|
31
|
+
deathsInGame: number;
|
|
32
|
+
streak: number;
|
|
33
|
+
totalKills: number;
|
|
34
|
+
totalDeaths: number;
|
|
35
|
+
bestGameStreak: number;
|
|
36
|
+
bestOverallStreak: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface PlayerData {
|
|
40
|
+
id: string;
|
|
41
|
+
uniqueId: string;
|
|
42
|
+
name: string;
|
|
43
|
+
safename: string;
|
|
44
|
+
charClass: number;
|
|
45
|
+
team: 0 | 1 | 2;
|
|
46
|
+
primaryWeaponItem: Item | number;
|
|
47
|
+
secondaryWeaponItem: Item | number;
|
|
48
|
+
shellColor: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13;
|
|
49
|
+
hatItem: Item | number;
|
|
50
|
+
stampItem: Item | number;
|
|
51
|
+
stampPosX: number;
|
|
52
|
+
stampPosY: number;
|
|
53
|
+
grenadeItem: Item | number;
|
|
54
|
+
meleeItem: Item | number;
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
z: number;
|
|
58
|
+
$dx: number;
|
|
59
|
+
$dy: number;
|
|
60
|
+
$dz: number;
|
|
61
|
+
yaw: number;
|
|
62
|
+
pitch: number;
|
|
63
|
+
score: number;
|
|
64
|
+
kills: number;
|
|
65
|
+
deaths: number;
|
|
66
|
+
streak: number;
|
|
67
|
+
totalKills: number;
|
|
68
|
+
totalDeaths: number;
|
|
69
|
+
bestGameStreak: number;
|
|
70
|
+
bestOverallStreak: number;
|
|
71
|
+
shield: number;
|
|
72
|
+
hp: number;
|
|
73
|
+
playing: boolean;
|
|
74
|
+
weaponIdx: number;
|
|
75
|
+
$controlKeys: number;
|
|
76
|
+
upgradeProductId: number;
|
|
77
|
+
activeShellStreaks: number;
|
|
78
|
+
social: string;
|
|
79
|
+
hideBadge: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface Social {
|
|
83
|
+
id: number;
|
|
84
|
+
type: 'Facebook' | 'Instagram' | 'Tiktok' | 'Discord' | 'Youtube' | 'Twitter' | 'Twitch';
|
|
85
|
+
url: string;
|
|
86
|
+
active: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export class GamePlayer {
|
|
90
|
+
id: string;
|
|
91
|
+
team: 0 | 1 | 2;
|
|
92
|
+
raw: PlayerData;
|
|
93
|
+
name: string;
|
|
94
|
+
uniqueId: string;
|
|
95
|
+
playing: boolean;
|
|
96
|
+
socials: Social[];
|
|
97
|
+
isVip: boolean;
|
|
98
|
+
showBadge: boolean;
|
|
99
|
+
position: Position;
|
|
100
|
+
jumping: boolean;
|
|
101
|
+
climbing: boolean;
|
|
102
|
+
view: View;
|
|
103
|
+
character: Character;
|
|
104
|
+
stats: PlayerStats;
|
|
105
|
+
activeGun: number;
|
|
106
|
+
selectedGun: number;
|
|
107
|
+
weapons: [AnyGun, Cluck9mm];
|
|
108
|
+
grenades: number;
|
|
109
|
+
streak: number;
|
|
110
|
+
hp: number;
|
|
111
|
+
hpShield: number;
|
|
112
|
+
spawnShield: number;
|
|
113
|
+
streakRewards: number[];
|
|
114
|
+
randomSeed: number;
|
|
115
|
+
|
|
116
|
+
constructor(playerData: PlayerData);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export default GamePlayer;
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
type intents = {
|
|
2
|
+
CHALLENGES: 1,
|
|
3
|
+
STATS: 2,
|
|
4
|
+
PATHFINDING: 3,
|
|
5
|
+
PING: 5,
|
|
6
|
+
COSMETIC_DATA: 6,
|
|
7
|
+
PLAYER_HEALTH: 7,
|
|
8
|
+
PACKET_HOOK: 8,
|
|
9
|
+
LOG_PACKETS: 10,
|
|
10
|
+
NO_LOGIN: 11,
|
|
11
|
+
DEBUG_BUFFER: 12,
|
|
12
|
+
DEBUG_BEST_TARGET: 14
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
import { NodeList } from '../pathing/mapnode.js';
|
|
16
|
+
|
|
17
|
+
import { Character, GamePlayer } from './bot/GamePlayer';
|
|
18
|
+
import { Challenge } from './constants/challenges';
|
|
19
|
+
import { AnyGun } from './constants/guns';
|
|
20
|
+
import { Map } from './constants/maps';
|
|
21
|
+
import { ADispatch } from './dispatches/index';
|
|
22
|
+
import { Matchmaker, RawGameData } from './matchmaker';
|
|
23
|
+
import yolkws from './socket';
|
|
24
|
+
|
|
25
|
+
export interface BotParams {
|
|
26
|
+
intents?: number[];
|
|
27
|
+
doUpdate?: boolean;
|
|
28
|
+
updateInterval?: number;
|
|
29
|
+
proxy?: string;
|
|
30
|
+
instance?: string;
|
|
31
|
+
protocol?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ChiknWinnerStatus {
|
|
35
|
+
atLimit: boolean;
|
|
36
|
+
limit: number;
|
|
37
|
+
secondsUntilPlay: number;
|
|
38
|
+
canPlayAgain: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface StatKD {
|
|
42
|
+
total: number;
|
|
43
|
+
mode: {
|
|
44
|
+
public: number;
|
|
45
|
+
private: number;
|
|
46
|
+
};
|
|
47
|
+
dmgType: {
|
|
48
|
+
pistol: number;
|
|
49
|
+
grenade: number;
|
|
50
|
+
rpegg: number;
|
|
51
|
+
eggk: number;
|
|
52
|
+
scrambler: number;
|
|
53
|
+
ranger: number;
|
|
54
|
+
whpper: number;
|
|
55
|
+
crackshot: number;
|
|
56
|
+
trihard: number;
|
|
57
|
+
melee: number;
|
|
58
|
+
};
|
|
59
|
+
gameType: {
|
|
60
|
+
kotc: number;
|
|
61
|
+
spatula: number;
|
|
62
|
+
ffa: number;
|
|
63
|
+
team: number;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface Stats {
|
|
68
|
+
streak: number;
|
|
69
|
+
kills: StatKD;
|
|
70
|
+
deaths: StatKD;
|
|
71
|
+
gameType: {
|
|
72
|
+
kotc: {
|
|
73
|
+
captured: number;
|
|
74
|
+
wins: number;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface Challenges {
|
|
80
|
+
raw: {
|
|
81
|
+
challengeInfo: Challenge;
|
|
82
|
+
challengeData: {
|
|
83
|
+
period: number;
|
|
84
|
+
challengeId: number;
|
|
85
|
+
reset: number;
|
|
86
|
+
claimed: number;
|
|
87
|
+
completed: number;
|
|
88
|
+
data: number;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
id: number;
|
|
92
|
+
name: string;
|
|
93
|
+
desc: string;
|
|
94
|
+
rewardEggs: number;
|
|
95
|
+
isRerolled: boolean;
|
|
96
|
+
isClaimed: boolean;
|
|
97
|
+
isCompleted: boolean;
|
|
98
|
+
progressNum: number;
|
|
99
|
+
goalNum: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface Account {
|
|
103
|
+
id: number;
|
|
104
|
+
firebaseId: string;
|
|
105
|
+
sessionId: string;
|
|
106
|
+
session: string;
|
|
107
|
+
email: string;
|
|
108
|
+
password: string;
|
|
109
|
+
cw: ChiknWinnerStatus;
|
|
110
|
+
loadout: {
|
|
111
|
+
hatId: number | null;
|
|
112
|
+
meleeId: number;
|
|
113
|
+
stampId: number | null;
|
|
114
|
+
classIdx: number;
|
|
115
|
+
colorIdx: number;
|
|
116
|
+
grenadeId: number;
|
|
117
|
+
primaryId: number[];
|
|
118
|
+
secondaryId: number[];
|
|
119
|
+
stampPositionX: number;
|
|
120
|
+
stampPositionY: number;
|
|
121
|
+
};
|
|
122
|
+
ownedItemIds: number[];
|
|
123
|
+
vip: boolean;
|
|
124
|
+
accountAge: number;
|
|
125
|
+
emailVerified: boolean;
|
|
126
|
+
eggBalance: number;
|
|
127
|
+
stats: {
|
|
128
|
+
lifetime: Stats;
|
|
129
|
+
monthly: Stats;
|
|
130
|
+
}
|
|
131
|
+
challenges: Challenges[];
|
|
132
|
+
rawLoginData: any; // someday i'll type it
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface GameOptions {
|
|
136
|
+
gravity: number;
|
|
137
|
+
damage: number;
|
|
138
|
+
healthRegen: number;
|
|
139
|
+
locked: boolean;
|
|
140
|
+
noTeamChange: boolean;
|
|
141
|
+
noTeamShuffle: boolean;
|
|
142
|
+
weaponsDisabled: boolean[];
|
|
143
|
+
mustUseSecondary: boolean;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface Collectable {
|
|
147
|
+
id: number;
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
z: number;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface Zone {
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
z: number;
|
|
157
|
+
zone: number;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface Game {
|
|
161
|
+
raw: RawGameData;
|
|
162
|
+
code: string;
|
|
163
|
+
gameModeId: number;
|
|
164
|
+
gameMode: string;
|
|
165
|
+
mapIdx: number;
|
|
166
|
+
map: {
|
|
167
|
+
filename: string;
|
|
168
|
+
hash: string;
|
|
169
|
+
name: string;
|
|
170
|
+
modes: {
|
|
171
|
+
FFA: boolean;
|
|
172
|
+
Teams: boolean;
|
|
173
|
+
Spatula: boolean;
|
|
174
|
+
King: boolean;
|
|
175
|
+
};
|
|
176
|
+
availability: string;
|
|
177
|
+
numPlayers: string;
|
|
178
|
+
raw: Map;
|
|
179
|
+
zones: Zone[][];
|
|
180
|
+
};
|
|
181
|
+
playerLimit: number;
|
|
182
|
+
isGameOwner: boolean;
|
|
183
|
+
isPrivate: boolean;
|
|
184
|
+
options: GameOptions;
|
|
185
|
+
collectables: Collectable[][];
|
|
186
|
+
teamScore: number[];
|
|
187
|
+
spatula: {
|
|
188
|
+
coords: { x: number; y: number; z: number };
|
|
189
|
+
controlledBy: number;
|
|
190
|
+
controlledByTeam: number;
|
|
191
|
+
};
|
|
192
|
+
stage: number;
|
|
193
|
+
zoneNumber: number;
|
|
194
|
+
activeZone: Zone[];
|
|
195
|
+
capturing: number;
|
|
196
|
+
captureProgress: number;
|
|
197
|
+
numCapturing: number;
|
|
198
|
+
stageName: string;
|
|
199
|
+
capturePercent: number;
|
|
200
|
+
socket: yolkws | null;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface Pathing {
|
|
204
|
+
nodeList: NodeList | null;
|
|
205
|
+
followingPath: boolean;
|
|
206
|
+
activePath: any;
|
|
207
|
+
activeNode: any;
|
|
208
|
+
activeNodeIdx: number;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface BotState {
|
|
212
|
+
name: string;
|
|
213
|
+
weaponIdx: number;
|
|
214
|
+
reloading: boolean;
|
|
215
|
+
swappingGun: boolean;
|
|
216
|
+
usingMelee: boolean;
|
|
217
|
+
shotsFired: number;
|
|
218
|
+
quit: boolean;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface ChiknWinnerResponse {
|
|
222
|
+
eggsGiven: number;
|
|
223
|
+
itemIds: number[];
|
|
224
|
+
rewardTier: number;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export class Bot {
|
|
228
|
+
static Intents: intents;
|
|
229
|
+
Intents: intents;
|
|
230
|
+
|
|
231
|
+
proxy: string;
|
|
232
|
+
autoUpdate: boolean;
|
|
233
|
+
disablePathing: boolean;
|
|
234
|
+
updateInterval: number;
|
|
235
|
+
instance: string;
|
|
236
|
+
protocol: string;
|
|
237
|
+
state: BotState;
|
|
238
|
+
players: Record<string, GamePlayer>;
|
|
239
|
+
me: GamePlayer;
|
|
240
|
+
game: Game;
|
|
241
|
+
account: Account;
|
|
242
|
+
ping: number;
|
|
243
|
+
lastPingTime: number;
|
|
244
|
+
lastDeathTime: number;
|
|
245
|
+
lastChatTime: number;
|
|
246
|
+
lastUpdateTime: number;
|
|
247
|
+
controlKeys: number;
|
|
248
|
+
pathing: Pathing;
|
|
249
|
+
matchmaker: Matchmaker | null;
|
|
250
|
+
|
|
251
|
+
constructor(params?: BotParams);
|
|
252
|
+
|
|
253
|
+
loginAnonymously(): Promise<Account | false>;
|
|
254
|
+
loginWithRefreshToken(refreshToken: string): Promise<Account | false>;
|
|
255
|
+
login(email: string, pass: string): Promise<Account | false>;
|
|
256
|
+
createAccount(email: string, pass: string): Promise<Account | false>;
|
|
257
|
+
|
|
258
|
+
initMatchmaker(): Promise<boolean>;
|
|
259
|
+
createPrivateGame(opts: { region: string; mode: string; map: string }): Promise<RawGameData>;
|
|
260
|
+
join(botName: string, data: string | RawGameData): Promise<void>;
|
|
261
|
+
|
|
262
|
+
processPacket(data: number[]): void;
|
|
263
|
+
dispatch(disp: ADispatch): void;
|
|
264
|
+
update(): void;
|
|
265
|
+
|
|
266
|
+
canSee(player: GamePlayer): boolean;
|
|
267
|
+
getBestTarget(customFilter?: (player: GamePlayer) => boolean): { player: GamePlayer, inLoS: boolean } | undefined;
|
|
268
|
+
|
|
269
|
+
onAny(cb: Function): void;
|
|
270
|
+
off(event: string, cb: Function): void;
|
|
271
|
+
|
|
272
|
+
on(event: 'authFail', cb: (reason: string) => void): void;
|
|
273
|
+
on(event: 'authSuccess', cb: (account: Account) => void): void;
|
|
274
|
+
on(event: 'balanceUpdate', cb: (oldBalance: number, newBalance: number) => void): void;
|
|
275
|
+
on(event: 'banned', cb: (banRemaining: string) => void): void;
|
|
276
|
+
on(event: 'chat', cb: (player: GamePlayer | undefined, message: string, flags: number) => void): void;
|
|
277
|
+
on(event: 'close', cb: (code: number) => void): void;
|
|
278
|
+
on(event: 'collectAmmo', cb: (player: GamePlayer, weapon: AnyGun) => void): void;
|
|
279
|
+
on(event: 'collectGrenade', cb: (player: GamePlayer) => void): void;
|
|
280
|
+
on(event: 'gameForcePause', cb: () => void): void;
|
|
281
|
+
on(event: 'gameOptionsChange', cb: (oldOptions: GameOptions, newOptions: GameOptions) => void): void;
|
|
282
|
+
on(event: 'gameReady', cb: () => void): void;
|
|
283
|
+
on(event: 'gameReset', cb: () => void): void;
|
|
284
|
+
on(event: 'gameStateChange', cb: (oldState: Game, newState: Game) => void): void;
|
|
285
|
+
on(event: 'grenadeExploded', cb: (item: Item | number, pos: { x: number; y: number; z: number }, damage: number, radius: number) => void): void;
|
|
286
|
+
on(event: 'leave', cb: () => void): void;
|
|
287
|
+
on(event: 'packet', cb: (packet: ArrayBuffer) => void): void;
|
|
288
|
+
on(event: 'pingUpdate', cb: (oldPing: number, newPing: number) => void): void;
|
|
289
|
+
on(event: 'playerBeginStreak', cb: (player: GamePlayer, streak: number) => void): void;
|
|
290
|
+
on(event: 'playerChangeCharacter', cb: (player: GamePlayer, oldCharacter: Character, newCharacter: Character) => void): void;
|
|
291
|
+
on(event: 'playerChangeGun', cb: (player: GamePlayer, oldGun: number, newGun: number) => void): void;
|
|
292
|
+
on(event: 'playerDamaged', cb: (player: GamePlayer, oldHp: number, newHp: number) => void): void;
|
|
293
|
+
on(event: 'playerDeath', cb: (player: GamePlayer, killer: GamePlayer) => void): void;
|
|
294
|
+
on(event: 'playerFire', cb: (player: GamePlayer, weapon: AnyGun) => void): void;
|
|
295
|
+
on(event: 'playerJoin', cb: (player: GamePlayer) => void): void;
|
|
296
|
+
on(event: 'playerLeave', cb: (player: GamePlayer) => void): void;
|
|
297
|
+
on(event: 'playerMelee', cb: (player: GamePlayer) => void): void;
|
|
298
|
+
on(event: 'playerPause', cb: (player: GamePlayer) => void): void;
|
|
299
|
+
on(event: 'playerReload', cb: (player: GamePlayer, weapon: AnyGun) => void): void;
|
|
300
|
+
on(event: 'playerRespawn', cb: (player: GamePlayer) => void): void;
|
|
301
|
+
on(event: 'playerSwapWeapon', cb: (player: GamePlayer, nowActive: number) => void): void;
|
|
302
|
+
on(event: 'playerSwitchTeam', cb: (player: GamePlayer, oldTeam: number, newTeam: number) => void): void;
|
|
303
|
+
on(event: 'quit', cb: () => void): void;
|
|
304
|
+
on(event: 'rocketHit', cb: (pos: { x: number; y: number; z: number }, damage: number, radius: number) => void): void;
|
|
305
|
+
on(event: 'selfDamaged', cb: (oldHp: number, newHp: number) => void): void;
|
|
306
|
+
on(event: 'selfMoved', cb: (oldPos: { x: number; y: number; z: number }, newPos: { x: number; y: number; z: number }) => void): void;
|
|
307
|
+
on(event: 'selfRespawnFail', cb: () => void): void;
|
|
308
|
+
on(event: 'selfShieldHit', cb: (oldShield: number, newShield: number) => void): void;
|
|
309
|
+
on(event: 'selfShieldLost', cb: () => void): void;
|
|
310
|
+
on(event: 'spawnItem', cb: (type: number, _id: number, pos: { x: number; y: number; z: number }) => void): void;
|
|
311
|
+
on(event: 'tick', cb: () => void): void;
|
|
312
|
+
|
|
313
|
+
checkChiknWinner(): Promise<ChiknWinnerStatus>;
|
|
314
|
+
playChiknWinner(doPrematureCooldownCheck: boolean): Promise<ChiknWinnerResponse | string>;
|
|
315
|
+
resetChiknWinner(): Promise<ChiknWinnerStatus>;
|
|
316
|
+
|
|
317
|
+
refreshChallenges(): Promise<Challenges[]>;
|
|
318
|
+
claimChallenge(challengeId: number): Promise<{ eggReward: number, updatedChallenges: Challenges[] }>;
|
|
319
|
+
rerollChallenge(challengeId: number): Promise<Challenges[]>;
|
|
320
|
+
|
|
321
|
+
refreshBalance(): Promise<number>;
|
|
322
|
+
redeemCode(code: string): Promise<{ result: string; eggsGiven: number; itemIds: number[]; }>;
|
|
323
|
+
claimURLReward(reward: string): Promise<{ result: string; eggsGiven: number; itemIds: number[]; }>;
|
|
324
|
+
claimSocialReward(rewardTag: string): Promise<{ result: string; eggsGiven: number; itemIds: number[]; }>;
|
|
325
|
+
buyItem(itemId: number): Promise<{ result: string; currentBalance: number; itemId: number; }>;
|
|
326
|
+
|
|
327
|
+
leave(code?: number): void;
|
|
328
|
+
quit(noCleanup?: boolean): void;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export default Bot;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const CloseCode: {
|
|
2
|
+
gameNotFound: number;
|
|
3
|
+
gameFull: number;
|
|
4
|
+
badName: number;
|
|
5
|
+
mainMenu: number;
|
|
6
|
+
gameIdleExceeded: number;
|
|
7
|
+
corruptedLoginData: number;
|
|
8
|
+
gameMaxPlayersExceeded: number;
|
|
9
|
+
gameDestroyUser: number;
|
|
10
|
+
joinGameOutOfOrder: number;
|
|
11
|
+
gameShuttingDown: number;
|
|
12
|
+
readyBeforeReady: number;
|
|
13
|
+
booted: number;
|
|
14
|
+
gameErrorOnUserSocket: number;
|
|
15
|
+
uuidNotFound: number;
|
|
16
|
+
sessionNotFound: number;
|
|
17
|
+
clusterFullCpu: number;
|
|
18
|
+
clusterFullMem: number;
|
|
19
|
+
noClustersAvailable: number;
|
|
20
|
+
locked: number;
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare class CommIn {
|
|
2
|
+
static buffer: Uint8Array;
|
|
3
|
+
static idx: number;
|
|
4
|
+
static init(buf: ArrayBuffer): void;
|
|
5
|
+
static isMoreDataAvailable(): number;
|
|
6
|
+
static peekInt8U(): number;
|
|
7
|
+
static unPackInt8U(): number;
|
|
8
|
+
static unPackInt8(): number;
|
|
9
|
+
static unPackInt16U(): number;
|
|
10
|
+
static unPackInt24U(): number;
|
|
11
|
+
static unPackInt32U(): number;
|
|
12
|
+
static unPackInt16(): number;
|
|
13
|
+
static unPackInt32(): number;
|
|
14
|
+
static unPackRadU(): number;
|
|
15
|
+
static unPackRad(): number;
|
|
16
|
+
static unPackFloat(): number;
|
|
17
|
+
static unPackDouble(): number;
|
|
18
|
+
static unPackString(maxLen?: number): string;
|
|
19
|
+
static unPackLongString(maxLen?: number): string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default CommIn;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare class OutBuffer {
|
|
2
|
+
private idx: number;
|
|
3
|
+
private arrayBuffer: ArrayBuffer;
|
|
4
|
+
private buffer: Uint8Array;
|
|
5
|
+
|
|
6
|
+
constructor(size: number);
|
|
7
|
+
|
|
8
|
+
send(ws2: { send(data: Uint8Array): void }): void;
|
|
9
|
+
|
|
10
|
+
packInt8(val: number): void;
|
|
11
|
+
packInt16(val: number): void;
|
|
12
|
+
packInt24(val: number): void;
|
|
13
|
+
packInt32(val: number): void;
|
|
14
|
+
|
|
15
|
+
packRadU(val: number): void;
|
|
16
|
+
packRad(val: number): void;
|
|
17
|
+
packFloat(val: number): void;
|
|
18
|
+
packDouble(val: number): void;
|
|
19
|
+
|
|
20
|
+
packString(str: string, doMalicious?: boolean): void;
|
|
21
|
+
packLongString(str: string): void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default OutBuffer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare class Pool<T> {
|
|
2
|
+
size: number;
|
|
3
|
+
originalSize: number;
|
|
4
|
+
constructorFn: () => T;
|
|
5
|
+
objects: Array<T & { id: number; active: boolean }>;
|
|
6
|
+
idx: number;
|
|
7
|
+
numActive: number;
|
|
8
|
+
|
|
9
|
+
constructor(constructorFn: () => T, size: number);
|
|
10
|
+
|
|
11
|
+
expand(num: number): void;
|
|
12
|
+
|
|
13
|
+
retrieve(id?: number): T & { id: number; active: boolean };
|
|
14
|
+
|
|
15
|
+
recycle(obj: T & { id: number; active: boolean }): void;
|
|
16
|
+
|
|
17
|
+
forEachActive(fn: (obj: T & { id: number; active: boolean }, index: number) => void): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default Pool;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import CommIn from './CommIn';
|
|
2
|
+
import CommOut from './CommOut';
|
|
3
|
+
import OutBuffer from './OutBuffer';
|
|
4
|
+
import Pool from './Pool';
|
|
5
|
+
|
|
6
|
+
import { CommCode } from '../constants/codes';
|
|
7
|
+
import { CloseCode } from './Codes';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
CommIn,
|
|
11
|
+
CommOut,
|
|
12
|
+
OutBuffer,
|
|
13
|
+
Pool,
|
|
14
|
+
CommCode,
|
|
15
|
+
CloseCode
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface Challenge {
|
|
2
|
+
id: number;
|
|
3
|
+
loc_ref: string;
|
|
4
|
+
type: number;
|
|
5
|
+
subType: number;
|
|
6
|
+
period: number;
|
|
7
|
+
goal: number;
|
|
8
|
+
reward: number;
|
|
9
|
+
conditional: number;
|
|
10
|
+
value: string;
|
|
11
|
+
valueTwo: string | null;
|
|
12
|
+
tier: number;
|
|
13
|
+
loc: {
|
|
14
|
+
title: string;
|
|
15
|
+
desc: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Challenges: Challenge[];
|