55 lines
2.3 KiB
Markdown
55 lines
2.3 KiB
Markdown
# Asset pack (scaffold) — MMORPG
|
|
|
|
Server-only plugins **cannot inject a button into the native inventory screen** and cannot render
|
|
a custom-designed page without a client-side asset (`.ui`). This folder is the scaffold to add one.
|
|
|
|
## What already works without this asset pack
|
|
|
|
- `/mmorpg menu` opens a real `CustomUIPage` (`PlayerInfoPage`) built with **inline UI markup**, so
|
|
it renders without any bundled asset.
|
|
- `/mmorpg info` prints the same data in chat (reliable fallback).
|
|
- The `mmorpg_player_info` interaction is registered (`OpenCustomUIInteraction`) so the page can be
|
|
opened from an item/block interaction once you wire one.
|
|
|
|
## Class ability keys (Ability 1/2/3)
|
|
|
|
Weapon ability slots are overridden in **`src/main/resources/Server/Item/Items/`** (bundled with the
|
|
plugin JAR, not this scaffold folder). Each patch sets:
|
|
|
|
```json
|
|
"Ability1": {
|
|
"Interactions": [{ "Type": "mmorpg_cast_ability", "Slot": 1 }]
|
|
}
|
|
```
|
|
|
|
The Java interaction `mmorpg_cast_ability` is registered in `MmorpgPlugin`. Even without a patch
|
|
for a given weapon, the **packet filter** still routes Ability 1/2/3 to class abilities when the
|
|
player has a class.
|
|
|
|
To patch another weapon, add `Server/Item/Items/<ItemId>.json` with only `"Id"` and `"Interactions"`.
|
|
|
|
Shipped examples: longsword, battleaxe, staff, daggers, shortbow, crossbow (mithril/cobalt variants).
|
|
|
|
## Enabling the designed `.ui` template
|
|
|
|
1. Package this `assetpack/` content according to your Hytale/ScaffoldIt asset-pack layout and set
|
|
`"IncludesAssetPack": true` in `src/main/resources/manifest.json`.
|
|
2. Edit `com.disklexar.mmorpg.ui.PlayerInfoPage#build` to append the template and fill fields:
|
|
|
|
```java
|
|
ui.append("Pages/MmorpgPlayerInfo.ui");
|
|
ui.set("#Title.Text", "Profil MMORPG");
|
|
for (PlayerInfoView.Entry e : PlayerInfoView.entries(profile)) {
|
|
ui.append("#Content", "Label { Text: \"" + e.label() + " : " + e.value() + "\"; }");
|
|
}
|
|
events.addEventBinding(CustomUIEventBindingType.Click, "#CloseButton");
|
|
```
|
|
|
|
3. Validate the `.ui` grammar in-game and adjust `MmorpgPlayerInfo.ui`.
|
|
|
|
## Inventory button
|
|
|
|
A literal button inside the native inventory UI requires a client UI mod/asset overriding the
|
|
inventory screen, which is out of scope for a server-only plugin. The supported equivalents are the
|
|
`/mmorpg menu` command and the `mmorpg_player_info` interaction above.
|