diff options
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/ClientView.Grid.cs')
-rw-r--r-- | OpenSim/OpenSim.RegionServer/ClientView.Grid.cs | 192 |
1 files changed, 0 insertions, 192 deletions
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs deleted file mode 100644 index 019b65d..0000000 --- a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs +++ /dev/null | |||
@@ -1,192 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using Nwc.XmlRpc; | ||
34 | using System.Net; | ||
35 | using System.Net.Sockets; | ||
36 | using System.IO; | ||
37 | using System.Threading; | ||
38 | using System.Timers; | ||
39 | using OpenSim.Framework.Interfaces; | ||
40 | using OpenSim.Framework.Types; | ||
41 | using OpenSim.Framework.Inventory; | ||
42 | using OpenSim.Framework.Utilities; | ||
43 | using OpenSim.world; | ||
44 | using OpenSim.Assets; | ||
45 | using OpenSim.Framework.Console; | ||
46 | |||
47 | namespace OpenSim | ||
48 | { | ||
49 | public partial class ClientView | ||
50 | { | ||
51 | |||
52 | public void EnableNeighbours() | ||
53 | { | ||
54 | if ((this.m_gridServer.GetName() == "Remote") && (!this.m_child)) | ||
55 | { | ||
56 | Hashtable SimParams; | ||
57 | ArrayList SendParams; | ||
58 | XmlRpcRequest GridReq; | ||
59 | XmlRpcResponse GridResp; | ||
60 | List<Packet> enablePackets = new List<Packet>(); | ||
61 | |||
62 | RemoteGridBase gridServer = (RemoteGridBase)this.m_gridServer; | ||
63 | |||
64 | foreach (Hashtable neighbour in gridServer.neighbours) | ||
65 | { | ||
66 | try | ||
67 | { | ||
68 | string neighbourIPStr = (string)neighbour["sim_ip"]; | ||
69 | System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse(neighbourIPStr); | ||
70 | ushort neighbourPort = (ushort)Convert.ToInt32(neighbour["sim_port"]); | ||
71 | string reqUrl = "http://" + neighbourIPStr + ":" + neighbourPort.ToString(); | ||
72 | |||
73 | MainConsole.Instance.Verbose("Requesting " + reqUrl); | ||
74 | |||
75 | SimParams = new Hashtable(); | ||
76 | SimParams["session_id"] = this.SessionID.ToString(); | ||
77 | SimParams["secure_session_id"] = this.SecureSessionID.ToString(); | ||
78 | SimParams["firstname"] = this.ClientAvatar.firstname; | ||
79 | SimParams["lastname"] = this.ClientAvatar.lastname; | ||
80 | SimParams["agent_id"] = this.AgentID.ToString(); | ||
81 | SimParams["circuit_code"] = (Int32)this.CircuitCode; | ||
82 | SimParams["child_agent"] = "1"; | ||
83 | SendParams = new ArrayList(); | ||
84 | SendParams.Add(SimParams); | ||
85 | |||
86 | GridReq = new XmlRpcRequest("expect_user", SendParams); | ||
87 | GridResp = GridReq.Send(reqUrl, 3000); | ||
88 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | ||
89 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | ||
90 | enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256)); | ||
91 | |||
92 | |||
93 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
94 | enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; | ||
95 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; | ||
96 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; | ||
97 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; | ||
98 | enablesimpacket.SimulatorInfo.Port = neighbourPort; | ||
99 | enablePackets.Add(enablesimpacket); | ||
100 | } | ||
101 | catch (Exception e) | ||
102 | { | ||
103 | MainConsole.Instance.Notice("Could not connect to neighbour " + neighbour["sim_ip"] + ":" + neighbour["sim_port"] + ", continuing."); | ||
104 | } | ||
105 | } | ||
106 | Thread.Sleep(3000); | ||
107 | foreach (Packet enable in enablePackets) | ||
108 | { | ||
109 | this.OutPacket(enable); | ||
110 | } | ||
111 | enablePackets.Clear(); | ||
112 | |||
113 | } | ||
114 | } | ||
115 | |||
116 | public void CrossSimBorder(LLVector3 avatarpos) | ||
117 | { // VERY VERY BASIC | ||
118 | |||
119 | LLVector3 newpos = avatarpos; | ||
120 | uint neighbourx = this.m_regionData.RegionLocX; | ||
121 | uint neighboury = this.m_regionData.RegionLocY; | ||
122 | |||
123 | if (avatarpos.X < 0) | ||
124 | { | ||
125 | neighbourx -= 1; | ||
126 | newpos.X = 254; | ||
127 | } | ||
128 | if (avatarpos.X > 255) | ||
129 | { | ||
130 | neighbourx += 1; | ||
131 | newpos.X = 1; | ||
132 | } | ||
133 | if (avatarpos.Y < 0) | ||
134 | { | ||
135 | neighboury -= 1; | ||
136 | newpos.Y = 254; | ||
137 | } | ||
138 | if (avatarpos.Y > 255) | ||
139 | { | ||
140 | neighboury += 1; | ||
141 | newpos.Y = 1; | ||
142 | } | ||
143 | MainConsole.Instance.Notice("SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]"); | ||
144 | |||
145 | Hashtable SimParams; | ||
146 | ArrayList SendParams; | ||
147 | XmlRpcRequest GridReq; | ||
148 | XmlRpcResponse GridResp; | ||
149 | foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours) | ||
150 | { | ||
151 | if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString())) | ||
152 | { | ||
153 | SimParams = new Hashtable(); | ||
154 | SimParams["firstname"] = this.ClientAvatar.firstname; | ||
155 | SimParams["lastname"] = this.ClientAvatar.lastname; | ||
156 | SimParams["circuit_code"] = this.CircuitCode.ToString(); | ||
157 | SimParams["pos_x"] = newpos.X.ToString(); | ||
158 | SimParams["pos_y"] = newpos.Y.ToString(); | ||
159 | SimParams["pos_z"] = newpos.Z.ToString(); | ||
160 | SendParams = new ArrayList(); | ||
161 | SendParams.Add(SimParams); | ||
162 | |||
163 | GridReq = new XmlRpcRequest("agent_crossing", SendParams); | ||
164 | GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000); | ||
165 | |||
166 | CrossedRegionPacket NewSimPack = new CrossedRegionPacket(); | ||
167 | NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); | ||
168 | NewSimPack.AgentData.AgentID = this.AgentID; | ||
169 | NewSimPack.AgentData.SessionID = this.SessionID; | ||
170 | NewSimPack.Info = new CrossedRegionPacket.InfoBlock(); | ||
171 | NewSimPack.Info.Position = newpos; | ||
172 | NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! | ||
173 | NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); | ||
174 | NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256)); | ||
175 | System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]); | ||
176 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
177 | NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; | ||
178 | NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; | ||
179 | NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; | ||
180 | NewSimPack.RegionData.SimIP += (uint)byteIP[0]; | ||
181 | NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]); | ||
182 | NewSimPack.RegionData.SeedCapability = new byte[0]; | ||
183 | lock (PacketQueue) | ||
184 | { | ||
185 | ProcessOutPacket(NewSimPack); | ||
186 | DowngradeClient(); | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | } | ||
191 | } | ||
192 | } | ||