private static void logHangingSequence()
        {
            List <string> logLines = new List <string>();

            logLines.Add(String.Format("Sequence {0} timed out after {1} ms, type: {2}",
                                       previousSequence.SequenceGUID, TIMEOUT, previousSequence.GetType()));
            logLines.Add(String.Format("Active TurnActor: {0}", stackManager.Combat.TurnDirector.ActiveTurnActor.GetType()));

            Logger.Block(logLines.ToArray(), MethodBase.GetCurrentMethod());
        }
        private static bool shouldIgnoreSequence(IStackSequence stackSequence)
        {
            bool isTeamActivation = stackSequence.GetType() == typeof(TeamActivationSequence);

            if (isTeamActivation)
            {
                TeamActivationSequence teamSequence = (TeamActivationSequence)stackSequence;
                return(teamSequence.team.IsLocalPlayer);
            }

            return(isTeamActivation);
        }
        public static void Postfix(StackManager __instance)
        {
            Logger.Minimal(".");
            stackManager = __instance;

            List <IStackSequence> sequenceStack = Traverse.Create(__instance).Property("SequenceStack").
                                                  GetValue <List <IStackSequence> >();

            if (sequenceStack.Count > 0 && !shouldIgnoreSequence(sequenceStack[0]))
            {
                currentSequence = sequenceStack[0];

                if (isNewSequence())
                {
                    Logger.Minimal(String.Format("SequenceStack count: {0}, curr seq: {1}, Guid: {2}",
                                                 sequenceStack.Count, currentSequence.GetType(), currentSequence.SequenceGUID));
                    setNewSequenceAndStartTimer();
                    return;
                }

                if (isTimedOut())
                {
                    Logger.Minimal("timed out");
                    fixHangingSequence();
                    resetTimer();
                    return;
                }
            }

            if (sequenceStack.Count == 0)
            {
                if (previousSequence != null)
                {
                    Logger.Minimal("sequenceStack empty");
                    previousSequence = null;
                    startTimer();
                    return;
                }

                if (isTimedOut())
                {
                    Logger.Minimal("sequenceStack empty timeout");
                    fixHangingSequenceStack();
                    resetTimer();
                    return;
                }
            }
        }