diff options
Diffstat (limited to 'OpenSim.RegionServer/ClientView.Grid.cs')
-rw-r--r-- | OpenSim.RegionServer/ClientView.Grid.cs | 164 |
1 files changed, 0 insertions, 164 deletions
diff --git a/OpenSim.RegionServer/ClientView.Grid.cs b/OpenSim.RegionServer/ClientView.Grid.cs deleted file mode 100644 index 5229dbd..0000000 --- a/OpenSim.RegionServer/ClientView.Grid.cs +++ /dev/null | |||
@@ -1,164 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | using Nwc.XmlRpc; | ||
7 | using System.Net; | ||
8 | using System.Net.Sockets; | ||
9 | using System.IO; | ||
10 | using System.Threading; | ||
11 | using System.Timers; | ||
12 | using OpenSim.Framework.Interfaces; | ||
13 | using OpenSim.Framework.Types; | ||
14 | using OpenSim.Framework.Inventory; | ||
15 | using OpenSim.Framework.Utilities; | ||
16 | using OpenSim.world; | ||
17 | using OpenSim.Assets; | ||
18 | |||
19 | namespace OpenSim | ||
20 | { | ||
21 | public partial class ClientView | ||
22 | { | ||
23 | |||
24 | public void EnableNeighbours() | ||
25 | { | ||
26 | if ((this.m_gridServer.GetName() == "Remote") && (!this.m_child)) | ||
27 | { | ||
28 | Hashtable SimParams; | ||
29 | ArrayList SendParams; | ||
30 | XmlRpcRequest GridReq; | ||
31 | XmlRpcResponse GridResp; | ||
32 | List<Packet> enablePackets = new List<Packet>(); | ||
33 | |||
34 | RemoteGridBase gridServer = (RemoteGridBase)this.m_gridServer; | ||
35 | |||
36 | foreach (Hashtable neighbour in gridServer.neighbours) | ||
37 | { | ||
38 | try | ||
39 | { | ||
40 | string neighbourIPStr = (string)neighbour["sim_ip"]; | ||
41 | System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse(neighbourIPStr); | ||
42 | ushort neighbourPort = (ushort)Convert.ToInt32(neighbour["sim_port"]); | ||
43 | string reqUrl = "http://" + neighbourIPStr + ":" + neighbourPort.ToString(); | ||
44 | |||
45 | Console.WriteLine(reqUrl); | ||
46 | |||
47 | SimParams = new Hashtable(); | ||
48 | SimParams["session_id"] = this.SessionID.ToString(); | ||
49 | SimParams["secure_session_id"] = this.SecureSessionID.ToString(); | ||
50 | SimParams["firstname"] = this.ClientAvatar.firstname; | ||
51 | SimParams["lastname"] = this.ClientAvatar.lastname; | ||
52 | SimParams["agent_id"] = this.AgentID.ToString(); | ||
53 | SimParams["circuit_code"] = (Int32)this.CircuitCode; | ||
54 | SimParams["child_agent"] = "1"; | ||
55 | SendParams = new ArrayList(); | ||
56 | SendParams.Add(SimParams); | ||
57 | |||
58 | GridReq = new XmlRpcRequest("expect_user", SendParams); | ||
59 | GridResp = GridReq.Send(reqUrl, 3000); | ||
60 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | ||
61 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | ||
62 | enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256)); | ||
63 | |||
64 | |||
65 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
66 | enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; | ||
67 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; | ||
68 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; | ||
69 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; | ||
70 | enablesimpacket.SimulatorInfo.Port = neighbourPort; | ||
71 | enablePackets.Add(enablesimpacket); | ||
72 | } | ||
73 | catch (Exception e) | ||
74 | { | ||
75 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Could not connect to neighbour " + neighbour["sim_ip"] + ":" + neighbour["sim_port"] + ", continuing."); | ||
76 | } | ||
77 | } | ||
78 | Thread.Sleep(3000); | ||
79 | foreach (Packet enable in enablePackets) | ||
80 | { | ||
81 | this.OutPacket(enable); | ||
82 | } | ||
83 | enablePackets.Clear(); | ||
84 | |||
85 | } | ||
86 | } | ||
87 | |||
88 | public void CrossSimBorder(LLVector3 avatarpos) | ||
89 | { // VERY VERY BASIC | ||
90 | |||
91 | LLVector3 newpos = avatarpos; | ||
92 | uint neighbourx = this.m_regionData.RegionLocX; | ||
93 | uint neighboury = this.m_regionData.RegionLocY; | ||
94 | |||
95 | if (avatarpos.X < 0) | ||
96 | { | ||
97 | neighbourx -= 1; | ||
98 | newpos.X = 254; | ||
99 | } | ||
100 | if (avatarpos.X > 255) | ||
101 | { | ||
102 | neighbourx += 1; | ||
103 | newpos.X = 1; | ||
104 | } | ||
105 | if (avatarpos.Y < 0) | ||
106 | { | ||
107 | neighboury -= 1; | ||
108 | newpos.Y = 254; | ||
109 | } | ||
110 | if (avatarpos.Y > 255) | ||
111 | { | ||
112 | neighboury += 1; | ||
113 | newpos.Y = 1; | ||
114 | } | ||
115 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]"); | ||
116 | |||
117 | Hashtable SimParams; | ||
118 | ArrayList SendParams; | ||
119 | XmlRpcRequest GridReq; | ||
120 | XmlRpcResponse GridResp; | ||
121 | foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours) | ||
122 | { | ||
123 | if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString())) | ||
124 | { | ||
125 | SimParams = new Hashtable(); | ||
126 | SimParams["firstname"] = this.ClientAvatar.firstname; | ||
127 | SimParams["lastname"] = this.ClientAvatar.lastname; | ||
128 | SimParams["circuit_code"] = this.CircuitCode.ToString(); | ||
129 | SimParams["pos_x"] = newpos.X.ToString(); | ||
130 | SimParams["pos_y"] = newpos.Y.ToString(); | ||
131 | SimParams["pos_z"] = newpos.Z.ToString(); | ||
132 | SendParams = new ArrayList(); | ||
133 | SendParams.Add(SimParams); | ||
134 | |||
135 | GridReq = new XmlRpcRequest("agent_crossing", SendParams); | ||
136 | GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000); | ||
137 | |||
138 | CrossedRegionPacket NewSimPack = new CrossedRegionPacket(); | ||
139 | NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); | ||
140 | NewSimPack.AgentData.AgentID = this.AgentID; | ||
141 | NewSimPack.AgentData.SessionID = this.SessionID; | ||
142 | NewSimPack.Info = new CrossedRegionPacket.InfoBlock(); | ||
143 | NewSimPack.Info.Position = newpos; | ||
144 | NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! | ||
145 | NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); | ||
146 | NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256)); | ||
147 | System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]); | ||
148 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
149 | NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; | ||
150 | NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; | ||
151 | NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; | ||
152 | NewSimPack.RegionData.SimIP += (uint)byteIP[0]; | ||
153 | NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]); | ||
154 | NewSimPack.RegionData.SeedCapability = new byte[0]; | ||
155 | lock (PacketQueue) | ||
156 | { | ||
157 | ProcessOutPacket(NewSimPack); | ||
158 | DowngradeClient(); | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | } | ||
164 | } | ||