RynthCore as of 2026-10-05 evening (internal 0a2043e): release 2026.10.5.20 - own dat reader, plugin manifests, UI/login hooks with Loot Editor drag-and-drop, server-message stream (API v78), raise attributes and skills (API v79), nameplate sizing and overlay opacity, engine reload held while a plugin is fighting, StatusAgent character sheet, world map and travel for DrakRemote
This commit is contained in:
parent
c3e15480e5
commit
913a2a00b6
110 changed files with 12560 additions and 1151 deletions
|
|
@ -6,7 +6,25 @@ namespace RynthCore.PluginCore;
|
|||
|
||||
public abstract class RynthPluginBase
|
||||
{
|
||||
public virtual uint MinimumApiVersion => RynthCoreHost.BaselineApiVersion;
|
||||
/// <summary>
|
||||
/// The oldest engine API the plugin starts on (RynthPluginRuntime refuses older ones). Defaults to
|
||||
/// the plugin's manifest minimum (RynthPluginMinEngineApi in its csproj, compiled in as
|
||||
/// [assembly: RynthPluginManifest]) so the plugin's own check and the engine's/launcher's manifest
|
||||
/// check agree; without a manifest, the SDK baseline.
|
||||
/// </summary>
|
||||
public virtual uint MinimumApiVersion => ManifestMinimum(GetType()) ?? RynthCoreHost.BaselineApiVersion;
|
||||
|
||||
private static uint? ManifestMinimum(Type pluginType)
|
||||
{
|
||||
try
|
||||
{
|
||||
return System.Reflection.CustomAttributeExtensions.GetCustomAttribute<RynthPluginManifestAttribute>(pluginType.Assembly)?.MinEngineApi;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected RynthCoreApiNative Api { get; private set; }
|
||||
protected RynthCoreHost Host { get; private set; }
|
||||
|
|
@ -68,4 +86,21 @@ public abstract class RynthPluginBase
|
|||
public virtual void OnKillNotification(string? deathMessage) { }
|
||||
public virtual void OnEnchantmentAdded(uint spellId, double durationSeconds) { }
|
||||
public virtual void OnEnchantmentRemoved(uint enchantmentId) { }
|
||||
|
||||
// v77 (RynthCoreHost.HasUiHooks): the client's screens and AC's own tooltips and drag/drop.
|
||||
// The plugin's exports call these through RynthPluginRuntime; an older engine never calls them.
|
||||
|
||||
/// <summary>The client changed screens (<see cref="RynthScreenMode"/>): e.g. World to CharacterSelect at logout.</summary>
|
||||
public virtual void OnScreenChanged(int oldMode, int newMode) { }
|
||||
/// <summary>The client is shutting down and about to tear its UI down. Last chance to read AC
|
||||
/// state; no ticks or events follow (Shutdown still does).</summary>
|
||||
public virtual void OnClientCleanup() { }
|
||||
/// <summary>AC shows a tooltip for an item (objectId) or a spell icon (spellId); both 0 for any other element.</summary>
|
||||
public virtual void OnTooltipShow(uint objectId, uint spellId) { }
|
||||
/// <summary>The tooltip from <see cref="OnTooltipShow"/> is gone.</summary>
|
||||
public virtual void OnTooltipHide() { }
|
||||
/// <summary>The player started dragging an item (objectId, its icon) or a spell (spellId) in AC's UI.</summary>
|
||||
public virtual void OnDragStart(uint objectId, uint spellId, uint iconId) { }
|
||||
/// <summary>AC took a dropped item or spell; targetElementId is the AC UI element it landed on.</summary>
|
||||
public virtual void OnItemDropped(uint objectId, uint spellId, uint targetElementId) { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,6 +279,53 @@ public unsafe sealed class RynthPluginRuntime<TPlugin>
|
|||
catch (Exception ex) { LogException("OnEnchantmentRemoved", ex); }
|
||||
}
|
||||
|
||||
// ── v77 UI callbacks ─────────────────────────────────────────────────
|
||||
// Exports: RynthPluginOnScreenChanged(int, int), RynthPluginOnClientCleanup(),
|
||||
// RynthPluginOnTooltipShow(uint, uint), RynthPluginOnTooltipHide(),
|
||||
// RynthPluginOnDragStart(uint, uint, uint), RynthPluginOnItemDropped(uint, uint, uint); all cdecl.
|
||||
|
||||
public void OnScreenChanged(int oldMode, int newMode)
|
||||
{
|
||||
if (!IsInitialized) return;
|
||||
try { _plugin!.OnScreenChanged(oldMode, newMode); }
|
||||
catch (Exception ex) { LogException("OnScreenChanged", ex); }
|
||||
}
|
||||
|
||||
public void OnClientCleanup()
|
||||
{
|
||||
if (!IsInitialized) return;
|
||||
try { _plugin!.OnClientCleanup(); }
|
||||
catch (Exception ex) { LogException("OnClientCleanup", ex); }
|
||||
}
|
||||
|
||||
public void OnTooltipShow(uint objectId, uint spellId)
|
||||
{
|
||||
if (!IsInitialized) return;
|
||||
try { _plugin!.OnTooltipShow(objectId, spellId); }
|
||||
catch (Exception ex) { LogException("OnTooltipShow", ex); }
|
||||
}
|
||||
|
||||
public void OnTooltipHide()
|
||||
{
|
||||
if (!IsInitialized) return;
|
||||
try { _plugin!.OnTooltipHide(); }
|
||||
catch (Exception ex) { LogException("OnTooltipHide", ex); }
|
||||
}
|
||||
|
||||
public void OnDragStart(uint objectId, uint spellId, uint iconId)
|
||||
{
|
||||
if (!IsInitialized) return;
|
||||
try { _plugin!.OnDragStart(objectId, spellId, iconId); }
|
||||
catch (Exception ex) { LogException("OnDragStart", ex); }
|
||||
}
|
||||
|
||||
public void OnItemDropped(uint objectId, uint spellId, uint targetElementId)
|
||||
{
|
||||
if (!IsInitialized) return;
|
||||
try { _plugin!.OnItemDropped(objectId, spellId, targetElementId); }
|
||||
catch (Exception ex) { LogException("OnItemDropped", ex); }
|
||||
}
|
||||
|
||||
private void LogException(string method, Exception ex)
|
||||
{
|
||||
if (Interlocked.Increment(ref _exceptionCount) > MaxLoggedExceptions)
|
||||
|
|
|
|||
Loading…
Reference in a new issue