diff options
author | BlueWall | 2012-01-21 23:26:27 -0500 |
---|---|---|
committer | BlueWall | 2012-01-21 23:26:27 -0500 |
commit | 32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85 (patch) | |
tree | 8c19dbfa8975080d7bbbeaa1e2de4072520c899f /OpenSim/Data/MySQL | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.zip opensim-SC-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.tar.gz opensim-SC-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.tar.bz2 opensim-SC-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.tar.xz |
Telehub Support:
Telehub settings now persist to the database and are saved across sim restarts. So-far this only works on MySQL. this is a work in progress, teleport routing is not yet implemented.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 66 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/EstateStore.migrations | 21 |
2 files changed, 86 insertions, 1 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 3d647ca..a357268 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -157,6 +157,7 @@ namespace OpenSim.Data.MySQL | |||
157 | DoCreate(es); | 157 | DoCreate(es); |
158 | 158 | ||
159 | LoadBanList(es); | 159 | LoadBanList(es); |
160 | LoadSpawnPoints(es); | ||
160 | 161 | ||
161 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); | 162 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); |
162 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); | 163 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); |
@@ -210,7 +211,7 @@ namespace OpenSim.Data.MySQL | |||
210 | } | 211 | } |
211 | 212 | ||
212 | LoadBanList(es); | 213 | LoadBanList(es); |
213 | 214 | LoadSpawnPoints(es); | |
214 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); | 215 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); |
215 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); | 216 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); |
216 | es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); | 217 | es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); |
@@ -297,11 +298,74 @@ namespace OpenSim.Data.MySQL | |||
297 | } | 298 | } |
298 | 299 | ||
299 | SaveBanList(es); | 300 | SaveBanList(es); |
301 | SaveSpawnPoints(es); | ||
300 | SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers); | 302 | SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers); |
301 | SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess); | 303 | SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess); |
302 | SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups); | 304 | SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups); |
303 | } | 305 | } |
304 | 306 | ||
307 | private void LoadSpawnPoints(EstateSettings es) | ||
308 | { | ||
309 | es.ClearSpawnPoints(); | ||
310 | |||
311 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
312 | { | ||
313 | dbcon.Open(); | ||
314 | |||
315 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
316 | { | ||
317 | uint EstateID = es.EstateID; | ||
318 | cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where EstateID = ?EstateID"; | ||
319 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID); | ||
320 | |||
321 | using (IDataReader r = cmd.ExecuteReader()) | ||
322 | { | ||
323 | while (r.Read()) | ||
324 | { | ||
325 | Vector3 point = new Vector3(); | ||
326 | |||
327 | point.X = (float)r["PointX"]; | ||
328 | point.Y = (float)r["PointY"]; | ||
329 | point.Z = (float)r["PointZ"]; | ||
330 | |||
331 | es.AddSpawnPoint(point); | ||
332 | } | ||
333 | } | ||
334 | } | ||
335 | } | ||
336 | } | ||
337 | |||
338 | private void SaveSpawnPoints(EstateSettings es) | ||
339 | { | ||
340 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
341 | { | ||
342 | dbcon.Open(); | ||
343 | |||
344 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
345 | { | ||
346 | cmd.CommandText = "delete from spawn_points where EstateID = ?EstateID"; | ||
347 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); | ||
348 | |||
349 | cmd.ExecuteNonQuery(); | ||
350 | |||
351 | cmd.Parameters.Clear(); | ||
352 | |||
353 | cmd.CommandText = "insert into spawn_points (EstateID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)"; | ||
354 | |||
355 | foreach (Vector3 p in es.SpawnPoints()) | ||
356 | { | ||
357 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); | ||
358 | cmd.Parameters.AddWithValue("?PointX", p.X); | ||
359 | cmd.Parameters.AddWithValue("?PointY", p.Y); | ||
360 | cmd.Parameters.AddWithValue("?PointZ", p.Z); | ||
361 | |||
362 | cmd.ExecuteNonQuery(); | ||
363 | cmd.Parameters.Clear(); | ||
364 | } | ||
365 | } | ||
366 | } | ||
367 | } | ||
368 | |||
305 | private void LoadBanList(EstateSettings es) | 369 | private void LoadBanList(EstateSettings es) |
306 | { | 370 | { |
307 | es.ClearBans(); | 371 | es.ClearBans(); |
diff --git a/OpenSim/Data/MySQL/Resources/EstateStore.migrations b/OpenSim/Data/MySQL/Resources/EstateStore.migrations index df82a2e..591295b 100644 --- a/OpenSim/Data/MySQL/Resources/EstateStore.migrations +++ b/OpenSim/Data/MySQL/Resources/EstateStore.migrations | |||
@@ -78,4 +78,25 @@ ALTER TABLE estate_settings AUTO_INCREMENT = 100; | |||
78 | COMMIT; | 78 | COMMIT; |
79 | 79 | ||
80 | 80 | ||
81 | :VERSION 33 #--------------------- ( Supporting Telehubs | ||
81 | 82 | ||
83 | BEGIN; | ||
84 | CREATE TABLE IF NOT EXISTS `spawn_points` ( | ||
85 | `EstateID` varchar(36) COLLATE utf8_unicode_ci NOT NULL, | ||
86 | `PointX` float NOT NULL, | ||
87 | `PointY` float NOT NULL, | ||
88 | `PointZ` float NOT NULL, | ||
89 | KEY `EstateID` (`EstateID`) | ||
90 | ) ENGINE=Innodb; | ||
91 | |||
92 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL; | ||
93 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubName` varchar(255) NOT NULL; | ||
94 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubEnabled` tinyint(4) NOT NULL; | ||
95 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosX` float NOT NULL; | ||
96 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosY` float NOT NULL; | ||
97 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosZ` float NOT NULL; | ||
98 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotX` float NOT NULL; | ||
99 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotY` float NOT NULL; | ||
100 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotZ` float NOT NULL; | ||
101 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotW` float NOT NULL; | ||
102 | COMMIT; \ No newline at end of file | ||