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)); }
/// <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); }
/// <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 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); }
void LogSourceInformation(ISourceInformation source, Action <string> log = null, StringBuilder sb = null) { if (source == null || String.IsNullOrEmpty(source.FileName)) { return; } string location = source.FileName; if (source.LineNumber != null && source.LineNumber >= 0) { location += $":{source.LineNumber}"; } do_log($" Source: {location}", log, sb); sb?.AppendLine(); }
/// <summary> /// Get the corresponding script file path from a model element. /// </summary> /// <param name="element">model element</param> /// <param name="fileName">file path of the scripts corresponding to the model element</param> /// <returns></returns> private static Boolean GetElementSourceFile(IModelElement element, out String fileName) { fileName = null; IScriptSourcedModelElement scriptSourcedElement = element as IScriptSourcedModelElement; if (scriptSourcedElement != null) { ISourceInformation elementSource = scriptSourcedElement.PrimarySource; if (elementSource != null) { fileName = elementSource.SourceName; } } return(String.IsNullOrEmpty(fileName) == false); }
public static void ReportOutcome(ISourceInformation source, string text) { throw new NotImplementedException(); }
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); }
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); }
internal static void TellSource(ISourceInformation command, string message, params object[] args) { TellSource(command, string.Format(message, args)); }
XElement CreateTestResultElement(ITestResultMessage testResult, string resultText) { ITest test = testResult.Test; ITestCase testCase = testResult.TestCase; ITestMethod testMethod = testCase.TestMethod; ITestClass testClass = testMethod.TestClass; var collectionElement = GetTestCollectionElement(testClass.TestCollection); var testResultElement = new XElement("test", new XAttribute("name", XmlEscape(test.DisplayName)), new XAttribute("type", testClass.Class.Name), new XAttribute("method", testMethod.Method.Name), new XAttribute("time", testResult.ExecutionTime.ToString(CultureInfo.InvariantCulture)), new XAttribute("result", resultText) ); var testOutput = testResult.Output; if (!string.IsNullOrWhiteSpace(testOutput)) { testResultElement.Add(new XElement("output", new XCData(testOutput))); } ISourceInformation sourceInformation = testCase.SourceInformation; if (sourceInformation != null) { var fileName = sourceInformation.FileName; if (fileName != null) { testResultElement.Add(new XAttribute("source-file", fileName)); } var lineNumber = sourceInformation.LineNumber; if (lineNumber != null) { testResultElement.Add(new XAttribute("source-line", lineNumber.GetValueOrDefault())); } } var traits = testCase.Traits; if (traits != null && traits.Count > 0) { var traitsElement = new XElement("traits"); foreach (var keyValuePair in traits) { foreach (var val in keyValuePair.Value) { traitsElement.Add( new XElement("trait", new XAttribute("name", XmlEscape(keyValuePair.Key)), new XAttribute("value", XmlEscape(val)) ) ); } } testResultElement.Add(traitsElement); } collectionElement.Add(testResultElement); if (_logger != null) { _logger.LogMessage($"collectionElement: {collectionElement}"); } return(testResultElement); }
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(); }
public static void ReportOutcome(ISourceInformation source, string text, params object[] args) { ReportOutcome(source, string.Format(text, args)); }
/// <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(); }
/// <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 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(); } }
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); }