RynthSuite as of 2026-12-02 (internal 152e13d): release 2026.12.1.1

This commit is contained in:
Tom Bohar 2026-12-02 06:45:07 -05:00
commit 6b5a9c7e99
65 changed files with 3920 additions and 237 deletions

View file

@ -106,11 +106,68 @@ public sealed partial class RynthAiPlugin
case "config":
// ub-IT: /mt config = /mt opt (list when bare).
return parts.Length < 3 ? HandleMtOpt(new[] { "/mt", "opt", "list" }) : HandleMtOpt(parts);
case "attack_melee": return HandleMtAttackMelee(parts);
default:
return false;
}
}
// ── attack_melee (2026-12-01 command audit) ─────────────────────────────────
internal const string MtAttackMeleeUsage = "[RynthAi] Usage: /mt attack_melee [closest]";
/// <summary>
/// /mt attack_melee [closest] (Mag-Tools), one step a call as Mag-Tools does it, so a meta sends it
/// again and again: out of melee mode it goes to melee mode; in melee mode it attacks the selected
/// monster once (the closest monster when none is selected, or with "closest", which it selects),
/// at RynthAi's melee attack height and power. It was "Unknown /mt command" before.
/// </summary>
private bool HandleMtAttackMelee(string[] parts)
{
bool closest = parts.Length >= 3 && parts[2].Equals("closest", StringComparison.OrdinalIgnoreCase);
if (parts.Length >= 3 && !closest) { ReplyFail(MtAttackMeleeUsage); return true; }
LegacyUi.LegacyUiSettings? s = _dashboard?.Settings;
if (_objectCache == null || _playerId == 0 || s == null) { ReplyFail("[RynthAi] /mt attack_melee: not ready (log in first)."); return true; }
if (!Host.HasMeleeAttack || !Host.HasChangeCombatMode) { ReplyFail("[RynthAi] /mt attack_melee: this RynthCore can't attack from a command."); return true; }
if (!Host.HasGetCurrentCombatMode || Host.GetCurrentCombatMode() != CombatMode.Melee)
{
Host.ChangeCombatModeFor(CombatMode.Melee, "Command", "/mt attack_melee", force: true);
ReplyOk("[RynthAi] /mt attack_melee: going to melee mode (the next one attacks).");
return true;
}
WorldObject? target = null;
uint sel = Host.GetSelectedItemId();
if (!closest && sel != 0 && _objectCache[unchecked((int)sel)] is { ObjectClass: AcObjectClass.Monster } picked)
target = picked;
if (target == null)
{
int me = unchecked((int)_playerId);
double best = double.MaxValue;
foreach (WorldObject wo in _objectCache.GetLandscapeObjects())
{
if (wo.ObjectClass != AcObjectClass.Monster || _objectCache.GetHealthRatio(wo.Id) == 0f) continue;
double d = _objectCache.Distance(me, wo.Id);
if (d < best) { best = d; target = wo; }
}
if (target == null) { ReplyFail("[RynthAi] /mt attack_melee: no monster nearby."); return true; }
if (Host.HasSelectItem) ItemInfo.SelfSelect.SelectAsBot(Host, unchecked((uint)target.Id));
}
int acHeight = s.MeleeAttackHeight switch { 0 => 3, 2 => 1, _ => 2 }; // Low=3, Med=2, High=1
float power = AttackPowerModes.Resolve(AttackPowerModes.Default, s.MeleeAttackPower, s.UseRecklessness,
_charSkills == null || _charSkills[AcSkillType.Recklessness].Training >= 2,
s.VariablePowerMin, s.VariablePowerMax, Random.Shared.NextDouble);
if (Host.MeleeAttack(unchecked((uint)target.Id), acHeight, power))
{
RynthCore.Plugin.Shared.ActionPacer.NoteAttackSent();
ReplyOk($"[RynthAi] /mt attack_melee: attacking {target.Name}.");
}
else ReplyFail($"[RynthAi] /mt attack_melee: the attack on {target.Name} wasn't sent.");
return true;
}
// ── send: keys, as Mag-Tools ────────────────────────────────────────────────
/// <summary>