Inheritance: MonoBehaviour
        /// <summary>
        /// This also updates the parcel, not for just adding a new one
        /// </summary>
        /// <param name="args"></param>
        /// <param name="regionID"></param>
        /// <param name="forSale"></param>
        /// <param name="EstateID"></param>
        /// <param name="showInSearch"></param>
        public void AddLandObject(LandData args)
        {
            //Check whether this region is just spamming add to search and stop them if they are
            if (timeBeforeNextUpdate.ContainsKey(args.InfoUUID) &&
                Util.UnixTimeSinceEpoch() < timeBeforeNextUpdate[args.InfoUUID])
                return; //Too soon to update

            //Update the time with now + the time to wait for the next update
            timeBeforeNextUpdate[args.InfoUUID] = Util.UnixTimeSinceEpoch() + (60 * minTimeBeforeNextParcelUpdate);
            
            List<object> Values = new List<object>();
            Values.Add(args.RegionID);
            Values.Add(args.GlobalID);
            Values.Add(args.LocalID);
            Values.Add(args.UserLocation.X);
            Values.Add(args.UserLocation.Y);
            Values.Add(args.UserLocation.Z);
            Values.Add(args.Name);
            Values.Add(args.Description);
            Values.Add(args.Flags);
            Values.Add(args.Dwell);
            //InfoUUID is the missing 'real' Gridwide ParcelID
            Values.Add(args.InfoUUID);
            Values.Add(((args.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale) ? 1 : 0);
            Values.Add(args.SalePrice);
            Values.Add(args.AuctionID);
            Values.Add(args.Area);
            Values.Add(0);
            Values.Add(args.Maturity);
            Values.Add(args.OwnerID);
            Values.Add(args.GroupID);
            Values.Add(((args.Flags & (uint)ParcelFlags.ShowDirectory) == (uint)ParcelFlags.ShowDirectory) ? 1 : 0);
            Values.Add(args.SnapshotID);

            List<string> Keys = new List<string>();
            Keys.Add("RegionID");
            Keys.Add("ParcelID");
            Keys.Add("LocalID");
            Keys.Add("LandingX");
            Keys.Add("LandingY");
            Keys.Add("LandingZ");
            Keys.Add("Name");
            Keys.Add("Description");
            Keys.Add("Flags");
            Keys.Add("Dwell");
            Keys.Add("InfoUUID");
            Keys.Add("ForSale");
            Keys.Add("SalePrice");
            Keys.Add("Auction");
            Keys.Add("Area");
            Keys.Add("EstateID");
            Keys.Add("Maturity");
            Keys.Add("OwnerID");
            Keys.Add("GroupID");
            Keys.Add("ShowInSearch");
            Keys.Add("SnapshotID");

            GD.Replace("searchparcel", Keys.ToArray(), Values.ToArray());
        }
 /// <summary>
 /// This also updates the parcel, not for just adding a new one
 /// </summary>
 /// <param name="args"></param>
 /// <param name="regionID"></param>
 /// <param name="forSale"></param>
 /// <param name="EstateID"></param>
 /// <param name="showInSearch"></param>
 public void AddLandObject(LandData args)
 {
     OSDMap mess = args.ToOSD ();
     mess["Method"] = "addlandobject";
     List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI");
     foreach (string m_ServerURI in m_ServerURIs)
     {
         WebUtils.PostToService (m_ServerURI + "osd", mess, false, false);
     }
 }
        /// <summary>
        /// This also updates the parcel, not for just adding a new one
        /// </summary>
        /// <param name="args"></param>
        /// <param name="regionID"></param>
        /// <param name="forSale"></param>
        /// <param name="EstateID"></param>
        /// <param name="showInSearch"></param>
        public void AddLandObject(LandData args)
        {
            Dictionary<string, object> sendData = args.ToKeyValuePairs();

            sendData["METHOD"] = "addlandobject";

            string reqString = ServerUtils.BuildXmlResponse(sendData);

            try
            {
                SynchronousRestFormsRequester.MakeRequest("POST",
                        m_ServerURI + "/auroradata",
                        reqString);
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e.Message);
            }
        }
