PGSQLSimulationData.cs 132 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Data;
  30. using System.Drawing;
  31. using System.IO;
  32. using System.Reflection;
  33. using System.Threading;
  34. using log4net;
  35. using OpenMetaverse;
  36. using OpenSim.Framework;
  37. using OpenSim.Region.Framework.Interfaces;
  38. using OpenSim.Region.Framework.Scenes;
  39. using OpenSim.Data;
  40. using Npgsql;
  41. namespace OpenSim.Data.PGSQL
  42. {
  43. /// <summary>
  44. /// A PGSQL Interface for the Region Server.
  45. /// </summary>
  46. public class PGSQLSimulationData : ISimulationDataStore
  47. {
  48. private const string _migrationStore = "RegionStore";
  49. private const string LogHeader = "[REGION DB PGSQL]";
  50. // private static FileSystemDataStore Instance = new FileSystemDataStore();
  51. private static readonly ILog _Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  52. /// <summary>
  53. /// The database manager
  54. /// </summary>
  55. private PGSQLManager _Database;
  56. private string m_connectionString;
  57. protected virtual Assembly Assembly
  58. {
  59. get { return GetType().Assembly; }
  60. }
  61. public PGSQLSimulationData()
  62. {
  63. }
  64. public PGSQLSimulationData(string connectionString)
  65. {
  66. Initialise(connectionString);
  67. }
  68. /// <summary>
  69. /// Initialises the region datastore
  70. /// </summary>
  71. /// <param name="connectionString">The connection string.</param>
  72. public void Initialise(string connectionString)
  73. {
  74. m_connectionString = connectionString;
  75. _Database = new PGSQLManager(connectionString);
  76. using (NpgsqlConnection conn = new NpgsqlConnection(connectionString))
  77. {
  78. conn.Open();
  79. //New Migration settings
  80. Migration m = new Migration(conn, Assembly, "RegionStore");
  81. m.Update();
  82. }
  83. }
  84. /// <summary>
  85. /// Dispose the database
  86. /// </summary>
  87. public void Dispose() { }
  88. #region SceneObjectGroup region for loading and Store of the scene.
  89. /// <summary>
  90. /// Loads the objects present in the region.
  91. /// </summary>
  92. /// <param name="regionUUID">The region UUID.</param>
  93. /// <returns></returns>
  94. public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
  95. {
  96. UUID lastGroupID = UUID.Zero;
  97. Dictionary<UUID, SceneObjectPart> prims = new Dictionary<UUID, SceneObjectPart>();
  98. Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
  99. SceneObjectGroup grp = null;
  100. string sql = @"SELECT *,
  101. CASE WHEN prims.""UUID"" = prims.""SceneGroupID"" THEN 0 ELSE 1 END as sort
  102. FROM prims
  103. LEFT JOIN primshapes ON prims.""UUID"" = primshapes.""UUID""
  104. WHERE ""RegionUUID"" = :RegionUUID
  105. ORDER BY ""SceneGroupID"" asc, sort asc, ""LinkNumber"" asc";
  106. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  107. using (NpgsqlCommand command = new NpgsqlCommand(sql, conn))
  108. {
  109. command.Parameters.Add(_Database.CreateParameter("regionUUID", regionUUID));
  110. conn.Open();
  111. using (NpgsqlDataReader reader = command.ExecuteReader())
  112. {
  113. while (reader.Read())
  114. {
  115. SceneObjectPart sceneObjectPart = BuildPrim(reader);
  116. if (reader["Shape"] is DBNull)
  117. sceneObjectPart.Shape = PrimitiveBaseShape.Default;
  118. else
  119. sceneObjectPart.Shape = BuildShape(reader);
  120. prims[sceneObjectPart.UUID] = sceneObjectPart;
  121. UUID groupID = new UUID((Guid)reader["SceneGroupID"]);
  122. if (groupID != lastGroupID) // New SOG
  123. {
  124. if (grp != null)
  125. objects[grp.UUID] = grp;
  126. lastGroupID = groupID;
  127. // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are
  128. // recorded as the root prim (for which the UUID must equal the persisted group UUID). In
  129. // this case, force the UUID to be the same as the group UUID so that at least these can be
  130. // deleted (we need to change the UUID so that any other prims in the linkset can also be
  131. // deleted).
  132. if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero)
  133. {
  134. _Log.WarnFormat(
  135. "[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID",
  136. sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID);
  137. sceneObjectPart.UUID = groupID;
  138. }
  139. grp = new SceneObjectGroup(sceneObjectPart);
  140. }
  141. else
  142. {
  143. // Black magic to preserve link numbers
  144. // Why is this needed, fix this in AddPart method.
  145. int link = sceneObjectPart.LinkNum;
  146. grp.AddPart(sceneObjectPart);
  147. if (link != 0)
  148. sceneObjectPart.LinkNum = link;
  149. }
  150. }
  151. }
  152. }
  153. if (grp != null)
  154. objects[grp.UUID] = grp;
  155. // Instead of attempting to LoadItems on every prim,
  156. // most of which probably have no items... get a
  157. // list from DB of all prims which have items and
  158. // LoadItems only on those
  159. List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>();
  160. string qry = "select distinct \"primID\" from primitems";
  161. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  162. using (NpgsqlCommand command = new NpgsqlCommand(qry, conn))
  163. {
  164. conn.Open();
  165. using (NpgsqlDataReader itemReader = command.ExecuteReader())
  166. {
  167. while (itemReader.Read())
  168. {
  169. if (!(itemReader["primID"] is DBNull))
  170. {
  171. UUID primID = new UUID(itemReader["primID"].ToString());
  172. if (prims.ContainsKey(primID))
  173. {
  174. primsWithInventory.Add(prims[primID]);
  175. }
  176. }
  177. }
  178. }
  179. }
  180. LoadItems(primsWithInventory);
  181. _Log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count);
  182. return new List<SceneObjectGroup>(objects.Values);
  183. }
  184. /// <summary>
  185. /// Load in the prim's persisted inventory.
  186. /// </summary>
  187. /// <param name="allPrims">all prims with inventory on a region</param>
  188. private void LoadItems(List<SceneObjectPart> allPrimsWithInventory)
  189. {
  190. string sql = @"SELECT * FROM primitems WHERE ""primID"" = :PrimID";
  191. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  192. using (NpgsqlCommand command = new NpgsqlCommand(sql, conn))
  193. {
  194. conn.Open();
  195. foreach (SceneObjectPart objectPart in allPrimsWithInventory)
  196. {
  197. command.Parameters.Clear();
  198. command.Parameters.Add(_Database.CreateParameter("PrimID", objectPart.UUID));
  199. List<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
  200. using (NpgsqlDataReader reader = command.ExecuteReader())
  201. {
  202. while (reader.Read())
  203. {
  204. TaskInventoryItem item = BuildItem(reader);
  205. item.ParentID = objectPart.UUID; // Values in database are
  206. // often wrong
  207. inventory.Add(item);
  208. }
  209. }
  210. objectPart.Inventory.RestoreInventoryItems(inventory);
  211. }
  212. }
  213. }
  214. /// <summary>
  215. /// Stores all object's details apart from inventory
  216. /// </summary>
  217. /// <param name="obj"></param>
  218. /// <param name="regionUUID"></param>
  219. public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
  220. {
  221. uint flags = obj.RootPart.GetEffectiveObjectFlags();
  222. // Eligibility check
  223. //
  224. if ((flags & (uint)PrimFlags.Temporary) != 0)
  225. return;
  226. if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
  227. return;
  228. //_Log.DebugFormat("[PGSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Parts.Length);
  229. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  230. {
  231. conn.Open();
  232. NpgsqlTransaction transaction = conn.BeginTransaction();
  233. try
  234. {
  235. foreach (SceneObjectPart sceneObjectPart in obj.Parts)
  236. {
  237. //Update prim
  238. using (NpgsqlCommand sqlCommand = conn.CreateCommand())
  239. {
  240. sqlCommand.Transaction = transaction;
  241. try
  242. {
  243. StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID);
  244. }
  245. catch (NpgsqlException sqlEx)
  246. {
  247. _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.Line);
  248. throw;
  249. }
  250. }
  251. //Update primshapes
  252. using (NpgsqlCommand sqlCommand = conn.CreateCommand())
  253. {
  254. sqlCommand.Transaction = transaction;
  255. try
  256. {
  257. StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID);
  258. }
  259. catch (NpgsqlException sqlEx)
  260. {
  261. _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.Line);
  262. throw;
  263. }
  264. }
  265. }
  266. transaction.Commit();
  267. }
  268. catch (Exception ex)
  269. {
  270. _Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message);
  271. try
  272. {
  273. transaction.Rollback();
  274. }
  275. catch (Exception ex2)
  276. {
  277. //Show error
  278. _Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message);
  279. }
  280. }
  281. }
  282. }
  283. /// <summary>
  284. /// Stores the prim of the sceneobjectpart.
  285. /// </summary>
  286. /// <param name="sceneObjectPart">The sceneobjectpart or prim.</param>
  287. /// <param name="sqlCommand">The SQL command with the transaction.</param>
  288. /// <param name="sceneGroupID">The scenegroup UUID.</param>
  289. /// <param name="regionUUID">The region UUID.</param>
  290. private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID)
  291. {
  292. //Big query to update or insert a new prim.
  293. string queryPrims = @"
  294. UPDATE prims SET
  295. ""CreationDate"" = :CreationDate, ""Name"" = :Name, ""Text"" = :Text, ""Description"" = :Description, ""SitName"" = :SitName,
  296. ""TouchName"" = :TouchName, ""ObjectFlags"" = :ObjectFlags, ""OwnerMask"" = :OwnerMask, ""NextOwnerMask"" = :NextOwnerMask, ""GroupMask"" = :GroupMask,
  297. ""EveryoneMask"" = :EveryoneMask, ""BaseMask"" = :BaseMask, ""PositionX"" = :PositionX, ""PositionY"" = :PositionY, ""PositionZ"" = :PositionZ,
  298. ""GroupPositionX"" = :GroupPositionX, ""GroupPositionY"" = :GroupPositionY, ""GroupPositionZ"" = :GroupPositionZ, ""VelocityX"" = :VelocityX,
  299. ""VelocityY"" = :VelocityY, ""VelocityZ"" = :VelocityZ, ""AngularVelocityX"" = :AngularVelocityX, ""AngularVelocityY"" = :AngularVelocityY,
  300. ""AngularVelocityZ"" = :AngularVelocityZ, ""AccelerationX"" = :AccelerationX, ""AccelerationY"" = :AccelerationY,
  301. ""AccelerationZ"" = :AccelerationZ, ""RotationX"" = :RotationX, ""RotationY"" = :RotationY, ""RotationZ"" = :RotationZ, ""RotationW"" = :RotationW,
  302. ""SitTargetOffsetX"" = :SitTargetOffsetX, ""SitTargetOffsetY"" = :SitTargetOffsetY, ""SitTargetOffsetZ"" = :SitTargetOffsetZ,
  303. ""SitTargetOrientW"" = :SitTargetOrientW, ""SitTargetOrientX"" = :SitTargetOrientX, ""SitTargetOrientY"" = :SitTargetOrientY,
  304. ""SitTargetOrientZ"" = :SitTargetOrientZ, ""RegionUUID"" = :RegionUUID, ""CreatorID"" = :CreatorID, ""OwnerID"" = :OwnerID, ""GroupID"" = :GroupID,
  305. ""LastOwnerID"" = :LastOwnerID, ""SceneGroupID"" = :SceneGroupID, ""PayPrice"" = :PayPrice, ""PayButton1"" = :PayButton1, ""PayButton2"" = :PayButton2,
  306. ""PayButton3"" = :PayButton3, ""PayButton4"" = :PayButton4, ""LoopedSound"" = :LoopedSound, ""LoopedSoundGain"" = :LoopedSoundGain,
  307. ""TextureAnimation"" = :TextureAnimation, ""OmegaX"" = :OmegaX, ""OmegaY"" = :OmegaY, ""OmegaZ"" = :OmegaZ, ""CameraEyeOffsetX"" = :CameraEyeOffsetX,
  308. ""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX,
  309. ""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook,
  310. ""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice,
  311. ""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution,
  312. ""PassCollisions"" = :PassCollisions, ""RotationAxisLocks"" = :RotationAxisLocks, ""RezzerID"" = :RezzerID,
  313. ""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
  314. ""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs,
  315. ""PhysInertia"" = :PhysInertia
  316. WHERE ""UUID"" = :UUID ;
  317. INSERT INTO
  318. prims (
  319. ""UUID"", ""CreationDate"", ""Name"", ""Text"", ""Description"", ""SitName"", ""TouchName"", ""ObjectFlags"", ""OwnerMask"", ""NextOwnerMask"", ""GroupMask"",
  320. ""EveryoneMask"", ""BaseMask"", ""PositionX"", ""PositionY"", ""PositionZ"", ""GroupPositionX"", ""GroupPositionY"", ""GroupPositionZ"", ""VelocityX"",
  321. ""VelocityY"", ""VelocityZ"", ""AngularVelocityX"", ""AngularVelocityY"", ""AngularVelocityZ"", ""AccelerationX"", ""AccelerationY"", ""AccelerationZ"",
  322. ""RotationX"", ""RotationY"", ""RotationZ"", ""RotationW"", ""SitTargetOffsetX"", ""SitTargetOffsetY"", ""SitTargetOffsetZ"", ""SitTargetOrientW"",
  323. ""SitTargetOrientX"", ""SitTargetOrientY"", ""SitTargetOrientZ"", ""RegionUUID"", ""CreatorID"", ""OwnerID"", ""GroupID"", ""LastOwnerID"", ""SceneGroupID"",
  324. ""PayPrice"", ""PayButton1"", ""PayButton2"", ""PayButton3"", ""PayButton4"", ""LoopedSound"", ""LoopedSoundGain"", ""TextureAnimation"", ""OmegaX"",
  325. ""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
  326. ""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
  327. ""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
  328. ""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""PhysInertia""
  329. ) Select
  330. :UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
  331. :EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
  332. :VelocityY, :VelocityZ, :AngularVelocityX, :AngularVelocityY, :AngularVelocityZ, :AccelerationX, :AccelerationY, :AccelerationZ,
  333. :RotationX, :RotationY, :RotationZ, :RotationW, :SitTargetOffsetX, :SitTargetOffsetY, :SitTargetOffsetZ, :SitTargetOrientW,
  334. :SitTargetOrientX, :SitTargetOrientY, :SitTargetOrientZ, :RegionUUID, :CreatorID, :OwnerID, :GroupID, :LastOwnerID, :SceneGroupID,
  335. :PayPrice, :PayButton1, :PayButton2, :PayButton3, :PayButton4, :LoopedSound, :LoopedSoundGain, :TextureAnimation, :OmegaX,
  336. :OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
  337. :ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
  338. :ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
  339. :PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :PhysInertia
  340. where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
  341. ";
  342. //Set commandtext.
  343. sqlCommand.CommandText = queryPrims;
  344. //Add parameters
  345. sqlCommand.Parameters.AddRange(CreatePrimParameters(sceneObjectPart, sceneGroupID, regionUUID));
  346. //Execute the query. If it fails then error is trapped in calling function
  347. sqlCommand.ExecuteNonQuery();
  348. }
  349. /// <summary>
  350. /// Stores the scene object prim shapes.
  351. /// </summary>
  352. /// <param name="sceneObjectPart">The sceneobjectpart containing prim shape.</param>
  353. /// <param name="sqlCommand">The SQL command with the transaction.</param>
  354. /// <param name="sceneGroupID">The scenegroup UUID.</param>
  355. /// <param name="regionUUID">The region UUID.</param>
  356. private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID)
  357. {
  358. //Big query to or insert or update primshapes
  359. string queryPrimShapes = @"
  360. UPDATE primshapes SET
  361. ""Shape"" = :Shape, ""ScaleX"" = :ScaleX, ""ScaleY"" = :ScaleY, ""ScaleZ"" = :ScaleZ, ""PCode"" = :PCode, ""PathBegin"" = :PathBegin,
  362. ""PathEnd"" = :PathEnd, ""PathScaleX"" = :PathScaleX, ""PathScaleY"" = :PathScaleY, ""PathShearX"" = :PathShearX, ""PathShearY"" = :PathShearY,
  363. ""PathSkew"" = :PathSkew, ""PathCurve"" = :PathCurve, ""PathRadiusOffset"" = :PathRadiusOffset, ""PathRevolutions"" = :PathRevolutions,
  364. ""PathTaperX"" = :PathTaperX, ""PathTaperY"" = :PathTaperY, ""PathTwist"" = :PathTwist, ""PathTwistBegin"" = :PathTwistBegin,
  365. ""ProfileBegin"" = :ProfileBegin, ""ProfileEnd"" = :ProfileEnd, ""ProfileCurve"" = :ProfileCurve, ""ProfileHollow"" = :ProfileHollow,
  366. ""Texture"" = :Texture, ""ExtraParams"" = :ExtraParams, ""State"" = :State, ""Media"" = :Media
  367. WHERE ""UUID"" = :UUID ;
  368. INSERT INTO
  369. primshapes (
  370. ""UUID"", ""Shape"", ""ScaleX"", ""ScaleY"", ""ScaleZ"", ""PCode"", ""PathBegin"", ""PathEnd"", ""PathScaleX"", ""PathScaleY"", ""PathShearX"", ""PathShearY"",
  371. ""PathSkew"", ""PathCurve"", ""PathRadiusOffset"", ""PathRevolutions"", ""PathTaperX"", ""PathTaperY"", ""PathTwist"", ""PathTwistBegin"", ""ProfileBegin"",
  372. ""ProfileEnd"", ""ProfileCurve"", ""ProfileHollow"", ""Texture"", ""ExtraParams"", ""State"", ""Media""
  373. )
  374. Select
  375. :UUID, :Shape, :ScaleX, :ScaleY, :ScaleZ, :PCode, :PathBegin, :PathEnd, :PathScaleX, :PathScaleY, :PathShearX, :PathShearY,
  376. :PathSkew, :PathCurve, :PathRadiusOffset, :PathRevolutions, :PathTaperX, :PathTaperY, :PathTwist, :PathTwistBegin, :ProfileBegin,
  377. :ProfileEnd, :ProfileCurve, :ProfileHollow, :Texture, :ExtraParams, :State, :Media
  378. where not EXISTS (SELECT ""UUID"" FROM primshapes WHERE ""UUID"" = :UUID);
  379. ";
  380. //Set commandtext.
  381. sqlCommand.CommandText = queryPrimShapes;
  382. //Add parameters
  383. sqlCommand.Parameters.AddRange(CreatePrimShapeParameters(sceneObjectPart, sceneGroupID, regionUUID));
  384. //Execute the query. If it fails then error is trapped in calling function
  385. sqlCommand.ExecuteNonQuery();
  386. }
  387. /// <summary>
  388. /// Removes a object from the database.
  389. /// Meaning removing it from tables Prims, PrimShapes and PrimItems
  390. /// </summary>
  391. /// <param name="objectID">id of scenegroup</param>
  392. /// <param name="regionUUID">regionUUID (is this used anyway</param>
  393. public void RemoveObject(UUID objectID, UUID regionUUID)
  394. {
  395. //_Log.InfoFormat("[PGSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID);
  396. //Remove from prims and primsitem table
  397. string sqlPrims = @"DELETE FROM PRIMS WHERE ""SceneGroupID"" = :objectID";
  398. string sqlPrimItems = @"DELETE FROM PRIMITEMS WHERE ""primID"" in (SELECT ""UUID"" FROM PRIMS WHERE ""SceneGroupID"" = :objectID)";
  399. string sqlPrimShapes = @"DELETE FROM PRIMSHAPES WHERE ""UUID"" in (SELECT ""UUID"" FROM PRIMS WHERE ""SceneGroupID"" = :objectID)";
  400. lock (_Database)
  401. {
  402. //Using the non transaction mode.
  403. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  404. using (NpgsqlCommand cmd = new NpgsqlCommand())
  405. {
  406. cmd.Connection = conn;
  407. cmd.CommandText = sqlPrimShapes;
  408. conn.Open();
  409. cmd.Parameters.Add(_Database.CreateParameter("objectID", objectID));
  410. cmd.ExecuteNonQuery();
  411. cmd.CommandText = sqlPrimItems;
  412. cmd.ExecuteNonQuery();
  413. cmd.CommandText = sqlPrims;
  414. cmd.ExecuteNonQuery();
  415. }
  416. }
  417. }
  418. /// <summary>
  419. /// Store the inventory of a prim. Warning deletes everything first and then adds all again.
  420. /// </summary>
  421. /// <param name="primID"></param>
  422. /// <param name="items"></param>
  423. public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
  424. {
  425. //_Log.InfoFormat("[REGION DB: Persisting Prim Inventory with prim ID {0}", primID);
  426. //Statement from PGSQL section!
  427. // For now, we're just going to crudely remove all the previous inventory items
  428. // no matter whether they have changed or not, and replace them with the current set.
  429. //Delete everything from PrimID
  430. //TODO add index on PrimID in DB, if not already exist
  431. string sql = @"delete from primitems where ""primID"" = :primID";
  432. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  433. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  434. {
  435. cmd.Parameters.Add(_Database.CreateParameter("primID", primID));
  436. conn.Open();
  437. cmd.ExecuteNonQuery();
  438. }
  439. sql =
  440. @"INSERT INTO primitems (
  441. ""itemID"",""primID"",""assetID"",""parentFolderID"",""invType"",""assetType"",""name"",""description"",""creationDate"",""creatorID"",""ownerID"",""lastOwnerID"",""groupID"",
  442. ""nextPermissions"",""currentPermissions"",""basePermissions"",""everyonePermissions"",""groupPermissions"",""flags"")
  443. VALUES (:itemID,:primID,:assetID,:parentFolderID,:invType,:assetType,:name,:description,:creationDate,:creatorID,:ownerID,
  444. :lastOwnerID,:groupID,:nextPermissions,:currentPermissions,:basePermissions,:everyonePermissions,:groupPermissions,:flags)";
  445. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  446. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  447. {
  448. conn.Open();
  449. foreach (TaskInventoryItem taskItem in items)
  450. {
  451. cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem));
  452. cmd.ExecuteNonQuery();
  453. cmd.Parameters.Clear();
  454. }
  455. }
  456. }
  457. #endregion
  458. /// <summary>
  459. /// Loads the terrain map.
  460. /// </summary>
  461. /// <param name="regionID">regionID.</param>
  462. /// <returns></returns>
  463. public double[,] LoadTerrain(UUID regionID)
  464. {
  465. double[,] ret = null;
  466. TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
  467. if (terrData != null)
  468. ret = terrData.GetDoubles();
  469. return ret;
  470. }
  471. // Returns 'null' if region not found
  472. public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
  473. {
  474. TerrainData terrData = null;
  475. string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from terrain
  476. where ""RegionUUID"" = :RegionUUID order by ""Revision"" desc limit 1; ";
  477. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  478. {
  479. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  480. {
  481. // PGSqlParameter param = new PGSqlParameter();
  482. cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
  483. conn.Open();
  484. using (NpgsqlDataReader reader = cmd.ExecuteReader())
  485. {
  486. int rev;
  487. if (reader.Read())
  488. {
  489. rev = Convert.ToInt32(reader["Revision"]);
  490. if ((reader["Heightfield"] != DBNull.Value))
  491. {
  492. byte[] blob = (byte[])reader["Heightfield"];
  493. terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
  494. }
  495. }
  496. else
  497. {
  498. _Log.Info("[REGION DB]: No terrain found for region");
  499. return null;
  500. }
  501. _Log.Info("[REGION DB]: Loaded terrain revision r" + rev);
  502. }
  503. }
  504. }
  505. return terrData;
  506. }
  507. public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
  508. {
  509. TerrainData terrData = null;
  510. string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain
  511. where ""RegionUUID"" = :RegionUUID; ";
  512. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  513. {
  514. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  515. {
  516. // PGSqlParameter param = new PGSqlParameter();
  517. cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
  518. conn.Open();
  519. using (NpgsqlDataReader reader = cmd.ExecuteReader())
  520. {
  521. int rev;
  522. if (reader.Read())
  523. {
  524. rev = Convert.ToInt32(reader["Revision"]);
  525. if ((reader["Heightfield"] != DBNull.Value))
  526. {
  527. byte[] blob = (byte[])reader["Heightfield"];
  528. terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
  529. }
  530. }
  531. }
  532. }
  533. }
  534. return terrData;
  535. }
  536. // Legacy entry point for when terrain was always a 256x256 heightmap
  537. public void StoreTerrain(double[,] terrain, UUID regionID)
  538. {
  539. StoreTerrain(new HeightmapTerrainData(terrain), regionID);
  540. }
  541. /// <summary>
  542. /// Stores the terrain map to DB.
  543. /// </summary>
  544. /// <param name="terrain">terrain map data.</param>
  545. /// <param name="regionID">regionID.</param>
  546. public void StoreTerrain(TerrainData terrData, UUID regionID)
  547. {
  548. //Delete old terrain map
  549. string sql = @"delete from terrain where ""RegionUUID""=:RegionUUID";
  550. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  551. {
  552. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  553. {
  554. cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
  555. conn.Open();
  556. cmd.ExecuteNonQuery();
  557. _Log.InfoFormat("{0} Deleted terrain revision id = {1}", LogHeader, regionID);
  558. }
  559. }
  560. int terrainDBRevision;
  561. Array terrainDBblob;
  562. terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
  563. sql = @"insert into terrain(""RegionUUID"", ""Revision"", ""Heightfield"") values(:RegionUUID, :Revision, :Heightfield)";
  564. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  565. {
  566. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  567. {
  568. cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
  569. cmd.Parameters.Add(_Database.CreateParameter("Revision", terrainDBRevision));
  570. cmd.Parameters.Add(_Database.CreateParameter("Heightfield", terrainDBblob));
  571. conn.Open();
  572. cmd.ExecuteNonQuery();
  573. _Log.InfoFormat("{0} Stored terrain id = {1}, terrainSize = <{2},{3}>",
  574. LogHeader, regionID, terrData.SizeX, terrData.SizeY);
  575. }
  576. }
  577. }
  578. /// <summary>
  579. /// Stores the baked terrain map to DB.
  580. /// </summary>
  581. /// <param name="terrain">terrain map data.</param>
  582. /// <param name="regionID">regionID.</param>
  583. public void StoreBakedTerrain(TerrainData terrData, UUID regionID)
  584. {
  585. //Delete old terrain map
  586. string sql = @"delete from bakedterrain where ""RegionUUID""=:RegionUUID";
  587. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  588. {
  589. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  590. {
  591. cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
  592. conn.Open();
  593. cmd.ExecuteNonQuery();
  594. _Log.InfoFormat("{0} Deleted bakedterrain id = {1}", LogHeader, regionID);
  595. }
  596. }
  597. int terrainDBRevision;
  598. Array terrainDBblob;
  599. terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
  600. sql = @"insert into bakedterrain(""RegionUUID"", ""Revision"", ""Heightfield"") values(:RegionUUID, :Revision, :Heightfield)";
  601. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  602. {
  603. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  604. {
  605. cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
  606. cmd.Parameters.Add(_Database.CreateParameter("Revision", terrainDBRevision));
  607. cmd.Parameters.Add(_Database.CreateParameter("Heightfield", terrainDBblob));
  608. conn.Open();
  609. cmd.ExecuteNonQuery();
  610. _Log.InfoFormat("{0} Stored bakedterrain id = {1}, terrainSize = <{2},{3}>",
  611. LogHeader, regionID, terrData.SizeX, terrData.SizeY);
  612. }
  613. }
  614. }
  615. /// <summary>
  616. /// Loads all the land objects of a region.
  617. /// </summary>
  618. /// <param name="regionUUID">The region UUID.</param>
  619. /// <returns></returns>
  620. public List<LandData> LoadLandObjects(UUID regionUUID)
  621. {
  622. List<LandData> LandDataForRegion = new List<LandData>();
  623. string sql = @"select * from land where ""RegionUUID"" = :RegionUUID";
  624. //Retrieve all land data from region
  625. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  626. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  627. {
  628. cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID));
  629. conn.Open();
  630. using (NpgsqlDataReader readerLandData = cmd.ExecuteReader())
  631. {
  632. while (readerLandData.Read())
  633. {
  634. LandDataForRegion.Add(BuildLandData(readerLandData));
  635. }
  636. }
  637. }
  638. //Retrieve all accesslist data for all landdata
  639. foreach (LandData LandData in LandDataForRegion)
  640. {
  641. sql = @"select * from landaccesslist where ""LandUUID"" = :LandUUID";
  642. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  643. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  644. {
  645. cmd.Parameters.Add(_Database.CreateParameter("LandUUID", LandData.GlobalID));
  646. conn.Open();
  647. using (NpgsqlDataReader readerAccessList = cmd.ExecuteReader())
  648. {
  649. while (readerAccessList.Read())
  650. {
  651. LandData.ParcelAccessList.Add(BuildLandAccessData(readerAccessList));
  652. }
  653. }
  654. }
  655. }
  656. //Return data
  657. return LandDataForRegion;
  658. }
  659. /// <summary>
  660. /// Stores land object with landaccess list.
  661. /// </summary>
  662. /// <param name="parcel">parcel data.</param>
  663. public void StoreLandObject(ILandObject parcel)
  664. {
  665. //As this is only one record in land table I just delete all and then add a new record.
  666. //As the delete landaccess is already in the pgsql code
  667. //Delete old values
  668. RemoveLandObject(parcel.LandData.GlobalID);
  669. //Insert new values
  670. string sql = @"INSERT INTO land
  671. (""UUID"",""RegionUUID"",""LocalLandID"",""Bitmap"",""Name"",""Description"",""OwnerUUID"",""IsGroupOwned"",""Area"",""AuctionID"",""Category"",""ClaimDate"",""ClaimPrice"",
  672. ""GroupUUID"",""SalePrice"",""LandStatus"",""LandFlags"",""LandingType"",""MediaAutoScale"",""MediaTextureUUID"",""MediaURL"",""MusicURL"",""PassHours"",""PassPrice"",
  673. ""SnapshotUUID"",""UserLocationX"",""UserLocationY"",""UserLocationZ"",""UserLookAtX"",""UserLookAtY"",""UserLookAtZ"",""AuthbuyerID"",""OtherCleanTime"",""Dwell"",
  674. ""MediaType"",""MediaDescription"",""MediaSize"",""MediaLoop"",""ObscureMusic"",""ObscureMedia"",""SeeAVs"",""AnyAVSounds"",""GroupAVSounds"")
  675. VALUES
  676. (:UUID,:RegionUUID,:LocalLandID,:Bitmap,:Name,:Description,:OwnerUUID,:IsGroupOwned,:Area,:AuctionID,:Category,:ClaimDate,:ClaimPrice,
  677. :GroupUUID,:SalePrice,:LandStatus,:LandFlags,:LandingType,:MediaAutoScale,:MediaTextureUUID,:MediaURL,:MusicURL,:PassHours,:PassPrice,
  678. :SnapshotUUID,:UserLocationX,:UserLocationY,:UserLocationZ,:UserLookAtX,:UserLookAtY,:UserLookAtZ,:AuthbuyerID,:OtherCleanTime,:Dwell,
  679. :MediaType,:MediaDescription,:MediaWidth::text || ',' || :MediaHeight::text,:MediaLoop,:ObscureMusic,:ObscureMedia,:SeeAVs::int::smallint,
  680. :AnyAVSounds::int::smallint,:GroupAVSounds::int::smallint)";
  681. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  682. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  683. {
  684. cmd.Parameters.AddRange(CreateLandParameters(parcel.LandData, parcel.RegionUUID));
  685. conn.Open();
  686. cmd.ExecuteNonQuery();
  687. }
  688. sql = @"INSERT INTO landaccesslist (""LandUUID"",""AccessUUID"",""LandFlags"",""Expires"") VALUES (:LandUUID,:AccessUUID,:Flags,:Expires)";
  689. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  690. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  691. {
  692. conn.Open();
  693. foreach (LandAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList)
  694. {
  695. cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID));
  696. cmd.ExecuteNonQuery();
  697. cmd.Parameters.Clear();
  698. }
  699. }
  700. }
  701. /// <summary>
  702. /// Removes a land object from DB.
  703. /// </summary>
  704. /// <param name="globalID">UUID of landobject</param>
  705. public void RemoveLandObject(UUID globalID)
  706. {
  707. string sql = @"delete from land where ""UUID""=:UUID";
  708. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  709. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  710. {
  711. cmd.Parameters.Add(_Database.CreateParameter("UUID", globalID));
  712. conn.Open();
  713. cmd.ExecuteNonQuery();
  714. }
  715. sql = @"delete from landaccesslist where ""LandUUID""=:UUID";
  716. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  717. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  718. {
  719. cmd.Parameters.Add(_Database.CreateParameter("UUID", globalID));
  720. conn.Open();
  721. cmd.ExecuteNonQuery();
  722. }
  723. }
  724. public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
  725. {
  726. RegionLightShareData nWP = new RegionLightShareData();
  727. nWP.OnSave += StoreRegionWindlightSettings;
  728. string sql = @"select * from regionwindlight where ""region_id"" = :regionID";
  729. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  730. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  731. {
  732. cmd.Parameters.Add(_Database.CreateParameter("regionID", regionUUID.ToString() ));
  733. conn.Open();
  734. using (NpgsqlDataReader result = cmd.ExecuteReader())
  735. {
  736. if (!result.Read())
  737. {
  738. //No result, so store our default windlight profile and return it
  739. nWP.regionID = regionUUID;
  740. StoreRegionWindlightSettings(nWP);
  741. return nWP;
  742. }
  743. else
  744. {
  745. nWP.regionID = DBGuid.FromDB(result["region_id"]);
  746. nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
  747. nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
  748. nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
  749. nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
  750. nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
  751. nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
  752. nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
  753. nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
  754. nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
  755. nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
  756. nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
  757. nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
  758. nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
  759. nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
  760. nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
  761. nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
  762. nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
  763. UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
  764. nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
  765. nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
  766. nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
  767. nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
  768. nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
  769. nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
  770. nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
  771. nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
  772. nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
  773. nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
  774. nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
  775. nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
  776. nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
  777. nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
  778. nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
  779. nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
  780. nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
  781. nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
  782. nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
  783. nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
  784. nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
  785. nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
  786. nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
  787. nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
  788. nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
  789. nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
  790. nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
  791. nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
  792. nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
  793. nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
  794. nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
  795. nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
  796. nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
  797. nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
  798. nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
  799. nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
  800. nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
  801. nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
  802. nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
  803. nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
  804. nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
  805. nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
  806. nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
  807. nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
  808. nWP.valid = true;
  809. }
  810. }
  811. }
  812. return nWP;
  813. }
  814. public void RemoveRegionWindlightSettings(UUID regionID)
  815. {
  816. string sql = @"delete from regionwindlight where ""region_id"" = :region_id";
  817. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  818. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  819. {
  820. conn.Open();
  821. cmd.Parameters.Add(_Database.CreateParameter("region_id", regionID.ToString()));
  822. cmd.ExecuteNonQuery();
  823. }
  824. }
  825. public void StoreRegionWindlightSettings(RegionLightShareData wl)
  826. {
  827. string sql = @"select region_id from regionwindlight where ""region_id"" = :region_id limit 1;";
  828. bool exists = false;
  829. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  830. {
  831. conn.Open();
  832. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  833. {
  834. cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString() ));
  835. NpgsqlDataReader dr = cmd.ExecuteReader();
  836. exists = dr.Read();
  837. }
  838. }
  839. if (exists)
  840. {
  841. RemoveRegionWindlightSettings(wl.regionID);
  842. }
  843. // sql insert
  844. sql = @"INSERT INTO regionwindlight
  845. (region_id
  846. ,water_color_r
  847. ,water_color_g
  848. ,water_color_b
  849. ,water_fog_density_exponent
  850. ,underwater_fog_modifier
  851. ,reflection_wavelet_scale_1
  852. ,reflection_wavelet_scale_2
  853. ,reflection_wavelet_scale_3
  854. ,fresnel_scale
  855. ,fresnel_offset
  856. ,refract_scale_above
  857. ,refract_scale_below
  858. ,blur_multiplier
  859. ,big_wave_direction_x
  860. ,big_wave_direction_y
  861. ,little_wave_direction_x
  862. ,little_wave_direction_y
  863. ,normal_map_texture
  864. ,horizon_r
  865. ,horizon_g
  866. ,horizon_b
  867. ,horizon_i
  868. ,haze_horizon
  869. ,blue_density_r
  870. ,blue_density_g
  871. ,blue_density_b
  872. ,blue_density_i
  873. ,haze_density
  874. ,density_multiplier
  875. ,distance_multiplier
  876. ,max_altitude
  877. ,sun_moon_color_r
  878. ,sun_moon_color_g
  879. ,sun_moon_color_b
  880. ,sun_moon_color_i
  881. ,sun_moon_position
  882. ,ambient_r
  883. ,ambient_g
  884. ,ambient_b
  885. ,ambient_i
  886. ,east_angle
  887. ,sun_glow_focus
  888. ,sun_glow_size
  889. ,scene_gamma
  890. ,star_brightness
  891. ,cloud_color_r
  892. ,cloud_color_g
  893. ,cloud_color_b
  894. ,cloud_color_i
  895. ,cloud_x
  896. ,cloud_y
  897. ,cloud_density
  898. ,cloud_coverage
  899. ,cloud_scale
  900. ,cloud_detail_x
  901. ,cloud_detail_y
  902. ,cloud_detail_density
  903. ,cloud_scroll_x
  904. ,cloud_scroll_x_lock
  905. ,cloud_scroll_y
  906. ,cloud_scroll_y_lock
  907. ,draw_classic_clouds)
  908. VALUES
  909. (:region_id
  910. ,:water_color_r
  911. ,:water_color_g
  912. ,:water_color_b
  913. ,:water_fog_density_exponent
  914. ,:underwater_fog_modifier
  915. ,:reflection_wavelet_scale_1
  916. ,:reflection_wavelet_scale_2
  917. ,:reflection_wavelet_scale_3
  918. ,:fresnel_scale
  919. ,:fresnel_offset
  920. ,:refract_scale_above
  921. ,:refract_scale_below
  922. ,:blur_multiplier
  923. ,:big_wave_direction_x
  924. ,:big_wave_direction_y
  925. ,:little_wave_direction_x
  926. ,:little_wave_direction_y
  927. ,:normal_map_texture
  928. ,:horizon_r
  929. ,:horizon_g
  930. ,:horizon_b
  931. ,:horizon_i
  932. ,:haze_horizon
  933. ,:blue_density_r
  934. ,:blue_density_g
  935. ,:blue_density_b
  936. ,:blue_density_i
  937. ,:haze_density
  938. ,:density_multiplier
  939. ,:distance_multiplier
  940. ,:max_altitude
  941. ,:sun_moon_color_r
  942. ,:sun_moon_color_g
  943. ,:sun_moon_color_b
  944. ,:sun_moon_color_i
  945. ,:sun_moon_position
  946. ,:ambient_r
  947. ,:ambient_g
  948. ,:ambient_b
  949. ,:ambient_i
  950. ,:east_angle
  951. ,:sun_glow_focus
  952. ,:sun_glow_size
  953. ,:scene_gamma
  954. ,:star_brightness
  955. ,:cloud_color_r
  956. ,:cloud_color_g
  957. ,:cloud_color_b
  958. ,:cloud_color_i
  959. ,:cloud_x
  960. ,:cloud_y
  961. ,:cloud_density
  962. ,:cloud_coverage
  963. ,:cloud_scale
  964. ,:cloud_detail_x
  965. ,:cloud_detail_y
  966. ,:cloud_detail_density
  967. ,:cloud_scroll_x
  968. ,:cloud_scroll_x_lock
  969. ,:cloud_scroll_y
  970. ,:cloud_scroll_y_lock
  971. ,:draw_classic_clouds);";
  972. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  973. {
  974. conn.Open();
  975. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  976. {
  977. cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString()));
  978. cmd.Parameters.Add(_Database.CreateParameter("water_color_r", wl.waterColor.X));
  979. cmd.Parameters.Add(_Database.CreateParameter("water_color_g", wl.waterColor.Y));
  980. cmd.Parameters.Add(_Database.CreateParameter("water_color_b", wl.waterColor.Z));
  981. cmd.Parameters.Add(_Database.CreateParameter("water_fog_density_exponent", wl.waterFogDensityExponent));
  982. cmd.Parameters.Add(_Database.CreateParameter("underwater_fog_modifier", wl.underwaterFogModifier));
  983. cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X));
  984. cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y));
  985. cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z));
  986. cmd.Parameters.Add(_Database.CreateParameter("fresnel_scale", wl.fresnelScale));
  987. cmd.Parameters.Add(_Database.CreateParameter("fresnel_offset", wl.fresnelOffset));
  988. cmd.Parameters.Add(_Database.CreateParameter("refract_scale_above", wl.refractScaleAbove));
  989. cmd.Parameters.Add(_Database.CreateParameter("refract_scale_below", wl.refractScaleBelow));
  990. cmd.Parameters.Add(_Database.CreateParameter("blur_multiplier", wl.blurMultiplier));
  991. cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_x", wl.bigWaveDirection.X));
  992. cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_y", wl.bigWaveDirection.Y));
  993. cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_x", wl.littleWaveDirection.X));
  994. cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_y", wl.littleWaveDirection.Y));
  995. cmd.Parameters.Add(_Database.CreateParameter("normal_map_texture", wl.normalMapTexture.ToString()));
  996. cmd.Parameters.Add(_Database.CreateParameter("horizon_r", wl.horizon.X));
  997. cmd.Parameters.Add(_Database.CreateParameter("horizon_g", wl.horizon.Y));
  998. cmd.Parameters.Add(_Database.CreateParameter("horizon_b", wl.horizon.Z));
  999. cmd.Parameters.Add(_Database.CreateParameter("horizon_i", wl.horizon.W));
  1000. cmd.Parameters.Add(_Database.CreateParameter("haze_horizon", wl.hazeHorizon));
  1001. cmd.Parameters.Add(_Database.CreateParameter("blue_density_r", wl.blueDensity.X));
  1002. cmd.Parameters.Add(_Database.CreateParameter("blue_density_g", wl.blueDensity.Y));
  1003. cmd.Parameters.Add(_Database.CreateParameter("blue_density_b", wl.blueDensity.Z));
  1004. cmd.Parameters.Add(_Database.CreateParameter("blue_density_i", wl.blueDensity.W));
  1005. cmd.Parameters.Add(_Database.CreateParameter("haze_density", wl.hazeDensity));
  1006. cmd.Parameters.Add(_Database.CreateParameter("density_multiplier", wl.densityMultiplier));
  1007. cmd.Parameters.Add(_Database.CreateParameter("distance_multiplier", wl.distanceMultiplier));
  1008. cmd.Parameters.Add(_Database.CreateParameter("max_altitude", wl.maxAltitude));
  1009. cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_r", wl.sunMoonColor.X));
  1010. cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_g", wl.sunMoonColor.Y));
  1011. cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_b", wl.sunMoonColor.Z));
  1012. cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_i", wl.sunMoonColor.W));
  1013. cmd.Parameters.Add(_Database.CreateParameter("sun_moon_position", wl.sunMoonPosition));
  1014. cmd.Parameters.Add(_Database.CreateParameter("ambient_r", wl.ambient.X));
  1015. cmd.Parameters.Add(_Database.CreateParameter("ambient_g", wl.ambient.Y));
  1016. cmd.Parameters.Add(_Database.CreateParameter("ambient_b", wl.ambient.Z));
  1017. cmd.Parameters.Add(_Database.CreateParameter("ambient_i", wl.ambient.W));
  1018. cmd.Parameters.Add(_Database.CreateParameter("east_angle", wl.eastAngle));
  1019. cmd.Parameters.Add(_Database.CreateParameter("sun_glow_focus", wl.sunGlowFocus));
  1020. cmd.Parameters.Add(_Database.CreateParameter("sun_glow_size", wl.sunGlowSize));
  1021. cmd.Parameters.Add(_Database.CreateParameter("scene_gamma", wl.sceneGamma));
  1022. cmd.Parameters.Add(_Database.CreateParameter("star_brightness", wl.starBrightness));
  1023. cmd.Parameters.Add(_Database.CreateParameter("cloud_color_r", wl.cloudColor.X));
  1024. cmd.Parameters.Add(_Database.CreateParameter("cloud_color_g", wl.cloudColor.Y));
  1025. cmd.Parameters.Add(_Database.CreateParameter("cloud_color_b", wl.cloudColor.Z));
  1026. cmd.Parameters.Add(_Database.CreateParameter("cloud_color_i", wl.cloudColor.W));
  1027. cmd.Parameters.Add(_Database.CreateParameter("cloud_x", wl.cloudXYDensity.X));
  1028. cmd.Parameters.Add(_Database.CreateParameter("cloud_y", wl.cloudXYDensity.Y));
  1029. cmd.Parameters.Add(_Database.CreateParameter("cloud_density", wl.cloudXYDensity.Z));
  1030. cmd.Parameters.Add(_Database.CreateParameter("cloud_coverage", wl.cloudCoverage));
  1031. cmd.Parameters.Add(_Database.CreateParameter("cloud_scale", wl.cloudScale));
  1032. cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_x", wl.cloudDetailXYDensity.X));
  1033. cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_y", wl.cloudDetailXYDensity.Y));
  1034. cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_density", wl.cloudDetailXYDensity.Z));
  1035. cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x", wl.cloudScrollX));
  1036. cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x_lock", wl.cloudScrollXLock));
  1037. cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y", wl.cloudScrollY));
  1038. cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y_lock", wl.cloudScrollYLock));
  1039. cmd.Parameters.Add(_Database.CreateParameter("draw_classic_clouds", wl.drawClassicClouds));
  1040. cmd.ExecuteNonQuery();
  1041. }
  1042. }
  1043. #region update
  1044. // }
  1045. // else
  1046. // {
  1047. // // sql update
  1048. // sql = @"UPDATE [OpenSim].[dbo].[regionwindlight]
  1049. // SET [region_id] = @region_id
  1050. // ,[water_color_r] = @water_color_r
  1051. // ,[water_color_g] = @water_color_g
  1052. // ,[water_color_b] = @water_color_b
  1053. // ,[water_fog_density_exponent] = @water_fog_density_exponent
  1054. // ,[underwater_fog_modifier] = @underwater_fog_modifier
  1055. // ,[reflection_wavelet_scale_1] = @reflection_wavelet_scale_1
  1056. // ,[reflection_wavelet_scale_2] = @reflection_wavelet_scale_2
  1057. // ,[reflection_wavelet_scale_3] = @reflection_wavelet_scale_3
  1058. // ,[fresnel_scale] = @fresnel_scale
  1059. // ,[fresnel_offset] = @fresnel_offset
  1060. // ,[refract_scale_above] = @refract_scale_above
  1061. // ,[refract_scale_below] = @refract_scale_below
  1062. // ,[blur_multiplier] = @blur_multiplier
  1063. // ,[big_wave_direction_x] = @big_wave_direction_x
  1064. // ,[big_wave_direction_y] = @big_wave_direction_y
  1065. // ,[little_wave_direction_x] = @little_wave_direction_x
  1066. // ,[little_wave_direction_y] = @little_wave_direction_y
  1067. // ,[normal_map_texture] = @normal_map_texture
  1068. // ,[horizon_r] = @horizon_r
  1069. // ,[horizon_g] = @horizon_g
  1070. // ,[horizon_b] = @horizon_b
  1071. // ,[horizon_i] = @horizon_i
  1072. // ,[haze_horizon] = @haze_horizon
  1073. // ,[blue_density_r] = @blue_density_r
  1074. // ,[blue_density_g] = @blue_density_g
  1075. // ,[blue_density_b] = @blue_density_b
  1076. // ,[blue_density_i] = @blue_density_i
  1077. // ,[haze_density] = @haze_density
  1078. // ,[density_multiplier] = @density_multiplier
  1079. // ,[distance_multiplier] = @distance_multiplier
  1080. // ,[max_altitude] = @max_altitude
  1081. // ,[sun_moon_color_r] = @sun_moon_color_r
  1082. // ,[sun_moon_color_g] = @sun_moon_color_g
  1083. // ,[sun_moon_color_b] = @sun_moon_color_b
  1084. // ,[sun_moon_color_i] = @sun_moon_color_i
  1085. // ,[sun_moon_position] = @sun_moon_position
  1086. // ,[ambient_r] = @ambient_r
  1087. // ,[ambient_g] = @ambient_g
  1088. // ,[ambient_b] = @ambient_b
  1089. // ,[ambient_i] = @ambient_i
  1090. // ,[east_angle] = @east_angle
  1091. // ,[sun_glow_focus] = @sun_glow_focus
  1092. // ,[sun_glow_size] = @sun_glow_size
  1093. // ,[scene_gamma] = @scene_gamma
  1094. // ,[star_brightness] = @star_brightness
  1095. // ,[cloud_color_r] = @cloud_color_r
  1096. // ,[cloud_color_g] = @cloud_color_g
  1097. // ,[cloud_color_b] = @cloud_color_b
  1098. // ,[cloud_color_i] = @cloud_color_i
  1099. // ,[cloud_x] = @cloud_x
  1100. // ,[cloud_y] = @cloud_y
  1101. // ,[cloud_density] = @cloud_density
  1102. // ,[cloud_coverage] = @cloud_coverage
  1103. // ,[cloud_scale] = @cloud_scale
  1104. // ,[cloud_detail_x] = @cloud_detail_x
  1105. // ,[cloud_detail_y] = @cloud_detail_y
  1106. // ,[cloud_detail_density] = @cloud_detail_density
  1107. // ,[cloud_scroll_x] = @cloud_scroll_x
  1108. // ,[cloud_scroll_x_lock] = @cloud_scroll_x_lock
  1109. // ,[cloud_scroll_y] = @cloud_scroll_y
  1110. // ,[cloud_scroll_y_lock] = @cloud_scroll_y_lock
  1111. // ,[draw_classic_clouds] = @draw_classic_clouds
  1112. // WHERE region_id = @region_id";
  1113. // using (SqlConnection conn = new SqlConnection(m_connectionString))
  1114. // {
  1115. // conn.Open();
  1116. // using (SqlCommand cmd = new SqlCommand(sql, conn))
  1117. // {
  1118. // cmd.Parameters.AddWithValue("region_id", wl.regionID);
  1119. // cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
  1120. // cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
  1121. // cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
  1122. // cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
  1123. // cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
  1124. // cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
  1125. // cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
  1126. // cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
  1127. // cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
  1128. // cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
  1129. // cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
  1130. // cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
  1131. // cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
  1132. // cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
  1133. // cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
  1134. // cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
  1135. // cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
  1136. // cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
  1137. // cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
  1138. // cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
  1139. // cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
  1140. // cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
  1141. // cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
  1142. // cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
  1143. // cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
  1144. // cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
  1145. // cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
  1146. // cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
  1147. // cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
  1148. // cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
  1149. // cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
  1150. // cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
  1151. // cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
  1152. // cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
  1153. // cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
  1154. // cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
  1155. // cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
  1156. // cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
  1157. // cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
  1158. // cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
  1159. // cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
  1160. // cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
  1161. // cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
  1162. // cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
  1163. // cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
  1164. // cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
  1165. // cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
  1166. // cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
  1167. // cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
  1168. // cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
  1169. // cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
  1170. // cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
  1171. // cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
  1172. // cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
  1173. // cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
  1174. // cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
  1175. // cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
  1176. // cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
  1177. // cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
  1178. // cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
  1179. // cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
  1180. // cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
  1181. // cmd.ExecuteNonQuery();
  1182. // }
  1183. // }
  1184. // }
  1185. #endregion
  1186. }
  1187. #region Environment Settings
  1188. public string LoadRegionEnvironmentSettings(UUID regionUUID)
  1189. {
  1190. string sql = "select * from regionenvironment where region_id = :region_id";
  1191. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  1192. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  1193. {
  1194. cmd.Parameters.Add(_Database.CreateParameter("region_id", regionUUID));
  1195. conn.Open();
  1196. using (NpgsqlDataReader result = cmd.ExecuteReader())
  1197. {
  1198. if (!result.Read())
  1199. {
  1200. return String.Empty;
  1201. }
  1202. else
  1203. {
  1204. return Convert.ToString(result["llsd_settings"]);
  1205. }
  1206. }
  1207. }
  1208. }
  1209. public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
  1210. {
  1211. {
  1212. string sql = "DELETE FROM regionenvironment WHERE region_id = :region_id ;";
  1213. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  1214. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  1215. {
  1216. cmd.Parameters.Add(_Database.CreateParameter("region_id", regionUUID));
  1217. conn.Open();
  1218. cmd.ExecuteNonQuery();
  1219. }
  1220. sql = "INSERT INTO regionenvironment (region_id, llsd_settings) VALUES (:region_id, :llsd_settings) ;";
  1221. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  1222. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  1223. {
  1224. cmd.Parameters.Add(_Database.CreateParameter("region_id", regionUUID));
  1225. cmd.Parameters.Add(_Database.CreateParameter("llsd_settings", settings));
  1226. conn.Open();
  1227. cmd.ExecuteNonQuery();
  1228. }
  1229. }
  1230. }
  1231. public void RemoveRegionEnvironmentSettings(UUID regionUUID)
  1232. {
  1233. string sql = "delete from regionenvironment where region_id = :region_id ;";
  1234. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  1235. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  1236. {
  1237. cmd.Parameters.Add(_Database.CreateParameter("region_id", regionUUID));
  1238. conn.Open();
  1239. cmd.ExecuteNonQuery();
  1240. }
  1241. }
  1242. #endregion
  1243. /// <summary>
  1244. /// Loads the settings of a region.
  1245. /// </summary>
  1246. /// <param name="regionUUID">The region UUID.</param>
  1247. /// <returns></returns>
  1248. public RegionSettings LoadRegionSettings(UUID regionUUID)
  1249. {
  1250. string sql = @"select * from regionsettings where ""regionUUID"" = :regionUUID";
  1251. RegionSettings regionSettings;
  1252. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  1253. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  1254. {
  1255. cmd.Parameters.Add(_Database.CreateParameter("regionUUID", regionUUID));
  1256. conn.Open();
  1257. using (NpgsqlDataReader reader = cmd.ExecuteReader())
  1258. {
  1259. if (reader.Read())
  1260. {
  1261. regionSettings = BuildRegionSettings(reader);
  1262. regionSettings.OnSave += StoreRegionSettings;
  1263. return regionSettings;
  1264. }
  1265. }
  1266. }
  1267. //If we reach this point then there are new region settings for that region
  1268. regionSettings = new RegionSettings();
  1269. regionSettings.RegionUUID = regionUUID;
  1270. regionSettings.OnSave += StoreRegionSettings;
  1271. //Store new values
  1272. StoreNewRegionSettings(regionSettings);
  1273. LoadSpawnPoints(regionSettings);
  1274. return regionSettings;
  1275. }
  1276. /// <summary>
  1277. /// Store region settings, need to check if the check is really necesary. If we can make something for creating new region.
  1278. /// </summary>
  1279. /// <param name="regionSettings">region settings.</param>
  1280. public void StoreRegionSettings(RegionSettings regionSettings)
  1281. {
  1282. //Little check if regionUUID already exist in DB
  1283. string regionUUID;
  1284. string sql = @"SELECT ""regionUUID"" FROM regionsettings WHERE ""regionUUID"" = :regionUUID";
  1285. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  1286. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  1287. {
  1288. cmd.Parameters.Add(_Database.CreateParameter("regionUUID", regionSettings.RegionUUID));
  1289. conn.Open();
  1290. regionUUID = cmd.ExecuteScalar().ToString();
  1291. }
  1292. if (string.IsNullOrEmpty(regionUUID))
  1293. {
  1294. StoreNewRegionSettings(regionSettings);
  1295. }
  1296. else
  1297. {
  1298. //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB
  1299. sql =
  1300. @"UPDATE regionsettings SET block_terraform = :block_terraform ,block_fly = :block_fly ,allow_damage = :allow_damage
  1301. ,restrict_pushing = :restrict_pushing ,allow_land_resell = :allow_land_resell ,allow_land_join_divide = :allow_land_join_divide
  1302. ,block_show_in_search = :block_show_in_search ,agent_limit = :agent_limit ,object_bonus = :object_bonus ,maturity = :maturity
  1303. ,disable_scripts = :disable_scripts ,disable_collisions = :disable_collisions ,disable_physics = :disable_physics
  1304. ,terrain_texture_1 = :terrain_texture_1 ,terrain_texture_2 = :terrain_texture_2 ,terrain_texture_3 = :terrain_texture_3
  1305. ,terrain_texture_4 = :terrain_texture_4 ,elevation_1_nw = :elevation_1_nw ,elevation_2_nw = :elevation_2_nw
  1306. ,elevation_1_ne = :elevation_1_ne ,elevation_2_ne = :elevation_2_ne ,elevation_1_se = :elevation_1_se ,elevation_2_se = :elevation_2_se
  1307. ,elevation_1_sw = :elevation_1_sw ,elevation_2_sw = :elevation_2_sw ,water_height = :water_height ,terrain_raise_limit = :terrain_raise_limit
  1308. ,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position
  1309. ,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz,
  1310. ""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID,
  1311. ""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID
  1312. WHERE ""regionUUID"" = :regionUUID";
  1313. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  1314. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  1315. {
  1316. cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings));
  1317. conn.Open();
  1318. cmd.ExecuteNonQuery();
  1319. }
  1320. }
  1321. SaveSpawnPoints(regionSettings);
  1322. }
  1323. public void Shutdown()
  1324. {
  1325. //Not used??
  1326. }
  1327. #region Private Methods
  1328. /// <summary>
  1329. /// Stores new regionsettings.
  1330. /// </summary>
  1331. /// <param name="regionSettings">The region settings.</param>
  1332. private void StoreNewRegionSettings(RegionSettings regionSettings)
  1333. {
  1334. string sql = @"INSERT INTO regionsettings
  1335. (""regionUUID"",block_terraform,block_fly,allow_damage,restrict_pushing,allow_land_resell,allow_land_join_divide,
  1336. block_show_in_search,agent_limit,object_bonus,maturity,disable_scripts,disable_collisions,disable_physics,
  1337. terrain_texture_1,terrain_texture_2,terrain_texture_3,terrain_texture_4,elevation_1_nw,elevation_2_nw,elevation_1_ne,
  1338. elevation_2_ne,elevation_1_se,elevation_2_se,elevation_1_sw,elevation_2_sw,water_height,terrain_raise_limit,
  1339. terrain_lower_limit,use_estate_sun,fixed_sun,sun_position,covenant,covenant_datetime,sunvectorx, sunvectory, sunvectorz,
  1340. ""Sandbox"", loaded_creation_datetime, loaded_creation_id
  1341. )
  1342. VALUES
  1343. (:regionUUID,:block_terraform,:block_fly,:allow_damage,:restrict_pushing,:allow_land_resell,:allow_land_join_divide,
  1344. :block_show_in_search,:agent_limit,:object_bonus,:maturity,:disable_scripts,:disable_collisions,:disable_physics,
  1345. :terrain_texture_1,:terrain_texture_2,:terrain_texture_3,:terrain_texture_4,:elevation_1_nw,:elevation_2_nw,:elevation_1_ne,
  1346. :elevation_2_ne,:elevation_1_se,:elevation_2_se,:elevation_1_sw,:elevation_2_sw,:water_height,:terrain_raise_limit,
  1347. :terrain_lower_limit,:use_estate_sun,:fixed_sun,:sun_position,:covenant, :covenant_datetime, :sunvectorx,:sunvectory,
  1348. :sunvectorz, :Sandbox, :loaded_creation_datetime, :loaded_creation_id )";
  1349. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  1350. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  1351. {
  1352. cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings));
  1353. conn.Open();
  1354. cmd.ExecuteNonQuery();
  1355. }
  1356. }
  1357. #region Private DataRecord conversion methods
  1358. /// <summary>
  1359. /// Builds the region settings from a datarecod.
  1360. /// </summary>
  1361. /// <param name="row">datarecord with regionsettings.</param>
  1362. /// <returns></returns>
  1363. private static RegionSettings BuildRegionSettings(IDataRecord row)
  1364. {
  1365. //TODO change this is some more generic code so we doesnt have to change it every time a new field is added?
  1366. RegionSettings newSettings = new RegionSettings();
  1367. newSettings.RegionUUID = new UUID((Guid)row["regionUUID"]);
  1368. newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
  1369. newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
  1370. newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
  1371. newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]);
  1372. newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]);
  1373. newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]);
  1374. newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]);
  1375. newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]);
  1376. newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]);
  1377. newSettings.Maturity = Convert.ToInt32(row["maturity"]);
  1378. newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
  1379. newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
  1380. newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
  1381. newSettings.TerrainTexture1 = new UUID((Guid)row["terrain_texture_1"]);
  1382. newSettings.TerrainTexture2 = new UUID((Guid)row["terrain_texture_2"]);
  1383. newSettings.TerrainTexture3 = new UUID((Guid)row["terrain_texture_3"]);
  1384. newSettings.TerrainTexture4 = new UUID((Guid)row["terrain_texture_4"]);
  1385. newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
  1386. newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
  1387. newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
  1388. newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]);
  1389. newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]);
  1390. newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]);
  1391. newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]);
  1392. newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]);
  1393. newSettings.WaterHeight = Convert.ToDouble(row["water_height"]);
  1394. newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
  1395. newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
  1396. newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
  1397. newSettings.Sandbox = Convert.ToBoolean(row["Sandbox"]);
  1398. newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
  1399. newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
  1400. newSettings.SunVector = new Vector3(
  1401. Convert.ToSingle(row["sunvectorx"]),
  1402. Convert.ToSingle(row["sunvectory"]),
  1403. Convert.ToSingle(row["sunvectorz"])
  1404. );
  1405. newSettings.Covenant = new UUID((Guid)row["covenant"]);
  1406. newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
  1407. newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
  1408. if (row["loaded_creation_id"] is DBNull)
  1409. newSettings.LoadedCreationID = "";
  1410. else
  1411. newSettings.LoadedCreationID = (String)row["loaded_creation_id"];
  1412. newSettings.TerrainImageID = new UUID((string)row["map_tile_ID"]);
  1413. newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]);
  1414. newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]);
  1415. return newSettings;
  1416. }
  1417. /// <summary>
  1418. /// Builds the land data from a datarecord.
  1419. /// </summary>
  1420. /// <param name="row">datarecord with land data</param>
  1421. /// <returns></returns>
  1422. private static LandData BuildLandData(IDataRecord row)
  1423. {
  1424. LandData newData = new LandData();
  1425. newData.GlobalID = new UUID((Guid)row["UUID"]);
  1426. newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
  1427. // Bitmap is a byte[512]
  1428. newData.Bitmap = (Byte[])row["Bitmap"];
  1429. newData.Name = (string)row["Name"];
  1430. newData.Description = (string)row["Description"];
  1431. newData.OwnerID = new UUID((Guid)row["OwnerUUID"]);
  1432. newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
  1433. newData.Area = Convert.ToInt32(row["Area"]);
  1434. newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
  1435. newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]);
  1436. //Enum libsecondlife.Parcel.ParcelCategory
  1437. newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
  1438. newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
  1439. newData.GroupID = new UUID((Guid)row["GroupUUID"]);
  1440. newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
  1441. newData.Status = (ParcelStatus)Convert.ToInt32(row["LandStatus"]);
  1442. //Enum. libsecondlife.Parcel.ParcelStatus
  1443. newData.Flags = Convert.ToUInt32(row["LandFlags"]);
  1444. newData.LandingType = Convert.ToByte(row["LandingType"]);
  1445. newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
  1446. newData.MediaID = new UUID((Guid)row["MediaTextureUUID"]);
  1447. newData.MediaURL = (string)row["MediaURL"];
  1448. newData.MusicURL = (string)row["MusicURL"];
  1449. newData.PassHours = Convert.ToSingle(row["PassHours"]);
  1450. newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
  1451. // UUID authedbuyer;
  1452. // UUID snapshotID;
  1453. //
  1454. // if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer))
  1455. // newData.AuthBuyerID = authedbuyer;
  1456. //
  1457. // if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID))
  1458. // newData.SnapshotID = snapshotID;
  1459. newData.AuthBuyerID = new UUID((Guid)row["AuthBuyerID"]);
  1460. newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
  1461. newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
  1462. newData.Dwell = Convert.ToSingle(row["Dwell"]);
  1463. try
  1464. {
  1465. newData.UserLocation =
  1466. new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
  1467. Convert.ToSingle(row["UserLocationZ"]));
  1468. newData.UserLookAt =
  1469. new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
  1470. Convert.ToSingle(row["UserLookAtZ"]));
  1471. }
  1472. catch (InvalidCastException)
  1473. {
  1474. newData.UserLocation = Vector3.Zero;
  1475. newData.UserLookAt = Vector3.Zero;
  1476. _Log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
  1477. }
  1478. newData.ParcelAccessList = new List<LandAccessEntry>();
  1479. newData.MediaDescription = (string)row["MediaDescription"];
  1480. newData.MediaType = (string)row["MediaType"];
  1481. newData.MediaWidth = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[0]);
  1482. newData.MediaHeight = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[1]);
  1483. newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
  1484. newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
  1485. newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
  1486. newData.SeeAVs = Convert.ToBoolean(row["SeeAVs"]);
  1487. newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]);
  1488. newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]);
  1489. return newData;
  1490. }
  1491. /// <summary>
  1492. /// Builds the landaccess data from a data record.
  1493. /// </summary>
  1494. /// <param name="row">datarecord with landaccess data</param>
  1495. /// <returns></returns>
  1496. private static LandAccessEntry BuildLandAccessData(IDataRecord row)
  1497. {
  1498. LandAccessEntry entry = new LandAccessEntry();
  1499. entry.AgentID = new UUID((Guid)row["AccessUUID"]);
  1500. entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
  1501. entry.Expires = Convert.ToInt32(row["Expires"]);
  1502. return entry;
  1503. }
  1504. /// <summary>
  1505. /// Builds the prim from a datarecord.
  1506. /// </summary>
  1507. /// <param name="primRow">datarecord</param>
  1508. /// <returns></returns>
  1509. private static SceneObjectPart BuildPrim(IDataRecord primRow)
  1510. {
  1511. SceneObjectPart prim = new SceneObjectPart();
  1512. prim.UUID = new UUID((Guid)primRow["UUID"]);
  1513. // explicit conversion of integers is required, which sort
  1514. // of sucks. No idea if there is a shortcut here or not.
  1515. prim.CreationDate = Convert.ToInt32(primRow["CreationDate"]);
  1516. prim.Name = (string)primRow["Name"];
  1517. // various text fields
  1518. prim.Text = (string)primRow["Text"];
  1519. prim.Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]),
  1520. Convert.ToInt32(primRow["ColorR"]),
  1521. Convert.ToInt32(primRow["ColorG"]),
  1522. Convert.ToInt32(primRow["ColorB"]));
  1523. prim.Description = (string)primRow["Description"];
  1524. prim.SitName = (string)primRow["SitName"];
  1525. prim.TouchName = (string)primRow["TouchName"];
  1526. // permissions
  1527. prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]);
  1528. //prim.creatorID = new UUID((Guid)primRow["creatorID"]);
  1529. prim.CreatorIdentification = (string)primRow["CreatorID"].ToString();
  1530. prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
  1531. prim.GroupID = new UUID((Guid)primRow["GroupID"]);
  1532. prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
  1533. if (primRow["RezzerID"] != DBNull.Value)
  1534. prim.RezzerID = new UUID((Guid)primRow["RezzerID"]);
  1535. else
  1536. prim.RezzerID = UUID.Zero;
  1537. prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
  1538. prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
  1539. prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
  1540. prim.EveryoneMask = Convert.ToUInt32(primRow["EveryoneMask"]);
  1541. prim.BaseMask = Convert.ToUInt32(primRow["BaseMask"]);
  1542. // vectors
  1543. prim.OffsetPosition = new Vector3(
  1544. Convert.ToSingle(primRow["PositionX"]),
  1545. Convert.ToSingle(primRow["PositionY"]),
  1546. Convert.ToSingle(primRow["PositionZ"]));
  1547. prim.GroupPosition = new Vector3(
  1548. Convert.ToSingle(primRow["GroupPositionX"]),
  1549. Convert.ToSingle(primRow["GroupPositionY"]),
  1550. Convert.ToSingle(primRow["GroupPositionZ"]));
  1551. prim.Velocity = new Vector3(
  1552. Convert.ToSingle(primRow["VelocityX"]),
  1553. Convert.ToSingle(primRow["VelocityY"]),
  1554. Convert.ToSingle(primRow["VelocityZ"]));
  1555. prim.AngularVelocity = new Vector3(
  1556. Convert.ToSingle(primRow["AngularVelocityX"]),
  1557. Convert.ToSingle(primRow["AngularVelocityY"]),
  1558. Convert.ToSingle(primRow["AngularVelocityZ"]));
  1559. prim.Acceleration = new Vector3(
  1560. Convert.ToSingle(primRow["AccelerationX"]),
  1561. Convert.ToSingle(primRow["AccelerationY"]),
  1562. Convert.ToSingle(primRow["AccelerationZ"]));
  1563. // quaternions
  1564. prim.RotationOffset = new Quaternion(
  1565. Convert.ToSingle(primRow["RotationX"]),
  1566. Convert.ToSingle(primRow["RotationY"]),
  1567. Convert.ToSingle(primRow["RotationZ"]),
  1568. Convert.ToSingle(primRow["RotationW"]));
  1569. prim.SitTargetPositionLL = new Vector3(
  1570. Convert.ToSingle(primRow["SitTargetOffsetX"]),
  1571. Convert.ToSingle(primRow["SitTargetOffsetY"]),
  1572. Convert.ToSingle(primRow["SitTargetOffsetZ"]));
  1573. prim.SitTargetOrientationLL = new Quaternion(
  1574. Convert.ToSingle(primRow["SitTargetOrientX"]),
  1575. Convert.ToSingle(primRow["SitTargetOrientY"]),
  1576. Convert.ToSingle(primRow["SitTargetOrientZ"]),
  1577. Convert.ToSingle(primRow["SitTargetOrientW"]));
  1578. prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]);
  1579. prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]);
  1580. prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]);
  1581. prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]);
  1582. prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]);
  1583. prim.Sound = new UUID((Guid)primRow["LoopedSound"]);
  1584. prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]);
  1585. prim.SoundFlags = 1; // If it's persisted at all, it's looped
  1586. if (!(primRow["TextureAnimation"] is DBNull))
  1587. prim.TextureAnimation = (Byte[])primRow["TextureAnimation"];
  1588. if (!(primRow["ParticleSystem"] is DBNull))
  1589. prim.ParticleSystem = (Byte[])primRow["ParticleSystem"];
  1590. prim.AngularVelocity = new Vector3(
  1591. Convert.ToSingle(primRow["OmegaX"]),
  1592. Convert.ToSingle(primRow["OmegaY"]),
  1593. Convert.ToSingle(primRow["OmegaZ"]));
  1594. prim.SetCameraEyeOffset(new Vector3(
  1595. Convert.ToSingle(primRow["CameraEyeOffsetX"]),
  1596. Convert.ToSingle(primRow["CameraEyeOffsetY"]),
  1597. Convert.ToSingle(primRow["CameraEyeOffsetZ"])
  1598. ));
  1599. prim.SetCameraAtOffset(new Vector3(
  1600. Convert.ToSingle(primRow["CameraAtOffsetX"]),
  1601. Convert.ToSingle(primRow["CameraAtOffsetY"]),
  1602. Convert.ToSingle(primRow["CameraAtOffsetZ"])
  1603. ));
  1604. if (Convert.ToInt16(primRow["ForceMouselook"]) != 0)
  1605. prim.SetForceMouselook(true);
  1606. prim.ScriptAccessPin = Convert.ToInt32(primRow["ScriptAccessPin"]);
  1607. if (Convert.ToInt16(primRow["AllowedDrop"]) != 0)
  1608. prim.AllowedDrop = true;
  1609. if (Convert.ToInt16(primRow["DieAtEdge"]) != 0)
  1610. prim.DIE_AT_EDGE = true;
  1611. prim.SalePrice = Convert.ToInt32(primRow["SalePrice"]);
  1612. prim.ObjectSaleType = Convert.ToByte(primRow["SaleType"]);
  1613. prim.Material = Convert.ToByte(primRow["Material"]);
  1614. if (!(primRow["ClickAction"] is DBNull))
  1615. prim.ClickAction = Convert.ToByte(primRow["ClickAction"]);
  1616. prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]);
  1617. prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
  1618. prim.PassTouches = (bool)primRow["PassTouches"];
  1619. prim.PassCollisions = (bool)primRow["PassCollisions"];
  1620. if (!(primRow["MediaURL"] is System.DBNull))
  1621. prim.MediaUrl = (string)primRow["MediaURL"];
  1622. if (!(primRow["DynAttrs"] is System.DBNull) && (string)primRow["DynAttrs"] != "")
  1623. prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]);
  1624. else
  1625. prim.DynAttrs = new DAMap();
  1626. prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]);
  1627. prim.Density = Convert.ToSingle(primRow["Density"]);
  1628. prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]);
  1629. prim.Friction = Convert.ToSingle(primRow["Friction"]);
  1630. prim.Restitution = Convert.ToSingle(primRow["Restitution"]);
  1631. prim.RotationAxisLocks = Convert.ToByte(primRow["RotationAxisLocks"]);
  1632. PhysicsInertiaData pdata = null;
  1633. if (!(primRow["PhysInertia"] is System.DBNull))
  1634. pdata = PhysicsInertiaData.FromXml2(primRow["PhysInertia"].ToString());
  1635. prim.PhysicsInertia = pdata;
  1636. return prim;
  1637. }
  1638. /// <summary>
  1639. /// Builds the prim shape from a datarecord.
  1640. /// </summary>
  1641. /// <param name="shapeRow">The row.</param>
  1642. /// <returns></returns>
  1643. private static PrimitiveBaseShape BuildShape(IDataRecord shapeRow)
  1644. {
  1645. PrimitiveBaseShape baseShape = new PrimitiveBaseShape();
  1646. baseShape.Scale = new Vector3(
  1647. (float)Convert.ToDouble(shapeRow["ScaleX"]),
  1648. (float)Convert.ToDouble(shapeRow["ScaleY"]),
  1649. (float)Convert.ToDouble(shapeRow["ScaleZ"]));
  1650. // paths
  1651. baseShape.PCode = Convert.ToByte(shapeRow["PCode"]);
  1652. baseShape.PathBegin = Convert.ToUInt16(shapeRow["PathBegin"]);
  1653. baseShape.PathEnd = Convert.ToUInt16(shapeRow["PathEnd"]);
  1654. baseShape.PathScaleX = Convert.ToByte(shapeRow["PathScaleX"]);
  1655. baseShape.PathScaleY = Convert.ToByte(shapeRow["PathScaleY"]);
  1656. baseShape.PathShearX = Convert.ToByte(shapeRow["PathShearX"]);
  1657. baseShape.PathShearY = Convert.ToByte(shapeRow["PathShearY"]);
  1658. baseShape.PathSkew = Convert.ToSByte(shapeRow["PathSkew"]);
  1659. baseShape.PathCurve = Convert.ToByte(shapeRow["PathCurve"]);
  1660. baseShape.PathRadiusOffset = Convert.ToSByte(shapeRow["PathRadiusOffset"]);
  1661. baseShape.PathRevolutions = Convert.ToByte(shapeRow["PathRevolutions"]);
  1662. baseShape.PathTaperX = Convert.ToSByte(shapeRow["PathTaperX"]);
  1663. baseShape.PathTaperY = Convert.ToSByte(shapeRow["PathTaperY"]);
  1664. baseShape.PathTwist = Convert.ToSByte(shapeRow["PathTwist"]);
  1665. baseShape.PathTwistBegin = Convert.ToSByte(shapeRow["PathTwistBegin"]);
  1666. // profile
  1667. baseShape.ProfileBegin = Convert.ToUInt16(shapeRow["ProfileBegin"]);
  1668. baseShape.ProfileEnd = Convert.ToUInt16(shapeRow["ProfileEnd"]);
  1669. baseShape.ProfileCurve = Convert.ToByte(shapeRow["ProfileCurve"]);
  1670. baseShape.ProfileHollow = Convert.ToUInt16(shapeRow["ProfileHollow"]);
  1671. byte[] textureEntry = (byte[])shapeRow["Texture"];
  1672. baseShape.TextureEntry = textureEntry;
  1673. baseShape.ExtraParams = (byte[])shapeRow["ExtraParams"];
  1674. try
  1675. {
  1676. baseShape.State = Convert.ToByte(shapeRow["State"]);
  1677. }
  1678. catch (InvalidCastException)
  1679. {
  1680. }
  1681. if (!(shapeRow["Media"] is System.DBNull))
  1682. {
  1683. baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
  1684. }
  1685. return baseShape;
  1686. }
  1687. /// <summary>
  1688. /// Build a prim inventory item from the persisted data.
  1689. /// </summary>
  1690. /// <param name="inventoryRow"></param>
  1691. /// <returns></returns>
  1692. private static TaskInventoryItem BuildItem(IDataRecord inventoryRow)
  1693. {
  1694. TaskInventoryItem taskItem = new TaskInventoryItem();
  1695. taskItem.ItemID = new UUID((Guid)inventoryRow["itemID"]);
  1696. taskItem.ParentPartID = new UUID((Guid)inventoryRow["primID"]);
  1697. taskItem.AssetID = new UUID((Guid)inventoryRow["assetID"]);
  1698. taskItem.ParentID = new UUID((Guid)inventoryRow["parentFolderID"]);
  1699. taskItem.InvType = Convert.ToInt32(inventoryRow["invType"]);
  1700. taskItem.Type = Convert.ToInt32(inventoryRow["assetType"]);
  1701. taskItem.Name = (string)inventoryRow["name"];
  1702. taskItem.Description = (string)inventoryRow["description"];
  1703. taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]);
  1704. //taskItem.creatorID = new UUID((Guid)inventoryRow["creatorID"]);
  1705. taskItem.CreatorIdentification = (string)inventoryRow["creatorID"].ToString();
  1706. taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]);
  1707. taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]);
  1708. taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]);
  1709. taskItem.NextPermissions = Convert.ToUInt32(inventoryRow["nextPermissions"]);
  1710. taskItem.CurrentPermissions = Convert.ToUInt32(inventoryRow["currentPermissions"]);
  1711. taskItem.BasePermissions = Convert.ToUInt32(inventoryRow["basePermissions"]);
  1712. taskItem.EveryonePermissions = Convert.ToUInt32(inventoryRow["everyonePermissions"]);
  1713. taskItem.GroupPermissions = Convert.ToUInt32(inventoryRow["groupPermissions"]);
  1714. taskItem.Flags = Convert.ToUInt32(inventoryRow["flags"]);
  1715. return taskItem;
  1716. }
  1717. #endregion
  1718. #region Create parameters methods
  1719. /// <summary>
  1720. /// Creates the prim inventory parameters.
  1721. /// </summary>
  1722. /// <param name="taskItem">item in inventory.</param>
  1723. /// <returns></returns>
  1724. private NpgsqlParameter[] CreatePrimInventoryParameters(TaskInventoryItem taskItem)
  1725. {
  1726. List<NpgsqlParameter> parameters = new List<NpgsqlParameter>();
  1727. parameters.Add(_Database.CreateParameter("itemID", taskItem.ItemID));
  1728. parameters.Add(_Database.CreateParameter("primID", taskItem.ParentPartID));
  1729. parameters.Add(_Database.CreateParameter("assetID", taskItem.AssetID));
  1730. parameters.Add(_Database.CreateParameter("parentFolderID", taskItem.ParentID));
  1731. parameters.Add(_Database.CreateParameter("invType", taskItem.InvType));
  1732. parameters.Add(_Database.CreateParameter("assetType", taskItem.Type));
  1733. parameters.Add(_Database.CreateParameter("name", taskItem.Name));
  1734. parameters.Add(_Database.CreateParameter("description", taskItem.Description));
  1735. parameters.Add(_Database.CreateParameter("creationDate", taskItem.CreationDate));
  1736. parameters.Add(_Database.CreateParameter("creatorID", taskItem.CreatorID));
  1737. parameters.Add(_Database.CreateParameter("ownerID", taskItem.OwnerID));
  1738. parameters.Add(_Database.CreateParameter("lastOwnerID", taskItem.LastOwnerID));
  1739. parameters.Add(_Database.CreateParameter("groupID", taskItem.GroupID));
  1740. parameters.Add(_Database.CreateParameter("nextPermissions", taskItem.NextPermissions));
  1741. parameters.Add(_Database.CreateParameter("currentPermissions", taskItem.CurrentPermissions));
  1742. parameters.Add(_Database.CreateParameter("basePermissions", taskItem.BasePermissions));
  1743. parameters.Add(_Database.CreateParameter("everyonePermissions", taskItem.EveryonePermissions));
  1744. parameters.Add(_Database.CreateParameter("groupPermissions", taskItem.GroupPermissions));
  1745. parameters.Add(_Database.CreateParameter("flags", taskItem.Flags));
  1746. return parameters.ToArray();
  1747. }
  1748. /// <summary>
  1749. /// Creates the region setting parameters.
  1750. /// </summary>
  1751. /// <param name="settings">regionsettings.</param>
  1752. /// <returns></returns>
  1753. private NpgsqlParameter[] CreateRegionSettingParameters(RegionSettings settings)
  1754. {
  1755. List<NpgsqlParameter> parameters = new List<NpgsqlParameter>();
  1756. parameters.Add(_Database.CreateParameter("regionUUID", settings.RegionUUID));
  1757. parameters.Add(_Database.CreateParameter("block_terraform", settings.BlockTerraform));
  1758. parameters.Add(_Database.CreateParameter("block_fly", settings.BlockFly));
  1759. parameters.Add(_Database.CreateParameter("allow_damage", settings.AllowDamage));
  1760. parameters.Add(_Database.CreateParameter("restrict_pushing", settings.RestrictPushing));
  1761. parameters.Add(_Database.CreateParameter("allow_land_resell", settings.AllowLandResell));
  1762. parameters.Add(_Database.CreateParameter("allow_land_join_divide", settings.AllowLandJoinDivide));
  1763. parameters.Add(_Database.CreateParameter("block_show_in_search", settings.BlockShowInSearch));
  1764. parameters.Add(_Database.CreateParameter("agent_limit", settings.AgentLimit));
  1765. parameters.Add(_Database.CreateParameter("object_bonus", settings.ObjectBonus));
  1766. parameters.Add(_Database.CreateParameter("maturity", settings.Maturity));
  1767. parameters.Add(_Database.CreateParameter("disable_scripts", settings.DisableScripts));
  1768. parameters.Add(_Database.CreateParameter("disable_collisions", settings.DisableCollisions));
  1769. parameters.Add(_Database.CreateParameter("disable_physics", settings.DisablePhysics));
  1770. parameters.Add(_Database.CreateParameter("terrain_texture_1", settings.TerrainTexture1));
  1771. parameters.Add(_Database.CreateParameter("terrain_texture_2", settings.TerrainTexture2));
  1772. parameters.Add(_Database.CreateParameter("terrain_texture_3", settings.TerrainTexture3));
  1773. parameters.Add(_Database.CreateParameter("terrain_texture_4", settings.TerrainTexture4));
  1774. parameters.Add(_Database.CreateParameter("elevation_1_nw", settings.Elevation1NW));
  1775. parameters.Add(_Database.CreateParameter("elevation_2_nw", settings.Elevation2NW));
  1776. parameters.Add(_Database.CreateParameter("elevation_1_ne", settings.Elevation1NE));
  1777. parameters.Add(_Database.CreateParameter("elevation_2_ne", settings.Elevation2NE));
  1778. parameters.Add(_Database.CreateParameter("elevation_1_se", settings.Elevation1SE));
  1779. parameters.Add(_Database.CreateParameter("elevation_2_se", settings.Elevation2SE));
  1780. parameters.Add(_Database.CreateParameter("elevation_1_sw", settings.Elevation1SW));
  1781. parameters.Add(_Database.CreateParameter("elevation_2_sw", settings.Elevation2SW));
  1782. parameters.Add(_Database.CreateParameter("water_height", settings.WaterHeight));
  1783. parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit));
  1784. parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit));
  1785. parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun));
  1786. parameters.Add(_Database.CreateParameter("Sandbox", settings.Sandbox));
  1787. parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun));
  1788. parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition));
  1789. parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X));
  1790. parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y));
  1791. parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z));
  1792. parameters.Add(_Database.CreateParameter("covenant", settings.Covenant));
  1793. parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime));
  1794. parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime));
  1795. parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID));
  1796. parameters.Add(_Database.CreateParameter("TerrainImageID", settings.TerrainImageID));
  1797. parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
  1798. parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
  1799. return parameters.ToArray();
  1800. }
  1801. /// <summary>
  1802. /// Creates the land parameters.
  1803. /// </summary>
  1804. /// <param name="land">land parameters.</param>
  1805. /// <param name="regionUUID">region UUID.</param>
  1806. /// <returns></returns>
  1807. private NpgsqlParameter[] CreateLandParameters(LandData land, UUID regionUUID)
  1808. {
  1809. List<NpgsqlParameter> parameters = new List<NpgsqlParameter>();
  1810. parameters.Add(_Database.CreateParameter("UUID", land.GlobalID));
  1811. parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID));
  1812. parameters.Add(_Database.CreateParameter("LocalLandID", land.LocalID));
  1813. // Bitmap is a byte[512]
  1814. parameters.Add(_Database.CreateParameter("Bitmap", land.Bitmap));
  1815. parameters.Add(_Database.CreateParameter("Name", land.Name));
  1816. parameters.Add(_Database.CreateParameter("Description", land.Description));
  1817. parameters.Add(_Database.CreateParameter("OwnerUUID", land.OwnerID));
  1818. parameters.Add(_Database.CreateParameter("IsGroupOwned", land.IsGroupOwned));
  1819. parameters.Add(_Database.CreateParameter("Area", land.Area));
  1820. parameters.Add(_Database.CreateParameter("AuctionID", land.AuctionID)); //Unemplemented
  1821. parameters.Add(_Database.CreateParameter("Category", (int)land.Category)); //Enum libsecondlife.Parcel.ParcelCategory
  1822. parameters.Add(_Database.CreateParameter("ClaimDate", land.ClaimDate));
  1823. parameters.Add(_Database.CreateParameter("ClaimPrice", land.ClaimPrice));
  1824. parameters.Add(_Database.CreateParameter("GroupUUID", land.GroupID));
  1825. parameters.Add(_Database.CreateParameter("SalePrice", land.SalePrice));
  1826. parameters.Add(_Database.CreateParameter("LandStatus", (int)land.Status)); //Enum. libsecondlife.Parcel.ParcelStatus
  1827. parameters.Add(_Database.CreateParameter("LandFlags", land.Flags));
  1828. parameters.Add(_Database.CreateParameter("LandingType", Convert.ToInt32( land.LandingType) ));
  1829. parameters.Add(_Database.CreateParameter("MediaAutoScale", Convert.ToInt32( land.MediaAutoScale )));
  1830. parameters.Add(_Database.CreateParameter("MediaTextureUUID", land.MediaID));
  1831. parameters.Add(_Database.CreateParameter("MediaURL", land.MediaURL));
  1832. parameters.Add(_Database.CreateParameter("MusicURL", land.MusicURL));
  1833. parameters.Add(_Database.CreateParameter("PassHours", land.PassHours));
  1834. parameters.Add(_Database.CreateParameter("PassPrice", land.PassPrice));
  1835. parameters.Add(_Database.CreateParameter("SnapshotUUID", land.SnapshotID));
  1836. parameters.Add(_Database.CreateParameter("UserLocationX", land.UserLocation.X));
  1837. parameters.Add(_Database.CreateParameter("UserLocationY", land.UserLocation.Y));
  1838. parameters.Add(_Database.CreateParameter("UserLocationZ", land.UserLocation.Z));
  1839. parameters.Add(_Database.CreateParameter("UserLookAtX", land.UserLookAt.X));
  1840. parameters.Add(_Database.CreateParameter("UserLookAtY", land.UserLookAt.Y));
  1841. parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
  1842. parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
  1843. parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
  1844. parameters.Add(_Database.CreateParameter("Dwell", land.Dwell));
  1845. parameters.Add(_Database.CreateParameter("MediaDescription", land.MediaDescription));
  1846. parameters.Add(_Database.CreateParameter("MediaType", land.MediaType));
  1847. parameters.Add(_Database.CreateParameter("MediaWidth", land.MediaWidth));
  1848. parameters.Add(_Database.CreateParameter("MediaHeight", land.MediaHeight));
  1849. parameters.Add(_Database.CreateParameter("MediaLoop", land.MediaLoop));
  1850. parameters.Add(_Database.CreateParameter("ObscureMusic", land.ObscureMusic));
  1851. parameters.Add(_Database.CreateParameter("ObscureMedia", land.ObscureMedia));
  1852. parameters.Add(_Database.CreateParameter("SeeAVs", land.SeeAVs));
  1853. parameters.Add(_Database.CreateParameter("AnyAVSounds", land.AnyAVSounds));
  1854. parameters.Add(_Database.CreateParameter("GroupAVSounds", land.GroupAVSounds));
  1855. return parameters.ToArray();
  1856. }
  1857. /// <summary>
  1858. /// Creates the land access parameters.
  1859. /// </summary>
  1860. /// <param name="parcelAccessEntry">parcel access entry.</param>
  1861. /// <param name="parcelID">parcel ID.</param>
  1862. /// <returns></returns>
  1863. private NpgsqlParameter[] CreateLandAccessParameters(LandAccessEntry parcelAccessEntry, UUID parcelID)
  1864. {
  1865. List<NpgsqlParameter> parameters = new List<NpgsqlParameter>();
  1866. parameters.Add(_Database.CreateParameter("LandUUID", parcelID));
  1867. parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID));
  1868. parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags));
  1869. parameters.Add(_Database.CreateParameter("Expires", parcelAccessEntry.Expires));
  1870. return parameters.ToArray();
  1871. }
  1872. /// <summary>
  1873. /// Creates the prim parameters for storing in DB.
  1874. /// </summary>
  1875. /// <param name="prim">Basic data of SceneObjectpart prim.</param>
  1876. /// <param name="sceneGroupID">The scenegroup ID.</param>
  1877. /// <param name="regionUUID">The region ID.</param>
  1878. /// <returns></returns>
  1879. private NpgsqlParameter[] CreatePrimParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
  1880. {
  1881. List<NpgsqlParameter> parameters = new List<NpgsqlParameter>();
  1882. parameters.Add(_Database.CreateParameter("UUID", prim.UUID));
  1883. parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID));
  1884. parameters.Add(_Database.CreateParameter("CreationDate", prim.CreationDate));
  1885. parameters.Add(_Database.CreateParameter("Name", prim.Name));
  1886. parameters.Add(_Database.CreateParameter("SceneGroupID", sceneGroupID));
  1887. // the UUID of the root part for this SceneObjectGroup
  1888. // various text fields
  1889. parameters.Add(_Database.CreateParameter("Text", prim.Text));
  1890. parameters.Add(_Database.CreateParameter("ColorR", prim.Color.R));
  1891. parameters.Add(_Database.CreateParameter("ColorG", prim.Color.G));
  1892. parameters.Add(_Database.CreateParameter("ColorB", prim.Color.B));
  1893. parameters.Add(_Database.CreateParameter("ColorA", prim.Color.A));
  1894. parameters.Add(_Database.CreateParameter("Description", prim.Description));
  1895. parameters.Add(_Database.CreateParameter("SitName", prim.SitName));
  1896. parameters.Add(_Database.CreateParameter("TouchName", prim.TouchName));
  1897. // permissions
  1898. parameters.Add(_Database.CreateParameter("ObjectFlags", (uint)prim.Flags));
  1899. parameters.Add(_Database.CreateParameter("CreatorID", prim.CreatorID));
  1900. parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
  1901. parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
  1902. parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID));
  1903. parameters.Add(_Database.CreateParameter("RezzerID", prim.RezzerID));
  1904. parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask));
  1905. parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask));
  1906. parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask));
  1907. parameters.Add(_Database.CreateParameter("EveryoneMask", prim.EveryoneMask));
  1908. parameters.Add(_Database.CreateParameter("BaseMask", prim.BaseMask));
  1909. // vectors
  1910. parameters.Add(_Database.CreateParameter("PositionX", prim.OffsetPosition.X));
  1911. parameters.Add(_Database.CreateParameter("PositionY", prim.OffsetPosition.Y));
  1912. parameters.Add(_Database.CreateParameter("PositionZ", prim.OffsetPosition.Z));
  1913. parameters.Add(_Database.CreateParameter("GroupPositionX", prim.GroupPosition.X));
  1914. parameters.Add(_Database.CreateParameter("GroupPositionY", prim.GroupPosition.Y));
  1915. parameters.Add(_Database.CreateParameter("GroupPositionZ", prim.GroupPosition.Z));
  1916. parameters.Add(_Database.CreateParameter("VelocityX", prim.Velocity.X));
  1917. parameters.Add(_Database.CreateParameter("VelocityY", prim.Velocity.Y));
  1918. parameters.Add(_Database.CreateParameter("VelocityZ", prim.Velocity.Z));
  1919. parameters.Add(_Database.CreateParameter("AngularVelocityX", prim.AngularVelocity.X));
  1920. parameters.Add(_Database.CreateParameter("AngularVelocityY", prim.AngularVelocity.Y));
  1921. parameters.Add(_Database.CreateParameter("AngularVelocityZ", prim.AngularVelocity.Z));
  1922. parameters.Add(_Database.CreateParameter("AccelerationX", prim.Acceleration.X));
  1923. parameters.Add(_Database.CreateParameter("AccelerationY", prim.Acceleration.Y));
  1924. parameters.Add(_Database.CreateParameter("AccelerationZ", prim.Acceleration.Z));
  1925. // quaternions
  1926. parameters.Add(_Database.CreateParameter("RotationX", prim.RotationOffset.X));
  1927. parameters.Add(_Database.CreateParameter("RotationY", prim.RotationOffset.Y));
  1928. parameters.Add(_Database.CreateParameter("RotationZ", prim.RotationOffset.Z));
  1929. parameters.Add(_Database.CreateParameter("RotationW", prim.RotationOffset.W));
  1930. // Sit target
  1931. Vector3 sitTargetPos = prim.SitTargetPositionLL;
  1932. parameters.Add(_Database.CreateParameter("SitTargetOffsetX", sitTargetPos.X));
  1933. parameters.Add(_Database.CreateParameter("SitTargetOffsetY", sitTargetPos.Y));
  1934. parameters.Add(_Database.CreateParameter("SitTargetOffsetZ", sitTargetPos.Z));
  1935. Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
  1936. parameters.Add(_Database.CreateParameter("SitTargetOrientW", sitTargetOrient.W));
  1937. parameters.Add(_Database.CreateParameter("SitTargetOrientX", sitTargetOrient.X));
  1938. parameters.Add(_Database.CreateParameter("SitTargetOrientY", sitTargetOrient.Y));
  1939. parameters.Add(_Database.CreateParameter("SitTargetOrientZ", sitTargetOrient.Z));
  1940. parameters.Add(_Database.CreateParameter("PayPrice", prim.PayPrice[0]));
  1941. parameters.Add(_Database.CreateParameter("PayButton1", prim.PayPrice[1]));
  1942. parameters.Add(_Database.CreateParameter("PayButton2", prim.PayPrice[2]));
  1943. parameters.Add(_Database.CreateParameter("PayButton3", prim.PayPrice[3]));
  1944. parameters.Add(_Database.CreateParameter("PayButton4", prim.PayPrice[4]));
  1945. if ((prim.SoundFlags & 1) != 0) // Looped
  1946. {
  1947. parameters.Add(_Database.CreateParameter("LoopedSound", prim.Sound));
  1948. parameters.Add(_Database.CreateParameter("LoopedSoundGain", prim.SoundGain));
  1949. }
  1950. else
  1951. {
  1952. parameters.Add(_Database.CreateParameter("LoopedSound", UUID.Zero));
  1953. parameters.Add(_Database.CreateParameter("LoopedSoundGain", 0.0f));
  1954. }
  1955. parameters.Add(_Database.CreateParameter("TextureAnimation", prim.TextureAnimation));
  1956. parameters.Add(_Database.CreateParameter("ParticleSystem", prim.ParticleSystem));
  1957. parameters.Add(_Database.CreateParameter("OmegaX", prim.AngularVelocity.X));
  1958. parameters.Add(_Database.CreateParameter("OmegaY", prim.AngularVelocity.Y));
  1959. parameters.Add(_Database.CreateParameter("OmegaZ", prim.AngularVelocity.Z));
  1960. parameters.Add(_Database.CreateParameter("CameraEyeOffsetX", prim.GetCameraEyeOffset().X));
  1961. parameters.Add(_Database.CreateParameter("CameraEyeOffsetY", prim.GetCameraEyeOffset().Y));
  1962. parameters.Add(_Database.CreateParameter("CameraEyeOffsetZ", prim.GetCameraEyeOffset().Z));
  1963. parameters.Add(_Database.CreateParameter("CameraAtOffsetX", prim.GetCameraAtOffset().X));
  1964. parameters.Add(_Database.CreateParameter("CameraAtOffsetY", prim.GetCameraAtOffset().Y));
  1965. parameters.Add(_Database.CreateParameter("CameraAtOffsetZ", prim.GetCameraAtOffset().Z));
  1966. if (prim.GetForceMouselook())
  1967. parameters.Add(_Database.CreateParameter("ForceMouselook", 1));
  1968. else
  1969. parameters.Add(_Database.CreateParameter("ForceMouselook", 0));
  1970. parameters.Add(_Database.CreateParameter("ScriptAccessPin", prim.ScriptAccessPin));
  1971. if (prim.AllowedDrop)
  1972. parameters.Add(_Database.CreateParameter("AllowedDrop", 1));
  1973. else
  1974. parameters.Add(_Database.CreateParameter("AllowedDrop", 0));
  1975. if (prim.DIE_AT_EDGE)
  1976. parameters.Add(_Database.CreateParameter("DieAtEdge", 1));
  1977. else
  1978. parameters.Add(_Database.CreateParameter("DieAtEdge", 0));
  1979. parameters.Add(_Database.CreateParameter("SalePrice", prim.SalePrice));
  1980. parameters.Add(_Database.CreateParameter("SaleType", prim.ObjectSaleType));
  1981. byte clickAction = prim.ClickAction;
  1982. parameters.Add(_Database.CreateParameter("ClickAction", clickAction));
  1983. parameters.Add(_Database.CreateParameter("Material", prim.Material));
  1984. parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
  1985. parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
  1986. parameters.Add(_Database.CreateParameter("PassTouches", (bool)prim.PassTouches));
  1987. parameters.Add(_Database.CreateParameter("PassCollisions", (bool)prim.PassCollisions));
  1988. if (prim.PassTouches)
  1989. parameters.Add(_Database.CreateParameter("PassTouches", true));
  1990. else
  1991. parameters.Add(_Database.CreateParameter("PassTouches", false));
  1992. if (prim.PassCollisions)
  1993. parameters.Add(_Database.CreateParameter("PassCollisions", true));
  1994. else
  1995. parameters.Add(_Database.CreateParameter("PassCollisions", false));
  1996. parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
  1997. parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
  1998. if (prim.PhysicsInertia != null)
  1999. parameters.Add(_Database.CreateParameter("PhysInertia", prim.PhysicsInertia.ToXml2()));
  2000. else
  2001. parameters.Add(_Database.CreateParameter("PhysInertia", String.Empty));
  2002. if (prim.DynAttrs.CountNamespaces > 0)
  2003. parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
  2004. else
  2005. parameters.Add(_Database.CreateParameter("DynAttrs", null));
  2006. parameters.Add(_Database.CreateParameter("PhysicsShapeType", prim.PhysicsShapeType));
  2007. parameters.Add(_Database.CreateParameter("Density", (double)prim.Density));
  2008. parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier));
  2009. parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction));
  2010. parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution));
  2011. parameters.Add(_Database.CreateParameter("RotationAxisLocks", prim.RotationAxisLocks));
  2012. return parameters.ToArray();
  2013. }
  2014. /// <summary>
  2015. /// Creates the primshape parameters for storing in DB.
  2016. /// </summary>
  2017. /// <param name="prim">Basic data of SceneObjectpart prim.</param>
  2018. /// <param name="sceneGroupID">The scene group ID.</param>
  2019. /// <param name="regionUUID">The region UUID.</param>
  2020. /// <returns></returns>
  2021. private NpgsqlParameter[] CreatePrimShapeParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
  2022. {
  2023. List<NpgsqlParameter> parameters = new List<NpgsqlParameter>();
  2024. PrimitiveBaseShape s = prim.Shape;
  2025. parameters.Add(_Database.CreateParameter("UUID", prim.UUID));
  2026. // shape is an enum
  2027. parameters.Add(_Database.CreateParameter("Shape", 0));
  2028. // vectors
  2029. parameters.Add(_Database.CreateParameter("ScaleX", s.Scale.X));
  2030. parameters.Add(_Database.CreateParameter("ScaleY", s.Scale.Y));
  2031. parameters.Add(_Database.CreateParameter("ScaleZ", s.Scale.Z));
  2032. // paths
  2033. parameters.Add(_Database.CreateParameter("PCode", s.PCode));
  2034. parameters.Add(_Database.CreateParameter("PathBegin", s.PathBegin));
  2035. parameters.Add(_Database.CreateParameter("PathEnd", s.PathEnd));
  2036. parameters.Add(_Database.CreateParameter("PathScaleX", s.PathScaleX));
  2037. parameters.Add(_Database.CreateParameter("PathScaleY", s.PathScaleY));
  2038. parameters.Add(_Database.CreateParameter("PathShearX", s.PathShearX));
  2039. parameters.Add(_Database.CreateParameter("PathShearY", s.PathShearY));
  2040. parameters.Add(_Database.CreateParameter("PathSkew", s.PathSkew));
  2041. parameters.Add(_Database.CreateParameter("PathCurve", s.PathCurve));
  2042. parameters.Add(_Database.CreateParameter("PathRadiusOffset", s.PathRadiusOffset));
  2043. parameters.Add(_Database.CreateParameter("PathRevolutions", s.PathRevolutions));
  2044. parameters.Add(_Database.CreateParameter("PathTaperX", s.PathTaperX));
  2045. parameters.Add(_Database.CreateParameter("PathTaperY", s.PathTaperY));
  2046. parameters.Add(_Database.CreateParameter("PathTwist", s.PathTwist));
  2047. parameters.Add(_Database.CreateParameter("PathTwistBegin", s.PathTwistBegin));
  2048. // profile
  2049. parameters.Add(_Database.CreateParameter("ProfileBegin", s.ProfileBegin));
  2050. parameters.Add(_Database.CreateParameter("ProfileEnd", s.ProfileEnd));
  2051. parameters.Add(_Database.CreateParameter("ProfileCurve", s.ProfileCurve));
  2052. parameters.Add(_Database.CreateParameter("ProfileHollow", s.ProfileHollow));
  2053. parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry));
  2054. parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams));
  2055. parameters.Add(_Database.CreateParameter("State", s.State));
  2056. if (null == s.Media)
  2057. {
  2058. parameters.Add(_Database.CreateParameter("Media", DBNull.Value));
  2059. }
  2060. else
  2061. {
  2062. parameters.Add(_Database.CreateParameter("Media", s.Media.ToXml()));
  2063. }
  2064. return parameters.ToArray();
  2065. }
  2066. #endregion
  2067. #endregion
  2068. private void LoadSpawnPoints(RegionSettings rs)
  2069. {
  2070. rs.ClearSpawnPoints();
  2071. string sql = @"SELECT ""Yaw"", ""Pitch"", ""Distance"" FROM spawn_points WHERE ""RegionUUID"" = :RegionUUID";
  2072. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  2073. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  2074. {
  2075. cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", rs.RegionUUID));
  2076. conn.Open();
  2077. using (NpgsqlDataReader reader = cmd.ExecuteReader())
  2078. {
  2079. if (reader.Read())
  2080. {
  2081. SpawnPoint sp = new SpawnPoint();
  2082. sp.Yaw = (float)reader["Yaw"];
  2083. sp.Pitch = (float)reader["Pitch"];
  2084. sp.Distance = (float)reader["Distance"];
  2085. rs.AddSpawnPoint(sp);
  2086. }
  2087. }
  2088. }
  2089. }
  2090. private void SaveSpawnPoints(RegionSettings rs)
  2091. {
  2092. string sql = @"DELETE FROM spawn_points WHERE ""RegionUUID"" = :RegionUUID";
  2093. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  2094. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  2095. {
  2096. cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", rs.RegionUUID));
  2097. conn.Open();
  2098. cmd.ExecuteNonQuery();
  2099. }
  2100. foreach (SpawnPoint p in rs.SpawnPoints())
  2101. {
  2102. sql = @"INSERT INTO spawn_points (""RegionUUID"", ""Yaw"", ""Pitch"", ""Distance"") VALUES (:RegionUUID, :Yaw, :Pitch, :Distance)";
  2103. using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
  2104. using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
  2105. {
  2106. cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", rs.RegionUUID));
  2107. cmd.Parameters.Add(_Database.CreateParameter("Yaw", p.Yaw));
  2108. cmd.Parameters.Add(_Database.CreateParameter("Pitch", p.Pitch));
  2109. cmd.Parameters.Add(_Database.CreateParameter("Distance", p.Distance));
  2110. conn.Open();
  2111. cmd.ExecuteNonQuery();
  2112. }
  2113. }
  2114. }
  2115. public UUID[] GetObjectIDs(UUID regionID)
  2116. {
  2117. return new UUID[0];
  2118. }
  2119. public void SaveExtra(UUID regionID, string name, string value)
  2120. {
  2121. }
  2122. public void RemoveExtra(UUID regionID, string name)
  2123. {
  2124. }
  2125. public Dictionary<string, string> GetExtra(UUID regionID)
  2126. {
  2127. return null;
  2128. }
  2129. }
  2130. }