bloxd.io.d.ts 1.1.0 → 1.2.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/api-type-def/normal/index.d.ts +2 -10
- package/api-type-def/normal/{getPlayerIds.d.ts → player/getPlayerIds.d.ts} +1 -1
- package/api-type-def/normal/{getPlayerPartyWhenJoined.d.ts → player/getPlayerPartyWhenJoined.d.ts} +1 -1
- package/api-type-def/normal/player/index.d.ts +10 -0
- package/api-type-def/normal/{playerIsInGame.d.ts → player/playerIsInGame.d.ts} +1 -1
- package/api-type-def/normal/{playerIsLoggedIn.d.ts → player/playerIsLoggedIn.d.ts} +1 -1
- package/api-type-def/normal/shops/configureShopCategory.d.ts +17 -0
- package/api-type-def/normal/shops/createShopItem.d.ts +22 -0
- package/api-type-def/normal/shops/deleteShopItem.d.ts +16 -0
- package/api-type-def/normal/shops/index.d.ts +9 -2
- package/api-type-def/normal/shops/updateShopItem.d.ts +21 -0
- package/package.json +1 -1
- package/type/index.d.ts +1 -0
- package/type/shop/ShopCategoryConfig.d.ts +10 -0
- package/type/shop/ShopCategoryKey.d.ts +1 -0
- package/type/shop/ShopItem.d.ts +23 -0
- package/type/shop/ShopItemBadgeType.d.ts +1 -0
- package/type/shop/ShopItemKey.d.ts +1 -0
- package/type/shop/ShopItemUserInput.d.ts +18 -0
- package/type/shop/index.d.ts +6 -0
- /package/api-type-def/normal/{getNumPlayers.d.ts → player/getNumPlayers.d.ts} +0 -0
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import GetPlayerIdsInterface from "./getPlayerIds";
|
|
2
|
-
import PlayerIsInGameInterface from "./playerIsInGame";
|
|
3
|
-
import PlayerIsLoggedInInterface from "./playerIsLoggedIn";
|
|
4
|
-
import GetPlayerPartyWhenJoinedInterface from "./getPlayerPartyWhenJoined";
|
|
5
|
-
import GetNumPlayersInterface from "./getNumPlayers";
|
|
6
1
|
import GetUnitCoordinatesLifeformWithinInterface from "./getUnitCoordinatesLifeformWithin";
|
|
7
2
|
import { ShopApis } from "./shops";
|
|
8
3
|
import { ShieldApis } from "./shields";
|
|
@@ -11,14 +6,11 @@ import { StandingOnApis } from "./standingOns";
|
|
|
11
6
|
import { HealthApis } from "./health";
|
|
12
7
|
import { KillstreakApis } from "./killstreak";
|
|
13
8
|
import { MessageApis } from "./message";
|
|
9
|
+
import { PlayerApis } from "./player";
|
|
14
10
|
import { MargeObject } from "../../type";
|
|
15
11
|
|
|
16
12
|
type AllNormalApiIntersection = PositionApis &
|
|
17
|
-
|
|
18
|
-
PlayerIsInGameInterface &
|
|
19
|
-
PlayerIsLoggedInInterface &
|
|
20
|
-
GetPlayerPartyWhenJoinedInterface &
|
|
21
|
-
GetNumPlayersInterface &
|
|
13
|
+
PlayerApis &
|
|
22
14
|
StandingOnApis &
|
|
23
15
|
GetUnitCoordinatesLifeformWithinInterface &
|
|
24
16
|
ShopApis &
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import GetPlayerIdsInterface from "./getPlayerIds";
|
|
2
|
+
import GetNumPlayersInterface from "./getNumPlayers";
|
|
3
|
+
import GetPlayerPartyWhenJoinedInterface from "./getPlayerPartyWhenJoined";
|
|
4
|
+
import PlayerIsInGameInterface from "./playerIsInGame";
|
|
5
|
+
import PlayerIsLoggedInInterface from "./playerIsLoggedIn";
|
|
6
|
+
export type PlayerApis = GetNumPlayersInterface &
|
|
7
|
+
GetPlayerIdsInterface &
|
|
8
|
+
GetPlayerPartyWhenJoinedInterface &
|
|
9
|
+
PlayerIsInGameInterface &
|
|
10
|
+
PlayerIsLoggedInInterface;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ShopCategoryConfig, ShopCategoryKey } from "../../../type";
|
|
2
|
+
|
|
3
|
+
interface ConfigureShopCategory {
|
|
4
|
+
/**
|
|
5
|
+
* Set properties of a shop category.
|
|
6
|
+
*
|
|
7
|
+
* @param {ShopCategoryKey} categoryKey - The key of the category to configure
|
|
8
|
+
* @param {ShopCategoryConfig} config - Category configuration properties
|
|
9
|
+
* @returns {void}
|
|
10
|
+
*/
|
|
11
|
+
configureShopCategory(
|
|
12
|
+
categoryKey: ShopCategoryKey,
|
|
13
|
+
config: ShopCategoryConfig,
|
|
14
|
+
): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default ConfigureShopCategory;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ShopCategoryKey, ShopItem, ShopItemKey } from "../../../type";
|
|
2
|
+
|
|
3
|
+
interface CreateShopItemInterface {
|
|
4
|
+
/**
|
|
5
|
+
* Create a new shop item under the given category.
|
|
6
|
+
* Will create a new category if it does not exist.
|
|
7
|
+
* If the shop item already exists then it will be replaced.
|
|
8
|
+
* If any per-player overrides exist under the same categoryKey and itemKey then they will be deleted.
|
|
9
|
+
*
|
|
10
|
+
* @param {ShopCategoryKey} categoryKey - The key of the category to create the item in
|
|
11
|
+
* @param {ShopItemKey} itemKey - The unique key for the item
|
|
12
|
+
* @param {ShopItem} item - The shop item to create (will be mutated)
|
|
13
|
+
* @returns {void}
|
|
14
|
+
*/
|
|
15
|
+
createShopItem(
|
|
16
|
+
categoryKey: ShopCategoryKey,
|
|
17
|
+
itemKey: ShopItemKey,
|
|
18
|
+
item: ShopItem,
|
|
19
|
+
): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default CreateShopItemInterface;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ShopCategoryKey, ShopItemKey } from "../../../type";
|
|
2
|
+
|
|
3
|
+
interface DeleteShopItemInterface {
|
|
4
|
+
/**
|
|
5
|
+
* Delete an existing shop item.
|
|
6
|
+
* Throws an error if the item does not exist.
|
|
7
|
+
* Will also delete all per-player overrides for the shop item.
|
|
8
|
+
*
|
|
9
|
+
* @param {ShopCategoryKey} categoryKey - The key of the category containing the item
|
|
10
|
+
* @param {ShopItemKey} itemKey - The unique key for the item
|
|
11
|
+
* @returns {void}
|
|
12
|
+
*/
|
|
13
|
+
deleteShopItem(categoryKey: ShopCategoryKey, itemKey: ShopItemKey): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default DeleteShopItemInterface;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import ShowShopTutorialInterface from "./showShopTutorial";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import CreateShopItemInterface from "./createShopItem";
|
|
3
|
+
import UpdateShopItemInterface from "./updateShopItem";
|
|
4
|
+
import DeleteShopItemInterface from "./deleteShopItem";
|
|
5
|
+
import ConfigureShopCategory from "./configureShopCategory";
|
|
6
|
+
export type ShopApis = ShowShopTutorialInterface &
|
|
7
|
+
CreateShopItemInterface &
|
|
8
|
+
UpdateShopItemInterface &
|
|
9
|
+
DeleteShopItemInterface &
|
|
10
|
+
ConfigureShopCategory;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ShopCategoryKey, ShopItem, ShopItemKey } from "../../../type";
|
|
2
|
+
|
|
3
|
+
interface UpdateShopItemInterface {
|
|
4
|
+
/**
|
|
5
|
+
* Update selected properties of an existing shop item.
|
|
6
|
+
* For example, { canBuy: true } to allow players to purchase the item.
|
|
7
|
+
* Throws an error if the item does not exist.
|
|
8
|
+
*
|
|
9
|
+
* @param {ShopCategoryKey} categoryKey - The key of the category containing the item
|
|
10
|
+
* @param {ShopItemKey} itemKey - The unique key for the item
|
|
11
|
+
* @param {Partial<ShopItem>} changes - Partial shop item properties to update
|
|
12
|
+
* @returns {void}
|
|
13
|
+
*/
|
|
14
|
+
updateShopItem(
|
|
15
|
+
categoryKey: ShopCategoryKey,
|
|
16
|
+
itemKey: ShopItemKey,
|
|
17
|
+
changes: Partial<ShopItem>,
|
|
18
|
+
): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default UpdateShopItemInterface;
|
package/package.json
CHANGED
package/type/index.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CustomTextStyling } from "..";
|
|
2
|
+
|
|
3
|
+
export type ShopCategoryConfig = Partial<{
|
|
4
|
+
autoSelectCategory: boolean;
|
|
5
|
+
customTitle: string; // Supports translation keys and ordinary text
|
|
6
|
+
redDot: boolean;
|
|
7
|
+
forceRemoveRedDot: boolean;
|
|
8
|
+
sortPriority: number;
|
|
9
|
+
description: string | CustomTextStyling;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ShopCategoryKey = string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ShopItemBadgeType, ShopItemUserInput } from ".";
|
|
2
|
+
import { CustomTextStyling, StringColor } from "..";
|
|
3
|
+
|
|
4
|
+
export type ShopItem = {
|
|
5
|
+
image: string;
|
|
6
|
+
cost?: number;
|
|
7
|
+
currency?: string;
|
|
8
|
+
amount?: number; // Display amount shown on the shop tile image (0 and 1 are not displayed)
|
|
9
|
+
imageColour?: StringColor;
|
|
10
|
+
canBuy?: boolean;
|
|
11
|
+
isSelected?: boolean;
|
|
12
|
+
buyButtonText?: string | CustomTextStyling;
|
|
13
|
+
customTitle?: string | CustomTextStyling;
|
|
14
|
+
description?: string | CustomTextStyling;
|
|
15
|
+
onBoughtMessage?: string | CustomTextStyling;
|
|
16
|
+
redDot?: boolean;
|
|
17
|
+
forceRemoveRedDot?: boolean;
|
|
18
|
+
badge?: { text: string | CustomTextStyling; type: ShopItemBadgeType };
|
|
19
|
+
userInput?: ShopItemUserInput;
|
|
20
|
+
sell?: boolean; // Optional, defaults to false. If true, the sign of "cost" is flipped. So a "cost" of -25 would give the player 25 currency AND be displayed as "25" (instead of -25)
|
|
21
|
+
sortPriority?: number; // Descending, bigger number means closer to the top
|
|
22
|
+
hidden?: boolean;
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ShopItemBadgeType = "new" | "lucky";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ShopItemKey = string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PlayerId } from "..";
|
|
2
|
+
|
|
3
|
+
export type ShopItemUserInput =
|
|
4
|
+
| {
|
|
5
|
+
type: "text";
|
|
6
|
+
placeholderText?: string;
|
|
7
|
+
wordCharsOnly?: boolean;
|
|
8
|
+
initialValue?: string;
|
|
9
|
+
} // wordCharsOnly defaults to false. If true, only allows \w character (alphanumeric and _). initialValue always takes precedence as the text input value when set.
|
|
10
|
+
| { type: "number"; placeholderText?: string; initialValue?: string }
|
|
11
|
+
| {
|
|
12
|
+
type: "dropdown";
|
|
13
|
+
dropdownOptions: readonly (string | { option: string; cost: number })[];
|
|
14
|
+
shouldResetSelectionOnOptionsChange?: boolean; // Defaults to false. If true, the selection will reset to the first option when dropdownOptions changes.
|
|
15
|
+
initialValue?: string;
|
|
16
|
+
}
|
|
17
|
+
| { type: "player"; excludedPlayers?: PlayerId[] } // Defaults to excluding the current player
|
|
18
|
+
| { type: "color"; initialValue?: string };
|
|
File without changes
|