RynthSuite as of 2026-11-02 (internal 0a66a40): release 2026.11.2.3
This commit is contained in:
parent
f48050bf01
commit
e6436cd826
4 changed files with 56 additions and 8 deletions
|
|
@ -238,7 +238,7 @@ public partial class BuffManager
|
|||
foreach (var r in _settings.ConsumableRules)
|
||||
if (r.Type.Equals("HealthKit", StringComparison.OrdinalIgnoreCase)
|
||||
&& !(r.Name ?? "").Contains("Stamina Kit", StringComparison.OrdinalIgnoreCase)
|
||||
&& ConsumableLookup.Resolve(_worldObjectCache, r) != null) { capable = true; break; }
|
||||
&& ConsumableLookup.Resolve(_worldObjectCache, r) is WorldObject wo && IsUseOnSelfKit(wo)) { capable = true; break; }
|
||||
}
|
||||
if (!capable && _settings.UsePotions && HasListedPotion("HealthPotion")) capable = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2493,9 +2493,9 @@ public partial class BuffManager : IDisposable
|
|||
{
|
||||
if (_worldObjectCache == null) return false;
|
||||
foreach (var rule in _settings.ConsumableRules)
|
||||
if (Array.FindIndex(types, t => t.Equals(rule.Type, StringComparison.OrdinalIgnoreCase)) >= 0
|
||||
&& !IsKitName(rule.Name)
|
||||
&& ConsumableLookup.Resolve(_worldObjectCache, rule) != null)
|
||||
if (!IsKitName(rule.Name)
|
||||
&& ConsumableLookup.Resolve(_worldObjectCache, rule) is WorldObject wo
|
||||
&& Array.FindIndex(types, t => t.Equals(DrinkType(rule, wo), StringComparison.OrdinalIgnoreCase)) >= 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2509,6 +2509,20 @@ public partial class BuffManager : IDisposable
|
|||
internal static bool IsKitName(string? name) =>
|
||||
!string.IsNullOrEmpty(name) && name.TrimEnd().EndsWith(" Kit", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// A healing kit, used on yourself: the kit class, or a name ending in "Kit". Any other item
|
||||
/// listed as a healing item is used with no target, like a potion. Conquest's Health Tincture
|
||||
/// (no kit, not Food) was typed HealthKit for the "Health" in its name, used on the player
|
||||
/// and refused by the server ("can't use Health Tincture on ...") every 8 s, the bot never
|
||||
/// healing until the player did it by hand (report R-20261103-022318-418c, 2026-11-02).
|
||||
/// </summary>
|
||||
internal static bool IsUseOnSelfKit(WorldObject wo) =>
|
||||
wo.ObjectClass == AcObjectClass.HealingKit || IsKitName(wo.Name);
|
||||
|
||||
/// <summary>The potion type <paramref name="rule"/> is drunk as: a HealthKit rule on an item that is no kit is a health potion.</summary>
|
||||
internal static string DrinkType(ConsumableRule rule, WorldObject wo) =>
|
||||
rule.Type.Equals("HealthKit", StringComparison.OrdinalIgnoreCase) && !IsUseOnSelfKit(wo) ? "HealthPotion" : rule.Type;
|
||||
|
||||
/// <summary><paramref name="listedOnly"/>: only the Consumables list, not any potion in the pack.</summary>
|
||||
private bool AttemptPotion(bool listedOnly, params string[] types)
|
||||
{
|
||||
|
|
@ -2516,10 +2530,10 @@ public partial class BuffManager : IDisposable
|
|||
if ((RynthClock.Now - _lastPotionAt).TotalMilliseconds < 2500) return VitalNo("one drunk under 2.5 s ago");
|
||||
foreach (var rule in _settings.ConsumableRules)
|
||||
{
|
||||
if (Array.FindIndex(types, t => t.Equals(rule.Type, StringComparison.OrdinalIgnoreCase)) < 0) continue;
|
||||
if (IsKitName(rule.Name)) continue; // the kit path uses it, on yourself
|
||||
if (ConsumableLookup.Resolve(_worldObjectCache, rule) is not WorldObject potion) continue;
|
||||
if (IsKitName(potion.Name)) continue;
|
||||
if (Array.FindIndex(types, t => t.Equals(DrinkType(rule, potion), StringComparison.OrdinalIgnoreCase)) < 0) continue;
|
||||
if (HeldCastBlocksItemUse(out string heldWhy)) return VitalNo(heldWhy);
|
||||
_host.Log($"[RynthAi] Vitals: drinking {rule.Name} ({rule.Type})" + (potion.Id != rule.Id ? " from a new stack." : "."));
|
||||
_host.UseFor(unchecked((uint)potion.Id), "Buff", $"vitals: drink {rule.Name} ({rule.Type}) from the Items list");
|
||||
|
|
@ -2670,7 +2684,8 @@ public partial class BuffManager : IDisposable
|
|||
foreach (var r in _settings.ConsumableRules)
|
||||
if (r.Type.Equals("HealthKit", StringComparison.OrdinalIgnoreCase)
|
||||
&& !(r.Name ?? "").Contains("Stamina Kit", StringComparison.OrdinalIgnoreCase) // a stamina kit heals no health
|
||||
&& ConsumableLookup.Resolve(_worldObjectCache, r) is WorldObject wo) { kit = wo; break; }
|
||||
&& ConsumableLookup.Resolve(_worldObjectCache, r) is WorldObject wo
|
||||
&& IsUseOnSelfKit(wo)) { kit = wo; break; } // no kit: the potion step drinks it
|
||||
if (kit == null) { kit = BestPackHealingKit(); fromPack = true; }
|
||||
if (kit == null) return VitalNo("no healing kit");
|
||||
if (KitRetryWait(out string kitWait)) return VitalNo(kitWait);
|
||||
|
|
|
|||
|
|
@ -228,11 +228,12 @@ internal sealed class LegacyWeaponsUi
|
|||
string? potion = PotionType(wo);
|
||||
if (potion != null) return potion;
|
||||
|
||||
// Health items
|
||||
// Health items: a kit is used on yourself, anything else (Conquest's Health Tincture is
|
||||
// no Food) is used with no target, like a potion.
|
||||
if (name.Contains("Heal", StringComparison.OrdinalIgnoreCase) ||
|
||||
name.Contains("Health", StringComparison.OrdinalIgnoreCase) ||
|
||||
name.Contains("Elixir of Healing", StringComparison.OrdinalIgnoreCase))
|
||||
return "HealthKit";
|
||||
return BuffManager.IsUseOnSelfKit(wo) ? "HealthKit" : "HealthPotion";
|
||||
|
||||
// Mana items. A mana kit (it restores your own mana, like a stamina kit) is no stone: typed
|
||||
// ManaStone it switched off the ordinary stones and Drakkon's gear ran dry (10-23).
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ internal static class OneTouchHealTests
|
|||
r.Add("one-touch: a request that stays blocked gives up after OneTouchWaitMs and says why", HealGivesUp);
|
||||
r.Add("one-touch: stamina takes a stamina kit, a listed potion out of Magic stance, else Revitalize", StaminaChoice);
|
||||
r.Add("vitals: a stamina kit is typed StaminaKit and never taken by the potion step (it was drunk with no target)", StaminaKitNeverDrunk);
|
||||
r.Add("vitals: a healing item that is no kit (a Health Tincture listed as HealthKit) is drunk with no target, never used on yourself", NonKitHealItemDrunk);
|
||||
r.Add("buff wand: a caster that needs untrained War Magic is never picked to buff; the next listed one is", BuffWandSkipsUnwieldable);
|
||||
r.Add("one-touch: mana casts Stamina to Mana; with stamina at the floor it refills stamina first", ManaChoice);
|
||||
r.Add("one-touch: /ra heal, /ra stam and /ra mana request a pass (and say so before login)", Commands);
|
||||
|
|
@ -291,6 +292,37 @@ internal static class OneTouchHealTests
|
|||
Check.False(BuffManager.IsKitName("Stamina Tincture"), "a potion is not a kit");
|
||||
}
|
||||
|
||||
// R-20261103-022318-418c (Conquest, 2026-11-02): a custom Health Tincture (not Food, no kit) sat on the
|
||||
// Items list typed HealthKit for the "Health" in its name. The kit step used it on the player every
|
||||
// 8 s, the server refused each one ("can't use Health Tincture on ..."), and the bot stood at 73%
|
||||
// health until the player healed by hand.
|
||||
private static void NonKitHealItemDrunk()
|
||||
{
|
||||
// Listed first, typed HealthKit, a real kit listed after it: the kit goes on the player.
|
||||
var r = Make(CombatMode.Melee, hp: 60, kit: true, healPotion: true, tweak: s =>
|
||||
{
|
||||
s.ConsumableRules[0].Type = "HealthKit";
|
||||
s.ConsumableRules.Add(new ConsumableRule { Id = unchecked((int)Kit), Name = "Peerless Healing Kit", Type = "HealthKit" });
|
||||
});
|
||||
r.B.RequestOneTouch(OneTouchVital.Health);
|
||||
Pump(r.B, OneTouchVital.Health);
|
||||
Check.False(FakeHost.UsesOn.Any(u => u.Source == HealPotion), "the tincture is never used on the player");
|
||||
Check.True(FakeHost.UsesOn.Any(u => u.Source == Kit && u.Target == Player), "the listed kit is the kit");
|
||||
|
||||
// No kit: the potion step drinks it, no target.
|
||||
r = Make(CombatMode.Melee, hp: 60, healPotion: true, tweak: s => s.ConsumableRules[0].Type = "HealthKit");
|
||||
r.B.RequestOneTouch(OneTouchVital.Health);
|
||||
Pump(r.B, OneTouchVital.Health);
|
||||
Check.Eq(FakeHost.UsesOn.Count, 0, "nothing used on the player");
|
||||
Check.True(FakeHost.Uses.Contains(HealPotion), "the tincture is drunk: " + AllChat);
|
||||
Check.Eq(FakeHost.Casts.Count, 0, "melee: no Heal Self while it can heal");
|
||||
|
||||
// Adding one to Items types it HealthPotion now; a kit stays HealthKit.
|
||||
var detect = typeof(LegacyWeaponsUi).GetMethod("DetectConsumableType", BindingFlags.Static | BindingFlags.NonPublic)!;
|
||||
Check.Eq((string)detect.Invoke(null, new object[] { new WorldObject(0x60002003, "Health Tincture", AcObjectClass.Misc) })!, "HealthPotion", "a tincture is drunk");
|
||||
Check.Eq((string)detect.Invoke(null, new object[] { new WorldObject(0x60002004, "Peerless Healing Kit", AcObjectClass.HealingKit) })!, "HealthKit", "a kit is a kit");
|
||||
Check.Eq((string)detect.Invoke(null, new object[] { new WorldObject(0x60002005, "Treated Healing Kit", AcObjectClass.Unknown) })!, "HealthKit", "a kit by name, class not read yet");
|
||||
}
|
||||
// 2026-10-18 01:00-01:24: with the buff wand gone, buffing tried an Electric Baton that needs War
|
||||
// Magic (untrained) every 8 s for 24 minutes; Heal Self couldn't go and Drakkon died.
|
||||
private static void BuffWandSkipsUnwieldable()
|
||||
|
|
|
|||
Loading…
Reference in a new issue