aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs286
1 files changed, 208 insertions, 78 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 03e0f98..f7fdbb5 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -26,16 +26,14 @@
26* 26*
27*/ 27*/
28 28
29using System;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Net; 31using System.Net;
31using System.Text; 32using System.Text;
32using libsecondlife; 33using libsecondlife;
33using libsecondlife.Packets; 34using libsecondlife.Packets;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
38using System;
39 37
40namespace SimpleApp 38namespace SimpleApp
41{ 39{
@@ -126,13 +124,15 @@ namespace SimpleApp
126#pragma warning restore 67 124#pragma warning restore 67
127 125
128 private LLUUID myID = LLUUID.Random(); 126 private LLUUID myID = LLUUID.Random();
129 public MyNpcCharacter( EventManager eventManager ) 127
128 public MyNpcCharacter(EventManager eventManager)
130 { 129 {
131 // startPos = new LLVector3(128, (float)(Util.RandomClass.NextDouble()*100), 2); 130 // startPos = new LLVector3(128, (float)(Util.RandomClass.NextDouble()*100), 2);
132 eventManager.OnFrame += Update; 131 eventManager.OnFrame += Update;
133 } 132 }
134 133
135 private LLVector3 startPos = new LLVector3(128, 128,2); 134 private LLVector3 startPos = new LLVector3(128, 128, 2);
135
136 public virtual LLVector3 StartPos 136 public virtual LLVector3 StartPos
137 { 137 {
138 get { return startPos; } 138 get { return startPos; }
@@ -155,92 +155,218 @@ namespace SimpleApp
155 } 155 }
156 156
157 private string lastName = "NPC" + Util.RandomClass.Next(1, 1000); 157 private string lastName = "NPC" + Util.RandomClass.Next(1, 1000);
158
158 public virtual string LastName 159 public virtual string LastName
159 { 160 {
160 get { return lastName; } 161 get { return lastName; }
161 } 162 }
162 163
163 public virtual void OutPacket(Packet newPack) { } 164 public virtual void OutPacket(Packet newPack)
164 public virtual void SendWearables(AvatarWearable[] wearables) { } 165 {
165 public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) { } 166 }
166 public virtual void SendStartPingCheck(byte seq) { } 167
167 public virtual void SendKillObject(ulong regionHandle, uint localID) { } 168 public virtual void SendWearables(AvatarWearable[] wearables)
168 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) { } 169 {
169 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } 170 }
170 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } 171
171 public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) { } 172 public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
172 public virtual void SendLayerData(float[] map) { } 173 {
173 public virtual void SendLayerData(int px, int py, float[] map) { } 174 }
174 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { } 175
175 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) { } 176 public virtual void SendStartPingCheck(byte seq)
176 public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } 177 {
177 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL) { } 178 }
178 public virtual void SendMapBlock(List<MapBlockData> mapBlocks) { } 179
179 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) { } 180 public virtual void SendKillObject(ulong regionHandle, uint localID)
180 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL) { } 181 {
181 public virtual void SendTeleportCancel() { } 182 }
182 public virtual void SendTeleportLocationStart() { } 183
183 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { } 184 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId)
184 185 {
185 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) { } 186 }
186 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { } 187
187 public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) { } 188 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName,
188 189 LLUUID fromAgentID)
189 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } 190 {
190 191 }
191 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) { } 192
192 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { } 193 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName,
193 194 LLUUID fromAgentID)
194 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } 195 {
195 public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) { } 196 }
196 public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } 197
197 public virtual void SendRemoveInventoryItem(LLUUID itemID) { } 198 public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
198 public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } 199 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
199 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) { } 200 {
200 201 }
201 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } 202
202 203 public virtual void SendLayerData(float[] map)
203 public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) { } 204 {
204 public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) { } 205 }
205 206
206 public void SendAlertMessage(string message) { } 207 public virtual void SendLayerData(int px, int py, float[] map)
207 public void SendAgentAlertMessage(string message, bool modal) { } 208 {
208 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { } 209 }
210
211 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
212 {
213 }
214
215 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
216 {
217 }
218
219 public virtual AgentCircuitData RequestClientInfo()
220 {
221 return new AgentCircuitData();
222 }
223
224 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt,
225 IPEndPoint newRegionExternalEndPoint, string capsURL)
226 {
227 }
228
229 public virtual void SendMapBlock(List<MapBlockData> mapBlocks)
230 {
231 }
232
233 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
234 {
235 }
236
237 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
238 uint locationID, uint flags, string capsURL)
239 {
240 }
241
242 public virtual void SendTeleportCancel()
243 {
244 }
245
246 public virtual void SendTeleportLocationStart()
247 {
248 }
249
250 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
251 {
252 }
253
254 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
255 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
256 {
257 }
258
259 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
260 LLVector3 position, LLVector3 velocity, LLQuaternion rotation)
261 {
262 }
263
264 public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations)
265 {
266 }
267
268 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint)
269 {
270 }
271
272 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
273 PrimitiveBaseShape primShape, LLVector3 pos, uint flags,
274 LLUUID objectID, LLUUID ownerID, string text, uint parentID,
275 byte[] particleSystem, LLQuaternion rotation)
276 {
277 }
278
279 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
280 LLVector3 position, LLQuaternion rotation)
281 {
282 }
283
284 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items)
285 {
286 }
287
288 public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item)
289 {
290 }
291
292 public virtual void SendInventoryItemUpdate(InventoryItemBase Item)
293 {
294 }
295
296 public virtual void SendRemoveInventoryItem(LLUUID itemID)
297 {
298 }
299
300 public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
301 {
302 }
303
304 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data)
305 {
306 }
307
308 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname)
309 {
310 }
311
312 public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID)
313 {
314 }
315
316 public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain,
317 byte flags)
318 {
319 }
320
321 public void SendAlertMessage(string message)
322 {
323 }
324
325 public void SendAgentAlertMessage(string message, bool modal)
326 {
327 }
328
329 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message,
330 string url)
331 {
332 }
209 333
210 public virtual void SendRegionHandshake(RegionInfo regionInfo) 334 public virtual void SendRegionHandshake(RegionInfo regionInfo)
211 { 335 {
212 if (OnRegionHandShakeReply != null) 336 if (OnRegionHandShakeReply != null)
213 { 337 {
214 this.OnRegionHandShakeReply(this); 338 OnRegionHandShakeReply(this);
215 } 339 }
216 340
217 if (OnCompleteMovementToRegion != null) 341 if (OnCompleteMovementToRegion != null)
218 { 342 {
219 this.OnCompleteMovementToRegion(); 343 OnCompleteMovementToRegion();
220 } 344 }
221 } 345 }
222 346
223 private void Update( ) 347 private void Update()
224 { 348 {
225 Encoding enc = Encoding.ASCII; 349 Encoding enc = Encoding.ASCII;
226 350
227 if (this.OnAgentUpdate != null) 351 if (OnAgentUpdate != null)
228 { 352 {
229 this.OnAgentUpdate(this, movementFlag, bodyDirection); 353 OnAgentUpdate(this, movementFlag, bodyDirection);
230 } 354 }
231 if (this.flyState == 0) 355 if (flyState == 0)
232 { 356 {
233 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; 357 movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY |
358 (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG;
234 flyState = 1; 359 flyState = 1;
235 } 360 }
236 else if (this.flyState == 1) 361 else if (flyState == 1)
237 { 362 {
238 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; 363 movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY |
364 (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS;
239 flyState = 2; 365 flyState = 2;
240 } 366 }
241 else 367 else
242 { 368 {
243 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY; 369 movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY;
244 flyState = 0; 370 flyState = 0;
245 } 371 }
246 372
@@ -251,15 +377,14 @@ namespace SimpleApp
251 ChatFromViewerArgs args = new ChatFromViewerArgs(); 377 ChatFromViewerArgs args = new ChatFromViewerArgs();
252 args.Message = "Kinda quiet around here, isn't it?"; 378 args.Message = "Kinda quiet around here, isn't it?";
253 args.Channel = 0; 379 args.Channel = 0;
254 args.From = this.FirstName + " " + this.LastName; 380 args.From = FirstName + " " + LastName;
255 args.Position = new LLVector3(128, 128, 26); 381 args.Position = new LLVector3(128, 128, 26);
256 args.Sender = this; 382 args.Sender = this;
257 args.Type = ChatTypeEnum.Shout; 383 args.Type = ChatTypeEnum.Shout;
258 384
259 this.OnChatFromViewer(this, args); 385 OnChatFromViewer(this, args);
260 } 386 }
261 count = -1; 387 count = -1;
262
263 } 388 }
264 389
265 count++; 390 count++;
@@ -270,9 +395,19 @@ namespace SimpleApp
270 return false; 395 return false;
271 } 396 }
272 397
273 public void SendViewerTime(int phase) { } 398 public void SendViewerTime(int phase)
274 public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) { } 399 {
275 public void SetDebug(int newDebug) { } 400 }
401
402 public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember,
403 string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL,
404 LLUUID partnerID)
405 {
406 }
407
408 public void SetDebug(int newDebug)
409 {
410 }
276 411
277 public void InPacket(Packet NewPack) 412 public void InPacket(Packet NewPack)
278 { 413 {
@@ -281,22 +416,17 @@ namespace SimpleApp
281 public void Close() 416 public void Close()
282 { 417 {
283 } 418 }
284 419
285 private uint m_circuitCode; 420 private uint m_circuitCode;
421
286 public uint CircuitCode 422 public uint CircuitCode
287 { 423 {
288 get 424 get { return m_circuitCode; }
289 { 425 set { m_circuitCode = value; }
290 return m_circuitCode;
291 }
292 set
293 {
294 m_circuitCode = value;
295 }
296 } 426 }
297 427
298 public void SendLogoutPacket() 428 public void SendLogoutPacket()
299 { 429 {
300 } 430 }
301 } 431 }
302} 432} \ No newline at end of file