internal static void HookBehaviorTree()
{
Logger.DBLog.InfoFormat("[Funky] Treehooks..");
#region TreeHooks
#region OutOfGame
CanRunDecoratorDelegate shouldPreformOutOfGameBehavior = OutOfGame.OutOfGameOverlord;
ActionDelegate actionDelgateOOGBehavior = OutOfGame.OutOfGameBehavior;
Sequence sequenceOOG = new Sequence(
new Action(actionDelgateOOGBehavior)
);
var OutOfGameInsert = new Decorator(shouldPreformOutOfGameBehavior, sequenceOOG);
SetHookValue(HookType.OutOfGame, 0, OutOfGameInsert, true);
Logger.DBLog.DebugFormat("Out of game tree hooked");
#endregion
#region Death
Logger.DBLog.DebugFormat("Death...");
//Insert Death Tally Counter At Beginning!
CanRunDecoratorDelegate deathTallyDecoratorDelegate = DeathBehavior.TallyDeathCanRunDecorator;
ActionDelegate actionDelegatedeathTallyAction = DeathBehavior.TallyDeathAction;
Action deathTallyAction = new Action(actionDelegatedeathTallyAction);
Decorator deathTallyDecorator = new Decorator(deathTallyDecoratorDelegate, deathTallyAction);
//Death Wait..
CanRunDecoratorDelegate deathWaitDecoratorDelegate = DeathBehavior.DeathShouldWait;
ActionDelegate deathWaitActionDelegate = DeathBehavior.DeathWaitAction;
Action deathWaitAction = new Action(deathWaitActionDelegate);
Decorator deathWaitDecorator = new Decorator(deathWaitDecoratorDelegate, deathWaitAction);
Sequence DeathSequence = new Sequence
(
deathTallyDecorator,
deathWaitDecorator
);
SetHookValue(HookType.Death, 0, DeathSequence, true);
//hook.Value.Add(deathTallyActionReset);
Logger.DBLog.DebugFormat("Death tree hooked");
#endregion
if (RoutineManager.Current.Name == "Funky")
{
CanRunDecoratorDelegate canRunDelegateCombatTargetCheck = CombatHandler.GlobalOverlord;
ActionDelegate actionDelegateCoreTarget = CombatHandler.HandleTarget;
Sequence sequencecombat = new Sequence
(
new Action(actionDelegateCoreTarget)
);
var NewCombatComposite = new Decorator(canRunDelegateCombatTargetCheck, sequencecombat);
SetHookValue(HookType.Combat, 0, NewCombatComposite);
CanRunDecoratorDelegate canRunDelegateBlank = BlankDecorator;
ActionDelegate actionDelegateBlank = BlankAction;
Sequence sequenceblank = new Sequence(
new Action(actionDelegateBlank)
);
var NewLootComposite = new Decorator(canRunDelegateBlank, sequenceblank);
SetHookValue(HookType.Loot, 0, NewLootComposite);
}
#endregion
initTreeHooks = true;
}