Example #4
0
        private static bool ValidateSpawnPoint(Map map, int x, int y, int z)
        {
            LandTile lt = map.Tiles.GetLandTile(x, y);
            LandData ld = TileData.LandTable[lt.ID];

            if (lt.Ignored || (ld.Flags & TileFlag.Impassable) > 0 || (ld.Flags & TileFlag.Wet) > 0 || (ld.Flags & TileFlag.Roof) > 0)
            {
                return(false);
            }

            for (int i = 0; i < HousePlacement.RoadIDs.Length; i += 2)
            {
                if (lt.ID >= HousePlacement.RoadIDs[i] && lt.ID <= HousePlacement.RoadIDs[i + 1])
                {
                    return(false);
                }
            }

            Point3D p = new Point3D(x, y, lt.Z);

            Region reg = Region.Find(p, map);

            //no-go in towns, houses, dungeons and champspawns
            if (reg != null && (reg.IsPartOf <TownRegion>() || reg.IsPartOf <DungeonRegion>() || reg.IsPartOf <ChampionSpawnRegion>() || reg.IsPartOf <HouseRegion>()))
            {
                return(false);
            }

            //check for house within 5 tiles
            for (p.X = x - 5; p.X <= x + 5; p.X++)
            {
                for (p.Y = y - 5; p.Y <= y + 5; p.Y++)
                {
                    if (BaseHouse.FindHouseAt(p, map, Region.MaxZ - p.Z) != null)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
        public void setup()
        {
            // setup LandData object
            this.land                = new LandData();
            this.land.AABBMax        = new Vector3(1, 2, 3);
            this.land.AABBMin        = new Vector3(129, 130, 131);
            this.land.Area           = 128;
            this.land.AuctionID      = 4;
            this.land.AuthBuyerID    = new UUID("7176df0c-6c50-45db-8a37-5e78be56a0cd");
            this.land.Category       = ParcelCategory.Residential;
            this.land.ClaimDate      = 1;
            this.land.ClaimPrice     = 2;
            this.land.GlobalID       = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50");
            this.land.GroupID        = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5");
            this.land.Description    = "land data to test LandDataSerializer";
            this.land.Flags          = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat);
            this.land.LandingType    = (byte)LandingType.Direct;
            this.land.Name           = "LandDataSerializerTest Land";
            this.land.Status         = ParcelStatus.Leased;
            this.land.LocalID        = 1;
            this.land.MediaAutoScale = (byte)0x01;
            this.land.MediaID        = new UUID("d4452578-2f25-4b97-a81b-819af559cfd7");
            this.land.MediaURL       = "http://videos.opensimulator.org/bumblebee.mp4";
            this.land.OwnerID        = new UUID("1b8eedf9-6d15-448b-8015-24286f1756bf");

            this.landWithParcelAccessList = this.land.Copy();
            this.landWithParcelAccessList.ParcelAccessList.Clear();

            LandAccessEntry pae0 = new LandAccessEntry();

            pae0.AgentID = new UUID("62d65d45-c91a-4f77-862c-46557d978b6c");
            pae0.Flags   = AccessList.Ban;
            pae0.Expires = 0;
            this.landWithParcelAccessList.ParcelAccessList.Add(pae0);

            LandAccessEntry pae1 = new LandAccessEntry();

            pae1.AgentID = new UUID("ec2a8d18-2378-4fe0-8b68-2a31b57c481e");
            pae1.Flags   = AccessList.Access;
            pae1.Expires = 0;
            this.landWithParcelAccessList.ParcelAccessList.Add(pae1);
        }
Example #6
0
        /// <summary>
        ///   Save this parcel's access list
        /// </summary>
        /// <param name = "data"></param>
        private void SaveParcelAccessList(LandData data)
        {
            //Clear out all old parcel bans and access list entries
            QueryFilter filter = new QueryFilter();

            filter.andFilters["ParcelID"] = data.GlobalID;
            GD.Delete("parcelaccess", filter);
            Dictionary <string, object> row;

            foreach (ParcelManager.ParcelAccessEntry entry in data.ParcelAccessList)
            {
                row             = new Dictionary <string, object>(4);
                row["ParcelID"] = data.GlobalID;
                row["AccessID"] = entry.AgentID;
                row["Flags"]    = entry.Flags;
                row["Time"]     = entry.Time.Ticks;
                //Replace all the old ones
                GD.Replace("parcelaccess", row);
            }
        }
Example #7
0
        public static void ProcessParcelAccessList(LandData ld, XmlReader xtr)
        {
            if (!xtr.IsEmptyElement)
            {
                while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
                {
                    LandAccessEntry lae = new LandAccessEntry();

                    xtr.ReadStartElement("ParcelAccessEntry");

                    ExternalRepresentationUtils.ExecuteReadProcessors <LandAccessEntry>(lae, m_laeProcessors, xtr);

                    xtr.ReadEndElement();

                    ld.ParcelAccessList.Add(lae);
                }
            }

            xtr.Read();
        }
 private void SaveParcelAccessList(LandData data)
 {
     foreach (ParcelManager.ParcelAccessEntry entry in data.ParcelAccessList)
     {
         GD.Replace("parcelaccess", new string[]
         {
             "ParcelID",
             "AccessID",
             "Flags",
             "Time"
         }
         ,
         new object[]
         {
             data.GlobalID,
             entry.AgentID,
             entry.Flags,
             entry.Time.Ticks
         });
     }
 }
        /// <summary>
        ///   Rebuild the access list from the database
        /// </summary>
        /// <param name = "LandData"></param>
        private void BuildParcelAccessList(LandData LandData)
        {
            QueryFilter filter = new QueryFilter();

            filter.andFilters["ParcelID"] = LandData.GlobalID;
            List <string> Query = GD.Query(new string[3] {
                "AccessID",
                "Flags",
                "Time"
            }, "parcelaccess", filter, null, null, null);

            ParcelManager.ParcelAccessEntry entry;
            for (int i = 0; i < Query.Count; i += 3)
            {
                entry         = new ParcelManager.ParcelAccessEntry();
                entry.AgentID = UUID.Parse(Query[i]);
                entry.Flags   = (AccessList)Enum.Parse(typeof(AccessList), Query[i + 1]);
                entry.Time    = new DateTime(long.Parse(Query[i + 2]));
                LandData.ParcelAccessList.Add(entry);
            }
        }
Example #10
0
        public LandData GetParcelInfo(UUID InfoUUID)
        {
            OSDMap mess = new OSDMap();

            mess["Method"]   = "getparcelinfo";
            mess["InfoUUID"] = InfoUUID;
            List <string> m_ServerURIs =
                m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI");

            foreach (string m_ServerURI in m_ServerURIs)
            {
                OSDMap results      = WebUtils.PostToService(m_ServerURI + "osd", mess, true, false);
                OSDMap innerResults = (OSDMap)OSDParser.DeserializeJson(results["_RawResult"]);
                if (innerResults["Success"])
                {
                    LandData result = new LandData(innerResults);
                    return(result);
                }
            }
            return(null);
        }
Example #11
0
        private void OnClickApplyFilterLand(object sender, EventArgs e)
        {
            LandData land = new LandData();
            string   name = textBoxNameLand.Text;

            if (name.Length > 20)
            {
                name = name.Substring(0, 20);
            }
            land.Name = name;
            short shortres;

            if (short.TryParse(textBoxTexID.Text, out shortres))
            {
                land.TextureID = shortres;
            }
            land.Flags = TileFlag.None;
            if (checkedListBox2.GetItemChecked(0))
            {
                land.Flags |= TileFlag.Damaging;
            }
            if (checkedListBox2.GetItemChecked(1))
            {
                land.Flags |= TileFlag.Wet;
            }
            if (checkedListBox2.GetItemChecked(2))
            {
                land.Flags |= TileFlag.Impassable;
            }
            if (checkedListBox2.GetItemChecked(3))
            {
                land.Flags |= TileFlag.Wall;
            }
            if (checkedListBox2.GetItemChecked(4))
            {
                land.Flags |= TileFlag.Unknown3;
            }

            TileDatas.ApplyFilterLand(land);
        }
Example #12
0
    public override ECommandResult Execute()
    {
        foreach (var data in DataList)
        {
            if (data.BuildType == (int)EZooObjectType.Shop)
            {
                var shopData = new ShopData();
                shopData.Name         = GameEntry.DataTable.GetDataTableRow <DRShop>(data.BuildId).Name;
                shopData.LeftBottom   = data.Rect.position;
                shopData.Price        = 1;
                shopData.TodayIncome  = 2;
                shopData.TodayVisitor = 3;
                shopData.Id           = data.BuildId;
                shopData.Rotation     = data.Rotate;
                GameEntry.Database.Shop.AddShop(shopData);
            }
            else if (data.BuildType == (int)EZooObjectType.Facility)
            {
                var facilityData = new FacilityData();
                facilityData.Id         = data.BuildId;
                facilityData.LeftBottom = data.Rect.position;
                facilityData.Rotation   = data.Rotate;
                GameEntry.Database.Facility.AddFacility(facilityData);
            }
            else if (data.BuildType == (int)EZooObjectType.Land)
            {
                var landData = new LandData();
                landData.Id         = data.BuildId;
                landData.LeftBottom = data.Rect.position;
                landData.Rotation   = data.Rotate;
                GameEntry.Database.Land.AddLand(landData);
            }
        }

        foreach (var data in FenceAreaList)
        {
            GameEntry.Database.FenceArea.AddFenceArea(data);
        }
        return(ECommandResult.Success);
    }
        /// <summary>
        /// Gets all parcels owned by the given user
        /// </summary>
        /// <param name="OwnerID"></param>
        /// <returns></returns>
        public LandData[] GetParcelByOwner(UUID OwnerID)
        {
            List <LandData> Lands = new List <LandData>();
            //NOTE: this does check for group deeded land as well, so this can check for that as well
            List <string> Query = GD.Query("OwnerID", OwnerID, "searchparcel", "*");

            //Return if no values
            if (Query.Count == 0)
            {
                return(Lands.ToArray());
            }

            LandData LandData = new LandData();

            //Add all the parcels belonging to the owner to the list
            for (int i = 0; i < Query.Count; i += 22)
            {
                LandData.RegionID     = UUID.Parse(Query[i]);
                LandData.GlobalID     = UUID.Parse(Query[i + 1]);
                LandData.LocalID      = int.Parse(Query[i + 2]);
                LandData.UserLocation = new Vector3(float.Parse(Query[i + 3]), float.Parse(Query[i + 4]), float.Parse(Query[i + 5]));
                LandData.Name         = Query[i + 6];
                LandData.Description  = Query[i + 7];
                LandData.Flags        = uint.Parse(Query[i + 8]);
                LandData.Dwell        = int.Parse(Query[i + 9]);
                LandData.InfoUUID     = UUID.Parse(Query[i + 10]);
                LandData.AuctionID    = uint.Parse(Query[i + 13]);
                LandData.Area         = int.Parse(Query[i + 14]);
                LandData.Maturity     = int.Parse(Query[i + 16]);
                LandData.OwnerID      = UUID.Parse(Query[i + 17]);
                LandData.GroupID      = UUID.Parse(Query[i + 18]);
                LandData.SnapshotID   = UUID.Parse(Query[i + 20]);
                LandData.Bitmap       = OSDParser.DeserializeLLSDXml(Query[i + 21]);

                Lands.Add(LandData);
                LandData = new LandData();
            }
            return(Lands.ToArray());
        }
        public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
        {
            regionAccess = 2;
//            m_log.DebugFormat("[LAND CONNECTOR]: request for land data in {0} at {1}, {2}",
//                  regionHandle, x, y);

            uint rx = 0, ry = 0;

            Util.RegionHandleToWorldLoc(regionHandle, out rx, out ry);

            foreach (Scene s in m_Scenes)
            {
                uint t = s.RegionInfo.WorldLocX;
                if (rx < t)
                {
                    continue;
                }
                t += s.RegionInfo.RegionSizeX;
                if (rx >= t)
                {
                    continue;
                }
                t = s.RegionInfo.WorldLocY;
                if (ry < t)
                {
                    continue;
                }
                t += s.RegionInfo.RegionSizeY;
                if (ry < t)
                {
                    LandData land = s.GetLandData(x, y);
                    regionAccess = s.RegionInfo.AccessLevel;
                    return(land);
                }
            }

            m_log.Debug("[LAND CONNECTOR]: didn't find land data locally.");
            return(null);
        }
 public OSDMap GetParcelDetails(UUID agentId)
 {
     try
     {
         ICapsService       capsService = m_registry.RequestModuleInterface <ICapsService>();
         IClientCapsService client      = capsService.GetClientCapsService(agentId);
         if (client != null)
         {
             IRegionClientCapsService regionClient = client.GetRootCapsService();
             if (regionClient != null)
             {
                 LandData land = regionPostHandler.ParcelDetailsRegionPostHandler(regionClient.Region, client.AgentID);
                 return(land.ToOSD());
             }
         }
     }
     catch (Exception e)
     {
         MainConsole.Instance.ErrorFormat("[CURRENCY CONNECTOR] UserCurrencyUpdate to m_ServerURI: {0}", e.ToString());
     }
     return(null);
 }
Example #16
0
        public void updateAccessList(uint flags, List <ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
        {
            LandData newData = landData.Copy();

            if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
            {
                entries.Clear();
            }

            List <ParcelManager.ParcelAccessEntry> toRemove = new List <ParcelManager.ParcelAccessEntry>();

            foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
            {
                if (entry.Flags == (AccessList)flags)
                {
                    toRemove.Add(entry);
                }
            }

            foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
            {
                newData.ParcelAccessList.Remove(entry);
            }
            foreach (ParcelManager.ParcelAccessEntry entry in entries)
            {
                ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry();
                temp.AgentID = entry.AgentID;
                temp.Time    = new DateTime(); //Pointless? Yes.
                temp.Flags   = (AccessList)flags;

                if (!newData.ParcelAccessList.Contains(temp))
                {
                    newData.ParcelAccessList.Add(temp);
                }
            }

            m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData);
        }
Example #17
0
        public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
        {
            if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this))
            {
                //Needs later group support
                bool     snap_selection = false;
                LandData newData        = LandData.Copy();

                if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice)
                {
                    if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this))
                    {
                        newData.AuthBuyerID = args.AuthBuyerID;
                        newData.SalePrice   = args.SalePrice;
                        snap_selection      = true;
                    }
                }
                newData.Category       = args.Category;
                newData.Description    = args.Desc;
                newData.GroupID        = args.GroupID;
                newData.LandingType    = args.LandingType;
                newData.MediaAutoScale = args.MediaAutoScale;
                newData.MediaID        = args.MediaID;
                newData.MediaURL       = args.MediaURL;
                newData.MusicURL       = args.MusicURL;
                newData.Name           = args.Name;
                newData.Flags          = args.ParcelFlags;
                newData.PassHours      = args.PassHours;
                newData.PassPrice      = args.PassPrice;
                newData.SnapshotID     = args.SnapshotID;
                newData.UserLocation   = args.UserLocation;
                newData.UserLookAt     = args.UserLookAt;

                m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);

                SendLandUpdateToAvatarsOverMe(snap_selection);
            }
        }
        // NOTE: This method MUST be called while holding the taint lock!
        private void Recount()
        {
//            m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName);

            m_OwnerMap.Clear();
            m_SimwideCounts.Clear();
            m_ParcelCounts.Clear();

            List <ILandObject> land = m_Scene.LandChannel.AllParcels();

            foreach (ILandObject l in land)
            {
                LandData landData = l.LandData;

                m_OwnerMap[landData.GlobalID]     = landData.OwnerID;
                m_SimwideCounts[landData.OwnerID] = 0;
//                m_log.DebugFormat(
//                    "[PRIM COUNT MODULE]: Initializing parcel count for {0} on {1}",
//                    landData.Name, m_Scene.RegionInfo.RegionName);
                m_ParcelCounts[landData.GlobalID] = new ParcelCounts();
            }

            m_Scene.ForEachSOG(AddObject);

            lock (m_PrimCounts)
            {
                List <UUID> primcountKeys = new List <UUID>(m_PrimCounts.Keys);
                foreach (UUID k in primcountKeys)
                {
                    if (!m_OwnerMap.ContainsKey(k))
                    {
                        m_PrimCounts.Remove(k);
                    }
                }
            }

            m_Tainted = false;
        }
        private static List <LandData> Query2LandData(List <string> Query)
        {
            List <LandData> Lands = new List <LandData>();

            LandData LandData;

            for (int i = 0; i < Query.Count; i += 23)
            {
                LandData              = new LandData();
                LandData.RegionID     = UUID.Parse(Query[i]);
                LandData.GlobalID     = UUID.Parse(Query[i + 1]);
                LandData.LocalID      = int.Parse(Query[i + 2]);
                LandData.UserLocation = new Vector3(float.Parse(Query[i + 3]), float.Parse(Query[i + 4]),
                                                    float.Parse(Query[i + 5]));
                LandData.Name        = Query[i + 6];
                LandData.Description = Query[i + 7];
                LandData.Flags       = uint.Parse(Query[i + 8]);
                LandData.Dwell       = int.Parse(Query[i + 9]);
                LandData.InfoUUID    = UUID.Parse(Query[i + 10]);
                LandData.AuctionID   = uint.Parse(Query[i + 13]);
                LandData.Area        = int.Parse(Query[i + 14]);
                LandData.Maturity    = int.Parse(Query[i + 16]);
                LandData.OwnerID     = UUID.Parse(Query[i + 17]);
                LandData.GroupID     = UUID.Parse(Query[i + 18]);
                LandData.SnapshotID  = UUID.Parse(Query[i + 20]);
                try
                {
                    LandData.Bitmap = OSDParser.DeserializeLLSDXml(Query[i + 21]);
                }
                catch
                {
                }
                LandData.Category = (Query[i + 22] == string.Empty) ? ParcelCategory.None : (ParcelCategory)int.Parse(Query[i + 22]);

                Lands.Add(LandData);
            }
            return(Lands);
        }
Example #20
0
    void CreatePlant()
    {
        List <HomePosInfo>   posList = GetPosListByModuleID(landID);
        HomeLandViewDatabase db      = GameTableManager.Instance.GetTableItem <HomeLandViewDatabase>(landID);

        if (db != null)
        {
            for (int i = 0; i < posList.Count; i++)
            {
                HomePosInfo plant = posList[i];
                if (i < landList.Count)
                {
                    LandData ld = landList[i];
                    ShowSoilModel(plant, ld);
                    ShowPlantModel(plant, ld);
                }
                else
                {
                    ShowSoilModel(plant, null);
                }
            }
        }
    }
Example #21
0
        /// <summary>
        /// This also updates the parcel, not for just adding a new one
        /// </summary>
        /// <param name="args"></param>
        /// <param name="regionID"></param>
        /// <param name="forSale"></param>
        /// <param name="EstateID"></param>
        /// <param name="showInSearch"></param>
        public void AddLandObject(LandData args)
        {
            Dictionary <string, object> sendData = args.ToKeyValuePairs();

            sendData["METHOD"] = "addlandobject";

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    AsynchronousRestObjectRequester.MakeRequest("POST",
                                                                m_ServerURI,
                                                                reqString);
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e.ToString());
            }
        }
