/*public static void DoRoomItems(SqlDatabaseClient Phoenix, SqlDatabaseClient Butterfly) { DataTable items = Phoenix.ExecuteQueryTable("SELECT * FROM items WHERE room_id > 0 AND wall_pos NOT LIKE ':w=%'"); foreach (DataRow item in items.Rows) { uint Id = (uint)item["id"]; uint RoomId = (uint)item["room_id"]; int CombinedXY = Combine((double)item["x"], (double)item["y"]); double Z = (double)item["z"]; int Rotation = (int)item["rot"]; int BaseItem = (int)item["base_item"]; string ExtraData = (string)item["extra_data"]; Butterfly.ExecuteNonQuery("REPLACE INTO items_rooms(item_id, room_id, x, y, n) VALUES ('" + Id + "', '" + RoomId + "', '" + CombinedXY + "', '" + Z + "', '" + Rotation + "')"); Butterfly.ExecuteNonQuery("REPLACE INTO items(item_id, base_id) VALUES ('" + Id + "', '" + BaseItem + "')"); if (ExtraData != "") { string SafeExtraData = AddSlashes(ExtraData); Butterfly.ExecuteNonQuery("REPLACE INTO items_extradata (item_id, data) VALUES ('" + Id + "', '" + SafeExtraData + "')"); } items.Rows.Remove(item); } }*/ public static void DoUserItems(SqlDatabaseClient Phoenix, SqlDatabaseClient Butterfly) { DataTable items = Phoenix.ExecuteQueryTable("SELECT * FROM items WHERE room_id = 0 AND wall_pos NOT LIKE ':w=%'"); foreach (DataRow item in items.Rows) { uint Id = (uint)item["id"]; int UserId = (int)item["user_id"]; int BaseItem = (int)item["base_item"]; string ExtraData = (string)item["extra_data"]; Butterfly.ExecuteNonQuery("REPLACE INTO items_users(item_id, user_id) VALUES ('" + Id + "', '" + UserId + "')"); Butterfly.ExecuteNonQuery("REPLACE INTO items(item_id, base_id) VALUES ('" + Id + "', '" + BaseItem + "')"); if (ExtraData != "") { string SafeExtraData = AddSlashes(ExtraData); Butterfly.ExecuteNonQuery("REPLACE INTO items_extradata (item_id, data) VALUES ('" + Id + "', '" + SafeExtraData + "')"); } items.Rows.Remove(item); } }
public static void DoUserWallItems(SqlDatabaseClient Phoenix, SqlDatabaseClient Butterfly) { DataTable items = Phoenix.ExecuteQueryTable("SELECT * FROM items WHERE room_id = 0 AND wall_pos LIKE ':w=%'"); foreach (DataRow item in items.Rows) { uint Id = (uint)item["id"]; int UserId = (int)item["user_id"]; int BaseItem = (int)item["base_item"]; Butterfly.ExecuteNonQuery("REPLACE INTO items_users(item_id, user_id) VALUES ('" + Id + "', '" + UserId + "')"); Butterfly.ExecuteNonQuery("REPLACE INTO items(item_id, base_id) VALUES ('" + Id + "', '" + BaseItem + "')"); items.Rows.Remove(item); } }
public static void DoWallItems(SqlDatabaseClient Phoenix, SqlDatabaseClient Butterfly) { DataTable items = Phoenix.ExecuteQueryTable("SELECT * FROM items WHERE room_id > 0 AND wall_pos LIKE ':w=%'"); foreach (DataRow item in items.Rows) { int Id = Convert.ToInt32(item["id"]); int RoomId = Convert.ToInt32(item["room_id"]); string WallPos = (string)item["wall_pos"]; int Position; string start = WallPos.Replace(":w=", ""); string start2 = start.Replace("l=", ""); string[] furni1 = start.Split(' '); string[] furni2 = start2.Split(' '); string x = furni1[0]; string x1 = x.Replace(",", "."); string y = furni2[1]; string y1 = y.Replace(",", "."); if (furni2[2] == "l") Position = 8; else Position = 7; string data = x1; string[] furnix = data.Split('.'); string data1 = y1; string[] furniy = data1.Split('.'); double x0 = Convert.ToDouble(furnix[0]); double x01 = Convert.ToDouble(furnix[1]); double y0 = Convert.ToDouble(furniy[0]); double y01 = Convert.ToDouble(furniy[1]); double g = Combine(x0, x01); double h = Combine(y0, y01); Butterfly.ExecuteNonQuery("REPLACE INTO items_rooms(item_id, room_id, x, y, n) VALUES ('" + Id + "', '" + RoomId + "', '" + g + "', '" + h + "', '" + Position + "')"); } }