aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ExportBot/Commands
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ExportBot/Commands/CloneProfileCommand.cs25
-rw-r--r--ExportBot/Commands/Communication/TtsCommand.cs51
2 files changed, 12 insertions, 64 deletions
diff --git a/ExportBot/Commands/CloneProfileCommand.cs b/ExportBot/Commands/CloneProfileCommand.cs
index d7fb5fc..d608318 100644
--- a/ExportBot/Commands/CloneProfileCommand.cs
+++ b/ExportBot/Commands/CloneProfileCommand.cs
@@ -10,6 +10,7 @@ namespace libsecondlife.TestClient
10 { 10 {
11 Avatar.AvatarProperties Properties; 11 Avatar.AvatarProperties Properties;
12 Avatar.Interests Interests; 12 Avatar.Interests Interests;
13 private Dictionary<LLUUID,ulong> Avatars = new Dictionary<LLUUID,ulong>();
13 List<LLUUID> Groups = new List<LLUUID>(); 14 List<LLUUID> Groups = new List<LLUUID>();
14 bool ReceivedProperties = false; 15 bool ReceivedProperties = false;
15 bool ReceivedInterests = false; 16 bool ReceivedInterests = false;
@@ -23,12 +24,22 @@ namespace libsecondlife.TestClient
23 testClient.Avatars.OnAvatarGroups += new AvatarManager.AvatarGroupsCallback(Avatars_OnAvatarGroups); 24 testClient.Avatars.OnAvatarGroups += new AvatarManager.AvatarGroupsCallback(Avatars_OnAvatarGroups);
24 testClient.Self.OnJoinGroup += new MainAvatar.JoinGroupCallback(Self_OnJoinGroup); 25 testClient.Self.OnJoinGroup += new MainAvatar.JoinGroupCallback(Self_OnJoinGroup);
25 26
27 testClient.Self.Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(AvatarSeen);
28
26 Name = "cloneprofile"; 29 Name = "cloneprofile";
27 Description = "Clones another avatars profile as closely as possible. WARNING: This command will " + 30 Description = "Clones another avatars profile as closely as possible. WARNING: This command will " +
28 "destroy your existing profile! Usage: cloneprofile [targetuuid]"; 31 "destroy your existing profile! Usage: cloneprofile [targetuuid]";
29 } 32 }
30 33
31 public override string Execute(string[] args, LLUUID fromAgentID) 34 void AvatarSeen(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
35 {
36 lock (Avatars)
37 {
38 Avatars.Add(avatar.UUID,avatar.LocalID);
39 }
40 }
41
42 public override string Execute(string[] args, LLUUID fromAgentID)
32 { 43 {
33 if (args.Length != 1) 44 if (args.Length != 1)
34 return Description; 45 return Description;
@@ -58,20 +69,8 @@ namespace libsecondlife.TestClient
58 if (!ReceivedInterests || !ReceivedProperties || !ReceivedGroups) 69 if (!ReceivedInterests || !ReceivedProperties || !ReceivedGroups)
59 return "Failed to retrieve a complete profile for that UUID"; 70 return "Failed to retrieve a complete profile for that UUID";
60 71
61 // Synchronize our profile
62 Client.Self.ProfileInterests = Interests;
63 Client.Self.ProfileProperties = Properties;
64 Client.Self.SetAvatarInformation(); 72 Client.Self.SetAvatarInformation();
65 73
66 // TODO: Leave all the groups we're currently a member of? This could
67 // break TestClient connectivity that might be relying on group authentication
68
69 // Attempt to join all the groups
70 foreach (LLUUID groupID in Groups)
71 {
72 Client.Self.RequestJoinGroup(groupID);
73 }
74
75 return "Synchronized our profile to the profile of " + targetID.ToStringHyphenated(); 74 return "Synchronized our profile to the profile of " + targetID.ToStringHyphenated();
76 } 75 }
77 76
diff --git a/ExportBot/Commands/Communication/TtsCommand.cs b/ExportBot/Commands/Communication/TtsCommand.cs
deleted file mode 100644
index e8bd122..0000000
--- a/ExportBot/Commands/Communication/TtsCommand.cs
+++ /dev/null
@@ -1,51 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Speech.Synthesis;
5using libsecondlife;
6using libsecondlife.Packets;
7using 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
13namespace 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