Example #22
0
        public void BuyLand(BasePlayer player, int id)
        {
            LandData data = GetLand(id);

            if (data == null)
            {
                Send(player, GetMessage("WrongID"));  return;
            }
            if (data.OwnerID == player.userID)
            {
                Send(player, GetMessage("CantBuyYourLand")); return;
            }
            if (data.OwnerID != 0)
            {
                Send(player, GetMessage("HasOwner")); return;
            }

            if (TakeMoney(player, data.price))
            {
                GiveLand(player, id);
                Send(player, GetMessage("LandBought"), data.id);
            }
        }
Example #23
0
        public LandData ParcelDetailsRegionPostHandler(Aurora.Framework.Services.GridRegion region, UUID agentid)
        {
            OSDMap map = new OSDMap();

            map["AgentID"] = agentid;
            bool   complete = false;
            OSDMap result   = null;

            m_syncMessagePosterService.Get(region.ServerURI, map, (r) => { result = r; complete = true; });
            while (!complete)
            {
                Thread.Sleep(50);
            }

            if (result == null || result.Type != OSDType.Map)
            {
                return(null);
            }
            LandData data = new LandData();

            data.FromOSD((OSDMap)result);
            return(data);
        }
        /// <summary>
        /// This also updates the parcel, not for just adding a new one
        /// </summary>
        /// <param name="args"></param>
        /// <param name="regionID"></param>
        /// <param name="forSale"></param>
        /// <param name="EstateID"></param>
        /// <param name="showInSearch"></param>
        public void AddLandObject(LandData args)
        {
            Dictionary<string, object> sendData = args.ToKeyValuePairs();

            sendData["METHOD"] = "addlandobject";

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    AsynchronousRestObjectRequester.MakeRequest("POST",
                           m_ServerURI,
                           reqString);
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e.ToString());
            }
        }
 private void BuildParcelAccessList(LandData LandData)
 {
     List<string> Query = GD.Query("ParcelID", LandData.GlobalID, "parcelaccess", "AccessID, Flags, Time");
     int i = 0;
     int dataCount = 0;
     ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
     foreach (string retVal in Query)
     {
         if (dataCount == 0)
             entry.AgentID = UUID.Parse(Query[i]);
         if (dataCount == 1)
             entry.Flags = (AccessList)int.Parse(Query[i]);
         if (dataCount == 2)
             entry.Time = new DateTime(long.Parse(Query[i]));
         dataCount++;
         i++;
         if (dataCount == 3)
         {
             LandData.ParcelAccessList.Add(entry);
             entry = new ParcelManager.ParcelAccessEntry();
             dataCount = 0;
         }
     }
 }
Example #26
0
    void ShowSoilModel(HomePosInfo plant, LandData ld)
    {
        LandState st = LandState.LockCanBuy;

        if (ld != null)
        {
            if (ld.farm_id == plant.index)
            {
                st = LandState.Idle;
                if (ld.land_state == 0 && ld.plant_begin != 0)
                {
                    if (ld.remain_time == 0)
                    {
                        st = LandState.CanGain;
                    }
                    if (ld.remain_time != 0)
                    {
                        st = LandState.Growing;
                    }
                }
            }
        }
        AddSoilModel(plant, st);
    }
Example #27
0
        public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
        {
            m_scene = scene;
            if (m_scene == null)
            {
                LandBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit];
            }
            else
            {
                LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
            }

            LandData         = new LandData();
            LandData.OwnerID = owner_id;
            if (is_group_owned)
            {
                LandData.GroupID = owner_id;
            }
            else
            {
                LandData.GroupID = UUID.Zero;
            }
            LandData.IsGroupOwned = is_group_owned;
        }
 /// <summary>
 /// Save this parcel's access list 
 /// </summary>
 /// <param name="data"></param>
 private void SaveParcelAccessList(LandData data)
 {
     //Clear out all old parcel bans and access list entries
     GD.Delete("parcelaccess", new string[] { "ParcelID" }, new object[] { data.GlobalID });
     foreach (ParcelManager.ParcelAccessEntry entry in data.ParcelAccessList)
     {
         //Replace all the old ones
         GD.Replace("parcelaccess", new string[]
         {
             "ParcelID",
             "AccessID",
             "Flags",
             "Time"
         }
         ,
         new object[]
         {
             data.GlobalID,
             entry.AgentID,
             entry.Flags,
             entry.Time.Ticks
         });
     }
 }
Example #29
0
    public void saveTopologyLayer()
    {
        if (topology == null)
        {
            topology = GameObject.FindGameObjectWithTag("Topology").GetComponent <TopologyMesh>();
        }

        LandData         topologyData = GameObject.FindGameObjectWithTag("Land").transform.Find("Topology").GetComponent <LandData>();
        TerrainMap <int> topologyMap  = new TerrainMap <int>(topology.top, 1);

        float[,,] splatMap = TypeConverter.singleToMulti(topologyData.splatMap, 2);

        if (splatMap == null)
        {
            Debug.LogError("Splatmap is null");
            return;
        }

        for (int i = 0; i < topologyMap.res; i++)
        {
            for (int j = 0; j < topologyMap.res; j++)
            {
                if (splatMap[i, j, 0] > 0)
                {
                    topologyMap[i, j] = topologyMap[i, j] | (int)oldTopologyLayer;
                }
                if (splatMap[i, j, 1] > 0)
                {
                    topologyMap[i, j] = topologyMap[i, j] & ~(int)oldTopologyLayer;
                }
            }
        }


        topology.top = topologyMap.ToByteArray();
    }
Example #30
0
    public void changeLandLayer()
    {
        if (topology == null)
        {
            topology = GameObject.FindGameObjectWithTag("Topology").GetComponent <TopologyMesh>();
        }

        if (selectedLandLayer != null)
        {
            selectedLandLayer.save();
        }

        switch (landLayer.ToLower())
        {
        case "ground":
            selectedLandLayer = GameObject.FindGameObjectWithTag("Land").transform.Find("Ground").GetComponent <LandData>();
            break;

        case "biome":
            selectedLandLayer = GameObject.FindGameObjectWithTag("Land").transform.Find("Biome").GetComponent <LandData>();
            break;

        case "alpha":
            selectedLandLayer = GameObject.FindGameObjectWithTag("Land").transform.Find("Alpha").GetComponent <LandData>();
            break;

        case "topology":
            //updated topology values
            //selectedLandLayer.splatMap;
            saveTopologyLayer();
            selectedLandLayer = GameObject.FindGameObjectWithTag("Land").transform.Find("Topology").GetComponent <LandData>();
            selectedLandLayer.setData(topology.getSplatMap((int)topologyLayer), "topology");
            break;
        }
        selectedLandLayer.setLayer();
    }
Example #31
0
        public XmlRpcResponse GetLandData(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            Hashtable requestData  = (Hashtable)request.Params[0];
            ulong     regionHandle = Convert.ToUInt64(requestData["region_handle"]);
            uint      x            = Convert.ToUInt32(requestData["x"]);
            uint      y            = Convert.ToUInt32(requestData["y"]);
            //            m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle);

            byte      regionAccess;
            LandData  landData = m_LocalService.GetLandData(UUID.Zero, regionHandle, x, y, out regionAccess);
            Hashtable hash     = new Hashtable();

            if (landData != null)
            {
                // for now, only push out the data we need for answering a ParcelInfoReqeust
                hash["AABBMax"]      = landData.AABBMax.ToString();
                hash["AABBMin"]      = landData.AABBMin.ToString();
                hash["Area"]         = landData.Area.ToString();
                hash["AuctionID"]    = landData.AuctionID.ToString();
                hash["Description"]  = landData.Description;
                hash["Flags"]        = landData.Flags.ToString();
                hash["GlobalID"]     = landData.GlobalID.ToString();
                hash["Name"]         = landData.Name;
                hash["OwnerID"]      = landData.OwnerID.ToString();
                hash["SalePrice"]    = landData.SalePrice.ToString();
                hash["SnapshotID"]   = landData.SnapshotID.ToString();
                hash["UserLocation"] = landData.UserLocation.ToString();
                hash["RegionAccess"] = regionAccess.ToString();
                hash["Dwell"]        = landData.Dwell.ToString();
            }

            XmlRpcResponse response = new XmlRpcResponse();

            response.Value = hash;
            return(response);
        }
 /// <summary>
 ///   Save this parcel's access list
 /// </summary>
 /// <param name = "data"></param>
 private void SaveParcelAccessList(LandData data)
 {
     //Clear out all old parcel bans and access list entries
     GD.Delete("parcelaccess", new[] { "ParcelID" }, new object[] { data.GlobalID });
     foreach (ParcelManager.ParcelAccessEntry entry in data.ParcelAccessList)
     {
         //Replace all the old ones
         GD.Replace("parcelaccess", new[]
         {
             "ParcelID",
             "AccessID",
             "Flags",
             "Time"
         }
                    ,
                    new object[]
         {
             data.GlobalID,
             entry.AgentID,
             entry.Flags,
             entry.Time.Ticks
         });
     }
 }
 public void AddLandObject(LandData parcel)
 {
     IDirectoryServiceConnector DSC = Aurora.DataManager.DataManager.RequestPlugin<IDirectoryServiceConnector>();
     if (DSC != null)
     {
         Vector3 OldUserLocation = parcel.UserLocation;
         if (parcel.UserLocation == Vector3.Zero)
         {
             //Set it to a position inside the parcel at the ground if it doesn't have one
             parcel.UserLocation = GetParcelCenterAtGround(GetLandObject(parcel.LocalID));
         }
         if (m_UpdateDirectoryOnUpdate)
             //Update search database
             DSC.AddLandObject(parcel);
         else if (m_UpdateDirectoryOnTimer)
         {
             //lock (m_TaintedLandData)
             //{
             //Tell the timer about it
             if (!m_TaintedLandData.Contains(parcel))
                 m_TaintedLandData.Add(parcel);
             //}
         }
         //Reset the position 
         parcel.UserLocation = OldUserLocation;
     }
 }
Example #34
0
        /// <summary>
        /// Load serialized parcels.
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="serialisedParcels"></param>
        protected void LoadParcels(Scene scene, List <string> serialisedParcels)
        {
            // Reload serialized parcels
            m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels.  Please wait.", serialisedParcels.Count);
            List <LandData> landData = new List <LandData>();

            foreach (string serialisedParcel in serialisedParcels)
            {
                LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);

                // Validate User and Group UUID's

                if (parcel.IsGroupOwned)
                {
                    if (!ResolveGroupUuid(parcel.GroupID))
                    {
                        parcel.OwnerID      = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
                        parcel.GroupID      = UUID.Zero;
                        parcel.IsGroupOwned = false;
                    }
                }
                else
                {
                    if (!ResolveUserUuid(scene, parcel.OwnerID))
                    {
                        parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
                    }

                    if (!ResolveGroupUuid(parcel.GroupID))
                    {
                        parcel.GroupID = UUID.Zero;
                    }
                }

                List <LandAccessEntry> accessList = new List <LandAccessEntry>();
                foreach (LandAccessEntry entry in parcel.ParcelAccessList)
                {
                    if (ResolveUserUuid(scene, entry.AgentID))
                    {
                        accessList.Add(entry);
                    }
                    // else, drop this access rule
                }
                parcel.ParcelAccessList = accessList;

//                m_log.DebugFormat(
//                    "[ARCHIVER]: Adding parcel {0}, local id {1}, owner {2}, group {3}, isGroupOwned {4}, area {5}",
//                    parcel.Name, parcel.LocalID, parcel.OwnerID, parcel.GroupID, parcel.IsGroupOwned, parcel.Area);

                landData.Add(parcel);
            }

            if (!m_merge)
            {
                bool setupDefaultParcel = (landData.Count == 0);
                scene.LandChannel.Clear(setupDefaultParcel);
            }

            scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
            m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);
        }
