aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs
blob: 33996d04c41583ed28fcb2d288dc2417f643e073 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Text;

using OpenSim.Framework.Types;
using OpenSim.RegionServer.Simulator;
using OpenSim.RegionServer.Client;

using libsecondlife;
using libsecondlife.Packets;

namespace OpenSim.RegionServer.Estate
{

    /// <summary>
    /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings
    /// </summary>
    public class EstateManager
    {
        private World m_world;

        public EstateManager(World world)
        {
            m_world = world; //Estate settings found at world.m_regInfo.estateSettings            
        }

        public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, ClientView remote_client)
        {
            if (remote_client.AgentID == m_world.m_regInfo.MasterAvatarAssignedUUID)
            {
                switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
                {
                    case "getinfo":
                        Console.WriteLine("GETINFO Requested");
                        RegionInfoPacket regionInfoPacket = new RegionInfoPacket();
                        regionInfoPacket.AgentData.AgentID = remote_client.AgentID;
                        regionInfoPacket.AgentData.SessionID = remote_client.SessionID;
                        regionInfoPacket.RegionInfo.BillableFactor = m_world.m_regInfo.estateSettings.billableFactor;
                        regionInfoPacket.RegionInfo.EstateID = m_world.m_regInfo.estateSettings.estateID;
                        regionInfoPacket.RegionInfo.MaxAgents = m_world.m_regInfo.estateSettings.maxAgents;
                        regionInfoPacket.RegionInfo.ObjectBonusFactor = m_world.m_regInfo.estateSettings.objectBonusFactor;
                        regionInfoPacket.RegionInfo.ParentEstateID = m_world.m_regInfo.estateSettings.parentEstateID;
                        regionInfoPacket.RegionInfo.PricePerMeter = m_world.m_regInfo.estateSettings.pricePerMeter;
                        regionInfoPacket.RegionInfo.RedirectGridX = m_world.m_regInfo.estateSettings.redirectGridX;
                        regionInfoPacket.RegionInfo.RedirectGridY = m_world.m_regInfo.estateSettings.redirectGridY;
                        regionInfoPacket.RegionInfo.RegionFlags = m_world.m_regInfo.estateSettings.regionFlags;
                        regionInfoPacket.RegionInfo.SimAccess = m_world.m_regInfo.estateSettings.simAccess;
                        regionInfoPacket.RegionInfo.SimName = Helpers.StringToField(m_world.m_regInfo.RegionName);
                        regionInfoPacket.RegionInfo.SunHour = m_world.m_regInfo.estateSettings.sunHour;
                        regionInfoPacket.RegionInfo.TerrainLowerLimit = m_world.m_regInfo.estateSettings.terrainLowerLimit;
                        regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_world.m_regInfo.estateSettings.terrainRaiseLimit;
                        regionInfoPacket.RegionInfo.UseEstateSun = m_world.m_regInfo.estateSettings.useEstateSun;
                        regionInfoPacket.RegionInfo.WaterHeight = m_world.m_regInfo.estateSettings.waterHeight;

                        remote_client.OutPacket(regionInfoPacket);
                        break;
                    default:
                        OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
                        break;
                }
            }
        }
    }
}