@ianlucas/cs2-lib 5.0.0 → 5.1.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/economy-container.d.ts +1 -0
- package/dist/economy-container.js +3 -0
- package/dist/veto.d.ts +2 -0
- package/dist/veto.js +14 -1
- package/package.json +1 -1
|
@@ -55,3 +55,4 @@ export declare const CS2_BASE_ODD = 0.8;
|
|
|
55
55
|
export declare const CS2_STATTRAK_ODD = 0.1;
|
|
56
56
|
export declare function randomFloat(min: number, max: number): number;
|
|
57
57
|
export declare function randomInt(min: number, max: number): number;
|
|
58
|
+
export declare function randomBoolean(): boolean;
|
package/dist/veto.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const CS2VetoAction: {
|
|
|
8
8
|
export type CS2VetoActionValues = EnumValues<typeof CS2VetoAction>;
|
|
9
9
|
export declare const CS2VetoType: {
|
|
10
10
|
readonly BO1: "bo1";
|
|
11
|
+
readonly BO2: "bo2";
|
|
11
12
|
readonly BO3: "bo3";
|
|
12
13
|
readonly BO5: "bo5";
|
|
13
14
|
readonly Custom: "custom";
|
|
@@ -22,6 +23,7 @@ export declare class CS2Veto {
|
|
|
22
23
|
private actions;
|
|
23
24
|
private maps;
|
|
24
25
|
private pickedMaps;
|
|
26
|
+
private toggleTeam;
|
|
25
27
|
constructor(type: CS2VetoTypeValues, maps: CS2Map[], actions?: CS2VetoActionValues[]);
|
|
26
28
|
private getAvailableMaps;
|
|
27
29
|
private getMap;
|
package/dist/veto.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Ian Lucas. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { randomBoolean } from "./economy-container.js";
|
|
5
6
|
import { assert, ensure } from "./utils.js";
|
|
6
7
|
export const CS2VetoAction = {
|
|
7
8
|
Available: 0,
|
|
@@ -10,6 +11,7 @@ export const CS2VetoAction = {
|
|
|
10
11
|
};
|
|
11
12
|
export const CS2VetoType = {
|
|
12
13
|
BO1: "bo1",
|
|
14
|
+
BO2: "bo2",
|
|
13
15
|
BO3: "bo3",
|
|
14
16
|
BO5: "bo5",
|
|
15
17
|
Custom: "custom"
|
|
@@ -18,6 +20,7 @@ export class CS2Veto {
|
|
|
18
20
|
actions;
|
|
19
21
|
maps;
|
|
20
22
|
pickedMaps = [];
|
|
23
|
+
toggleTeam = false;
|
|
21
24
|
constructor(type, maps, actions) {
|
|
22
25
|
assert(type !== "custom" || actions !== undefined);
|
|
23
26
|
assert(maps.length === 7);
|
|
@@ -37,6 +40,16 @@ export class CS2Veto {
|
|
|
37
40
|
CS2VetoAction.Ban
|
|
38
41
|
];
|
|
39
42
|
break;
|
|
43
|
+
case CS2VetoType.BO2:
|
|
44
|
+
this.toggleTeam = randomBoolean();
|
|
45
|
+
this.actions = [
|
|
46
|
+
CS2VetoAction.Ban,
|
|
47
|
+
CS2VetoAction.Ban,
|
|
48
|
+
CS2VetoAction.Ban,
|
|
49
|
+
CS2VetoAction.Ban,
|
|
50
|
+
CS2VetoAction.Ban
|
|
51
|
+
];
|
|
52
|
+
break;
|
|
40
53
|
case CS2VetoType.BO3:
|
|
41
54
|
this.actions = [
|
|
42
55
|
CS2VetoAction.Ban,
|
|
@@ -72,7 +85,7 @@ export class CS2Veto {
|
|
|
72
85
|
return this.getAvailableMaps().map((map) => map.mapname);
|
|
73
86
|
}
|
|
74
87
|
getCurrentTeam() {
|
|
75
|
-
return this.actions.length % 2;
|
|
88
|
+
return (this.toggleTeam ? 1 : 0) + (this.actions.length % 2) * (this.toggleTeam ? -1 : 1);
|
|
76
89
|
}
|
|
77
90
|
choose(mapname) {
|
|
78
91
|
if (this.actions.length === 0) {
|