aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs6
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs94
-rw-r--r--OpenSim/Region/DataSnapshot/DataSnapshotManager.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs522
-rw-r--r--OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs16
-rw-r--r--OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs18
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs60
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs128
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs384
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs10
14 files changed, 649 insertions, 649 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index b0ca496..2094578 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -249,7 +249,7 @@ namespace OpenSim
249 config.Set("enabled", "false"); 249 config.Set("enabled", "false");
250 } 250 }
251 251
252 if (DefaultConfig.Configs["Voice"] == null) 252 if (DefaultConfig.Configs["Voice"] == null)
253 DefaultConfig.AddConfig("Voice"); 253 DefaultConfig.AddConfig("Voice");
254 config = DefaultConfig.Configs["Voice"]; 254 config = DefaultConfig.Configs["Voice"];
255 if (config != null) 255 if (config != null)
@@ -522,8 +522,8 @@ namespace OpenSim
522 m_log.Info("[MODULES]: Loading Region's modules"); 522 m_log.Info("[MODULES]: Loading Region's modules");
523 523
524 List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, "."); 524 List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, ".");
525 // This needs to be ahead of the script engine load, so the 525 // This needs to be ahead of the script engine load, so the
526 // script module can pick up events exposed by a module 526 // script module can pick up events exposed by a module
527 m_moduleLoader.InitialiseSharedModules(scene); 527 m_moduleLoader.InitialiseSharedModules(scene);
528 528
529 //m_moduleLoader.PickupModules(scene, "ScriptEngines"); 529 //m_moduleLoader.PickupModules(scene, "ScriptEngines");
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 0a6431d..5b9bfdb 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -91,7 +91,7 @@ namespace OpenSim.Region.ClientStack
91 private readonly uint m_circuitCode; 91 private readonly uint m_circuitCode;
92 private int m_moneyBalance; 92 private int m_moneyBalance;
93 93
94 private int m_animationSequenceNumber = 1; 94 private int m_animationSequenceNumber = 1;
95 95
96 private byte[] m_channelVersion = Helpers.StringToField("OpenSimulator 0.5"); // Dummy value needed by libSL 96 private byte[] m_channelVersion = Helpers.StringToField("OpenSimulator 0.5"); // Dummy value needed by libSL
97 97
@@ -233,8 +233,8 @@ namespace OpenSim.Region.ClientStack
233 private RequestAsset handlerRequestAsset = null; // OnRequestAsset; 233 private RequestAsset handlerRequestAsset = null; // OnRequestAsset;
234 private UUIDNameRequest handlerTeleportHomeRequest = null; 234 private UUIDNameRequest handlerTeleportHomeRequest = null;
235 235
236 private ScriptAnswer handlerScriptAnswer = null; 236 private ScriptAnswer handlerScriptAnswer = null;
237 private RequestPayPrice handlerRequestPayPrice = null; 237 private RequestPayPrice handlerRequestPayPrice = null;
238 private ObjectDeselect handlerObjectDetach = null; 238 private ObjectDeselect handlerObjectDetach = null;
239 239
240 /* Properties */ 240 /* Properties */
@@ -307,10 +307,10 @@ namespace OpenSim.Region.ClientStack
307 get { return m_moneyBalance; } 307 get { return m_moneyBalance; }
308 } 308 }
309 309
310 public int NextAnimationSequenceNumber 310 public int NextAnimationSequenceNumber
311 { 311 {
312 get { return m_animationSequenceNumber++; } 312 get { return m_animationSequenceNumber++; }
313 } 313 }
314 314
315 /* METHODS */ 315 /* METHODS */
316 316
@@ -793,8 +793,8 @@ namespace OpenSim.Region.ClientStack
793 793
794 public event UUIDNameRequest OnTeleportHomeRequest; 794 public event UUIDNameRequest OnTeleportHomeRequest;
795 795
796 public event ScriptAnswer OnScriptAnswer; 796 public event ScriptAnswer OnScriptAnswer;
797 public event RequestPayPrice OnRequestPayPrice; 797 public event RequestPayPrice OnRequestPayPrice;
798 798
799 #region Scene/Avatar to Client 799 #region Scene/Avatar to Client
800 800
@@ -1171,28 +1171,28 @@ namespace OpenSim.Region.ClientStack
1171 OutPacket(money, ThrottleOutPacketType.Task); 1171 OutPacket(money, ThrottleOutPacketType.Task);
1172 } 1172 }
1173 1173
1174 public void SendPayPrice(LLUUID objectID, int[] payPrice) 1174 public void SendPayPrice(LLUUID objectID, int[] payPrice)
1175 { 1175 {
1176 if(payPrice[0] == 0 && 1176 if(payPrice[0] == 0 &&
1177 payPrice[1] == 0 && 1177 payPrice[1] == 0 &&
1178 payPrice[2] == 0 && 1178 payPrice[2] == 0 &&
1179 payPrice[3] == 0 && 1179 payPrice[3] == 0 &&
1180 payPrice[4] == 0) 1180 payPrice[4] == 0)
1181 return; 1181 return;
1182 1182
1183 PayPriceReplyPacket payPriceReply = (PayPriceReplyPacket)PacketPool.Instance.GetPacket(PacketType.PayPriceReply); 1183 PayPriceReplyPacket payPriceReply = (PayPriceReplyPacket)PacketPool.Instance.GetPacket(PacketType.PayPriceReply);
1184 payPriceReply.ObjectData.ObjectID = objectID; 1184 payPriceReply.ObjectData.ObjectID = objectID;
1185 payPriceReply.ObjectData.DefaultPayPrice = payPrice[0]; 1185 payPriceReply.ObjectData.DefaultPayPrice = payPrice[0];
1186 1186
1187 payPriceReply.ButtonData=new PayPriceReplyPacket.ButtonDataBlock[4]; 1187 payPriceReply.ButtonData=new PayPriceReplyPacket.ButtonDataBlock[4];
1188 payPriceReply.ButtonData[0]=new PayPriceReplyPacket.ButtonDataBlock(); 1188 payPriceReply.ButtonData[0]=new PayPriceReplyPacket.ButtonDataBlock();
1189 payPriceReply.ButtonData[0].PayButton = payPrice[1]; 1189 payPriceReply.ButtonData[0].PayButton = payPrice[1];
1190 payPriceReply.ButtonData[1]=new PayPriceReplyPacket.ButtonDataBlock(); 1190 payPriceReply.ButtonData[1]=new PayPriceReplyPacket.ButtonDataBlock();
1191 payPriceReply.ButtonData[1].PayButton = payPrice[2]; 1191 payPriceReply.ButtonData[1].PayButton = payPrice[2];
1192 payPriceReply.ButtonData[2]=new PayPriceReplyPacket.ButtonDataBlock(); 1192 payPriceReply.ButtonData[2]=new PayPriceReplyPacket.ButtonDataBlock();
1193 payPriceReply.ButtonData[2].PayButton = payPrice[3]; 1193 payPriceReply.ButtonData[2].PayButton = payPrice[3];
1194 payPriceReply.ButtonData[3]=new PayPriceReplyPacket.ButtonDataBlock(); 1194 payPriceReply.ButtonData[3]=new PayPriceReplyPacket.ButtonDataBlock();
1195 payPriceReply.ButtonData[3].PayButton = payPrice[4]; 1195 payPriceReply.ButtonData[3].PayButton = payPrice[4];
1196 1196
1197 OutPacket(payPriceReply, ThrottleOutPacketType.Task); 1197 OutPacket(payPriceReply, ThrottleOutPacketType.Task);
1198 } 1198 }
@@ -2530,8 +2530,8 @@ namespace OpenSim.Region.ClientStack
2530 return true; 2530 return true;
2531 } 2531 }
2532 2532
2533 public void SendScriptQuestion(LLUUID taskID, string taskName, string ownerName, LLUUID itemID, int question) 2533 public void SendScriptQuestion(LLUUID taskID, string taskName, string ownerName, LLUUID itemID, int question)
2534 { 2534 {
2535 ScriptQuestionPacket scriptQuestion = (ScriptQuestionPacket)PacketPool.Instance.GetPacket(PacketType.ScriptQuestion); 2535 ScriptQuestionPacket scriptQuestion = (ScriptQuestionPacket)PacketPool.Instance.GetPacket(PacketType.ScriptQuestion);
2536 scriptQuestion.Data = new ScriptQuestionPacket.DataBlock(); 2536 scriptQuestion.Data = new ScriptQuestionPacket.DataBlock();
2537 // TODO: don't create new blocks if recycling an old packet 2537 // TODO: don't create new blocks if recycling an old packet
@@ -2542,7 +2542,7 @@ namespace OpenSim.Region.ClientStack
2542 scriptQuestion.Data.ObjectOwner = Helpers.StringToField(ownerName); 2542 scriptQuestion.Data.ObjectOwner = Helpers.StringToField(ownerName);
2543 2543
2544 OutPacket(scriptQuestion, ThrottleOutPacketType.Task); 2544 OutPacket(scriptQuestion, ThrottleOutPacketType.Task);
2545 } 2545 }
2546 2546
2547 protected virtual bool Logout(IClientAPI client, Packet packet) 2547 protected virtual bool Logout(IClientAPI client, Packet packet)
2548 { 2548 {
@@ -3915,14 +3915,14 @@ namespace OpenSim.Region.ClientStack
3915 } 3915 }
3916 break; 3916 break;
3917 3917
3918 case PacketType.ScriptAnswerYes: 3918 case PacketType.ScriptAnswerYes:
3919 ScriptAnswerYesPacket scriptAnswer = (ScriptAnswerYesPacket)Pack; 3919 ScriptAnswerYesPacket scriptAnswer = (ScriptAnswerYesPacket)Pack;
3920 3920
3921 handlerScriptAnswer = OnScriptAnswer; 3921 handlerScriptAnswer = OnScriptAnswer;
3922 if (handlerScriptAnswer != null) 3922 if (handlerScriptAnswer != null)
3923 { 3923 {
3924 handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions); 3924 handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions);
3925 } 3925 }
3926 break; 3926 break;
3927 3927
3928 #endregion 3928 #endregion
@@ -4613,14 +4613,14 @@ namespace OpenSim.Region.ClientStack
4613 // TODO: handle this packet 4613 // TODO: handle this packet
4614 //m_log.Warn("[CLIENT]: unhandled EconomyDataRequest packet"); 4614 //m_log.Warn("[CLIENT]: unhandled EconomyDataRequest packet");
4615 break; 4615 break;
4616 case PacketType.RequestPayPrice: 4616 case PacketType.RequestPayPrice:
4617 RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack; 4617 RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack;
4618 handlerRequestPayPrice = OnRequestPayPrice; 4618 handlerRequestPayPrice = OnRequestPayPrice;
4619 if (handlerRequestPayPrice != null) 4619 if (handlerRequestPayPrice != null)
4620 { 4620 {
4621 handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID); 4621 handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID);
4622 } 4622 }
4623 break; 4623 break;
4624 4624
4625 #endregion 4625 #endregion
4626 4626
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
index 682763b..f3b50ae 100644
--- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
+++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.DataSnapshot
69 #region IRegionModule 69 #region IRegionModule
70 public void Close() 70 public void Close()
71 { 71 {
72 72
73 } 73 }
74 74
75 public void Initialise(Scene scene, IConfigSource config) 75 public void Initialise(Scene scene, IConfigSource config)
@@ -81,7 +81,7 @@ namespace OpenSim.Region.DataSnapshot
81 m_configLoaded = true; 81 m_configLoaded = true;
82 m_log.Info("[DATASNAPSHOT]: Loading configuration"); 82 m_log.Info("[DATASNAPSHOT]: Loading configuration");
83 //Read from the config for options 83 //Read from the config for options
84 lock (m_syncInit) { 84 lock (m_syncInit) {
85 try { 85 try {
86 m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled); 86 m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled);
87 if (config.Configs["Startup"].GetBoolean("gridmode", true)) 87 if (config.Configs["Startup"].GetBoolean("gridmode", true))
@@ -152,7 +152,7 @@ namespace OpenSim.Region.DataSnapshot
152 152
153 public string Name 153 public string Name
154 { 154 {
155 get { return "External Data Generator"; } 155 get { return "External Data Generator"; }
156 } 156 }
157 157
158 public void PostInitialise() 158 public void PostInitialise()
diff --git a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs
index bd0660f..34f8238 100644
--- a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs
+++ b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs
@@ -54,20 +54,20 @@ namespace OpenSim.Region.Environment.Modules
54 /// svn co https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux 54 /// svn co https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux
55 /// </summary> 55 /// </summary>
56 56
57 public delegate void ObjectPaid(LLUUID objectID, LLUUID agentID, int amount); 57 public delegate void ObjectPaid(LLUUID objectID, LLUUID agentID, int amount);
58 58
59 public interface IMoneyModule : IRegionModule 59 public interface IMoneyModule : IRegionModule
60 { 60 {
61 bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount); 61 bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount);
62 62
63 event ObjectPaid OnObjectPaid; 63 event ObjectPaid OnObjectPaid;
64 } 64 }
65 65
66 public class BetaGridLikeMoneyModule: IMoneyModule 66 public class BetaGridLikeMoneyModule: IMoneyModule
67 { 67 {
68 public event ObjectPaid OnObjectPaid; 68 public event ObjectPaid OnObjectPaid;
69 69
70 private ObjectPaid handerOnObjectPaid; 70 private ObjectPaid handerOnObjectPaid;
71 71
72 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 72 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
73 73
@@ -134,7 +134,7 @@ namespace OpenSim.Region.Environment.Modules
134 IConfig startupConfig = m_gConfig.Configs["Startup"]; 134 IConfig startupConfig = m_gConfig.Configs["Startup"];
135 IConfig economyConfig = m_gConfig.Configs["Economy"]; 135 IConfig economyConfig = m_gConfig.Configs["Economy"];
136 136
137 scene.RegisterModuleInterface<IMoneyModule>(this); 137 scene.RegisterModuleInterface<IMoneyModule>(this);
138 138
139 ReadConfigAndPopulate(scene, startupConfig, "Startup"); 139 ReadConfigAndPopulate(scene, startupConfig, "Startup");
140 ReadConfigAndPopulate(scene, economyConfig, "Economy"); 140 ReadConfigAndPopulate(scene, economyConfig, "Economy");
@@ -320,7 +320,7 @@ namespace OpenSim.Region.Environment.Modules
320 // Subscribe to Money messages 320 // Subscribe to Money messages
321 client.OnEconomyDataRequest += EconomyDataRequestHandler; 321 client.OnEconomyDataRequest += EconomyDataRequestHandler;
322 client.OnMoneyBalanceRequest += SendMoneyBalance; 322 client.OnMoneyBalanceRequest += SendMoneyBalance;
323 client.OnRequestPayPrice += requestPayPrice; 323 client.OnRequestPayPrice += requestPayPrice;
324 client.OnLogout += ClientClosed; 324 client.OnLogout += ClientClosed;
325 325
326 326
@@ -328,20 +328,20 @@ namespace OpenSim.Region.Environment.Modules
328 328
329 #region event Handlers 329 #region event Handlers
330 330
331 public void requestPayPrice(IClientAPI client, LLUUID objectID) 331 public void requestPayPrice(IClientAPI client, LLUUID objectID)
332 { 332 {
333 Scene scene=LocateSceneClientIn(client.AgentId); 333 Scene scene=LocateSceneClientIn(client.AgentId);
334 if(scene == null) 334 if(scene == null)
335 return; 335 return;
336 336
337 SceneObjectPart task=scene.GetSceneObjectPart(objectID); 337 SceneObjectPart task=scene.GetSceneObjectPart(objectID);
338 if(task == null) 338 if(task == null)
339 return; 339 return;
340 SceneObjectGroup group=task.ParentGroup; 340 SceneObjectGroup group=task.ParentGroup;
341 SceneObjectPart root=group.RootPart; 341 SceneObjectPart root=group.RootPart;
342 342
343 client.SendPayPrice(objectID, root.PayPrice); 343 client.SendPayPrice(objectID, root.PayPrice);
344 } 344 }
345 345
346 /// <summary> 346 /// <summary>
347 /// When the client closes the connection we remove their accounting info from memory to free up resources. 347 /// When the client closes the connection we remove their accounting info from memory to free up resources.
@@ -380,52 +380,52 @@ namespace OpenSim.Region.Environment.Modules
380 380
381 private void ValidateLandBuy (Object osender, EventManager.LandBuyArgs e) 381 private void ValidateLandBuy (Object osender, EventManager.LandBuyArgs e)
382 { 382 {
383 if (m_MoneyAddress.Length == 0) 383 if (m_MoneyAddress.Length == 0)
384 { 384 {
385 lock (m_KnownClientFunds) 385 lock (m_KnownClientFunds)
386 { 386 {
387 if (m_KnownClientFunds.ContainsKey(e.agentId)) 387 if (m_KnownClientFunds.ContainsKey(e.agentId))
388 { 388 {
389 // Does the sender have enough funds to give? 389 // Does the sender have enough funds to give?
390 if (m_KnownClientFunds[e.agentId] >= e.parcelPrice) 390 if (m_KnownClientFunds[e.agentId] >= e.parcelPrice)
391 { 391 {
392 lock(e) 392 lock(e)
393 { 393 {
394 e.economyValidated=true; 394 e.economyValidated=true;
395 } 395 }
396 } 396 }
397 } 397 }
398 } 398 }
399 } 399 }
400 else 400 else
401 { 401 {
402 if(GetRemoteBalance(e.agentId) >= e.parcelPrice) 402 if(GetRemoteBalance(e.agentId) >= e.parcelPrice)
403 { 403 {
404 lock(e) 404 lock(e)
405 { 405 {
406 e.economyValidated=true; 406 e.economyValidated=true;
407 } 407 }
408 } 408 }
409 } 409 }
410 } 410 }
411 411
412 private void processLandBuy(Object osender, EventManager.LandBuyArgs e) 412 private void processLandBuy(Object osender, EventManager.LandBuyArgs e)
413 { 413 {
414 lock(e) 414 lock(e)
415 { 415 {
416 if(e.economyValidated == true && e.transactionID == 0) 416 if(e.economyValidated == true && e.transactionID == 0)
417 { 417 {
418 e.transactionID=Util.UnixTimeSinceEpoch(); 418 e.transactionID=Util.UnixTimeSinceEpoch();
419 419
420 if(doMoneyTransfer(e.agentId, e.parcelOwnerID, e.parcelPrice, 0, "Land purchase")) 420 if(doMoneyTransfer(e.agentId, e.parcelOwnerID, e.parcelPrice, 0, "Land purchase"))
421 { 421 {
422 lock (e) 422 lock (e)
423 { 423 {
424 e.amountDebited = e.parcelPrice; 424 e.amountDebited = e.parcelPrice;
425 } 425 }
426 } 426 }
427 } 427 }
428 } 428 }
429 } 429 }
430 430
431 /// <summary> 431 /// <summary>
@@ -438,47 +438,47 @@ namespace OpenSim.Region.Environment.Modules
438 IClientAPI sender = null; 438 IClientAPI sender = null;
439 IClientAPI receiver = null; 439 IClientAPI receiver = null;
440 440
441 if(m_MoneyAddress.Length > 0) // Handled on server 441 if(m_MoneyAddress.Length > 0) // Handled on server
442 e.description=String.Empty; 442 e.description=String.Empty;
443 443
444 if(e.transactiontype == 5008) // Object gets paid 444 if(e.transactiontype == 5008) // Object gets paid
445 { 445 {
446 sender = LocateClientObject(e.sender); 446 sender = LocateClientObject(e.sender);
447 if (sender != null) 447 if (sender != null)
448 { 448 {
449 SceneObjectPart part=findPrim(e.receiver); 449 SceneObjectPart part=findPrim(e.receiver);
450 if(part == null) 450 if(part == null)
451 return; 451 return;
452 452
453 string name=resolveAgentName(part.OwnerID); 453 string name=resolveAgentName(part.OwnerID);
454 if(name == String.Empty) 454 if(name == String.Empty)
455 name="(hippos)"; 455 name="(hippos)";
456 456
457 receiver = LocateClientObject(part.OwnerID); 457 receiver = LocateClientObject(part.OwnerID);
458 458
459 string description=String.Format("Paid {0} via object {1}", name, e.description); 459 string description=String.Format("Paid {0} via object {1}", name, e.description);
460 bool transactionresult = doMoneyTransfer(e.sender, part.OwnerID, e.amount, e.transactiontype, description); 460 bool transactionresult = doMoneyTransfer(e.sender, part.OwnerID, e.amount, e.transactiontype, description);
461 461
462 if(transactionresult) 462 if(transactionresult)
463 { 463 {
464 ObjectPaid handlerOnObjectPaid = OnObjectPaid; 464 ObjectPaid handlerOnObjectPaid = OnObjectPaid;
465 if(handlerOnObjectPaid != null) 465 if(handlerOnObjectPaid != null)
466 { 466 {
467 handlerOnObjectPaid(e.receiver, e.sender, e.amount); 467 handlerOnObjectPaid(e.receiver, e.sender, e.amount);
468 } 468 }
469 } 469 }
470 470
471 if (e.sender != e.receiver) 471 if (e.sender != e.receiver)
472 { 472 {
473 sender.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.sender)); 473 sender.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.sender));
474 } 474 }
475 if(receiver != null) 475 if(receiver != null)
476 { 476 {
477 receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(part.OwnerID)); 477 receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(part.OwnerID));
478 } 478 }
479 } 479 }
480 return; 480 return;
481 } 481 }
482 482
483 sender = LocateClientObject(e.sender); 483 sender = LocateClientObject(e.sender);
484 if (sender != null) 484 if (sender != null)
@@ -652,45 +652,45 @@ namespace OpenSim.Region.Environment.Modules
652 { 652 {
653 // If we don't know about the sender, then the sender can't 653 // If we don't know about the sender, then the sender can't
654 // actually be here and therefore this is likely fraud or outdated. 654 // actually be here and therefore this is likely fraud or outdated.
655 if (m_MoneyAddress.Length == 0) 655 if (m_MoneyAddress.Length == 0)
656 { 656 {
657 if (m_KnownClientFunds.ContainsKey(Sender)) 657 if (m_KnownClientFunds.ContainsKey(Sender))
658 { 658 {
659 // Does the sender have enough funds to give? 659 // Does the sender have enough funds to give?
660 if (m_KnownClientFunds[Sender] >= amount) 660 if (m_KnownClientFunds[Sender] >= amount)
661 { 661 {
662 // Subtract the funds from the senders account 662 // Subtract the funds from the senders account
663 m_KnownClientFunds[Sender] -= amount; 663 m_KnownClientFunds[Sender] -= amount;
664 664
665 // do we know about the receiver? 665 // do we know about the receiver?
666 if (!m_KnownClientFunds.ContainsKey(Receiver)) 666 if (!m_KnownClientFunds.ContainsKey(Receiver))
667 { 667 {
668 // Make a record for them so they get the updated balance when they login 668 // Make a record for them so they get the updated balance when they login
669 CheckExistAndRefreshFunds(Receiver); 669 CheckExistAndRefreshFunds(Receiver);
670 } 670 }
671 if (m_enabled) 671 if (m_enabled)
672 { 672 {
673 //Add the amount to the Receiver's funds 673 //Add the amount to the Receiver's funds
674 m_KnownClientFunds[Receiver] += amount; 674 m_KnownClientFunds[Receiver] += amount;
675 result = true; 675 result = true;
676 } 676 }
677 } 677 }
678 else 678 else
679 { 679 {
680 // These below are redundant to make this clearer to read 680 // These below are redundant to make this clearer to read
681 result = false; 681 result = false;
682 } 682 }
683 } 683 }
684 else 684 else
685 { 685 {
686 result = false; 686 result = false;
687 } 687 }
688 } 688 }
689 else 689 else
690 { 690 {
691 result = TransferMoneyonMoneyServer(Sender, Receiver, amount, transactiontype, description); 691 result = TransferMoneyonMoneyServer(Sender, Receiver, amount, transactiontype, description);
692 } 692 }
693 } 693 }
694 } 694 }
695 return result; 695 return result;
696 } 696 }
@@ -1003,50 +1003,50 @@ namespace OpenSim.Region.Environment.Modules
1003 return MoneyRespData; 1003 return MoneyRespData;
1004 } 1004 }
1005 1005
1006 private SceneObjectPart findPrim(LLUUID objectID) 1006 private SceneObjectPart findPrim(LLUUID objectID)
1007 { 1007 {
1008 lock (m_scenel) 1008 lock (m_scenel)
1009 { 1009 {
1010 foreach (Scene s in m_scenel.Values) 1010 foreach (Scene s in m_scenel.Values)
1011 { 1011 {
1012 SceneObjectPart part=s.GetSceneObjectPart(objectID); 1012 SceneObjectPart part=s.GetSceneObjectPart(objectID);
1013 if(part != null) 1013 if(part != null)
1014 { 1014 {
1015 return part; 1015 return part;
1016 } 1016 }
1017 } 1017 }
1018 }
1019 return null;
1020 }
1021
1022 private string resolveObjectName(LLUUID objectID)
1023 {
1024 SceneObjectPart part=findPrim(objectID);
1025 if(part != null)
1026 {
1027 return part.Name;
1018 } 1028 }
1019 return null; 1029 return String.Empty;
1020 } 1030 }
1021 1031
1022 private string resolveObjectName(LLUUID objectID) 1032 private string resolveAgentName(LLUUID agentID)
1023 {
1024 SceneObjectPart part=findPrim(objectID);
1025 if(part != null)
1026 {
1027 return part.Name;
1028 }
1029 return String.Empty;
1030 }
1031
1032 private string resolveAgentName(LLUUID agentID)
1033 { 1033 {
1034 // try avatar username surname 1034 // try avatar username surname
1035 Scene scene=GetRandomScene(); 1035 Scene scene=GetRandomScene();
1036 UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(agentID); 1036 UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(agentID);
1037 if (profile != null) 1037 if (profile != null)
1038 { 1038 {
1039 string avatarname = profile.FirstName + " " + profile.SurName; 1039 string avatarname = profile.FirstName + " " + profile.SurName;
1040 return avatarname; 1040 return avatarname;
1041 } 1041 }
1042 return String.Empty; 1042 return String.Empty;
1043 } 1043 }
1044 1044
1045 public bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount) 1045 public bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount)
1046 { 1046 {
1047 string description=String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); 1047 string description=String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID));
1048 return doMoneyTransfer(fromID, toID, amount, 2, description); 1048 return doMoneyTransfer(fromID, toID, amount, 2, description);
1049 } 1049 }
1050 1050
1051 /// <summary> 1051 /// <summary>
1052 /// Informs the Money Grid Server of a transfer. 1052 /// Informs the Money Grid Server of a transfer.
@@ -1134,63 +1134,63 @@ namespace OpenSim.Region.Environment.Modules
1134 1134
1135 } 1135 }
1136 1136
1137 public int GetRemoteBalance(LLUUID agentId) 1137 public int GetRemoteBalance(LLUUID agentId)
1138 { 1138 {
1139 int funds = 0; 1139 int funds = 0;
1140 1140
1141 IClientAPI aClient = LocateClientObject(agentId); 1141 IClientAPI aClient = LocateClientObject(agentId);
1142 if (aClient != null) 1142 if (aClient != null)
1143 { 1143 {
1144 Scene s = LocateSceneClientIn(agentId); 1144 Scene s = LocateSceneClientIn(agentId);
1145 if (s != null) 1145 if (s != null)
1146 { 1146 {
1147 if (m_MoneyAddress.Length > 0) 1147 if (m_MoneyAddress.Length > 0)
1148 { 1148 {
1149 Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret); 1149 Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret);
1150 if ((bool)hbinfo["success"] == true) 1150 if ((bool)hbinfo["success"] == true)
1151 { 1151 {
1152 try 1152 try
1153 { 1153 {
1154 funds = (Int32)hbinfo["funds"]; 1154 funds = (Int32)hbinfo["funds"];
1155 } 1155 }
1156 catch (ArgumentException) 1156 catch (ArgumentException)
1157 { 1157 {
1158 } 1158 }
1159 catch (FormatException) 1159 catch (FormatException)
1160 { 1160 {
1161 } 1161 }
1162 catch (OverflowException) 1162 catch (OverflowException)
1163 { 1163 {
1164 m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId); 1164 m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId);
1165 aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable"); 1165 aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable");
1166 } 1166 }
1167 catch (InvalidCastException) 1167 catch (InvalidCastException)
1168 { 1168 {
1169 funds = 0; 1169 funds = 0;
1170 } 1170 }
1171 1171
1172 } 1172 }
1173 else 1173 else
1174 { 1174 {
1175 m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]); 1175 m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]);
1176 aClient.SendAlertMessage((string)hbinfo["errorMessage"]); 1176 aClient.SendAlertMessage((string)hbinfo["errorMessage"]);
1177 } 1177 }
1178 } 1178 }
1179 1179
1180 SetLocalFundsForAgentID(agentId, funds); 1180 SetLocalFundsForAgentID(agentId, funds);
1181 SendMoneyBalance(aClient, agentId, aClient.SessionId, LLUUID.Zero); 1181 SendMoneyBalance(aClient, agentId, aClient.SessionId, LLUUID.Zero);
1182 } 1182 }
1183 else 1183 else
1184 { 1184 {
1185 m_log.Debug("[MONEY]: Got balance request update for agent that is here, but couldn't find which scene."); 1185 m_log.Debug("[MONEY]: Got balance request update for agent that is here, but couldn't find which scene.");
1186 } 1186 }
1187 } 1187 }
1188 else 1188 else
1189 { 1189 {
1190 m_log.Debug("[MONEY]: Got balance request update for agent that isn't here."); 1190 m_log.Debug("[MONEY]: Got balance request update for agent that isn't here.");
1191 } 1191 }
1192 return funds; 1192 return funds;
1193 } 1193 }
1194 1194
1195 public XmlRpcResponse GridMoneyUpdate(XmlRpcRequest request) 1195 public XmlRpcResponse GridMoneyUpdate(XmlRpcRequest request)
1196 { 1196 {
@@ -1204,7 +1204,7 @@ namespace OpenSim.Region.Environment.Modules
1204 Helpers.TryParse((string)requestData["agentId"], out agentId); 1204 Helpers.TryParse((string)requestData["agentId"], out agentId);
1205 if (agentId != LLUUID.Zero) 1205 if (agentId != LLUUID.Zero)
1206 { 1206 {
1207 GetRemoteBalance(agentId); 1207 GetRemoteBalance(agentId);
1208 1208
1209 } 1209 }
1210 else 1210 else
@@ -1228,7 +1228,7 @@ namespace OpenSim.Region.Environment.Modules
1228 /// XMLRPC handler to send alert message and sound to client 1228 /// XMLRPC handler to send alert message and sound to client
1229 /// </summary> 1229 /// </summary>
1230 public XmlRpcResponse UserAlert(XmlRpcRequest request) 1230 public XmlRpcResponse UserAlert(XmlRpcRequest request)
1231 { 1231 {
1232 XmlRpcResponse ret = new XmlRpcResponse(); 1232 XmlRpcResponse ret = new XmlRpcResponse();
1233 Hashtable retparam = new Hashtable(); 1233 Hashtable retparam = new Hashtable();
1234 Hashtable requestData = (Hashtable)request.Params[0]; 1234 Hashtable requestData = (Hashtable)request.Params[0];
@@ -1236,36 +1236,36 @@ namespace OpenSim.Region.Environment.Modules
1236 LLUUID agentId = LLUUID.Zero; 1236 LLUUID agentId = LLUUID.Zero;
1237 LLUUID soundId = LLUUID.Zero; 1237 LLUUID soundId = LLUUID.Zero;
1238 1238
1239 Helpers.TryParse((string)requestData["agentId"], out agentId); 1239 Helpers.TryParse((string)requestData["agentId"], out agentId);
1240 Helpers.TryParse((string)requestData["soundId"], out soundId); 1240 Helpers.TryParse((string)requestData["soundId"], out soundId);
1241 string text=(string)requestData["text"]; 1241 string text=(string)requestData["text"];
1242 string secret=(string)requestData["secret"]; 1242 string secret=(string)requestData["secret"];
1243 1243
1244 Scene userScene = GetRandomScene(); 1244 Scene userScene = GetRandomScene();
1245 if(userScene.RegionInfo.regionSecret.ToString() == secret) 1245 if(userScene.RegionInfo.regionSecret.ToString() == secret)
1246 { 1246 {
1247 IClientAPI client = LocateClientObject(agentId); 1247 IClientAPI client = LocateClientObject(agentId);
1248 1248
1249 if (client != null) 1249 if (client != null)
1250 { 1250 {
1251 if(soundId != LLUUID.Zero) 1251 if(soundId != LLUUID.Zero)
1252 client.SendPlayAttachedSound(soundId, LLUUID.Zero, LLUUID.Zero, 1.0f, 0); 1252 client.SendPlayAttachedSound(soundId, LLUUID.Zero, LLUUID.Zero, 1.0f, 0);
1253 client.SendBlueBoxMessage(LLUUID.Zero, LLUUID.Zero, "", text); 1253 client.SendBlueBoxMessage(LLUUID.Zero, LLUUID.Zero, "", text);
1254 retparam.Add("success", true); 1254 retparam.Add("success", true);
1255 } 1255 }
1256 else 1256 else
1257 { 1257 {
1258 retparam.Add("success", false); 1258 retparam.Add("success", false);
1259 } 1259 }
1260 } 1260 }
1261 else 1261 else
1262 { 1262 {
1263 retparam.Add("success", false); 1263 retparam.Add("success", false);
1264 } 1264 }
1265 ret.Value = retparam; 1265 ret.Value = retparam;
1266 1266
1267 return ret; 1267 return ret;
1268 } 1268 }
1269 1269
1270 1270
1271# region Standalone box enablers only 1271# region Standalone box enablers only
diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs
index 561c5cf..e2414b0 100644
--- a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs
+++ b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs
@@ -949,12 +949,12 @@ namespace OpenSim.Region.Environment.Modules.LandManagement
949 } 949 }
950 } 950 }
951 951
952 // If the economy has been validated by the economy module, 952 // If the economy has been validated by the economy module,
953 // and land has been validated as well, this method transfers 953 // and land has been validated as well, this method transfers
954 // the land ownership 954 // the land ownership
955 955
956 public void handleLandBuyRequest(Object o, EventManager.LandBuyArgs e) 956 public void handleLandBuyRequest(Object o, EventManager.LandBuyArgs e)
957 { 957 {
958 if (e.economyValidated && e.landValidated) 958 if (e.economyValidated && e.landValidated)
959 { 959 {
960 lock (landList) 960 lock (landList)
@@ -966,11 +966,11 @@ namespace OpenSim.Region.Environment.Modules.LandManagement
966 } 966 }
967 } 967 }
968 } 968 }
969 } 969 }
970 970
971 // After receiving a land buy packet, first the data needs to 971 // After receiving a land buy packet, first the data needs to
972 // be validated. This method validates the right to buy the 972 // be validated. This method validates the right to buy the
973 // parcel 973 // parcel
974 974
975 public void handleLandValidationRequest(Object o, EventManager.LandBuyArgs e) 975 public void handleLandValidationRequest(Object o, EventManager.LandBuyArgs e)
976 { 976 {
diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs
index f9684e6..6e87a1c 100644
--- a/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs
+++ b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs
@@ -73,20 +73,20 @@ namespace OpenSim.Region.Environment.Modules.LandManagement
73 73
74 public LandData landData 74 public LandData landData
75 { 75 {
76 get 76 get
77 { 77 {
78 return m_landData; 78 return m_landData;
79 } 79 }
80 80
81 set 81 set
82 { 82 {
83 m_landData = value; 83 m_landData = value;
84 } 84 }
85 } 85 }
86 86
87 public LLUUID regionUUID 87 public LLUUID regionUUID
88 { 88 {
89 get { return m_scene.RegionInfo.RegionID; } 89 get { return m_scene.RegionInfo.RegionID; }
90 } 90 }
91 91
92 #endregion 92 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 9bf6728..40650f3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -730,11 +730,11 @@ namespace OpenSim.Region.Environment.Scenes
730 730
731 if (item != null) 731 if (item != null)
732 { 732 {
733 group.AddInventoryItem(remoteClient, primLocalID, item, copyID); 733 group.AddInventoryItem(remoteClient, primLocalID, item, copyID);
734 m_log.InfoFormat( 734 m_log.InfoFormat(
735 "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", 735 "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
736 item.Name, primLocalID, remoteClient.Name); 736 item.Name, primLocalID, remoteClient.Name);
737 group.GetProperties(remoteClient); 737 group.GetProperties(remoteClient);
738 } 738 }
739 else 739 else
740 { 740 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 8fdb468..5e0b8ba 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -134,10 +134,10 @@ namespace OpenSim.Region.Environment.Scenes
134 EventManager.LandBuyArgs args = new EventManager.LandBuyArgs( 134 EventManager.LandBuyArgs args = new EventManager.LandBuyArgs(
135 agentId, groupId, final, groupOwned, removeContribution, parcelLocalID, parcelArea, parcelPrice, authenticated); 135 agentId, groupId, final, groupOwned, removeContribution, parcelLocalID, parcelArea, parcelPrice, authenticated);
136 136
137 // First, allow all validators a stab at it 137 // First, allow all validators a stab at it
138 m_eventManager.TriggerValidateLandBuy(this, args); 138 m_eventManager.TriggerValidateLandBuy(this, args);
139 139
140 // Then, check validation and transfer 140 // Then, check validation and transfer
141 m_eventManager.TriggerLandBuy(this, args); 141 m_eventManager.TriggerLandBuy(this, args);
142 } 142 }
143 143
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 6e815a6..dd361bf 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -258,32 +258,32 @@ namespace OpenSim.Region.Environment.Scenes
258 } 258 }
259 } 259 }
260 260
261 // Assumes a lock is held on the inventory 261 // Assumes a lock is held on the inventory
262 private bool InventoryContainsName(string name) 262 private bool InventoryContainsName(string name)
263 { 263 {
264 foreach (TaskInventoryItem item in m_taskInventory.Values) 264 foreach (TaskInventoryItem item in m_taskInventory.Values)
265 { 265 {
266 if(item.Name == name) 266 if(item.Name == name)
267 return true; 267 return true;
268 } 268 }
269 return false; 269 return false;
270 } 270 }
271 271
272 private string FindAvailableInventoryName(string name) 272 private string FindAvailableInventoryName(string name)
273 { 273 {
274 if(!InventoryContainsName(name)) 274 if(!InventoryContainsName(name))
275 return name; 275 return name;
276 276
277 int suffix=1; 277 int suffix=1;
278 while(suffix < 256) 278 while(suffix < 256)
279 { 279 {
280 string tryName=String.Format("{0} {1}", name, suffix); 280 string tryName=String.Format("{0} {1}", name, suffix);
281 if(!InventoryContainsName(tryName)) 281 if(!InventoryContainsName(tryName))
282 return tryName; 282 return tryName;
283 suffix++; 283 suffix++;
284 } 284 }
285 return String.Empty; 285 return String.Empty;
286 } 286 }
287 287
288 /// <summary> 288 /// <summary>
289 /// Add an item to this prim's inventory. 289 /// Add an item to this prim's inventory.
@@ -295,11 +295,11 @@ namespace OpenSim.Region.Environment.Scenes
295 item.CreationDate = 1000; 295 item.CreationDate = 1000;
296 item.ParentPartID = UUID; 296 item.ParentPartID = UUID;
297 297
298 string name=FindAvailableInventoryName(item.Name); 298 string name=FindAvailableInventoryName(item.Name);
299 if(name == String.Empty) 299 if(name == String.Empty)
300 return; 300 return;
301 301
302 item.Name=name; 302 item.Name=name;
303 303
304 lock (m_taskInventory) 304 lock (m_taskInventory)
305 { 305 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 099d0f0..0608fa7 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Region.Environment.Scenes
97 public uint Category; 97 public uint Category;
98 98
99 // TODO: This needs to be persisted in next XML version update! 99 // TODO: This needs to be persisted in next XML version update!
100 [XmlIgnore] public int[] PayPrice = {0,0,0,0,0}; 100 [XmlIgnore] public int[] PayPrice = {0,0,0,0,0};
101 101
102 102
103 [XmlIgnore] public bool m_IsAttachment = false; 103 [XmlIgnore] public bool m_IsAttachment = false;
@@ -2038,18 +2038,18 @@ namespace OpenSim.Region.Environment.Scenes
2038 } 2038 }
2039 } 2039 }
2040 2040
2041 if(soundID == LLUUID.Zero) 2041 if(soundID == LLUUID.Zero)
2042 return; 2042 return;
2043 2043
2044 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2044 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
2045 foreach (ScenePresence p in avatarts) 2045 foreach (ScenePresence p in avatarts)
2046 { 2046 {
2047 double dis=Util.GetDistanceTo(p.AbsolutePosition, position); 2047 double dis=Util.GetDistanceTo(p.AbsolutePosition, position);
2048 if(dis > 100.0) // Max audio distance 2048 if(dis > 100.0) // Max audio distance
2049 continue; 2049 continue;
2050 2050
2051 // Scale by distance 2051 // Scale by distance
2052 volume*=((100.0-dis)/100.0); 2052 volume*=((100.0-dis)/100.0);
2053 2053
2054 if (triggered) 2054 if (triggered)
2055 { 2055 {
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 3f70108..94dbbb3 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -270,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
270 } 270 }
271 271
272 m_pos = value; 272 m_pos = value;
273 m_parentPosition=new LLVector3(0, 0, 0); 273 m_parentPosition=new LLVector3(0, 0, 0);
274 } 274 }
275 } 275 }
276 276
@@ -362,7 +362,7 @@ namespace OpenSim.Region.Environment.Scenes
362 // Move them into an object to (hopefully) avoid threading issues. 362 // Move them into an object to (hopefully) avoid threading issues.
363 try 363 try
364 { 364 {
365 SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); 365 SetMovementAnimation(Animations.AnimsLLUUID["STAND"]);
366 } 366 }
367 catch (KeyNotFoundException) 367 catch (KeyNotFoundException)
368 { 368 {
@@ -547,7 +547,7 @@ namespace OpenSim.Region.Environment.Scenes
547 547
548 AddToPhysicalScene(); 548 AddToPhysicalScene();
549 m_physicsActor.Flying = isFlying; 549 m_physicsActor.Flying = isFlying;
550 SendAnimPack(); 550 SendAnimPack();
551 551
552 m_scene.SwapRootAgentCount(false); 552 m_scene.SwapRootAgentCount(false);
553 m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(m_uuid); 553 m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(m_uuid);
@@ -570,15 +570,15 @@ namespace OpenSim.Region.Environment.Scenes
570 /// </summary> 570 /// </summary>
571 public void MakeChildAgent() 571 public void MakeChildAgent()
572 { 572 {
573 if(m_animations.Count > 0) 573 if(m_animations.Count > 0)
574 { 574 {
575 LLUUID movement=m_animations[0]; 575 LLUUID movement=m_animations[0];
576 576
577 m_animations.Clear(); 577 m_animations.Clear();
578 m_animationSeqs.Clear(); 578 m_animationSeqs.Clear();
579 579
580 SetMovementAnimation(movement); 580 SetMovementAnimation(movement);
581 } 581 }
582// m_log.DebugFormat( 582// m_log.DebugFormat(
583// "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}", 583// "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}",
584// Name, UUID, m_scene.RegionInfo.RegionName); 584// Name, UUID, m_scene.RegionInfo.RegionName);
@@ -611,10 +611,10 @@ namespace OpenSim.Region.Environment.Scenes
611 /// <param name="pos"></param> 611 /// <param name="pos"></param>
612 public void Teleport(LLVector3 pos) 612 public void Teleport(LLVector3 pos)
613 { 613 {
614 RemoveFromPhysicalScene(); 614 RemoveFromPhysicalScene();
615 Velocity = new LLVector3(0, 0, 0); 615 Velocity = new LLVector3(0, 0, 0);
616 AbsolutePosition = pos; 616 AbsolutePosition = pos;
617 AddToPhysicalScene(); 617 AddToPhysicalScene();
618 SendTerseUpdateToAllClients(); 618 SendTerseUpdateToAllClients();
619 } 619 }
620 620
@@ -1055,12 +1055,12 @@ namespace OpenSim.Region.Environment.Scenes
1055 1055
1056 public void AddAnimation(LLUUID animID) 1056 public void AddAnimation(LLUUID animID)
1057 { 1057 {
1058 if(m_isChildAgent) 1058 if(m_isChildAgent)
1059 return; 1059 return;
1060 1060
1061 // Don't let this animation become the movement animation 1061 // Don't let this animation become the movement animation
1062 if(m_animations.Count < 1) 1062 if(m_animations.Count < 1)
1063 SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); 1063 SetMovementAnimation(Animations.AnimsLLUUID["STAND"]);
1064 1064
1065 if (!m_animations.Contains(animID)) 1065 if (!m_animations.Contains(animID))
1066 { 1066 {
@@ -1072,8 +1072,8 @@ namespace OpenSim.Region.Environment.Scenes
1072 1072
1073 public void RemoveAnimation(LLUUID animID) 1073 public void RemoveAnimation(LLUUID animID)
1074 { 1074 {
1075 if(m_isChildAgent) 1075 if(m_isChildAgent)
1076 return; 1076 return;
1077 1077
1078 if (m_animations.Contains(animID)) 1078 if (m_animations.Contains(animID))
1079 { 1079 {
@@ -1083,21 +1083,21 @@ namespace OpenSim.Region.Environment.Scenes
1083 } 1083 }
1084 else 1084 else
1085 { 1085 {
1086 // What a HACK!! Anim list really needs to be an object! 1086 // What a HACK!! Anim list really needs to be an object!
1087 int idx; 1087 int idx;
1088 1088
1089 for(idx=0;idx < m_animations.Count;idx++) 1089 for(idx=0;idx < m_animations.Count;idx++)
1090 { 1090 {
1091 if(m_animations[idx] == animID) 1091 if(m_animations[idx] == animID)
1092 { 1092 {
1093 int seq=m_animationSeqs[idx]; 1093 int seq=m_animationSeqs[idx];
1094 1094
1095 m_animations.Remove(animID); 1095 m_animations.Remove(animID);
1096 m_animationSeqs.Remove(seq); 1096 m_animationSeqs.Remove(seq);
1097 SendAnimPack(); 1097 SendAnimPack();
1098 break; 1098 break;
1099 } 1099 }
1100 } 1100 }
1101 } 1101 }
1102 } 1102 }
1103 } 1103 }
@@ -1119,33 +1119,33 @@ namespace OpenSim.Region.Environment.Scenes
1119 /// </summary> 1119 /// </summary>
1120 protected void SetMovementAnimation(LLUUID anim) 1120 protected void SetMovementAnimation(LLUUID anim)
1121 { 1121 {
1122 if(m_animations.Count < 1) 1122 if(m_animations.Count < 1)
1123 { 1123 {
1124 m_animations.Add(Animations.AnimsLLUUID["STAND"]); 1124 m_animations.Add(Animations.AnimsLLUUID["STAND"]);
1125 m_animationSeqs.Add(1); 1125 m_animationSeqs.Add(1);
1126 1126
1127 SendAnimPack(); 1127 SendAnimPack();
1128 } 1128 }
1129 else 1129 else
1130 { 1130 {
1131 try 1131 try
1132 { 1132 {
1133 if (m_animations[0] != anim) 1133 if (m_animations[0] != anim)
1134 { 1134 {
1135 m_animations[0] = anim; 1135 m_animations[0] = anim;
1136 m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber; 1136 m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber;
1137 } 1137 }
1138 SendAnimPack(); 1138 SendAnimPack();
1139 } 1139 }
1140 catch 1140 catch
1141 { 1141 {
1142 m_log.Warn("[AVATAR]: SetMovementAnimation for avatar failed. Attempting recovery..."); 1142 m_log.Warn("[AVATAR]: SetMovementAnimation for avatar failed. Attempting recovery...");
1143 m_animations[0] = anim; 1143 m_animations[0] = anim;
1144 m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber; 1144 m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber;
1145 SendAnimPack(); 1145 SendAnimPack();
1146 } 1146 }
1147 } 1147 }
1148 } 1148 }
1149 1149
1150 /// <summary> 1150 /// <summary>
1151 /// This method handles agent movement related animations 1151 /// This method handles agent movement related animations
@@ -1536,8 +1536,8 @@ namespace OpenSim.Region.Environment.Scenes
1536 /// <param name="seqs"></param> 1536 /// <param name="seqs"></param>
1537 public void SendAnimPack(LLUUID[] animations, int[] seqs) 1537 public void SendAnimPack(LLUUID[] animations, int[] seqs)
1538 { 1538 {
1539 if(m_isChildAgent) 1539 if(m_isChildAgent)
1540 return; 1540 return;
1541 1541
1542 m_scene.Broadcast( 1542 m_scene.Broadcast(
1543 delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId); }); 1543 delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId); });
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 0aa3240..2586ac5 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -167,8 +167,8 @@ namespace OpenSim.Region.Examples.SimpleModule
167 public event ObjectIncludeInSearch OnObjectIncludeInSearch; 167 public event ObjectIncludeInSearch OnObjectIncludeInSearch;
168 public event UUIDNameRequest OnTeleportHomeRequest; 168 public event UUIDNameRequest OnTeleportHomeRequest;
169 169
170 public event ScriptAnswer OnScriptAnswer; 170 public event ScriptAnswer OnScriptAnswer;
171 public event RequestPayPrice OnRequestPayPrice; 171 public event RequestPayPrice OnRequestPayPrice;
172 172
173 173
174#pragma warning restore 67 174#pragma warning restore 67
@@ -221,10 +221,10 @@ namespace OpenSim.Region.Examples.SimpleModule
221 get { return FirstName + LastName; } 221 get { return FirstName + LastName; }
222 } 222 }
223 223
224 public virtual int NextAnimationSequenceNumber 224 public virtual int NextAnimationSequenceNumber
225 { 225 {
226 get { return 1; } 226 get { return 1; }
227 } 227 }
228 228
229 public virtual void OutPacket(Packet newPack, ThrottleOutPacketType packType) 229 public virtual void OutPacket(Packet newPack, ThrottleOutPacketType packType)
230 { 230 {
@@ -344,9 +344,9 @@ namespace OpenSim.Region.Examples.SimpleModule
344 { 344 {
345 } 345 }
346 346
347 public virtual void SendPayPrice(LLUUID objectID, int[] payPrice) 347 public virtual void SendPayPrice(LLUUID objectID, int[] payPrice)
348 { 348 {
349 } 349 }
350 350
351 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, 351 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
352 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) 352 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
@@ -603,8 +603,8 @@ namespace OpenSim.Region.Examples.SimpleModule
603 { 603 {
604 } 604 }
605 605
606 public void SendScriptQuestion(LLUUID objectID, string taskName, string ownerName, LLUUID itemID, int question) 606 public void SendScriptQuestion(LLUUID objectID, string taskName, string ownerName, LLUUID itemID, int question)
607 { 607 {
608 } 608 }
609 } 609 }
610} 610}
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 3778c09..3273023 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.ScriptEngine.Common
70 70
71 private DateTime m_timer = DateTime.Now; 71 private DateTime m_timer = DateTime.Now;
72 private string m_state = "default"; 72 private string m_state = "default";
73 private bool m_waitingForScriptAnswer=false; 73 private bool m_waitingForScriptAnswer=false;
74 74
75 75
76 public string State 76 public string State
@@ -121,50 +121,50 @@ namespace OpenSim.Region.ScriptEngine.Common
121 return World.GetCommander(name); 121 return World.GetCommander(name);
122 } 122 }
123 123
124 private LLUUID InventorySelf() 124 private LLUUID InventorySelf()
125 { 125 {
126 LLUUID invItemID=new LLUUID(); 126 LLUUID invItemID=new LLUUID();
127 127
128 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) 128 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
129 { 129 {
130 if(inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) 130 if(inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
131 { 131 {
132 invItemID=inv.Key; 132 invItemID=inv.Key;
133 break; 133 break;
134 } 134 }
135 } 135 }
136 136
137 return invItemID; 137 return invItemID;
138 } 138 }
139 139
140 private LLUUID InventoryKey(string name, int type) 140 private LLUUID InventoryKey(string name, int type)
141 { 141 {
142 m_host.AddScriptLPS(1); 142 m_host.AddScriptLPS(1);
143 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) 143 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
144 { 144 {
145 if(inv.Value.Name == name) 145 if(inv.Value.Name == name)
146 { 146 {
147 if(inv.Value.Type != type) 147 if(inv.Value.Type != type)
148 return LLUUID.Zero; 148 return LLUUID.Zero;
149 149
150 return inv.Value.AssetID.ToString(); 150 return inv.Value.AssetID.ToString();
151 } 151 }
152 } 152 }
153 return LLUUID.Zero; 153 return LLUUID.Zero;
154 } 154 }
155 155
156 private LLUUID InventoryKey(string name) 156 private LLUUID InventoryKey(string name)
157 { 157 {
158 m_host.AddScriptLPS(1); 158 m_host.AddScriptLPS(1);
159 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) 159 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
160 { 160 {
161 if(inv.Value.Name == name) 161 if(inv.Value.Name == name)
162 { 162 {
163 return inv.Value.AssetID.ToString(); 163 return inv.Value.AssetID.ToString();
164 } 164 }
165 } 165 }
166 return LLUUID.Zero; 166 return LLUUID.Zero;
167 } 167 }
168 168
169 //These are the implementations of the various ll-functions used by the LSL scripts. 169 //These are the implementations of the various ll-functions used by the LSL scripts.
170 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 170 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
@@ -947,15 +947,15 @@ namespace OpenSim.Region.ScriptEngine.Common
947 { 947 {
948 m_host.AddScriptLPS(1); 948 m_host.AddScriptLPS(1);
949 949
950 LLUUID textureID=new LLUUID(); 950 LLUUID textureID=new LLUUID();
951 951
952 if(!LLUUID.TryParse(texture, out textureID)) 952 if(!LLUUID.TryParse(texture, out textureID))
953 { 953 {
954 textureID=InventoryKey(texture, (int)AssetType.Texture); 954 textureID=InventoryKey(texture, (int)AssetType.Texture);
955 } 955 }
956 956
957 if(textureID == LLUUID.Zero) 957 if(textureID == LLUUID.Zero)
958 return; 958 return;
959 959
960 LLObject.TextureEntry tex = m_host.Shape.Textures; 960 LLObject.TextureEntry tex = m_host.Shape.Textures;
961 961
@@ -1610,41 +1610,41 @@ namespace OpenSim.Region.ScriptEngine.Common
1610 1610
1611 public int llGiveMoney(string destination, int amount) 1611 public int llGiveMoney(string destination, int amount)
1612 { 1612 {
1613 LLUUID invItemID=InventorySelf(); 1613 LLUUID invItemID=InventorySelf();
1614 if(invItemID == LLUUID.Zero) 1614 if(invItemID == LLUUID.Zero)
1615 return 0; 1615 return 0;
1616 1616
1617 m_host.AddScriptLPS(1); 1617 m_host.AddScriptLPS(1);
1618 1618
1619 if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) 1619 if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
1620 return 0; 1620 return 0;
1621 1621
1622 if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) == 0) 1622 if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) == 0)
1623 { 1623 {
1624 LSLError("No permissions to give money"); 1624 LSLError("No permissions to give money");
1625 return 0; 1625 return 0;
1626 } 1626 }
1627 1627
1628 LLUUID toID=new LLUUID(); 1628 LLUUID toID=new LLUUID();
1629 1629
1630 if(!LLUUID.TryParse(destination, out toID)) 1630 if(!LLUUID.TryParse(destination, out toID))
1631 { 1631 {
1632 LSLError("Bad key in llGiveMoney"); 1632 LSLError("Bad key in llGiveMoney");
1633 return 0; 1633 return 0;
1634 } 1634 }
1635 1635
1636 IMoneyModule money=World.RequestModuleInterface<IMoneyModule>(); 1636 IMoneyModule money=World.RequestModuleInterface<IMoneyModule>();
1637 1637
1638 if(money == null) 1638 if(money == null)
1639 { 1639 {
1640 NotImplemented("llGiveMoney"); 1640 NotImplemented("llGiveMoney");
1641 return 0; 1641 return 0;
1642 } 1642 }
1643 1643
1644 bool result=money.ObjectGiveMoney(m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); 1644 bool result=money.ObjectGiveMoney(m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
1645 1645
1646 if(result) 1646 if(result)
1647 return 1; 1647 return 1;
1648 1648
1649 return 0; 1649 return 0;
1650 } 1650 }
@@ -1883,57 +1883,57 @@ namespace OpenSim.Region.ScriptEngine.Common
1883 { 1883 {
1884 m_host.AddScriptLPS(1); 1884 m_host.AddScriptLPS(1);
1885 1885
1886 LLUUID invItemID=InventorySelf(); 1886 LLUUID invItemID=InventorySelf();
1887 if(invItemID == LLUUID.Zero) 1887 if(invItemID == LLUUID.Zero)
1888 return; 1888 return;
1889 1889
1890 if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) 1890 if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
1891 return; 1891 return;
1892 1892
1893 if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) 1893 if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
1894 { 1894 {
1895 // Do NOT try to parse LLUUID, animations cannot be triggered by ID 1895 // Do NOT try to parse LLUUID, animations cannot be triggered by ID
1896 LLUUID animID=InventoryKey(anim, (int)AssetType.Animation); 1896 LLUUID animID=InventoryKey(anim, (int)AssetType.Animation);
1897 if(animID == LLUUID.Zero) 1897 if(animID == LLUUID.Zero)
1898 return; 1898 return;
1899 1899
1900 if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) 1900 if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter))
1901 { 1901 {
1902 ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter]; 1902 ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter];
1903 presence.AddAnimation(animID); 1903 presence.AddAnimation(animID);
1904 } 1904 }
1905 } 1905 }
1906 } 1906 }
1907 1907
1908 public void llStopAnimation(string anim) 1908 public void llStopAnimation(string anim)
1909 { 1909 {
1910 m_host.AddScriptLPS(1); 1910 m_host.AddScriptLPS(1);
1911 1911
1912 LLUUID invItemID=InventorySelf(); 1912 LLUUID invItemID=InventorySelf();
1913 if(invItemID == LLUUID.Zero) 1913 if(invItemID == LLUUID.Zero)
1914 return; 1914 return;
1915 1915
1916 if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) 1916 if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
1917 return; 1917 return;
1918 1918
1919 if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) 1919 if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
1920 { 1920 {
1921 LLUUID animID = new LLUUID(); 1921 LLUUID animID = new LLUUID();
1922 1922
1923 if(!LLUUID.TryParse(anim, out animID)) 1923 if(!LLUUID.TryParse(anim, out animID))
1924 { 1924 {
1925 animID=InventoryKey(anim); 1925 animID=InventoryKey(anim);
1926 } 1926 }
1927 1927
1928 if(animID == LLUUID.Zero) 1928 if(animID == LLUUID.Zero)
1929 return; 1929 return;
1930 1930
1931 if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) 1931 if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter))
1932 { 1932 {
1933 ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter]; 1933 ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter];
1934 presence.RemoveAnimation(animID); 1934 presence.RemoveAnimation(animID);
1935 } 1935 }
1936 } 1936 }
1937 } 1937 }
1938 1938
1939 public void llPointAt() 1939 public void llPointAt()
@@ -1972,108 +1972,108 @@ namespace OpenSim.Region.ScriptEngine.Common
1972 1972
1973 public void llRequestPermissions(string agent, int perm) 1973 public void llRequestPermissions(string agent, int perm)
1974 { 1974 {
1975 LLUUID agentID=new LLUUID(); 1975 LLUUID agentID=new LLUUID();
1976 1976
1977 if(!LLUUID.TryParse(agent, out agentID)) 1977 if(!LLUUID.TryParse(agent, out agentID))
1978 return; 1978 return;
1979 1979
1980 LLUUID invItemID=InventorySelf(); 1980 LLUUID invItemID=InventorySelf();
1981 1981
1982 if(invItemID == LLUUID.Zero) 1982 if(invItemID == LLUUID.Zero)
1983 return; // Not in a prim? How?? 1983 return; // Not in a prim? How??
1984 1984
1985 if(agentID == LLUUID.Zero || perm == 0) // Releasing permissions 1985 if(agentID == LLUUID.Zero || perm == 0) // Releasing permissions
1986 { 1986 {
1987 m_host.TaskInventory[invItemID].PermsGranter=LLUUID.Zero; 1987 m_host.TaskInventory[invItemID].PermsGranter=LLUUID.Zero;
1988 m_host.TaskInventory[invItemID].PermsMask=0; 1988 m_host.TaskInventory[invItemID].PermsMask=0;
1989 1989
1990 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 1990 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
1991 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0}); 1991 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0});
1992 1992
1993 return; 1993 return;
1994 } 1994 }
1995 1995
1996 m_host.AddScriptLPS(1); 1996 m_host.AddScriptLPS(1);
1997 1997
1998 bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state 1998 bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state
1999 1999
2000 if(attachment && agent == m_host.OwnerID) 2000 if(attachment && agent == m_host.OwnerID)
2001 { 2001 {
2002 // When attached, certain permissions are implicit if requested from owner 2002 // When attached, certain permissions are implicit if requested from owner
2003 int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS | 2003 int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS |
2004 BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | 2004 BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION |
2005 BuiltIn_Commands_BaseClass.PERMISSION_ATTACH; 2005 BuiltIn_Commands_BaseClass.PERMISSION_ATTACH;
2006 2006
2007 if((perm & (~implicitPerms)) == 0) // Requested only implicit perms 2007 if((perm & (~implicitPerms)) == 0) // Requested only implicit perms
2008 { 2008 {
2009 m_host.TaskInventory[invItemID].PermsGranter=agentID; 2009 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2010 m_host.TaskInventory[invItemID].PermsMask=perm; 2010 m_host.TaskInventory[invItemID].PermsMask=perm;
2011 2011
2012 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2012 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2013 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)perm}); 2013 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)perm});
2014 2014
2015 return; 2015 return;
2016 } 2016 }
2017 } 2017 }
2018 else if(m_host.m_sitTargetAvatar == agentID) // Sitting avatar 2018 else if(m_host.m_sitTargetAvatar == agentID) // Sitting avatar
2019 { 2019 {
2020 // When agent is sitting, certain permissions are implicit if requested from sitting agent 2020 // When agent is sitting, certain permissions are implicit if requested from sitting agent
2021 int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | 2021 int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION |
2022 BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA; 2022 BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA;
2023 2023
2024 if((perm & (~implicitPerms)) == 0) // Requested only implicit perms 2024 if((perm & (~implicitPerms)) == 0) // Requested only implicit perms
2025 { 2025 {
2026 m_host.TaskInventory[invItemID].PermsGranter=agentID; 2026 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2027 m_host.TaskInventory[invItemID].PermsMask=perm; 2027 m_host.TaskInventory[invItemID].PermsMask=perm;
2028 2028
2029 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2029 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2030 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)perm}); 2030 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)perm});
2031 2031
2032 return; 2032 return;
2033 } 2033 }
2034 } 2034 }
2035 2035
2036 if (World.m_innerScene.ScenePresences.ContainsKey(agentID)) 2036 if (World.m_innerScene.ScenePresences.ContainsKey(agentID))
2037 { 2037 {
2038 string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID); 2038 string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID);
2039 if(ownerName == String.Empty) 2039 if(ownerName == String.Empty)
2040 ownerName="(hippos)"; 2040 ownerName="(hippos)";
2041 2041
2042 ScenePresence presence = World.m_innerScene.ScenePresences[agentID]; 2042 ScenePresence presence = World.m_innerScene.ScenePresences[agentID];
2043 if(!m_waitingForScriptAnswer) 2043 if(!m_waitingForScriptAnswer)
2044 { 2044 {
2045 m_host.TaskInventory[invItemID].PermsGranter=agentID; 2045 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2046 m_host.TaskInventory[invItemID].PermsMask=0; 2046 m_host.TaskInventory[invItemID].PermsMask=0;
2047 presence.ControllingClient.OnScriptAnswer+=handleScriptAnswer; 2047 presence.ControllingClient.OnScriptAnswer+=handleScriptAnswer;
2048 m_waitingForScriptAnswer=true; 2048 m_waitingForScriptAnswer=true;
2049 } 2049 }
2050 2050
2051 presence.ControllingClient.SendScriptQuestion(m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); 2051 presence.ControllingClient.SendScriptQuestion(m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm);
2052 return; 2052 return;
2053 } 2053 }
2054 2054
2055 // Requested agent is not in range, refuse perms 2055 // Requested agent is not in range, refuse perms
2056 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2056 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2057 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0}); 2057 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0});
2058 } 2058 }
2059 2059
2060 void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer) 2060 void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer)
2061 { 2061 {
2062 if(taskID != m_host.UUID) 2062 if(taskID != m_host.UUID)
2063 return; 2063 return;
2064 2064
2065 LLUUID invItemID=InventorySelf(); 2065 LLUUID invItemID=InventorySelf();
2066 2066
2067 if(invItemID == LLUUID.Zero) 2067 if(invItemID == LLUUID.Zero)
2068 return; 2068 return;
2069 2069
2070 client.OnScriptAnswer-=handleScriptAnswer; 2070 client.OnScriptAnswer-=handleScriptAnswer;
2071 m_waitingForScriptAnswer=false; 2071 m_waitingForScriptAnswer=false;
2072 2072
2073 m_host.TaskInventory[invItemID].PermsMask=answer; 2073 m_host.TaskInventory[invItemID].PermsMask=answer;
2074 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2074 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2075 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)answer}); 2075 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)answer});
2076 } 2076 }
2077 2077
2078 public string llGetPermissionsKey() 2078 public string llGetPermissionsKey()
2079 { 2079 {
@@ -2083,7 +2083,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2083 { 2083 {
2084 if(item.Type == 10 && item.ItemID == m_itemID) 2084 if(item.Type == 10 && item.ItemID == m_itemID)
2085 { 2085 {
2086 return item.PermsGranter.ToString(); 2086 return item.PermsGranter.ToString();
2087 } 2087 }
2088 } 2088 }
2089 2089
@@ -2098,7 +2098,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2098 { 2098 {
2099 if(item.Type == 10 && item.ItemID == m_itemID) 2099 if(item.Type == 10 && item.ItemID == m_itemID)
2100 { 2100 {
2101 return item.PermsMask; 2101 return item.PermsMask;
2102 } 2102 }
2103 } 2103 }
2104 2104
@@ -3997,24 +3997,24 @@ namespace OpenSim.Region.ScriptEngine.Common
3997 LSLError("First parameter to llDialog needs to be a key"); 3997 LSLError("First parameter to llDialog needs to be a key");
3998 return; 3998 return;
3999 } 3999 }
4000 if(buttons.Length > 12) 4000 if(buttons.Length > 12)
4001 { 4001 {
4002 LSLError("No more than 12 buttons can be shown"); 4002 LSLError("No more than 12 buttons can be shown");
4003 return; 4003 return;
4004 } 4004 }
4005 string[] buts = new string[buttons.Length]; 4005 string[] buts = new string[buttons.Length];
4006 for(int i = 0; i < buttons.Length; i++) 4006 for(int i = 0; i < buttons.Length; i++)
4007 { 4007 {
4008 if(buttons.Data[i].ToString() == String.Empty) 4008 if(buttons.Data[i].ToString() == String.Empty)
4009 { 4009 {
4010 LSLError("button label cannot be blank"); 4010 LSLError("button label cannot be blank");
4011 return; 4011 return;
4012 } 4012 }
4013 if(buttons.Data[i].ToString().Length > 24) 4013 if(buttons.Data[i].ToString().Length > 24)
4014 { 4014 {
4015 LSLError("button label cannot be longer than 24 characters"); 4015 LSLError("button label cannot be longer than 24 characters");
4016 return; 4016 return;
4017 } 4017 }
4018 buts[i] = buttons.Data[i].ToString(); 4018 buts[i] = buttons.Data[i].ToString();
4019 } 4019 }
4020 World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); 4020 World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
@@ -5137,16 +5137,16 @@ namespace OpenSim.Region.ScriptEngine.Common
5137 { 5137 {
5138 m_host.AddScriptLPS(1); 5138 m_host.AddScriptLPS(1);
5139 5139
5140 if(quick_pay_buttons.Data.Length != 4) 5140 if(quick_pay_buttons.Data.Length != 4)
5141 { 5141 {
5142 LSLError("List must have 4 elements"); 5142 LSLError("List must have 4 elements");
5143 return; 5143 return;
5144 } 5144 }
5145 m_host.ParentGroup.RootPart.PayPrice[0]=price; 5145 m_host.ParentGroup.RootPart.PayPrice[0]=price;
5146 m_host.ParentGroup.RootPart.PayPrice[1]=(int)quick_pay_buttons.Data[0]; 5146 m_host.ParentGroup.RootPart.PayPrice[1]=(int)quick_pay_buttons.Data[0];
5147 m_host.ParentGroup.RootPart.PayPrice[2]=(int)quick_pay_buttons.Data[1]; 5147 m_host.ParentGroup.RootPart.PayPrice[2]=(int)quick_pay_buttons.Data[1];
5148 m_host.ParentGroup.RootPart.PayPrice[3]=(int)quick_pay_buttons.Data[2]; 5148 m_host.ParentGroup.RootPart.PayPrice[3]=(int)quick_pay_buttons.Data[2];
5149 m_host.ParentGroup.RootPart.PayPrice[4]=(int)quick_pay_buttons.Data[3]; 5149 m_host.ParentGroup.RootPart.PayPrice[4]=(int)quick_pay_buttons.Data[3];
5150 } 5150 }
5151 5151
5152 public LSL_Types.Vector3 llGetCameraPos() 5152 public LSL_Types.Vector3 llGetCameraPos()
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
index c2e3209..d3e9948 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
@@ -71,11 +71,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
71 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; 71 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
72 myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; 72 myScriptEngine.World.EventManager.OnScriptChangedEvent += changed;
73 // TODO: HOOK ALL EVENTS UP TO SERVER! 73 // TODO: HOOK ALL EVENTS UP TO SERVER!
74 IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); 74 IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>();
75 if(money != null) 75 if(money != null)
76 { 76 {
77 money.OnObjectPaid+=HandleObjectPaid; 77 money.OnObjectPaid+=HandleObjectPaid;
78 } 78 }
79 79
80 } 80 }
81 } 81 }