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.ThreadPoolClientBranch
parent
0ea708c133
commit
742ed9537d
|
@ -609,6 +609,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void SendAgentAlertMessage(string message, bool modal);
|
void SendAgentAlertMessage(string message, bool modal);
|
||||||
void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
|
void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
|
||||||
|
void SendDialog(string objectname, LLUUID objectID, LLUUID ownerID, string msg, LLUUID textureID, int ch, string[] buttonlabels);
|
||||||
bool AddMoney(int debit);
|
bool AddMoney(int debit);
|
||||||
|
|
||||||
void SendSunPos(LLVector3 sunPos, LLVector3 sunVel);
|
void SendSunPos(LLVector3 sunPos, LLVector3 sunVel);
|
||||||
|
|
|
@ -1299,10 +1299,28 @@ namespace OpenSim.Region.ClientStack
|
||||||
loadURL.Data.OwnerIsGroup = groupOwned;
|
loadURL.Data.OwnerIsGroup = groupOwned;
|
||||||
loadURL.Data.Message = Helpers.StringToField(message);
|
loadURL.Data.Message = Helpers.StringToField(message);
|
||||||
loadURL.Data.URL = Helpers.StringToField(url);
|
loadURL.Data.URL = Helpers.StringToField(url);
|
||||||
|
|
||||||
OutPacket(loadURL, ThrottleOutPacketType.Task);
|
OutPacket(loadURL, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendDialog(string objectname, LLUUID objectID, LLUUID ownerID, string msg, LLUUID textureID, int ch, string[] buttonlabels)
|
||||||
|
{
|
||||||
|
ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog);
|
||||||
|
dialog.Data.ObjectID = objectID;
|
||||||
|
dialog.Data.ObjectName = Helpers.StringToField(objectname);
|
||||||
|
dialog.Data.FirstName = Helpers.StringToField(this.FirstName);
|
||||||
|
dialog.Data.LastName = Helpers.StringToField(this.LastName);
|
||||||
|
dialog.Data.Message = Helpers.StringToField(msg);
|
||||||
|
dialog.Data.ImageID = textureID;
|
||||||
|
dialog.Data.ChatChannel = ch;
|
||||||
|
ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[buttonlabels.Length];
|
||||||
|
for (int i = 0; i < buttonlabels.Length; i++)
|
||||||
|
{
|
||||||
|
buttons[i] = new ScriptDialogPacket.ButtonsBlock();
|
||||||
|
buttons[i].ButtonLabel = Helpers.StringToField(buttonlabels[i]);
|
||||||
|
}
|
||||||
|
dialog.Buttons = buttons;
|
||||||
|
OutPacket(dialog, ThrottleOutPacketType.Task);
|
||||||
|
}
|
||||||
|
|
||||||
public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID)
|
public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID)
|
||||||
{
|
{
|
||||||
|
@ -2617,6 +2635,23 @@ namespace OpenSim.Region.ClientStack
|
||||||
OnChatFromViewer(this, args);
|
OnChatFromViewer(this, args);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PacketType.ScriptDialogReply:
|
||||||
|
ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
|
||||||
|
int ch = rdialog.Data.ChatChannel;
|
||||||
|
byte[] msg = rdialog.Data.ButtonLabel;
|
||||||
|
if (OnChatFromViewer != null)
|
||||||
|
{
|
||||||
|
ChatFromViewerArgs args = new ChatFromViewerArgs();
|
||||||
|
args.Channel = ch;
|
||||||
|
args.From = String.Empty;
|
||||||
|
args.Message = Helpers.FieldToUTF8String(msg);
|
||||||
|
args.Type = ChatTypeEnum.Shout;
|
||||||
|
args.Position = new LLVector3();
|
||||||
|
args.Scene = Scene;
|
||||||
|
args.Sender = this;
|
||||||
|
OnChatFromViewer(this, args);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case PacketType.ImprovedInstantMessage:
|
case PacketType.ImprovedInstantMessage:
|
||||||
ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
|
ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
|
||||||
string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
|
string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
|
||||||
|
|
|
@ -1727,6 +1727,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendDialogToUser(LLUUID avatarID, string objectName, LLUUID objectID, LLUUID ownerID,string message,LLUUID TextureID,int ch,string[] buttonlabels)
|
||||||
|
{
|
||||||
|
if (m_scenePresences.ContainsKey(avatarID))
|
||||||
|
{
|
||||||
|
m_scenePresences[avatarID].ControllingClient.SendDialog(objectName,objectID,ownerID,message,TextureID,ch,buttonlabels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -320,6 +320,10 @@ namespace SimpleApp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void SendDialog(string objectname, LLUUID objectID, LLUUID ownerID, string msg, LLUUID textureID, int ch, string[] buttonlabels)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
|
public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
|
||||||
PrimitiveBaseShape primShape, LLVector3 pos, uint flags,
|
PrimitiveBaseShape primShape, LLVector3 pos, uint flags,
|
||||||
LLUUID objectID, LLUUID ownerID, string text, byte[] color,
|
LLUUID objectID, LLUUID ownerID, string text, byte[] color,
|
||||||
|
|
|
@ -2487,7 +2487,19 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||||
|
|
||||||
public void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel)
|
public void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel)
|
||||||
{
|
{
|
||||||
NotImplemented("llDialog");
|
LLUUID av = new LLUUID();
|
||||||
|
if (!LLUUID.TryParse(avatar,out av))
|
||||||
|
{
|
||||||
|
LSLError("First parameter to llDialog needs to be a key");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string[] buts = new string[buttons.Length];
|
||||||
|
for(int i = 0; i < buttons.Length; i++)
|
||||||
|
{
|
||||||
|
buts[i] = buttons.Data[i].ToString();
|
||||||
|
}
|
||||||
|
World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
|
||||||
|
//NotImplemented("llDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llVolumeDetect(int detect)
|
public void llVolumeDetect(int detect)
|
||||||
|
|
Loading…
Reference in New Issue