diff options
Diffstat (limited to '')
6 files changed, 306 insertions, 0 deletions
diff --git a/tools/mass test client/Commands/Communication/EchoMasterCommand.cs b/tools/mass test client/Commands/Communication/EchoMasterCommand.cs new file mode 100644 index 0000000..a7c3d3f --- /dev/null +++ b/tools/mass test client/Commands/Communication/EchoMasterCommand.cs | |||
@@ -0,0 +1,42 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace libsecondlife.TestClient | ||
8 | { | ||
9 | public class EchoMasterCommand: Command | ||
10 | { | ||
11 | public EchoMasterCommand(TestClient testClient) | ||
12 | { | ||
13 | Name = "echoMaster"; | ||
14 | Description = "Repeat everything that master says."; | ||
15 | } | ||
16 | |||
17 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
18 | { | ||
19 | if (!Active) | ||
20 | { | ||
21 | Active = true; | ||
22 | Client.Self.OnChat += new MainAvatar.ChatCallback(Self_OnChat); | ||
23 | return "Echoing is now on."; | ||
24 | } | ||
25 | else | ||
26 | { | ||
27 | Active = false; | ||
28 | Client.Self.OnChat -= new MainAvatar.ChatCallback(Self_OnChat); | ||
29 | return "Echoing is now off."; | ||
30 | } | ||
31 | } | ||
32 | |||
33 | void Self_OnChat(string message, MainAvatar.ChatAudibleLevel audible, MainAvatar.ChatType type, | ||
34 | MainAvatar.ChatSourceType sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) | ||
35 | { | ||
36 | if (message.Length > 0 && Client.MasterKey == id) | ||
37 | { | ||
38 | Client.Self.Chat(message, 0, MainAvatar.ChatType.Normal); | ||
39 | } | ||
40 | } | ||
41 | } | ||
42 | } | ||
diff --git a/tools/mass test client/Commands/Communication/IMCommand.cs b/tools/mass test client/Commands/Communication/IMCommand.cs new file mode 100644 index 0000000..d847291 --- /dev/null +++ b/tools/mass test client/Commands/Communication/IMCommand.cs | |||
@@ -0,0 +1,71 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Threading; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace libsecondlife.TestClient | ||
8 | { | ||
9 | public class ImCommand : Command | ||
10 | { | ||
11 | string ToAvatarName = String.Empty; | ||
12 | ManualResetEvent NameSearchEvent = new ManualResetEvent(false); | ||
13 | Dictionary<string, LLUUID> Name2Key = new Dictionary<string, LLUUID>(); | ||
14 | |||
15 | public ImCommand(TestClient testClient) | ||
16 | { | ||
17 | testClient.Avatars.OnAvatarNameSearch += new AvatarManager.AvatarNameSearchCallback(Avatars_OnAvatarNameSearch); | ||
18 | |||
19 | Name = "im"; | ||
20 | Description = "Instant message someone. Usage: im [firstname] [lastname] [message]"; | ||
21 | } | ||
22 | |||
23 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
24 | { | ||
25 | if (args.Length < 3) | ||
26 | return "Usage: im [firstname] [lastname] [message]"; | ||
27 | |||
28 | ToAvatarName = args[0] + " " + args[1]; | ||
29 | |||
30 | // Build the message | ||
31 | string message = String.Empty; | ||
32 | for (int ct = 2; ct < args.Length; ct++) | ||
33 | message += args[ct] + " "; | ||
34 | message = message.TrimEnd(); | ||
35 | if (message.Length > 1023) message = message.Remove(1023); | ||
36 | |||
37 | if (!Name2Key.ContainsKey(ToAvatarName.ToLower())) | ||
38 | { | ||
39 | // Send the Query | ||
40 | Client.Avatars.RequestAvatarNameSearch(ToAvatarName, LLUUID.Random()); | ||
41 | |||
42 | NameSearchEvent.WaitOne(6000, false); | ||
43 | } | ||
44 | |||
45 | if (Name2Key.ContainsKey(ToAvatarName.ToLower())) | ||
46 | { | ||
47 | LLUUID id = Name2Key[ToAvatarName.ToLower()]; | ||
48 | |||
49 | Client.Self.InstantMessage(id, message, id); | ||
50 | return "Instant Messaged " + id.ToStringHyphenated() + " with message: " + message; | ||
51 | } | ||
52 | else | ||
53 | { | ||
54 | return "Name lookup for " + ToAvatarName + " failed"; | ||
55 | } | ||
56 | } | ||
57 | |||
58 | void Avatars_OnAvatarNameSearch(LLUUID queryID, Dictionary<LLUUID, string> avatars) | ||
59 | { | ||
60 | foreach (KeyValuePair<LLUUID, string> kvp in avatars) | ||
61 | { | ||
62 | if (kvp.Value.ToLower() == ToAvatarName.ToLower()) | ||
63 | { | ||
64 | Name2Key[ToAvatarName.ToLower()] = kvp.Key; | ||
65 | NameSearchEvent.Set(); | ||
66 | return; | ||
67 | } | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | } | ||
diff --git a/tools/mass test client/Commands/Communication/SayCommand.cs b/tools/mass test client/Commands/Communication/SayCommand.cs new file mode 100644 index 0000000..2ab9db4 --- /dev/null +++ b/tools/mass test client/Commands/Communication/SayCommand.cs | |||
@@ -0,0 +1,44 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace libsecondlife.TestClient | ||
7 | { | ||
8 | public class SayCommand: Command | ||
9 | { | ||
10 | public SayCommand(TestClient testClient) | ||
11 | { | ||
12 | Name = "say"; | ||
13 | Description = "Say something. (usage: say (optional channel) whatever)"; | ||
14 | } | ||
15 | |||
16 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
17 | { | ||
18 | int channel = 0; | ||
19 | int startIndex = 0; | ||
20 | |||
21 | if (args.Length < 1) | ||
22 | { | ||
23 | return "usage: say (optional channel) whatever"; | ||
24 | } | ||
25 | else if (args.Length > 1) | ||
26 | { | ||
27 | if (Int32.TryParse(args[0], out channel)) | ||
28 | startIndex = 1; | ||
29 | } | ||
30 | |||
31 | StringBuilder message = new StringBuilder(); | ||
32 | |||
33 | for (int i = startIndex; i < args.Length; i++) | ||
34 | { | ||
35 | message.Append(args[i]); | ||
36 | if (i != args.Length - 1) message.Append(" "); | ||
37 | } | ||
38 | |||
39 | Client.Self.Chat(message.ToString(), channel, MainAvatar.ChatType.Normal); | ||
40 | |||
41 | return "Said " + message.ToString(); | ||
42 | } | ||
43 | } | ||
44 | } | ||
diff --git a/tools/mass test client/Commands/Communication/ShoutCommand.cs b/tools/mass test client/Commands/Communication/ShoutCommand.cs new file mode 100644 index 0000000..3533e3d --- /dev/null +++ b/tools/mass test client/Commands/Communication/ShoutCommand.cs | |||
@@ -0,0 +1,49 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace libsecondlife.TestClient | ||
8 | { | ||
9 | public class ShoutCommand : Command | ||
10 | { | ||
11 | public ShoutCommand(TestClient testClient) | ||
12 | { | ||
13 | Name = "shout"; | ||
14 | Description = "Shout something."; | ||
15 | } | ||
16 | |||
17 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
18 | { | ||
19 | int channel = 0; | ||
20 | int startIndex = 0; | ||
21 | string message = String.Empty; | ||
22 | if (args.Length < 1) | ||
23 | { | ||
24 | return "usage: shout (optional channel) whatever"; | ||
25 | } | ||
26 | else if (args.Length > 1) | ||
27 | { | ||
28 | try | ||
29 | { | ||
30 | channel = Convert.ToInt32(args[0]); | ||
31 | startIndex = 1; | ||
32 | } | ||
33 | catch (FormatException) | ||
34 | { | ||
35 | channel = 0; | ||
36 | } | ||
37 | } | ||
38 | |||
39 | for (int i = startIndex; i < args.Length; i++) | ||
40 | { | ||
41 | message += args[i] + " "; | ||
42 | } | ||
43 | |||
44 | Client.Self.Chat(message, channel, MainAvatar.ChatType.Shout); | ||
45 | |||
46 | return "Shouted " + message; | ||
47 | } | ||
48 | } | ||
49 | } | ||
diff --git a/tools/mass test client/Commands/Communication/TtsCommand.cs b/tools/mass test client/Commands/Communication/TtsCommand.cs new file mode 100644 index 0000000..52b7a39 --- /dev/null +++ b/tools/mass test client/Commands/Communication/TtsCommand.cs | |||
@@ -0,0 +1,51 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Speech.Synthesis; | ||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | using libsecondlife.AssetSystem; | ||
8 | |||
9 | |||
10 | // Since this requires .Net 3.0 I've left it out of the project by default. | ||
11 | // To use this: include it in the project and add a reference to the System.Speech.dll | ||
12 | |||
13 | namespace libsecondlife.TestClient | ||
14 | { | ||
15 | public class TtsCommand : Command | ||
16 | { | ||
17 | SpeechSynthesizer _speechSynthesizer; | ||
18 | |||
19 | public TtsCommand(TestClient testClient) | ||
20 | { | ||
21 | Name = "tts"; | ||
22 | Description = "Text To Speech. When activated, client will echo all recieved chat messages out thru the computer's speakers."; | ||
23 | } | ||
24 | |||
25 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
26 | { | ||
27 | if (!Active) | ||
28 | { | ||
29 | if (_speechSynthesizer == null) | ||
30 | _speechSynthesizer = new SpeechSynthesizer(); | ||
31 | Active = true; | ||
32 | Client.Self.OnChat += new MainAvatar.ChatCallback(Self_OnChat); | ||
33 | return "TTS is now on."; | ||
34 | } | ||
35 | else | ||
36 | { | ||
37 | Active = false; | ||
38 | Client.Self.OnChat -= new MainAvatar.ChatCallback(Self_OnChat); | ||
39 | return "TTS is now off."; | ||
40 | } | ||
41 | } | ||
42 | |||
43 | void Self_OnChat(string message, byte audible, byte type, byte sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) | ||
44 | { | ||
45 | if (message.Length > 0) | ||
46 | { | ||
47 | _speechSynthesizer.SpeakAsync(message); | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | } \ No newline at end of file | ||
diff --git a/tools/mass test client/Commands/Communication/WhisperCommand.cs b/tools/mass test client/Commands/Communication/WhisperCommand.cs new file mode 100644 index 0000000..4bfda33 --- /dev/null +++ b/tools/mass test client/Commands/Communication/WhisperCommand.cs | |||
@@ -0,0 +1,49 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace libsecondlife.TestClient | ||
8 | { | ||
9 | public class WhisperCommand : Command | ||
10 | { | ||
11 | public WhisperCommand(TestClient testClient) | ||
12 | { | ||
13 | Name = "whisper"; | ||
14 | Description = "Whisper something."; | ||
15 | } | ||
16 | |||
17 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
18 | { | ||
19 | int channel = 0; | ||
20 | int startIndex = 0; | ||
21 | string message = String.Empty; | ||
22 | if (args.Length < 1) | ||
23 | { | ||
24 | return "usage: whisper (optional channel) whatever"; | ||
25 | } | ||
26 | else if (args.Length > 1) | ||
27 | { | ||
28 | try | ||
29 | { | ||
30 | channel = Convert.ToInt32(args[0]); | ||
31 | startIndex = 1; | ||
32 | } | ||
33 | catch (FormatException) | ||
34 | { | ||
35 | channel = 0; | ||
36 | } | ||
37 | } | ||
38 | |||
39 | for (int i = startIndex; i < args.Length; i++) | ||
40 | { | ||
41 | message += args[i] + " "; | ||
42 | } | ||
43 | |||
44 | Client.Self.Chat(message, channel, MainAvatar.ChatType.Whisper); | ||
45 | |||
46 | return "Whispered " + message; | ||
47 | } | ||
48 | } | ||
49 | } | ||