Example #1
0
        /// <summary>
        /// Creates a tack frame from source information. This can be useful when simulating a
        /// stack frame in a non-exceptional situation (f.e., for a skipped test).
        /// </summary>
        /// <param name="sourceInfo">The source information to inspect</param>
        /// <returns>The stack frame info</returns>
        public static StackFrameInfo FromSourceInformation(ISourceInformation sourceInfo)
        {
            if (sourceInfo == null)
                return None;

            return new StackFrameInfo(sourceInfo.FileName, sourceInfo.LineNumber ?? 0);
        }
        internal static void TellSource(ISourceInformation command, string message)
        {
            if (command.Channel == CommandChannel.Fellowship)
            {
                TellActions.TellNativeFellow(message);
                return;
            }

            if (command.Channel == CommandChannel.VirindiFellowship)
            {
                TellActions.TellVirindiFellow((string)command.ChannelTag, message);
                return;
            }

            if (command.Channel == CommandChannel.AreaChat)
            {
                // Respond directly to the player even those it was area chat
                TellActions.TellPlayer(command.SourceCharacter, message);
                return;
            }

            if (command.Channel == CommandChannel.Tell)
            {
                TellActions.TellPlayer(command.SourceCharacter, message);
                return;
            }

            if(command.Channel == CommandChannel.DirectEntry)
            {
                REPlugin.Instance.Chat.WriteLine(message);
            }

            throw new NotImplementedException(string.Format("Support for channel {0} has not been implemented", command.Channel));
        }
        internal static void NavDistanceTight(ISourceInformation command)
        {
            // always ignore self nav commands.  Nav commands are always for controlling slave nav behavior
            if (command.FromSelf)
            {
                return;
            }

            NavDistanceTight();
        }
        internal static void FollowMe(ISourceInformation command)
        {
            // Always ignore if the source character was yourself.  It would never make sense to follow yourself
            if (command.FromSelf)
            {
                return;
            }

            VTActions.FollowCharacter(command.SourceCharacter, true, 3);
        }
        public static double GetDistanceFromSelf(ISourceInformation requestor)
        {
            if (requestor.IsSourceIdAvailable)
            {
                return GetDistanceFromSelf(requestor.SourceCharacterId);
            }

            return GetDistanceFromSelf(requestor.SourceCharacter);
        }
        public static bool WithinRangeOfSelf(ISourceInformation requestor, int maxDistance)
        {
            if (requestor.FromSelf)
            {
                // Always within range of yourself
                return true;
            }

            if (requestor.IsSourceIdAvailable)
            {
                return WithinRangeOfSelf(requestor.SourceCharacterId, maxDistance);
            }

            // If the source id isn't available, that's not a good sign that they are near by,
            // but we'll give a by name check a chance just in case
            return WithinRangeOfSelf(requestor.SourceCharacter, maxDistance);
        }
 internal static void TellSource(ISourceInformation command, string message, params object[] args)
 {
     TellSource(command, string.Format(message, args));
 }
        internal static void NavDistanceNormal(ISourceInformation command)
        {
            // always ignore self nav commands.  Nav commands are always for controlling slave nav behavior
            if (command.FromSelf)
            {
                return;
            }

            // Set the use portal distance slightly higher than the follow distance to ensure that
            // we can always use the portal
            VTActions.SetUsePortalDistance(DefaultNormalNavDistance + UsePortalToleranceOverNavDistance);

            NavDistanceNormal();
        }
        /// <summary>
        /// Waits, but will still buff and fight (if already enabled)
        /// </summary>
        /// <param name="command"></param>
        internal static void Wait(ISourceInformation command)
        {
            // Always ignore if the source character was yourself.  It would never make sense to wait on yourself
            if (command.FromSelf)
            {
                return;
            }

            VTActions.DisableNav();
        }
        internal static void InitDefaultState(ISourceInformation command)
        {
            // Init needs to put everybod into a consistent state, day in and day out.
            // So we also need to initialize our main VT profile.
            SetMainProfile(MyMainProfiles.CharacterSpecificDefault.ToString(), command.SourceCharacter);

            VTActions.DisableAllVTStates();

            MyActions.LoadMyDefaultLootProfile();

            NavDistanceNormal(command);

            VTActions.DisableSummon();
            VTActions.SetPetRange(DefaultPetRange);
            VTActions.SetPetMonsterDensity(DefaultPetDensity);

            // Note : I think it would be nice to follow immediately as well.  We'll see how this goes.
            FollowMe(command);

            VTActions.StartVT();

            // If we are the master, turn on copy cat on init
            if (command.FromSelf)
            {
                REPlugin.Instance.MonitorManager.CopyCatMaster.Enable();
            }
        }
        /// <summary>
        /// Waits 'nicely'.  No Nav, No Combt, no Buff
        /// </summary>
        /// <param name="command"></param>
        internal static void WaitNice(ISourceInformation command)
        {
            // Always ignore if the source character was yourself.
            if (command.FromSelf)
            {
                return;
            }

            VTActions.DisableNav();
            VTActions.DisableCombat();
            VTActions.DisableBuffing();
        }
        internal static void InitMuleState(ISourceInformation command)
        {
            if (command.FromSelf)
            {
                return;
            }

            VTActions.DisableAllVTStates();
            VTActions.EnableAutoCram();
            VTActions.StartVT();
        }
        internal static void FaceHeading(ISourceInformation command, double degrees, bool skipSelf)
        {
            if(command.FromSelf && skipSelf)
            {
                return;
            }

            FaceHeading(degrees);
        }
 private static bool SourceIsWithinJumpRange(ISourceInformation requestor)
 {
     // For jumping, the slaves should be pretty close to the master, otherwise jumping would be pointless
     return Core.Utilities.WorldUtilities.WithinRangeOfSelf(requestor, 4);
 }
 public static void ReportOutcome(ISourceInformation source, string text, params object[] args)
 {
     ReportOutcome(source, string.Format(text, args));
 }
 public static void ReportOutcome(ISourceInformation source, string text)
 {
     throw new NotImplementedException();
 }