Example #35
0
 public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
 {
 }
Example #36
0
            public void LoadModuleFromArchive(byte[] data, string filePath, TarArchiveReader.TarEntryType type, IScene scene)
            {
                if (filePath.StartsWith("parcels/"))
                {
                    if (!m_merge)
                    {
                        //Only use if we are not merging
                        LandData parcel = new LandData();
                        OSD parcelData = OSDParser.DeserializeLLSDBinary(data);
                        parcel.FromOSD((OSDMap)parcelData);
                        m_parcels.Add(parcel);
                    }
                }
                else if (filePath.StartsWith("terrain/"))
                {
                    ITerrainModule terrainModule = m_scene.RequestModuleInterface<ITerrainModule>();

                    MemoryStream ms = new MemoryStream(data);
                    terrainModule.LoadFromStream(filePath, ms, 0, 0);
                    ms.Close();
                }
                else if (filePath.StartsWith("entities/"))
                {
                    MemoryStream ms = new MemoryStream(data);
                    SceneObjectGroup sceneObject = OpenSim.Region.Framework.Scenes.Serialization.SceneObjectSerializer.FromXml2Format(ms, (Scene)scene);
                    foreach (SceneObjectPart part in sceneObject.ChildrenList)
                    {
                        if (!ResolveUserUuid(part.CreatorID))
                            part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;

                        if (!ResolveUserUuid(part.OwnerID))
                            part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;

                        if (!ResolveUserUuid(part.LastOwnerID))
                            part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;

                        // And zap any troublesome sit target information
                        part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
                        part.SitTargetPosition = new Vector3(0, 0, 0);

                        // Fix ownership/creator of inventory items
                        // Not doing so results in inventory items
                        // being no copy/no mod for everyone
                        lock (part.TaskInventory)
                        {
                            TaskInventoryDictionary inv = part.TaskInventory;
                            foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
                            {
                                if (!ResolveUserUuid(kvp.Value.OwnerID))
                                {
                                    kvp.Value.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
                                }
                                if (!ResolveUserUuid(kvp.Value.CreatorID))
                                {
                                    kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
                                }
                            }
                        }
                    }

                    if (m_scene.SceneGraph.AddPrimToScene(sceneObject))
                    {
                        sceneObject.HasGroupChanged = true;
                        sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
                        sceneObject.CreateScriptInstances(0, false, 0, UUID.Zero);
                        sceneObject.ResumeScripts();
                    }
                }
            }
Example #37
0
        /// <summary>
        /// This method will produce a random city with the central region of the city being
        /// specified as a parameter. More parameters need to be made available for this method
        /// to produce a better quality city, note for now the minimum area for a city is a
        /// 3x3 grid of regions. This code is based on the original C++ version called pixel city.
        /// </summary>
        /// <param name="seed_value">Random integer seed value.</param>
        /// <returns>true / false indicator of success or failure.</returns>
        private bool doGenerate(int seed_value)
        {
            int rx, ry;
            //  Based on the initial seed value populate the regions that this shared module
            // is connected to, this means first get a list of the region, determine which
            // region is in the center of all the regions and set this as the hotzone, or
            // central part of the city (this is where the tallest/largest buildings will
            // be created) and will extend out to cover virtually all of the connected
            // regions if desired. No support for aging of the buildings or the city exists
            // yet it is a possible course for the future of this module.

            //  First quick check to see if the module is enabled or not.
            if (!m_fEnabled)
            {
                m_log.Info("[CITY BUILDER]: Disabled, aborting auto generation.");
                return (false);
            }

            m_log.Info("[CITY BUILDER]: Auto generating the city.");

            //  Now we need to ask some basic values for the city generation, we already have
            // the base seed value as this is part of the 'city generate' command, now what
            // about a name, position, size, densities etc. Some of this can be generated
            // based on the seed value, but then, it would need to be confirmed by the user
            // or allow them to change it. TODO move all requested data into the configuration file.
            if (m_UserAccountService == null)
            {
                m_UserAccountService = simulationBase.ApplicationRegistry.RequestModuleInterface<IUserAccountService>();
            }

            //  Decide where the city is to be placed within the server instance.
            int r = this.randomValue(10);

            string regionCount = MainConsole.Instance.CmdPrompt("Region Count ", r.ToString());
            r = Convert.ToInt32(regionCount);
            m_log.InfoFormat("[CITY BUILDER]: City area {0} x {1} regions ", r, r);

            cityName = MainConsole.Instance.CmdPrompt("City Name ", cityName);
            cityOwner = MainConsole.Instance.CmdPrompt("City Owner ", cityOwner);
            m_DefaultUserName = cityOwner;

            //  Make sure that the user and estate information specified in the configuration file
            // have been loaded and the information has either been found or has been created.
            m_DefaultUserAccount = m_UserAccountService.GetUserAccount(UUID.Zero, cityOwner);
            if (m_DefaultUserAccount == null)
            {
                m_log.InfoFormat("[CITY BUILDER]: Creating default account {0}", m_DefaultUserName);
                m_UserAccountService.CreateUser(m_DefaultUserName, Util.Md5Hash(m_DefaultUserPword), m_DefaultUserEmail);
                m_DefaultUserAccount = m_UserAccountService.GetUserAccount(UUID.Zero, m_DefaultUserName);
                cityOwner = m_DefaultUserName;
            }
            else
                m_log.InfoFormat("[CITY BUILDER]: Account found for {0}", m_DefaultUserName);

            // Obtain the scene manager that the server instance is using.
            sceneManager = simulationBase.ApplicationRegistry.RequestModuleInterface<SceneManager>();

            //  Construct the data instance for a city map to hold the total regions in the simulation.
            cityMap = new CityMap();
            citySeed = seed_value;
            cityMap.cityRegions = new Scene[r, r];
            cityMap.cityPlots = new List<BuildingPlot>();
            cityMap.cityBuildings = new List<CityBuilding>();

            //  Construct land and estate data and update to reflect the found user or the newly created one.
            cityLandData = new LandData();
            RegionInfo regionInfo = new RegionInfo();

            regionInfo.RegionID = UUID.Random();

            //Create an estate
            m_DefaultEstate = new EstateSettings();

            m_log.InfoFormat("[CITY BUILDER]: No estates found for user {0}, constructing default estate.", m_DefaultUserAccount.Name);

            m_DefaultEstate.EstateOwner = m_DefaultUserAccount.PrincipalID;
            m_DefaultEstate.EstateName = m_DefaultEstateName;
            m_DefaultEstate.EstatePass = Util.Md5Hash(Util.Md5Hash(m_DefaultEstatePassword));
            m_DefaultEstate.EstateID = (uint)this.randomValue(1000);

            regionInfo.EstateSettings = m_DefaultEstate; //Just set the estate, this module took care of the loading and the rest will leave it alone

            cityLandData.OwnerID = m_DefaultUserAccount.PrincipalID;
            cityLandData.Name = m_DefaultEstateName;
            cityLandData.GlobalID = UUID.Random();
            cityLandData.GroupID = UUID.Zero;

            int regionPort = startPort;

            //  Construct the region.
            regionInfo.RegionSizeX = cityConfig.GetInt("DefaultRegionSize", 256);
            regionInfo.RegionSizeY = regionInfo.RegionSizeX;
            regionInfo.RegionType = "Mainland";
            regionInfo.ObjectCapacity = 100000;
            regionInfo.Startup = StartupType.Normal;
            regionInfo.ScopeID = UUID.Zero;

            IParcelServiceConnector parcelService = Aurora.DataManager.DataManager.RequestPlugin<IParcelServiceConnector>();
            if (r == 1)
            {
                m_log.Info("[CITY BUILDER]: Single region city.");
                IPAddress address = IPAddress.Parse("0.0.0.0");
                regionInfo.ExternalHostName = Aurora.Framework.Utilities.GetExternalIp();
                regionInfo.FindExternalAutomatically = true;
                regionInfo.InternalEndPoint = new IPEndPoint(address, regionPort++);
                cityLandData.RegionID = regionInfo.RegionID;
                if(parcelService != null)
                    parcelService.StoreLandObject(cityLandData.LandData);
                regionInfo.RegionName = "Region00";
                regionInfo.RegionLocX = (int)m_DefaultStartLocation.X;
                regionInfo.RegionLocY = (int)m_DefaultStartLocation.Y;
                if (!createRegion(0, 0, regionInfo))
                {
                    m_log.Info("[CITY BUILDER]: Failed to construct region.");
                    return (false);
                }
            }
            else if (r > 1)
            {
                m_log.Info("[CITY BUILDER]: Multi-region city.");
                IPAddress address = IPAddress.Parse("0.0.0.0");
                regionInfo.ExternalHostName = Aurora.Framework.Utilities.GetExternalIp();
                regionInfo.FindExternalAutomatically = true;
                //  Construct the regions for the city.
                regionPort = startPort;
                for (rx = 0; rx < r; rx++)
                {
                    for (ry = 0; ry < r; ry++)
                    {
                        regionInfo.InternalEndPoint = new IPEndPoint(address, regionPort++);
                        cityLandData.RegionID = regionInfo.RegionID;
                        if(parcelService != null)
                            parcelService.StoreLandObject(cityLandData.LandData);
                        regionInfo.RegionName = "Region" + rx + ry;
                        regionInfo.RegionLocX = (int)(m_DefaultStartLocation.X + rx);
                        regionInfo.RegionLocY = (int)(m_DefaultStartLocation.Y + ry);
                        m_log.InfoFormat("[CITY BUILDER]: '{0}' @ {1},{2}, http://{3}/", regionInfo.RegionName,
                            regionInfo.RegionLocX, regionInfo.RegionLocY, regionInfo.InternalEndPoint);
                        //We already set the estate before, we don't need to deal with linking it or anything
                        //EstateConnector.LinkRegion(regionInfo.RegionID, (int)m_DefaultEstate.EstateID, m_DefaultEstate.EstatePass);
                        if (!createRegion(rx, ry, regionInfo))
                        {
                            m_log.InfoFormat("[CITY BUILDER]: Failed to construct region at {0},{1}", rx, ry);
                            return (false);
                        }
                    }
                }
            }

            //  Either generate the terrain or loading from an existing file, DEM for example.
            m_log.Info("[CITY BUILDER]: [TERRAIN]");

            //  For each region, just fill the terrain to be 21. This is just above the default
            // water level for Aurora.
            float[,] tHeight = new float[256, 256];
            for (rx = 0; rx < 256; rx++)
            {
                for (ry = 0; ry < 256; ry++)
                {
                    tHeight[rx, ry] = 21.0f;
                }
            }
            //  Construct the new terrain for each region and pass the height map to it.
            for (rx = 0; rx < r; rx++)
            {
                for (ry = 0; ry < r; ry++)
                {
                    Scene region = cityMap.cityRegions[rx, ry];
                    ITerrainChannel tChannel = new TerrainChannel(true, region);
                    ITerrain terrain = null;
                    try
                    {
                        region.TryRequestModuleInterface<ITerrain>(out terrain);
                        terrain.SetHeights2D(tHeight);
                    }
                    catch
                    {
                    }
                }
            }

            //  Rivers and other waterways.

            //  From the total number of regions pick a number of regions that will be 'centers'
            // for the entire city, record these in the centralRegions list.
            m_log.Info("[CITY BUILDER]: [CENTERS]");
            //  ( region count * region count ) / 3
            int aNum = this.randomValue((cityMap.cityRegions.GetUpperBound(0) * cityMap.cityRegions.GetUpperBound(1))/3);
            if (aNum == 0)
            {
                aNum = 1;
            }
            m_log.InfoFormat("[CITY BUILDER]: Total regions {0}, selecting {1} regions for centers.", (r*r), aNum );
            int prevRegionX = 0;
            int prevRegionY = 0;
            while ( aNum > 0 )
            {
                int currRegionX = randomValue( cityMap.cityRegions.GetUpperBound(0) ) / 2;
                int currRegionY = randomValue( cityMap.cityRegions.GetUpperBound(1) ) / 2;

                // If the location selected is the same as the previous location try again.
                if (currRegionX == prevRegionX && currRegionY == prevRegionY)
                {
                    aNum--;
                    continue;
                }

                m_log.InfoFormat("[CITY BUILDER]: Region {0}, located {1},{2}", aNum, prevRegionX, prevRegionY);

                try
                {
                    Scene region = cityMap.centralRegions[(prevRegionX * cityMap.cityRegions.GetUpperBound(0)) + prevRegionY];
                    if (region!=null)
                    {
                        cityMap.centralRegions.Add(region);
                    }
                }
                catch
                {
                }
                aNum--;
                prevRegionX = currRegionX;
                prevRegionY = currRegionY;
            }

            m_log.Info("[CITY BUILDER]: [DENSITY]");
            float avgDensity = 0.0f;

            avgDensity += cityDensities[0];
            avgDensity += cityDensities[1];
            avgDensity += cityDensities[2];
            avgDensity += cityDensities[3];
            avgDensity /= 4;

            //  Before ANYTHING else is created construct the transport systems, priority is given
            // to the road network before the rail network, perhaps a configuration option to allow
            // for the prioritisation value of the transport system is possible.
            m_log.Info("[CITY BUILDER]: [FREEWAYS]");
            m_log.Info("[CITY BUILDER]: [HIGHWAYS]");
            m_log.Info("[CITY BUILDER]: [STREETS]");
            m_log.Info("[CITY BUILDER]: [RAILWAYS]");

            m_log.InfoFormat("[CITY BUILDER]: [RESIDENTIAL DENSITY] {0}%", cityDensities[0] * 100);
            m_log.InfoFormat("[CITY BUILDER]: [COMMERCIAL DENSITY] {0}%", cityDensities[1] * 100);
            m_log.InfoFormat("[CITY BUILDER]: [CORPORATE DENSITY] {0}%", cityDensities[2] * 100);
            m_log.InfoFormat("[CITY BUILDER]: [INDUSTRIAL DENISTY] {0}%", cityDensities[3] * 100);
            m_log.InfoFormat("[CITY BUILDER]: [AVERAGE DENSITY] {0}%", avgDensity);

            m_log.Info("[CITY BUILDER]: [BLOCKS]");
            m_log.Info("[CITY BUILDER]: [ALLOTMENT PLOTS]");
            m_log.Info("[CITY BUILDER]: [BUILDINGS]");

            return (true);
        }
 public bool PreprocessIncomingLandObjectFromStorage(LandData data)
 {
     ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
     new_land.LandData = data;
     new_land.SetInfoID();
     if (!new_land.SetLandBitmapFromByteArray())
         return false;
     AddLandObject(new_land, true);
     return true;
 }
 private static OSDMap LandData2WebOSD(LandData parcel)
 {
     OSDMap parcelOSD = parcel.ToOSD();
     parcelOSD["GenericData"] = parcelOSD.ContainsKey("GenericData") ? (parcelOSD["GenericData"].Type == OSDType.Map ? parcelOSD["GenericData"] : (OSDMap)OSDParser.DeserializeLLSDXml(parcelOSD["GenericData"].ToString())) : new OSDMap();
     parcelOSD["Bitmap"] = OSD.FromBinary(parcelOSD["Bitmap"]).ToString();
     return parcelOSD;
 }
