warcraft-3-w3ts-utils 0.1.10 → 0.1.12

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/index.d.ts CHANGED
@@ -1 +1,2 @@
1
+ /** @noSelfInFile */
1
2
  export * from "./utils/index";
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warcraft-3-w3ts-utils",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "A library of utility functions for modding Warcraft 3 utilizing the W3TS template.",
5
5
  "main": "./src/index.ts",
6
6
  "keywords": [
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  import { Unit } from "w3ts";
2
3
  /**
3
4
  * Good for once a unit gets near you, but not good while they are near you since the event is only triggered on entry, not during
@@ -1 +1,2 @@
1
+ /** @noSelfInFile */
1
2
  export declare function enableCameraZoom(): void;
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  import { MapPlayer, Trigger } from "w3ts";
2
3
  /**
3
4
  * Setup trigger to listen for a chat command for the players specified in the array. Execute function when triggered
@@ -1,109 +1,7 @@
1
+ /** @noSelfInFile */
1
2
  export declare const playerRGBMap: Map<number, {
2
3
  r: number;
3
4
  g: number;
4
5
  b: number;
5
6
  }>;
6
7
  export declare const playerHexColorMap: Map<number, string>;
7
- /**
8
- *
9
- *
10
- PlayerStrings[0].colour = "|c00ff0303"
11
- PlayerStrings[1].colour = "|c000042ff"
12
- PlayerStrings[2].colour = "|c001ce6b9"
13
- PlayerStrings[3].colour = "|c00540081"
14
- PlayerStrings[4].colour = "|c00fffc00"
15
- PlayerStrings[5].colour = "|c00fe8a0e"
16
- PlayerStrings[6].colour = "|c0020c000"
17
- PlayerStrings[7].colour = "|c00e55bb0"
18
- PlayerStrings[8].colour = "|c00959697"
19
- PlayerStrings[9].colour = "|c007ebff1"
20
- PlayerStrings[10].colour = "|c00106246"
21
- PlayerStrings[11].colour = "|c004e2a04"
22
- PlayerStrings[12].colour = "|c009b0000"
23
- PlayerStrings[13].colour = "|c000000c3"
24
- PlayerStrings[14].colour = "|c0000eaff"
25
- PlayerStrings[15].colour = "|c00be00fe"
26
- PlayerStrings[16].colour = "|c00ebcd87"
27
- PlayerStrings[17].colour = "|c00f8a48b"
28
- PlayerStrings[18].colour = "|c00bfff80"
29
- PlayerStrings[19].colour = "|c00dcb9eb"
30
- PlayerStrings[20].colour = "|c00282828"
31
- PlayerStrings[21].colour = "|c00ebf0ff"
32
- PlayerStrings[22].colour = "|c0000781e"
33
- PlayerStrings[23].colour = "|c00a46f33"
34
- -- RGB
35
- PlayerStrings[0].red = 255
36
- PlayerStrings[0].green = 3
37
- PlayerStrings[0].blue = 3
38
- PlayerStrings[1].red = 0
39
- PlayerStrings[1].green = 66
40
- PlayerStrings[1].blue = 255
41
- PlayerStrings[2].red = 28
42
- PlayerStrings[2].green = 230
43
- PlayerStrings[2].blue = 185
44
- PlayerStrings[3].red = 84
45
- PlayerStrings[3].green = 0
46
- PlayerStrings[3].blue = 129
47
- PlayerStrings[4].red = 255
48
- PlayerStrings[4].green = 254
49
- PlayerStrings[4].blue = 0
50
- PlayerStrings[5].red = 254
51
- PlayerStrings[5].green = 138
52
- PlayerStrings[5].blue = 14
53
- PlayerStrings[6].red = 32
54
- PlayerStrings[6].green = 192
55
- PlayerStrings[6].blue = 0
56
- PlayerStrings[7].red = 229
57
- PlayerStrings[7].green = 91
58
- PlayerStrings[7].blue = 176
59
- PlayerStrings[8].red = 149
60
- PlayerStrings[8].green = 150
61
- PlayerStrings[8].blue = 151
62
- PlayerStrings[9].red = 126
63
- PlayerStrings[9].green = 191
64
- PlayerStrings[9].blue = 241
65
- PlayerStrings[10].red = 16
66
- PlayerStrings[10].green = 98
67
- PlayerStrings[10].blue = 70
68
- PlayerStrings[11].red = 78
69
- PlayerStrings[11].green = 42
70
- PlayerStrings[11].blue = 4
71
- PlayerStrings[12].red = 155
72
- PlayerStrings[12].green = 0
73
- PlayerStrings[12].blue = 0
74
- PlayerStrings[13].red = 0
75
- PlayerStrings[13].green = 0
76
- PlayerStrings[13].blue = 195
77
- PlayerStrings[14].red = 155
78
- PlayerStrings[14].green = 234
79
- PlayerStrings[14].blue = 255
80
- PlayerStrings[15].red = 190
81
- PlayerStrings[15].green = 0
82
- PlayerStrings[15].blue = 254
83
- PlayerStrings[16].red = 235
84
- PlayerStrings[16].green = 205
85
- PlayerStrings[16].blue = 135
86
- PlayerStrings[17].red = 248
87
- PlayerStrings[17].green = 164
88
- PlayerStrings[17].blue = 139
89
- PlayerStrings[18].red = 191
90
- PlayerStrings[18].green = 255
91
- PlayerStrings[18].blue = 128
92
- PlayerStrings[19].red = 220
93
- PlayerStrings[19].green = 185
94
- PlayerStrings[19].blue = 235
95
- PlayerStrings[20].red = 40
96
- PlayerStrings[20].green = 40
97
- PlayerStrings[20].blue = 40
98
- PlayerStrings[21].red = 235
99
- PlayerStrings[21].green = 240
100
- PlayerStrings[21].blue = 255
101
- PlayerStrings[22].red = 0
102
- PlayerStrings[22].green = 120
103
- PlayerStrings[22].blue = 30
104
- PlayerStrings[23].red = 164
105
- PlayerStrings[23].green = 111
106
- PlayerStrings[23].blue = 51
107
- *
108
- *
109
- */
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  export * from "./abilities";
2
3
  export * from "./camera";
3
4
  export * from "./chat-command";
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  import { Unit } from "w3ts";
2
3
  /**
3
4
  * Checks if the unit has an item in their item slots
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  /**
2
3
  * @deprecated
3
4
  * @param a
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  export type MINIMAP_ICONS = "UI\\Minimap\\MiniMap-ControlPoint.mdl" | "UI\\Minimap\\MiniMap-QuestGiver.mdl" | "UI\\Minimap\\Minimap-QuestObjectiveBonus.mdl" | "UI\\Minimap\\Minimap-QuestObjectivePrimary.mdl" | "UI\\Minimap\\Minimap-QuestTurnIn.mdl" | "UI\\Minimap\\MiniMap-Hero.mdl" | "UI\\Minimap\\Minimap-Ping.mdl" | "UI\\Minimap\\MiniMap-Item.mdl" | "UI\\Minimap\\MiniMap-NeutralBuilding.mdl";
2
3
  export declare enum MinimapIconPath {
3
4
  controlPoint = "UI\\Minimap\\MiniMap-ControlPoint.mdl",
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  import { Effect, MapPlayer, Unit } from "w3ts";
2
3
  type ProperColors = "goldenrod" | "magenta" | "green" | "yellow" | "red" | "player1-red" | "player2-blue" | "player3-teal" | "player4-purple" | "player5-yellow" | "player6-orange";
3
4
  export declare function tColor(text: string | number, color?: ProperColors | null, hex?: PlayerColorHex | string | null, alpha?: string): string;
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  import { Effect, Unit } from "w3ts";
2
3
  interface ApplyForceConfig {
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  import { MapPlayer, Rectangle, Unit } from "w3ts";
2
3
  /**
3
4
  * Does a callback for every unit of the player that has the ability
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  import { Point } from "w3ts";
2
3
  export declare function createValidPoint(maxAttempts: number, validatorFn: (p: Point) => {}): Point | undefined;
3
4
  export declare function getRandomCoordinatesInCircularArea(relativeX: number, relativeY: number, radius: number): {
@@ -1,2 +1,3 @@
1
+ /** @noSelfInFile */
1
2
  export declare function setup_quests(): void;
2
3
  export declare function addQuest(title: string, description: string, iconPath?: string, required?: boolean): void;
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  import { Unit } from "w3ts";
2
3
  /**
3
4
  * https://www.hiveworkshop.com/threads/floating-text.149719/
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  import { Timer } from "w3ts";
2
3
  /**
3
4
  * @param duration milliseconds
@@ -1,3 +1,4 @@
1
+ /** @noSelfInFile */
1
2
  import { MapPlayer, Unit } from "w3ts";
2
3
  export declare function createUnits(quantity: number, useFood: boolean, ...args: Parameters<typeof Unit.create>): Unit[];
3
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warcraft-3-w3ts-utils",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "A library of utility functions for modding Warcraft 3 utilizing the W3TS template.",
5
5
  "main": "./src/index.ts",
6
6
  "keywords": [
package/readme.md ADDED
@@ -0,0 +1,62 @@
1
+ # WC3-W3TS-utils
2
+
3
+ Small collection of utility helpers for projects using W3TS (Warcraft III TypeScript, v3.x). Designed to be lightweight and easy to drop into your WC3 TypeScript projects to simplify common tasks (tables, math, cloning, timers, safe wrappers, etc.).
4
+
5
+ ## Features
6
+ - Safe wrappers for native WC3 APIs
7
+ - Common math and clamp helpers
8
+ - Table/object deep clone and merge
9
+ - Timer helpers and simple schedulers
10
+ - Small, dependency-free TypeScript utilities
11
+
12
+ ## Installation
13
+ Copy the utils folder into your project or install via your package manager if published:
14
+
15
+ npm
16
+ ```
17
+ npm install wc3-w3ts-utils
18
+ ```
19
+
20
+ yarn
21
+ ```
22
+ yarn add wc3-w3ts-utils
23
+ ```
24
+
25
+ Or add the files directly to your W3TS project (recommended for custom Warcraft builds).
26
+
27
+ ## Usage
28
+ Import only what you need:
29
+
30
+ ```ts
31
+ import { createTimer } from 'wc3-w3ts-utils';
32
+
33
+ // timer example
34
+ const t = createTimer(() => {
35
+ // do something each tick
36
+ }, 1.0, true);
37
+ ```
38
+
39
+ If copied directly into a W3TS project, adjust import paths accordingly:
40
+ ```ts
41
+ import { clamp } from './utils/math';
42
+ ```
43
+
44
+ ## API (examples)
45
+ - clamp(value: number, min: number, max: number): number
46
+ - deepClone<T>(obj: T): T
47
+ - merge<T>(target: T, source: Partial<T>): T
48
+ - createTimer(callback: () => void, period: number, repeating?: boolean)
49
+ - safeCall<T>(fn: () => T, fallback?: T): T
50
+
51
+ (See source files for full signatures and docs.)
52
+
53
+ ## Contributing
54
+ - Open an issue for bugs or enhancement requests.
55
+ - Fork, create a feature branch, and submit a PR with tests/examples where applicable.
56
+ - Keep changes small and well-documented.
57
+
58
+ ## License
59
+ MIT — see LICENSE file.
60
+
61
+ ## Notes
62
+ Built to be simple and compatible with W3TS v3.x and Warcraft III modding workflows. Adjust imports when integrating directly into your map project.