@@ -0,0 +1,54 @@
|
||||
# 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.
|
||||
@@ -0,0 +1,29 @@
|
||||
// Sample custom UI page template for the MMORPG player-info screen.
|
||||
//
|
||||
// This is a SCAFFOLD: the exact .ui markup grammar is defined by the Hytale client and must be
|
||||
// validated in-game. The plugin works today without this file because PlayerInfoPage builds its
|
||||
// layout with inline markup. Use this template when you want a richer designed layout, then have
|
||||
// PlayerInfoPage.build() append "Pages/MmorpgPlayerInfo.ui" and set the named fields below.
|
||||
//
|
||||
// Named fields the server can target via UICommandBuilder.set(...):
|
||||
// #Title.Text - page title
|
||||
// #Content - vertical container the server appends one Label per attribute into
|
||||
// #CloseButton - close/dismiss button (bind via UIEventBuilder)
|
||||
|
||||
Panel {
|
||||
Style: (Width: 420; Anchor: Center; Padding: 16; Background: (Color: #1b1b1fEE));
|
||||
|
||||
Label #Title {
|
||||
Text: "Profil MMORPG";
|
||||
Style: (Alignment: Center; FontSize: 20; MarginBottom: 12);
|
||||
}
|
||||
|
||||
VerticalList #Content {
|
||||
Style: (Spacing: 4);
|
||||
}
|
||||
|
||||
Button #CloseButton {
|
||||
Text: "Fermer";
|
||||
Style: (Alignment: Center; MarginTop: 12);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user