aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authoralondria2008-02-02 22:53:01 +0000
committeralondria2008-02-02 22:53:01 +0000
commit742ed9537df1cb45a0c57e38e4c0c0735fc92eca (patch)
treeda78e2838e34139dfc4aa8f4fa5e118136781b16 /OpenSim
parentAdded llParseString2List (and a few extra methods to LSL_Types.list). (diff)
downloadopensim-SC_OLD-742ed9537df1cb45a0c57e38e4c0c0735fc92eca.zip
opensim-SC_OLD-742ed9537df1cb45a0c57e38e4c0c0735fc92eca.tar.gz
opensim-SC_OLD-742ed9537df1cb45a0c57e38e4c0c0735fc92eca.tar.bz2
opensim-SC_OLD-742ed9537df1cb45a0c57e38e4c0c0735fc92eca.tar.xz
Implements LSL function llDialog().
The ScriptDialogReply packet handler is a bit of a hack job. It is currently handled similar to ChatFromViewer, which will trigger the listen() event, however this is not exactly how LL's implementation works and will/can be fixed up later.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/IClientAPI.cs1
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs37
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs14
5 files changed, 62 insertions, 2 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 9bf1f9a..aaf27bb 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -609,6 +609,7 @@ namespace OpenSim.Framework
609 609
610 void SendAgentAlertMessage(string message, bool modal); 610 void SendAgentAlertMessage(string message, bool modal);
611 void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); 611 void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
612 void SendDialog(string objectname, LLUUID objectID, LLUUID ownerID, string msg, LLUUID textureID, int ch, string[] buttonlabels);
612 bool AddMoney(int debit); 613 bool AddMoney(int debit);
613 614
614 void SendSunPos(LLVector3 sunPos, LLVector3 sunVel); 615 void SendSunPos(LLVector3 sunPos, LLVector3 sunVel);
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index c68c3c7..4aceac0 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -1299,10 +1299,28 @@ namespace OpenSim.Region.ClientStack
1299 loadURL.Data.OwnerIsGroup = groupOwned; 1299 loadURL.Data.OwnerIsGroup = groupOwned;
1300 loadURL.Data.Message = Helpers.StringToField(message); 1300 loadURL.Data.Message = Helpers.StringToField(message);
1301 loadURL.Data.URL = Helpers.StringToField(url); 1301 loadURL.Data.URL = Helpers.StringToField(url);
1302
1303 OutPacket(loadURL, ThrottleOutPacketType.Task); 1302 OutPacket(loadURL, ThrottleOutPacketType.Task);
1304 } 1303 }
1305 1304
1305 public void SendDialog(string objectname, LLUUID objectID, LLUUID ownerID, string msg, LLUUID textureID, int ch, string[] buttonlabels)
1306 {
1307 ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog);
1308 dialog.Data.ObjectID = objectID;
1309 dialog.Data.ObjectName = Helpers.StringToField(objectname);
1310 dialog.Data.FirstName = Helpers.StringToField(this.FirstName);
1311 dialog.Data.LastName = Helpers.StringToField(this.LastName);
1312 dialog.Data.Message = Helpers.StringToField(msg);
1313 dialog.Data.ImageID = textureID;
1314 dialog.Data.ChatChannel = ch;
1315 ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[buttonlabels.Length];
1316 for (int i = 0; i < buttonlabels.Length; i++)
1317 {
1318 buttons[i] = new ScriptDialogPacket.ButtonsBlock();
1319 buttons[i].ButtonLabel = Helpers.StringToField(buttonlabels[i]);
1320 }
1321 dialog.Buttons = buttons;
1322 OutPacket(dialog, ThrottleOutPacketType.Task);
1323 }
1306 1324
1307 public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) 1325 public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID)
1308 { 1326 {
@@ -2617,6 +2635,23 @@ namespace OpenSim.Region.ClientStack
2617 OnChatFromViewer(this, args); 2635 OnChatFromViewer(this, args);
2618 } 2636 }
2619 break; 2637 break;
2638 case PacketType.ScriptDialogReply:
2639 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
2640 int ch = rdialog.Data.ChatChannel;
2641 byte[] msg = rdialog.Data.ButtonLabel;
2642 if (OnChatFromViewer != null)
2643 {
2644 ChatFromViewerArgs args = new ChatFromViewerArgs();
2645 args.Channel = ch;
2646 args.From = String.Empty;
2647 args.Message = Helpers.FieldToUTF8String(msg);
2648 args.Type = ChatTypeEnum.Shout;
2649 args.Position = new LLVector3();
2650 args.Scene = Scene;
2651 args.Sender = this;
2652 OnChatFromViewer(this, args);
2653 }
2654 break;
2620 case PacketType.ImprovedInstantMessage: 2655 case PacketType.ImprovedInstantMessage:
2621 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; 2656 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
2622 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); 2657 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 464a29a..c99cac0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1727,6 +1727,14 @@ namespace OpenSim.Region.Environment.Scenes
1727 } 1727 }
1728 } 1728 }
1729 1729
1730 public void SendDialogToUser(LLUUID avatarID, string objectName, LLUUID objectID, LLUUID ownerID,string message,LLUUID TextureID,int ch,string[] buttonlabels)
1731 {
1732 if (m_scenePresences.ContainsKey(avatarID))
1733 {
1734 m_scenePresences[avatarID].ControllingClient.SendDialog(objectName,objectID,ownerID,message,TextureID,ch,buttonlabels);
1735 }
1736 }
1737
1730 /// <summary> 1738 /// <summary>
1731 /// 1739 ///
1732 /// </summary> 1740 /// </summary>
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index b5663de..6ae74e6 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -320,6 +320,10 @@ namespace SimpleApp
320 { 320 {
321 } 321 }
322 322
323 public virtual void SendDialog(string objectname, LLUUID objectID, LLUUID ownerID, string msg, LLUUID textureID, int ch, string[] buttonlabels)
324 {
325 }
326
323 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, 327 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
324 PrimitiveBaseShape primShape, LLVector3 pos, uint flags, 328 PrimitiveBaseShape primShape, LLVector3 pos, uint flags,
325 LLUUID objectID, LLUUID ownerID, string text, byte[] color, 329 LLUUID objectID, LLUUID ownerID, string text, byte[] color,
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 8ef33d7..9d228fa 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -2487,7 +2487,19 @@ namespace OpenSim.Region.ScriptEngine.Common
2487 2487
2488 public void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel) 2488 public void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel)
2489 { 2489 {
2490 NotImplemented("llDialog"); 2490 LLUUID av = new LLUUID();
2491 if (!LLUUID.TryParse(avatar,out av))
2492 {
2493 LSLError("First parameter to llDialog needs to be a key");
2494 return;
2495 }
2496 string[] buts = new string[buttons.Length];
2497 for(int i = 0; i < buttons.Length; i++)
2498 {
2499 buts[i] = buttons.Data[i].ToString();
2500 }
2501 World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
2502 //NotImplemented("llDialog");
2491 } 2503 }
2492 2504
2493 public void llVolumeDetect(int detect) 2505 public void llVolumeDetect(int detect)