diff options
Diffstat (limited to 'OpenSim.RegionServer/world/WorldPacketHandlers.cs')
-rw-r--r-- | OpenSim.RegionServer/world/WorldPacketHandlers.cs | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/OpenSim.RegionServer/world/WorldPacketHandlers.cs b/OpenSim.RegionServer/world/WorldPacketHandlers.cs index 70cbc6b..f4213d0 100644 --- a/OpenSim.RegionServer/world/WorldPacketHandlers.cs +++ b/OpenSim.RegionServer/world/WorldPacketHandlers.cs | |||
@@ -8,6 +8,7 @@ using OpenSim.Framework.Interfaces; | |||
8 | using OpenSim.Framework.Types; | 8 | using OpenSim.Framework.Types; |
9 | using OpenSim.Framework.Terrain; | 9 | using OpenSim.Framework.Terrain; |
10 | using OpenSim.Framework.Inventory; | 10 | using OpenSim.Framework.Inventory; |
11 | using OpenSim.Framework.Utilities; | ||
11 | using OpenSim.Assets; | 12 | using OpenSim.Assets; |
12 | 13 | ||
13 | namespace OpenSim.world | 14 | namespace OpenSim.world |
@@ -44,7 +45,7 @@ namespace OpenSim.world | |||
44 | { | 45 | { |
45 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | 46 | System.Text.Encoding enc = System.Text.Encoding.ASCII; |
46 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)packet; | 47 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)packet; |
47 | if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") | 48 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") |
48 | { | 49 | { |
49 | //empty message so don't bother with it | 50 | //empty message so don't bother with it |
50 | return true; | 51 | return true; |
@@ -53,7 +54,7 @@ namespace OpenSim.world | |||
53 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); | 54 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); |
54 | reply.ChatData.Audible = 1; | 55 | reply.ChatData.Audible = 1; |
55 | reply.ChatData.Message = inchatpack.ChatData.Message; | 56 | reply.ChatData.Message = inchatpack.ChatData.Message; |
56 | reply.ChatData.ChatType = 1; | 57 | reply.ChatData.ChatType = inchatpack.ChatData.Type; |
57 | reply.ChatData.SourceType = 1; | 58 | reply.ChatData.SourceType = 1; |
58 | reply.ChatData.Position = simClient.ClientAvatar.Pos; | 59 | reply.ChatData.Position = simClient.ClientAvatar.Pos; |
59 | reply.ChatData.FromName = enc.GetBytes(simClient.ClientAvatar.firstname + " " + simClient.ClientAvatar.lastname + "\0"); | 60 | reply.ChatData.FromName = enc.GetBytes(simClient.ClientAvatar.firstname + " " + simClient.ClientAvatar.lastname + "\0"); |
@@ -61,7 +62,31 @@ namespace OpenSim.world | |||
61 | reply.ChatData.SourceID = simClient.AgentID; | 62 | reply.ChatData.SourceID = simClient.AgentID; |
62 | foreach (SimClient client in m_clientThreads.Values) | 63 | foreach (SimClient client in m_clientThreads.Values) |
63 | { | 64 | { |
64 | client.OutPacket(reply); | 65 | switch (inchatpack.ChatData.Type) |
66 | { | ||
67 | case 0: | ||
68 | int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | ||
69 | if ((dis < 10) && (dis > -10)) | ||
70 | { | ||
71 | client.OutPacket(reply); | ||
72 | } | ||
73 | break; | ||
74 | case 1: | ||
75 | dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | ||
76 | if ((dis < 30) && (dis > -30)) | ||
77 | { | ||
78 | client.OutPacket(reply); | ||
79 | } | ||
80 | break; | ||
81 | case 2: | ||
82 | dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | ||
83 | if ((dis < 100) && (dis > -100)) | ||
84 | { | ||
85 | client.OutPacket(reply); | ||
86 | } | ||
87 | break; | ||
88 | } | ||
89 | |||
65 | } | 90 | } |
66 | return true; | 91 | return true; |
67 | } | 92 | } |