/// <summary>
        /// This will replace the main BehaviorTree hooks for Combat, Vendoring, and Looting.
        /// </summary>
        internal static void ReplaceTreeHooks()
        {
            if (Trinity.IsPluginEnabled)
            {
                // This is the do-all-be-all god-head all encompasing piece of trinity
                StoreAndReplaceHook("Combat", new Decorator(Trinity.TargetCheck, Trinity.HandleTargetAction()));

                // We still want the main VendorRun logic, we're just going to take control of *when* this logic kicks in
                var vendorDecorator = TreeHooks.Instance.Hooks["VendorRun"][0] as Decorator;
                if (vendorDecorator != null)
                {
                    StoreAndReplaceHook("VendorRun", new Decorator(TownRun.TownRunCanRun, TownRun.TownRunWrapper(vendorDecorator.Children[0])));
                }

                // Loot tree is now empty and never runs (Loot is handled through combat)
                // This is for special out of combat handling like Horadric Cache
                Composite lootComposite = TreeHooks.Instance.Hooks["Loot"][0];
                StoreAndReplaceHook("Loot", Composites.CreateLootBehavior(lootComposite));
            }
            else
            {
                ReplaceHookWithOriginal("Combat");
                ReplaceHookWithOriginal("VendorRun");
                ReplaceHookWithOriginal("Loot");
            }
        }
Exemple #2
0
        private static void ReplaceLootHook()
        {
            if (!TreeHooks.Instance.Hooks.ContainsKey("Loot"))
            {
                return;
            }
            // Loot tree is now empty and never runs (Loot is handled through combat)
            // This is for special out of combat handling like Horadric Cache
            Composite lootComposite = TreeHooks.Instance.Hooks["Loot"][0];

            StoreAndReplaceHook("Loot", Composites.CreateLootBehavior(lootComposite));
        }