Progetto H — API Reference API & Scripting Documentation

Funzioni & API Esportate 10

ph.alertDialog

Client
ph.alertDialog(options)
Opens a centered obsidian modal with gold gradient borders. Blocks current coroutine until user selects Confirm or Cancel / presses ESC.

Parametri & Opzioni

Parametro Tipo Stato Descrizione
options.header string Obbligatorio Uppercase header text (Cinzel font).
options.content string Obbligatorio Body content text. Supports newlines (\n).
options.centered boolean Opzionale (default: true) Centers text content if true.
options.cancel boolean Opzionale (default: true) Shows cancel button and allows ESC key if true.
options.labels table Opzionale Custom button labels: { confirm = 'Text', cancel = 'Text' }.

Valore di Ritorno

string — Returns 'confirm' on confirm, 'cancel' on cancel/ESC.

Esempio d'Uso

Esempio Lua
ph.async(function()
    local action = ph.alertDialog({
        header = "CONFIRM ACTION",
        content = "Are you sure you want to learn this ancient spell?\nCost: 50 Mana.",
        centered = true,
        cancel = true
    })
    if action == "confirm" then
        ph.notify({ title = "Spell Learned", type = "success" })
    end
end)

ph.registerContext

Client
ph.registerContext(menuData)
Registers a structured context menu card with multi-level submenus, icons, disabled states, and event triggers.

Parametri & Opzioni

Parametro Tipo Stato Descrizione
menuData.id string Obbligatorio Unique context menu identifier.
menuData.title string Obbligatorio Uppercase header title.
menuData.options table[] Obbligatorio Array of menu options: { title, description, icon, disabled, menu, arrow, onSelect, event, serverEvent, args }.

Valore di Ritorno

void — No return value.

Esempio d'Uso

Esempio Lua
ph.registerContext({
    id = "blacksmith_menu",
    title = "BLACKSMITH FORGE",
    options = {
        {
            title = "Repair Armor",
            description = "COST: 50 GOLD",
            icon = "shield",
            onSelect = function()
                ph.notify({ title = "Blacksmith", description = "Armor repaired!", type = "success" })
            end
        }
    }
})

ph.showContext("blacksmith_menu")

ph.showContext

Client
ph.showContext(menuId)
Opens registered context menu and captures mouse cursor focus.

Parametri & Opzioni

Parametro Tipo Stato Descrizione
menuId string | table Obbligatorio Menu ID to open.

Valore di Ritorno

void — No return value.

Esempio d'Uso

Esempio Lua
ph.showContext("blacksmith_menu")

ph.hideContext

Client
ph.hideContext()
Closes active context menu and releases mouse focus.

Valore di Ritorno

void — No return value.

Esempio d'Uso

Esempio Lua
ph.hideContext()

ph.inputDialog

Client
ph.inputDialog(heading, rows)
Opens universal form dialog with validation, color picker swatch, checkboxes, dates, and sliders.

Parametri & Opzioni

Parametro Tipo Stato Descrizione
heading string Obbligatorio Form title header.
rows table[] Obbligatorio Array of input field objects: 'input', 'number', 'checkbox', 'color', 'date', 'select', 'slider', 'textarea'.

Valore di Ritorno

table | nil — Returns array of entered values, or nil if cancelled.

Esempio d'Uso

Esempio Lua
ph.async(function()
    local input = ph.inputDialog("GUILD REGISTRATION", {
        { type = "input", label = "GUILD NAME", placeholder = "Emerald Knights", required = true },
        { type = "number", label = "MAX MEMBERS", default = 25, min = 5, max = 50 },
        { type = "checkbox", label = "RULES", text = "I accept kingdom charter", checked = true },
        { type = "color", label = "EMBLEM COLOR", default = "#049098" }
    })
end)

ph.progressBar

Client
ph.progressBar(options)
Displays glowing parallelogram linear progress bar with horizontal accent beams.

Parametri & Opzioni

Parametro Tipo Stato Descrizione
options.duration number Obbligatorio Duration in milliseconds (e.g. 4000).
options.label string Obbligatorio Centered text label.
options.position string Opzionale (default: 'bottom') 'bottom', 'middle', 'top'.
options.canCancel boolean Opzionale (default: true) Allows player to cancel via ESC or X.
options.freeze boolean Opzionale (default: false) Freezes player movements during progress.

Valore di Ritorno

boolean — True on completion, false on cancel.

Esempio d'Uso

Esempio Lua
ph.async(function()
    local success = ph.progressBar({
        duration = 4000,
        label = "Mining Crystal...",
        position = "bottom",
        canCancel = true,
        freeze = true
    })
end)

ph.progressCircle

Client
ph.progressCircle(options)
Displays concentric circular HUD progress ring with center percentage.

Parametri & Opzioni

Parametro Tipo Stato Descrizione
options.duration number Obbligatorio Duration in ms.
options.label string Opzionale Subtitle label.
options.position string Opzionale (default: 'middle') 'middle', 'bottom', 'top', 'right-center', 'left-center'.
options.canCancel boolean Opzionale (default: true) Allows cancel.
options.freeze boolean Opzionale (default: false) Freezes player movement.

Valore di Ritorno

boolean — True on completion, false on cancel.

Esempio d'Uso

Esempio Lua
ph.async(function()
    local ok = ph.progressCircle({ duration = 3500, label = "Channeling Spell", position = "middle" })
end)

ph.skillCheck

Client
ph.skillCheck(difficulties, inputs)
Runs precision QTE minigame with double concentric rings, rotating needle, and 0ms instant input registration.

Parametri & Opzioni

Parametro Tipo Stato Descrizione
difficulties string | string[] Opzionale (default: 'medium') 'easy', 'medium', 'hard' or array for sequences.
inputs string | string[] Opzionale (default: { 'e' }) Key or array of keys required (e.g. { 'e', 'space' }).

Valore di Ritorno

boolean — True on success, false on fail.

Esempio d'Uso

Esempio Lua
ph.async(function()
    local passed = ph.skillCheck({ "medium", "hard" }, { "e", "space" })
end)

ph.notify

Client
ph.notify(data)
Displays separate toast notifications with top/bottom gold borders or full Quest banner with diamond crest.

Parametri & Opzioni

Parametro Tipo Stato Descrizione
data.title string Obbligatorio Uppercase title (Cinzel font).
data.description string Opzionale Body description (Taviraj font).
data.type string Opzionale (default: 'info') 'success', 'fail' / 'error', 'warning' / 'info', 'quest'.
data.duration number Opzionale (default: 4500) Duration in ms.

Valore di Ritorno

void — No return value.

Esempio d'Uso

Esempio Lua
ph.notify({
    type = "quest",
    title = "NEW SECONDARY QUEST",
    description = "Arcanum Tournament",
    duration = 6000
})

ph.showTextUI

Client
ph.showTextUI(text, options)
Displays floating interaction prompt on screen in obsidian gold style.

Parametri & Opzioni

Parametro Tipo Stato Descrizione
text string Obbligatorio Prompt text.
options.position string Opzionale (default: 'right-center') 'right-center', 'left-center', 'top-center', 'bottom-center', 'top-right', 'top-left', 'bottom-right', 'bottom-left'.

Valore di Ritorno

void — No return value.

Esempio d'Uso

Esempio Lua
ph.showTextUI("[E] - Talk to Alchemist", { position = "right-center" })

-- To hide:
ph.hideTextUI()