API UO AddFigure - LIHACHTETAN/ClassicUO-BadNewbie-BasicIDE GitHub Wiki

UO.AddFigure

ClassicUO / Basic IDE

Оглавление · Алфавитный указатель · Client UI

Creates a persistent client-side overlay entry used by the actual ClassicUO WorldMapGump. The map renders line, ellipse, rectangle, direction-arrow and text figure kinds. World-coordinate figures follow the current map transform/zoom; screen-coordinate figures are relative to the map gump. The returned ID is used by UpdateFigure and RemoveFigure.

Синтаксис

UO.AddFigure(Figure:Any) -> Any

Регистр имени не важен. Any — динамическое значение Basic; Unit — отсутствие возвращаемого значения. Integer — знаковое 32-битное число, Decimal — число с плавающей точкой. Правила типов, serial, индексов и ожиданий.

Параметры

Имя Назначение
Figure Позиционный аргумент этой перегрузки. Подробности использования указаны в описании/фактической ветви runtime ниже.

Параметры обязательны внутри каждой показанной сигнатуры. Опустить аргумент можно только при наличии более короткой перегрузки; пропуск позиции посередине не подразумевается.

Ограничения

The figure is local to this ClassicUO client; no server packet is sent.

  • Only figures whose worldNum matches the currently displayed facet are drawn.
  • Historical brushColor/brushStyle fields are retained for compatibility; the current Basic renderer guarantees outline/text rendering and does not claim pixel-identical Delphi brush hatching.
  • fkDirection with world coordinates and x2=0,y2=0 draws from the current player toward x1,y1, matching the common Stealth usage pattern.
  • Figures remain in the client-side map collection until removed/cleared or the process ends.

Примеры

Каждый блок — самостоятельный скрипт из мануала проекта. Параметры демонстрационного объекта/контейнера и условия действия необходимо сопоставить с вашей игровой ситуацией.

Пример 1

SUB Main()
    # Red world-space rectangle with a label
    DIM fig(11)
    fig[0] = 2
    fig[1] = 0
    fig[2] = UO.GetX(self)-3
    fig[3] = UO.GetY(self)-3
    fig[4] = UO.GetX(self)+3
    fig[5] = UO.GetY(self)+3
    fig[6] = 0
    fig[7] = 1
    fig[8] = 255
    fig[9] = UO.WorldNum()
    fig[10] = 'Area'
    VAR figureId = UO.AddFigure(fig)
END SUB

Пример 2

SUB Main()
    # Direction arrow from player toward a world point
    DIM dirFig(11)
    dirFig[0] = 3
    dirFig[1] = 0
    dirFig[2] = UO.GetX(self)+10
    dirFig[3] = UO.GetY(self)
    dirFig[4] = 0
    dirFig[5] = 0
    dirFig[6] = 0
    dirFig[7] = 1
    dirFig[8] = 65280
    dirFig[9] = UO.WorldNum()
    dirFig[10] = 'East'
    VAR arrowId = UO.AddFigure(dirFig)
END SUB

Пример 3

SUB Main()
    VAR result = UO.AddFigure(1)
    UO.Print(CStr(result))
END SUB

Пример 4

SUB Main()
    VAR arg1 = 1 # Figure
    VAR result = UO.AddFigure(arg1)
    UO.Print(CStr(result))
END SUB

Пример 5

SUB ReadResult()
    VAR arg1 = 1 # Figure
    VAR result = UO.AddFigure(arg1)
    UO.Print(CStr(result))
END SUB

SUB Main()
    ReadResult()
END SUB
Реализация и проверка контракта
  • InjectionScript.Runtime.InjectionApiUO+<>c__DisplayClass38_0.<RegisterStealthCompatibility>b__0

Соответствующая ветвь совместимого обработчика в InjectionApiUO.cs. Arg(i)/Text(i) читают позицию с нуля; bridge обращается к клиенту. Прямые типизированные перегрузки перечислены выше и могут иметь отдельный маршрут.

{
                    if (!TryMapFigureArg(0, out int[] figure, out string figureText))
                        return InjectionValue.Zero;
                    int id = state.NextMapFigureId++;
                    if (bridge.SetMapFigure(id, figure[0], figure[1], figure[2], figure[3], figure[4], figure[5], figure[6], figure[7], figure[8], figure[9], figureText) == 0)
                        return InjectionValue.Zero;
                    state.MapFigures[id] = SerializeMapFigure(figure, figureText);
                    return new InjectionValue(id);
                }

Источник реестра и отчёт сверки. Примеры проверяются загрузчиком/парсером включённого runtime. Действия на игровом сервере этой проверкой не исполняются.

⚠️ **GitHub.com Fallback** ⚠️