RewardBoxes
Adds loot-box like functionality to the game. This mod is intended for other mods but can be used standalone.
Описание
Это мод для Hytale.
Этот мод добавляет возможность создавать случайные «лут-боксы».
В автономном режиме он имеет только /командные функции, но как api он добавляет возможность запуска пользовательских событий, чтобы вознаградить игроков с помощью «лут-бокса».
Использование:
Все следующие команды начинаются с «/RewardBox» {Пример: «/RewardBox создает пример»}
| Командование | Описание | Разрешение |
|---|---|---|
| List_boxs список | Список всех ящиков и сколько предметов они содержат «-rewardbox ExampleBox» можно использовать для перечисления всех предметов в RewardBox. | |
| roll_box <RewardBox_Name> roll, pull | Если у пользователя есть «ключ» к указанному RewardBox, он переворачивает коробку и помещает вознаграждение в инвентарь игрока. Если в инвентаре игрока недостаточно места, то предмет сбрасывается на землю. | |
| Создать <Name> | Создаем новый RewardBox | Награды.admin |
| удалите_box <Name> rem_box, rb | Удалить целый бонус | Награды.admin |
| add_item <RewardBox_name> <ItemID> <Quantity> <Chance> add | Добавляет элемент в RewardBox. Один и тот же элемент может быть добавлен несколько раз ItemID может быть любым элементом: {"Tool_Pickaxe_Crude"} Случайность представлена как: { Случай/Сумма(RewardBox.items.chance)} | Награды.admin |
| Удалить_item <RewardBox_name> <ItemID> rem, r | Удалите все элементы, которые соответствуют примеру ItemID: если у вас есть коробка с двумя «Tool_Pickaxe_Crude», она удалит обе записи из коробки. | Награды.admin |
| grant_item_roll <player_name> <RewardBox_Name> optional_arg:<amount> add_roll | Добавляет «ключ» к целевому игроку, это позволяет им открывать указанное количество раз. <количество> при исключении из команды равно 1 | Награды.admin |
Для владельцев серверов и моддеров
Джейсон Конфиг
В первый раз, когда этот мод запустит, он создаст {server_root_directory}/config/KatsiLib/RewardBoxes.json, этот файл хранит всю информацию о RewardBoxes на вашем сервере, команды динамически сохраняют этот файл, поэтому, если вы предпочитаете настроить RewardBoxes из игры, тогда это тоже работает.
Когда вы впервые запустите мод, он сгенерирует конфигурацию по умолчанию с примерами, но только если файл не существует.
Дефолт и пример для создания награды Конфигурация коробки:
{
«is_enabled» — истинно,
"reward_boxes": [
{
"box_creator": "Каци",
"box_name": "DefaultRewardBox",
"пункты":
{
"item_id": "Tool_Pickaxe_Crude",
"pull_chance": 0,5,
"количество": 1 1
?
{
"item_id": "Tool_Hatchet_Crude",
"pull_chance": 0,5,
"количество": 1 1
?
]
"total_chance": 1.0
?
{
"box_creator": "Каци",
"box_name": "ExampleRewardBox",
"пункты":
{
"item_id": "Weapon_Daggers_Crude",
"pull_chance": 35.0,
"количество": 1 1
?
{
"item_id": "Weapon_Daggers_Bone",
"pull_chance": 30.0,
"количество": 1 1
?
{
"item_id": "Weapon_Daggers_Bronze",
"pull_chance": 20.0,
"количество": 1 1
?
{
"item_id": "Weapon_Daggers_Copper",
"pull_chance": 10.0,
"количество": 1 1
?
{
"item_id": "Weapon_Daggers_Iron",
"pull_chance": 5.0,
"количество": 1 1
?
]
"total_chance": 100.0
?
]
?
Примечание: «total_chance» — это просто число, которое рассчитывается при запуске, поэтому его значение не имеет значения.
Моддинг API
Примером мода, который использует этот API модов, является мой «DailyLoginReward». Исходный код доступен на github для дальнейшей ссылки.
Чтобы взаимодействовать с этим API модов, вы используете Hytales, встроенный в систему событий, этот мод имел 2 события, связанные с ним, GrantRollEvent() и ConsumeRollEvent(), оба этих события имеют одну и ту же подпись «новый GrantRollEvent(PlayerRef targetted_player, String RewardBoxName, int Number_Keys_To_Give);»
GrantRollEvent дает «ключи» целевому игроку, чтобы иметь возможность открывать определенные бонусные окна. ConsumeRollEvent заставляет целевого игрока пытаться перевернуть RewardBox X несколько раз. Примечание: Пользователь будет использовать свои ключи, чтобы открыть эти ящики, и остановится, как только они закончатся. {Пример: У меня есть 4 клавиши -> Событие(Я, Примербокс, 6) -> Произойдет 4 броска, и у меня останется 0 ключей. ?
Код для отправки события обычно:
Разработчик:GrantRoll Событие, GrantRollEvent> диспетчер = HytaleServer.get().getEventBus().dispatchFor(GrantRollEvent.class); if (dispatcher.hasListener()) Грантролл Событие = новый GrantRollEvent (playerRef, reward_box,num_keys_to_give); dispatcher.dispatch (событие); }
Показать оригинальное описание (English)
This is a mod for Hytale.
This mod adds the ability to create random 'loot-boxes'.
Standalone it only has /command functionalities, but as a api it adds the ability to trigger custom events to reward players with a 'loot-box'.
Usage:
All of the following commands start with “/RewardBox” {Example: “/RewardBox create example”}
| Command | Description | Permission |
|---|---|---|
| list_boxes list | Lists all boxes & how many items they contain “–rewardbox ExampleBox” can be used to list all items in an RewardBox | |
| roll_box <RewardBox_Name> roll, pull | If the user has a ‘key’ to the specified RewardBox, it rolls the box and puts the reward in the player's inventory. If there is not enough room in a player's inventory then the item is dropped on the ground. | |
| create <Name> | Creates a new RewardBox | rewardboxes.admin |
| remove_box <Name> rem_box, rb | Deletes an entire RewardBox | rewardboxes.admin |
| add_item <RewardBox_name> <ItemID> <Quantity> <Chance> add, a | Adds an item to a RewardBox. The same item can be added multiple times ItemID can be any item: {"Tool_Pickaxe_Crude"} Chance is represented as: {Chance / Sum(RewardBox.items.chance)} | rewardboxes.admin |
| remove_item <RewardBox_name> <ItemID> rem, r | Removes all items that match the ItemID Example: if you have a box with two “Tool_Pickaxe_Crude” it will remove both entries from the box | rewardboxes.admin |
| grant_item_roll <player_name> <RewardBox_Name> optional_arg:<amount> add_roll, ar | Adds a ‘key’ to the targeted player, this allows them to open the specified box <amount> of times. <amount> when excluded from command is 1 | rewardboxes.admin |
For Server Owners & Modders
Json Config
The first time this mod launches it will create a {server_root_directory}/config/KatsiLib/RewardBoxes.json, this file stores all the information about the RewardBoxes on your server, the commands dynamically save to this file so if you prefer to setup RewardBoxes from within the game then that works too.
When you first launch the mod it will generate a default config with examples, but only if the file didn't exist.
Default & Example for creating an RewardBox config:
{
"is_enabled": true,
"reward_boxes": [
{
"box_creator": "Katsi",
"box_name": "DefaultRewardBox",
"items": [
{
"item_id": "Tool_Pickaxe_Crude",
"pull_chance": 0.5,
"quantity": 1
},
{
"item_id": "Tool_Hatchet_Crude",
"pull_chance": 0.5,
"quantity": 1
}
],
"total_chance": 1.0
},
{
"box_creator": "Katsi",
"box_name": "ExampleRewardBox",
"items": [
{
"item_id": "Weapon_Daggers_Crude",
"pull_chance": 35.0,
"quantity": 1
},
{
"item_id": "Weapon_Daggers_Bone",
"pull_chance": 30.0,
"quantity": 1
},
{
"item_id": "Weapon_Daggers_Bronze",
"pull_chance": 20.0,
"quantity": 1
},
{
"item_id": "Weapon_Daggers_Copper",
"pull_chance": 10.0,
"quantity": 1
},
{
"item_id": "Weapon_Daggers_Iron",
"pull_chance": 5.0,
"quantity": 1
}
],
"total_chance": 100.0
}
]
}
Note: “total_chance” just needs to be a number, it is calculated on startup so its value does not matter.
Modding API
An example mod that uses this mods API is my 'DailyLoginReward'. The source code is available on github for futher reference.
To interact with this mods API you use Hytales built in event system, this mod had 2 events tied to it, GrantRollEvent() and the ConsumeRollEvent(), both of these events have the same signature "new GrantRollEvent(PlayerRef targetted_player, String RewardBoxName, int Number_Keys_To_Give);"
The GrantRollEvent gives 'keys' to the targeted player to be able to open specified RewardBoxes. The ConsumeRollEvent causes the targeted player to attempt to roll a RewardBox X amount of times. Note: The user will consume their keys to open these boxes and will stop once they run out of keys. {Example: I have 4 keys -> Event(Me, ExampleBox, 6) -> 4 rolls will happen and I will have 0 keys left over.}
The code to dispatch an event is typically:
IEventDispatcher<GrantRollEvent, GrantRollEvent> dispatcher = HytaleServer.get().getEventBus().dispatchFor(GrantRollEvent.class); if (dispatcher.hasListener()) { GrantRollEvent event = new GrantRollEvent(playerRef, reward_box, num_keys_to_give); dispatcher.dispatch(event); }
Информация
Авторы:
Категории:
Версии игры:
Создан: 17.01.2026