29 using System.Collections.Generic;
33 using System.Reflection;
34 using System.Threading;
36 using MySql.Data.MySqlClient;
38 using OpenSim.Framework;
39 using OpenSim.Region.Framework.Interfaces;
40 using OpenSim.Region.Framework.Scenes;
43 namespace OpenSim.Data.MySQL
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private static string LogHeader =
"[REGION DB MYSQL]";
53 private string m_connectionString;
63 private object m_dbLock =
new object();
65 protected virtual Assembly Assembly
67 get {
return GetType().Assembly; }
76 Initialise(connectionString);
81 m_connectionString = connectionString;
83 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
94 private IDataReader ExecuteReader(MySqlCommand c)
100 r = c.ExecuteReader();
104 m_log.ErrorFormat(
"{0} MySQL error in ExecuteReader: {1}", LogHeader, e);
111 private void ExecuteNonQuery(MySqlCommand c)
119 m_log.Error(
"[REGION DB]: MySQL error in ExecuteNonQuery: " + e.Message);
128 uint flags = obj.RootPart.GetEffectiveObjectFlags();
136 if ((flags & (uint)
PrimFlags.TemporaryOnRez) != 0)
141 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
145 using (MySqlCommand cmd = dbcon.CreateCommand())
149 cmd.Parameters.Clear();
151 cmd.CommandText =
"replace into prims (" +
152 "UUID, CreationDate, " +
153 "Name, Text, Description, " +
154 "SitName, TouchName, ObjectFlags, " +
155 "OwnerMask, NextOwnerMask, GroupMask, " +
156 "EveryoneMask, BaseMask, PositionX, " +
157 "PositionY, PositionZ, GroupPositionX, " +
158 "GroupPositionY, GroupPositionZ, VelocityX, " +
159 "VelocityY, VelocityZ, AngularVelocityX, " +
160 "AngularVelocityY, AngularVelocityZ, " +
161 "AccelerationX, AccelerationY, " +
162 "AccelerationZ, RotationX, " +
163 "RotationY, RotationZ, " +
164 "RotationW, SitTargetOffsetX, " +
165 "SitTargetOffsetY, SitTargetOffsetZ, " +
166 "SitTargetOrientW, SitTargetOrientX, " +
167 "SitTargetOrientY, SitTargetOrientZ, " +
168 "RegionUUID, CreatorID, " +
169 "OwnerID, GroupID, " +
170 "LastOwnerID, SceneGroupID, " +
171 "PayPrice, PayButton1, " +
172 "PayButton2, PayButton3, " +
173 "PayButton4, LoopedSound, " +
174 "LoopedSoundGain, TextureAnimation, " +
175 "OmegaX, OmegaY, OmegaZ, " +
176 "CameraEyeOffsetX, CameraEyeOffsetY, " +
177 "CameraEyeOffsetZ, CameraAtOffsetX, " +
178 "CameraAtOffsetY, CameraAtOffsetZ, " +
179 "ForceMouselook, ScriptAccessPin, " +
180 "AllowedDrop, DieAtEdge, " +
181 "SalePrice, SaleType, " +
182 "ColorR, ColorG, ColorB, ColorA, " +
183 "ParticleSystem, ClickAction, Material, " +
184 "CollisionSound, CollisionSoundVolume, " +
187 "LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " +
188 "AttachedPosY, AttachedPosZ, " +
189 "PhysicsShapeType, Density, GravityModifier, " +
190 "Friction, Restitution, Vehicle, DynAttrs, " +
191 "RotationAxisLocks" +
192 ") values (" +
"?UUID, " +
193 "?CreationDate, ?Name, ?Text, " +
194 "?Description, ?SitName, ?TouchName, " +
195 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
196 "?GroupMask, ?EveryoneMask, ?BaseMask, " +
197 "?PositionX, ?PositionY, ?PositionZ, " +
198 "?GroupPositionX, ?GroupPositionY, " +
199 "?GroupPositionZ, ?VelocityX, " +
200 "?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
201 "?AngularVelocityY, ?AngularVelocityZ, " +
202 "?AccelerationX, ?AccelerationY, " +
203 "?AccelerationZ, ?RotationX, " +
204 "?RotationY, ?RotationZ, " +
205 "?RotationW, ?SitTargetOffsetX, " +
206 "?SitTargetOffsetY, ?SitTargetOffsetZ, " +
207 "?SitTargetOrientW, ?SitTargetOrientX, " +
208 "?SitTargetOrientY, ?SitTargetOrientZ, " +
209 "?RegionUUID, ?CreatorID, ?OwnerID, " +
210 "?GroupID, ?LastOwnerID, ?SceneGroupID, " +
211 "?PayPrice, ?PayButton1, ?PayButton2, " +
212 "?PayButton3, ?PayButton4, ?LoopedSound, " +
213 "?LoopedSoundGain, ?TextureAnimation, " +
214 "?OmegaX, ?OmegaY, ?OmegaZ, " +
215 "?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
216 "?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
217 "?CameraAtOffsetY, ?CameraAtOffsetZ, " +
218 "?ForceMouselook, ?ScriptAccessPin, " +
219 "?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
220 "?SaleType, ?ColorR, ?ColorG, " +
221 "?ColorB, ?ColorA, ?ParticleSystem, " +
222 "?ClickAction, ?Material, ?CollisionSound, " +
223 "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " +
224 "?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " +
225 "?AttachedPosY, ?AttachedPosZ, " +
226 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
227 "?Friction, ?Restitution, ?Vehicle, ?DynAttrs," +
228 "?RotationAxisLocks)";
230 FillPrimCommand(cmd, prim, obj.
UUID, regionUUID);
232 ExecuteNonQuery(cmd);
234 cmd.Parameters.Clear();
236 cmd.CommandText =
"replace into primshapes (" +
237 "UUID, Shape, ScaleX, ScaleY, " +
238 "ScaleZ, PCode, PathBegin, PathEnd, " +
239 "PathScaleX, PathScaleY, PathShearX, " +
240 "PathShearY, PathSkew, PathCurve, " +
241 "PathRadiusOffset, PathRevolutions, " +
242 "PathTaperX, PathTaperY, PathTwist, " +
243 "PathTwistBegin, ProfileBegin, ProfileEnd, " +
244 "ProfileCurve, ProfileHollow, Texture, " +
245 "ExtraParams, State, LastAttachPoint, Media) " +
247 "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
248 "?PCode, ?PathBegin, ?PathEnd, " +
249 "?PathScaleX, ?PathScaleY, " +
250 "?PathShearX, ?PathShearY, " +
251 "?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
252 "?PathRevolutions, ?PathTaperX, " +
253 "?PathTaperY, ?PathTwist, " +
254 "?PathTwistBegin, ?ProfileBegin, " +
255 "?ProfileEnd, ?ProfileCurve, " +
256 "?ProfileHollow, ?Texture, ?ExtraParams, " +
257 "?State, ?LastAttachPoint, ?Media)";
259 FillShapeCommand(cmd, prim);
261 ExecuteNonQuery(cmd);
272 List<UUID> uuids =
new List<UUID>();
284 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
288 using (MySqlCommand cmd = dbcon.CreateCommand())
290 cmd.CommandText =
"select UUID from prims where SceneGroupID= ?UUID";
291 cmd.Parameters.AddWithValue(
"UUID", obj.ToString());
293 using (IDataReader reader = ExecuteReader(cmd))
295 while (reader.Read())
296 uuids.Add(DBGuid.FromDB(reader[
"UUID"].ToString()));
300 cmd.CommandText =
"delete from prims where SceneGroupID= ?UUID";
301 ExecuteNonQuery(cmd);
321 private void RemoveItems(UUID uuid)
326 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
330 using (MySqlCommand cmd = dbcon.CreateCommand())
332 cmd.CommandText =
"delete from primitems where PrimID = ?PrimID";
333 cmd.Parameters.AddWithValue(
"PrimID", uuid.ToString());
335 ExecuteNonQuery(cmd);
346 private void RemoveShapes(List<UUID> uuids)
350 string sql =
"delete from primshapes where ";
351 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
355 using (MySqlCommand cmd = dbcon.CreateCommand())
357 for (
int i = 0; i < uuids.Count; i++)
359 if ((i + 1) == uuids.Count)
361 sql +=
"(UUID = ?UUID" + i +
")";
365 sql +=
"(UUID = ?UUID" + i +
") or ";
368 cmd.CommandText = sql;
370 for (
int i = 0; i < uuids.Count; i++)
371 cmd.Parameters.AddWithValue(
"UUID" + i, uuids[i].ToString());
373 ExecuteNonQuery(cmd);
384 private void RemoveItems(List<UUID> uuids)
388 string sql =
"delete from primitems where ";
389 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
393 using (MySqlCommand cmd = dbcon.CreateCommand())
395 for (
int i = 0; i < uuids.Count; i++)
397 if ((i + 1) == uuids.Count)
400 sql +=
"(PrimID = ?PrimID" + i +
")";
404 sql +=
"(PrimID = ?PrimID" + i +
") or ";
407 cmd.CommandText = sql;
409 for (
int i = 0; i < uuids.Count; i++)
410 cmd.Parameters.AddWithValue(
"PrimID" + i, uuids[i].ToString());
412 ExecuteNonQuery(cmd);
420 const int ROWS_PER_QUERY = 5000;
422 Dictionary<UUID, SceneObjectPart> prims =
new Dictionary<UUID, SceneObjectPart>(ROWS_PER_QUERY);
423 Dictionary<UUID, SceneObjectGroup> objects =
new Dictionary<UUID, SceneObjectGroup>();
430 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
434 using (MySqlCommand cmd = dbcon.CreateCommand())
437 "SELECT * FROM prims LEFT JOIN primshapes ON prims.UUID = primshapes.UUID WHERE RegionUUID = ?RegionUUID";
438 cmd.Parameters.AddWithValue(
"RegionUUID", regionID.ToString());
439 cmd.CommandTimeout = 3600;
441 using (IDataReader reader = ExecuteReader(cmd))
443 while (reader.Read())
446 if (reader[
"Shape"] is DBNull)
447 prim.Shape = PrimitiveBaseShape.Default;
449 prim.Shape = BuildShape(reader);
451 UUID parentID = DBGuid.FromDB(reader[
"SceneGroupID"].ToString());
452 if (parentID != prim.
UUID)
453 prim.ParentUUID = parentID;
455 prims[prim.UUID] = prim;
458 if (count % ROWS_PER_QUERY == 0)
459 m_log.Debug(
"[REGION DB]: Loaded " + count +
" prims...");
466 #endregion Prim Loading
468 #region SceneObjectGroup Creation
485 if (objects.TryGetValue(prim.
ParentUUID, out sog))
487 int originalLinkNum = prim.LinkNum;
493 if (originalLinkNum != 0)
494 prim.LinkNum = originalLinkNum;
499 "[REGION DB]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.",
500 prim.Name, prim.UUID, regionID, prim.ParentUUID);
505 #endregion SceneObjectGroup Creation
507 m_log.DebugFormat(
"[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count);
509 #region Prim Inventory Loading
515 List<SceneObjectPart> primsWithInventory =
new List<SceneObjectPart>();
518 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
522 using (MySqlCommand itemCmd = dbcon.CreateCommand())
524 itemCmd.CommandText =
"SELECT DISTINCT primID FROM primitems";
525 using (IDataReader itemReader = ExecuteReader(itemCmd))
527 while (itemReader.Read())
529 if (!(itemReader[
"primID"] is DBNull))
531 UUID primID = DBGuid.FromDB(itemReader[
"primID"].ToString());
532 if (prims.ContainsKey(primID))
533 primsWithInventory.Add(prims[primID]);
546 #endregion Prim Inventory Loading
548 m_log.DebugFormat(
"[REGION DB]: Loaded inventory from {0} objects", primsWithInventory.Count);
550 return new List<SceneObjectGroup>(objects.Values);
561 List<TaskInventoryItem> inventory =
new List<TaskInventoryItem>();
563 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
567 using (MySqlCommand cmd = dbcon.CreateCommand())
569 cmd.CommandText =
"select * from primitems where PrimID = ?PrimID";
570 cmd.Parameters.AddWithValue(
"PrimID", prim.UUID.ToString());
572 using (IDataReader reader = ExecuteReader(cmd))
574 while (reader.Read())
578 item.ParentID = prim.UUID;
585 prim.Inventory.RestoreInventoryItems(inventory);
597 Util.FireAndForget(delegate(
object x)
599 m_log.Info(
"[REGION DB]: Storing terrain");
603 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
607 using (MySqlCommand cmd = dbcon.CreateCommand())
609 cmd.CommandText =
"delete from terrain where RegionUUID = ?RegionUUID";
610 cmd.Parameters.AddWithValue(
"RegionUUID", regionID.ToString());
612 using (MySqlCommand cmd2 = dbcon.CreateCommand())
616 cmd2.CommandText =
"insert into terrain (RegionUUID, " +
617 "Revision, Heightfield) values (?RegionUUID, " +
618 "?Revision, ?Heightfield)";
620 int terrainDBRevision;
622 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
624 cmd2.Parameters.AddWithValue(
"RegionUUID", regionID.ToString());
625 cmd2.Parameters.AddWithValue(
"Revision", terrainDBRevision);
626 cmd2.Parameters.AddWithValue(
"Heightfield", terrainDBblob);
628 ExecuteNonQuery(cmd);
629 ExecuteNonQuery(cmd2);
633 m_log.ErrorFormat(e.ToString());
645 double[,] ret = null;
647 if (terrData != null)
648 ret = terrData.GetDoubles();
659 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
663 using (MySqlCommand cmd = dbcon.CreateCommand())
665 cmd.CommandText =
"select RegionUUID, Revision, Heightfield " +
666 "from terrain where RegionUUID = ?RegionUUID " +
667 "order by Revision desc limit 1";
668 cmd.Parameters.AddWithValue(
"RegionUUID", regionID.ToString());
670 using (IDataReader reader = ExecuteReader(cmd))
672 while (reader.Read())
674 int rev = Convert.ToInt32(reader[
"Revision"]);
675 if ((reader[
"Heightfield"] != DBNull.Value))
677 byte[] blob = (byte[])reader[
"Heightfield"];
678 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
693 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
697 using (MySqlCommand cmd = dbcon.CreateCommand())
699 cmd.CommandText =
"delete from land where UUID = ?UUID";
700 cmd.Parameters.AddWithValue(
"UUID", globalID.ToString());
702 ExecuteNonQuery(cmd);
712 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
716 using (MySqlCommand cmd = dbcon.CreateCommand())
718 cmd.CommandText =
"replace into land (UUID, RegionUUID, " +
719 "LocalLandID, Bitmap, Name, Description, " +
720 "OwnerUUID, IsGroupOwned, Area, AuctionID, " +
721 "Category, ClaimDate, ClaimPrice, GroupUUID, " +
722 "SalePrice, LandStatus, LandFlags, LandingType, " +
723 "MediaAutoScale, MediaTextureUUID, MediaURL, " +
724 "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
725 "UserLocationX, UserLocationY, UserLocationZ, " +
726 "UserLookAtX, UserLookAtY, UserLookAtZ, " +
727 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
728 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " +
729 "SeeAVs, AnyAVSounds, GroupAVSounds) values (" +
730 "?UUID, ?RegionUUID, " +
731 "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
732 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
733 "?Category, ?ClaimDate, ?ClaimPrice, ?GroupUUID, " +
734 "?SalePrice, ?LandStatus, ?LandFlags, ?LandingType, " +
735 "?MediaAutoScale, ?MediaTextureUUID, ?MediaURL, " +
736 "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
737 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
738 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
739 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
740 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia, " +
741 "?SeeAVs, ?AnyAVSounds, ?GroupAVSounds)";
745 ExecuteNonQuery(cmd);
747 cmd.CommandText =
"delete from landaccesslist where LandUUID = ?UUID";
749 ExecuteNonQuery(cmd);
751 cmd.Parameters.Clear();
752 cmd.CommandText =
"insert into landaccesslist (LandUUID, " +
753 "AccessUUID, Flags, Expires) values (?LandUUID, ?AccessUUID, " +
759 ExecuteNonQuery(cmd);
760 cmd.Parameters.Clear();
770 nWP.OnSave += StoreRegionWindlightSettings;
772 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
776 string command =
"select * from `regionwindlight` where region_id = ?regionID";
778 using (MySqlCommand cmd =
new MySqlCommand(command))
780 cmd.Connection = dbcon;
782 cmd.Parameters.AddWithValue(
"?regionID", regionUUID.ToString());
784 IDataReader result = ExecuteReader(cmd);
788 nWP.regionID = regionUUID;
794 nWP.regionID = DBGuid.FromDB(result[
"region_id"]);
795 nWP.waterColor.X = Convert.ToSingle(result[
"water_color_r"]);
796 nWP.waterColor.Y = Convert.ToSingle(result[
"water_color_g"]);
797 nWP.waterColor.Z = Convert.ToSingle(result[
"water_color_b"]);
798 nWP.waterFogDensityExponent = Convert.ToSingle(result[
"water_fog_density_exponent"]);
799 nWP.underwaterFogModifier = Convert.ToSingle(result[
"underwater_fog_modifier"]);
800 nWP.reflectionWaveletScale.X = Convert.ToSingle(result[
"reflection_wavelet_scale_1"]);
801 nWP.reflectionWaveletScale.Y = Convert.ToSingle(result[
"reflection_wavelet_scale_2"]);
802 nWP.reflectionWaveletScale.Z = Convert.ToSingle(result[
"reflection_wavelet_scale_3"]);
803 nWP.fresnelScale = Convert.ToSingle(result[
"fresnel_scale"]);
804 nWP.fresnelOffset = Convert.ToSingle(result[
"fresnel_offset"]);
805 nWP.refractScaleAbove = Convert.ToSingle(result[
"refract_scale_above"]);
806 nWP.refractScaleBelow = Convert.ToSingle(result[
"refract_scale_below"]);
807 nWP.blurMultiplier = Convert.ToSingle(result[
"blur_multiplier"]);
808 nWP.bigWaveDirection.X = Convert.ToSingle(result[
"big_wave_direction_x"]);
809 nWP.bigWaveDirection.Y = Convert.ToSingle(result[
"big_wave_direction_y"]);
810 nWP.littleWaveDirection.X = Convert.ToSingle(result[
"little_wave_direction_x"]);
811 nWP.littleWaveDirection.Y = Convert.ToSingle(result[
"little_wave_direction_y"]);
812 UUID.TryParse(result[
"normal_map_texture"].ToString(), out nWP.
normalMapTexture);
813 nWP.horizon.X = Convert.ToSingle(result[
"horizon_r"]);
814 nWP.horizon.Y = Convert.ToSingle(result[
"horizon_g"]);
815 nWP.horizon.Z = Convert.ToSingle(result[
"horizon_b"]);
816 nWP.horizon.W = Convert.ToSingle(result[
"horizon_i"]);
817 nWP.hazeHorizon = Convert.ToSingle(result[
"haze_horizon"]);
818 nWP.blueDensity.X = Convert.ToSingle(result[
"blue_density_r"]);
819 nWP.blueDensity.Y = Convert.ToSingle(result[
"blue_density_g"]);
820 nWP.blueDensity.Z = Convert.ToSingle(result[
"blue_density_b"]);
821 nWP.blueDensity.W = Convert.ToSingle(result[
"blue_density_i"]);
822 nWP.hazeDensity = Convert.ToSingle(result[
"haze_density"]);
823 nWP.densityMultiplier = Convert.ToSingle(result[
"density_multiplier"]);
824 nWP.distanceMultiplier = Convert.ToSingle(result[
"distance_multiplier"]);
825 nWP.maxAltitude = Convert.ToUInt16(result[
"max_altitude"]);
826 nWP.sunMoonColor.X = Convert.ToSingle(result[
"sun_moon_color_r"]);
827 nWP.sunMoonColor.Y = Convert.ToSingle(result[
"sun_moon_color_g"]);
828 nWP.sunMoonColor.Z = Convert.ToSingle(result[
"sun_moon_color_b"]);
829 nWP.sunMoonColor.W = Convert.ToSingle(result[
"sun_moon_color_i"]);
830 nWP.sunMoonPosition = Convert.ToSingle(result[
"sun_moon_position"]);
831 nWP.ambient.X = Convert.ToSingle(result[
"ambient_r"]);
832 nWP.ambient.Y = Convert.ToSingle(result[
"ambient_g"]);
833 nWP.ambient.Z = Convert.ToSingle(result[
"ambient_b"]);
834 nWP.ambient.W = Convert.ToSingle(result[
"ambient_i"]);
835 nWP.eastAngle = Convert.ToSingle(result[
"east_angle"]);
836 nWP.sunGlowFocus = Convert.ToSingle(result[
"sun_glow_focus"]);
837 nWP.sunGlowSize = Convert.ToSingle(result[
"sun_glow_size"]);
838 nWP.sceneGamma = Convert.ToSingle(result[
"scene_gamma"]);
839 nWP.starBrightness = Convert.ToSingle(result[
"star_brightness"]);
840 nWP.cloudColor.X = Convert.ToSingle(result[
"cloud_color_r"]);
841 nWP.cloudColor.Y = Convert.ToSingle(result[
"cloud_color_g"]);
842 nWP.cloudColor.Z = Convert.ToSingle(result[
"cloud_color_b"]);
843 nWP.cloudColor.W = Convert.ToSingle(result[
"cloud_color_i"]);
844 nWP.cloudXYDensity.X = Convert.ToSingle(result[
"cloud_x"]);
845 nWP.cloudXYDensity.Y = Convert.ToSingle(result[
"cloud_y"]);
846 nWP.cloudXYDensity.Z = Convert.ToSingle(result[
"cloud_density"]);
847 nWP.cloudCoverage = Convert.ToSingle(result[
"cloud_coverage"]);
848 nWP.cloudScale = Convert.ToSingle(result[
"cloud_scale"]);
849 nWP.cloudDetailXYDensity.X = Convert.ToSingle(result[
"cloud_detail_x"]);
850 nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result[
"cloud_detail_y"]);
851 nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result[
"cloud_detail_density"]);
852 nWP.cloudScrollX = Convert.ToSingle(result[
"cloud_scroll_x"]);
853 nWP.cloudScrollXLock = Convert.ToBoolean(result[
"cloud_scroll_x_lock"]);
854 nWP.cloudScrollY = Convert.ToSingle(result[
"cloud_scroll_y"]);
855 nWP.cloudScrollYLock = Convert.ToBoolean(result[
"cloud_scroll_y_lock"]);
856 nWP.drawClassicClouds = Convert.ToBoolean(result[
"draw_classic_clouds"]);
871 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
875 using (MySqlCommand cmd = dbcon.CreateCommand())
877 cmd.CommandText =
"select * from regionsettings where regionUUID = ?RegionUUID";
878 cmd.Parameters.AddWithValue(
"regionUUID", regionUUID);
880 using (IDataReader reader = ExecuteReader(cmd))
884 rs = BuildRegionSettings(reader);
885 rs.OnSave += StoreRegionSettings;
890 rs.RegionUUID = regionUUID;
891 rs.OnSave += StoreRegionSettings;
893 StoreRegionSettings(rs);
907 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
911 using (MySqlCommand cmd = dbcon.CreateCommand())
913 cmd.CommandText =
"REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
914 cmd.CommandText +=
"`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
915 cmd.CommandText +=
"`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
916 cmd.CommandText +=
"`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
917 cmd.CommandText +=
"`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
918 cmd.CommandText +=
"`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
919 cmd.CommandText +=
"`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
920 cmd.CommandText +=
"`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
921 cmd.CommandText +=
"`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
922 cmd.CommandText +=
"`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
923 cmd.CommandText +=
"`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
924 cmd.CommandText +=
"`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
925 cmd.CommandText +=
"`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
926 cmd.CommandText +=
"`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
927 cmd.CommandText +=
"?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
928 cmd.CommandText +=
"?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
929 cmd.CommandText +=
"?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
930 cmd.CommandText +=
"?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
931 cmd.CommandText +=
"?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
932 cmd.CommandText +=
"?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
933 cmd.CommandText +=
"?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
934 cmd.CommandText +=
"?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
935 cmd.CommandText +=
"?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
936 cmd.CommandText +=
"?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
937 cmd.CommandText +=
"?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
939 cmd.Parameters.AddWithValue(
"region_id", wl.regionID);
940 cmd.Parameters.AddWithValue(
"water_color_r", wl.waterColor.X);
941 cmd.Parameters.AddWithValue(
"water_color_g", wl.waterColor.Y);
942 cmd.Parameters.AddWithValue(
"water_color_b", wl.waterColor.Z);
943 cmd.Parameters.AddWithValue(
"water_fog_density_exponent", wl.waterFogDensityExponent);
944 cmd.Parameters.AddWithValue(
"underwater_fog_modifier", wl.underwaterFogModifier);
945 cmd.Parameters.AddWithValue(
"reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
946 cmd.Parameters.AddWithValue(
"reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
947 cmd.Parameters.AddWithValue(
"reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
948 cmd.Parameters.AddWithValue(
"fresnel_scale", wl.fresnelScale);
949 cmd.Parameters.AddWithValue(
"fresnel_offset", wl.fresnelOffset);
950 cmd.Parameters.AddWithValue(
"refract_scale_above", wl.refractScaleAbove);
951 cmd.Parameters.AddWithValue(
"refract_scale_below", wl.refractScaleBelow);
952 cmd.Parameters.AddWithValue(
"blur_multiplier", wl.blurMultiplier);
953 cmd.Parameters.AddWithValue(
"big_wave_direction_x", wl.bigWaveDirection.X);
954 cmd.Parameters.AddWithValue(
"big_wave_direction_y", wl.bigWaveDirection.Y);
955 cmd.Parameters.AddWithValue(
"little_wave_direction_x", wl.littleWaveDirection.X);
956 cmd.Parameters.AddWithValue(
"little_wave_direction_y", wl.littleWaveDirection.Y);
957 cmd.Parameters.AddWithValue(
"normal_map_texture", wl.normalMapTexture);
958 cmd.Parameters.AddWithValue(
"horizon_r", wl.horizon.X);
959 cmd.Parameters.AddWithValue(
"horizon_g", wl.horizon.Y);
960 cmd.Parameters.AddWithValue(
"horizon_b", wl.horizon.Z);
961 cmd.Parameters.AddWithValue(
"horizon_i", wl.horizon.W);
962 cmd.Parameters.AddWithValue(
"haze_horizon", wl.hazeHorizon);
963 cmd.Parameters.AddWithValue(
"blue_density_r", wl.blueDensity.X);
964 cmd.Parameters.AddWithValue(
"blue_density_g", wl.blueDensity.Y);
965 cmd.Parameters.AddWithValue(
"blue_density_b", wl.blueDensity.Z);
966 cmd.Parameters.AddWithValue(
"blue_density_i", wl.blueDensity.W);
967 cmd.Parameters.AddWithValue(
"haze_density", wl.hazeDensity);
968 cmd.Parameters.AddWithValue(
"density_multiplier", wl.densityMultiplier);
969 cmd.Parameters.AddWithValue(
"distance_multiplier", wl.distanceMultiplier);
970 cmd.Parameters.AddWithValue(
"max_altitude", wl.maxAltitude);
971 cmd.Parameters.AddWithValue(
"sun_moon_color_r", wl.sunMoonColor.X);
972 cmd.Parameters.AddWithValue(
"sun_moon_color_g", wl.sunMoonColor.Y);
973 cmd.Parameters.AddWithValue(
"sun_moon_color_b", wl.sunMoonColor.Z);
974 cmd.Parameters.AddWithValue(
"sun_moon_color_i", wl.sunMoonColor.W);
975 cmd.Parameters.AddWithValue(
"sun_moon_position", wl.sunMoonPosition);
976 cmd.Parameters.AddWithValue(
"ambient_r", wl.ambient.X);
977 cmd.Parameters.AddWithValue(
"ambient_g", wl.ambient.Y);
978 cmd.Parameters.AddWithValue(
"ambient_b", wl.ambient.Z);
979 cmd.Parameters.AddWithValue(
"ambient_i", wl.ambient.W);
980 cmd.Parameters.AddWithValue(
"east_angle", wl.eastAngle);
981 cmd.Parameters.AddWithValue(
"sun_glow_focus", wl.sunGlowFocus);
982 cmd.Parameters.AddWithValue(
"sun_glow_size", wl.sunGlowSize);
983 cmd.Parameters.AddWithValue(
"scene_gamma", wl.sceneGamma);
984 cmd.Parameters.AddWithValue(
"star_brightness", wl.starBrightness);
985 cmd.Parameters.AddWithValue(
"cloud_color_r", wl.cloudColor.X);
986 cmd.Parameters.AddWithValue(
"cloud_color_g", wl.cloudColor.Y);
987 cmd.Parameters.AddWithValue(
"cloud_color_b", wl.cloudColor.Z);
988 cmd.Parameters.AddWithValue(
"cloud_color_i", wl.cloudColor.W);
989 cmd.Parameters.AddWithValue(
"cloud_x", wl.cloudXYDensity.X);
990 cmd.Parameters.AddWithValue(
"cloud_y", wl.cloudXYDensity.Y);
991 cmd.Parameters.AddWithValue(
"cloud_density", wl.cloudXYDensity.Z);
992 cmd.Parameters.AddWithValue(
"cloud_coverage", wl.cloudCoverage);
993 cmd.Parameters.AddWithValue(
"cloud_scale", wl.cloudScale);
994 cmd.Parameters.AddWithValue(
"cloud_detail_x", wl.cloudDetailXYDensity.X);
995 cmd.Parameters.AddWithValue(
"cloud_detail_y", wl.cloudDetailXYDensity.Y);
996 cmd.Parameters.AddWithValue(
"cloud_detail_density", wl.cloudDetailXYDensity.Z);
997 cmd.Parameters.AddWithValue(
"cloud_scroll_x", wl.cloudScrollX);
998 cmd.Parameters.AddWithValue(
"cloud_scroll_x_lock", wl.cloudScrollXLock);
999 cmd.Parameters.AddWithValue(
"cloud_scroll_y", wl.cloudScrollY);
1000 cmd.Parameters.AddWithValue(
"cloud_scroll_y_lock", wl.cloudScrollYLock);
1001 cmd.Parameters.AddWithValue(
"draw_classic_clouds", wl.drawClassicClouds);
1003 ExecuteNonQuery(cmd);
1010 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
1014 using (MySqlCommand cmd = dbcon.CreateCommand())
1016 cmd.CommandText =
"delete from `regionwindlight` where `region_id`=?regionID";
1017 cmd.Parameters.AddWithValue(
"?regionID", regionID.ToString());
1018 ExecuteNonQuery(cmd);
1023 #region RegionEnvironmentSettings
1026 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
1030 string command =
"select * from `regionenvironment` where region_id = ?region_id";
1032 using (MySqlCommand cmd =
new MySqlCommand(command))
1034 cmd.Connection = dbcon;
1036 cmd.Parameters.AddWithValue(
"?region_id", regionUUID.ToString());
1038 IDataReader result = ExecuteReader(cmd);
1041 return String.Empty;
1045 return Convert.ToString(result[
"llsd_settings"]);
1053 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
1057 using (MySqlCommand cmd = dbcon.CreateCommand())
1059 cmd.CommandText =
"REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
1061 cmd.Parameters.AddWithValue(
"region_id", regionUUID);
1062 cmd.Parameters.AddWithValue(
"llsd_settings", settings);
1064 ExecuteNonQuery(cmd);
1071 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
1075 using (MySqlCommand cmd = dbcon.CreateCommand())
1077 cmd.CommandText =
"delete from `regionenvironment` where region_id = ?region_id";
1078 cmd.Parameters.AddWithValue(
"?region_id", regionUUID.ToString());
1079 ExecuteNonQuery(cmd);
1087 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
1091 using (MySqlCommand cmd = dbcon.CreateCommand())
1093 cmd.CommandText =
"replace into regionsettings (regionUUID, " +
1094 "block_terraform, block_fly, allow_damage, " +
1095 "restrict_pushing, allow_land_resell, " +
1096 "allow_land_join_divide, block_show_in_search, " +
1097 "agent_limit, object_bonus, maturity, " +
1098 "disable_scripts, disable_collisions, " +
1099 "disable_physics, terrain_texture_1, " +
1100 "terrain_texture_2, terrain_texture_3, " +
1101 "terrain_texture_4, elevation_1_nw, " +
1102 "elevation_2_nw, elevation_1_ne, " +
1103 "elevation_2_ne, elevation_1_se, " +
1104 "elevation_2_se, elevation_1_sw, " +
1105 "elevation_2_sw, water_height, " +
1106 "terrain_raise_limit, terrain_lower_limit, " +
1107 "use_estate_sun, fixed_sun, sun_position, " +
1108 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
1109 "sunvectorz, loaded_creation_datetime, " +
1110 "loaded_creation_id, map_tile_ID, block_search, casino, " +
1111 "TelehubObject, parcel_tile_ID) " +
1112 "values (?RegionUUID, ?BlockTerraform, " +
1113 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
1114 "?AllowLandResell, ?AllowLandJoinDivide, " +
1115 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
1116 "?Maturity, ?DisableScripts, ?DisableCollisions, " +
1117 "?DisablePhysics, ?TerrainTexture1, " +
1118 "?TerrainTexture2, ?TerrainTexture3, " +
1119 "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
1120 "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
1121 "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
1122 "?WaterHeight, ?TerrainRaiseLimit, " +
1123 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
1124 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1125 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1126 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1127 "?TerrainImageID, ?block_search, ?casino, " +
1128 "?TelehubObject, ?ParcelImageID)";
1130 FillRegionSettingsCommand(cmd, rs);
1131 ExecuteNonQuery(cmd);
1134 SaveSpawnPoints(rs);
1140 List<LandData> landData =
new List<LandData>();
1144 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
1148 using (MySqlCommand cmd = dbcon.CreateCommand())
1150 cmd.CommandText =
"select * from land where RegionUUID = ?RegionUUID";
1151 cmd.Parameters.AddWithValue(
"RegionUUID", regionUUID.ToString());
1153 using (IDataReader reader = ExecuteReader(cmd))
1155 while (reader.Read())
1157 LandData newLand = BuildLandData(reader);
1158 landData.Add(newLand);
1163 using (MySqlCommand cmd = dbcon.CreateCommand())
1165 foreach (
LandData land
in landData)
1167 cmd.Parameters.Clear();
1168 cmd.CommandText =
"select * from landaccesslist where LandUUID = ?LandUUID";
1169 cmd.Parameters.AddWithValue(
"LandUUID", land.GlobalID.ToString());
1171 using (IDataReader reader = ExecuteReader(cmd))
1173 while (reader.Read())
1175 land.ParcelAccessList.Add(BuildLandAccessData(reader));
1195 prim.UUID = DBGuid.FromDB(row[
"UUID"]);
1196 prim.CreatorIdentification = (string)row[
"CreatorID"];
1197 prim.OwnerID = DBGuid.FromDB(row[
"OwnerID"]);
1198 prim.GroupID = DBGuid.FromDB(row[
"GroupID"]);
1199 prim.LastOwnerID = DBGuid.FromDB(row[
"LastOwnerID"]);
1203 prim.CreationDate = (int)row[
"CreationDate"];
1204 if (row[
"Name"] != DBNull.Value)
1205 prim.Name = (string)row[
"Name"];
1207 prim.Name = String.Empty;
1209 prim.Text = (string)row[
"Text"];
1210 prim.Color = Color.FromArgb((int)row[
"ColorA"],
1213 (
int)row["ColorB"]);
1214 prim.Description = (
string)row["Description"];
1215 prim.SitName = (
string)row["SitName"];
1216 prim.TouchName = (
string)row["TouchName"];
1218 prim.Flags = (PrimFlags)(
int)row["ObjectFlags"];
1219 prim.OwnerMask = (uint)(
int)row["OwnerMask"];
1220 prim.NextOwnerMask = (uint)(
int)row["NextOwnerMask"];
1221 prim.GroupMask = (uint)(
int)row["GroupMask"];
1222 prim.EveryoneMask = (uint)(
int)row["EveryoneMask"];
1223 prim.BaseMask = (uint)(
int)row["BaseMask"];
1226 prim.OffsetPosition = new Vector3(
1227 (
float)(
double)row["PositionX"],
1228 (
float)(
double)row["PositionY"],
1229 (
float)(
double)row["PositionZ"]
1231 prim.GroupPosition = new Vector3(
1232 (
float)(
double)row["GroupPositionX"],
1233 (
float)(
double)row["GroupPositionY"],
1234 (
float)(
double)row["GroupPositionZ"]
1236 prim.Velocity = new Vector3(
1237 (
float)(
double)row["VelocityX"],
1238 (
float)(
double)row["VelocityY"],
1239 (
float)(
double)row["VelocityZ"]
1241 prim.AngularVelocity = new Vector3(
1242 (
float)(
double)row["AngularVelocityX"],
1243 (
float)(
double)row["AngularVelocityY"],
1244 (
float)(
double)row["AngularVelocityZ"]
1246 prim.Acceleration = new Vector3(
1247 (
float)(
double)row["AccelerationX"],
1248 (
float)(
double)row["AccelerationY"],
1249 (
float)(
double)row["AccelerationZ"]
1252 prim.RotationOffset = new Quaternion(
1253 (
float)(
double)row["RotationX"],
1254 (
float)(
double)row["RotationY"],
1255 (
float)(
double)row["RotationZ"],
1256 (
float)(
double)row["RotationW"]
1258 prim.SitTargetPositionLL = new Vector3(
1259 (
float)(
double)row["SitTargetOffsetX"],
1260 (
float)(
double)row["SitTargetOffsetY"],
1261 (
float)(
double)row["SitTargetOffsetZ"]
1263 prim.SitTargetOrientationLL = new Quaternion(
1264 (
float)(
double)row["SitTargetOrientX"],
1265 (
float)(
double)row["SitTargetOrientY"],
1266 (
float)(
double)row["SitTargetOrientZ"],
1267 (
float)(
double)row["SitTargetOrientW"]
1270 prim.PayPrice[0] = (
int)row["PayPrice"];
1271 prim.PayPrice[1] = (
int)row["PayButton1"];
1272 prim.PayPrice[2] = (
int)row["PayButton2"];
1273 prim.PayPrice[3] = (
int)row["PayButton3"];
1274 prim.PayPrice[4] = (
int)row["PayButton4"];
1276 prim.Sound = DBGuid.FromDB(row["LoopedSound"].ToString());
1277 prim.SoundGain = (
float)(
double)row["LoopedSoundGain"];
1278 prim.SoundFlags = 1;
1280 if (!(row["TextureAnimation"] is DBNull))
1281 prim.TextureAnimation = (byte[])row["TextureAnimation"];
1282 if (!(row["ParticleSystem"] is DBNull))
1283 prim.ParticleSystem = (byte[])row["ParticleSystem"];
1285 prim.AngularVelocity = new Vector3(
1286 (
float)(
double)row["OmegaX"],
1287 (
float)(
double)row["OmegaY"],
1288 (
float)(
double)row["OmegaZ"]
1291 prim.SetCameraEyeOffset(new Vector3(
1292 (
float)(
double)row["CameraEyeOffsetX"],
1293 (
float)(
double)row["CameraEyeOffsetY"],
1294 (
float)(
double)row["CameraEyeOffsetZ"]
1297 prim.SetCameraAtOffset(new Vector3(
1298 (
float)(
double)row["CameraAtOffsetX"],
1299 (
float)(
double)row["CameraAtOffsetY"],
1300 (
float)(
double)row["CameraAtOffsetZ"]
1303 prim.SetForceMouselook((sbyte)row["ForceMouselook"] != 0);
1304 prim.ScriptAccessPin = (
int)row["ScriptAccessPin"];
1305 prim.AllowedDrop = ((sbyte)row["AllowedDrop"] != 0);
1306 prim.DIE_AT_EDGE = ((sbyte)row["DieAtEdge"] != 0);
1308 prim.SalePrice = (
int)row["SalePrice"];
1309 prim.ObjectSaleType = unchecked((byte)(sbyte)row["SaleType"]);
1313 if (!(row["ClickAction"] is DBNull))
1314 prim.ClickAction = unchecked((byte)(sbyte)row["ClickAction"]);
1316 prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]);
1317 prim.CollisionSoundVolume = (
float)(
double)row["CollisionSoundVolume"];
1319 prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
1320 prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0);
1321 prim.LinkNum = (
int)row["LinkNumber"];
1323 if (!(row["MediaURL"] is System.DBNull))
1324 prim.MediaUrl = (
string)row["MediaURL"];
1326 if (!(row["AttachedPosX"] is System.DBNull))
1328 prim.AttachedPos =
new Vector3(
1329 (
float)(
double)row[
"AttachedPosX"],
1330 (
float)(
double)row[
"AttachedPosY"],
1331 (
float)(
double)row[
"AttachedPosZ"]
1335 if (!(row[
"DynAttrs"] is System.DBNull))
1336 prim.DynAttrs = DAMap.FromXml((string)row[
"DynAttrs"]);
1338 prim.DynAttrs =
new DAMap();
1340 if (!(row[
"KeyframeMotion"] is DBNull))
1342 Byte[] data = (byte[])row[
"KeyframeMotion"];
1343 if (data.Length > 0)
1344 prim.KeyframeMotion = KeyframeMotion.FromData(null, data);
1346 prim.KeyframeMotion = null;
1350 prim.KeyframeMotion = null;
1353 prim.PhysicsShapeType = (byte)Convert.ToInt32(row[
"PhysicsShapeType"].ToString());
1354 prim.Density = (float)(
double)row[
"Density"];
1355 prim.GravityModifier = (float)(
double)row[
"GravityModifier"];
1356 prim.Friction = (float)(
double)row[
"Friction"];
1357 prim.Restitution = (float)(
double)row[
"Restitution"];
1358 prim.RotationAxisLocks = (byte)Convert.ToInt32(row[
"RotationAxisLocks"].ToString());
1362 if (row[
"Vehicle"].ToString() != String.Empty)
1364 vehicle = SOPVehicle.FromXml2(row[
"Vehicle"].ToString());
1365 if (vehicle != null)
1366 prim.VehicleParams = vehicle;
1383 taskItem.ItemID = DBGuid.FromDB(row[
"itemID"]);
1384 taskItem.ParentPartID = DBGuid.FromDB(row[
"primID"]);
1385 taskItem.AssetID = DBGuid.FromDB(row[
"assetID"]);
1386 taskItem.ParentID = DBGuid.FromDB(row[
"parentFolderID"]);
1388 taskItem.InvType = Convert.ToInt32(row[
"invType"]);
1389 taskItem.Type = Convert.ToInt32(row[
"assetType"]);
1391 taskItem.Name = (
String)row[
"name"];
1392 taskItem.Description = (
String)row[
"description"];
1393 taskItem.CreationDate = Convert.ToUInt32(row[
"creationDate"]);
1394 taskItem.CreatorIdentification = (
String)row[
"creatorID"];
1395 taskItem.OwnerID = DBGuid.FromDB(row[
"ownerID"]);
1396 taskItem.LastOwnerID = DBGuid.FromDB(row[
"lastOwnerID"]);
1397 taskItem.GroupID = DBGuid.FromDB(row[
"groupID"]);
1399 taskItem.NextPermissions = Convert.ToUInt32(row[
"nextPermissions"]);
1400 taskItem.CurrentPermissions = Convert.ToUInt32(row[
"currentPermissions"]);
1401 taskItem.BasePermissions = Convert.ToUInt32(row[
"basePermissions"]);
1402 taskItem.EveryonePermissions = Convert.ToUInt32(row[
"everyonePermissions"]);
1403 taskItem.GroupPermissions = Convert.ToUInt32(row[
"groupPermissions"]);
1404 taskItem.Flags = Convert.ToUInt32(row[
"flags"]);
1410 m_log.ErrorFormat(
"[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row[
"itemID"].ToString(), row[
"primID"].ToString());
1415 private static RegionSettings BuildRegionSettings(IDataReader row)
1419 newSettings.RegionUUID = DBGuid.FromDB(row[
"regionUUID"]);
1420 newSettings.BlockTerraform = Convert.ToBoolean(row[
"block_terraform"]);
1421 newSettings.AllowDamage = Convert.ToBoolean(row[
"allow_damage"]);
1422 newSettings.BlockFly = Convert.ToBoolean(row[
"block_fly"]);
1423 newSettings.RestrictPushing = Convert.ToBoolean(row[
"restrict_pushing"]);
1424 newSettings.AllowLandResell = Convert.ToBoolean(row[
"allow_land_resell"]);
1425 newSettings.AllowLandJoinDivide = Convert.ToBoolean(row[
"allow_land_join_divide"]);
1426 newSettings.BlockShowInSearch = Convert.ToBoolean(row[
"block_show_in_search"]);
1427 newSettings.AgentLimit = Convert.ToInt32(row[
"agent_limit"]);
1428 newSettings.ObjectBonus = Convert.ToDouble(row[
"object_bonus"]);
1429 newSettings.Maturity = Convert.ToInt32(row[
"maturity"]);
1430 newSettings.DisableScripts = Convert.ToBoolean(row[
"disable_scripts"]);
1431 newSettings.DisableCollisions = Convert.ToBoolean(row[
"disable_collisions"]);
1432 newSettings.DisablePhysics = Convert.ToBoolean(row[
"disable_physics"]);
1433 newSettings.TerrainTexture1 = DBGuid.FromDB(row[
"terrain_texture_1"]);
1434 newSettings.TerrainTexture2 = DBGuid.FromDB(row[
"terrain_texture_2"]);
1435 newSettings.TerrainTexture3 = DBGuid.FromDB(row[
"terrain_texture_3"]);
1436 newSettings.TerrainTexture4 = DBGuid.FromDB(row[
"terrain_texture_4"]);
1437 newSettings.Elevation1NW = Convert.ToDouble(row[
"elevation_1_nw"]);
1438 newSettings.Elevation2NW = Convert.ToDouble(row[
"elevation_2_nw"]);
1439 newSettings.Elevation1NE = Convert.ToDouble(row[
"elevation_1_ne"]);
1440 newSettings.Elevation2NE = Convert.ToDouble(row[
"elevation_2_ne"]);
1441 newSettings.Elevation1SE = Convert.ToDouble(row[
"elevation_1_se"]);
1442 newSettings.Elevation2SE = Convert.ToDouble(row[
"elevation_2_se"]);
1443 newSettings.Elevation1SW = Convert.ToDouble(row[
"elevation_1_sw"]);
1444 newSettings.Elevation2SW = Convert.ToDouble(row[
"elevation_2_sw"]);
1445 newSettings.WaterHeight = Convert.ToDouble(row[
"water_height"]);
1446 newSettings.TerrainRaiseLimit = Convert.ToDouble(row[
"terrain_raise_limit"]);
1447 newSettings.TerrainLowerLimit = Convert.ToDouble(row[
"terrain_lower_limit"]);
1448 newSettings.UseEstateSun = Convert.ToBoolean(row[
"use_estate_sun"]);
1449 newSettings.Sandbox = Convert.ToBoolean(row[
"Sandbox"]);
1450 newSettings.SunVector =
new Vector3 (
1451 Convert.ToSingle(row[
"sunvectorx"]),
1452 Convert.ToSingle(row[
"sunvectory"]),
1453 Convert.ToSingle(row[
"sunvectorz"])
1455 newSettings.FixedSun = Convert.ToBoolean(row[
"fixed_sun"]);
1456 newSettings.SunPosition = Convert.ToDouble(row[
"sun_position"]);
1457 newSettings.Covenant = DBGuid.FromDB(row[
"covenant"]);
1458 newSettings.CovenantChangedDateTime = Convert.ToInt32(row[
"covenant_datetime"]);
1459 newSettings.LoadedCreationDateTime = Convert.ToInt32(row[
"loaded_creation_datetime"]);
1461 if (row[
"loaded_creation_id"] is DBNull)
1462 newSettings.LoadedCreationID =
"";
1464 newSettings.LoadedCreationID = (
String) row[
"loaded_creation_id"];
1466 newSettings.TerrainImageID = DBGuid.FromDB(row[
"map_tile_ID"]);
1467 newSettings.ParcelImageID = DBGuid.FromDB(row[
"parcel_tile_ID"]);
1468 newSettings.TelehubObject = DBGuid.FromDB(row[
"TelehubObject"]);
1470 newSettings.GodBlockSearch = Convert.ToBoolean(row[
"block_search"]);
1471 newSettings.Casino = Convert.ToBoolean(row[
"casino"]);
1481 private static LandData BuildLandData(IDataReader row)
1485 newData.GlobalID = DBGuid.FromDB(row[
"UUID"]);
1486 newData.LocalID = Convert.ToInt32(row[
"LocalLandID"]);
1489 newData.Bitmap = (Byte[]) row[
"Bitmap"];
1491 newData.Name = (
String) row[
"Name"];
1492 newData.Description = (
String) row[
"Description"];
1493 newData.OwnerID = DBGuid.FromDB(row[
"OwnerUUID"]);
1494 newData.IsGroupOwned = Convert.ToBoolean(row[
"IsGroupOwned"]);
1495 newData.Area = Convert.ToInt32(row[
"Area"]);
1496 newData.AuctionID = Convert.ToUInt32(row[
"AuctionID"]);
1497 newData.Category = (ParcelCategory) Convert.ToInt32(row[
"Category"]);
1499 newData.ClaimDate = Convert.ToInt32(row[
"ClaimDate"]);
1500 newData.ClaimPrice = Convert.ToInt32(row[
"ClaimPrice"]);
1501 newData.GroupID = DBGuid.FromDB(row[
"GroupUUID"]);
1502 newData.SalePrice = Convert.ToInt32(row[
"SalePrice"]);
1503 newData.Status = (ParcelStatus) Convert.ToInt32(row[
"LandStatus"]);
1505 newData.Flags = Convert.ToUInt32(row[
"LandFlags"]);
1506 newData.LandingType = Convert.ToByte(row[
"LandingType"]);
1507 newData.MediaAutoScale = Convert.ToByte(row[
"MediaAutoScale"]);
1508 newData.MediaID = DBGuid.FromDB(row[
"MediaTextureUUID"]);
1509 newData.MediaURL = (
String) row[
"MediaURL"];
1510 newData.MusicURL = (
String) row[
"MusicURL"];
1511 newData.PassHours = Convert.ToSingle(row[
"PassHours"]);
1512 newData.PassPrice = Convert.ToInt32(row[
"PassPrice"]);
1513 UUID authedbuyer = UUID.Zero;
1514 UUID snapshotID = UUID.Zero;
1516 UUID.TryParse((string)row[
"AuthBuyerID"], out authedbuyer);
1517 UUID.TryParse((string)row[
"SnapshotUUID"], out snapshotID);
1518 newData.OtherCleanTime = Convert.ToInt32(row[
"OtherCleanTime"]);
1519 newData.Dwell = Convert.ToSingle(row[
"Dwell"]);
1521 newData.AuthBuyerID = authedbuyer;
1522 newData.SnapshotID = snapshotID;
1525 newData.UserLocation =
1526 new Vector3(Convert.ToSingle(row[
"UserLocationX"]), Convert.ToSingle(row[
"UserLocationY"]),
1527 Convert.ToSingle(row[
"UserLocationZ"]));
1528 newData.UserLookAt =
1529 new Vector3(Convert.ToSingle(row[
"UserLookAtX"]), Convert.ToSingle(row[
"UserLookAtY"]),
1530 Convert.ToSingle(row[
"UserLookAtZ"]));
1532 catch (InvalidCastException)
1534 newData.UserLocation = Vector3.Zero;
1535 newData.UserLookAt = Vector3.Zero;
1536 m_log.ErrorFormat(
"[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
1539 newData.MediaDescription = (string) row[
"MediaDescription"];
1540 newData.MediaType = (string) row[
"MediaType"];
1541 newData.MediaWidth = Convert.ToInt32((((string) row[
"MediaSize"]).Split(
','))[0]);
1542 newData.MediaHeight = Convert.ToInt32((((string) row[
"MediaSize"]).Split(
','))[1]);
1543 newData.MediaLoop = Convert.ToBoolean(row[
"MediaLoop"]);
1544 newData.ObscureMusic = Convert.ToBoolean(row[
"ObscureMusic"]);
1545 newData.ObscureMedia = Convert.ToBoolean(row[
"ObscureMedia"]);
1547 newData.ParcelAccessList =
new List<LandAccessEntry>();
1549 if (!(row[
"SeeAVs"] is System.DBNull))
1550 newData.SeeAVs = Convert.ToInt32(row[
"SeeAVs"]) != 0 ?
true :
false;
1551 if (!(row[
"AnyAVSounds"] is System.DBNull))
1552 newData.AnyAVSounds = Convert.ToInt32(row[
"AnyAVSounds"]) != 0 ?
true :
false;
1553 if (!(row[
"GroupAVSounds"] is System.DBNull))
1554 newData.GroupAVSounds = Convert.ToInt32(row[
"GroupAVSounds"]) != 0 ?
true :
false;
1567 entry.AgentID = DBGuid.FromDB(row[
"AccessUUID"]);
1568 entry.Flags = (AccessList) Convert.ToInt32(row[
"Flags"]);
1569 entry.Expires = Convert.ToInt32(row[
"Expires"]);
1580 private void FillPrimCommand(MySqlCommand cmd,
SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
1582 cmd.Parameters.AddWithValue(
"UUID", prim.UUID.ToString());
1583 cmd.Parameters.AddWithValue(
"RegionUUID", regionUUID.ToString());
1584 cmd.Parameters.AddWithValue(
"CreationDate", prim.CreationDate);
1585 cmd.Parameters.AddWithValue(
"Name", prim.Name);
1586 cmd.Parameters.AddWithValue(
"SceneGroupID", sceneGroupID.ToString());
1589 cmd.Parameters.AddWithValue(
"Text", prim.Text);
1590 cmd.Parameters.AddWithValue(
"ColorR", prim.Color.R);
1591 cmd.Parameters.AddWithValue(
"ColorG", prim.Color.G);
1592 cmd.Parameters.AddWithValue(
"ColorB", prim.Color.B);
1593 cmd.Parameters.AddWithValue(
"ColorA", prim.Color.A);
1594 cmd.Parameters.AddWithValue(
"Description", prim.Description);
1595 cmd.Parameters.AddWithValue(
"SitName", prim.SitName);
1596 cmd.Parameters.AddWithValue(
"TouchName", prim.TouchName);
1598 cmd.Parameters.AddWithValue(
"ObjectFlags", (uint)prim.
Flags);
1599 cmd.Parameters.AddWithValue(
"CreatorID", prim.CreatorIdentification.ToString());
1600 cmd.Parameters.AddWithValue(
"OwnerID", prim.OwnerID.ToString());
1601 cmd.Parameters.AddWithValue(
"GroupID", prim.GroupID.ToString());
1602 cmd.Parameters.AddWithValue(
"LastOwnerID", prim.LastOwnerID.ToString());
1603 cmd.Parameters.AddWithValue(
"OwnerMask", prim.OwnerMask);
1604 cmd.Parameters.AddWithValue(
"NextOwnerMask", prim.NextOwnerMask);
1605 cmd.Parameters.AddWithValue(
"GroupMask", prim.GroupMask);
1606 cmd.Parameters.AddWithValue(
"EveryoneMask", prim.EveryoneMask);
1607 cmd.Parameters.AddWithValue(
"BaseMask", prim.BaseMask);
1609 cmd.Parameters.AddWithValue(
"PositionX", (double)prim.
OffsetPosition.X);
1610 cmd.Parameters.AddWithValue(
"PositionY", (double)prim.
OffsetPosition.Y);
1611 cmd.Parameters.AddWithValue(
"PositionZ", (double)prim.
OffsetPosition.Z);
1612 cmd.Parameters.AddWithValue(
"GroupPositionX", (double)prim.
GroupPosition.X);
1613 cmd.Parameters.AddWithValue(
"GroupPositionY", (double)prim.
GroupPosition.Y);
1614 cmd.Parameters.AddWithValue(
"GroupPositionZ", (double)prim.
GroupPosition.Z);
1615 cmd.Parameters.AddWithValue(
"VelocityX", (double)prim.
Velocity.X);
1616 cmd.Parameters.AddWithValue(
"VelocityY", (double)prim.
Velocity.Y);
1617 cmd.Parameters.AddWithValue(
"VelocityZ", (double)prim.
Velocity.Z);
1618 cmd.Parameters.AddWithValue(
"AngularVelocityX", (double)prim.
AngularVelocity.X);
1619 cmd.Parameters.AddWithValue(
"AngularVelocityY", (double)prim.
AngularVelocity.Y);
1620 cmd.Parameters.AddWithValue(
"AngularVelocityZ", (double)prim.
AngularVelocity.Z);
1621 cmd.Parameters.AddWithValue(
"AccelerationX", (double)prim.
Acceleration.X);
1622 cmd.Parameters.AddWithValue(
"AccelerationY", (double)prim.
Acceleration.Y);
1623 cmd.Parameters.AddWithValue(
"AccelerationZ", (double)prim.
Acceleration.Z);
1625 cmd.Parameters.AddWithValue(
"RotationX", (double)prim.
RotationOffset.X);
1626 cmd.Parameters.AddWithValue(
"RotationY", (double)
prim.RotationOffset.Y);
1627 cmd.Parameters.AddWithValue(
"RotationZ", (double)
prim.RotationOffset.Z);
1628 cmd.Parameters.AddWithValue(
"RotationW", (double)
prim.RotationOffset.W);
1631 Vector3 sitTargetPos = prim.SitTargetPositionLL;
1632 cmd.Parameters.AddWithValue(
"SitTargetOffsetX", (double)sitTargetPos.X);
1633 cmd.Parameters.AddWithValue(
"SitTargetOffsetY", (double)sitTargetPos.Y);
1634 cmd.Parameters.AddWithValue(
"SitTargetOffsetZ", (double)sitTargetPos.Z);
1636 Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
1637 cmd.Parameters.AddWithValue(
"SitTargetOrientW", (double)sitTargetOrient.W);
1638 cmd.Parameters.AddWithValue(
"SitTargetOrientX", (double)sitTargetOrient.X);
1639 cmd.Parameters.AddWithValue(
"SitTargetOrientY", (double)sitTargetOrient.Y);
1640 cmd.Parameters.AddWithValue(
"SitTargetOrientZ", (double)sitTargetOrient.Z);
1642 cmd.Parameters.AddWithValue(
"PayPrice", prim.PayPrice[0]);
1643 cmd.Parameters.AddWithValue(
"PayButton1", prim.PayPrice[1]);
1644 cmd.Parameters.AddWithValue(
"PayButton2", prim.PayPrice[2]);
1645 cmd.Parameters.AddWithValue(
"PayButton3", prim.PayPrice[3]);
1646 cmd.Parameters.AddWithValue(
"PayButton4", prim.PayPrice[4]);
1648 if ((
prim.SoundFlags & 1) != 0)
1650 cmd.Parameters.AddWithValue(
"LoopedSound", prim.Sound.ToString());
1651 cmd.Parameters.AddWithValue(
"LoopedSoundGain", prim.SoundGain);
1655 cmd.Parameters.AddWithValue(
"LoopedSound", UUID.Zero);
1656 cmd.Parameters.AddWithValue(
"LoopedSoundGain", 0.0f);
1659 cmd.Parameters.AddWithValue(
"TextureAnimation", prim.TextureAnimation);
1660 cmd.Parameters.AddWithValue(
"ParticleSystem", prim.ParticleSystem);
1662 cmd.Parameters.AddWithValue(
"OmegaX", (double)
prim.AngularVelocity.X);
1663 cmd.Parameters.AddWithValue(
"OmegaY", (double)
prim.AngularVelocity.Y);
1664 cmd.Parameters.AddWithValue(
"OmegaZ", (double)
prim.AngularVelocity.Z);
1666 cmd.Parameters.AddWithValue(
"CameraEyeOffsetX", (double)
prim.GetCameraEyeOffset().X);
1667 cmd.Parameters.AddWithValue(
"CameraEyeOffsetY", (double)
prim.GetCameraEyeOffset().Y);
1668 cmd.Parameters.AddWithValue(
"CameraEyeOffsetZ", (double)
prim.GetCameraEyeOffset().Z);
1670 cmd.Parameters.AddWithValue(
"CameraAtOffsetX", (double)
prim.GetCameraAtOffset().X);
1671 cmd.Parameters.AddWithValue(
"CameraAtOffsetY", (double)
prim.GetCameraAtOffset().Y);
1672 cmd.Parameters.AddWithValue(
"CameraAtOffsetZ", (double)
prim.GetCameraAtOffset().Z);
1674 if (
prim.GetForceMouselook())
1675 cmd.Parameters.AddWithValue(
"ForceMouselook", 1);
1677 cmd.Parameters.AddWithValue(
"ForceMouselook", 0);
1679 cmd.Parameters.AddWithValue(
"ScriptAccessPin", prim.ScriptAccessPin);
1681 if (
prim.AllowedDrop)
1682 cmd.Parameters.AddWithValue(
"AllowedDrop", 1);
1684 cmd.Parameters.AddWithValue(
"AllowedDrop", 0);
1686 if (
prim.DIE_AT_EDGE)
1687 cmd.Parameters.AddWithValue(
"DieAtEdge", 1);
1689 cmd.Parameters.AddWithValue(
"DieAtEdge", 0);
1691 cmd.Parameters.AddWithValue(
"SalePrice", prim.SalePrice);
1692 cmd.Parameters.AddWithValue(
"SaleType", unchecked((sbyte)(
prim.ObjectSaleType)));
1694 byte clickAction = prim.ClickAction;
1695 cmd.Parameters.AddWithValue(
"ClickAction", unchecked((sbyte)(clickAction)));
1697 cmd.Parameters.AddWithValue(
"Material", unchecked((sbyte)(
prim.Material)));
1699 cmd.Parameters.AddWithValue(
"CollisionSound", prim.CollisionSound.ToString());
1700 cmd.Parameters.AddWithValue(
"CollisionSoundVolume", prim.CollisionSoundVolume);
1702 if (
prim.PassTouches)
1703 cmd.Parameters.AddWithValue(
"PassTouches", 1);
1705 cmd.Parameters.AddWithValue(
"PassTouches", 0);
1707 if (
prim.PassCollisions)
1708 cmd.Parameters.AddWithValue(
"PassCollisions", 1);
1710 cmd.Parameters.AddWithValue(
"PassCollisions", 0);
1712 cmd.Parameters.AddWithValue(
"LinkNumber", prim.LinkNum);
1713 cmd.Parameters.AddWithValue(
"MediaURL", prim.MediaUrl);
1714 if (
prim.AttachedPos != null)
1716 cmd.Parameters.AddWithValue(
"AttachedPosX", (double)
prim.AttachedPos.X);
1717 cmd.Parameters.AddWithValue(
"AttachedPosY", (double)
prim.AttachedPos.Y);
1718 cmd.Parameters.AddWithValue(
"AttachedPosZ", (double)
prim.AttachedPos.Z);
1721 if (
prim.KeyframeMotion != null)
1722 cmd.Parameters.AddWithValue(
"KeyframeMotion", prim.KeyframeMotion.Serialize());
1724 cmd.Parameters.AddWithValue(
"KeyframeMotion",
new Byte[0]);
1726 if (
prim.VehicleParams != null)
1727 cmd.Parameters.AddWithValue(
"Vehicle", prim.VehicleParams.ToXml2());
1729 cmd.Parameters.AddWithValue(
"Vehicle", String.Empty);
1731 if (
prim.DynAttrs.CountNamespaces > 0)
1732 cmd.Parameters.AddWithValue(
"DynAttrs", prim.DynAttrs.ToXml());
1734 cmd.Parameters.AddWithValue(
"DynAttrs", null);
1736 cmd.Parameters.AddWithValue(
"PhysicsShapeType", prim.PhysicsShapeType);
1737 cmd.Parameters.AddWithValue(
"Density", (double)
prim.Density);
1738 cmd.Parameters.AddWithValue(
"GravityModifier", (double)
prim.GravityModifier);
1739 cmd.Parameters.AddWithValue(
"Friction", (double)
prim.Friction);
1740 cmd.Parameters.AddWithValue(
"Restitution", (double)
prim.Restitution);
1741 cmd.Parameters.AddWithValue(
"RotationAxisLocks", prim.RotationAxisLocks);
1749 private static void FillItemCommand(MySqlCommand cmd,
TaskInventoryItem taskItem)
1751 cmd.Parameters.AddWithValue(
"itemID", taskItem.ItemID);
1752 cmd.Parameters.AddWithValue(
"primID", taskItem.ParentPartID);
1753 cmd.Parameters.AddWithValue(
"assetID", taskItem.AssetID);
1754 cmd.Parameters.AddWithValue(
"parentFolderID", taskItem.ParentID);
1756 cmd.Parameters.AddWithValue(
"invType", taskItem.InvType);
1757 cmd.Parameters.AddWithValue(
"assetType", taskItem.Type);
1759 cmd.Parameters.AddWithValue(
"name", taskItem.Name);
1760 cmd.Parameters.AddWithValue(
"description", taskItem.Description);
1761 cmd.Parameters.AddWithValue(
"creationDate", taskItem.CreationDate);
1762 cmd.Parameters.AddWithValue(
"creatorID", taskItem.CreatorIdentification);
1763 cmd.Parameters.AddWithValue(
"ownerID", taskItem.OwnerID);
1764 cmd.Parameters.AddWithValue(
"lastOwnerID", taskItem.LastOwnerID);
1765 cmd.Parameters.AddWithValue(
"groupID", taskItem.GroupID);
1766 cmd.Parameters.AddWithValue(
"nextPermissions", taskItem.NextPermissions);
1767 cmd.Parameters.AddWithValue(
"currentPermissions", taskItem.CurrentPermissions);
1768 cmd.Parameters.AddWithValue(
"basePermissions", taskItem.BasePermissions);
1769 cmd.Parameters.AddWithValue(
"everyonePermissions", taskItem.EveryonePermissions);
1770 cmd.Parameters.AddWithValue(
"groupPermissions", taskItem.GroupPermissions);
1771 cmd.Parameters.AddWithValue(
"flags", taskItem.Flags);
1777 private static void FillRegionSettingsCommand(MySqlCommand cmd,
RegionSettings settings)
1779 cmd.Parameters.AddWithValue(
"RegionUUID", settings.RegionUUID.ToString());
1780 cmd.Parameters.AddWithValue(
"BlockTerraform", settings.BlockTerraform);
1781 cmd.Parameters.AddWithValue(
"BlockFly", settings.BlockFly);
1782 cmd.Parameters.AddWithValue(
"AllowDamage", settings.AllowDamage);
1783 cmd.Parameters.AddWithValue(
"RestrictPushing", settings.RestrictPushing);
1784 cmd.Parameters.AddWithValue(
"AllowLandResell", settings.AllowLandResell);
1785 cmd.Parameters.AddWithValue(
"AllowLandJoinDivide", settings.AllowLandJoinDivide);
1786 cmd.Parameters.AddWithValue(
"BlockShowInSearch", settings.BlockShowInSearch);
1787 cmd.Parameters.AddWithValue(
"AgentLimit", settings.AgentLimit);
1788 cmd.Parameters.AddWithValue(
"ObjectBonus", settings.ObjectBonus);
1789 cmd.Parameters.AddWithValue(
"Maturity", settings.Maturity);
1790 cmd.Parameters.AddWithValue(
"DisableScripts", settings.DisableScripts);
1791 cmd.Parameters.AddWithValue(
"DisableCollisions", settings.DisableCollisions);
1792 cmd.Parameters.AddWithValue(
"DisablePhysics", settings.DisablePhysics);
1793 cmd.Parameters.AddWithValue(
"TerrainTexture1", settings.TerrainTexture1.ToString());
1794 cmd.Parameters.AddWithValue(
"TerrainTexture2", settings.TerrainTexture2.ToString());
1795 cmd.Parameters.AddWithValue(
"TerrainTexture3", settings.TerrainTexture3.ToString());
1796 cmd.Parameters.AddWithValue(
"TerrainTexture4", settings.TerrainTexture4.ToString());
1797 cmd.Parameters.AddWithValue(
"Elevation1NW", settings.Elevation1NW);
1798 cmd.Parameters.AddWithValue(
"Elevation2NW", settings.Elevation2NW);
1799 cmd.Parameters.AddWithValue(
"Elevation1NE", settings.Elevation1NE);
1800 cmd.Parameters.AddWithValue(
"Elevation2NE", settings.Elevation2NE);
1801 cmd.Parameters.AddWithValue(
"Elevation1SE", settings.Elevation1SE);
1802 cmd.Parameters.AddWithValue(
"Elevation2SE", settings.Elevation2SE);
1803 cmd.Parameters.AddWithValue(
"Elevation1SW", settings.Elevation1SW);
1804 cmd.Parameters.AddWithValue(
"Elevation2SW", settings.Elevation2SW);
1805 cmd.Parameters.AddWithValue(
"WaterHeight", settings.WaterHeight);
1806 cmd.Parameters.AddWithValue(
"TerrainRaiseLimit", settings.TerrainRaiseLimit);
1807 cmd.Parameters.AddWithValue(
"TerrainLowerLimit", settings.TerrainLowerLimit);
1808 cmd.Parameters.AddWithValue(
"UseEstateSun", settings.UseEstateSun);
1809 cmd.Parameters.AddWithValue(
"Sandbox", settings.Sandbox);
1810 cmd.Parameters.AddWithValue(
"SunVectorX", settings.SunVector.X);
1811 cmd.Parameters.AddWithValue(
"SunVectorY", settings.SunVector.Y);
1812 cmd.Parameters.AddWithValue(
"SunVectorZ", settings.SunVector.Z);
1813 cmd.Parameters.AddWithValue(
"FixedSun", settings.FixedSun);
1814 cmd.Parameters.AddWithValue(
"SunPosition", settings.SunPosition);
1815 cmd.Parameters.AddWithValue(
"Covenant", settings.Covenant.ToString());
1816 cmd.Parameters.AddWithValue(
"CovenantChangedDateTime", settings.CovenantChangedDateTime);
1817 cmd.Parameters.AddWithValue(
"LoadedCreationDateTime", settings.LoadedCreationDateTime);
1818 cmd.Parameters.AddWithValue(
"LoadedCreationID", settings.LoadedCreationID);
1819 cmd.Parameters.AddWithValue(
"TerrainImageID", settings.TerrainImageID);
1820 cmd.Parameters.AddWithValue(
"block_search", settings.GodBlockSearch);
1821 cmd.Parameters.AddWithValue(
"casino", settings.Casino);
1823 cmd.Parameters.AddWithValue(
"ParcelImageID", settings.ParcelImageID);
1824 cmd.Parameters.AddWithValue(
"TelehubObject", settings.TelehubObject);
1833 private static void FillLandCommand(MySqlCommand cmd,
LandData land, UUID regionUUID)
1835 cmd.Parameters.AddWithValue(
"UUID", land.GlobalID.ToString());
1836 cmd.Parameters.AddWithValue(
"RegionUUID", regionUUID.ToString());
1837 cmd.Parameters.AddWithValue(
"LocalLandID", land.LocalID);
1840 cmd.Parameters.AddWithValue(
"Bitmap", land.Bitmap);
1842 cmd.Parameters.AddWithValue(
"Name", land.Name);
1843 cmd.Parameters.AddWithValue(
"Description", land.Description);
1844 cmd.Parameters.AddWithValue(
"OwnerUUID", land.OwnerID.ToString());
1845 cmd.Parameters.AddWithValue(
"IsGroupOwned", land.IsGroupOwned);
1846 cmd.Parameters.AddWithValue(
"Area", land.Area);
1847 cmd.Parameters.AddWithValue(
"AuctionID", land.AuctionID);
1848 cmd.Parameters.AddWithValue(
"Category", land.Category);
1849 cmd.Parameters.AddWithValue(
"ClaimDate", land.ClaimDate);
1850 cmd.Parameters.AddWithValue(
"ClaimPrice", land.ClaimPrice);
1851 cmd.Parameters.AddWithValue(
"GroupUUID", land.GroupID.ToString());
1852 cmd.Parameters.AddWithValue(
"SalePrice", land.SalePrice);
1853 cmd.Parameters.AddWithValue(
"LandStatus", land.Status);
1854 cmd.Parameters.AddWithValue(
"LandFlags", land.Flags);
1855 cmd.Parameters.AddWithValue(
"LandingType", land.LandingType);
1856 cmd.Parameters.AddWithValue(
"MediaAutoScale", land.MediaAutoScale);
1857 cmd.Parameters.AddWithValue(
"MediaTextureUUID", land.MediaID.ToString());
1858 cmd.Parameters.AddWithValue(
"MediaURL", land.MediaURL);
1859 cmd.Parameters.AddWithValue(
"MusicURL", land.MusicURL);
1860 cmd.Parameters.AddWithValue(
"PassHours", land.PassHours);
1861 cmd.Parameters.AddWithValue(
"PassPrice", land.PassPrice);
1862 cmd.Parameters.AddWithValue(
"SnapshotUUID", land.SnapshotID.ToString());
1863 cmd.Parameters.AddWithValue(
"UserLocationX", land.UserLocation.X);
1864 cmd.Parameters.AddWithValue(
"UserLocationY", land.UserLocation.Y);
1865 cmd.Parameters.AddWithValue(
"UserLocationZ", land.UserLocation.Z);
1866 cmd.Parameters.AddWithValue(
"UserLookAtX", land.UserLookAt.X);
1867 cmd.Parameters.AddWithValue(
"UserLookAtY", land.UserLookAt.Y);
1868 cmd.Parameters.AddWithValue(
"UserLookAtZ", land.UserLookAt.Z);
1869 cmd.Parameters.AddWithValue(
"AuthBuyerID", land.AuthBuyerID);
1870 cmd.Parameters.AddWithValue(
"OtherCleanTime", land.OtherCleanTime);
1871 cmd.Parameters.AddWithValue(
"Dwell", land.Dwell);
1872 cmd.Parameters.AddWithValue(
"MediaDescription", land.MediaDescription);
1873 cmd.Parameters.AddWithValue(
"MediaType", land.MediaType);
1874 cmd.Parameters.AddWithValue(
"MediaWidth", land.MediaWidth);
1875 cmd.Parameters.AddWithValue(
"MediaHeight", land.MediaHeight);
1876 cmd.Parameters.AddWithValue(
"MediaLoop", land.MediaLoop);
1877 cmd.Parameters.AddWithValue(
"ObscureMusic", land.ObscureMusic);
1878 cmd.Parameters.AddWithValue(
"ObscureMedia", land.ObscureMedia);
1879 cmd.Parameters.AddWithValue(
"SeeAVs", land.SeeAVs ? 1 : 0);
1880 cmd.Parameters.AddWithValue(
"AnyAVSounds", land.AnyAVSounds ? 1 : 0);
1881 cmd.Parameters.AddWithValue(
"GroupAVSounds", land.GroupAVSounds ? 1 : 0);
1891 private static void FillLandAccessCommand(MySqlCommand cmd,
LandAccessEntry entry, UUID parcelID)
1893 cmd.Parameters.AddWithValue(
"LandUUID", parcelID.ToString());
1894 cmd.Parameters.AddWithValue(
"AccessUUID", entry.AgentID.ToString());
1895 cmd.Parameters.AddWithValue(
"Flags", entry.Flags);
1896 cmd.Parameters.AddWithValue(
"Expires", entry.Expires.ToString());
1907 s.Scale =
new Vector3(
1908 (
float)(
double)row[
"ScaleX"],
1909 (
float)(
double)row[
"ScaleY"],
1910 (
float)(
double)row[
"ScaleZ"]
1913 s.PCode = (byte)(
int)row[
"PCode"];
1914 s.PathBegin = (ushort)(
int)row[
"PathBegin"];
1915 s.PathEnd = (ushort)(
int)row[
"PathEnd"];
1916 s.PathScaleX = (byte)(
int)row[
"PathScaleX"];
1917 s.PathScaleY = (byte)(
int)row[
"PathScaleY"];
1918 s.PathShearX = (byte)(
int)row[
"PathShearX"];
1919 s.PathShearY = (byte)(
int)row[
"PathShearY"];
1920 s.PathSkew = (sbyte)(
int)row[
"PathSkew"];
1921 s.PathCurve = (byte)(
int)row[
"PathCurve"];
1922 s.PathRadiusOffset = (sbyte)(
int)row[
"PathRadiusOffset"];
1923 s.PathRevolutions = (byte)(
int)row[
"PathRevolutions"];
1924 s.PathTaperX = (sbyte)(
int)row[
"PathTaperX"];
1925 s.PathTaperY = (sbyte)(
int)row[
"PathTaperY"];
1926 s.PathTwist = (sbyte)(
int)row[
"PathTwist"];
1927 s.PathTwistBegin = (sbyte)(
int)row[
"PathTwistBegin"];
1929 s.ProfileBegin = (ushort)(
int)row[
"ProfileBegin"];
1930 s.ProfileEnd = (ushort)(
int)row[
"ProfileEnd"];
1931 s.ProfileCurve = (byte)(
int)row[
"ProfileCurve"];
1932 s.ProfileHollow = (ushort)(
int)row[
"ProfileHollow"];
1933 s.TextureEntry = (byte[])row[
"Texture"];
1935 s.ExtraParams = (byte[])row[
"ExtraParams"];
1937 s.State = (byte)(
int)row[
"State"];
1938 s.LastAttachPoint = (byte)(
int)row[
"LastAttachPoint"];
1940 if (!(row[
"Media"] is System.DBNull))
1954 cmd.Parameters.AddWithValue(
"UUID", prim.UUID.ToString());
1956 cmd.Parameters.AddWithValue(
"Shape", 0);
1958 cmd.Parameters.AddWithValue(
"ScaleX", (double)s.
Scale.X);
1959 cmd.Parameters.AddWithValue(
"ScaleY", (double)s.
Scale.Y);
1960 cmd.Parameters.AddWithValue(
"ScaleZ", (double)s.
Scale.Z);
1962 cmd.Parameters.AddWithValue(
"PCode", s.PCode);
1963 cmd.Parameters.AddWithValue(
"PathBegin", s.PathBegin);
1964 cmd.Parameters.AddWithValue(
"PathEnd", s.PathEnd);
1965 cmd.Parameters.AddWithValue(
"PathScaleX", s.PathScaleX);
1966 cmd.Parameters.AddWithValue(
"PathScaleY", s.PathScaleY);
1967 cmd.Parameters.AddWithValue(
"PathShearX", s.PathShearX);
1968 cmd.Parameters.AddWithValue(
"PathShearY", s.PathShearY);
1969 cmd.Parameters.AddWithValue(
"PathSkew", s.PathSkew);
1970 cmd.Parameters.AddWithValue(
"PathCurve", s.PathCurve);
1971 cmd.Parameters.AddWithValue(
"PathRadiusOffset", s.PathRadiusOffset);
1972 cmd.Parameters.AddWithValue(
"PathRevolutions", s.PathRevolutions);
1973 cmd.Parameters.AddWithValue(
"PathTaperX", s.PathTaperX);
1974 cmd.Parameters.AddWithValue(
"PathTaperY", s.PathTaperY);
1975 cmd.Parameters.AddWithValue(
"PathTwist", s.PathTwist);
1976 cmd.Parameters.AddWithValue(
"PathTwistBegin", s.PathTwistBegin);
1978 cmd.Parameters.AddWithValue(
"ProfileBegin", s.ProfileBegin);
1979 cmd.Parameters.AddWithValue(
"ProfileEnd", s.ProfileEnd);
1980 cmd.Parameters.AddWithValue(
"ProfileCurve", s.ProfileCurve);
1981 cmd.Parameters.AddWithValue(
"ProfileHollow", s.ProfileHollow);
1982 cmd.Parameters.AddWithValue(
"Texture", s.TextureEntry);
1983 cmd.Parameters.AddWithValue(
"ExtraParams", s.ExtraParams);
1984 cmd.Parameters.AddWithValue(
"State", s.State);
1985 cmd.Parameters.AddWithValue(
"LastAttachPoint", s.LastAttachPoint);
1986 cmd.Parameters.AddWithValue(
"Media", null == s.Media ? null : s.Media.ToXml());
1993 RemoveItems(primID);
1995 if (items.Count == 0)
1998 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
2002 using (MySqlCommand cmd = dbcon.CreateCommand())
2004 cmd.CommandText =
"insert into primitems (" +
2005 "invType, assetType, name, " +
2006 "description, creationDate, nextPermissions, " +
2007 "currentPermissions, basePermissions, " +
2008 "everyonePermissions, groupPermissions, " +
2009 "flags, itemID, primID, assetID, " +
2010 "parentFolderID, creatorID, ownerID, " +
2011 "groupID, lastOwnerID) values (?invType, " +
2012 "?assetType, ?name, ?description, " +
2013 "?creationDate, ?nextPermissions, " +
2014 "?currentPermissions, ?basePermissions, " +
2015 "?everyonePermissions, ?groupPermissions, " +
2016 "?flags, ?itemID, ?primID, ?assetID, " +
2017 "?parentFolderID, ?creatorID, ?ownerID, " +
2018 "?groupID, ?lastOwnerID)";
2022 cmd.Parameters.Clear();
2024 FillItemCommand(cmd, item);
2026 ExecuteNonQuery(cmd);
2035 List<UUID> uuids =
new List<UUID>();
2039 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
2043 using (MySqlCommand cmd = dbcon.CreateCommand())
2045 cmd.CommandText =
"select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID";
2046 cmd.Parameters.AddWithValue(
"RegionUUID", regionID.ToString());
2048 using (IDataReader reader = ExecuteReader(cmd))
2050 while (reader.Read())
2052 UUID id =
new UUID(reader[
"UUID"].ToString());
2061 return uuids.ToArray();
2066 rs.ClearSpawnPoints();
2070 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
2074 using (MySqlCommand cmd = dbcon.CreateCommand())
2076 cmd.CommandText =
"select Yaw, Pitch, Distance from spawn_points where RegionID = ?RegionID";
2077 cmd.Parameters.AddWithValue(
"?RegionID", rs.RegionUUID.ToString());
2079 using (IDataReader r = cmd.ExecuteReader())
2085 sp.Yaw = (float)r[
"Yaw"];
2086 sp.Pitch = (float)r[
"Pitch"];
2087 sp.Distance = (float)r[
"Distance"];
2089 rs.AddSpawnPoint(sp);
2101 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
2105 using (MySqlCommand cmd = dbcon.CreateCommand())
2107 cmd.CommandText =
"delete from spawn_points where RegionID = ?RegionID";
2108 cmd.Parameters.AddWithValue(
"?RegionID", rs.RegionUUID.ToString());
2110 cmd.ExecuteNonQuery();
2112 cmd.Parameters.Clear();
2114 cmd.CommandText =
"insert into spawn_points (RegionID, Yaw, Pitch, Distance) values ( ?RegionID, ?Yaw, ?Pitch, ?Distance)";
2118 cmd.Parameters.AddWithValue(
"?RegionID", rs.RegionUUID.ToString());
2119 cmd.Parameters.AddWithValue(
"?Yaw", p.Yaw);
2120 cmd.Parameters.AddWithValue(
"?Pitch", p.Pitch);
2121 cmd.Parameters.AddWithValue(
"?Distance", p.Distance);
2123 cmd.ExecuteNonQuery();
2124 cmd.Parameters.Clear();
2131 public void SaveExtra(UUID regionID,
string name,
string val)
2133 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
2137 using (MySqlCommand cmd = dbcon.CreateCommand())
2139 cmd.CommandText =
"replace into regionextra values (?RegionID, ?Name, ?value)";
2140 cmd.Parameters.AddWithValue(
"?RegionID", regionID.ToString());
2141 cmd.Parameters.AddWithValue(
"?Name", name);
2142 cmd.Parameters.AddWithValue(
"?value", val);
2144 cmd.ExecuteNonQuery();
2151 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
2155 using (MySqlCommand cmd = dbcon.CreateCommand())
2157 cmd.CommandText =
"delete from regionextra where RegionID=?RegionID and Name=?Name";
2158 cmd.Parameters.AddWithValue(
"?RegionID", regionID.ToString());
2159 cmd.Parameters.AddWithValue(
"?Name", name);
2161 cmd.ExecuteNonQuery();
2166 public Dictionary<string, string>
GetExtra(UUID regionID)
2168 Dictionary<string, string> ret =
new Dictionary<string, string>();
2170 using (MySqlConnection dbcon =
new MySqlConnection(m_connectionString))
2174 using (MySqlCommand cmd = dbcon.CreateCommand())
2176 cmd.CommandText =
"select * from regionextra where RegionID=?RegionID";
2177 cmd.Parameters.AddWithValue(
"?RegionID", regionID.ToString());
2178 using (IDataReader r = cmd.ExecuteReader())
2182 ret[r[
"Name"].ToString()] = r[
"value"].ToString();
void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
Store Environment settings into region storage
Vector3 GroupPosition
The position of the entire group that this prim belongs to.
virtual void StorePrimInventory(UUID primID, ICollection< TaskInventoryItem > items)
Store a prim's inventory
string LoadRegionEnvironmentSettings(UUID regionUUID)
Load Environment settings from region storage
void Dispose()
Dispose the database
virtual void StoreLandObject(ILandObject parcel)
TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
Load the latest terrain revision from region storage
List< LandAccessEntry > ParcelAccessList
List of access data for the parcel. User data, some bitflags, and a time
virtual void StoreRegionSettings(RegionSettings rs)
OpenSim.Framework.RegionSettings RegionSettings
virtual void RemoveObject(UUID obj, UUID regionUUID)
Entirely removes the object, including inventory
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
PrimFlags Flags
Property flags. See OpenMetaverse.PrimFlags
MediaList Media
Entries to store media textures on each face
Represents an item in a task inventory
virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
Stores all object's details apart from inventory
virtual RegionSettings LoadRegionSettings(UUID regionUUID)
virtual void RemoveRegionWindlightSettings(UUID regionID)
virtual void Initialise(string connectionString)
Initialises the data storage engine
Dictionary< string, string > GetExtra(UUID regionID)
A MySQL Interface for the Region Server
UUID GlobalID
Global ID for the parcel. (3rd Party Integration)
void StoreTerrain(TerrainData terrData, UUID regionID)
Store a terrain revision in region storage
void RemoveRegionEnvironmentSettings(UUID regionUUID)
Delete Environment settings from region storage
void SaveExtra(UUID regionID, string name, string val)
This class stores and retrieves dynamic attributes.
Details of a Parcel of land
UUID[] GetObjectIDs(UUID regionID)
void StoreTerrain(double[,] ter, UUID regionID)
Vector3 AngularVelocity
Get or set angular velocity. Does not schedule update.
virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
virtual double[,] LoadTerrain(UUID regionID)
virtual List< LandData > LoadLandObjects(UUID regionUUID)
virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
void RemoveExtra(UUID regionID, string name)
Material
Material type for a primitive
List< SpawnPoint > SpawnPoints()
virtual List< SceneObjectGroup > LoadObjects(UUID regionID)
Load persisted objects from region storage.
virtual void RemoveLandObject(UUID globalID)
delete from land where UUID=globalID delete from landaccesslist where LandUUID=globalID ...
Quaternion RotationOffset
MySQLSimulationData(string connectionString)