Example #40
0
 public override IDataTransferable Duplicate()
 {
     LandData m = new LandData();
     m.FromOSD(ToOSD());
     return m;
 }
Example #41
0
        /// <summary>
        /// Make a new copy of the land data
        /// </summary>
        /// <returns></returns>
        public LandData Copy()
        {
            LandData landData = new LandData();

            landData._AABBMax = _AABBMax;
            landData._AABBMin = _AABBMin;
            landData._area = _area;
            landData._auctionID = _auctionID;
            landData._authBuyerID = _authBuyerID;
            landData._category = _category;
            landData._claimDate = _claimDate;
            landData._claimPrice = _claimPrice;
            landData._globalID = _globalID;
            landData._groupID = _groupID;
            landData._isGroupOwned = _isGroupOwned;
            landData._localID = _localID;
            landData._landingType = _landingType;
            landData._mediaAutoScale = _mediaAutoScale;
            landData._mediaID = _mediaID;
            landData._mediaURL = _mediaURL;
            landData._musicURL = _musicURL;
            landData._ownerID = _ownerID;
            landData._bitmap = (byte[]) _bitmap.Clone();
            landData._description = _description;
            landData._flags = _flags;
            landData._name = _name;
            landData._status = _status;
            landData._passHours = _passHours;
            landData._passPrice = _passPrice;
            landData._salePrice = _salePrice;
            landData._snapshotID = _snapshotID;
            landData._userLocation = _userLocation;
            landData._userLookAt = _userLookAt;
            landData._otherCleanTime = _otherCleanTime;
            landData._dwell = _dwell;
            landData._mediaType = _mediaType;
            landData._mediaDescription = _mediaDescription;
            landData._mediaWidth = _mediaWidth;
            landData._mediaHeight = _mediaHeight;
            landData._mediaLoop = _mediaLoop;
            landData._MediaLoopSet = _MediaLoopSet;
            landData._obscureMusic = _obscureMusic;
            landData._obscureMedia = _obscureMedia;
            landData._regionID = _regionID;
            landData._regionHandle = _regionHandle;
            landData._infoUUID = _infoUUID;
            landData._Maturity = _Maturity;
            landData._private = _private;

            landData._parcelAccessList.Clear();
            foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
            {
                ParcelManager.ParcelAccessEntry newEntry = new ParcelManager.ParcelAccessEntry();
                newEntry.AgentID = entry.AgentID;
                newEntry.Flags = entry.Flags;
                newEntry.Time = entry.Time;

                landData._parcelAccessList.Add(newEntry);
            }

            return landData;
        }
