/// <summary> /// This will replace the main BehaviorTree hooks for Combat, Vendoring, and Looting. /// </summary> private static void ReplaceTreeHooks() { // This is the do-all-be-all god-head all encompasing piece of trinity TreeHooks.Instance.ReplaceHook("Combat", new Decorator(ctx => CheckHasTarget(ctx), HandleTargetAction())); // We still want the main VendorRun logic, we're just going to take control of *when* this logic kicks in PrioritySelector VendorRunPrioritySelector = (TreeHooks.Instance.Hooks["VendorRun"][0] as Decorator).Children[0] as PrioritySelector; TreeHooks.Instance.ReplaceHook("VendorRun", new Decorator(ret => TownRun.TownRunCanRun(ret), VendorRunPrioritySelector)); // Loot tree is now empty and never runs (Loot is handled through combat) TreeHooks.Instance.ReplaceHook("Loot", new Decorator(ret => false, new Action())); }