@ianlucas/cs2-lib 7.21.0 → 7.22.0
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/dist/translations/bulgarian.mjs +54 -20
- package/dist/translations/russian.mjs +2 -2
- package/dist/translations/swedish.mjs +10 -10
- package/dist/veto.d.mts +1 -0
- package/dist/veto.mjs +1 -1
- package/package.json +28 -12
package/dist/veto.d.mts
CHANGED
|
@@ -32,6 +32,7 @@ declare class CS2Veto {
|
|
|
32
32
|
private getAvailableMapnames;
|
|
33
33
|
getCurrentAction(): CS2VetoActionValues | undefined;
|
|
34
34
|
getCurrentTeam(): number;
|
|
35
|
+
getRandomAvailableMapname(): string | undefined;
|
|
35
36
|
choose(mapname?: string): boolean;
|
|
36
37
|
random(): boolean;
|
|
37
38
|
getState(): CS2VetoMap[];
|
package/dist/veto.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assert as e,ensure as t}from"./utils.mjs";import{randomBoolean as n}from"./economy-container.mjs";const r={Available:0,Pick:1,Ban:2},i={BO1:`bo1`,BO2:`bo2`,BO3:`bo3`,BO5:`bo5`,Custom:`custom`};var a=class{actions;maps;pickedMaps=[];toggleTeam=!1;constructor(a,o,s){switch(e(a!==`custom`||s!==void 0),e(o.length===7),e(s===void 0||s.length===6),this.maps=o.map(e=>({mapname:e.mapname,value:r.Available})),a){case i.BO1:this.actions=[r.Ban,r.Ban,r.Ban,r.Ban,r.Ban,r.Ban];break;case i.BO2:this.toggleTeam=n(),this.actions=[r.Ban,r.Ban,r.Ban,r.Ban,r.Ban];break;case i.BO3:this.actions=[r.Ban,r.Ban,r.Pick,r.Pick,r.Ban,r.Ban];break;case i.BO5:this.actions=[r.Ban,r.Ban,r.Pick,r.Pick,r.Pick,r.Pick];break;case i.Custom:this.actions=t(s);break}}getAvailableMaps(){return this.maps.filter(e=>e.value===r.Available)}getMap(e){return this.maps.find(t=>t.mapname===e)}getAvailableMapnames(){return this.getAvailableMaps().map(e=>e.mapname)}getCurrentAction(){return this.actions[0]}getCurrentTeam(){return(this.toggleTeam?1:0)+this.actions.length%2*(this.toggleTeam?-1:1)}choose(e){if(this.actions.length===0)return!1;if(e===void 0)return this.random();let t=this.getMap(e);if(t===void 0||t.value!==r.Available)return!1;let n=this.getCurrentTeam(),i=this.actions.shift();return i===void 0?!1:(i===r.Pick&&this.pickedMaps.push(e),this.maps=this.maps.map(t=>t.mapname===e?{...t,value:i,team:n}:t),!0)}random(){
|
|
1
|
+
import{assert as e,ensure as t}from"./utils.mjs";import{randomBoolean as n}from"./economy-container.mjs";const r={Available:0,Pick:1,Ban:2},i={BO1:`bo1`,BO2:`bo2`,BO3:`bo3`,BO5:`bo5`,Custom:`custom`};var a=class{actions;maps;pickedMaps=[];toggleTeam=!1;constructor(a,o,s){switch(e(a!==`custom`||s!==void 0),e(o.length===7),e(s===void 0||s.length===6),this.maps=o.map(e=>({mapname:e.mapname,value:r.Available})),a){case i.BO1:this.actions=[r.Ban,r.Ban,r.Ban,r.Ban,r.Ban,r.Ban];break;case i.BO2:this.toggleTeam=n(),this.actions=[r.Ban,r.Ban,r.Ban,r.Ban,r.Ban];break;case i.BO3:this.actions=[r.Ban,r.Ban,r.Pick,r.Pick,r.Ban,r.Ban];break;case i.BO5:this.actions=[r.Ban,r.Ban,r.Pick,r.Pick,r.Pick,r.Pick];break;case i.Custom:this.actions=t(s);break}}getAvailableMaps(){return this.maps.filter(e=>e.value===r.Available)}getMap(e){return this.maps.find(t=>t.mapname===e)}getAvailableMapnames(){return this.getAvailableMaps().map(e=>e.mapname)}getCurrentAction(){return this.actions[0]}getCurrentTeam(){return(this.toggleTeam?1:0)+this.actions.length%2*(this.toggleTeam?-1:1)}getRandomAvailableMapname(){let e=this.getAvailableMapnames();if(e.length)return e[Math.floor(Math.random()*e.length)]}choose(e){if(this.actions.length===0)return!1;if(e===void 0)return this.random();let t=this.getMap(e);if(t===void 0||t.value!==r.Available)return!1;let n=this.getCurrentTeam(),i=this.actions.shift();return i===void 0?!1:(i===r.Pick&&this.pickedMaps.push(e),this.maps=this.maps.map(t=>t.mapname===e?{...t,value:i,team:n}:t),!0)}random(){var e=this.getRandomAvailableMapname();return e===void 0?!1:this.choose(e)}getState(){return this.maps}getMaps(){if(this.actions.length>0)return this.pickedMaps;let e=this.getAvailableMapnames();return[...this.pickedMaps,...e]}done(){return this.actions.length===0}};export{a as CS2Veto,r as CS2VetoAction,i as CS2VetoType};
|
package/package.json
CHANGED
|
@@ -3,10 +3,23 @@
|
|
|
3
3
|
"description": "A TypeScript library for manipulating Counter-Strike 2 data",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Ian Lucas",
|
|
6
|
-
"
|
|
6
|
+
"keywords": [
|
|
7
|
+
"cs2",
|
|
8
|
+
"counter-strike",
|
|
9
|
+
"counter-strike-2",
|
|
10
|
+
"csgo",
|
|
11
|
+
"cs-go"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/ianlucas/cs2-lib#readme",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/ianlucas/cs2-lib.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/ianlucas/cs2-lib/issues"
|
|
20
|
+
},
|
|
7
21
|
"type": "module",
|
|
8
22
|
"main": "./dist/index.mjs",
|
|
9
|
-
"module": "./dist/index.mjs",
|
|
10
23
|
"types": "./dist/index.d.mts",
|
|
11
24
|
"exports": {
|
|
12
25
|
".": {
|
|
@@ -18,9 +31,9 @@
|
|
|
18
31
|
"import": "./dist/translations/index.mjs"
|
|
19
32
|
}
|
|
20
33
|
},
|
|
34
|
+
"sideEffects": false,
|
|
21
35
|
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
"dist/translations"
|
|
36
|
+
"dist"
|
|
24
37
|
],
|
|
25
38
|
"scripts": {
|
|
26
39
|
"docs": "typedoc",
|
|
@@ -28,32 +41,35 @@
|
|
|
28
41
|
"prepack": "rolldown -c rolldown.config.ts",
|
|
29
42
|
"test": "vitest --run --testTimeout 120000",
|
|
30
43
|
"typecheck": "tsc --noEmit",
|
|
31
|
-
"update": "npm run
|
|
44
|
+
"update": "npm run item-generator && npm run item-generator-changelog",
|
|
32
45
|
"upgrade": "npx npm-check-updates@latest --target minor -u",
|
|
33
46
|
"cs2": "tsx scripts/cs2.ts",
|
|
34
47
|
"item-generator-changelog": "tsx scripts/item-generator-changelog.ts",
|
|
35
48
|
"item-generator": "tsx scripts/item-generator.ts"
|
|
36
49
|
},
|
|
37
50
|
"devDependencies": {
|
|
38
|
-
"@bunny.net/storage-sdk": "^0.3.
|
|
51
|
+
"@bunny.net/storage-sdk": "^0.3.1",
|
|
39
52
|
"@ianlucas/depot-downloader": "^3.4.0",
|
|
40
|
-
"@ianlucas/vrf-decompiler": "^
|
|
53
|
+
"@ianlucas/vrf-decompiler": "^18.0.0",
|
|
41
54
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
42
|
-
"@types/node": "^22.19.
|
|
55
|
+
"@types/node": "^22.19.11",
|
|
43
56
|
"cheerio": "^1.2.0",
|
|
44
|
-
"dotenv": "^17.
|
|
57
|
+
"dotenv": "^17.3.1",
|
|
45
58
|
"html-entities": "^2.6.0",
|
|
46
59
|
"javascript-stringify": "^2.1.0",
|
|
47
60
|
"prettier": "3.8.1",
|
|
48
|
-
"rolldown": "^1.0.0-rc.
|
|
61
|
+
"rolldown": "^1.0.0-rc.5",
|
|
49
62
|
"rolldown-plugin-dts": "^0.22.1",
|
|
50
63
|
"rollup-plugin-delete": "^3.0.2",
|
|
51
64
|
"sharp": "^0.34.5",
|
|
52
65
|
"string-strip-html": "^13.5.3",
|
|
53
66
|
"tsx": "^4.21.0",
|
|
54
|
-
"typedoc": "^0.28.
|
|
67
|
+
"typedoc": "^0.28.17",
|
|
55
68
|
"typescript": "^5.9.3",
|
|
56
69
|
"vitest": "^4.0.18"
|
|
57
70
|
},
|
|
58
|
-
"
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=20"
|
|
73
|
+
},
|
|
74
|
+
"version": "7.22.0"
|
|
59
75
|
}
|