private void RegionHandshakeHandler(Packet packet, Simulator simulator) { RegionHandshakePacket handshake = (RegionHandshakePacket)packet; simulator.ID = handshake.RegionInfo.CacheID; simulator.IsEstateManager = handshake.RegionInfo.IsEstateManager; simulator.Name = Helpers.FieldToUTF8String(handshake.RegionInfo.SimName); simulator.SimOwner = handshake.RegionInfo.SimOwner; simulator.TerrainBase0 = handshake.RegionInfo.TerrainBase0; simulator.TerrainBase1 = handshake.RegionInfo.TerrainBase1; simulator.TerrainBase2 = handshake.RegionInfo.TerrainBase2; simulator.TerrainBase3 = handshake.RegionInfo.TerrainBase3; simulator.TerrainDetail0 = handshake.RegionInfo.TerrainDetail0; simulator.TerrainDetail1 = handshake.RegionInfo.TerrainDetail1; simulator.TerrainDetail2 = handshake.RegionInfo.TerrainDetail2; simulator.TerrainDetail3 = handshake.RegionInfo.TerrainDetail3; simulator.TerrainHeightRange00 = handshake.RegionInfo.TerrainHeightRange00; simulator.TerrainHeightRange01 = handshake.RegionInfo.TerrainHeightRange01; simulator.TerrainHeightRange10 = handshake.RegionInfo.TerrainHeightRange10; simulator.TerrainHeightRange11 = handshake.RegionInfo.TerrainHeightRange11; simulator.TerrainStartHeight00 = handshake.RegionInfo.TerrainStartHeight00; simulator.TerrainStartHeight01 = handshake.RegionInfo.TerrainStartHeight01; simulator.TerrainStartHeight10 = handshake.RegionInfo.TerrainStartHeight10; simulator.TerrainStartHeight11 = handshake.RegionInfo.TerrainStartHeight11; simulator.WaterHeight = handshake.RegionInfo.WaterHeight; simulator.Flags = (Simulator.RegionFlags)handshake.RegionInfo.RegionFlags; simulator.BillableFactor = handshake.RegionInfo.BillableFactor; simulator.Access = (Simulator.SimAccess)handshake.RegionInfo.SimAccess; Client.Log("Received a region handshake for " + simulator.ToString(), Helpers.LogLevel.Info); // Send a RegionHandshakeReply RegionHandshakeReplyPacket reply = new RegionHandshakeReplyPacket(); reply.AgentData.AgentID = Client.Self.AgentID; reply.AgentData.SessionID = Client.Self.SessionID; reply.RegionInfo.Flags = 0; SendPacket(reply, simulator); // We're officially connected to this sim simulator.connected = true; simulator.ConnectedEvent.Set(); }
/// <summary>Process an incoming packet and raise the appropriate events</summary> /// <param name="sender">The sender</param> /// <param name="e">The EventArgs object containing the packet data</param> protected void RegionHandshakeHandler(object sender, PacketReceivedEventArgs e) { RegionHandshakePacket handshake = (RegionHandshakePacket)e.Packet; Simulator simulator = e.Simulator; e.Simulator.ID = handshake.RegionInfo.CacheID; simulator.IsEstateManager = handshake.RegionInfo.IsEstateManager; simulator.Name = Utils.BytesToString(handshake.RegionInfo.SimName); simulator.SimOwner = handshake.RegionInfo.SimOwner; simulator.TerrainBase0 = handshake.RegionInfo.TerrainBase0; simulator.TerrainBase1 = handshake.RegionInfo.TerrainBase1; simulator.TerrainBase2 = handshake.RegionInfo.TerrainBase2; simulator.TerrainBase3 = handshake.RegionInfo.TerrainBase3; simulator.TerrainDetail0 = handshake.RegionInfo.TerrainDetail0; simulator.TerrainDetail1 = handshake.RegionInfo.TerrainDetail1; simulator.TerrainDetail2 = handshake.RegionInfo.TerrainDetail2; simulator.TerrainDetail3 = handshake.RegionInfo.TerrainDetail3; simulator.TerrainHeightRange00 = handshake.RegionInfo.TerrainHeightRange00; simulator.TerrainHeightRange01 = handshake.RegionInfo.TerrainHeightRange01; simulator.TerrainHeightRange10 = handshake.RegionInfo.TerrainHeightRange10; simulator.TerrainHeightRange11 = handshake.RegionInfo.TerrainHeightRange11; simulator.TerrainStartHeight00 = handshake.RegionInfo.TerrainStartHeight00; simulator.TerrainStartHeight01 = handshake.RegionInfo.TerrainStartHeight01; simulator.TerrainStartHeight10 = handshake.RegionInfo.TerrainStartHeight10; simulator.TerrainStartHeight11 = handshake.RegionInfo.TerrainStartHeight11; simulator.WaterHeight = handshake.RegionInfo.WaterHeight; simulator.Flags = (RegionFlags)handshake.RegionInfo.RegionFlags; simulator.BillableFactor = handshake.RegionInfo.BillableFactor; simulator.Access = (SimAccess)handshake.RegionInfo.SimAccess; simulator.RegionID = handshake.RegionInfo2.RegionID; simulator.ColoLocation = Utils.BytesToString(handshake.RegionInfo3.ColoName); simulator.CPUClass = handshake.RegionInfo3.CPUClassID; simulator.CPURatio = handshake.RegionInfo3.CPURatio; simulator.ProductName = Utils.BytesToString(handshake.RegionInfo3.ProductName); simulator.ProductSku = Utils.BytesToString(handshake.RegionInfo3.ProductSKU); if (handshake.RegionInfo4 != null && handshake.RegionInfo4.Length > 0) { simulator.Protocols = (RegionProtocols)handshake.RegionInfo4[0].RegionProtocols; // Yes, overwrite region flags if we have extended version of them simulator.Flags = (RegionFlags)handshake.RegionInfo4[0].RegionFlagsExtended; } // Send a RegionHandshakeReply RegionHandshakeReplyPacket reply = new RegionHandshakeReplyPacket(); reply.AgentData.AgentID = Client.Self.AgentID; reply.AgentData.SessionID = Client.Self.SessionID; reply.RegionInfo.Flags = (uint)RegionProtocols.SelfAppearanceSupport; SendPacket(reply, simulator); // We're officially connected to this sim simulator.connected = true; simulator.handshakeComplete = true; simulator.ConnectedEvent.Set(); }
private void RegionHandshakeHandler(Packet packet, Simulator simulator) { // Send a RegionHandshakeReply RegionHandshakeReplyPacket reply = new RegionHandshakeReplyPacket(); reply.AgentData.AgentID = AgentID; reply.AgentData.SessionID = SessionID; reply.RegionInfo.Flags = 0; SendPacket(reply, simulator); // TODO: Do we need to send an AgentUpdate to each sim upon connection? RegionHandshakePacket handshake = (RegionHandshakePacket)packet; simulator.Region.ID = handshake.RegionInfo.CacheID; // FIXME: //handshake.RegionInfo.BillableFactor; //handshake.RegionInfo.RegionFlags; //handshake.RegionInfo.SimAccess; simulator.Region.IsEstateManager = handshake.RegionInfo.IsEstateManager; simulator.Region.Name = Helpers.FieldToString(handshake.RegionInfo.SimName); simulator.Region.SimOwner = handshake.RegionInfo.SimOwner; simulator.Region.TerrainBase0 = handshake.RegionInfo.TerrainBase0; simulator.Region.TerrainBase1 = handshake.RegionInfo.TerrainBase1; simulator.Region.TerrainBase2 = handshake.RegionInfo.TerrainBase2; simulator.Region.TerrainBase3 = handshake.RegionInfo.TerrainBase3; simulator.Region.TerrainDetail0 = handshake.RegionInfo.TerrainDetail0; simulator.Region.TerrainDetail1 = handshake.RegionInfo.TerrainDetail1; simulator.Region.TerrainDetail2 = handshake.RegionInfo.TerrainDetail2; simulator.Region.TerrainDetail3 = handshake.RegionInfo.TerrainDetail3; simulator.Region.TerrainHeightRange00 = handshake.RegionInfo.TerrainHeightRange00; simulator.Region.TerrainHeightRange01 = handshake.RegionInfo.TerrainHeightRange01; simulator.Region.TerrainHeightRange10 = handshake.RegionInfo.TerrainHeightRange10; simulator.Region.TerrainHeightRange11 = handshake.RegionInfo.TerrainHeightRange11; simulator.Region.TerrainStartHeight00 = handshake.RegionInfo.TerrainStartHeight00; simulator.Region.TerrainStartHeight01 = handshake.RegionInfo.TerrainStartHeight01; simulator.Region.TerrainStartHeight10 = handshake.RegionInfo.TerrainStartHeight10; simulator.Region.TerrainStartHeight11 = handshake.RegionInfo.TerrainStartHeight11; simulator.Region.WaterHeight = handshake.RegionInfo.WaterHeight; Client.Log("Received a region handshake for " + simulator.Region.Name, Helpers.LogLevel.Info); }
/// <summary>Process an incoming packet and raise the appropriate events</summary> /// <param name="sender">The sender</param> /// <param name="e">The EventArgs object containing the packet data</param> protected void RegionHandshakeHandler(object sender, PacketReceivedEventArgs e) { RegionHandshakePacket handshake = (RegionHandshakePacket)e.Packet; Simulator simulator = e.Simulator; e.Simulator.ID = handshake.RegionInfo.CacheID; simulator.IsEstateManager = handshake.RegionInfo.IsEstateManager; simulator.Name = Utils.BytesToString(handshake.RegionInfo.SimName); simulator.SimOwner = handshake.RegionInfo.SimOwner; simulator.TerrainBase0 = handshake.RegionInfo.TerrainBase0; simulator.TerrainBase1 = handshake.RegionInfo.TerrainBase1; simulator.TerrainBase2 = handshake.RegionInfo.TerrainBase2; simulator.TerrainBase3 = handshake.RegionInfo.TerrainBase3; simulator.TerrainDetail0 = handshake.RegionInfo.TerrainDetail0; simulator.TerrainDetail1 = handshake.RegionInfo.TerrainDetail1; simulator.TerrainDetail2 = handshake.RegionInfo.TerrainDetail2; simulator.TerrainDetail3 = handshake.RegionInfo.TerrainDetail3; simulator.TerrainHeightRange00 = handshake.RegionInfo.TerrainHeightRange00; simulator.TerrainHeightRange01 = handshake.RegionInfo.TerrainHeightRange01; simulator.TerrainHeightRange10 = handshake.RegionInfo.TerrainHeightRange10; simulator.TerrainHeightRange11 = handshake.RegionInfo.TerrainHeightRange11; simulator.TerrainStartHeight00 = handshake.RegionInfo.TerrainStartHeight00; simulator.TerrainStartHeight01 = handshake.RegionInfo.TerrainStartHeight01; simulator.TerrainStartHeight10 = handshake.RegionInfo.TerrainStartHeight10; simulator.TerrainStartHeight11 = handshake.RegionInfo.TerrainStartHeight11; simulator.WaterHeight = handshake.RegionInfo.WaterHeight; simulator.Flags = (RegionFlags)handshake.RegionInfo.RegionFlags; simulator.BillableFactor = handshake.RegionInfo.BillableFactor; simulator.Access = (SimAccess)handshake.RegionInfo.SimAccess; simulator.RegionID = handshake.RegionInfo2.RegionID; simulator.ColoLocation = Utils.BytesToString(handshake.RegionInfo3.ColoName); simulator.CPUClass = handshake.RegionInfo3.CPUClassID; simulator.CPURatio = handshake.RegionInfo3.CPURatio; simulator.ProductName = Utils.BytesToString(handshake.RegionInfo3.ProductName); simulator.ProductSku = Utils.BytesToString(handshake.RegionInfo3.ProductSKU); // Send a RegionHandshakeReply RegionHandshakeReplyPacket reply = new RegionHandshakeReplyPacket(); reply.AgentData.AgentID = Client.Self.AgentID; reply.AgentData.SessionID = Client.Self.SessionID; reply.RegionInfo.Flags = 0; SendPacket(reply, simulator); // We're officially connected to this sim simulator.connected = true; simulator.ConnectedEvent.Set(); }