diff options
author | gareth | 2007-03-01 15:24:24 +0000 |
---|---|---|
committer | gareth | 2007-03-01 15:24:24 +0000 |
commit | eacb864749cbb8cfd89286fb4cb975b346fa388a (patch) | |
tree | 7778e6ffabe34312f6fec2e6f879838f467eac51 /src/Agent_Manager.cs | |
parent | Lovely lovely flat island :) (diff) | |
download | opensim-SC_OLD-eacb864749cbb8cfd89286fb4cb975b346fa388a.zip opensim-SC_OLD-eacb864749cbb8cfd89286fb4cb975b346fa388a.tar.gz opensim-SC_OLD-eacb864749cbb8cfd89286fb4cb975b346fa388a.tar.bz2 opensim-SC_OLD-eacb864749cbb8cfd89286fb4cb975b346fa388a.tar.xz |
Cleaned up legacy code (i.e deleted the old stuff)
Diffstat (limited to 'src/Agent_Manager.cs')
-rw-r--r-- | src/Agent_Manager.cs | 879 |
1 files changed, 0 insertions, 879 deletions
diff --git a/src/Agent_Manager.cs b/src/Agent_Manager.cs deleted file mode 100644 index 195065e..0000000 --- a/src/Agent_Manager.cs +++ /dev/null | |||
@@ -1,879 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | */ | ||
26 | |||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using libsecondlife; | ||
30 | using libsecondlife.Packets; | ||
31 | using libsecondlife.AssetSystem; | ||
32 | using System.IO; | ||
33 | using Axiom.MathLib; | ||
34 | |||
35 | namespace OpenSim | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Description of Agent_Manager. | ||
39 | /// </summary> | ||
40 | public class AgentManager | ||
41 | { | ||
42 | public Dictionary<libsecondlife.LLUUID,AvatarData> AgentList; | ||
43 | public static Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>(); | ||
44 | public static Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>(); | ||
45 | |||
46 | private uint _localNumber=0; | ||
47 | private Server _server; | ||
48 | public PrimManager Prim_Manager; | ||
49 | public AssetManagement assetManager; | ||
50 | |||
51 | private libsecondlife.Packets.RegionHandshakePacket RegionPacket; | ||
52 | private System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
53 | private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; | ||
54 | |||
55 | /// <summary> | ||
56 | /// | ||
57 | /// </summary> | ||
58 | /// <param name="serve"></param> | ||
59 | public AgentManager(Server server) | ||
60 | { | ||
61 | AgentList = new Dictionary<libsecondlife.LLUUID,AvatarData>(); | ||
62 | _server = server; | ||
63 | this.initialise(); | ||
64 | } | ||
65 | |||
66 | /// <summary> | ||
67 | /// | ||
68 | /// </summary> | ||
69 | /// <param name="id"></param> | ||
70 | /// <returns></returns> | ||
71 | public AvatarData GetAgent(LLUUID id) | ||
72 | { | ||
73 | if(!this.AgentList.ContainsKey(id)) | ||
74 | { | ||
75 | return null; | ||
76 | } | ||
77 | else | ||
78 | { | ||
79 | AvatarData avatar = this.AgentList[id]; | ||
80 | return avatar; | ||
81 | } | ||
82 | } | ||
83 | /// <summary> | ||
84 | /// | ||
85 | /// </summary> | ||
86 | /// <param name="agent"></param> | ||
87 | public void AddAgent(AvatarData agent) | ||
88 | { | ||
89 | this.AgentList.Add(agent.FullID, agent); | ||
90 | } | ||
91 | /// <summary> | ||
92 | /// | ||
93 | /// </summary> | ||
94 | /// <param name="User_info"></param> | ||
95 | /// <param name="first"></param> | ||
96 | /// <param name="last"></param> | ||
97 | /// <returns></returns> | ||
98 | /// | ||
99 | |||
100 | /// <summary> | ||
101 | /// | ||
102 | /// </summary> | ||
103 | /// <param name="User_info"></param> | ||
104 | /// <param name="first"></param> | ||
105 | /// <param name="last"></param> | ||
106 | /// <returns></returns> | ||
107 | public bool NewAgent(UserAgentInfo userInfo, string first, string last, LLUUID baseFolder, LLUUID inventoryFolder) | ||
108 | { | ||
109 | AvatarData agent = new AvatarData(); | ||
110 | agent.FullID = userInfo.AgentID; | ||
111 | agent.NetInfo = userInfo; | ||
112 | agent.NetInfo.first_name =first; | ||
113 | agent.NetInfo.last_name = last; | ||
114 | agent.Position = new LLVector3(100, 100, 22); | ||
115 | agent.BaseFolder = baseFolder; | ||
116 | agent.InventoryFolder = inventoryFolder; | ||
117 | agent.AnimID = AnimsLLUUID["ANIM_AGENT_STAND"]; | ||
118 | agent.AnimSequenceID = 1; | ||
119 | |||
120 | this.AgentList.Add(agent.FullID, agent); | ||
121 | |||
122 | //Create new Wearable Assets and place in Inventory | ||
123 | this.assetManager.CreateNewInventorySet(ref agent, userInfo); | ||
124 | |||
125 | return(true); | ||
126 | } | ||
127 | |||
128 | /// <summary> | ||
129 | /// | ||
130 | /// </summary> | ||
131 | /// <param name="UserInfo"></param> | ||
132 | public void RemoveAgent(UserAgentInfo userInfo) | ||
133 | { | ||
134 | this.AgentList.Remove(userInfo.AgentID); | ||
135 | |||
136 | //tell other clients to delete this avatar | ||
137 | } | ||
138 | |||
139 | /// <summary> | ||
140 | /// | ||
141 | /// </summary> | ||
142 | /// <param name="User_info"></param> | ||
143 | public void AgentJoin(UserAgentInfo userInfo) | ||
144 | { | ||
145 | //send region data | ||
146 | _server.SendPacket(RegionPacket,true, userInfo); | ||
147 | |||
148 | //inform client of join comlete | ||
149 | libsecondlife.Packets.AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); | ||
150 | mov.AgentData.SessionID = userInfo.SessionID; | ||
151 | mov.AgentData.AgentID = userInfo.AgentID; | ||
152 | mov.Data.RegionHandle = Globals.Instance.RegionHandle; | ||
153 | mov.Data.Timestamp = 1169838966; | ||
154 | mov.Data.Position = new LLVector3(100f, 100f, 22f); | ||
155 | mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); | ||
156 | _server.SendPacket(mov, true, userInfo); | ||
157 | |||
158 | } | ||
159 | |||
160 | /// <summary> | ||
161 | /// | ||
162 | /// </summary> | ||
163 | public void UpdatePositions() | ||
164 | { | ||
165 | //update positions | ||
166 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) | ||
167 | { | ||
168 | |||
169 | kp.Value.Position.X += (kp.Value.Velocity.X * 0.2f); | ||
170 | kp.Value.Position.Y += (kp.Value.Velocity.Y * 0.2f); | ||
171 | kp.Value.Position.Z += (kp.Value.Velocity.Z * 0.2f); | ||
172 | } | ||
173 | |||
174 | } | ||
175 | |||
176 | public void UpdateAnim(UserAgentInfo userInfo, LLUUID AnimID, int AnimSeq) | ||
177 | { | ||
178 | AgentList[userInfo.AgentID].AnimID = AnimID; | ||
179 | AgentList[userInfo.AgentID].AnimSequenceID = AnimSeq; | ||
180 | UpdateAnim(userInfo); | ||
181 | } | ||
182 | |||
183 | public void UpdateAnim(UserAgentInfo userInfo) | ||
184 | { | ||
185 | Console.WriteLine("Agent_Manager.cs: UpdateAnim(UserAgentInfo userInfo): called for Agent " + userInfo.AgentID.ToString()); | ||
186 | AvatarAnimationPacket ani = new AvatarAnimationPacket(); | ||
187 | ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; | ||
188 | ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); | ||
189 | ani.AnimationSourceList[0].ObjectID = new LLUUID("00000000000000000000000000000000"); | ||
190 | ani.Sender = new AvatarAnimationPacket.SenderBlock(); | ||
191 | ani.Sender.ID = userInfo.AgentID; | ||
192 | ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; | ||
193 | ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); | ||
194 | ani.AnimationList[0].AnimID = AgentList[userInfo.AgentID].AnimID; | ||
195 | ani.AnimationList[0].AnimSequenceID = AgentList[userInfo.AgentID].AnimSequenceID; | ||
196 | Console.WriteLine("Agenct_Manager.cs: UpdateAnim(UserAgentInfo userInfo): Sent Animation to client - " + AgentManager.AnimsNames[ani.AnimationList[0].AnimID]); | ||
197 | _server.SendPacket(ani, true, userInfo); | ||
198 | |||
199 | // update other agents as appropiate | ||
200 | Axiom.MathLib.Sphere BoundingSphere; | ||
201 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) | ||
202 | { | ||
203 | if(kp.Key!=userInfo.AgentID) { | ||
204 | // Make a bounding sphere for the other avatar | ||
205 | BoundingSphere = new Sphere(new Vector3(kp.Value.Position.X,kp.Value.Position.Y,kp.Value.Position.Z), kp.Value.far); | ||
206 | |||
207 | // If it intersects with our position, send an update packet | ||
208 | if(BoundingSphere.Intersects(new Vector3(this.AgentList[userInfo.AgentID].Position.X,this.AgentList[userInfo.AgentID].Position.Y,this.AgentList[userInfo.AgentID].Position.Z))) { | ||
209 | ani.AnimationSourceList[0].ObjectID = userInfo.AgentID; | ||
210 | ani.Sender = new AvatarAnimationPacket.SenderBlock(); | ||
211 | ani.Sender.ID = userInfo.AgentID; | ||
212 | ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; | ||
213 | ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); | ||
214 | ani.AnimationList[0].AnimID = AgentList[userInfo.AgentID].AnimID; | ||
215 | ani.AnimationList[0].AnimSequenceID = AgentList[userInfo.AgentID].AnimSequenceID; | ||
216 | _server.SendPacket(ani, true, kp.Value.NetInfo); | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | } | ||
221 | /// <summary> | ||
222 | /// | ||
223 | /// </summary> | ||
224 | private void initialise() | ||
225 | { | ||
226 | //Region data | ||
227 | RegionPacket = new RegionHandshakePacket(); | ||
228 | RegionPacket.RegionInfo.BillableFactor = 0; | ||
229 | RegionPacket.RegionInfo.IsEstateManager = false; | ||
230 | RegionPacket.RegionInfo.TerrainHeightRange00 = 60; | ||
231 | RegionPacket.RegionInfo.TerrainHeightRange01 = 60; | ||
232 | RegionPacket.RegionInfo.TerrainHeightRange10 = 60; | ||
233 | RegionPacket.RegionInfo.TerrainHeightRange11 = 60; | ||
234 | RegionPacket.RegionInfo.TerrainStartHeight00 = 20; | ||
235 | RegionPacket.RegionInfo.TerrainStartHeight01 = 20; | ||
236 | RegionPacket.RegionInfo.TerrainStartHeight10 = 20; | ||
237 | RegionPacket.RegionInfo.TerrainStartHeight11 = 20; | ||
238 | RegionPacket.RegionInfo.SimAccess = 13; | ||
239 | RegionPacket.RegionInfo.WaterHeight = 5; | ||
240 | RegionPacket.RegionInfo.RegionFlags = 72458694; | ||
241 | RegionPacket.RegionInfo.SimName = _enc.GetBytes( Globals.Instance.RegionName); | ||
242 | RegionPacket.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
243 | RegionPacket.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); | ||
244 | RegionPacket.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); | ||
245 | RegionPacket.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); | ||
246 | RegionPacket.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); | ||
247 | RegionPacket.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
248 | RegionPacket.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
249 | RegionPacket.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
250 | RegionPacket.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
251 | RegionPacket.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); | ||
252 | |||
253 | //this.SetupTemplate("objectupate168.dat"); | ||
254 | this.LoadAnims(); | ||
255 | } | ||
256 | |||
257 | /// <summary> | ||
258 | /// | ||
259 | /// </summary> | ||
260 | /// <param name="name"></param> | ||
261 | private void SetupTemplate(string name) | ||
262 | { | ||
263 | |||
264 | int i = 0; | ||
265 | FileInfo fInfo = new FileInfo(name); | ||
266 | long numBytes = fInfo.Length; | ||
267 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | ||
268 | BinaryReader br = new BinaryReader(fStream); | ||
269 | byte [] data1 = br.ReadBytes((int)numBytes); | ||
270 | br.Close(); | ||
271 | fStream.Close(); | ||
272 | |||
273 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | ||
274 | |||
275 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
276 | libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); | ||
277 | pos.X = 100f; | ||
278 | objdata.ID = 8880000; | ||
279 | objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); | ||
280 | libsecondlife.LLVector3 pos2 = new LLVector3(13.981f,100.0f,20.0f); | ||
281 | //objdata.FullID=user.AgentID; | ||
282 | byte[] pb = pos.GetBytes(); | ||
283 | Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); | ||
284 | |||
285 | AvatarTemplate = objdata; | ||
286 | |||
287 | } | ||
288 | |||
289 | private void LoadAnims() | ||
290 | { | ||
291 | AnimsLLUUID.Add("ANIM_AGENT_AFRAID", new LLUUID("6b61c8e8-4747-0d75-12d7-e49ff207a4ca")); | ||
292 | AnimsLLUUID.Add("ANIM_AGENT_AIM_BAZOOKA_R", new LLUUID("b5b4a67d-0aee-30d2-72cd-77b333e932ef")); | ||
293 | AnimsLLUUID.Add("ANIM_AGENT_AIM_BOW_L", new LLUUID("46bb4359-de38-4ed8-6a22-f1f52fe8f506")); | ||
294 | AnimsLLUUID.Add("ANIM_AGENT_AIM_HANDGUN_R", new LLUUID("3147d815-6338-b932-f011-16b56d9ac18b")); | ||
295 | AnimsLLUUID.Add("ANIM_AGENT_AIM_RIFLE_R", new LLUUID("ea633413-8006-180a-c3ba-96dd1d756720")); | ||
296 | AnimsLLUUID.Add("ANIM_AGENT_ANGRY", new LLUUID("5747a48e-073e-c331-f6f3-7c2149613d3e")); | ||
297 | AnimsLLUUID.Add("ANIM_AGENT_AWAY", new LLUUID("fd037134-85d4-f241-72c6-4f42164fedee")); | ||
298 | AnimsLLUUID.Add("ANIM_AGENT_BACKFLIP", new LLUUID("c4ca6188-9127-4f31-0158-23c4e2f93304")); | ||
299 | AnimsLLUUID.Add("ANIM_AGENT_BELLY_LAUGH", new LLUUID("18b3a4b5-b463-bd48-e4b6-71eaac76c515")); | ||
300 | AnimsLLUUID.Add("ANIM_AGENT_BLOW_KISS", new LLUUID("db84829b-462c-ee83-1e27-9bbee66bd624")); | ||
301 | AnimsLLUUID.Add("ANIM_AGENT_BORED", new LLUUID("b906c4ba-703b-1940-32a3-0c7f7d791510")); | ||
302 | AnimsLLUUID.Add("ANIM_AGENT_BOW", new LLUUID("82e99230-c906-1403-4d9c-3889dd98daba")); | ||
303 | AnimsLLUUID.Add("ANIM_AGENT_BRUSH", new LLUUID("349a3801-54f9-bf2c-3bd0-1ac89772af01")); | ||
304 | AnimsLLUUID.Add("ANIM_AGENT_BUSY", new LLUUID("efcf670c-2d18-8128-973a-034ebc806b67")); | ||
305 | AnimsLLUUID.Add("ANIM_AGENT_CLAP", new LLUUID("9b0c1c4e-8ac7-7969-1494-28c874c4f668")); | ||
306 | AnimsLLUUID.Add("ANIM_AGENT_COURTBOW", new LLUUID("9ba1c942-08be-e43a-fb29-16ad440efc50")); | ||
307 | AnimsLLUUID.Add("ANIM_AGENT_CROUCH", new LLUUID("201f3fdf-cb1f-dbec-201f-7333e328ae7c")); | ||
308 | AnimsLLUUID.Add("ANIM_AGENT_CROUCHWALK", new LLUUID("47f5f6fb-22e5-ae44-f871-73aaaf4a6022")); | ||
309 | AnimsLLUUID.Add("ANIM_AGENT_CRY", new LLUUID("92624d3e-1068-f1aa-a5ec-8244585193ed")); | ||
310 | AnimsLLUUID.Add("ANIM_AGENT_CUSTOMIZE", new LLUUID("038fcec9-5ebd-8a8e-0e2e-6e71a0a1ac53")); | ||
311 | AnimsLLUUID.Add("ANIM_AGENT_CUSTOMIZE_DONE", new LLUUID("6883a61a-b27b-5914-a61e-dda118a9ee2c")); | ||
312 | AnimsLLUUID.Add("ANIM_AGENT_DANCE1", new LLUUID("b68a3d7c-de9e-fc87-eec8-543d787e5b0d")); | ||
313 | AnimsLLUUID.Add("ANIM_AGENT_DANCE2", new LLUUID("928cae18-e31d-76fd-9cc9-2f55160ff818")); | ||
314 | AnimsLLUUID.Add("ANIM_AGENT_DANCE3", new LLUUID("30047778-10ea-1af7-6881-4db7a3a5a114")); | ||
315 | AnimsLLUUID.Add("ANIM_AGENT_DANCE4", new LLUUID("951469f4-c7b2-c818-9dee-ad7eea8c30b7")); | ||
316 | AnimsLLUUID.Add("ANIM_AGENT_DANCE5", new LLUUID("4bd69a1d-1114-a0b4-625f-84e0a5237155")); | ||
317 | AnimsLLUUID.Add("ANIM_AGENT_DANCE6", new LLUUID("cd28b69b-9c95-bb78-3f94-8d605ff1bb12")); | ||
318 | AnimsLLUUID.Add("ANIM_AGENT_DANCE7", new LLUUID("a54d8ee2-28bb-80a9-7f0c-7afbbe24a5d6")); | ||
319 | AnimsLLUUID.Add("ANIM_AGENT_DANCE8", new LLUUID("b0dc417c-1f11-af36-2e80-7e7489fa7cdc")); | ||
320 | AnimsLLUUID.Add("ANIM_AGENT_DEAD", new LLUUID("57abaae6-1d17-7b1b-5f98-6d11a6411276")); | ||
321 | AnimsLLUUID.Add("ANIM_AGENT_DRINK", new LLUUID("0f86e355-dd31-a61c-fdb0-3a96b9aad05f")); | ||
322 | AnimsLLUUID.Add("ANIM_AGENT_EMBARRASSED", new LLUUID("514af488-9051-044a-b3fc-d4dbf76377c6")); | ||
323 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_AFRAID", new LLUUID("aa2df84d-cf8f-7218-527b-424a52de766e")); | ||
324 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_ANGER", new LLUUID("1a03b575-9634-b62a-5767-3a679e81f4de")); | ||
325 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_BORED", new LLUUID("214aa6c1-ba6a-4578-f27c-ce7688f61d0d")); | ||
326 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_CRY", new LLUUID("d535471b-85bf-3b4d-a542-93bea4f59d33")); | ||
327 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_DISDAIN", new LLUUID("d4416ff1-09d3-300f-4183-1b68a19b9fc1")); | ||
328 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_EMBARRASSED", new LLUUID("0b8c8211-d78c-33e8-fa28-c51a9594e424")); | ||
329 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_FROWN", new LLUUID("fee3df48-fa3d-1015-1e26-a205810e3001")); | ||
330 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_KISS", new LLUUID("1e8d90cc-a84e-e135-884c-7c82c8b03a14")); | ||
331 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_LAUGH", new LLUUID("62570842-0950-96f8-341c-809e65110823")); | ||
332 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_OPEN_MOUTH", new LLUUID("d63bc1f9-fc81-9625-a0c6-007176d82eb7")); | ||
333 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_REPULSED", new LLUUID("f76cda94-41d4-a229-2872-e0296e58afe1")); | ||
334 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_SAD", new LLUUID("eb6ebfb2-a4b3-a19c-d388-4dd5c03823f7")); | ||
335 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_SHRUG", new LLUUID("a351b1bc-cc94-aac2-7bea-a7e6ebad15ef")); | ||
336 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_SMILE", new LLUUID("b7c7c833-e3d3-c4e3-9fc0-131237446312")); | ||
337 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_SURPRISE", new LLUUID("728646d9-cc79-08b2-32d6-937f0a835c24")); | ||
338 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_TONGUE_OUT", new LLUUID("835965c6-7f2f-bda2-5deb-2478737f91bf")); | ||
339 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_TOOTHSMILE", new LLUUID("b92ec1a5-e7ce-a76b-2b05-bcdb9311417e")); | ||
340 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_WINK", new LLUUID("da020525-4d94-59d6-23d7-81fdebf33148")); | ||
341 | AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_WORRY", new LLUUID("9c05e5c7-6f07-6ca4-ed5a-b230390c3950")); | ||
342 | AnimsLLUUID.Add("ANIM_AGENT_FALLDOWN", new LLUUID("666307d9-a860-572d-6fd4-c3ab8865c094")); | ||
343 | AnimsLLUUID.Add("ANIM_AGENT_FEMALE_WALK", new LLUUID("f5fc7433-043d-e819-8298-f519a119b688")); | ||
344 | AnimsLLUUID.Add("ANIM_AGENT_FINGER_WAG", new LLUUID("c1bc7f36-3ba0-d844-f93c-93be945d644f")); | ||
345 | AnimsLLUUID.Add("ANIM_AGENT_FIST_PUMP", new LLUUID("7db00ccd-f380-f3ee-439d-61968ec69c8a")); | ||
346 | AnimsLLUUID.Add("ANIM_AGENT_FLY", new LLUUID("aec4610c-757f-bc4e-c092-c6e9caf18daf")); | ||
347 | AnimsLLUUID.Add("ANIM_AGENT_FLYSLOW", new LLUUID("2b5a38b2-5e00-3a97-a495-4c826bc443e6")); | ||
348 | AnimsLLUUID.Add("ANIM_AGENT_HELLO", new LLUUID("9b29cd61-c45b-5689-ded2-91756b8d76a9")); | ||
349 | AnimsLLUUID.Add("ANIM_AGENT_HOLD_BAZOOKA_R", new LLUUID("ef62d355-c815-4816-2474-b1acc21094a6")); | ||
350 | AnimsLLUUID.Add("ANIM_AGENT_HOLD_BOW_L", new LLUUID("8b102617-bcba-037b-86c1-b76219f90c88")); | ||
351 | AnimsLLUUID.Add("ANIM_AGENT_HOLD_HANDGUN_R", new LLUUID("efdc1727-8b8a-c800-4077-975fc27ee2f2")); | ||
352 | AnimsLLUUID.Add("ANIM_AGENT_HOLD_RIFLE_R", new LLUUID("3d94bad0-c55b-7dcc-8763-033c59405d33")); | ||
353 | AnimsLLUUID.Add("ANIM_AGENT_HOLD_THROW_R", new LLUUID("7570c7b5-1f22-56dd-56ef-a9168241bbb6")); | ||
354 | AnimsLLUUID.Add("ANIM_AGENT_HOVER", new LLUUID("4ae8016b-31b9-03bb-c401-b1ea941db41d")); | ||
355 | AnimsLLUUID.Add("ANIM_AGENT_HOVER_DOWN", new LLUUID("20f063ea-8306-2562-0b07-5c853b37b31e")); | ||
356 | AnimsLLUUID.Add("ANIM_AGENT_HOVER_UP", new LLUUID("62c5de58-cb33-5743-3d07-9e4cd4352864")); | ||
357 | AnimsLLUUID.Add("ANIM_AGENT_IMPATIENT", new LLUUID("5ea3991f-c293-392e-6860-91dfa01278a3")); | ||
358 | AnimsLLUUID.Add("ANIM_AGENT_JUMP", new LLUUID("2305bd75-1ca9-b03b-1faa-b176b8a8c49e")); | ||
359 | AnimsLLUUID.Add("ANIM_AGENT_JUMP_FOR_JOY", new LLUUID("709ea28e-1573-c023-8bf8-520c8bc637fa")); | ||
360 | AnimsLLUUID.Add("ANIM_AGENT_KISS_MY_BUTT", new LLUUID("19999406-3a3a-d58c-a2ac-d72e555dcf51")); | ||
361 | AnimsLLUUID.Add("ANIM_AGENT_LAND", new LLUUID("7a17b059-12b2-41b1-570a-186368b6aa6f")); | ||
362 | AnimsLLUUID.Add("ANIM_AGENT_LAUGH_SHORT", new LLUUID("ca5b3f14-3194-7a2b-c894-aa699b718d1f")); | ||
363 | AnimsLLUUID.Add("ANIM_AGENT_MEDIUM_LAND", new LLUUID("f4f00d6e-b9fe-9292-f4cb-0ae06ea58d57")); | ||
364 | AnimsLLUUID.Add("ANIM_AGENT_MOTORCYCLE_SIT", new LLUUID("08464f78-3a8e-2944-cba5-0c94aff3af29")); | ||
365 | AnimsLLUUID.Add("ANIM_AGENT_MUSCLE_BEACH", new LLUUID("315c3a41-a5f3-0ba4-27da-f893f769e69b")); | ||
366 | AnimsLLUUID.Add("ANIM_AGENT_NO", new LLUUID("5a977ed9-7f72-44e9-4c4c-6e913df8ae74")); | ||
367 | AnimsLLUUID.Add("ANIM_AGENT_NO_UNHAPPY", new LLUUID("d83fa0e5-97ed-7eb2-e798-7bd006215cb4")); | ||
368 | AnimsLLUUID.Add("ANIM_AGENT_NYAH_NYAH", new LLUUID("f061723d-0a18-754f-66ee-29a44795a32f")); | ||
369 | AnimsLLUUID.Add("ANIM_AGENT_ONETWO_PUNCH", new LLUUID("eefc79be-daae-a239-8c04-890f5d23654a")); | ||
370 | AnimsLLUUID.Add("ANIM_AGENT_PEACE", new LLUUID("b312b10e-65ab-a0a4-8b3c-1326ea8e3ed9")); | ||
371 | AnimsLLUUID.Add("ANIM_AGENT_POINT_ME", new LLUUID("17c024cc-eef2-f6a0-3527-9869876d7752")); | ||
372 | AnimsLLUUID.Add("ANIM_AGENT_POINT_YOU", new LLUUID("ec952cca-61ef-aa3b-2789-4d1344f016de")); | ||
373 | AnimsLLUUID.Add("ANIM_AGENT_PRE_JUMP", new LLUUID("7a4e87fe-de39-6fcb-6223-024b00893244")); | ||
374 | AnimsLLUUID.Add("ANIM_AGENT_PUNCH_LEFT", new LLUUID("f3300ad9-3462-1d07-2044-0fef80062da0")); | ||
375 | AnimsLLUUID.Add("ANIM_AGENT_PUNCH_RIGHT", new LLUUID("c8e42d32-7310-6906-c903-cab5d4a34656")); | ||
376 | AnimsLLUUID.Add("ANIM_AGENT_REPULSED", new LLUUID("36f81a92-f076-5893-dc4b-7c3795e487cf")); | ||
377 | AnimsLLUUID.Add("ANIM_AGENT_ROUNDHOUSE_KICK", new LLUUID("49aea43b-5ac3-8a44-b595-96100af0beda")); | ||
378 | AnimsLLUUID.Add("ANIM_AGENT_RPS_COUNTDOWN", new LLUUID("35db4f7e-28c2-6679-cea9-3ee108f7fc7f")); | ||
379 | AnimsLLUUID.Add("ANIM_AGENT_RPS_PAPER", new LLUUID("0836b67f-7f7b-f37b-c00a-460dc1521f5a")); | ||
380 | AnimsLLUUID.Add("ANIM_AGENT_RPS_ROCK", new LLUUID("42dd95d5-0bc6-6392-f650-777304946c0f")); | ||
381 | AnimsLLUUID.Add("ANIM_AGENT_RPS_SCISSORS", new LLUUID("16803a9f-5140-e042-4d7b-d28ba247c325")); | ||
382 | AnimsLLUUID.Add("ANIM_AGENT_RUN", new LLUUID("05ddbff8-aaa9-92a1-2b74-8fe77a29b445")); | ||
383 | AnimsLLUUID.Add("ANIM_AGENT_SAD", new LLUUID("0eb702e2-cc5a-9a88-56a5-661a55c0676a")); | ||
384 | AnimsLLUUID.Add("ANIM_AGENT_SALUTE", new LLUUID("cd7668a6-7011-d7e2-ead8-fc69eff1a104")); | ||
385 | AnimsLLUUID.Add("ANIM_AGENT_SHOOT_BOW_L", new LLUUID("e04d450d-fdb5-0432-fd68-818aaf5935f8")); | ||
386 | AnimsLLUUID.Add("ANIM_AGENT_SHOUT", new LLUUID("6bd01860-4ebd-127a-bb3d-d1427e8e0c42")); | ||
387 | AnimsLLUUID.Add("ANIM_AGENT_SHRUG", new LLUUID("70ea714f-3a97-d742-1b01-590a8fcd1db5")); | ||
388 | AnimsLLUUID.Add("ANIM_AGENT_SIT", new LLUUID("1a5fe8ac-a804-8a5d-7cbd-56bd83184568")); | ||
389 | AnimsLLUUID.Add("ANIM_AGENT_SIT_FEMALE", new LLUUID("b1709c8d-ecd3-54a1-4f28-d55ac0840782")); | ||
390 | AnimsLLUUID.Add("ANIM_AGENT_SIT_GENERIC", new LLUUID("245f3c54-f1c0-bf2e-811f-46d8eeb386e7")); | ||
391 | AnimsLLUUID.Add("ANIM_AGENT_SIT_GROUND", new LLUUID("1c7600d6-661f-b87b-efe2-d7421eb93c86")); | ||
392 | AnimsLLUUID.Add("ANIM_AGENT_SIT_GROUND_CONSTRAINED", new LLUUID("1a2bd58e-87ff-0df8-0b4c-53e047b0bb6e")); | ||
393 | AnimsLLUUID.Add("ANIM_AGENT_SIT_TO_STAND", new LLUUID("a8dee56f-2eae-9e7a-05a2-6fb92b97e21e")); | ||
394 | AnimsLLUUID.Add("ANIM_AGENT_SLEEP", new LLUUID("f2bed5f9-9d44-39af-b0cd-257b2a17fe40")); | ||
395 | AnimsLLUUID.Add("ANIM_AGENT_SMOKE_IDLE", new LLUUID("d2f2ee58-8ad1-06c9-d8d3-3827ba31567a")); | ||
396 | AnimsLLUUID.Add("ANIM_AGENT_SMOKE_INHALE", new LLUUID("6802d553-49da-0778-9f85-1599a2266526")); | ||
397 | AnimsLLUUID.Add("ANIM_AGENT_SMOKE_THROW_DOWN", new LLUUID("0a9fb970-8b44-9114-d3a9-bf69cfe804d6")); | ||
398 | AnimsLLUUID.Add("ANIM_AGENT_SNAPSHOT", new LLUUID("eae8905b-271a-99e2-4c0e-31106afd100c")); | ||
399 | AnimsLLUUID.Add("ANIM_AGENT_STAND", new LLUUID("2408fe9e-df1d-1d7d-f4ff-1384fa7b350f")); | ||
400 | AnimsLLUUID.Add("ANIM_AGENT_STANDUP", new LLUUID("3da1d753-028a-5446-24f3-9c9b856d9422")); | ||
401 | AnimsLLUUID.Add("ANIM_AGENT_STAND_1", new LLUUID("15468e00-3400-bb66-cecc-646d7c14458e")); | ||
402 | AnimsLLUUID.Add("ANIM_AGENT_STAND_2", new LLUUID("370f3a20-6ca6-9971-848c-9a01bc42ae3c")); | ||
403 | AnimsLLUUID.Add("ANIM_AGENT_STAND_3", new LLUUID("42b46214-4b44-79ae-deb8-0df61424ff4b")); | ||
404 | AnimsLLUUID.Add("ANIM_AGENT_STAND_4", new LLUUID("f22fed8b-a5ed-2c93-64d5-bdd8b93c889f")); | ||
405 | AnimsLLUUID.Add("ANIM_AGENT_STRETCH", new LLUUID("80700431-74ec-a008-14f8-77575e73693f")); | ||
406 | AnimsLLUUID.Add("ANIM_AGENT_STRIDE", new LLUUID("1cb562b0-ba21-2202-efb3-30f82cdf9595")); | ||
407 | AnimsLLUUID.Add("ANIM_AGENT_SURF", new LLUUID("41426836-7437-7e89-025d-0aa4d10f1d69")); | ||
408 | AnimsLLUUID.Add("ANIM_AGENT_SURPRISE", new LLUUID("313b9881-4302-73c0-c7d0-0e7a36b6c224")); | ||
409 | AnimsLLUUID.Add("ANIM_AGENT_SWORD_STRIKE", new LLUUID("85428680-6bf9-3e64-b489-6f81087c24bd")); | ||
410 | AnimsLLUUID.Add("ANIM_AGENT_TALK", new LLUUID("5c682a95-6da4-a463-0bf6-0f5b7be129d1")); | ||
411 | AnimsLLUUID.Add("ANIM_AGENT_TANTRUM", new LLUUID("11000694-3f41-adc2-606b-eee1d66f3724")); | ||
412 | AnimsLLUUID.Add("ANIM_AGENT_THROW_R", new LLUUID("aa134404-7dac-7aca-2cba-435f9db875ca")); | ||
413 | AnimsLLUUID.Add("ANIM_AGENT_TRYON_SHIRT", new LLUUID("83ff59fe-2346-f236-9009-4e3608af64c1")); | ||
414 | AnimsLLUUID.Add("ANIM_AGENT_TURNLEFT", new LLUUID("56e0ba0d-4a9f-7f27-6117-32f2ebbf6135")); | ||
415 | AnimsLLUUID.Add("ANIM_AGENT_TURNRIGHT", new LLUUID("2d6daa51-3192-6794-8e2e-a15f8338ec30")); | ||
416 | AnimsLLUUID.Add("ANIM_AGENT_TYPE", new LLUUID("c541c47f-e0c0-058b-ad1a-d6ae3a4584d9")); | ||
417 | AnimsLLUUID.Add("ANIM_AGENT_WALK", new LLUUID("6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0")); | ||
418 | AnimsLLUUID.Add("ANIM_AGENT_WHISPER", new LLUUID("7693f268-06c7-ea71-fa21-2b30d6533f8f")); | ||
419 | AnimsLLUUID.Add("ANIM_AGENT_WHISTLE", new LLUUID("b1ed7982-c68e-a982-7561-52a88a5298c0")); | ||
420 | AnimsLLUUID.Add("ANIM_AGENT_WINK", new LLUUID("869ecdad-a44b-671e-3266-56aef2e3ac2e")); | ||
421 | AnimsLLUUID.Add("ANIM_AGENT_WINK_HOLLYWOOD", new LLUUID("c0c4030f-c02b-49de-24ba-2331f43fe41c")); | ||
422 | AnimsLLUUID.Add("ANIM_AGENT_WORRY", new LLUUID("9f496bd2-589a-709f-16cc-69bf7df1d36c")); | ||
423 | AnimsLLUUID.Add("ANIM_AGENT_YES", new LLUUID("15dd911d-be82-2856-26db-27659b142875")); | ||
424 | AnimsLLUUID.Add("ANIM_AGENT_YES_HAPPY", new LLUUID("b8c8b2a3-9008-1771-3bfc-90924955ab2d")); | ||
425 | AnimsLLUUID.Add("ANIM_AGENT_YOGA_FLOAT", new LLUUID("42ecd00b-9947-a97c-400a-bbc9174c7aeb")); | ||
426 | |||
427 | |||
428 | foreach (KeyValuePair<string, LLUUID> kp in AgentManager.AnimsLLUUID) | ||
429 | { | ||
430 | AnimsNames.Add(kp.Value, kp.Key); | ||
431 | } | ||
432 | } | ||
433 | |||
434 | /// <summary> | ||
435 | /// | ||
436 | /// </summary> | ||
437 | /// <param name="User_info"></param> | ||
438 | public void SendInitialData(UserAgentInfo userInfo) | ||
439 | { | ||
440 | |||
441 | //shouldn't have to read all this in from disk for every new client | ||
442 | string data_path = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, @"layer_data"); | ||
443 | |||
444 | //send layerdata | ||
445 | LayerDataPacket layerpack = new LayerDataPacket(); | ||
446 | layerpack.LayerID.Type = 76; | ||
447 | this.SendLayerData(userInfo,ref layerpack, System.IO.Path.Combine(data_path, @"layerdata0.dat")); | ||
448 | |||
449 | LayerDataPacket layerpack1 = new LayerDataPacket(); | ||
450 | layerpack1.LayerID.Type = 76; | ||
451 | this.SendLayerData(userInfo, ref layerpack, System.IO.Path.Combine(data_path, @"layerdata1.dat")); | ||
452 | |||
453 | LayerDataPacket layerpack2 = new LayerDataPacket(); | ||
454 | layerpack2.LayerID.Type = 56; | ||
455 | this.SendLayerData(userInfo, ref layerpack, System.IO.Path.Combine(data_path, @"layerdata2.dat")); | ||
456 | |||
457 | LayerDataPacket layerpack3 = new LayerDataPacket(); | ||
458 | layerpack3.LayerID.Type = 55; | ||
459 | this.SendLayerData(userInfo, ref layerpack, System.IO.Path.Combine(data_path, @"layerdata3.dat")); | ||
460 | |||
461 | LayerDataPacket layerpack4 = new LayerDataPacket(); | ||
462 | layerpack4.LayerID.Type = 56; | ||
463 | this.SendLayerData(userInfo, ref layerpack, System.IO.Path.Combine(data_path, @"layerdata4.dat")); | ||
464 | |||
465 | LayerDataPacket layerpack5 = new LayerDataPacket(); | ||
466 | layerpack5.LayerID.Type = 55; | ||
467 | this.SendLayerData(userInfo, ref layerpack, System.IO.Path.Combine(data_path, @"layerdata5.dat")); | ||
468 | |||
469 | //send intial set of captured prims data? | ||
470 | this.Prim_Manager.ReadPrimDatabase( "objectdatabase.ini", userInfo); | ||
471 | |||
472 | //send prims that have been created by users | ||
473 | //prim_man.send_existing_prims(User_info); | ||
474 | |||
475 | //send update about clients avatar | ||
476 | this.SendInitialAvatarPosition(userInfo); | ||
477 | |||
478 | //send updates about all other users | ||
479 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) | ||
480 | { | ||
481 | if(kp.Value.NetInfo.AgentID != userInfo.AgentID) | ||
482 | { | ||
483 | this.SendOtherAvatarPosition(userInfo, kp.Value); | ||
484 | } | ||
485 | } | ||
486 | } | ||
487 | |||
488 | /// <summary> | ||
489 | /// | ||
490 | /// </summary> | ||
491 | /// <param name="User_info"></param> | ||
492 | public void SendInitialAvatarPosition(UserAgentInfo userInfo) | ||
493 | { | ||
494 | //send a objectupdate packet with information about the clients avatar | ||
495 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
496 | objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle; | ||
497 | objupdate.RegionData.TimeDilation = 64096; | ||
498 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
499 | |||
500 | objupdate.ObjectData[0] = AvatarTemplate; | ||
501 | //give this avatar object a local id and assign the user a name | ||
502 | objupdate.ObjectData[0].ID = 8880000 + this._localNumber; | ||
503 | userInfo.localID = objupdate.ObjectData[0].ID; | ||
504 | //User_info.name="Test"+this.local_numer+" User"; | ||
505 | this.GetAgent(userInfo.AgentID).Started = true; | ||
506 | objupdate.ObjectData[0].FullID = userInfo.AgentID; | ||
507 | objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0"); | ||
508 | userInfo.name = "FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0"; | ||
509 | |||
510 | libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f); | ||
511 | |||
512 | byte[] pb = pos2.GetBytes(); | ||
513 | |||
514 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
515 | this._localNumber++; | ||
516 | |||
517 | _server.SendPacket(objupdate, true, userInfo); | ||
518 | |||
519 | //send this info to other existing clients | ||
520 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) | ||
521 | { | ||
522 | if(kp.Value.NetInfo.AgentID != userInfo.AgentID) | ||
523 | { | ||
524 | _server.SendPacket(objupdate, true, kp.Value.NetInfo); | ||
525 | this.SendOtherAppearance(kp.Value.NetInfo, objupdate.ObjectData[0].FullID); | ||
526 | } | ||
527 | } | ||
528 | |||
529 | } | ||
530 | |||
531 | /// <summary> | ||
532 | /// | ||
533 | /// </summary> | ||
534 | /// <param name="user"></param> | ||
535 | public void SendIntialAvatarAppearance(UserAgentInfo userInfo) | ||
536 | { | ||
537 | AvatarData Agent = this.AgentList[userInfo.AgentID]; | ||
538 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | ||
539 | aw.AgentData.AgentID = userInfo.AgentID; | ||
540 | aw.AgentData.SerialNum = 0; | ||
541 | aw.AgentData.SessionID = userInfo.SessionID; | ||
542 | |||
543 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | ||
544 | AgentWearablesUpdatePacket.WearableDataBlock awb = null; | ||
545 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
546 | awb.WearableType = (byte)0; | ||
547 | awb.AssetID = Agent.Wearables[0].AssetID; | ||
548 | awb.ItemID = Agent.Wearables[0].ItemID; | ||
549 | aw.WearableData[0] = awb; | ||
550 | |||
551 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
552 | awb.WearableType =(byte)1; | ||
553 | awb.AssetID = Agent.Wearables[1].AssetID; | ||
554 | awb.ItemID = Agent.Wearables[1].ItemID; | ||
555 | aw.WearableData[1] = awb; | ||
556 | |||
557 | for(int i=2; i<13; i++) | ||
558 | { | ||
559 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
560 | awb.WearableType = (byte)i; | ||
561 | awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
562 | awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
563 | aw.WearableData[i] = awb; | ||
564 | } | ||
565 | |||
566 | _server.SendPacket(aw, true, userInfo); | ||
567 | } | ||
568 | |||
569 | /// <summary> | ||
570 | /// | ||
571 | /// </summary> | ||
572 | /// <param name="user"></param> | ||
573 | /// <param name="id"></param> | ||
574 | public void SendOtherAppearance(UserAgentInfo userInfo, LLUUID id) | ||
575 | { | ||
576 | AvatarAppearancePacket avp = new AvatarAppearancePacket(); | ||
577 | |||
578 | |||
579 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | ||
580 | //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes); | ||
581 | |||
582 | FileInfo fInfo = new FileInfo("Avatar_texture3.dat"); | ||
583 | long numBytes = fInfo.Length; | ||
584 | FileStream fStream = new FileStream("Avatar_texture3.dat", FileMode.Open, FileAccess.Read); | ||
585 | BinaryReader br = new BinaryReader(fStream); | ||
586 | avp.ObjectData.TextureEntry = br.ReadBytes((int)numBytes); | ||
587 | br.Close(); | ||
588 | fStream.Close(); | ||
589 | |||
590 | AvatarAppearancePacket.VisualParamBlock avblock = null; | ||
591 | for(int i = 0; i < 218; i++) | ||
592 | { | ||
593 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | ||
594 | avblock.ParamValue = (byte)100; | ||
595 | avp.VisualParam[i] = avblock; | ||
596 | } | ||
597 | |||
598 | avp.Sender.IsTrial = false; | ||
599 | avp.Sender.ID = id; | ||
600 | _server.SendPacket(avp, true, userInfo); | ||
601 | |||
602 | } | ||
603 | |||
604 | /// <summary> | ||
605 | /// | ||
606 | /// </summary> | ||
607 | /// <param name="User_info"></param> | ||
608 | /// <param name="avd"></param> | ||
609 | public void SendOtherAvatarPosition(UserAgentInfo userInfo, AvatarData avatar) | ||
610 | { | ||
611 | //send a objectupdate packet with information about the clients avatar | ||
612 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
613 | objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle; | ||
614 | objupdate.RegionData.TimeDilation = 64500; | ||
615 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
616 | |||
617 | objupdate.ObjectData[0] = AvatarTemplate; | ||
618 | //give this avatar object a local id and assign the user a name | ||
619 | objupdate.ObjectData[0].ID = avatar.NetInfo.localID; | ||
620 | objupdate.ObjectData[0].FullID = avatar.NetInfo.AgentID; | ||
621 | objupdate.ObjectData[0].NameValue = _enc.GetBytes(avatar.NetInfo.name); | ||
622 | libsecondlife.LLVector3 pos2 = new LLVector3(avatar.Position.X, avatar.Position.Y, avatar.Position.Z); | ||
623 | |||
624 | byte[] pb = pos2.GetBytes(); | ||
625 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
626 | this._localNumber++; | ||
627 | |||
628 | _server.SendPacket(objupdate, true, userInfo); | ||
629 | this.SendOtherAppearance(userInfo, avatar.NetInfo.AgentID); | ||
630 | |||
631 | } | ||
632 | |||
633 | /// <summary> | ||
634 | /// | ||
635 | /// </summary> | ||
636 | /// <param name="User_info"></param> | ||
637 | /// <param name="line"></param> | ||
638 | public void SendChatMessage(UserAgentInfo userInfo, string line) | ||
639 | { | ||
640 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); | ||
641 | reply.ChatData.Audible = 1; | ||
642 | reply.ChatData.Message = _enc.GetBytes(line); | ||
643 | reply.ChatData.ChatType = 1; | ||
644 | reply.ChatData.SourceType = 1; | ||
645 | reply.ChatData.Position = new LLVector3(120, 100, 21); //should set to actual position | ||
646 | reply.ChatData.FromName = _enc.GetBytes(userInfo.first_name + " " + userInfo.last_name + "\0"); | ||
647 | reply.ChatData.OwnerID = userInfo.AgentID; | ||
648 | reply.ChatData.SourceID = userInfo.AgentID; | ||
649 | //echo to sender | ||
650 | _server.SendPacket(reply, true, userInfo); | ||
651 | |||
652 | //send to all users | ||
653 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) | ||
654 | { | ||
655 | if(kp.Value.NetInfo.AgentID!=userInfo.AgentID) | ||
656 | { | ||
657 | _server.SendPacket(reply, true, kp.Value.NetInfo); | ||
658 | } | ||
659 | } | ||
660 | } | ||
661 | |||
662 | /// <summary> | ||
663 | /// | ||
664 | /// </summary> | ||
665 | /// <param name="user"></param> | ||
666 | /// <param name="stop"></param> | ||
667 | /// <param name="x"></param> | ||
668 | /// <param name="y"></param> | ||
669 | /// <param name="z"></param> | ||
670 | /// <param name="av_id"></param> | ||
671 | /// <param name="body"></param> | ||
672 | public void SendMoveCommand(UserAgentInfo userInfo, bool stop, float x, float y, float z, uint avatarID, libsecondlife.LLQuaternion body) | ||
673 | { | ||
674 | Console.WriteLine("sending move"); | ||
675 | uint ID = userInfo.localID; | ||
676 | byte[] bytes = new byte[60]; | ||
677 | int i=0; | ||
678 | |||
679 | ImprovedTerseObjectUpdatePacket im = new ImprovedTerseObjectUpdatePacket(); | ||
680 | im.RegionData.RegionHandle = Globals.Instance.RegionHandle;; | ||
681 | im.RegionData.TimeDilation = 64096; | ||
682 | |||
683 | im.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
684 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
685 | |||
686 | im.ObjectData[0] = dat; | ||
687 | |||
688 | dat.TextureEntry = AvatarTemplate.TextureEntry; | ||
689 | libsecondlife.LLVector3 pos2 = new LLVector3(x, y, z); | ||
690 | |||
691 | bytes[i++] = (byte)(ID % 256); | ||
692 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
693 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
694 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
695 | |||
696 | bytes[i++] = 0; | ||
697 | bytes[i++] = 1; | ||
698 | |||
699 | i += 14; | ||
700 | bytes[i++] = 128; | ||
701 | bytes[i++] = 63; | ||
702 | byte[] pb = pos2.GetBytes(); | ||
703 | |||
704 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
705 | i += 12; | ||
706 | ushort ac = 32767; | ||
707 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); | ||
708 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(body.W, body.X, body.Y, body.Z); | ||
709 | Axiom.MathLib.Vector3 direc = q * v3; | ||
710 | direc.Normalize(); | ||
711 | |||
712 | direc = direc * (0.03f); | ||
713 | direc.x += 1; | ||
714 | direc.y += 1; | ||
715 | direc.z += 1; | ||
716 | ushort dx, dy, dz; | ||
717 | dx = (ushort)(32768 * direc.x); | ||
718 | dy = (ushort)(32768 * direc.y); | ||
719 | dz = (ushort)(32768 * direc.z); | ||
720 | |||
721 | //vel | ||
722 | if(!stop) | ||
723 | { | ||
724 | bytes[i++] = (byte)(dx % 256); | ||
725 | bytes[i++] = (byte)((dx >> 8) % 256); | ||
726 | |||
727 | bytes[i++] = (byte)(dy % 256); | ||
728 | bytes[i++] = (byte)((dy >> 8) % 256); | ||
729 | |||
730 | bytes[i++] = (byte)(dz % 256); | ||
731 | bytes[i++] = (byte)((dz >> 8) % 256); | ||
732 | } | ||
733 | else | ||
734 | { | ||
735 | bytes[i++] = (byte)(ac % 256); | ||
736 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
737 | |||
738 | bytes[i++] = (byte)(ac % 256); | ||
739 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
740 | |||
741 | bytes[i++] = (byte)(ac % 256); | ||
742 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
743 | } | ||
744 | //accel | ||
745 | bytes[i++] = (byte)(ac % 256); | ||
746 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
747 | |||
748 | bytes[i++] = (byte)(ac % 256); | ||
749 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
750 | |||
751 | bytes[i++] = (byte)(ac % 256); | ||
752 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
753 | |||
754 | //rot | ||
755 | bytes[i++] = (byte)(ac % 256); | ||
756 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
757 | |||
758 | bytes[i++] = (byte)(ac % 256); | ||
759 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
760 | |||
761 | bytes[i++] = (byte)(ac % 256); | ||
762 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
763 | |||
764 | bytes[i++] = (byte)(ac % 256); | ||
765 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
766 | |||
767 | //rotation vel | ||
768 | bytes[i++] = (byte)(ac % 256); | ||
769 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
770 | |||
771 | bytes[i++] = (byte)(ac % 256); | ||
772 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
773 | |||
774 | bytes[i++] = (byte)(ac % 256); | ||
775 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
776 | |||
777 | dat.Data=bytes; | ||
778 | |||
779 | _server.SendPacket(im, true, userInfo); | ||
780 | |||
781 | //should send to all users. | ||
782 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) | ||
783 | { | ||
784 | if(kp.Value.NetInfo.AgentID != userInfo.AgentID) | ||
785 | { | ||
786 | _server.SendPacket(im, true, kp.Value.NetInfo); | ||
787 | } | ||
788 | } | ||
789 | |||
790 | //check if we should be standing or walking | ||
791 | if (this.AgentList[userInfo.AgentID].Walk) | ||
792 | { | ||
793 | this.AgentList[userInfo.AgentID].AnimID = AgentManager.AnimsLLUUID["ANIM_AGENT_WALK"]; | ||
794 | this.AgentList[userInfo.AgentID].AnimSequenceID = 1; | ||
795 | this.UpdateAnim(userInfo); | ||
796 | } | ||
797 | else | ||
798 | { | ||
799 | this.AgentList[userInfo.AgentID].AnimID = AgentManager.AnimsLLUUID["ANIM_AGENT_STAND"]; | ||
800 | this.AgentList[userInfo.AgentID].AnimSequenceID = 1; | ||
801 | this.UpdateAnim(userInfo); | ||
802 | } | ||
803 | } | ||
804 | |||
805 | /// <summary> | ||
806 | /// | ||
807 | /// </summary> | ||
808 | /// <param name="User_info"></param> | ||
809 | /// <param name="lay"></param> | ||
810 | /// <param name="name"></param> | ||
811 | public void SendLayerData(UserAgentInfo userInfo, ref LayerDataPacket layer, string name) | ||
812 | { | ||
813 | FileInfo fInfo = new FileInfo(name); | ||
814 | long numBytes = fInfo.Length; | ||
815 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | ||
816 | BinaryReader br = new BinaryReader(fStream); | ||
817 | byte [] data1 = br.ReadBytes((int)numBytes); | ||
818 | br.Close(); | ||
819 | fStream.Close(); | ||
820 | layer.LayerData.Data = data1; | ||
821 | _server.SendPacket(layer, true, userInfo); | ||
822 | |||
823 | } | ||
824 | } | ||
825 | |||
826 | public class AvatarData | ||
827 | { | ||
828 | public UserAgentInfo NetInfo; | ||
829 | public LLUUID FullID; | ||
830 | public LLVector3 Position; | ||
831 | public LLVector3 Velocity = new LLVector3(0,0,0); | ||
832 | //public LLQuaternion Rotation; | ||
833 | public bool Walk = false; | ||
834 | public bool Started = false; | ||
835 | //public TextureEntry TextureEntry; | ||
836 | public AvatarWearable[] Wearables; | ||
837 | public LLUUID InventoryFolder; | ||
838 | public LLUUID BaseFolder; | ||
839 | public LLUUID AnimID; | ||
840 | public int AnimSequenceID; | ||
841 | public float far; | ||
842 | public libsecondlife.LLVector3 CameraAtAxis; | ||
843 | public libsecondlife.LLVector3 CameraCenter; | ||
844 | public libsecondlife.LLVector3 CameraLeftAxis; | ||
845 | public libsecondlife.LLVector3 CameraUpAxis; | ||
846 | |||
847 | public AvatarData() | ||
848 | { | ||
849 | Wearables=new AvatarWearable[2]; //should be 13 | ||
850 | for(int i = 0; i < 2; i++) | ||
851 | { | ||
852 | Wearables[i] = new AvatarWearable(); | ||
853 | } | ||
854 | } | ||
855 | } | ||
856 | |||
857 | public class AvatarWearable | ||
858 | { | ||
859 | public LLUUID AssetID; | ||
860 | public LLUUID ItemID; | ||
861 | |||
862 | public AvatarWearable() | ||
863 | { | ||
864 | |||
865 | } | ||
866 | } | ||
867 | /* | ||
868 | public class AvatarParams | ||
869 | { | ||
870 | public byte[] Params; | ||
871 | |||
872 | public AvatarParams() | ||
873 | { | ||
874 | |||
875 | } | ||
876 | |||
877 | } | ||
878 | */ | ||
879 | } | ||