//Sets the quaternion rotation value of all characters in the database public static void SetAllRotations(Quaternion Rotation) { //Define the SQL query for applying the new rotation values to the database string RotationQuery = "UPDATE characters SET " + "XRotation='" + Rotation.X + "', " + "YRotation='" + Rotation.Y + "', " + "ZRotation='" + Rotation.Z + "', " + "WRotation='" + Rotation.W + "'"; //Pass the query on to be executed in a new SQL command CommandManager.ExecuteNonQuery(RotationQuery, "Setting the rotation of all characters in the database to " + Rotation.ToString() + "."); }
//Tries using the command arguments for performing a setallcharactersrotations private void TrySetAllCharactersRotations(string[] Input) { //Seperate the command arguments Quaternion Rotation = new Quaternion(float.Parse(Input[1]), float.Parse(Input[2]), float.Parse(Input[3]), float.Parse(Input[4])); //Log what is happening here MessageLog.Print("Setting the rotation of all characters in the database to " + Rotation.ToString()); //Apply the new rotation to all characters in the database CharactersDatabase.SetAllRotations(Rotation); }
//Backs up a characters world rotation value into the database private static void SetCharacterRotation(string CharacterName, Quaternion CharacterRotation) { string UpdateQuery = "UPDATE characters SET XRotation='" + CharacterRotation.X + "', YRotation='" + CharacterRotation.Y + "', ZRotation='" + CharacterRotation.Z + "', WRotation='" + CharacterRotation.W + "' WHERE CharacterName='" + CharacterName + "'"; CommandManager.ExecuteNonQuery(UpdateQuery, "Setting " + CharacterName + "s rotation in the database to " + CharacterRotation.ToString()); }