aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLRegionData.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-24 05:25:26 +0000
committerMelanie Thielker2008-08-24 05:25:26 +0000
commitc9b5641c499d23ff6674cafa1026b88ade1debec (patch)
treed9a274c8a60f94cc4246beb7816d6b453e8d6436 /OpenSim/Data/MySQL/MySQLRegionData.cs
parentAdd the fields for the eye candy and sale featires to the prims table. (diff)
downloadopensim-SC_OLD-c9b5641c499d23ff6674cafa1026b88ade1debec.zip
opensim-SC_OLD-c9b5641c499d23ff6674cafa1026b88ade1debec.tar.gz
opensim-SC_OLD-c9b5641c499d23ff6674cafa1026b88ade1debec.tar.bz2
opensim-SC_OLD-c9b5641c499d23ff6674cafa1026b88ade1debec.tar.xz
Plumb the data path for all those eye candy values. Saves texture
animation, target omega, looped sound, script access pin, allowed drop state and sale data. Loads it, too. Not all tested. Code: No Nuts. Data: Cannot Guarantee Nut Free.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLRegionData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs194
1 files changed, 139 insertions, 55 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 85af5df..c0ebbc6 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -979,6 +979,38 @@ namespace OpenSim.Data.MySQL
979 createCol(prims, "SitTargetOrientY", typeof (Double)); 979 createCol(prims, "SitTargetOrientY", typeof (Double));
980 createCol(prims, "SitTargetOrientZ", typeof (Double)); 980 createCol(prims, "SitTargetOrientZ", typeof (Double));
981 981
982 createCol(prims, "PayPrice", typeof(Int32));
983 createCol(prims, "PayButton1", typeof(Int32));
984 createCol(prims, "PayButton2", typeof(Int32));
985 createCol(prims, "PayButton3", typeof(Int32));
986 createCol(prims, "PayButton4", typeof(Int32));
987
988 createCol(prims, "LoopedSound", typeof(String));
989 createCol(prims, "LoopedSoundGain", typeof(Double));
990 createCol(prims, "TextureAnimation", typeof(Byte[]));
991
992 createCol(prims, "OmegaX", typeof (Double));
993 createCol(prims, "OmegaY", typeof (Double));
994 createCol(prims, "OmegaZ", typeof (Double));
995
996 createCol(prims, "CameraEyeOffsetX", typeof (Double));
997 createCol(prims, "CameraEyeOffsetY", typeof (Double));
998 createCol(prims, "CameraEyeOffsetZ", typeof (Double));
999
1000 createCol(prims, "CameraAtOffsetX", typeof (Double));
1001 createCol(prims, "CameraAtOffsetY", typeof (Double));
1002 createCol(prims, "CameraAtOffsetZ", typeof (Double));
1003
1004 createCol(prims, "ForceMouselook", typeof (Int16));
1005
1006 createCol(prims, "ScriptAccessPin", typeof(Int32));
1007
1008 createCol(prims, "AllowedDrop", typeof (Int16));
1009 createCol(prims, "DieAtEdge", typeof (Int16));
1010
1011 createCol(prims, "SalePrice", typeof(Int32));
1012 createCol(prims, "SaleType", typeof (Int16));
1013
982 1014
983 // Add in contraints 1015 // Add in contraints
984 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; 1016 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
@@ -1200,38 +1232,66 @@ namespace OpenSim.Data.MySQL
1200 Convert.ToSingle(row["RotationZ"]), 1232 Convert.ToSingle(row["RotationZ"]),
1201 Convert.ToSingle(row["RotationW"]) 1233 Convert.ToSingle(row["RotationW"])
1202 ); 1234 );
1203 try 1235 prim.SitTargetPositionLL = new LLVector3(
1204 { 1236 Convert.ToSingle(row["SitTargetOffsetX"]),
1205 prim.SitTargetPositionLL = new LLVector3( 1237 Convert.ToSingle(row["SitTargetOffsetY"]),
1206 Convert.ToSingle(row["SitTargetOffsetX"]), 1238 Convert.ToSingle(row["SitTargetOffsetZ"])
1207 Convert.ToSingle(row["SitTargetOffsetY"]), 1239 );
1208 Convert.ToSingle(row["SitTargetOffsetZ"])); 1240 prim.SitTargetOrientationLL = new LLQuaternion(
1209 prim.SitTargetOrientationLL = new LLQuaternion( 1241 Convert.ToSingle(row["SitTargetOrientX"]),
1210 Convert.ToSingle( 1242 Convert.ToSingle(row["SitTargetOrientY"]),
1211 row["SitTargetOrientX"]), 1243 Convert.ToSingle(row["SitTargetOrientZ"]),
1212 Convert.ToSingle( 1244 Convert.ToSingle(row["SitTargetOrientW"])
1213 row["SitTargetOrientY"]), 1245 );
1214 Convert.ToSingle( 1246
1215 row["SitTargetOrientZ"]), 1247 prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]);
1216 Convert.ToSingle( 1248 prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]);
1217 row["SitTargetOrientW"])); 1249 prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]);
1218 } 1250 prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]);
1219 catch (InvalidCastException) 1251 prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]);
1220 { 1252
1221 // Database table was created before we got here and needs to be created! :P 1253 prim.Sound = new LLUUID(row["LoopedSound"].ToString());
1254 prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]);
1255 prim.SoundFlags = 1; // If it's persisted at all, it's looped
1256
1257 if (!row.IsNull("TextureAnimation"))
1258 prim.TextureAnimation = (Byte[])row["TextureAnimation"];
1259
1260 prim.RotationalVelocity = new LLVector3(
1261 Convert.ToSingle(row["OmegaX"]),
1262 Convert.ToSingle(row["OmegaY"]),
1263 Convert.ToSingle(row["OmegaZ"])
1264 );
1265
1266 // TODO: Rotation
1267 // OmegaX, OmegaY, OmegaZ
1268
1269 prim.SetCameraEyeOffset(new LLVector3(
1270 Convert.ToSingle(row["CameraEyeOffsetX"]),
1271 Convert.ToSingle(row["CameraEyeOffsetY"]),
1272 Convert.ToSingle(row["CameraEyeOffsetZ"])
1273 ));
1274
1275 prim.SetCameraAtOffset(new LLVector3(
1276 Convert.ToSingle(row["CameraAtOffsetX"]),
1277 Convert.ToSingle(row["CameraAtOffsetY"]),
1278 Convert.ToSingle(row["CameraAtOffsetZ"])
1279 ));
1280
1281 if (Convert.ToInt16(row["ForceMouselook"]) != 0)
1282 prim.SetForceMouselook(true);
1283
1284 prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]);
1285
1286 if (Convert.ToInt16(row["AllowedDrop"]) != 0)
1287 prim.AllowedDrop = true;
1288
1289 if (Convert.ToInt16(row["DieAtEdge"]) != 0)
1290 prim.DIE_AT_EDGE = true;
1291
1292 prim.SalePrice = Convert.ToInt32(row["SalePrice"]);
1293 prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
1222 1294
1223 lock (m_dataSet)
1224 {
1225 using (
1226 MySqlCommand cmd =
1227 new MySqlCommand(
1228 "ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;",
1229 m_connection))
1230 {
1231 cmd.ExecuteNonQuery();
1232 }
1233 }
1234 }
1235 return prim; 1295 return prim;
1236 } 1296 }
1237 1297
@@ -1471,33 +1531,57 @@ namespace OpenSim.Data.MySQL
1471 row["RotationZ"] = prim.RotationOffset.Z; 1531 row["RotationZ"] = prim.RotationOffset.Z;
1472 row["RotationW"] = prim.RotationOffset.W; 1532 row["RotationW"] = prim.RotationOffset.W;
1473 1533
1474 try 1534 // Sit target
1535 LLVector3 sitTargetPos = prim.SitTargetPositionLL;
1536 row["SitTargetOffsetX"] = sitTargetPos.X;
1537 row["SitTargetOffsetY"] = sitTargetPos.Y;
1538 row["SitTargetOffsetZ"] = sitTargetPos.Z;
1539
1540 LLQuaternion sitTargetOrient = prim.SitTargetOrientationLL;
1541 row["SitTargetOrientW"] = sitTargetOrient.W;
1542 row["SitTargetOrientX"] = sitTargetOrient.X;
1543 row["SitTargetOrientY"] = sitTargetOrient.Y;
1544 row["SitTargetOrientZ"] = sitTargetOrient.Z;
1545
1546 row["PayPrice"] = prim.PayPrice[0];
1547 row["PayButton1"] = prim.PayPrice[1];
1548 row["PayButton2"] = prim.PayPrice[2];
1549 row["PayButton3"] = prim.PayPrice[3];
1550 row["PayButton4"] = prim.PayPrice[4];
1551
1552 if ((prim.SoundFlags & 1) != 0) // Looped
1475 { 1553 {
1476 // Sit target 1554 row["LoopedSound"] = prim.Sound.ToString();
1477 LLVector3 sitTargetPos = prim.SitTargetPositionLL; 1555 row["LoopedSoundGain"] = prim.SoundGain;
1478 row["SitTargetOffsetX"] = sitTargetPos.X;
1479 row["SitTargetOffsetY"] = sitTargetPos.Y;
1480 row["SitTargetOffsetZ"] = sitTargetPos.Z;
1481
1482 LLQuaternion sitTargetOrient = prim.SitTargetOrientationLL;
1483 row["SitTargetOrientW"] = sitTargetOrient.W;
1484 row["SitTargetOrientX"] = sitTargetOrient.X;
1485 row["SitTargetOrientY"] = sitTargetOrient.Y;
1486 row["SitTargetOrientZ"] = sitTargetOrient.Z;
1487 } 1556 }
1488 catch (MySqlException)
1489 {
1490 // Database table was created before we got here and needs to be created! :P
1491 1557
1492 using ( 1558 row["TextureAnimation"] = prim.TextureAnimation;
1493 MySqlCommand cmd = 1559
1494 new MySqlCommand( 1560 row["OmegaX"] = prim.RotationalVelocity.X;
1495 "ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", 1561 row["OmegaY"] = prim.RotationalVelocity.Y;
1496 m_connection)) 1562 row["OmegaZ"] = prim.RotationalVelocity.Z;
1497 { 1563
1498 cmd.ExecuteNonQuery(); 1564 row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X;
1499 } 1565 row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().Y;
1500 } 1566 row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z;
1567
1568 row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X;
1569 row["CameraAtOffsetX"] = prim.GetCameraAtOffset().Y;
1570 row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z;
1571
1572 if (prim.GetForceMouselook())
1573 row["ForceMouselook"] = 1;
1574
1575 row["ScriptAccessPin"] = prim.ScriptAccessPin;
1576
1577 if (prim.AllowedDrop)
1578 row["AllowedDrop"] = 1;
1579 if (prim.DIE_AT_EDGE)
1580 row["DieAtEdge"] = 1;
1581
1582 row["SalePrice"] = prim.SalePrice;
1583 row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType);
1584
1501 } 1585 }
1502 1586
1503 /// <summary> 1587 /// <summary>