Example #42
0
        // Issue 5 - End
        static TileData()
        {
            using (FileStream fileStream = FileManager.GetFile("tiledata.mul"))
            {
                BinaryReader bin = new BinaryReader(fileStream);

                LandData landData;
                ItemData itemData;

                if (fileStream.Length == 3188736)
                { // 7.0.9.0
                    LandData = new LandData[0x4000];

                    for (int i = 0; i < 0x4000; ++i)
                    {
                        landData = new LandData();

                        if (i == 1 || (i > 0 && (i & 0x1F) == 0))
                        {
                            bin.ReadInt32();
                        }

                        TileFlag flags = (TileFlag)bin.ReadInt64();

                        int iTextureID = bin.ReadInt16();

                        bin.BaseStream.Seek(20, SeekOrigin.Current);

                        landData.Flags = flags;
                        landData.TextureID = iTextureID;

                        LandData[i] = landData;
                    }

                    ItemData = new ItemData[0x10000];

                    for (int i = 0; i < 0x10000; ++i)
                    {
                        itemData = new ItemData();

                        if ((i & 0x1F) == 0)
                        {
                            bin.ReadInt32();
                        }

                        itemData.Flags = (TileFlag)bin.ReadInt64();
                        itemData.Weight = bin.ReadByte();
                        itemData.Quality = bin.ReadByte();

                        itemData.Unknown1 = bin.ReadByte();
                        itemData.Unknown2 = bin.ReadByte();
                        itemData.Unknown3 = bin.ReadByte();

                        itemData.Quantity = bin.ReadByte();
                        itemData.AnimID = bin.ReadInt16();

                        bin.BaseStream.Seek(2, SeekOrigin.Current); // hue?
                        itemData.Unknown4 = bin.ReadByte();

                        itemData.Value = bin.ReadByte();
                        itemData.Height = bin.ReadByte();

                        itemData.Name = ASCIIEncoding.ASCII.GetString((bin.ReadBytes(20)));
                        itemData.Name = itemData.Name.Trim('\0');
                        // binaryReader.BaseStream.Seek(20, SeekOrigin.Current);

                        // Issue 5 - Statics (bridge, stairs, etc) should be walkable - http://code.google.com/p/ultimaxna/issues/detail?id=5 - Smjert
                        if (i > 1005 && i < 7640)
                            itemData.IsStairs = !(Array.BinarySearch(m_StairsID, i) < 0);
                        // Issue 5 - End

                        ItemData[i] = itemData;
                    }
                }
                else
                {
                    LandData = new LandData[0x4000];

                    for (int i = 0; i < 0x4000; ++i)
                    {

                        landData = new LandData();

                        if ((i & 0x1F) == 0)
                        {
                            bin.ReadInt32();
                        }

                        TileFlag flags = (TileFlag)bin.ReadInt32();

                        int iTextureID = bin.ReadInt16();

                        bin.BaseStream.Seek(20, SeekOrigin.Current);

                        landData.Flags = flags;
                        landData.TextureID = iTextureID;

                        LandData[i] = landData;
                    }

                    if (fileStream.Length == 1644544)
                    { // 7.0.0.0
                        ItemData = new ItemData[0x8000];

                        for (int i = 0; i < 0x8000; ++i)
                        {
                            itemData = new ItemData();

                            if ((i & 0x1F) == 0)
                            {
                                bin.ReadInt32();
                            }

                            itemData.Flags = (TileFlag)bin.ReadInt32();
                            itemData.Weight = bin.ReadByte();
                            itemData.Quality = bin.ReadByte();

                            itemData.Unknown1 = bin.ReadByte();
                            itemData.Unknown2 = bin.ReadByte();
                            itemData.Unknown3 = bin.ReadByte();

                            itemData.Quantity = bin.ReadByte();
                            itemData.AnimID = bin.ReadInt16();

                            bin.BaseStream.Seek(2, SeekOrigin.Current); // hue?
                            itemData.Unknown4 = bin.ReadByte();

                            itemData.Value = bin.ReadByte();
                            itemData.Height = bin.ReadByte();

                            itemData.Name = ASCIIEncoding.ASCII.GetString((bin.ReadBytes(20)));
                            itemData.Name = itemData.Name.Trim('\0');
                            // binaryReader.BaseStream.Seek(20, SeekOrigin.Current);

                            // Issue 5 - Statics (bridge, stairs, etc) should be walkable - http://code.google.com/p/ultimaxna/issues/detail?id=5 - Smjert
                            if (i > 1005 && i < 7640)
                                itemData.IsStairs = !(Array.BinarySearch(m_StairsID, i) < 0);
                            // Issue 5 - End

                            ItemData[i] = itemData;
                        }
                    }
                    else
                    {
                        ItemData = new ItemData[0x4000];

                        for (int i = 0; i < 0x4000; ++i)
                        {
                            itemData = new ItemData();

                            if ((i & 0x1F) == 0)
                            {
                                bin.ReadInt32();
                            }

                            itemData.Flags = (TileFlag)bin.ReadInt32();
                            itemData.Weight = bin.ReadByte();
                            itemData.Quality = bin.ReadByte();

                            itemData.Unknown1 = bin.ReadByte();
                            itemData.Unknown2 = bin.ReadByte();
                            itemData.Unknown3 = bin.ReadByte();

                            itemData.Quantity = bin.ReadByte();
                            itemData.AnimID = bin.ReadInt16();

                            bin.BaseStream.Seek(2, SeekOrigin.Current); // hue?
                            itemData.Unknown4 = bin.ReadByte();

                            itemData.Value = bin.ReadByte();
                            itemData.Height = bin.ReadByte();

                            itemData.Name = ASCIIEncoding.ASCII.GetString((bin.ReadBytes(20)));
                            itemData.Name = itemData.Name.Trim('\0');
                            // binaryReader.BaseStream.Seek(20, SeekOrigin.Current);

                            // Issue 5 - Statics (bridge, stairs, etc) should be walkable - http://code.google.com/p/ultimaxna/issues/detail?id=5 - Smjert
                            if (i > 1005 && i < 7640)
                                itemData.IsStairs = !(Array.BinarySearch(m_StairsID, i) < 0);
                            // Issue 5 - End

                            ItemData[i] = itemData;
                        }
                    }
                }

                Metrics.ReportDataRead((int)bin.BaseStream.Position);
            }
        }
        public byte[] AddLandObject(Dictionary<string, object> request)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            LandData land = new LandData();
            land.FromKVP(request);
            DirectoryServiceConnector.AddLandObject(land);

            return SuccessResult();
        }
        public byte[] AddRegion(OSDMap request, UUID regionID)
        {
            OSDArray requests = (OSDArray) request["Requests"];
            List<LandData> parcels = new List<LandData>();
            foreach (OSD o in requests)
            {
                LandData land = new LandData();
                land.FromOSD((OSDMap) o);
                land.RegionID = regionID;
                parcels.Add(land);
            }
            if (parcels.Count == 0)
                return new byte[1];
            //Check whether this region is just spamming add to search and stop them if they are
            if (timeBeforeNextUpdate.ContainsKey(parcels[0].RegionID) &&
                Util.UnixTimeSinceEpoch() < timeBeforeNextUpdate[parcels[0].RegionID])
                return new byte[1]; //Too soon to update

            //Update the time with now + the time to wait for the next update
            timeBeforeNextUpdate[parcels[0].RegionID] = Util.UnixTimeSinceEpoch() + (60*minTimeBeforeNextParcelUpdate);

            DirectoryServiceConnector.AddRegion(parcels);
            return new byte[1];
        }
        public void UpdateLandObject(int local_id, LandData data)
        {
            LandData newData = data.Copy();
            newData.LocalID = local_id;

            lock (m_landList)
            {
                if (m_landList.ContainsKey(local_id))
                {
                    m_landList[local_id].LandData = newData;
                    m_scene.EventManager.TriggerLandObjectAdded(m_landList[local_id].LandData);
                }
            }
        }
        /// <summary>
        /// Gets all parcels owned by the given user
        /// </summary>
        /// <param name="OwnerID"></param>
        /// <returns></returns>
        public LandData[] GetParcelByOwner(UUID OwnerID)
        {
            List<LandData> Lands = new List<LandData>();
            //NOTE: this does check for group deeded land as well, so this can check for that as well
            List<string> Query = GD.Query("OwnerID", OwnerID, "searchparcel", "*");
            //Return if no values
            if (Query.Count == 0)
                return Lands.ToArray();
            
            LandData LandData = new LandData();
            //Add all the parcels belonging to the owner to the list
            for (int i = 0; i < Query.Count; i += 22)
            {
                LandData.RegionID = UUID.Parse(Query[i]);
                LandData.GlobalID = UUID.Parse(Query[i + 1]);
                LandData.LocalID = int.Parse(Query[i + 2]);
                LandData.UserLocation = new Vector3(float.Parse(Query[i + 3]), float.Parse(Query[i + 4]), float.Parse(Query[i + 5]));
                LandData.Name = Query[i + 6];
                LandData.Description = Query[i + 7];
                LandData.Flags = uint.Parse(Query[i + 8]);
                LandData.Dwell = int.Parse(Query[i + 9]);
                LandData.InfoUUID = UUID.Parse(Query[i + 10]);
                LandData.AuctionID = uint.Parse(Query[i + 13]);
                LandData.Area = int.Parse(Query[i + 14]);
                LandData.Maturity = int.Parse(Query[i + 16]);
                LandData.OwnerID = UUID.Parse(Query[i + 17]);
                LandData.GroupID = UUID.Parse(Query[i + 18]);
                LandData.SnapshotID = UUID.Parse(Query[i + 20]);
                LandData.Bitmap = OSDParser.DeserializeLLSDXml(Query[i + 21]);

                Lands.Add(LandData);
                LandData = new LandData();
            }
            return Lands.ToArray();
        }
        public void UpdateLandObject(int local_id, LandData data)
        {
            LandData newData = data.Copy();
            newData.LocalID = local_id;

            lock (m_landList)
            {
                if (m_landList.ContainsKey(local_id))
                {
                    m_landList[local_id].LandData = newData;
                    AddLandObjectToSearch(data);
                    IParcelServiceConnector conn = Aurora.DataManager.DataManager.RequestPlugin<IParcelServiceConnector>();
                    if (conn != null)
                        conn.StoreLandObject(data);
                    m_scene.EventManager.TriggerLandObjectAdded(m_landList[local_id].LandData);
                }
            }
        }
 public LandData GetParcelInfo(UUID InfoUUID)
 {
     List<string> Query = GD.Query("InfoUUID", InfoUUID, "searchparcel", "*");
     LandData LandData = new LandData();
     if (Query.Count == 0)
         return null;
     LandData.RegionID = UUID.Parse(Query[0]);
     LandData.GlobalID = UUID.Parse(Query[1]);
     LandData.LocalID = int.Parse(Query[2]);
     LandData.UserLocation = Vector3.Parse(Query[3]);
     LandData.Name = Query[6];
     LandData.Description = Query[7];
     LandData.Flags = uint.Parse(Query[8]);
     LandData.Dwell = int.Parse(Query[9]);
     LandData.InfoUUID = UUID.Parse(Query[10]);
     LandData.AuctionID = uint.Parse(Query[13]);
     LandData.Area = int.Parse(Query[14]);
     LandData.Maturity = int.Parse(Query[16]);
     LandData.OwnerID = UUID.Parse(Query[17]);
     LandData.GroupID = UUID.Parse(Query[18]);
     LandData.SnapshotID = UUID.Parse(Query[20]);
     return LandData;
 }
        public LandData[] GetParcelByOwner(UUID OwnerID)
        {
            List<LandData> Lands = new List<LandData>();
            List<string> Query = GD.Query("OwnerID", OwnerID, "searchparcel", "*");
            if (Query.Count == 0)
                return Lands.ToArray();
            int i = 0;
            int DataCount = 0;
            LandData LandData = new LandData();
            foreach (string RetVal in Query)
            {
                if (DataCount == 0)
                    LandData.RegionID = UUID.Parse(Query[i]);
                if (DataCount == 1)
                    LandData.GlobalID = UUID.Parse(Query[i]);
                if (DataCount == 2)
                    LandData.LocalID = int.Parse(Query[i]);
                if (DataCount == 3)
                    LandData.UserLocation = Vector3.Parse(Query[i]);
                if (DataCount == 6)
                    LandData.Name = Query[i];
                if (DataCount == 7)
                    LandData.Description = Query[i];
                if (DataCount == 8)
                    LandData.Flags = uint.Parse(Query[i]);
                if (DataCount == 9)
                    LandData.Dwell = int.Parse(Query[i]);
                if (DataCount == 10)
                    LandData.InfoUUID = UUID.Parse(Query[i]);
                if (DataCount == 13)
                    LandData.AuctionID = uint.Parse(Query[i]);
                if (DataCount == 14)
                    LandData.Area = int.Parse(Query[i]);
                if (DataCount == 16)
                    LandData.Maturity = int.Parse(Query[i]);
                if (DataCount == 17)
                    LandData.OwnerID = UUID.Parse(Query[i]);
                if (DataCount == 18)
                    LandData.GroupID = UUID.Parse(Query[i]);
                if (DataCount == 20)
                    LandData.SnapshotID = UUID.Parse(Query[i]);

                DataCount++;
                i++;
                if (DataCount == 21)
                {
                    Lands.Add(LandData);
                    LandData = new LandData();
                    DataCount = 0;
                }
            }
            return Lands.ToArray();
        }
        public RegionData LoadBackup(string file)
        {
            if (!File.Exists(file))
                return null;

            var stream = ArchiveHelpers.GetStream(file);
            if (stream == null)
                return null;

            GZipStream m_loadStream = new GZipStream(stream, CompressionMode.Decompress);
            TarArchiveReader reader = new TarArchiveReader(m_loadStream);
            List<uint> foundLocalIDs = new List<uint>();
            RegionData regiondata = new RegionData();
            regiondata.Init();

            byte[] data;
            string filePath;
            TarArchiveReader.TarEntryType entryType;
            System.Collections.Concurrent.ConcurrentQueue<byte[]> groups =
                new System.Collections.Concurrent.ConcurrentQueue<byte[]>();
            //Load the archive data that we need
            while ((data = reader.ReadEntry(out filePath, out entryType)) != null)
            {
                if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
                    continue;

                if (filePath.StartsWith("parcels/"))
                {
                    //Only use if we are not merging
                    LandData parcel = new LandData();
                    OSD parcelData = OSDParser.DeserializeLLSDBinary(data);
                    parcel.FromOSD((OSDMap) parcelData);
                    if (parcel.OwnerID != UUID.Parse("05948863-b678-433e-87a4-e44d17678d1d"))
                        //The default owner of the 'default' region
                        regiondata.Parcels.Add(parcel);
                }
                else if (filePath.StartsWith("newstyleterrain/"))
                {
                    regiondata.Terrain = data;
                }
                else if (filePath.StartsWith("newstylerevertterrain/"))
                {
                    regiondata.RevertTerrain = data;
                }
                else if (filePath.StartsWith("newstylewater/"))
                {
                    regiondata.Water = data;
                }
                else if (filePath.StartsWith("newstylerevertwater/"))
                {
                    regiondata.RevertWater = data;
                }
                else if (filePath.StartsWith("entities/"))
                {
                    groups.Enqueue(data);
                }
                else if (filePath.StartsWith("regioninfo/"))
                {
                    RegionInfo info = new RegionInfo();
                    info.FromOSD((OSDMap) OSDParser.DeserializeLLSDBinary(data));
                    regiondata.RegionInfo = info;
                }
                data = null;
            }
            m_loadStream.Close();
            m_loadStream = null;

            int threadCount = groups.Count > 16 ? 16 : groups.Count;
            System.Threading.Thread[] threads = new System.Threading.Thread[threadCount];
            for (int i = 0; i < threadCount; i++)
            {
                threads[i] = new System.Threading.Thread(() =>
                                                             {
                                                                 byte[] groupData;
                                                                 while (groups.TryDequeue(out groupData))
                                                                 {
                                                                     MemoryStream ms = new MemoryStream(groupData);
                                                                     ISceneEntity sceneObject =
                                                                         SceneEntitySerializer.SceneObjectSerializer
                                                                                              .FromXml2Format(ref ms,
                                                                                                              null);
                                                                     ms.Close();
                                                                     ms = null;
                                                                     data = null;
                                                                     if (sceneObject != null)
                                                                     {
                                                                         foreach (
                                                                             ISceneChildEntity part in
                                                                                 sceneObject.ChildrenEntities())
                                                                         {
                                                                             lock (foundLocalIDs)
                                                                             {
                                                                                 if (
                                                                                     !foundLocalIDs.Contains(
                                                                                         part.LocalId))
                                                                                     foundLocalIDs.Add(part.LocalId);
                                                                                 else
                                                                                     part.LocalId = 0;
                                                                                         //Reset it! Only use it once!
                                                                             }
                                                                         }
                                                                         regiondata.Groups.Add(
                                                                             sceneObject as SceneObjectGroup);
                                                                     }
                                                                 }
                                                             });
                threads[i].Start();
            }
            for (int i = 0; i < threadCount; i++)
                threads[i].Join();

            foundLocalIDs.Clear();

            return regiondata;
        }
 public bool PreprocessIncomingLandObjectFromStorage(LandData data, Vector2 parcelOffset)
 {
     ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
     new_land.LandData = data;
     return SetLandBitmapFromByteArray(new_land, false, parcelOffset);
 }
        /// <summary>
        /// Gets a parcel from the search database by Info UUID (the true cross instance parcel ID)
        /// </summary>
        /// <param name="ParcelID"></param>
        /// <returns></returns>
        public LandData GetParcelInfo(UUID InfoUUID)
        {
            //Get info about a specific parcel somewhere in the metaverse
            List<string> Query = GD.Query("InfoUUID", InfoUUID, "searchparcel", "*");
            //Cant find it, return
            if (Query.Count == 0)
                return null;

            //Parse and return
            LandData LandData = new LandData();
            LandData.RegionID = UUID.Parse(Query[0]);
            LandData.GlobalID = UUID.Parse(Query[1]);
            LandData.LocalID = int.Parse(Query[2]);
            LandData.UserLocation = new Vector3(float.Parse(Query[3]), float.Parse(Query[4]), float.Parse(Query[5]));
            LandData.Name = Query[6];
            LandData.Description = Query[7];
            LandData.Flags = uint.Parse(Query[8]);
            LandData.Dwell = int.Parse(Query[9]);
            LandData.InfoUUID = UUID.Parse(Query[10]);
            LandData.AuctionID = uint.Parse(Query[13]);
            LandData.Area = int.Parse(Query[14]);
            LandData.Maturity = int.Parse(Query[16]);
            LandData.OwnerID = UUID.Parse(Query[17]);
            LandData.GroupID = UUID.Parse(Query[18]);
            LandData.SnapshotID = UUID.Parse(Query[20]);
            return LandData;
        }
Example #53
0
        public static unsafe bool SetFile(string mulPath)
        {
            if (!String.IsNullOrEmpty(mulPath) && !File.Exists(mulPath))
            {
                return(false);
            }

            m_StringBuffer = new byte[20];

            using (FileStream fs = new FileStream(mulPath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                landheader = new int[512];
                int j = 0;
                m_LandData = new LandData[0x4000];

                byte[]   buffer  = new byte[fs.Length];
                GCHandle gc      = GCHandle.Alloc(buffer, GCHandleType.Pinned);
                long     currpos = 0;
                try
                {
                    fs.Read(buffer, 0, buffer.Length);

                    bool newmulFormat = Ultima.Secondary.Art.IsUOHS();

                    if (newmulFormat) // TileData после HS
                    {
                        for (int i = 0; i < 0x4000; i += 32)
                        {
                            IntPtr ptrheader = new IntPtr((long)gc.AddrOfPinnedObject() + currpos);
                            currpos        += 4;
                            landheader[j++] = (int)Marshal.PtrToStructure(ptrheader, typeof(int));

                            for (int count = 0; count < 32; ++count)
                            {
                                IntPtr ptr = new IntPtr((long)gc.AddrOfPinnedObject() + currpos);
                                currpos += sizeof(LandTileDataMul);
                                LandTileDataMul cur = (LandTileDataMul)Marshal.PtrToStructure(ptr, typeof(LandTileDataMul));
                                m_LandData[i + count] = new LandData(cur);
                            }
                        }
                    }
                    else // TileData до HS
                    {
                        for (int i = 0; i < 0x4000; i += 32)
                        {
                            IntPtr ptrheader = new IntPtr((long)gc.AddrOfPinnedObject() + currpos);
                            currpos        += 4;
                            landheader[j++] = (int)Marshal.PtrToStructure(ptrheader, typeof(int));

                            for (int count = 0; count < 32; ++count)
                            {
                                IntPtr ptr = new IntPtr((long)gc.AddrOfPinnedObject() + currpos);
                                currpos += sizeof(LandTileOldDataMul);
                                LandTileOldDataMul cur = (LandTileOldDataMul)Marshal.PtrToStructure(ptr, typeof(LandTileOldDataMul));
                                m_LandData[i + count] = new LandData(cur);
                            }
                        }
                    }


                    long remaining = buffer.Length - currpos;
                    int  itemlength;
                    if (remaining / 41 >= 0xF000)
                    {
                        itemlength = 0x10000;//0xFFDC;
                        itemheader = new int[512 * 4];
                    }
                    else if (remaining / 37 > 0x5000)
                    {
                        itemlength = 0x8000;
                        itemheader = new int[512 * 2];
                    }
                    else
                    {
                        itemlength = 0x4000;
                        itemheader = new int[512 * 1];
                    }

                    m_ItemData    = new ItemData[itemlength];
                    m_HeightTable = new int[itemlength];

                    j = 0;
                    if (newmulFormat) // TileData после HS
                    {
                        for (int i = 0; i < itemlength; i += 32)
                        {
                            IntPtr ptrheader = new IntPtr((long)gc.AddrOfPinnedObject() + currpos);
                            currpos        += 4;
                            itemheader[j++] = (int)Marshal.PtrToStructure(ptrheader, typeof(int));
                            for (int count = 0; count < 32; ++count)
                            {
                                IntPtr ptr = new IntPtr((long)gc.AddrOfPinnedObject() + currpos);
                                currpos += sizeof(ItemTileDataMul);
                                ItemTileDataMul cur = (ItemTileDataMul)Marshal.PtrToStructure(ptr, typeof(ItemTileDataMul));
                                m_ItemData[i + count]    = new ItemData(cur);
                                m_HeightTable[i + count] = cur.height;
                            }
                        }
                    }
                    else // TileData до HS
                    {
                        for (int i = 0; i < itemlength; i += 32)
                        {
                            IntPtr ptrheader = new IntPtr((long)gc.AddrOfPinnedObject() + currpos);
                            currpos        += 4;
                            itemheader[j++] = (int)Marshal.PtrToStructure(ptrheader, typeof(int));
                            for (int count = 0; count < 32; ++count)
                            {
                                IntPtr ptr = new IntPtr((long)gc.AddrOfPinnedObject() + currpos);
                                currpos += sizeof(ItemTileOldDataMul);
                                ItemTileOldDataMul cur = (ItemTileOldDataMul)Marshal.PtrToStructure(ptr, typeof(ItemTileOldDataMul));
                                m_ItemData[i + count]    = new ItemData(cur);
                                m_HeightTable[i + count] = cur.height;
                            }
                        }
                    }
                }
                finally
                {
                    gc.Free();
                }
                return(true);
            }
        }
        private static List<LandData> Query2LandData(List<string> Query)
        {
            List<LandData> Lands = new List<LandData>();

            LandData LandData;

            for (int i = 0; i < Query.Count; i += 23)
            {
                LandData = new LandData();
                LandData.RegionID = UUID.Parse(Query[i]);
                LandData.GlobalID = UUID.Parse(Query[i + 1]);
                LandData.LocalID = int.Parse(Query[i + 2]);
                LandData.UserLocation = new Vector3(float.Parse(Query[i + 3]), float.Parse(Query[i + 4]),
                                                    float.Parse(Query[i + 5]));
                LandData.Name = Query[i + 6];
                LandData.Description = Query[i + 7];
                LandData.Flags = uint.Parse(Query[i + 8]);
                LandData.Dwell = int.Parse(Query[i + 9]);
                LandData.InfoUUID = UUID.Parse(Query[i + 10]);
                LandData.AuctionID = uint.Parse(Query[i + 13]);
                LandData.Area = int.Parse(Query[i + 14]);
                LandData.Maturity = int.Parse(Query[i + 16]);
                LandData.OwnerID = UUID.Parse(Query[i + 17]);
                LandData.GroupID = UUID.Parse(Query[i + 18]);
                LandData.SnapshotID = UUID.Parse(Query[i + 20]);
                try
                {
                    LandData.Bitmap = OSDParser.DeserializeLLSDXml(Query[i + 21]);
                }
                catch
                {
                }
                LandData.Category = (Query[i + 22] == string.Empty) ? ParcelCategory.None : (ParcelCategory)int.Parse(Query[i + 22]);

                Lands.Add(LandData);
            }
            return Lands;
        }
Example #55
0
 public void SendLandObjectOwners(LandData land, List <UUID> groups, Dictionary <UUID, int> ownersAndCount)
 {
 }
Example #56
0
            public void LoadModuleFromArchive(byte[] data, string filePath, TarArchiveReader.TarEntryType type,
                IScene scene)
            {
                if (filePath.StartsWith("parcels/"))
                {
                    if (!m_merge)
                    {
                        //Only use if we are not merging
                        LandData parcel = new LandData();
                        OSD parcelData = OSDParser.DeserializeLLSDBinary(data);
                        parcel.FromOSD((OSDMap) parcelData);
                        m_parcels.Add(parcel);
                    }
                }
                    #region New Style Terrain Loading

                else if (filePath.StartsWith("newstyleterrain/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
                    terrainModule.TerrainMap = ReadTerrain(data, scene);
                }
                else if (filePath.StartsWith("newstylerevertterrain/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
                    terrainModule.TerrainRevertMap = ReadTerrain(data, scene);
                }
                else if (filePath.StartsWith("newstylewater/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
                    terrainModule.TerrainWaterMap = ReadTerrain(data, scene);
                }
                else if (filePath.StartsWith("newstylerevertwater/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
                    terrainModule.TerrainWaterRevertMap = ReadTerrain(data, scene);
                }
                    #endregion
                    #region Old Style Terrain Loading

                else if (filePath.StartsWith("terrain/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();

                    MemoryStream ms = new MemoryStream(data);
                    terrainModule.LoadFromStream(filePath, ms, 0, 0);
                    ms.Close();
                }
                else if (filePath.StartsWith("revertterrain/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();

                    MemoryStream ms = new MemoryStream(data);
                    terrainModule.LoadRevertMapFromStream(filePath, ms, 0, 0);
                    ms.Close();
                }
                else if (filePath.StartsWith("water/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();

                    MemoryStream ms = new MemoryStream(data);
                    terrainModule.LoadWaterFromStream(filePath, ms, 0, 0);
                    ms.Close();
                }
                else if (filePath.StartsWith("revertwater/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();

                    MemoryStream ms = new MemoryStream(data);
                    terrainModule.LoadWaterRevertMapFromStream(filePath, ms, 0, 0);
                    ms.Close();
                }
                    #endregion

                else if (filePath.StartsWith("entities/"))
                {
                    MemoryStream ms = new MemoryStream(data);
                    ISceneEntity sceneObject = SceneEntitySerializer.SceneObjectSerializer.FromXml2Format(ref ms, scene);
                    ms.Close();
                    ms = null;
                    data = null;
                    m_groups.Add(sceneObject);
                }
                else if (filePath.StartsWith("assets/"))
                {
                    if (m_loadAssets)
                    {
                        AssetBase asset = new AssetBase();
                        asset.Unpack(OSDParser.DeserializeJson(Encoding.UTF8.GetString(data)));
                        scene.AssetService.Store(asset);
                    }
                }
            }
Example #57
0
            public void LoadModuleFromArchive(byte[] data, string filePath, TarArchiveReader.TarEntryType type, IScene scene)
            {
                if (filePath.StartsWith("parcels/"))
                {
                    if (!m_merge)
                    {
                        //Only use if we are not merging
                        LandData parcel = new LandData();
                        OSD parcelData = OSDParser.DeserializeLLSDBinary(data);
                        parcel.FromOSD((OSDMap)parcelData);
                        m_parcels.Add(parcel);
                    }
                }
                #region New Style Terrain Loading
                else if (filePath.StartsWith ("newstyleterrain/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
                    terrainModule.TerrainMap = ReadTerrain(data, scene);
                }
                else if (filePath.StartsWith ("newstylerevertterrain/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
                    terrainModule.TerrainRevertMap = ReadTerrain(data, scene);
                }
                else if (filePath.StartsWith ("newstylewater/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
                    terrainModule.TerrainWaterMap = ReadTerrain(data, scene);
                }
                else if (filePath.StartsWith ("newstylerevertwater/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
                    terrainModule.TerrainWaterRevertMap = ReadTerrain(data, scene);
                }
                #endregion
                else if (filePath.StartsWith ("terrain/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();

                    MemoryStream ms = new MemoryStream (data);
                    terrainModule.LoadFromStream (filePath, ms, 0, 0);
                    ms.Close ();
                }
                else if (filePath.StartsWith ("revertterrain/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();

                    MemoryStream ms = new MemoryStream (data);
                    terrainModule.LoadRevertMapFromStream (filePath, ms, 0, 0);
                    ms.Close ();
                }
                else if (filePath.StartsWith ("water/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();

                    MemoryStream ms = new MemoryStream (data);
                    terrainModule.LoadWaterFromStream (filePath, ms, 0, 0);
                    ms.Close ();
                }
                else if (filePath.StartsWith ("revertwater/"))
                {
                    ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();

                    MemoryStream ms = new MemoryStream (data);
                    terrainModule.LoadWaterRevertMapFromStream (filePath, ms, 0, 0);
                    ms.Close ();
                }
                else if (filePath.StartsWith ("entities/"))
                {
                    MemoryStream ms = new MemoryStream (data);
                    SceneObjectGroup sceneObject = OpenSim.Region.Framework.Scenes.Serialization.SceneObjectSerializer.FromXml2Format (ref ms, scene);
                    ms.Close ();
                    ms = null;
                    data = null;
                    foreach(ISceneChildEntity part in sceneObject.ChildrenEntities())
                    {
                        if (!ResolveUserUuid (part.CreatorID))
                            part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;

                        if (!ResolveUserUuid (part.OwnerID))
                            part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;

                        if (!ResolveUserUuid (part.LastOwnerID))
                            part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;

                        // Fix ownership/creator of inventory items
                        // Not doing so results in inventory items
                        // being no copy/no mod for everyone
                        lock (part.TaskInventory)
                        {
                            TaskInventoryDictionary inv = part.TaskInventory;
                            foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
                            {
                                if (!ResolveUserUuid (kvp.Value.OwnerID))
                                {
                                    kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
                                }
                                if (!ResolveUserUuid (kvp.Value.CreatorID))
                                {
                                    kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
                                }
                            }
                        }
                    }

                    if(scene.SceneGraph.AddPrimToScene(sceneObject))
                    {
                        sceneObject.HasGroupChanged = true;
                        sceneObject.ScheduleGroupUpdate (PrimUpdateFlags.ForcedFullUpdate);
                        sceneObject.CreateScriptInstances(0, false, StateSource.RegionStart, UUID.Zero);
                        sceneObject.ResumeScripts ();
                    }
                }
                else if(filePath.StartsWith("assets/"))
                {
                    if(m_loadAssets)
                    {
                        AssetBase asset = new AssetBase();
                        asset.Unpack(OSDParser.DeserializeJson(UTF8Encoding.UTF8.GetString(data)));
                        bool exists = scene.AssetService.Get(asset.IDString) != null;
                        if(!exists && asset != null)
                            scene.AssetService.Store(asset);
                    }
                }
            }
        /// <summary>
        /// Gets a parcel from the search database by Info UUID (the true cross instance parcel ID)
        /// </summary>
        /// <param name="ParcelID"></param>
        /// <returns></returns>
        public LandData GetParcelInfo(UUID InfoUUID)
        {
            //Split the InfoUUID so that we get the regions, we'll check for positions in a bit
            int RegionX, RegionY;
            uint X, Y;
            ulong RegionHandle;
            Util.ParseFakeParcelID (InfoUUID, out RegionHandle, out X, out Y);

            Util.UlongToInts (RegionHandle, out RegionX, out RegionY);

            OpenSim.Services.Interfaces.GridRegion r = m_registry.RequestModuleInterface<IGridService> ().GetRegionByPosition (UUID.Zero, (int)RegionX, (int)RegionY);
            if (r == null)
            {
                m_log.Warn("[DirectoryService]: Could not find region for ParcelID: " + InfoUUID);
                return null;
            }
            //Get info about a specific parcel somewhere in the metaverse
            List<string> Query = GD.Query("RegionID", r.RegionID, "searchparcel", "*");
            //Cant find it, return
            if (Query.Count == 0)
                return null;

            List<LandData> Lands = new List<LandData>();
            //Parse and return
            LandData LandData = new LandData();
            //Add all the parcels belonging to the owner to the list
            for (int i = 0; i < Query.Count; i += 22)
            {
                LandData.RegionID = UUID.Parse(Query[i]);
                LandData.GlobalID = UUID.Parse(Query[i + 1]);
                LandData.LocalID = int.Parse(Query[i + 2]);
                LandData.UserLocation = new Vector3(float.Parse(Query[i + 3]), float.Parse(Query[i + 4]), float.Parse(Query[i + 5]));
                LandData.Name = Query[i + 6];
                LandData.Description = Query[i + 7];
                LandData.Flags = uint.Parse(Query[i + 8]);
                LandData.Dwell = int.Parse(Query[i + 9]);
                LandData.InfoUUID = UUID.Parse(Query[i + 10]);
                LandData.AuctionID = uint.Parse(Query[i + 13]);
                LandData.Area = int.Parse(Query[i + 14]);
                LandData.Maturity = int.Parse(Query[i + 16]);
                LandData.OwnerID = UUID.Parse(Query[i + 17]);
                LandData.GroupID = UUID.Parse(Query[i + 18]);
                LandData.SnapshotID = UUID.Parse(Query[i + 20]);
                try
                {
                    LandData.Bitmap = OSDParser.DeserializeLLSDXml(Query[i + 21]);
                }
                catch
                {
                }

                Lands.Add(LandData);
                LandData = new LandData();
            }
            LandData = null;
            
            bool[,] tempConvertMap = new bool[r.RegionSizeX / 4, r.RegionSizeX / 4];
            tempConvertMap.Initialize();
            foreach (LandData land in Lands)
            {
                if (land.Bitmap == null)
                    continue;
                ConvertBytesToLandBitmap(ref tempConvertMap, land.Bitmap, r.RegionSizeX);
                if (tempConvertMap[X / 64, Y / 64])
                {
                    LandData = land;
                    break;
                }
            }
            if (LandData == null && Lands.Count != 0)
                LandData = Lands[0];
            return LandData;
        }
Example #59
0
        /// <summary>
        ///   Reify/deserialize landData
        /// </summary>
        /// <param name = "serializedLandData"></param>
        /// <returns></returns>
        /// <exception cref = "System.Xml.XmlException"></exception>
        public static LandData Deserialize(string serializedLandData)
        {
            LandData landData = new LandData();

            StringReader  sr  = new StringReader(serializedLandData);
            XmlTextReader xtr = new XmlTextReader(sr);

            xtr.ReadStartElement("LandData");

            landData.Area           = Convert.ToInt32(xtr.ReadElementString("Area"));
            landData.AuctionID      = Convert.ToUInt32(xtr.ReadElementString("AuctionID"));
            landData.AuthBuyerID    = UUID.Parse(xtr.ReadElementString("AuthBuyerID"));
            landData.Category       = (ParcelCategory)Convert.ToSByte(xtr.ReadElementString("Category"));
            landData.ClaimDate      = Convert.ToInt32(xtr.ReadElementString("ClaimDate"));
            landData.ClaimPrice     = Convert.ToInt32(xtr.ReadElementString("ClaimPrice"));
            landData.GlobalID       = UUID.Parse(xtr.ReadElementString("GlobalID"));
            landData.GroupID        = UUID.Parse(xtr.ReadElementString("GroupID"));
            landData.IsGroupOwned   = Convert.ToBoolean(xtr.ReadElementString("IsGroupOwned"));
            landData.Bitmap         = Convert.FromBase64String(xtr.ReadElementString("Bitmap"));
            landData.Description    = xtr.ReadElementString("Description");
            landData.Flags          = Convert.ToUInt32(xtr.ReadElementString("Flags"));
            landData.LandingType    = Convert.ToByte(xtr.ReadElementString("LandingType"));
            landData.Name           = xtr.ReadElementString("Name");
            landData.Status         = (ParcelStatus)Convert.ToSByte(xtr.ReadElementString("Status"));
            landData.LocalID        = Convert.ToInt32(xtr.ReadElementString("LocalID"));
            landData.MediaAutoScale = Convert.ToByte(xtr.ReadElementString("MediaAutoScale"));
            landData.MediaID        = UUID.Parse(xtr.ReadElementString("MediaID"));
            landData.MediaURL       = xtr.ReadElementString("MediaURL");
            landData.MusicURL       = xtr.ReadElementString("MusicURL");
            landData.OwnerID        = UUID.Parse(xtr.ReadElementString("OwnerID"));

            landData.ParcelAccessList = new List <ParcelManager.ParcelAccessEntry>();
            xtr.Read();
            if (xtr.Name != "ParcelAccessList")
            {
                throw new XmlException(String.Format("Expected \"ParcelAccessList\" element but got \"{0}\"", xtr.Name));
            }

            if (!xtr.IsEmptyElement)
            {
                while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
                {
                    ParcelManager.ParcelAccessEntry pae = new ParcelManager.ParcelAccessEntry();

                    xtr.ReadStartElement("ParcelAccessEntry");
                    pae.AgentID = UUID.Parse(xtr.ReadElementString("AgentID"));
                    pae.Time    = Convert.ToDateTime(xtr.ReadElementString("Time"));
                    pae.Flags   = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList"));
                    xtr.ReadEndElement();

                    landData.ParcelAccessList.Add(pae);
                }
            }
            xtr.Read();

            landData.PassHours    = Convert.ToSingle(xtr.ReadElementString("PassHours"));
            landData.PassPrice    = Convert.ToInt32(xtr.ReadElementString("PassPrice"));
            landData.SalePrice    = Convert.ToInt32(xtr.ReadElementString("SalePrice"));
            landData.SnapshotID   = UUID.Parse(xtr.ReadElementString("SnapshotID"));
            landData.UserLocation = Vector3.Parse(xtr.ReadElementString("UserLocation"));
            landData.UserLookAt   = Vector3.Parse(xtr.ReadElementString("UserLookAt"));
            // No longer used here
            xtr.ReadElementString("Dwell");
            landData.OtherCleanTime = Convert.ToInt32(xtr.ReadElementString("OtherCleanTime"));

            xtr.ReadEndElement();

            xtr.Close();
            sr.Close();

            return(landData);
        }
 public void IncomingLandObjectFromStorage(LandData data)
 {
     ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
     new_land.LandData = data;
     new_land.SetLandBitmapFromByteArray();
     new_land.SetInfoID();
     AddLandObject(new_land);
 }