/// <summary> /// Adds a virtualRoom class together with the roomID to the roomManager. /// </summary> /// <param name="roomID">The ID of the room to add..</param> /// <param name="Room">The virtualRoom class of this room.</param> public static void addRoom(int roomID, virtualRoom Room) { if (_Rooms.ContainsKey(roomID) == false) { _Rooms.Add(roomID, Room); Out.WriteLine("Room [" + roomID + ", publicroom: " + Room.isPublicroom.ToString().ToLower() + "] loaded.", Out.logFlags.StandardAction); if (_Rooms.Count > _peakRoomCount) _peakRoomCount = _Rooms.Count; } }
/// <summary> /// Removes all the items from the item manager and destructs all objects inside. /// </summary> internal void Clear() { try { _Items.Clear(); } catch { } _Room = null; _Items = null; }
/// <summary> /// Initializes the manager. /// </summary> /// <param name="Room">The parent room.</param> public WallItemManager(virtualRoom Room) { this._Room = Room; }
/// <summary> /// Initializes the manager. /// </summary> /// <param name="Room">The parent room.</param> public FloorItemManager(virtualRoom Room) { this._Room = Room; }
/// <summary> /// Processes a single packet from the client. /// </summary> /// <param name="currentPacket">The packet to process.</param> private void processPacket(string currentPacket) { //Out.WriteSpecialLine(currentPacket.Replace(Convert.ToChar(13).ToString(), "{13}"), Out.logFlags.MehAction, ConsoleColor.DarkGray, ConsoleColor.DarkYellow, "< [" + Thread.GetDomainID() + "]", 2, ConsoleColor.Yellow); //try { if (_isLoggedIn == false) #region Non-logged in packet processing { switch (currentPacket.Substring(0, 2)) { case "CD": pingOK = true; break; case "CN": sendData("DUIH"); break; case "CJ": sendData("DAQBHHIIKHJIPAHQAdd-MM-yyyy" + Convert.ToChar(2) + "SAHPBhttp://www.holographemulator.com" + Convert.ToChar(2) + "QBH"); break; case "CL": { string ssoTicket = DB.Stripslash(currentPacket.Substring(4)); int myID = DB.runRead("SELECT id FROM users WHERE ticket_sso = '" + ssoTicket + "' AND ipaddress_last = '" + connectionRemoteIP + "'", null); if (myID == 0) // No user found for this sso ticket and/or IP address { Disconnect(); return; } string banReason = userManager.getBanReason(myID); if (banReason != "") { sendData("@c" + banReason); Disconnect(1000); return; } this.userID = myID; string[] userData = DB.runReadRow("SELECT name,figure,sex,mission,rank,consolemission FROM users WHERE id = '" + myID + "'"); _Username = userData[0]; _Figure = userData[1]; _Sex = char.Parse(userData[2]); _Mission = userData[3]; _Rank = byte.Parse(userData[4]); _consoleMission = userData[5]; userManager.addUser(myID, this); _isLoggedIn = true; sendData("DA" + "QBHIIIKHJIPAIQAdd-MM-yyyy" + Convert.ToChar(2) + "SAHPB/client" + Convert.ToChar(2) + "QBH"); sendData("@B" + rankManager.fuseRights(_Rank)); sendData("DbIH"); sendData("@C"); if (Config.enableWelcomeMessage) sendData("BK" + stringManager.getString("welcomemessage_text")); break; } default: Disconnect(); break; } } #endregion else #region Logged-in packet processing { switch (currentPacket.Substring(0, 2)) { case "CD": // Client - response to @r ping pingOK = true; break; case "@q": // Client - request current date sendData("Bc" + DateTime.Today.ToShortDateString()); break; #region Login case "@L": // Login - initialize messenger Messenger = new Messenger.virtualMessenger(userID); sendData("@L" + Messenger.friendList()); sendData("Dz" + Messenger.friendRequests()); break; case "@Z": // Login - initialize Club subscription status refreshClub(); break; case "@G": // Login - initialize/refresh appearance refreshAppearance(false, true, false); break; case "@H": // Login - initialize/refresh valueables [credits, tickets, etc] refreshValueables(true, true); break; case "B]": // Login - initialize/refresh badges refreshBadges(); break; case "Cd": // Login - initialize/refresh group status refreshGroupStatus(); break; case "C^": // Recycler - receive recycler setup sendData("Do" + recyclerManager.setupString); break; case "C_": // Recycler - receive recycler session status sendData("Dp" + recyclerManager.sessionString(userID)); break; #endregion case "BA": // Purse - redeem credit voucher { string Code = DB.Stripslash(currentPacket.Substring(4)); if (DB.checkExists("SELECT * FROM vouchers WHERE voucher = '" + Code + "'")) { int voucherAmount = DB.runRead("SELECT credits FROM vouchers WHERE voucher = '" + Code + "'", null); DB.runQuery("DELETE FROM vouchers WHERE voucher = '" + Code + "' LIMIT 1"); _Credits += voucherAmount; sendData("@F" + _Credits); sendData("CT"); DB.runQuery("UPDATE users SET credits = '" + voucherAmount + "' WHERE id = '" + userID + "' LIMIT 1"); } else sendData("CU1"); break; } #region Messenger case "@g": // Messenger - request user as friend { if (Messenger != null) { string Username = DB.Stripslash(currentPacket.Substring(4)); int toID = DB.runRead("SELECT id FROM users WHERE name = '" + Username + "'", null); if (toID > 0 && Messenger.hasFriendRequests(toID) == false && Messenger.hasFriendship(toID) == false) { int requestID = DB.runReadUnsafe("SELECT MAX(requestid) FROM messenger_friendrequests WHERE userid_to = '" + toID + "'", null) + 1; DB.runQuery("INSERT INTO messenger_friendrequests(userid_to,userid_from,requestid) VALUES ('" + toID + "','" + userID + "','" + requestID + "')"); userManager.getUser(toID).sendData("BD" + "I" + _Username + Convert.ToChar(2) + userID + Convert.ToChar(2)); } } break; } case "@e": // Messenger - accept friendrequest(s) { if (Messenger != null) { int Amount = Encoding.decodeVL64(currentPacket.Substring(2)); currentPacket = currentPacket.Substring(Encoding.encodeVL64(Amount).Length + 2); int updateAmount = 0; StringBuilder Updates = new StringBuilder(); virtualBuddy Me = new virtualBuddy(userID); for (int i = 0; i < Amount; i++) { if (currentPacket == "") return; int requestID = Encoding.decodeVL64(currentPacket); int fromUserID = DB.runRead("SELECT userid_from FROM messenger_friendrequests WHERE userid_to = '" + this.userID + "' AND requestid = '" + requestID + "'", null); if (fromUserID == 0) // Corrupt data return; virtualBuddy Buddy = new virtualBuddy(fromUserID); Updates.Append(Buddy.ToString(true)); updateAmount++; Messenger.addBuddy(Buddy, false); if (userManager.containsUser(fromUserID)) userManager.getUser(fromUserID).Messenger.addBuddy(Me, true); DB.runQuery("INSERT INTO messenger_friendships(userid,friendid) VALUES ('" + fromUserID + "','" + this.userID + "')"); DB.runQuery("DELETE FROM messenger_friendrequests WHERE userid_to = '" + this.userID + "' AND requestid = '" + requestID + "' LIMIT 1"); currentPacket = currentPacket.Substring(Encoding.encodeVL64(requestID).Length); } if (updateAmount > 0) sendData("@M" + "HI" + Encoding.encodeVL64(updateAmount) + Updates.ToString()); } break; } case "@f": // Messenger - decline friendrequests { if (Messenger != null) { int Amount = Encoding.decodeVL64(currentPacket.Substring(2)); currentPacket = currentPacket.Substring(Encoding.encodeVL64(Amount).Length + 2); for (int i = 0; i < Amount; i++) { if (currentPacket == "") return; int requestID = Encoding.decodeVL64(currentPacket); DB.runQuery("DELETE FROM messenger_friendrequests WHERE userid_to = '" + this.userID + "' AND requestid = '" + requestID + "' LIMIT 1"); currentPacket = currentPacket.Substring(Encoding.encodeVL64(requestID).Length); } } break; } case "@h": // Messenger - remove buddy from friendlist { if (Messenger != null) { int buddyID = Encoding.decodeVL64(currentPacket.Substring(3)); Messenger.removeBuddy(buddyID); if (userManager.containsUser(buddyID)) userManager.getUser(buddyID).Messenger.removeBuddy(userID); DB.runQuery("DELETE FROM messenger_friendships WHERE (userid = '" + userID + "' AND friendid = '" + buddyID + "') OR (userid = '" + buddyID + "' AND friendid = '" + userID + "') LIMIT 1"); } break; } case "@a": // Messenger - send instant message to buddy { if (Messenger != null) { int buddyID = Encoding.decodeVL64(currentPacket.Substring(2)); string Message = currentPacket.Substring(Encoding.encodeVL64(buddyID).Length + 4); Message = stringManager.filterSwearwords(Message); // Filter swearwords if (Messenger.containsOnlineBuddy(buddyID)) // Buddy online userManager.getUser(buddyID).sendData("BF" + Encoding.encodeVL64(userID) + Message + Convert.ToChar(2)); else // Buddy offline (or user doesn't has user in buddylist) sendData("DE" + Encoding.encodeVL64(5) + Encoding.encodeVL64(userID)); } break; } case "@O": // Messenger - refresh friendlist { if (Messenger != null) sendData("@M" + Messenger.getUpdates()); break; } case "DF": // Messenger - follow buddy to a room { if (Messenger != null) { int ID = Encoding.decodeVL64(currentPacket.Substring(2)); int errorID = -1; if (Messenger.hasFriendship(ID)) // Has friendship with user { if (userManager.containsUser(ID)) // User is online { virtualUser _User = userManager.getUser(ID); if (_User._roomID > 0) // User is in room { if (_User._inPublicroom) sendData("D^" + "I" + Encoding.encodeVL64(_User._roomID)); else sendData("D^" + "H" + Encoding.encodeVL64(_User._roomID)); } else // User is not in a room errorID = 2; } else // User is offline errorID = 1; } else // User is not this virtual user's friend errorID = 0; if (errorID != -1) // Error occured sendData("E]" + Encoding.encodeVL64(errorID)); } break; } case "@b": // Messenger - invite buddies to your room { if (Messenger != null && roomUser != null) { int Amount = Encoding.decodeVL64(currentPacket.Substring(2)); int[] IDs = new int[Amount]; currentPacket = currentPacket.Substring(Encoding.encodeVL64(Amount).Length + 2); for (int i = 0; i < Amount; i++) { if (currentPacket == "") return; int ID = Encoding.decodeVL64(currentPacket); if (Messenger.hasFriendship(ID) && userManager.containsUser(ID)) IDs[i] = ID; currentPacket = currentPacket.Substring(Encoding.encodeVL64(ID).Length); } string Message = currentPacket.Substring(2); string Data = "BG" + Encoding.encodeVL64(userID) + Message + Convert.ToChar(2); for (int i = 0; i < Amount; i++) userManager.getUser(IDs[i]).sendData(Data); } break; } #endregion #region Navigator actions case "BV": // Navigator - navigate through rooms and categories { int hideFull = Encoding.decodeVL64(currentPacket.Substring(2, 1)); int cataID = Encoding.decodeVL64(currentPacket.Substring(3)); string Name = DB.runReadUnsafe("SELECT name FROM room_categories WHERE id = '" + cataID + "' AND (access_rank_min <= " + _Rank + " OR access_rank_hideforlower = '0')"); if (Name == "") // User has no access to this category/it does not exist return; int Type = DB.runRead("SELECT type FROM room_categories WHERE id = '" + cataID + "'", null); int parentID = DB.runRead("SELECT parent FROM room_categories WHERE id = '" + cataID + "'", null); StringBuilder Navigator = new StringBuilder(@"C\" + Encoding.encodeVL64(hideFull) + Encoding.encodeVL64(cataID) + Encoding.encodeVL64(Type) + Name + Convert.ToChar(2) + Encoding.encodeVL64(0) + Encoding.encodeVL64(10000) + Encoding.encodeVL64(parentID)); string _SQL_ORDER_HELPER = ""; if (Type == 0) // Publicrooms { if (hideFull == 1) _SQL_ORDER_HELPER = "AND visitors_now < visitors_max ORDER BY id ASC"; else _SQL_ORDER_HELPER = "ORDER BY id ASC"; } else // Guestrooms { if (hideFull == 1) _SQL_ORDER_HELPER = "AND visitors_now < visitors_max ORDER BY visitors_now DESC LIMIT 30"; else _SQL_ORDER_HELPER = "ORDER BY visitors_now DESC LIMIT " + Config.Navigator_openCategory_maxResults; } int[] roomIDs = DB.runReadColumn("SELECT id FROM rooms WHERE category = '" + cataID + "' " + _SQL_ORDER_HELPER, 0, null); if (Type == 2) // Guestrooms Navigator.Append(Encoding.encodeVL64(roomIDs.Length)); if (roomIDs.Length > 0) { bool canSeeHiddenNames = false; int[] roomStates = DB.runReadColumn("SELECT state FROM rooms WHERE category = '" + cataID + "' " + _SQL_ORDER_HELPER, 0, null); int[] showNameFlags = DB.runReadColumn("SELECT showname FROM rooms WHERE category = '" + cataID + "' " + _SQL_ORDER_HELPER, 0, null); int[] nowVisitors = DB.runReadColumn("SELECT visitors_now FROM rooms WHERE category = '" + cataID + "' " + _SQL_ORDER_HELPER, 0, null); int[] maxVisitors = DB.runReadColumn("SELECT visitors_max FROM rooms WHERE category = '" + cataID + "' " + _SQL_ORDER_HELPER, 0, null); string[] roomNames = DB.runReadColumn("SELECT name FROM rooms WHERE category = '" + cataID + "' " + _SQL_ORDER_HELPER, 0); string[] roomDescriptions = DB.runReadColumn("SELECT description FROM rooms WHERE category = '" + cataID + "' " + _SQL_ORDER_HELPER, 0); string[] roomOwners = DB.runReadColumn("SELECT owner FROM rooms WHERE category = '" + cataID + "' " + _SQL_ORDER_HELPER, 0); string[] roomCCTs = null; if (Type == 0) // Publicroom roomCCTs = DB.runReadColumn("SELECT ccts FROM rooms WHERE category = '" + cataID + "' " + _SQL_ORDER_HELPER, 0); else canSeeHiddenNames = rankManager.containsRight(_Rank, "fuse_enter_locked_rooms"); for (int i = 0; i < roomIDs.Length; i++) { if (Type == 0) // Publicroom Navigator.Append(Encoding.encodeVL64(roomIDs[i]) + Encoding.encodeVL64(1) + roomNames[i] + Convert.ToChar(2) + Encoding.encodeVL64(nowVisitors[i]) + Encoding.encodeVL64(maxVisitors[i]) + Encoding.encodeVL64(cataID) + roomDescriptions[i] + Convert.ToChar(2) + Encoding.encodeVL64(roomIDs[i]) + Encoding.encodeVL64(0) + roomCCTs[i] + Convert.ToChar(2) + "HI"); else // Guestroom { if (showNameFlags[i] == 0 && canSeeHiddenNames == false) continue; else Navigator.Append(Encoding.encodeVL64(roomIDs[i]) + roomNames[i] + Convert.ToChar(2) + roomOwners[i] + Convert.ToChar(2) + roomManager.getRoomState(roomStates[i]) + Convert.ToChar(2) + Encoding.encodeVL64(nowVisitors[i]) + Encoding.encodeVL64(maxVisitors[i]) + roomDescriptions[i] + Convert.ToChar(2)); } } } int[] subCataIDs = DB.runReadColumn("SELECT id FROM room_categories WHERE parent = '" + cataID + "' AND (access_rank_min <= " + _Rank + " OR access_rank_hideforlower = '0') ORDER BY id ASC", 0, null); if (subCataIDs.Length > 0) // Sub categories { for (int i = 0; i < subCataIDs.Length; i++) { int visitorCount = DB.runReadUnsafe("SELECT SUM(visitors_now) FROM rooms WHERE category = '" + subCataIDs[i] + "'", null); int visitorMax = DB.runReadUnsafe("SELECT SUM(visitors_max) FROM rooms WHERE category = '" + subCataIDs[i] + "'", null); if (visitorMax > 0 && hideFull == 1 && visitorCount >= visitorMax) continue; string subName = DB.runRead("SELECT name FROM room_categories WHERE id = '" + subCataIDs[i] + "'"); Navigator.Append(Encoding.encodeVL64(subCataIDs[i]) + Encoding.encodeVL64(0) + subName + Convert.ToChar(2) + Encoding.encodeVL64(visitorCount) + Encoding.encodeVL64(visitorMax) + Encoding.encodeVL64(cataID)); } } sendData(Navigator.ToString()); break; } case "BW": // Navigator - request index of categories to place guestroom on { StringBuilder Categories = new StringBuilder(); int[] cataIDs = DB.runReadColumn("SELECT id FROM room_categories WHERE type = '2' AND parent > 0 AND access_rank_min <= " + _Rank + " ORDER BY id ASC", 0, null); string[] cataNames = DB.runReadColumn("SELECT name FROM room_categories WHERE type = '2' AND parent > 0 AND access_rank_min <= " + _Rank + " ORDER BY id ASC", 0); for (int i = 0; i < cataIDs.Length; i++) Categories.Append(Encoding.encodeVL64(cataIDs[i]) + cataNames[i] + Convert.ToChar(2)); sendData("C]" + Encoding.encodeVL64(cataIDs.Length) + Categories.ToString()); break; } case "DH": // Navigator - refresh recommended rooms (random guestrooms) { string Rooms = ""; for (int i = 0; i <= 3; i++) { string[] roomDetails = DB.runReadRow("SELECT id,name,owner,description,state,visitors_now,visitors_max FROM rooms WHERE NOT(owner IS NULL) ORDER BY RAND()"); if (roomDetails.Length == 0) return; else Rooms += Encoding.encodeVL64(int.Parse(roomDetails[0])) + roomDetails[1] + Convert.ToChar(2) + roomDetails[2] + Convert.ToChar(2) + roomManager.getRoomState(int.Parse(roomDetails[4])) + Convert.ToChar(2) + Encoding.encodeVL64(int.Parse(roomDetails[5])) + Encoding.encodeVL64(int.Parse(roomDetails[6])) + roomDetails[3] + Convert.ToChar(2); } sendData("E_" + Encoding.encodeVL64(3) + Rooms); break; } case "@P": // Navigator - view user's own guestrooms { string[] roomIDs = DB.runReadColumn("SELECT id FROM rooms WHERE owner = '" + _Username + "' ORDER BY id ASC", 0); if (roomIDs.Length > 0) { StringBuilder Rooms = new StringBuilder(); for (int i = 0; i < roomIDs.Length; i++) { string[] roomDetails = DB.runReadRow("SELECT name,description,state,showname,visitors_now,visitors_max FROM rooms WHERE id = '" + roomIDs[i] + "'"); Rooms.Append(roomIDs[i] + Convert.ToChar(9) + roomDetails[0] + Convert.ToChar(9) + _Username + Convert.ToChar(9) + roomManager.getRoomState(int.Parse(roomDetails[2])) + Convert.ToChar(9) + "x" + Convert.ToChar(9) + roomDetails[4] + Convert.ToChar(9) + roomDetails[5] + Convert.ToChar(9) + "null" + Convert.ToChar(9) + roomDetails[1] + Convert.ToChar(9) + roomDetails[1] + Convert.ToChar(9) + Convert.ToChar(13)); } sendData("@P" + Rooms.ToString()); } else sendData("@y" + _Username); break; } case "@Q": // Navigator - perform guestroom search on name/owner with a given criticeria { bool seeAllRoomOwners = rankManager.containsRight(_Rank, "fuse_see_all_roomowners"); string _SEARCH = DB.Stripslash(currentPacket.Substring(2)); string[] roomIDs = DB.runReadColumn("SELECT id FROM rooms WHERE NOT(owner IS NULL) AND (owner = '" + _SEARCH + "' OR name LIKE '%" + _SEARCH + "%') ORDER BY id ASC", Config.Navigator_roomSearch_maxResults); if (roomIDs.Length > 0) { StringBuilder Rooms = new StringBuilder(); for (int i = 0; i < roomIDs.Length; i++) { string[] roomDetails = DB.runReadRow("SELECT name,owner,description,state,showname,visitors_now,visitors_max FROM rooms WHERE id = '" + roomIDs[i] + "'"); if (roomDetails[4] == "0" && roomDetails[1] != _Username && seeAllRoomOwners == false) // The room owner has hidden his name at the guestroom and this user hasn't got the fuseright to see all room owners roomDetails[1] = "-"; Rooms.Append(roomIDs[i] + Convert.ToChar(9) + roomDetails[0] + Convert.ToChar(9) + roomDetails[1] + Convert.ToChar(9) + roomManager.getRoomState(int.Parse(roomDetails[3])) + Convert.ToChar(9) + "x" + Convert.ToChar(9) + roomDetails[5] + Convert.ToChar(9) + roomDetails[6] + Convert.ToChar(9) + "null" + Convert.ToChar(9) + roomDetails[2] + Convert.ToChar(9) + Convert.ToChar(13)); } sendData("@w" + Rooms.ToString()); } else sendData("@z"); break; } case "@U": // Navigator - get guestroom details { int roomID = int.Parse(currentPacket.Substring(2)); string[] roomDetails = DB.runReadRow("SELECT name,owner,description,model,state,superusers,showname,category,visitors_now,visitors_max FROM rooms WHERE id = '" + roomID + "' AND NOT(owner IS NULL)"); if (roomDetails.Length > 0) // Guestroom does exist { StringBuilder Details = new StringBuilder(Encoding.encodeVL64(int.Parse(roomDetails[5])) + Encoding.encodeVL64(int.Parse(roomDetails[4])) + Encoding.encodeVL64(roomID)); if (roomDetails[6] == "0" && rankManager.containsRight(_Rank, "fuse_see_all_roomowners")) // The room owner has decided to hide his name at this room, and this user hasn't got the fuseright to see all room owners, hide the name Details.Append("-"); else Details.Append(roomDetails[1]); Details.Append(Convert.ToChar(2) + "model_" + roomDetails[3] + Convert.ToChar(2) + roomDetails[0] + Convert.ToChar(2) + roomDetails[2] + Convert.ToChar(2) + Encoding.encodeVL64(int.Parse(roomDetails[6]))); if (DB.checkExists("SELECT id FROM room_categories WHERE id = '" + roomDetails[7] + "' AND trading = '1'")) Details.Append("I"); // Allow trading else Details.Append("H"); // Disallow trading Details.Append(Encoding.encodeVL64(int.Parse(roomDetails[8])) + Encoding.encodeVL64(int.Parse(roomDetails[9]))); sendData("@v" + Details.ToString()); } break; } case "@R": // Navigator - initialize user's favorite rooms { int[] roomIDs = DB.runReadColumn("SELECT roomid FROM users_favourites WHERE userid = '" + userID + "' ORDER BY roomid DESC", Config.Navigator_Favourites_maxRooms, null); if (roomIDs.Length > 0) { int deletedAmount = 0; int guestRoomAmount = 0; bool seeHiddenRoomOwners = rankManager.containsRight(_Rank, "fuse_enter_locked_rooms"); StringBuilder Rooms = new StringBuilder(); for (int i = 0; i < roomIDs.Length; i++) { string[] roomData = DB.runReadRow("SELECT name,owner,state,showname,visitors_now,visitors_max,description FROM rooms WHERE id = '" + roomIDs[i] + "'"); if (roomData.Length == 0) { if (guestRoomAmount > 0) deletedAmount++; DB.runQuery("DELETE FROM users_favourites WHERE userid = '" + userID + "' AND roomid = '" + roomIDs[i] + "' LIMIT 1"); } else { if (roomData[1] == "") // Publicroom { int categoryID = DB.runRead("SELECT category FROM rooms WHERE id = '" + roomIDs[i] + "'", null); string CCTs = DB.runRead("SELECT ccts FROM rooms WHERE id = '" + roomIDs[i] + "'"); Rooms.Append(Encoding.encodeVL64(roomIDs[i]) + "I" + roomData[0] + Convert.ToChar(2) + Encoding.encodeVL64(int.Parse(roomData[4])) + Encoding.encodeVL64(int.Parse(roomData[5])) + Encoding.encodeVL64(categoryID) + roomData[6] + Convert.ToChar(2) + Encoding.encodeVL64(roomIDs[i]) + "H" + CCTs + Convert.ToChar(2) + "HI"); } else // Guestroom { if (roomData[3] == "0" && _Username != roomData[1] && seeHiddenRoomOwners == false) // Room owner doesn't wish to show his name, and this user isn't the room owner and this user doesn't has the right to see hidden room owners, change room owner to '-' roomData[1] = "-"; Rooms.Append(Encoding.encodeVL64(roomIDs[i]) + roomData[0] + Convert.ToChar(2) + roomData[1] + Convert.ToChar(2) + roomManager.getRoomState(int.Parse(roomData[2])) + Convert.ToChar(2) + Encoding.encodeVL64(int.Parse(roomData[4])) + Encoding.encodeVL64(int.Parse(roomData[5])) + roomData[6] + Convert.ToChar(2)); guestRoomAmount++; } } } sendData("@}" + "H" + "H" + "J" + Convert.ToChar(2) + "HHH" + Encoding.encodeVL64(guestRoomAmount - deletedAmount) + Rooms.ToString()); } break; } case "@S": // Navigator - add room to favourite rooms list { int roomID = Encoding.decodeVL64(currentPacket.Substring(3)); if (DB.checkExists("SELECT id FROM rooms WHERE id = '" + roomID + "'") == true && DB.checkExists("SELECT userid FROM users_favourites WHERE userid = '" + userID + "' AND roomid = '" + roomID + "'") == false) // The virtual room does exist, and the virtual user hasn't got it in the list already { if (DB.runReadUnsafe("SELECT COUNT(userid) FROM users_favourites WHERE userid = '" + userID + "'", null) < Config.Navigator_Favourites_maxRooms) DB.runQuery("INSERT INTO users_favourites(userid,roomid) VALUES ('" + userID + "','" + roomID + "')"); else sendData("@a" + "nav_error_toomanyfavrooms"); } break; } case "@T": // Navigator - remove room from favourite rooms list { int roomID = Encoding.decodeVL64(currentPacket.Substring(3)); DB.runQuery("DELETE FROM users_favourites WHERE userid = '" + userID + "' AND roomid = '" + roomID + "' LIMIT 1"); break; } #endregion #region Room event actions case "EA": // Events - get setup sendData("Ep" + Encoding.encodeVL64(eventManager.categoryAmount)); break; case "EY": // Events - show/hide 'Host event' button if (_inPublicroom || roomUser == null || _hostsEvent) // In publicroom, not in room at all or already hosting event sendData("Eo" + "H"); // Hide else sendData("Eo" + "I"); // Show break; case "D{": // Events - check if event category is OK { int categoryID = Encoding.decodeVL64(currentPacket.Substring(2)); if (eventManager.categoryOK(categoryID)) sendData("Eb" + Encoding.encodeVL64(categoryID)); break; } case "E^": // Events - open category { int categoryID = Encoding.decodeVL64(currentPacket.Substring(2)); if (categoryID >= 1 && categoryID <= 11) sendData("Eq" + Encoding.encodeVL64(categoryID) + eventManager.getEvents(categoryID)); break; } case "EZ": // Events - create event { if (_isOwner && _hostsEvent == false && _inPublicroom == false && roomUser != null) { int categoryID = Encoding.decodeVL64(currentPacket.Substring(2)); if (eventManager.categoryOK(categoryID)) { int categoryLength = Encoding.encodeVL64(categoryID).Length; int nameLength = Encoding.decodeB64(currentPacket.Substring(categoryLength + 2, 2)); string Name = currentPacket.Substring(categoryLength + 4, nameLength); string Description = currentPacket.Substring(categoryLength + nameLength + 6); _hostsEvent = true; eventManager.createEvent(categoryID, userID, _roomID, Name, Description); Room.sendData("Er" + eventManager.getEvent(_roomID)); } } break; } case @"E\": // Events - edit event { if (_hostsEvent && _isOwner && _inPublicroom == false && roomUser != null) { int categoryID = Encoding.decodeVL64(currentPacket.Substring(2)); if (eventManager.categoryOK(categoryID)) { int categoryLength = Encoding.encodeVL64(categoryID).Length; int nameLength = Encoding.decodeB64(currentPacket.Substring(categoryLength + 2, 2)); string Name = currentPacket.Substring(categoryLength + 4, nameLength); string Description = currentPacket.Substring(categoryLength + nameLength + 6); eventManager.editEvent(categoryID, _roomID, Name, Description); Room.sendData("Er" + eventManager.getEvent(_roomID)); } } break; } case "E[": // Events - end event { if (_hostsEvent && _isOwner && _inPublicroom == false && roomUser != null) { _hostsEvent = false; eventManager.removeEvent(_roomID); Room.sendData("Er" + "-1"); } break; } #endregion #region Guestroom create and modify case "@]": // Create guestroom - phase 1 { string[] roomSettings = currentPacket.Split('/'); if (DB.runRead("SELECT COUNT(id) FROM rooms WHERE owner = '" + _Username + "'", null) < Config.Navigator_createRoom_maxRooms) { roomSettings[2] = stringManager.filterSwearwords(roomSettings[2]); roomSettings[3] = roomSettings[3].Substring(6, 1); roomSettings[4] = roomManager.getRoomState(roomSettings[4]).ToString(); if (roomSettings[5] != "0" && roomSettings[5] != "1") return; DB.runQuery("INSERT INTO rooms (name,owner,model,state,showname) VALUES ('" + DB.Stripslash(roomSettings[2]) + "','" + _Username + "','" + roomSettings[3] + "','" + roomSettings[4] + "','" + roomSettings[5] + "')"); string roomID = DB.runRead("SELECT MAX(id) FROM rooms WHERE owner = '" + _Username + "'"); sendData("@{" + roomID + Convert.ToChar(13) + roomSettings[2]); } else sendData("@a" + "Error creating a private room"); break; } case "@Y": // Create guestroom - phase 2 / modify guestroom { int roomID = 0; if (currentPacket.Substring(2, 1) == "/") roomID = int.Parse(currentPacket.Split('/')[1]); else roomID = int.Parse(currentPacket.Substring(2).Split('/')[0]); int superUsers = 0; int maxVisitors = 25; string[] packetContent = currentPacket.Split(Convert.ToChar(13)); string roomDescription = ""; string roomPassword = ""; for (int i = 1; i < packetContent.Length; i++) // More proper way, thanks Jeax { string updHeader = packetContent[i].Split('=')[0]; string updValue = packetContent[i].Substring(updHeader.Length + 1); switch (updHeader) { case "description": roomDescription = stringManager.filterSwearwords(updValue); roomDescription = DB.Stripslash(roomDescription); break; case "allsuperuser": superUsers = int.Parse(updValue); if (superUsers != 0 && superUsers != 1) superUsers = 0; break; case "maxvisitors": maxVisitors = int.Parse(updValue); if (maxVisitors < 10 || maxVisitors > 25) maxVisitors = 25; break; case "password": roomPassword = DB.Stripslash(updValue); break; default: return; } } DB.runQuery("UPDATE rooms SET description = '" + roomDescription + "',superusers = '" + superUsers + "',visitors_max = '" + maxVisitors + "',password = '******' WHERE id = '" + roomID + "' AND owner = '" + _Username + "' LIMIT 1"); break; } case "@X": // Modify guestroom, save name, state and show/hide ownername { string[] packetContent = currentPacket.Substring(2).Split('/'); int roomID = int.Parse(packetContent[0]); string roomName = DB.Stripslash(stringManager.filterSwearwords(packetContent[1])); string showName = packetContent[2]; if (showName != "1" && showName != "0") showName = "1"; int roomState = roomManager.getRoomState(packetContent[2]); DB.runQuery("UPDATE rooms SET name = '" + roomName + "',state = '" + roomState + "',showname = '" + showName + "' WHERE id = '" + roomID + "' AND owner = '" + _Username + "' LIMIT 1"); break; } case "BX": // Navigator - trigger guestroom modify { int roomID = Encoding.decodeVL64(currentPacket.Substring(2)); string roomCategory = DB.runRead("SELECT category FROM rooms WHERE id = '" + roomID + "' AND owner = '" + _Username + "'"); if (roomCategory != "") sendData("C^" + Encoding.encodeVL64(roomID) + Encoding.encodeVL64(int.Parse(roomCategory))); break; } case "BY": // Navigator - edit category of a guestroom { int roomID = Encoding.decodeVL64(currentPacket.Substring(2)); int cataID = Encoding.decodeVL64(currentPacket.Substring(Encoding.encodeVL64(roomID).Length + 2)); if (DB.checkExists("SELECT id FROM room_categories WHERE id = '" + cataID + "' AND type = '2' AND parent > 0 AND access_rank_min <= " + _Rank)) // Category is valid for this user DB.runQuery("UPDATE rooms SET category = '" + cataID + "' WHERE id = '" + roomID + "' AND owner = '" + _Username + "' LIMIT 1"); break; } case "BZ": // Navigator - 'Who's in here' feature for public rooms { int roomID = Encoding.decodeVL64(currentPacket.Substring(2)); if (roomManager.containsRoom(roomID)) sendData("C_" + roomManager.getRoom(roomID).Userlist); else sendData("C_"); break; } #endregion #region Enter/leave room case "@u": // Rooms - eave room { if (Room != null && roomUser != null) Room.removeUser(roomUser.roomUID, false, ""); break; } case "Bv": // Enter room - loading screen advertisement { Config.Rooms_LoadAvertisement_img = ""; if (Config.Rooms_LoadAvertisement_img == "") sendData("DB0"); else sendData("DB" + Config.Rooms_LoadAvertisement_img + Convert.ToChar(9) + Config.Rooms_LoadAvertisement_uri); } break; case "@B": // Enter room - determine room and check state + max visitors override { int roomID = Encoding.decodeVL64(currentPacket.Substring(3)); bool isPublicroom = (currentPacket.Substring(2, 1) == "A"); sendData("@S"); sendData("Bf" + "http://wwww.holographemulator.com/bf.php?p=emu"); if (Room != null && roomUser != null) Room.removeUser(roomUser.roomUID, false, ""); if (_teleporterID == 0) { bool allowEnterLockedRooms = rankManager.containsRight(_Rank, "fuse_enter_locked_rooms"); int accessLevel = DB.runRead("SELECT state FROM rooms WHERE id = '" + roomID + "'", null); if (accessLevel == 3 && _clubMember == false && allowEnterLockedRooms == false) // Room is only for club subscribers and the user isn't club and hasn't got the fuseright for entering all rooms nomatter the state { sendData("C`" + "Kc"); return; } else if (accessLevel == 4 && allowEnterLockedRooms == false) // The room is only for staff and the user hasn't got the fuseright for entering all rooms nomatter the state { sendData("BK" + stringManager.getString("room_stafflocked")); return; } int nowVisitors = DB.runRead("SELECT SUM(visitors_now) FROM rooms WHERE id = '" + roomID + "'", null); if (nowVisitors > 0) { int maxVisitors = DB.runRead("SELECT SUM(visitors_max) FROM rooms WHERE id = '" + roomID + "'", null); if (nowVisitors >= maxVisitors && rankManager.containsRight(_Rank, "fuse_enter_full_rooms") == false) { if (isPublicroom == false) sendData("C`" + "I"); else sendData("BK" + stringManager.getString("room_full")); return; } } } _roomID = roomID; _inPublicroom = isPublicroom; _ROOMACCESS_PRIMARY_OK = true; if (isPublicroom) { string roomModel = DB.runRead("SELECT model FROM rooms WHERE id = '" + roomID + "'"); sendData("AE" + roomModel + " " + roomID); _ROOMACCESS_SECONDARY_OK = true; } break; } case "@v": // Enter room - guestroom - enter room by using a teleporter { sendData("@S"); break; } case "@y": // Enter room - guestroom - check roomban/password/doorbell { if (_inPublicroom == false) { if (_teleporterID == 0) { int accessFlag = DB.runRead("SELECT state FROM rooms WHERE id = '" + _roomID + "'", null); if (_ROOMACCESS_PRIMARY_OK == false && accessFlag != 2) return; // Check for roombans if (DB.checkExists("SELECT roomid FROM room_bans WHERE roomid = '" + _roomID + "' AND userid = '" + userID + "'")) { DateTime banExpireMoment = DateTime.Parse(DB.runRead("SELECT ban_expire FROM room_bans WHERE roomid = '" + _roomID + "' AND userid = '" + userID + "'")); if (DateTime.Compare(banExpireMoment, DateTime.Now) > 0) { sendData("C`" + "PA"); sendData("@R"); return; } else DB.runQuery("DELETE FROM room_bans WHERE roomid = '" + _roomID + "' AND userid = '" + userID + "' LIMIT 1"); } if (rankManager.containsRight(_Rank, "fuse_enter_locked_rooms") == false) { if (accessFlag == 1) // Doorbell { if (roomManager.containsRoom(_roomID) == false) { sendData("BC"); return; } } else if (accessFlag == 2) // Password { string givenPassword = ""; try { givenPassword = currentPacket.Split('/')[1]; } catch { } string roomPassword = DB.runRead("SELECT password FROM rooms WHERE id = '" + _roomID + "'"); if (givenPassword != roomPassword) { sendData("@a" + "Incorrect flat password"); return; } } } } _ROOMACCESS_SECONDARY_OK = true; sendData("@i"); } break; } case "@{": // Enter room - guestroom - guestroom only data: model, wallpaper, rights, room votes { if (_ROOMACCESS_SECONDARY_OK && _inPublicroom == false) { string Model = "model_" + DB.runRead("SELECT model FROM rooms WHERE id = '" + _roomID + "'"); sendData("AE" + Model + " " + _roomID); int Wallpaper = DB.runRead("SELECT wallpaper FROM rooms WHERE id = '" + _roomID + "'", null); int Floor = DB.runRead("SELECT floor FROM rooms WHERE id = '" + _roomID + "'", null); if (Wallpaper > 0) sendData("@n" + "wallpaper/" + Wallpaper); if (Floor > 0) sendData("@n" + "floor/" + Floor); _isOwner = rankManager.containsRight(_Rank, "fuse_any_room_controller"); if (_isOwner == false) { _isOwner = DB.checkExists("SELECT id FROM rooms WHERE id = '" + _roomID + "' AND owner = '" + _Username + "'"); if (_isOwner == false) _hasRights = DB.checkExists("SELECT userid FROM room_rights WHERE roomid = '" + _roomID + "' AND userid = '" + userID + "'"); if (_hasRights == false) _hasRights = DB.checkExists("SELECT id FROM rooms WHERE id = '" + _roomID + "' AND superusers = '1'"); } if (_isOwner) { _hasRights = true; sendData("@o"); } if (_hasRights) sendData("@j"); int voteAmount = -1; if (DB.checkExists("SELECT userid FROM room_votes WHERE userid = '" + userID + "' AND roomid = '" + _roomID + "'")) { voteAmount = DB.runRead("SELECT SUM(vote) FROM room_votes WHERE roomid = '" + _roomID + "'", null); if (voteAmount < 0) { voteAmount = 0; } } sendData("EY" + Encoding.encodeVL64(voteAmount)); sendData("Er" + eventManager.getEvent(_roomID)); } break; } case "A~": // Enter room - get room advertisement { if (_inPublicroom && DB.checkExists("SELECT roomid FROM room_ads WHERE roomid = '" + _roomID + "'")) { string advImg = DB.runRead("SELECT img FROM room_ads WHERE roomid = '" + _roomID + "'"); string advUri = DB.runRead("SELECT uri FROM room_ads WHERE roomid = '" + _roomID + "'"); sendData("CP" + advImg + Convert.ToChar(9) + advUri); } else sendData("CP" + "0"); break; } case "@|": // Enter room - get roomclass + get heightmap { if (_ROOMACCESS_SECONDARY_OK) { if (roomManager.containsRoom(_roomID)) Room = roomManager.getRoom(_roomID); else { Room = new virtualRoom(_roomID, _inPublicroom); roomManager.addRoom(_roomID, Room); } sendData("@_" + Room.Heightmap); sendData(@"@\" + Room.dynamicUnits); } break; } case "@}": // Enter room - get items { if (_ROOMACCESS_SECONDARY_OK && Room != null) { sendData("@^" + Room.PublicroomItems); sendData("@`" + Room.Flooritems); } break; } case "@~": // Enter room - get group badges and user status updates { if (_ROOMACCESS_SECONDARY_OK && Room != null) { sendData("DiH"); sendData("Du" + Room.Groups); if (_receivedSpriteIndex == false) { sendData("Dg" + @"[_Dshelves_norjaX~Dshelves_polyfonYmAshelves_siloXQHtable_polyfon_smallYmAchair_polyfonZbBtable_norja_medY_Itable_silo_medX~Dtable_plasto_4legY_Itable_plasto_roundY_Itable_plasto_bigsquareY_Istand_polyfon_zZbBchair_siloX~Dsofa_siloX~Dcouch_norjaX~Dchair_norjaX~Dtable_polyfon_medYmAdoormat_loveZbBdoormat_plainZ[Msofachair_polyfonX~Dsofa_polyfonZ[Msofachair_siloX~Dchair_plastyX~Dchair_plastoYmAtable_plasto_squareY_Ibed_polyfonX~Dbed_polyfon_one[dObed_trad_oneYmAbed_tradYmAbed_silo_oneYmAbed_silo_twoYmAtable_silo_smallX~Dbed_armas_twoYmAbed_budget_oneXQHbed_budgetXQHshelves_armasYmAbench_armasYmAtable_armasYmAsmall_table_armasZbBsmall_chair_armasYmAfireplace_armasYmAlamp_armasYmAbed_armas_oneYmAcarpet_standardY_Icarpet_armasYmAcarpet_polarY_Ifireplace_polyfonY_Itable_plasto_4leg*1Y_Itable_plasto_bigsquare*1Y_Itable_plasto_round*1Y_Itable_plasto_square*1Y_Ichair_plasto*1YmAcarpet_standard*1Y_Idoormat_plain*1Z[Mtable_plasto_4leg*2Y_Itable_plasto_bigsquare*2Y_Itable_plasto_round*2Y_Itable_plasto_square*2Y_Ichair_plasto*2YmAdoormat_plain*2Z[Mcarpet_standard*2Y_Itable_plasto_4leg*3Y_Itable_plasto_bigsquare*3Y_Itable_plasto_round*3Y_Itable_plasto_square*3Y_Ichair_plasto*3YmAcarpet_standard*3Y_Idoormat_plain*3Z[Mtable_plasto_4leg*4Y_Itable_plasto_bigsquare*4Y_Itable_plasto_round*4Y_Itable_plasto_square*4Y_Ichair_plasto*4YmAcarpet_standard*4Y_Idoormat_plain*4Z[Mdoormat_plain*6Z[Mdoormat_plain*5Z[Mcarpet_standard*5Y_Itable_plasto_4leg*5Y_Itable_plasto_bigsquare*5Y_Itable_plasto_round*5Y_Itable_plasto_square*5Y_Ichair_plasto*5YmAtable_plasto_4leg*6Y_Itable_plasto_bigsquare*6Y_Itable_plasto_round*6Y_Itable_plasto_square*6Y_Ichair_plasto*6YmAtable_plasto_4leg*7Y_Itable_plasto_bigsquare*7Y_Itable_plasto_round*7Y_Itable_plasto_square*7Y_Ichair_plasto*7YmAtable_plasto_4leg*8Y_Itable_plasto_bigsquare*8Y_Itable_plasto_round*8Y_Itable_plasto_square*8Y_Ichair_plasto*8YmAtable_plasto_4leg*9Y_Itable_plasto_bigsquare*9Y_Itable_plasto_round*9Y_Itable_plasto_square*9Y_Ichair_plasto*9YmAcarpet_standard*6Y_Ichair_plasty*1X~DpizzaYmAdrinksYmAchair_plasty*2X~Dchair_plasty*3X~Dchair_plasty*4X~Dbar_polyfonY_Iplant_cruddyYmAbottleYmAbardesk_polyfonX~Dbardeskcorner_polyfonX~DfloortileHbar_armasY_Ibartable_armasYmAbar_chair_armasYmAcarpet_softZ@Kcarpet_soft*1Z@Kcarpet_soft*2Z@Kcarpet_soft*3Z@Kcarpet_soft*4Z@Kcarpet_soft*5Z@Kcarpet_soft*6Z@Kred_tvY_Iwood_tvYmAcarpet_polar*1Y_Ichair_plasty*5X~Dcarpet_polar*2Y_Icarpet_polar*3Y_Icarpet_polar*4Y_Ichair_plasty*6X~Dtable_polyfonYmAsmooth_table_polyfonYmAsofachair_polyfon_girlX~Dbed_polyfon_girl_one[dObed_polyfon_girlX~Dsofa_polyfon_girlZ[Mbed_budgetb_oneXQHbed_budgetbXQHplant_pineappleYmAplant_fruittreeY_Iplant_small_cactusY_Iplant_bonsaiY_Iplant_big_cactusY_Iplant_yukkaY_Icarpet_standard*7Y_Icarpet_standard*8Y_Icarpet_standard*9Y_Icarpet_standard*aY_Icarpet_standard*bY_Iplant_sunflowerY_Iplant_roseY_Itv_luxusY_IbathZ\BsinkY_ItoiletYmAduckYmAtileYmAtoilet_redYmAtoilet_yellYmAtile_redYmAtile_yellYmApresent_gen[~Npresent_gen1[~Npresent_gen2[~Npresent_gen3[~Npresent_gen4[~Npresent_gen5[~Npresent_gen6[~Nbar_basicY_Ishelves_basicXQHsoft_sofachair_norjaX~Dsoft_sofa_norjaX~Dlamp_basicXQHlamp2_armasYmAfridgeY_Idoor[dOdoorB[dOdoorC[dOpumpkinYmAskullcandleYmAdeadduckYmAdeadduck2YmAdeadduck3YmAmenorahYmApuddingYmAhamYmAturkeyYmAxmasduckY_IhouseYmAtriplecandleYmAtree3YmAtree4YmAtree5X~Dham2YmAwcandlesetYmArcandlesetYmAstatueYmAheartY_IvaleduckYmAheartsofaX~DthroneYmAsamovarY_IgiftflowersY_IhabbocakeYmAhologramYmAeasterduckY_IbunnyYmAbasketY_IbirdieYmAediceX~Dclub_sofaZ[Mprize1YmAprize2YmAprize3YmAdivider_poly3X~Ddivider_arm1YmAdivider_arm2YmAdivider_arm3YmAdivider_nor1X~Ddivider_silo1X~Ddivider_nor2X~Ddivider_silo2Z[Mdivider_nor3X~Ddivider_silo3X~DtypingmachineYmAspyroYmAredhologramYmAcameraHjoulutahtiYmAhyacinth1YmAhyacinth2YmAchair_plasto*10YmAchair_plasto*11YmAbardeskcorner_polyfon*12X~Dbardeskcorner_polyfon*13X~Dchair_plasto*12YmAchair_plasto*13YmAchair_plasto*14YmAtable_plasto_4leg*14Y_ImocchamasterY_Icarpet_legocourtYmAbench_legoYmAlegotrophyYmAvalentinescreenYmAedicehcYmArare_daffodil_rugYmArare_beehive_bulbY_IhcsohvaYmAhcammeYmArare_elephant_statueYmArare_fountainY_Irare_standYmArare_globeYmArare_hammockYmArare_elephant_statue*1YmArare_elephant_statue*2YmArare_fountain*1Y_Irare_fountain*2Y_Irare_fountain*3Y_Irare_beehive_bulb*1Y_Irare_beehive_bulb*2Y_Irare_xmas_screenY_Irare_parasol*1Y_Irare_parasol*2Y_Irare_parasol*3Y_Itree1X~Dtree2ZmBwcandleYxBrcandleYxBsoft_jaggara_norjaYmAhouse2YmAdjesko_turntableYmAmd_sofaZ[Mmd_limukaappiY_Itable_plasto_4leg*10Y_Itable_plasto_4leg*15Y_Itable_plasto_bigsquare*14Y_Itable_plasto_bigsquare*15Y_Itable_plasto_round*14Y_Itable_plasto_round*15Y_Itable_plasto_square*14Y_Itable_plasto_square*15Y_Ichair_plasto*15YmAchair_plasty*7X~Dchair_plasty*8X~Dchair_plasty*9X~Dchair_plasty*10X~Dchair_plasty*11X~Dchair_plasto*16YmAtable_plasto_4leg*16Y_Ihockey_scoreY_Ihockey_lightYmAdoorD[dOprizetrophy2*3[rIprizetrophy3*3XrIprizetrophy4*3[rIprizetrophy5*3[rIprizetrophy6*3[rIprizetrophy*1Y_Iprizetrophy2*1[rIprizetrophy3*1XrIprizetrophy4*1[rIprizetrophy5*1[rIprizetrophy6*1[rIprizetrophy*2Y_Iprizetrophy2*2[rIprizetrophy3*2XrIprizetrophy4*2[rIprizetrophy5*2[rIprizetrophy6*2[rIprizetrophy*3Y_Irare_parasol*0Hhc_lmp[fBhc_tblYmAhc_chrYmAhc_dskXQHnestHpetfood1ZvCpetfood2ZvCpetfood3ZvCwaterbowl*4XICwaterbowl*5XICwaterbowl*2XICwaterbowl*1XICwaterbowl*3XICtoy1XICtoy1*1XICtoy1*2XICtoy1*3XICtoy1*4XICgoodie1ZvCgoodie1*1ZvCgoodie1*2ZvCgoodie2X~Dprizetrophy7*3[rIprizetrophy7*1[rIprizetrophy7*2[rIscifiport*0Y_Iscifiport*9Y_Iscifiport*8Y_Iscifiport*7Y_Iscifiport*6Y_Iscifiport*5Y_Iscifiport*4Y_Iscifiport*3Y_Iscifiport*2Y_Iscifiport*1Y_Iscifirocket*9Y_Iscifirocket*8Y_Iscifirocket*7Y_Iscifirocket*6Y_Iscifirocket*5Y_Iscifirocket*4Y_Iscifirocket*3Y_Iscifirocket*2Y_Iscifirocket*1Y_Iscifirocket*0Y_Iscifidoor*10Y_Iscifidoor*9Y_Iscifidoor*8Y_Iscifidoor*7Y_Iscifidoor*6Y_Iscifidoor*5Y_Iscifidoor*4Y_Iscifidoor*3Y_Iscifidoor*2Y_Iscifidoor*1Y_Ipillow*5YmApillow*8YmApillow*0YmApillow*1YmApillow*2YmApillow*7YmApillow*9YmApillow*4YmApillow*6YmApillow*3YmAmarquee*1Y_Imarquee*2Y_Imarquee*7Y_Imarquee*aY_Imarquee*8Y_Imarquee*9Y_Imarquee*5Y_Imarquee*4Y_Imarquee*6Y_Imarquee*3Y_Iwooden_screen*1Y_Iwooden_screen*2Y_Iwooden_screen*7Y_Iwooden_screen*0Y_Iwooden_screen*8Y_Iwooden_screen*5Y_Iwooden_screen*9Y_Iwooden_screen*4Y_Iwooden_screen*6Y_Iwooden_screen*3Y_Ipillar*6Y_Ipillar*1Y_Ipillar*9Y_Ipillar*0Y_Ipillar*8Y_Ipillar*2Y_Ipillar*5Y_Ipillar*4Y_Ipillar*7Y_Ipillar*3Y_Irare_dragonlamp*4Y_Irare_dragonlamp*0Y_Irare_dragonlamp*5Y_Irare_dragonlamp*2Y_Irare_dragonlamp*8Y_Irare_dragonlamp*9Y_Irare_dragonlamp*7Y_Irare_dragonlamp*6Y_Irare_dragonlamp*1Y_Irare_dragonlamp*3Y_Irare_icecream*1Y_Irare_icecream*7Y_Irare_icecream*8Y_Irare_icecream*2Y_Irare_icecream*6Y_Irare_icecream*9Y_Irare_icecream*3Y_Irare_icecream*0Y_Irare_icecream*4Y_Irare_icecream*5Y_Irare_fan*7YxBrare_fan*6YxBrare_fan*9YxBrare_fan*3YxBrare_fan*0YxBrare_fan*4YxBrare_fan*5YxBrare_fan*1YxBrare_fan*8YxBrare_fan*2YxBqueue_tile1*3X~Dqueue_tile1*6X~Dqueue_tile1*4X~Dqueue_tile1*9X~Dqueue_tile1*8X~Dqueue_tile1*5X~Dqueue_tile1*7X~Dqueue_tile1*2X~Dqueue_tile1*1X~Dqueue_tile1*0X~DticketHrare_snowrugX~Dcn_lampZxIcn_sofaYmAsporttrack1*1YmAsporttrack1*3YmAsporttrack1*2YmAsporttrack2*1[~Nsporttrack2*2[~Nsporttrack2*3[~Nsporttrack3*1YmAsporttrack3*2YmAsporttrack3*3YmAfootylampX~Dbarchair_siloX~Ddivider_nor4*4X~Dtraffic_light*1ZxItraffic_light*2ZxItraffic_light*3ZxItraffic_light*4ZxItraffic_light*6ZxIrubberchair*1X~Drubberchair*2X~Drubberchair*3X~Drubberchair*4X~Drubberchair*5X~Drubberchair*6X~Dbarrier*1X~Dbarrier*2X~Dbarrier*3X~Drubberchair*7X~Drubberchair*8X~Dtable_norja_med*2Y_Itable_norja_med*3Y_Itable_norja_med*4Y_Itable_norja_med*5Y_Itable_norja_med*6Y_Itable_norja_med*7Y_Itable_norja_med*8Y_Itable_norja_med*9Y_Icouch_norja*2X~Dcouch_norja*3X~Dcouch_norja*4X~Dcouch_norja*5X~Dcouch_norja*6X~Dcouch_norja*7X~Dcouch_norja*8X~Dcouch_norja*9X~Dshelves_norja*2X~Dshelves_norja*3X~Dshelves_norja*4X~Dshelves_norja*5X~Dshelves_norja*6X~Dshelves_norja*7X~Dshelves_norja*8X~Dshelves_norja*9X~Dchair_norja*2X~Dchair_norja*3X~Dchair_norja*4X~Dchair_norja*5X~Dchair_norja*6X~Dchair_norja*7X~Dchair_norja*8X~Dchair_norja*9X~Ddivider_nor1*2X~Ddivider_nor1*3X~Ddivider_nor1*4X~Ddivider_nor1*5X~Ddivider_nor1*6X~Ddivider_nor1*7X~Ddivider_nor1*8X~Ddivider_nor1*9X~Dsoft_sofa_norja*2X~Dsoft_sofa_norja*3X~Dsoft_sofa_norja*4X~Dsoft_sofa_norja*5X~Dsoft_sofa_norja*6X~Dsoft_sofa_norja*7X~Dsoft_sofa_norja*8X~Dsoft_sofa_norja*9X~Dsoft_sofachair_norja*2X~Dsoft_sofachair_norja*3X~Dsoft_sofachair_norja*4X~Dsoft_sofachair_norja*5X~Dsoft_sofachair_norja*6X~Dsoft_sofachair_norja*7X~Dsoft_sofachair_norja*8X~Dsoft_sofachair_norja*9X~Dsofachair_silo*2X~Dsofachair_silo*3X~Dsofachair_silo*4X~Dsofachair_silo*5X~Dsofachair_silo*6X~Dsofachair_silo*7X~Dsofachair_silo*8X~Dsofachair_silo*9X~Dtable_silo_small*2X~Dtable_silo_small*3X~Dtable_silo_small*4X~Dtable_silo_small*5X~Dtable_silo_small*6X~Dtable_silo_small*7X~Dtable_silo_small*8X~Dtable_silo_small*9X~Ddivider_silo1*2X~Ddivider_silo1*3X~Ddivider_silo1*4X~Ddivider_silo1*5X~Ddivider_silo1*6X~Ddivider_silo1*7X~Ddivider_silo1*8X~Ddivider_silo1*9X~Ddivider_silo3*2X~Ddivider_silo3*3X~Ddivider_silo3*4X~Ddivider_silo3*5X~Ddivider_silo3*6X~Ddivider_silo3*7X~Ddivider_silo3*8X~Ddivider_silo3*9X~Dtable_silo_med*2X~Dtable_silo_med*3X~Dtable_silo_med*4X~Dtable_silo_med*5X~Dtable_silo_med*6X~Dtable_silo_med*7X~Dtable_silo_med*8X~Dtable_silo_med*9X~Dsofa_silo*2X~Dsofa_silo*3X~Dsofa_silo*4X~Dsofa_silo*5X~Dsofa_silo*6X~Dsofa_silo*7X~Dsofa_silo*8X~Dsofa_silo*9X~Dsofachair_polyfon*2X~Dsofachair_polyfon*3X~Dsofachair_polyfon*4X~Dsofachair_polyfon*6X~Dsofachair_polyfon*7X~Dsofachair_polyfon*8X~Dsofachair_polyfon*9X~Dsofa_polyfon*2Z[Msofa_polyfon*3Z[Msofa_polyfon*4Z[Msofa_polyfon*6Z[Msofa_polyfon*7Z[Msofa_polyfon*8Z[Msofa_polyfon*9Z[Mbed_polyfon*2X~Dbed_polyfon*3X~Dbed_polyfon*4X~Dbed_polyfon*6X~Dbed_polyfon*7X~Dbed_polyfon*8X~Dbed_polyfon*9X~Dbed_polyfon_one*2[dObed_polyfon_one*3[dObed_polyfon_one*4[dObed_polyfon_one*6[dObed_polyfon_one*7[dObed_polyfon_one*8[dObed_polyfon_one*9[dObardesk_polyfon*2X~Dbardesk_polyfon*3X~Dbardesk_polyfon*4X~Dbardesk_polyfon*5X~Dbardesk_polyfon*6X~Dbardesk_polyfon*7X~Dbardesk_polyfon*8X~Dbardesk_polyfon*9X~Dbardeskcorner_polyfon*2X~Dbardeskcorner_polyfon*3X~Dbardeskcorner_polyfon*4X~Dbardeskcorner_polyfon*5X~Dbardeskcorner_polyfon*6X~Dbardeskcorner_polyfon*7X~Dbardeskcorner_polyfon*8X~Dbardeskcorner_polyfon*9X~Ddivider_poly3*2X~Ddivider_poly3*3X~Ddivider_poly3*4X~Ddivider_poly3*5X~Ddivider_poly3*6X~Ddivider_poly3*7X~Ddivider_poly3*8X~Ddivider_poly3*9X~Dchair_silo*2X~Dchair_silo*3X~Dchair_silo*4X~Dchair_silo*5X~Dchair_silo*6X~Dchair_silo*7X~Dchair_silo*8X~Dchair_silo*9X~Ddivider_nor3*2X~Ddivider_nor3*3X~Ddivider_nor3*4X~Ddivider_nor3*5X~Ddivider_nor3*6X~Ddivider_nor3*7X~Ddivider_nor3*8X~Ddivider_nor3*9X~Ddivider_nor2*2X~Ddivider_nor2*3X~Ddivider_nor2*4X~Ddivider_nor2*5X~Ddivider_nor2*6X~Ddivider_nor2*7X~Ddivider_nor2*8X~Ddivider_nor2*9X~Dsilo_studydeskX~Dsolarium_norjaY_Isolarium_norja*1Y_Isolarium_norja*2Y_Isolarium_norja*3Y_Isolarium_norja*5Y_Isolarium_norja*6Y_Isolarium_norja*7Y_Isolarium_norja*8Y_Isolarium_norja*9Y_IsandrugX~Drare_moonrugYmAchair_chinaYmAchina_tableYmAsleepingbag*1YmAsleepingbag*2YmAsleepingbag*3YmAsleepingbag*4YmAsafe_siloY_Isleepingbag*7YmAsleepingbag*9YmAsleepingbag*5YmAsleepingbag*10YmAsleepingbag*6YmAsleepingbag*8YmAchina_shelveX~Dtraffic_light*5ZxIdivider_nor4*2X~Ddivider_nor4*3X~Ddivider_nor4*5X~Ddivider_nor4*6X~Ddivider_nor4*7X~Ddivider_nor4*8X~Ddivider_nor4*9X~Ddivider_nor5*2X~Ddivider_nor5*3X~Ddivider_nor5*4X~Ddivider_nor5*5X~Ddivider_nor5*6X~Ddivider_nor5*7X~Ddivider_nor5*8X~Ddivider_nor5*9X~Ddivider_nor5X~Ddivider_nor4X~Dwall_chinaYmAcorner_chinaYmAbarchair_silo*2X~Dbarchair_silo*3X~Dbarchair_silo*4X~Dbarchair_silo*5X~Dbarchair_silo*6X~Dbarchair_silo*7X~Dbarchair_silo*8X~Dbarchair_silo*9X~Dsafe_silo*2Y_Isafe_silo*3Y_Isafe_silo*4Y_Isafe_silo*5Y_Isafe_silo*6Y_Isafe_silo*7Y_Isafe_silo*8Y_Isafe_silo*9Y_Iglass_shelfY_Iglass_chairY_Iglass_stoolY_Iglass_sofaY_Iglass_tableY_Iglass_table*2Y_Iglass_table*3Y_Iglass_table*4Y_Iglass_table*5Y_Iglass_table*6Y_Iglass_table*7Y_Iglass_table*8Y_Iglass_table*9Y_Iglass_chair*2Y_Iglass_chair*3Y_Iglass_chair*4Y_Iglass_chair*5Y_Iglass_chair*6Y_Iglass_chair*7Y_Iglass_chair*8Y_Iglass_chair*9Y_Iglass_sofa*2Y_Iglass_sofa*3Y_Iglass_sofa*4Y_Iglass_sofa*5Y_Iglass_sofa*6Y_Iglass_sofa*7Y_Iglass_sofa*8Y_Iglass_sofa*9Y_Iglass_stool*2Y_Iglass_stool*4Y_Iglass_stool*5Y_Iglass_stool*6Y_Iglass_stool*7Y_Iglass_stool*8Y_Iglass_stool*3Y_Iglass_stool*9Y_ICFC_100_coin_goldZvCCFC_10_coin_bronzeZvCCFC_200_moneybagZvCCFC_500_goldbarZvCCFC_50_coin_silverZvCCF_10_coin_goldZvCCF_1_coin_bronzeZvCCF_20_moneybagZvCCF_50_goldbarZvCCF_5_coin_silverZvChc_crptYmAhc_tvZ\BgothgateX~DgothiccandelabraYxBgothrailingX~Dgoth_tableYmAhc_bkshlfYmAhc_btlrY_Ihc_crtnYmAhc_djsetYmAhc_frplcZbBhc_lmpstYmAhc_machineYmAhc_rllrXQHhc_rntgnX~Dhc_trllYmAgothic_chair*1X~Dgothic_sofa*1X~Dgothic_stool*1X~Dgothic_chair*2X~Dgothic_sofa*2X~Dgothic_stool*2X~Dgothic_chair*3X~Dgothic_sofa*3X~Dgothic_stool*3X~Dgothic_chair*4X~Dgothic_sofa*4X~Dgothic_stool*4X~Dgothic_chair*5X~Dgothic_sofa*5X~Dgothic_stool*5X~Dgothic_chair*6X~Dgothic_sofa*6X~Dgothic_stool*6X~Dval_cauldronX~Dsound_machineX~Dromantique_pianochair*3Y_Iromantique_pianochair*5Y_Iromantique_pianochair*2Y_Iromantique_pianochair*4Y_Iromantique_pianochair*1Y_Iromantique_divan*3Y_Iromantique_divan*5Y_Iromantique_divan*2Y_Iromantique_divan*4Y_Iromantique_divan*1Y_Iromantique_chair*3Y_Iromantique_chair*5Y_Iromantique_chair*2Y_Iromantique_chair*4Y_Iromantique_chair*1Y_Irare_parasolY_Iplant_valentinerose*3XICplant_valentinerose*5XICplant_valentinerose*2XICplant_valentinerose*4XICplant_valentinerose*1XICplant_mazegateYeCplant_mazeZcCplant_bulrushXICpetfood4Y_Icarpet_valentineZ|Egothic_carpetXICgothic_carpet2Z|Egothic_chairX~Dgothic_sofaX~Dgothic_stoolX~Dgrand_piano*3Z|Egrand_piano*5Z|Egrand_piano*2Z|Egrand_piano*4Z|Egrand_piano*1Z|Etheatre_seatZ@Kromantique_tray2Y_Iromantique_tray1Y_Iromantique_smalltabl*3Y_Iromantique_smalltabl*5Y_Iromantique_smalltabl*2Y_Iromantique_smalltabl*4Y_Iromantique_smalltabl*1Y_Iromantique_mirrortablY_Iromantique_divider*3Z[Mromantique_divider*2Z[Mromantique_divider*4Z[Mromantique_divider*1Z[Mjp_tatami2YGGjp_tatamiYGGhabbowood_chairYGGjp_bambooYGGjp_iroriXQHjp_pillowYGGsound_set_1Y_Isound_set_2Y_Isound_set_3Y_Isound_set_4Y_Isound_set_5Z@Ksound_set_6Y_Isound_set_7Y_Isound_set_8Y_Isound_set_9Y_Isound_machine*1ZIPspotlightY_Isound_machine*2ZIPsound_machine*3ZIPsound_machine*4ZIPsound_machine*5ZIPsound_machine*6ZIPsound_machine*7ZIProm_lampZ|Erclr_sofaXQHrclr_gardenXQHrclr_chairZ|Esound_set_28Y_Isound_set_27Y_Isound_set_26Y_Isound_set_25Y_Isound_set_24Y_Isound_set_23Y_Isound_set_22Y_Isound_set_21Y_Isound_set_20Z@Ksound_set_19Z@Ksound_set_18Y_Isound_set_17Y_Isound_set_16Y_Isound_set_15Y_Isound_set_14Y_Isound_set_13Y_Isound_set_12Y_Isound_set_11Y_Isound_set_10Y_Irope_dividerXQHromantique_clockY_Irare_icecream_campaignY_Ipura_mdl5*1XQHpura_mdl5*2XQHpura_mdl5*3XQHpura_mdl5*4XQHpura_mdl5*5XQHpura_mdl5*6XQHpura_mdl5*7XQHpura_mdl5*8XQHpura_mdl5*9XQHpura_mdl4*1XQHpura_mdl4*2XQHpura_mdl4*3XQHpura_mdl4*4XQHpura_mdl4*5XQHpura_mdl4*6XQHpura_mdl4*7XQHpura_mdl4*8XQHpura_mdl4*9XQHpura_mdl3*1XQHpura_mdl3*2XQHpura_mdl3*3XQHpura_mdl3*4XQHpura_mdl3*5XQHpura_mdl3*6XQHpura_mdl3*7XQHpura_mdl3*8XQHpura_mdl3*9XQHpura_mdl2*1XQHpura_mdl2*2XQHpura_mdl2*3XQHpura_mdl2*4XQHpura_mdl2*5XQHpura_mdl2*6XQHpura_mdl2*7XQHpura_mdl2*8XQHpura_mdl2*9XQHpura_mdl1*1XQHpura_mdl1*2XQHpura_mdl1*3XQHpura_mdl1*4XQHpura_mdl1*5XQHpura_mdl1*6XQHpura_mdl1*7XQHpura_mdl1*8XQHpura_mdl1*9XQHjp_lanternXQHchair_basic*1XQHchair_basic*2XQHchair_basic*3XQHchair_basic*4XQHchair_basic*5XQHchair_basic*6XQHchair_basic*7XQHchair_basic*8XQHchair_basic*9XQHbed_budget*1XQHbed_budget*2XQHbed_budget*3XQHbed_budget*4XQHbed_budget*5XQHbed_budget*6XQHbed_budget*7XQHbed_budget*8XQHbed_budget*9XQHbed_budget_one*1XQHbed_budget_one*2XQHbed_budget_one*3XQHbed_budget_one*4XQHbed_budget_one*5XQHbed_budget_one*6XQHbed_budget_one*7XQHbed_budget_one*8XQHbed_budget_one*9XQHjp_drawerXQHtile_stellaZ[Mtile_marbleZ[Mtile_brownZ[Msummer_grill*1Y_Isummer_grill*2Y_Isummer_grill*3Y_Isummer_grill*4Y_Isummer_chair*1Y_Isummer_chair*2Y_Isummer_chair*3Y_Isummer_chair*4Y_Isummer_chair*5Y_Isummer_chair*6Y_Isummer_chair*7Y_Isummer_chair*8Y_Isummer_chair*9Y_Isound_set_36ZfIsound_set_35ZfIsound_set_34ZfIsound_set_33ZfIsound_set_32Y_Isound_set_31Y_Isound_set_30Y_Isound_set_29Y_Isound_machine_pro[~Nrare_mnstrY_Ione_way_door*1XQHone_way_door*2XQHone_way_door*3XQHone_way_door*4XQHone_way_door*5XQHone_way_door*6XQHone_way_door*7XQHone_way_door*8XQHone_way_door*9XQHexe_rugZ[Mexe_s_tableZGRsound_set_37ZfIsummer_pool*1ZlIsummer_pool*2ZlIsummer_pool*3ZlIsummer_pool*4ZlIsong_diskY_Ijukebox*1[~Ncarpet_soft_tut[~Nsound_set_44Z@Ksound_set_43Z@Ksound_set_42Z@Ksound_set_41Z@Ksound_set_40Z@Ksound_set_39Z@Ksound_set_38Z@Kgrunge_chairZ@Kgrunge_mattressZ@Kgrunge_radiatorZ@Kgrunge_shelfZ@Kgrunge_signZ@Kgrunge_tableZ@Khabboween_crypt[uKhabboween_grassZ@Khal_cauldronZ@Khal_graveZ@Ksound_set_52ZuKsound_set_51ZuKsound_set_50ZuKsound_set_49ZuKsound_set_48ZuKsound_set_47ZuKsound_set_46ZuKsound_set_45ZuKxmas_icelampZ[Mxmas_cstl_wallZ[Mxmas_cstl_twrZ[Mxmas_cstl_gate[~Ntree7Z[Mtree6Z[Msound_set_54Z[Msound_set_53Z[Msafe_silo_pb[dOplant_mazegate_snowZ[Mplant_maze_snowZ[Mchristmas_sleighZ[Mchristmas_reindeer[~Nchristmas_poopZ[Mexe_bardeskZ[Mexe_chairZ[Mexe_chair2Z[Mexe_cornerZ[Mexe_drinksZ[Mexe_sofaZ[Mexe_tableZ[Msound_set_59[~Nsound_set_58[~Nsound_set_57[~Nsound_set_56[~Nsound_set_55[~Nnoob_table*1[~Nnoob_table*2[~Nnoob_table*3[~Nnoob_table*4[~Nnoob_table*5[~Nnoob_table*6[~Nnoob_stool*1[~Nnoob_stool*2[~Nnoob_stool*3[~Nnoob_stool*4[~Nnoob_stool*5[~Nnoob_stool*6[~Nnoob_rug*1[~Nnoob_rug*2[~Nnoob_rug*3[~Nnoob_rug*4[~Nnoob_rug*5[~Nnoob_rug*6[~Nnoob_lamp*1[dOnoob_lamp*2[dOnoob_lamp*3[dOnoob_lamp*4[dOnoob_lamp*5[dOnoob_lamp*6[dOnoob_chair*1[~Nnoob_chair*2[~Nnoob_chair*3[~Nnoob_chair*4[~Nnoob_chair*5[~Nnoob_chair*6[~Nexe_globe[~Nexe_plantZ[Mval_teddy*1[dOval_teddy*2[dOval_teddy*3[dOval_teddy*4[dOval_teddy*5[dOval_teddy*6[dOval_randomizer[dOval_choco[dOteleport_door[dOsound_set_61[dOsound_set_60[dOfortune[dOsw_tableZIPsw_raven[cQsw_chestZIPsand_cstl_wallZIPsand_cstl_twrZIPsand_cstl_gateZIPgrunge_candleZIPgrunge_benchZIPgrunge_barrelZIPrclr_lampZGRprizetrophy9*1ZGRprizetrophy8*1ZGRnouvelle_traxYcPmd_rugZGRjp_tray6ZGRjp_tray5ZGRjp_tray4ZGRjp_tray3ZGRjp_tray2ZGRjp_tray1ZGRarabian_teamkZGRarabian_snakeZGRarabian_rugZGRarabian_pllwZGRarabian_divdrZGRarabian_chairZGRarabian_bigtbZGRarabian_tetblZGRarabian_tray1ZGRarabian_tray2ZGRarabian_tray3ZGRarabian_tray4ZGRPIpost.itHpost.it.vdHphotoHChessHTicTacToeHBattleShipHPokerHwallpaperHfloorHposterZ@KgothicfountainYxBhc_wall_lampZbBindustrialfanZ`BtorchZ\Bval_heartXBCwallmirrorZ|Ejp_ninjastarsXQHhabw_mirrorXQHhabbowheelZ[Mguitar_skullZ@Kguitar_vZ@Kxmas_light[~Nhrella_poster_3[Nhrella_poster_2ZIPhrella_poster_1[Nsw_swordsZIPsw_stoneZIPsw_holeZIProomdimmerZGRmd_logo_wallZGRmd_canZGRjp_sheet3ZGRjp_sheet2ZGRjp_sheet1ZGRarabian_swordsZGRarabian_wndwZGR"); _receivedSpriteIndex = true; } } break; } case "@": // Enter room - guestroom - get wallitems { if (_ROOMACCESS_SECONDARY_OK && Room != null) sendData("@m" + Room.Wallitems); break; } case "A@": // Enter room - add this user to room { if (_ROOMACCESS_SECONDARY_OK && Room != null && roomUser == null) { sendData("@b" + Room.dynamicStatuses); Room.addUser(this); } break; } #endregion #region MOD-Tool case "CH": // MOD-Tool { int messageLength = 0; string Message = ""; int staffNoteLength = 0; string staffNote = ""; string targetUser = ""; switch (currentPacket.Substring(2, 2)) // Select the action { #region Alert single user case "HH": // Alert single user { if (rankManager.containsRight(_Rank, "fuse_alert") == false) { sendData("BK" + stringManager.getString("modtool_accesserror")); return; } messageLength = Encoding.decodeB64(currentPacket.Substring(4, 2)); Message = currentPacket.Substring(6, messageLength); staffNoteLength = Encoding.decodeB64(currentPacket.Substring(messageLength + 6, 2)); staffNote = currentPacket.Substring(messageLength + 8, staffNoteLength); targetUser = currentPacket.Substring(messageLength + staffNoteLength + 10); if (Message == "" || targetUser == "") return; virtualUser _targetUser = userManager.getUser(targetUser); if (_targetUser == null) sendData("BK" + stringManager.getString("modtool_actionfail") + "\r" + stringManager.getString("modtool_usernotfound")); else { _targetUser.sendData("B!" + Message + Convert.ToChar(2)); staffManager.addStaffMessage("alert", userID, _targetUser.userID, Message, staffNote); } break; } #endregion #region Kick single user from room case "HI": // Kick single user from room { if (rankManager.containsRight(_Rank, "fuse_kick") == false) { sendData("BK" + stringManager.getString("modtool_accesserror")); return; } messageLength = Encoding.decodeB64(currentPacket.Substring(4, 2)); Message = currentPacket.Substring(6, messageLength); staffNoteLength = Encoding.decodeB64(currentPacket.Substring(messageLength + 6, 2)); staffNote = currentPacket.Substring(messageLength + 8, staffNoteLength); targetUser = currentPacket.Substring(messageLength + staffNoteLength + 10); if (Message == "" || targetUser == "") return; virtualUser _targetUser = userManager.getUser(targetUser); if (_targetUser == null) sendData("BK" + stringManager.getString("modtool_actionfail") + "\r" + stringManager.getString("modtool_usernotfound")); else { if (_targetUser.Room != null && _targetUser.roomUser != null) { if (_targetUser._Rank < _Rank) { _targetUser.Room.removeUser(_targetUser.roomUser.roomUID, true, Message); staffManager.addStaffMessage("kick", userID, _targetUser.userID, Message, staffNote); } else sendData("BK" + stringManager.getString("modtool_actionfail") + "\r" + stringManager.getString("modtool_rankerror")); } } break; } #endregion #region Ban single user case "HJ": // Ban single user / IP { if (rankManager.containsRight(_Rank, "fuse_ban") == false) { sendData("BK" + stringManager.getString("modtool_accesserror")); return; } int targetUserLength = 0; int banHours = 0; bool banIP = (currentPacket.Substring(currentPacket.Length - 1, 1) == "I"); messageLength = Encoding.decodeB64(currentPacket.Substring(4, 2)); Message = currentPacket.Substring(6, messageLength); staffNoteLength = Encoding.decodeB64(currentPacket.Substring(messageLength + 6, 2)); staffNote = currentPacket.Substring(messageLength + 8, staffNoteLength); targetUserLength = Encoding.decodeB64(currentPacket.Substring(messageLength + staffNoteLength + 8, 2)); targetUser = currentPacket.Substring(messageLength + staffNoteLength + 10, targetUserLength); banHours = Encoding.decodeVL64(currentPacket.Substring(messageLength + staffNoteLength + targetUserLength + 10)); if (Message == "" || targetUser == "" || banHours == 0) return; else { string[] userDetails = DB.runReadRow("SELECT id,rank,ipaddress_last FROM users WHERE name = '" + DB.Stripslash(targetUser) + "'"); if (userDetails.Length == 0) { sendData("BK" + stringManager.getString("modtool_actionfail") + "\r" + stringManager.getString("modtool_usernotfound")); return; } else if (byte.Parse(userDetails[1]) >= _Rank) { sendData("BK" + stringManager.getString("modtool_actionfail") + "\r" + stringManager.getString("modtool_rankerror")); return; } int targetID = int.Parse(userDetails[0]); string Report = ""; staffManager.addStaffMessage("ban", userID, targetID, Message, staffNote); if (banIP && rankManager.containsRight(_Rank, "fuse_superban")) // IP ban is chosen and allowed for this staff member { userManager.setBan(userDetails[2], banHours, Message); Report = userManager.generateBanReport(userDetails[2]); } else { userManager.setBan(targetID, banHours, Message); Report = userManager.generateBanReport(targetID); } sendData("BK" + Report); } break; } #endregion #region Room alert case "IH": // Alert all users in current room { if (rankManager.containsRight(_Rank, "fuse_room_alert") == false) { sendData("BK" + stringManager.getString("modtool_accesserror")); return; } if (Room == null || roomUser == null) { return; } messageLength = Encoding.decodeB64(currentPacket.Substring(4, 2)); Message = currentPacket.Substring(6, messageLength); staffNoteLength = Encoding.decodeB64(currentPacket.Substring(messageLength + 6, 2)); staffNote = currentPacket.Substring(messageLength + 8, staffNoteLength); if (Message != "") { Room.sendData("B!" + Message + Convert.ToChar(2)); staffManager.addStaffMessage("ralert", userID, _roomID, Message, staffNote); } break; } #endregion #region Room kick case "II": // Kick all users below users rank from room { if (rankManager.containsRight(_Rank, "fuse_room_kick") == false) { sendData("BK" + stringManager.getString("modtool_accesserror")); return; } if (Room == null || roomUser == null) { return; } messageLength = Encoding.decodeB64(currentPacket.Substring(4, 2)); Message = currentPacket.Substring(6, messageLength); staffNoteLength = Encoding.decodeB64(currentPacket.Substring(messageLength + 6, 2)); staffNote = currentPacket.Substring(messageLength + 8, staffNoteLength); if (Message != "") { Room.kickUsers(_Rank, Message); staffManager.addStaffMessage("rkick", userID, _roomID, Message, staffNote); } break; } #endregion } break; } #endregion #region In-room actions case "AO": // Room - rotate user { if (Room != null && roomUser != null && statusManager.containsStatus("sit") == false && statusManager.containsStatus("lay") == false) { int X = int.Parse(currentPacket.Substring(2).Split(' ')[0]); int Y = int.Parse(currentPacket.Split(' ')[1]); roomUser.Z1 = Rooms.Pathfinding.Rotation.Calculate(roomUser.X, roomUser.Y, X, Y); roomUser.Z2 = roomUser.Z1; roomUser.Refresh(); } break; } case "AK": // Room - walk to a new square { if (Room != null && roomUser != null && roomUser.walkLock == false) { int goalX = Encoding.decodeB64(currentPacket.Substring(2, 2)); int goalY = Encoding.decodeB64(currentPacket.Substring(4, 2)); if (roomUser.SPECIAL_TELEPORTABLE) { roomUser.X = goalX; roomUser.Y = goalY; roomUser.goalX = -1; Room.Refresh(roomUser); refreshAppearance(false, false, true); } else { roomUser.goalX = goalX; roomUser.goalY = goalY; } } break; } case "As": // Room - click door to exit room { if (Room != null && roomUser != null && roomUser.walkDoor == false) { roomUser.walkDoor = true; roomUser.goalX = Room.doorX; roomUser.goalY = Room.doorY; } break; } case "At": // Room - select swimming outfit { if (Room != null || roomUser != null && Room.hasSwimmingPool) { virtualRoom.squareTrigger Trigger = Room.getTrigger(roomUser.X, roomUser.Y); if (Trigger.Object == "curtains1" || Trigger.Object == "curtains2") { string Outfit = DB.Stripslash(currentPacket.Substring(2)); roomUser.SwimOutfit = Outfit; Room.sendData(@"@\" + roomUser.detailsString); Room.sendSpecialCast(Trigger.Object, "open"); roomUser.walkLock = false; roomUser.goalX = Trigger.goalX; roomUser.goalY = Trigger.goalY; DB.runQuery("UPDATE users SET figure_swim = '" + Outfit + "' WHERE id = '" + userID + "' LIMIT 1"); } } break; } case "B^": // Badges - switch or toggle on/off badge { if (Room != null && roomUser != null) { int badgeLength = Encoding.decodeB64(currentPacket.Substring(2, 2)); int badgeEnabled = Encoding.decodeVL64(currentPacket.Substring(badgeLength + 4, 1)); if (badgeEnabled != 0 && badgeEnabled != 1) return; string newBadge = DB.Stripslash(currentPacket.Substring(4, badgeLength)); if (DB.checkExists("SELECT userid FROM users_badges WHERE userid = '" + userID + "' AND badgeid = '" + newBadge + "'") == false) return; DB.runQuery("UPDATE users SET badge_status = '" + badgeEnabled + "' WHERE id = '" + userID + "' LIMIT 1"); DB.runQuery("UPDATE users_badges SET iscurrent = '0' WHERE userid = '" + userID + "' AND badgeid = '" + _nowBadge + "' LIMIT 1"); DB.runQuery("UPDATE users_badges SET iscurrent = '1' WHERE userid = '" + userID + "' AND badgeid = '" + newBadge + "' LIMIT 1"); string newStatus = "Cd" + Encoding.encodeVL64(roomUser.roomUID); if (badgeEnabled == 1) { _nowBadge = newBadge; newStatus += newBadge + Convert.ToChar(2); } else _nowBadge = ""; Room.sendData(newStatus); } break; } case "DG": // Tags - get tags { int ownerID = Encoding.decodeVL64(currentPacket.Substring(2)); string Owner = DB.runRead("SELECT name FROM users WHERE id = '" + ownerID + "'"); string[] Tags = DB.runReadColumn("SELECT tag FROM cms_tags WHERE owner = '" + Owner + "'", 20); StringBuilder List = new StringBuilder(Encoding.encodeVL64(ownerID) + Encoding.encodeVL64(Tags.Length)); for (int i = 0; i < Tags.Length; i++) List.Append(Tags[i] + Convert.ToChar(2)); sendData("E^" + List.ToString()); break; } case "Cg": // Group badges - get details about a group [click badge] { if (Room != null && roomUser != null) { int groupID = Encoding.decodeVL64(currentPacket.Substring(2)); if (DB.checkExists("SELECT id FROM groups_details WHERE id = '" + groupID + "'")) { string Name = DB.runRead("SELECT name FROM groups_details WHERE id = '" + groupID + "'"); string Description = DB.runRead("SELECT description FROM groups_details WHERE id = '" + groupID + "'"); int roomID = DB.runRead("SELECT roomid FROM groups_details WHERE id = '" + groupID + "'", null); string roomName = ""; if (roomID > 0) roomName = DB.runRead("SELECT name FROM rooms WHERE id = '" + roomID + "'"); else roomID = -1; sendData("Dw" + Encoding.encodeVL64(groupID) + Name + Convert.ToChar(2) + Description + Convert.ToChar(2) + Encoding.encodeVL64(roomID) + roomName + Convert.ToChar(2)); } } break; } case "AX": // Statuses - stop status { if (statusManager != null) { string Status = currentPacket.Substring(2); if (Status == "CarryItem") statusManager.dropCarrydItem(); else if (Status == "Dance") { statusManager.removeStatus("dance"); statusManager.Refresh(); } } break; } case "A^": // Statuses - wave { if (Room != null && roomUser != null && statusManager.containsStatus("wave") == false) { statusManager.removeStatus("dance"); statusManager.handleStatus("wave", "", Config.Statuses_Wave_waveDuration); } break; } case "A]": // Statuses - dance { if (Room != null && roomUser != null && statusManager.containsStatus("sit") == false && statusManager.containsStatus("lay") == false) { statusManager.dropCarrydItem(); if (currentPacket.Length == 2) statusManager.addStatus("dance", ""); else { if (rankManager.containsRight(_Rank, "fuse_use_club_dance") == false) { return; } int danceID = Encoding.decodeVL64(currentPacket.Substring(2)); if (danceID < 0 || danceID > 4) { return; } statusManager.addStatus("dance", danceID.ToString()); } statusManager.Refresh(); } break; } case "AP": // Statuses - carry item { if (Room != null && roomUser != null) { string Item = currentPacket.Substring(2); if (statusManager.containsStatus("lay") || Item.Contains("/")) return; // THE HAX! \o/ try { int nItem = int.Parse(Item); if (nItem < 1 || nItem > 26) return; } catch { if (_inPublicroom == false && Item != "Water" && Item != "Milk" && Item != "Juice") // Not a drink that can be retrieved from the infobus minibar return; } statusManager.carryItem(Item); } break; } #region Chat case "@t": // Chat - say case "@w": // Chat - shout { if (_isMuted == false && Room != null && roomUser != null) { string Message = currentPacket.Substring(4); userManager.addChatMessage(_Username, _roomID, Message); Message = stringManager.filterSwearwords(Message); if (currentPacket.Substring(1, 1) == "w") // Shout Room.sendShout(roomUser, Message); else Room.sendSaying(roomUser, Message); } break; } case "@x": // Chat - whisper { // * muted if (_isMuted == false && Room != null && roomUser != null) { string Receiver = currentPacket.Substring(4).Split(' ')[0]; string Message = currentPacket.Substring(Receiver.Length + 5); if (Receiver == "" && Message.Substring(0, 1) == ":" && isSpeechCommand(Message.Substring(1))) // Speechcommand invoked! { if (roomUser.isTyping) { Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "H"); roomUser.isTyping = false; } } else { userManager.addChatMessage(_Username, _roomID, Message); Message = stringManager.filterSwearwords(Message); Room.sendWhisper(roomUser, Receiver, Message); } } break; } case "D}": // Chat - show speech bubble { if (_isMuted == false && Room != null && roomUser != null) { Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "I"); roomUser.isTyping = true; } break; } case "D~": // Chat - hide speech bubble { if (Room != null && roomUser != null) { Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "H"); roomUser.isTyping = false; } break; } #endregion #region Guestroom - rights, kicking, roombans and room voting case "A`": // Give rights { if (Room == null || roomUser == null || _inPublicroom || _isOwner == false) return; string Target = currentPacket.Substring(2); if (userManager.containsUser(Target) == false) return; virtualUser _Target = userManager.getUser(Target); if (_Target._roomID != _roomID || _Target._hasRights || _Target._isOwner) return; DB.runQuery("INSERT INTO room_rights(roomid,userid) VALUES ('" + _roomID + "','" + _Target.userID + "')"); _Target._hasRights = true; _Target.statusManager.addStatus("flatctrl", "onlyfurniture"); _Target.roomUser.Refresh(); _Target.sendData("@j"); break; } case "Aa": // Take rights { if (Room == null || roomUser == null || _inPublicroom || _isOwner == false) return; string Target = currentPacket.Substring(2); if (userManager.containsUser(Target) == false) return; virtualUser _Target = userManager.getUser(Target); if (_Target._roomID != _roomID || _Target._hasRights == false || _Target._isOwner) return; DB.runQuery("DELETE FROM room_rights WHERE roomid = '" + _roomID + "' AND userid = '" + _Target.userID + "' LIMIT 1"); _Target._hasRights = false; _Target.statusManager.removeStatus("flatctrl"); _Target.roomUser.Refresh(); _Target.sendData("@k"); break; } case "A_": // Kick user { if (Room == null || roomUser == null || _inPublicroom || _hasRights == false) return; string Target = currentPacket.Substring(2); if (userManager.containsUser(Target) == false) return; virtualUser _Target = userManager.getUser(Target); if (_Target._roomID != _roomID) return; if (_Target._isOwner && (_Target._Rank > _Rank || rankManager.containsRight(_Target._Rank, "fuse_any_room_controller"))) return; _Target.roomUser.walkLock = true; _Target.roomUser.walkDoor = true; _Target.roomUser.goalX = Room.doorX; _Target.roomUser.goalY = Room.doorY; break; } case "E@": // Kick and apply roomban { if (_hasRights == false || _inPublicroom || Room == null || roomUser == null) return; string Target = currentPacket.Substring(2); if (userManager.containsUser(Target) == false) return; virtualUser _Target = userManager.getUser(Target); if (_Target._roomID != _roomID) return; if (_Target._isOwner && (_Target._Rank > _Rank || rankManager.containsRight(_Target._Rank, "fuse_any_room_controller"))) return; string banExpireMoment = DateTime.Now.AddMinutes(Config.Rooms_roomBan_banDuration).ToString(); DB.runQuery("INSERT INTO room_bans (roomid,userid,ban_expire) VALUES ('" + _roomID + "','" + _Target.userID + "','" + banExpireMoment + "')"); _Target.roomUser.walkLock = true; _Target.roomUser.walkDoor = true; _Target.roomUser.goalX = Room.doorX; _Target.roomUser.goalY = Room.doorY; break; } case "Ab": // Answer guestroom doorbell { break; } case "DE": // Vote -1 or +1 on room { if (_inPublicroom || Room == null || roomUser == null) return; int Vote = Encoding.decodeVL64(currentPacket.Substring(2)); if ((Vote == 1 || Vote == -1) && DB.checkExists("SELECT userid FROM room_votes WHERE userid = '" + userID + "' AND roomid = '" + _roomID + "'") == false) { DB.runQuery("INSERT INTO room_votes (userid,roomid,vote) VALUES ('" + userID + "','" + _roomID + "','" + Vote + "')"); int voteAmount = DB.runRead("SELECT SUM(vote) FROM room_votes WHERE roomid = '" + _roomID + "'", null); if (voteAmount < 0) voteAmount = 0; roomUser.hasVoted = true; Room.sendNewVoteAmount(voteAmount); } break; } #endregion #region Catalogue and Recycler case "Ae": // Catalogue - open, retrieve index of pages { if (Room != null && roomUser != null) sendData("A~" + catalogueManager.getPageIndex(_Rank)); break; } case "Af": // Catalogue, open page, get page content { if (Room != null && roomUser != null) { string pageIndexName = currentPacket.Split('/')[1]; sendData("A" + catalogueManager.getPage(pageIndexName, _Rank)); } break; } case "Ad": // Catalogue - purchase { string[] packetContent = currentPacket.Split(Convert.ToChar(13)); string Page = packetContent[1]; string Item = packetContent[3]; int pageID = DB.runRead("SELECT indexid FROM catalogue_pages WHERE indexname = '" + DB.Stripslash(Page) + "' AND minrank <= " + _Rank, null); int templateID = DB.runRead("SELECT tid FROM catalogue_items WHERE name_cct = '" + DB.Stripslash(Item) + "'", null); int Cost = DB.runRead("SELECT catalogue_cost FROM catalogue_items WHERE catalogue_id_page = '" + pageID + "' AND tid = '" + templateID + "'", null); if (Cost == 0 || Cost > _Credits) { sendData("AD"); return; } int receiverID = userID; int presentBoxID = 0; int roomID = 0; // -1 = present box, 0 = inhand if (packetContent[5] == "1") // Purchased as present { string receiverName = packetContent[6]; if (receiverName != _Username) { int i = DB.runRead("SELECT id FROM users WHERE name = '" + DB.Stripslash(receiverName) + "'", null); if (i > 0) receiverID = i; else { sendData("AL" + receiverName); return; } } string boxSprite = "present_gen" + new Random().Next(1, 7); string boxTemplateID = DB.runRead("SELECT tid FROM catalogue_items WHERE name_cct = '" + boxSprite + "'"); string boxNote = DB.Stripslash(stringManager.filterSwearwords(packetContent[7])); DB.runQuery("INSERT INTO furniture(tid,ownerid,var) VALUES ('" + boxTemplateID + "','" + receiverID + "','!" + boxNote + "')"); presentBoxID = catalogueManager.lastItemID; roomID = -1; } _Credits -= Cost; sendData("@F" + _Credits); DB.runQuery("UPDATE users SET credits = '" + _Credits + "' WHERE id = '" + userID + "' LIMIT 1"); if (stringManager.getStringPart(Item, 0, 4) == "deal") { int dealID = int.Parse(Item.Substring(4)); int[] itemIDs = DB.runReadColumn("SELECT tid FROM catalogue_deals WHERE id = '" + dealID + "'", 0, null); int[] itemAmounts = DB.runReadColumn("SELECT amount FROM catalogue_deals WHERE id = '" + dealID + "'", 0, null); for (int i = 0; i < itemIDs.Length; i++) for (int j = 1; j <= itemAmounts[i]; j++) { DB.runQuery("INSERT INTO furniture(tid,ownerid,roomid) VALUES ('" + itemIDs[i] + "','" + receiverID + "','" + roomID + "')"); catalogueManager.handlePurchase(itemIDs[i], receiverID, roomID, 0, presentBoxID); } } else { DB.runQuery("INSERT INTO furniture(tid,ownerid,roomid) VALUES ('" + templateID + "','" + receiverID + "','" + roomID + "')"); if (catalogueManager.getTemplate(templateID).Sprite == "wallpaper" || catalogueManager.getTemplate(templateID).Sprite == "floor") { int decorID = int.Parse(packetContent[4]); catalogueManager.handlePurchase(templateID, receiverID, 0, decorID, presentBoxID); } else if (stringManager.getStringPart(Item, 0, 11) == "prizetrophy") { string Inscription = DB.Stripslash(stringManager.filterSwearwords(packetContent[4])); //string itemVariable = _Username + Convert.ToChar(9) + DateTime.Today.ToShortDateString() + Convert.ToChar(9) + Inscription; string itemVariable = _Username + "\t" + DateTime.Today.ToShortDateString() + "\t" + packetContent[4]; DB.runQuery("UPDATE furniture SET var = '" + itemVariable + "' WHERE id = '" + catalogueManager.lastItemID + "' LIMIT 1"); //"H" + GIVERNAME + [09] + GIVEDATE + [09] + MSG } else catalogueManager.handlePurchase(templateID, receiverID, roomID, 0, presentBoxID); } if (receiverID == userID) refreshHand("last"); else if (userManager.containsUser(receiverID)) { userManager.getUser(receiverID).refreshHand("last"); } if (presentBoxID > 0) Out.WriteLine(_Username + " is a pedobear."); break; } case "Ca": // Recycler - proceed input items { if (Config.enableRecycler == false || Room == null || recyclerManager.sessionExists(userID)) return; int itemCount = Encoding.decodeVL64(currentPacket.Substring(2)); if (recyclerManager.rewardExists(itemCount)) { recyclerManager.createSession(userID, itemCount); currentPacket = currentPacket.Substring(Encoding.encodeVL64(itemCount).ToString().Length + 2); for (int i = 0; i < itemCount; i++) { int itemID = Encoding.decodeVL64(currentPacket); if (DB.checkExists("SELECT id FROM furniture WHERE ownerid = '" + userID + "' AND roomid = '0'")) { DB.runQuery("UPDATE furniture SET roomid = '-2' WHERE id = '" + itemID + "' LIMIT 1"); currentPacket = currentPacket.Substring(Encoding.encodeVL64(itemID).ToString().Length); } else { recyclerManager.dropSession(userID, true); sendData("DpH"); return; } } sendData("Dp" + recyclerManager.sessionString(userID)); refreshHand("update"); } break; } case "Cb": // Recycler - redeem/cancel session { if (Config.enableRecycler == false || Room != null && recyclerManager.sessionExists(userID)) { bool Redeem = (currentPacket.Substring(2) == "I"); if (Redeem && recyclerManager.sessionReady(userID)) recyclerManager.rewardSession(userID); recyclerManager.dropSession(userID, Redeem); sendData("Dp" + recyclerManager.sessionString(userID)); if (Redeem) refreshHand("last"); else refreshHand("new"); } break; } #endregion #region Hand and item handling case "AA": // Hand { if (_inPublicroom || Room == null || roomUser == null) return; string Mode = currentPacket.Substring(2); refreshHand(Mode); break; } case "AB": // Item handling - apply wallpaper/floor to room { if (_hasRights == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Split('/')[1]); string decorType = currentPacket.Substring(2).Split('/')[0]; if (decorType != "wallpaper" && decorType != "floor") return; int templateID = DB.runRead("SELECT tid FROM furniture WHERE id = '" + itemID + "' AND ownerid = '" + userID + "' AND roomid = '0'", null); if (catalogueManager.getTemplate(templateID).Sprite != decorType) return; int decorVal = DB.runRead("SELECT var FROM furniture WHERE id = '" + itemID + "'", null); Room.sendData("@n" + decorType + "/" + decorVal); DB.runQuery("UPDATE rooms SET " + decorType + " = '" + decorVal + "' WHERE id = '" + _roomID + "' LIMIT 1"); DB.runQuery("DELETE FROM furniture WHERE id = '" + itemID + "' LIMIT 1"); break; } case "AZ": // Item handling - place item down { if (_hasRights == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Split(' ')[0].Substring(2)); int templateID = DB.runRead("SELECT tid FROM furniture WHERE id = '" + itemID + "' AND ownerid = '" + userID + "' AND roomid = '0'", null); if (templateID == 0) return; if (catalogueManager.getTemplate(templateID).typeID == 0) { string _INPUTPOS = currentPacket.Substring(itemID.ToString().Length + 3); string _CHECKEDPOS = catalogueManager.wallPositionOK(_INPUTPOS); if (_CHECKEDPOS != _INPUTPOS) return; string Var = DB.runRead("SELECT var FROM furniture WHERE id = '" + itemID + "'"); if (stringManager.getStringPart(catalogueManager.getTemplate(templateID).Sprite, 0, 7) == "post.it") { if (int.Parse(Var) > 1) DB.runQuery("UPDATE furniture SET var = var - 1 WHERE id = '" + itemID + "' LIMIT 1"); else DB.runQuery("DELETE FROM furniture WHERE id = '" + itemID + "' LIMIT 1"); DB.runQuery("INSERT INTO furniture(tid,ownerid) VALUES ('" + templateID + "','" + userID + "')"); itemID = catalogueManager.lastItemID; DB.runQuery("INSERT INTO furniture_stickies(id) VALUES ('" + itemID + "')"); Var = "FFFF33"; DB.runQuery("UPDATE furniture SET var = '" + Var + "' WHERE id = '" + itemID + "' LIMIT 1"); } Room.wallItemManager.addItem(itemID, templateID, _CHECKEDPOS, Var, true); } else { string[] locDetails = currentPacket.Split(' '); int X = int.Parse(locDetails[1]); int Y = int.Parse(locDetails[2]); byte Z = byte.Parse(locDetails[3]); byte typeID = catalogueManager.getTemplate(templateID).typeID; Room.floorItemManager.placeItem(itemID, templateID, X, Y, typeID, Z); } break; } case "AC": // Item handling - pickup item { if (_isOwner == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Split(' ')[2]); if (Room.floorItemManager.containsItem(itemID)) Room.floorItemManager.removeItem(itemID, userID); else if (Room.wallItemManager.containsItem(itemID) && stringManager.getStringPart(Room.wallItemManager.getItem(itemID).Sprite, 0, 7) != "post.it") // Can't pickup stickies from room Room.wallItemManager.removeItem(itemID, userID); else return; refreshHand("update"); break; } case "AI": // Item handling - move/rotate item { if (_hasRights == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Split(' ')[0].Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { string[] locDetails = currentPacket.Split(' '); int X = int.Parse(locDetails[1]); int Y = int.Parse(locDetails[2]); byte Z = byte.Parse(locDetails[3]); Room.floorItemManager.relocateItem(itemID, X, Y, Z); } break; } case "CV": // Item handling - toggle wallitem status { if (_inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Substring(4, Encoding.decodeB64(currentPacket.Substring(2, 2)))); int toStatus = Encoding.decodeVL64(currentPacket.Substring(itemID.ToString().Length + 4)); Room.wallItemManager.toggleItemStatus(itemID, toStatus); break; } case "AJ": // Item handling - toggle flooritem status { try { int itemID = int.Parse(currentPacket.Substring(4, Encoding.decodeB64(currentPacket.Substring(2, 2)))); string toStatus = DB.Stripslash(currentPacket.Substring(itemID.ToString().Length + 6)); Room.floorItemManager.toggleItemStatus(itemID, toStatus, _hasRights); } catch { } break; } case "AN": // Item handling - open presentbox { if (_isOwner == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID) == false) return; int[] itemIDs = DB.runReadColumn("SELECT itemid FROM furniture_presents WHERE id = '" + itemID + "'", 0, null); if (itemIDs.Length > 0) { for (int i = 0; i < itemIDs.Length; i++) DB.runQuery("UPDATE furniture SET roomid = '0' WHERE id = '" + itemIDs[i] + "' LIMIT 1"); Room.floorItemManager.removeItem(itemID, 0); int lastItemTID = DB.runRead("SELECT tid FROM furniture WHERE id = '" + itemIDs[itemIDs.Length - 1] + "'", null); catalogueManager.itemTemplate Template = catalogueManager.getTemplate(lastItemTID); if (Template.typeID > 0) sendData("BA" + Template.Sprite + Convert.ToChar(13) + Template.Sprite + Convert.ToChar(13) + Template.Length + Convert.ToChar(30) + Template.Width + Convert.ToChar(30) + Template.Colour); else sendData("BA" + Template.Sprite + Convert.ToChar(13) + Template.Sprite + " " + Template.Colour + Convert.ToChar(13)); } DB.runQuery("DELETE FROM furniture_presents WHERE id = '" + itemID + "' LIMIT " + itemIDs.Length); DB.runQuery("DELETE FROM furniture WHERE id = '" + itemID + "' LIMIT 1"); refreshHand("last"); break; } case "Bw": // Item handling - redeem credit item { if (_isOwner == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = Encoding.decodeVL64(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { string Sprite = Room.floorItemManager.getItem(itemID).Sprite; if (Sprite.Substring(0, 3).ToLower() != "cf_") return; int redeemValue = 0; try { redeemValue = int.Parse(Sprite.Split('_')[1]); } catch { return; } Room.floorItemManager.removeItem(itemID, 0); _Credits += redeemValue; sendData("@F" + _Credits); DB.runQuery("UPDATE users SET credits = '" + _Credits + "' WHERE id = '" + userID + "' LIMIT 1"); } break; } case "AQ": // Item handling - teleporters - enter teleporter { if (_inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { Rooms.Items.floorItem Teleporter = Room.floorItemManager.getItem(itemID); // Prevent clientside 'jumps' to teleporter, check if user is removed one coord from teleporter entrance if (Teleporter.Z == 2 && roomUser.X != Teleporter.X + 1 && roomUser.Y != Teleporter.Y) return; else if (Teleporter.Z == 4 && roomUser.X != Teleporter.X && roomUser.Y != Teleporter.Y + 1) return; roomUser.goalX = -1; Room.moveUser(this.roomUser, Teleporter.X, Teleporter.Y, true); } break; } case @"@\": // Item handling - teleporters - flash teleporter { if (_inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { Rooms.Items.floorItem Teleporter1 = Room.floorItemManager.getItem(itemID); if (roomUser.X != Teleporter1.X && roomUser.Y != Teleporter1.Y) return; int idTeleporter2 = DB.runRead("SELECT teleportid FROM furniture WHERE id = '" + itemID + "'", null); int roomIDTeleporter2 = DB.runRead("SELECT roomid FROM furniture WHERE id = '" + idTeleporter2 + "'", null); if (roomIDTeleporter2 > 0) new TeleporterUsageSleep(useTeleporter).BeginInvoke(Teleporter1, idTeleporter2, roomIDTeleporter2, null, null); } break; } case "AM": // Item handling - dices - close dice { if (Room == null || roomUser == null || _inPublicroom) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { Rooms.Items.floorItem Item = Room.floorItemManager.getItem(itemID); string Sprite = Item.Sprite; if (Sprite != "edice" && Sprite != "edicehc") // Not a dice item return; if (!(Math.Abs(roomUser.X - Item.X) > 1 || Math.Abs(roomUser.Y - Item.Y) > 1)) // User is not more than one square removed from dice { Item.Var = "0"; Room.sendData("AZ" + itemID + " " + (itemID * 38)); DB.runQuery("UPDATE furniture SET var = '0' WHERE id = '" + itemID + "' LIMIT 1"); } } break; } case "AL": // Item handling - dices - spin dice { if (Room == null || roomUser == null || _inPublicroom) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { Rooms.Items.floorItem Item = Room.floorItemManager.getItem(itemID); string Sprite = Item.Sprite; if (Sprite != "edice" && Sprite != "edicehc") // Not a dice item return; if (!(Math.Abs(roomUser.X - Item.X) > 1 || Math.Abs(roomUser.Y - Item.Y) > 1)) // User is not more than one square removed from dice { Room.sendData("AZ" + itemID); int rndNum = new Random(DateTime.Now.Millisecond).Next(1, 7); Room.sendData("AZ" + itemID + " " + ((itemID * 38) + rndNum), 2000); Item.Var = rndNum.ToString(); DB.runQuery("UPDATE furniture SET var = '" + rndNum + "' WHERE id = '" + itemID + "' LIMIT 1"); } } break; } case "CW": // Item handling - spin Wheel of fortune { if (_hasRights == false || Room == null || roomUser == null || _inPublicroom) return; int itemID = Encoding.decodeVL64(currentPacket.Substring(2)); if (Room.wallItemManager.containsItem(itemID)) { Rooms.Items.wallItem Item = Room.wallItemManager.getItem(itemID); if (Item.Sprite == "habbowheel") { int rndNum = new Random(DateTime.Now.Millisecond).Next(0, 10); Room.sendData("AU" + itemID + Convert.ToChar(9) + "habbowheel" + Convert.ToChar(9) + " " + Item.wallPosition + Convert.ToChar(9) + "-1"); Room.sendData("AU" + itemID + Convert.ToChar(9) + "habbowheel" + Convert.ToChar(9) + " " + Item.wallPosition + Convert.ToChar(9) + rndNum, 4250); DB.runQuery("UPDATE furniture SET var = '" + rndNum + "' WHERE id = '" + itemID + "' LIMIT 1"); } } break; } case "Dz": // Item handling - activate Love shuffler sofa { if (Room == null || roomUser == null || _inPublicroom) return; int itemID = Encoding.decodeVL64(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID) && Room.floorItemManager.getItem(itemID).Sprite == "val_randomizer") { int rndNum = new Random(DateTime.Now.Millisecond).Next(1, 5); Room.sendData("AX" + itemID + Convert.ToChar(2) + "123456789" + Convert.ToChar(2)); Room.sendData("AX" + itemID + Convert.ToChar(2) + rndNum + Convert.ToChar(2), 5000); DB.runQuery("UPDATE furniture SET var = '" + rndNum + "' WHERE id = '" + itemID + "' LIMIT 1"); } break; } case "AS": // Item handling - stickies/photo's - open stickie/photo { if (Room == null || roomUser == null || _inPublicroom) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.wallItemManager.containsItem(itemID)) { string Message = DB.runRead("SELECT text FROM furniture_stickies WHERE id = '" + itemID + "'"); sendData("@p" + itemID + Convert.ToChar(9) + Room.wallItemManager.getItem(itemID).Var + " " + Message); } break; } case "AT": // Item handling - stickies - edit stickie colour/message { if (_hasRights == false || Room == null || roomUser == null || _inPublicroom) return; int itemID = int.Parse(currentPacket.Substring(2, currentPacket.IndexOf("/") - 2)); if (Room.wallItemManager.containsItem(itemID)) { Rooms.Items.wallItem Item = Room.wallItemManager.getItem(itemID); string Sprite = Item.Sprite; if (Sprite != "post.it" && Sprite != "post.it.vd") return; string Colour = "FFFFFF"; // Valentine stickie default colour if (Sprite == "post.it") // Normal stickie { Colour = currentPacket.Substring(2 + itemID.ToString().Length + 1, 6); if (Colour != "FFFF33" && Colour != "FF9CFF" && Colour != "9CFF9C" && Colour != "9CCEFF") return; } string Message = currentPacket.Substring(2 + itemID.ToString().Length + 7); if (Message.Length > 684) return; if (Colour != Item.Var) DB.runQuery("UPDATE furniture SET var = '" + Colour + "' WHERE id = '" + itemID + "' LIMIT 1"); Item.Var = Colour; Room.sendData("AU" + itemID + Convert.ToChar(9) + Sprite + Convert.ToChar(9) + " " + Item.wallPosition + Convert.ToChar(9) + Colour); Message = DB.Stripslash(stringManager.filterSwearwords(Message)).Replace("/r", Convert.ToChar(13).ToString()); DB.runQuery("UPDATE furniture_stickies SET text = '" + Message + "' WHERE id = '" + itemID + "' LIMIT 1"); } break; } case "AU": // Item handling - stickies/photo - delete stickie/photo { if (_isOwner == false || Room == null || roomUser == null || _inPublicroom) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.wallItemManager.containsItem(itemID) && stringManager.getStringPart(Room.wallItemManager.getItem(itemID).Sprite, 0, 7) == "post.it") { Room.wallItemManager.removeItem(itemID, 0); DB.runQuery("DELETE FROM furniture_stickies WHERE id = '" + itemID + "' LIMIT 1"); } break; } #endregion #region Soundmachines case "Ct": // Soundmachine - initialize songs in soundmachine { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) sendData("EB" + soundMachineManager.getMachineSongList(Room.floorItemManager.soundMachineID)); break; } case "Cu": // Soundmachine - enter room initialize playlist { if (Room != null && Room.floorItemManager.soundMachineID > 0) sendData("EC" + soundMachineManager.getMachinePlaylist(Room.floorItemManager.soundMachineID)); break; } case "C]": // Soundmachine - get song title and data of certain song { if (Room != null && Room.floorItemManager.soundMachineID > 0) { int songID = Encoding.decodeVL64(currentPacket.Substring(2)); sendData("Dl" + soundMachineManager.getSong(songID)); } break; } case "Cs": // Soundmachine - save playlist { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int Amount = Encoding.decodeVL64(currentPacket.Substring(2)); if (Amount < 6) // Max playlist size { currentPacket = currentPacket.Substring(Encoding.encodeVL64(Amount).Length + 2); DB.runQuery("DELETE FROM soundmachine_playlists WHERE machineid = '" + Room.floorItemManager.soundMachineID + "'"); for (int i = 0; i < Amount; i++) { int songID = Encoding.decodeVL64(currentPacket); DB.runQuery("INSERT INTO soundmachine_playlists(machineid,songid,pos) VALUES ('" + Room.floorItemManager.soundMachineID + "','" + songID + "','" + i + "')"); currentPacket = currentPacket.Substring(Encoding.encodeVL64(songID).Length); } Room.sendData("EC" + soundMachineManager.getMachinePlaylist(Room.floorItemManager.soundMachineID)); // Refresh playlist } } break; } case "C~": // Sound machine - burn song to disk { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int songID = Encoding.decodeVL64(currentPacket.Substring(2)); if (_Credits > 0 && DB.checkExists("SELECT id FROM soundmachine_songs WHERE id = '" + songID + "' AND userid = '" + userID + "' AND machineid = '" + Room.floorItemManager.soundMachineID + "'")) { string[] songData = DB.runReadRow("SELECT title,length FROM soundmachine_songs WHERE id = '" + songID + "'"); int Length = DB.runRead("SELECT length FROM soundmachine_songs WHERE id = '" + songID + "'", null); string Status = Encoding.encodeVL64(songID) + _Username + Convert.ToChar(10) + DateTime.Today.Day + Convert.ToChar(10) + DateTime.Today.Month + Convert.ToChar(10) + DateTime.Today.Year + Convert.ToChar(10) + songData[1] + Convert.ToChar(10) + songData[0]; DB.runQuery("INSERT INTO furniture(tid,ownerid,var) VALUES ('" + Config.Soundmachine_burnToDisk_diskTemplateID + "','" + userID + "','" + Status + "')"); DB.runQuery("UPDATE soundmachine_songs SET burnt = '1' WHERE id = '" + songID + "' LIMIT 1"); DB.runQuery("UPDATE users SET credits = credits - 1 WHERE id = '" + userID + "' LIMIT 1"); _Credits--; sendData("@F" + _Credits); sendData("EB" + soundMachineManager.getMachineSongList(Room.floorItemManager.soundMachineID)); refreshHand("last"); } else // Virtual user doesn't has enough credits to burn this song to disk, or this song doesn't exist in his/her soundmachine sendData("AD"); } break; } case "Cx": // Sound machine - delete song { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int songID = Encoding.decodeVL64(currentPacket.Substring(2)); if (DB.checkExists("SELECT id FROM soundmachine_songs WHERE id = '" + songID + "' AND machineid = '" + Room.floorItemManager.soundMachineID + "'")) { DB.runQuery("UPDATE soundmachine_songs SET machineid = '0' WHERE id = '" + songID + "' AND burnt = '1'"); // If the song is burnt atleast once, then the song is removed from this machine DB.runQuery("DELETE FROM soundmachine_songs WHERE id = '" + songID + "' AND burnt = '0' LIMIT 1"); // If the song isn't burnt; delete song from database DB.runQuery("DELETE FROM soundmachine_playlists WHERE machineid = '" + Room.floorItemManager.soundMachineID + "' AND songid = '" + songID + "'"); // Remove song from playlist Room.sendData("EC" + soundMachineManager.getMachinePlaylist(Room.floorItemManager.soundMachineID)); } } break; } #region Song editor case "Co": // Soundmachine - song editor - initialize soundsets and samples { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { songEditor = new virtualSongEditor(Room.floorItemManager.soundMachineID, userID); songEditor.loadSoundsets(); sendData("Dm" + songEditor.getSoundsets()); sendData("Dn" + soundMachineManager.getHandSoundsets(userID)); } break; } case "C[": // Soundmachine - song editor - add soundset { if (songEditor != null && _isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int soundSetID = Encoding.decodeVL64(currentPacket.Substring(2)); int slotID = Encoding.decodeVL64(currentPacket.Substring(Encoding.encodeVL64(soundSetID).Length + 2)); if (slotID > 0 && slotID < 5 && songEditor.slotFree(slotID)) { songEditor.addSoundset(soundSetID, slotID); sendData("Dn" + soundMachineManager.getHandSoundsets(userID)); sendData("Dm" + songEditor.getSoundsets()); } } break; } case @"C\": // Soundmachine - song editor - remove soundset { if (songEditor != null && _isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int slotID = Encoding.decodeVL64(currentPacket.Substring(2)); if (songEditor.slotFree(slotID) == false) { songEditor.removeSoundset(slotID); sendData("Dm" + songEditor.getSoundsets()); sendData("Dn" + soundMachineManager.getHandSoundsets(userID)); } } break; } case "Cp": // Soundmachine - song editor - save new song { if (songEditor != null && _isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int nameLength = Encoding.decodeB64(currentPacket.Substring(2, 2)); string Title = currentPacket.Substring(4, nameLength); string Data = currentPacket.Substring(nameLength + 6); int Length = soundMachineManager.calculateSongLength(Data); if (Length != -1) { Title = DB.Stripslash(stringManager.filterSwearwords(Title)); Data = DB.Stripslash(Data); DB.runQuery("INSERT INTO soundmachine_songs (userid,machineid,title,length,data) VALUES ('" + userID + "','" + Room.floorItemManager.soundMachineID + "','" + Title + "','" + Length + "','" + DB.Stripslash(Data) + "')"); sendData("EB" + soundMachineManager.getMachineSongList(Room.floorItemManager.soundMachineID)); sendData("EK" + Encoding.encodeVL64(Room.floorItemManager.soundMachineID) + Title + Convert.ToChar(2)); } } break; } case "Cq": // Soundmachine - song editor - request edit of existing song { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int songID = Encoding.decodeVL64(currentPacket.Substring(2)); sendData("Dl" + soundMachineManager.getSong(songID)); songEditor = new virtualSongEditor(Room.floorItemManager.soundMachineID, userID); songEditor.loadSoundsets(); sendData("Dm" + songEditor.getSoundsets()); sendData("Dn" + soundMachineManager.getHandSoundsets(userID)); } break; } case "Cr": // Soundmachine - song editor - save edited existing song { if (songEditor != null && _isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int songID = Encoding.decodeVL64(currentPacket.Substring(2)); if (DB.checkExists("SELECT id FROM soundmachine_songs WHERE id = '" + songID + "' AND userid = '" + userID + "' AND machineid = '" + Room.floorItemManager.soundMachineID + "'")) { int idLength = Encoding.encodeVL64(songID).Length; int nameLength = Encoding.decodeB64(currentPacket.Substring(idLength + 2, 2)); string Title = currentPacket.Substring(idLength + 4, nameLength); string Data = currentPacket.Substring(idLength + nameLength + 6); int Length = soundMachineManager.calculateSongLength(Data); if (Length != -1) { Title = DB.Stripslash(stringManager.filterSwearwords(Title)); Data = DB.Stripslash(Data); DB.runQuery("UPDATE soundmachine_songs SET title = '" + Title + "',data = '" + Data + "',length = '" + Length + "' WHERE id = '" + songID + "' LIMIT 1"); sendData("ES"); sendData("EB" + soundMachineManager.getMachineSongList(Room.floorItemManager.soundMachineID)); Room.sendData("EC" + soundMachineManager.getMachinePlaylist(Room.floorItemManager.soundMachineID)); } } } break; } #endregion Song editor #endregion #region Trading case "AG": // Trading - start { if (Room != null || roomUser != null || _tradePartnerUID == -1) { if (Config.enableTrading == false) { sendData("BK" + stringManager.getString("trading_disabled")); return; } int partnerUID = int.Parse(currentPacket.Substring(2)); if (Room.containsUser(partnerUID)) { virtualUser Partner = Room.getUser(partnerUID); if (Partner.statusManager.containsStatus("trd")) return; this._tradePartnerUID = partnerUID; this.statusManager.addStatus("trd", ""); this.roomUser.Refresh(); Partner._tradePartnerUID = this.roomUser.roomUID; Partner.statusManager.addStatus("trd", ""); Partner.roomUser.Refresh(); this.refreshTradeBoxes(); Partner.refreshTradeBoxes(); } } break; } case "AH": // Trading - offer item { if (Room != null && roomUser != null && _tradePartnerUID != -1 && Room.containsUser(_tradePartnerUID)) { int itemID = int.Parse(currentPacket.Substring(2)); int templateID = DB.runRead("SELECT id FROM furniture WHERE id = '" + itemID + "' AND ownerid = '" + userID + "' AND roomid = '0'", null); if (templateID == 0) return; if (catalogueManager.getTemplate(templateID).isTradeable == false) { sendData("BK" + stringManager.getString("trading_nottradeable")); return; } _tradeItems[_tradeItemCount] = itemID; _tradeItemCount++; virtualUser Partner = Room.getUser(_tradePartnerUID); this._tradeAccept = false; Partner._tradeAccept = false; this.refreshTradeBoxes(); Partner.refreshTradeBoxes(); } break; } case "AD": // Trading - decline trade { if (Room != null && roomUser != null && _tradePartnerUID != -1 && Room.containsUser(_tradePartnerUID)) { virtualUser Partner = Room.getUser(_tradePartnerUID); this._tradeAccept = false; Partner._tradeAccept = false; this.refreshTradeBoxes(); Partner.refreshTradeBoxes(); } break; } case "AE": // Trading - accept trade (and, if both partners accept, swap items] { if (Room != null && roomUser != null && _tradePartnerUID != -1 && Room.containsUser(_tradePartnerUID)) { virtualUser Partner = Room.getUser(_tradePartnerUID); this._tradeAccept = true; this.refreshTradeBoxes(); Partner.refreshTradeBoxes(); if (Partner._tradeAccept) { for (int i = 0; i < _tradeItemCount; i++) if (_tradeItems[i] > 0) DB.runQuery("UPDATE furniture SET ownerid = '" + Partner.userID + "',roomid = '0' WHERE id = '" + this._tradeItems[i] + "' LIMIT 1"); for (int i = 0; i < Partner._tradeItemCount; i++) if (Partner._tradeItems[i] > 0) DB.runQuery("UPDATE furniture SET ownerid = '" + this.userID + "',roomid = '0' WHERE id = '" + Partner._tradeItems[i] + "' LIMIT 1"); abortTrade(); } } break; } case "AF": // Trading - abort trade { if (Room != null && roomUser != null && _tradePartnerUID != -1 && Room.containsUser(_tradePartnerUID)) { abortTrade(); refreshHand("update"); } break; } #endregion #endregion } } #endregion } //catch { Disconnect(); } }
/// <summary> /// Processes a single packet from the client. /// </summary> /// <param name="currentPacket">The packet to process.</param> private void processPacket(string currentPacket) { string str3; if (_isLoggedIn == false) { #region Non-logged in packet processing - Preferences switch (currentPacket.Substring(0, 2)) { case "CD": pingOK = true; break; //////////////////////////////////////////////////////////////////////////////////////////////// case "Ch": // One way doors (Entering) { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { string[] strArray2 = dbClient.runReadRow("SELECT id,name,owner,description,state,visitors_now,visitors_max FROM rooms WHERE id = '" + Room.roomID + "'"); string[] strArray3 = dbClient.runReadRow("SELECT id,name,credits FROM users WHERE name = '" + strArray2[2] + "'"); int num3 = dbClient.getInt("SELECT credits FROM users WHERE name = '" + strArray3[1] + "'"); Room.sendData("Dx" + currentPacket.Substring(2) + "IH"); roomUser.goalX = -1; str3 = ""; int x = roomUser.X; int y = roomUser.Y; if (x == (Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X + 1)) { str3 = "X1"; } if (x == (Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X - 1)) { str3 = "X-1"; } if (y == (Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y + 1)) { str3 = "Y1"; } if (y == (Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y - 1)) { str3 = "Y-1"; } Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); Thread.Sleep(500); if (Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Sprite == "one_way_door*0") { switch (str3) { case "X-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X + 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "X1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X - 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "Y-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y + 1, true); break; case "Y1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y - 1, true); break; } } if (Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Sprite == "one_way_door*1") { if (((_Credits - 5) > -1) && !_isOwner) { _Credits -= 5; num3 += 5; sendData("@F" + _Credits); sendData("BKYou've been charged 5 coins for entrance."); dbClient.runQuery(string.Concat(new object[] { "UPDATE users SET credits = '", num3, "' WHERE id = '", strArray3[0], "'" })); switch (str3) { case "X-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X + 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "X1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X - 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "Y-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y + 1, true); break; case "Y1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y - 1, true); break; } } else if (_isOwner) { switch (str3) { case "X-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X + 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "X1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X - 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "Y-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y + 1, true); break; case "Y1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y - 1, true); break; } } else { sendData("BKYou don't have sufficent funds for this entry."); switch (str3) { case "X1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X + 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "X-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X - 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "Y1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y + 1, true); break; case "Y-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y - 1, true); goto Label_173A; } } } goto Label_173A; } } /////////////////////////////////////////////////////////////////////////////////////// case "CN": sendData("DUIH"); break; case "CJ": sendData("DAQBHHIIKHJIPAHQAdd-MM-yyyy" + Convert.ToChar(2) + "SAHPBhttp://www.vista4life.com" + Convert.ToChar(2) + "QBH"); break; case "_R": sendData("DA" + "QBHIIIKHJIPAIQAdd-MM-yyyy" + Convert.ToChar(2) + "SAHPB/client" + Convert.ToChar(2) + "QBH" + "IJWVVVSNKQCFUBJASMSLKUUOJCOLJQPNSBIRSVQBRXZQOTGPMNJIHLVJCRRULBLUO"); // V25+ SSO LOGIN BY vista4life break; case "CL": { int myID; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("sso", currentPacket.Substring(4)); myID = dbClient.getInt("SELECT id FROM users WHERE ticket_sso = @sso"); } if (myID == 0) // No user found for this sso ticket and/or IP address { sendData("BK" + "Invalid SSO Ticket, please go use the SSOFix"); Disconnect(); return; } string banReason = userManager.getBanReason(myID); if (banReason != "") { sendData("@c" + banReason); Disconnect(1000); return; } userID = myID; DataRow dRow; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dRow = dbClient.getRow("SELECT name,figure,sex,mission,rank,consolemission FROM users WHERE id = '" + userID + "'"); } _Username = Convert.ToString(dRow[0]); _Figure = Convert.ToString(dRow[1]); _Sex = Convert.ToChar(dRow[2]); _Mission = Convert.ToString(dRow[3]); _Rank = Convert.ToByte(dRow[4]); _consoleMission = Convert.ToString(dRow[5]); userManager.addUser(myID, this); _isLoggedIn = true; sendData("DA" + "QBHIIIKHJIPAIQAdd-MM-yyyy" + Convert.ToChar(2) + "SAHPB/client" + Convert.ToChar(2) + "QBH"); DataColumn dCol; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dCol = dbClient.getColumn("SELECT fuseright FROM users_fuserights WHERE userid = " + userID); } _fuserights = new System.Collections.Generic.List<string>(); foreach (DataRow dbRow in dCol.Table.Rows) _fuserights.Add(Convert.ToString(dbRow[0])); sendData("@B" + rankManager.fuseRights(_Rank, userID)); sendData("DbIH"); sendData("@C"); if (Config.enableWelcomeMessage) sendData("BK" + stringManager.getString("welcomemessage_text")); } break; default: Disconnect(); return; //////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// Label_173A: if (Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Sprite == "one_way_door*2") { if (_isRoomStaff) { switch (str3) { case "X-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X + 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "X1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X - 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "Y-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y + 1, true); break; case "Y1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y - 1, true); break; } } else if (_isOwner) { switch (str3) { case "X-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X + 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "X1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X - 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "Y-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y + 1, true); break; case "Y1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y - 1, true); break; } } else { sendData("BKEcho staff entries only."); switch (str3) { case "X1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X + 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "X-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X - 1, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y, true); break; case "Y1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y + 1, true); break; case "Y-1": Room.moveUser(roomUser, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).X, Room.floorItemManager.getItem(Encoding.decodeVL64(currentPacket.Substring(2))).Y - 1, true); break; } } } Thread.Sleep(500); Room.sendData("Dx" + currentPacket.Substring(2) + "HH"); /////////////////////////////////////////////////////////////////////////////// using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { // determine if the user allows others to follow them via messenger if (dbClient.getString("SELECT follow_me FROM users WHERE id = '" + userID + "'") == "1") followEnabled = true; else followEnabled = false; } break; } #endregion /////////////////////////////////////////////////////////////////////////////// } else { /////////////////////////////////////////////////////////////////////////////// #region Logged-in packet processing - Preferences switch (currentPacket.Substring(0, 2)) { #region Misc - Preferences case "CD": // Client - response to @r ping pingOK = true; break; case "@q": // Client - request current date sendData("Bc" + DateTime.Today.ToShortDateString()); break; case "BA": // Purse - redeem credit voucher { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("code", currentPacket.Substring(4)); if (dbClient.findsResult("SELECT credits FROM vouchers WHERE voucher = @code")) { int voucherAmount = dbClient.getInt("SELECT credits FROM vouchers WHERE voucher = @code"); dbClient.runQuery("DELETE FROM vouchers WHERE voucher = @code LIMIT 1"); _Credits += voucherAmount; sendData("@F" + _Credits); sendData("CT"); dbClient.runQuery("UPDATE users SET credits = '" + voucherAmount + "' WHERE id = '" + userID + "' LIMIT 1"); } else sendData("CU1"); } break; } #endregion #region Login - Preferences case "@L": // Login - initialize messenger Messenger = new Messenger.virtualMessenger(userID); sendData("@L" + Messenger.friendList()); sendData("Dz" + Messenger.friendRequests()); break; case "@Z": // Login - initialize Club subscription status clubLoad = true; if (_isLoggedIn == false) { clubLoad = false; return; } break; case "@G": // Login - initialize/refresh appearance refreshAppearance(false, true, false); break; case "@H": // Login - initialize/refresh valueables [credits, tickets, etc] refreshValueables(true, true); // Credit updates #region creditupdates string today = DateTime.Today.ToString(); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { int usercredits = dbClient.getInt("SELECT userid FROM users_logins WHERE userid = '" + userID + "' AND date = '" + today + "'"); int users = 1000; int users_34 = 2000; int users_56 = 3000; int users_7 = 4000; if (usercredits == 0 && _Rank == 1 | _Rank == 2) { dbClient.runQuery("INSERT INTO users_logins (userid, date) VALUES ('" + userID + "','" + today + "')"); dbClient.runQuery("UPDATE users SET credits = credits + '" + users + "' WHERE id = '" + userID + "'"); sendData("BK" + "You have just received 1,000 coins from the daily system!"); refreshValueables(true, false); } if (usercredits == 0 && _Rank == 3 | _Rank == 4) { dbClient.runQuery("INSERT INTO users_logins (userid, date) VALUES ('" + userID + "','" + today + "')"); dbClient.runQuery("UPDATE users SET credits = credits + '" + users_34 + "' WHERE id = '" + userID + "'"); sendData("BK" + "You have just received 2,000 coins from the daily system!"); refreshValueables(true, false); } if (usercredits == 0 && _Rank == 5 | _Rank == 6) { dbClient.runQuery("INSERT INTO users_logins (userid, date) VALUES ('" + userID + "','" + today + "')"); dbClient.runQuery("UPDATE users SET credits = credits + '" + users_56 + "' WHERE id = '" + userID + "'"); sendData("BK" + "You have just received 3,000 coins from the daily system!"); refreshValueables(true, false); } if (usercredits == 0 && _Rank == 7) { dbClient.runQuery("INSERT INTO users_logins (userid, date) VALUES ('" + userID + "','" + today + "')"); dbClient.runQuery("UPDATE users SET credits = credits + '" + users_7 + "' WHERE id = '" + userID + "'"); sendData("BK" + "You have just received 4,000 coins from the daily system!"); refreshValueables(true, false); } } #endregion break; case "B]": // Login - initialize/refresh badges refreshBadges(); break; case "Cd": // Login - initialize/refresh group status refreshGroupStatus(); break; case "C^": // Recycler - receive recycler setup sendData("Do" + recyclerManager.setupString); break; case "C_": // Recycler - receive recycler session status sendData("Dp" + recyclerManager.sessionString(userID)); break; #endregion #region Messenger - Preferences case "@g": // Messenger - request user as friend { if (Messenger != null) { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { { DataRow dRow; dbClient.AddParamWithValue("username", currentPacket.Substring(4)); dRow = dbClient.getRow("SELECT name,figure,sex,mission,rank,consolemission,follow_me,friend_request,filter_chat FROM users WHERE id = '" + userID + "'"); int toID = dbClient.getInt("SELECT id FROM users WHERE name = @username"); if (toID > 0 && Messenger.hasFriendRequests(toID) == false && Messenger.hasFriendship(toID) == false) { int requestID = dbClient.getInt("SELECT MAX(requestid) FROM messenger_friendrequests WHERE userid_to = '" + toID + "'") + 1; dbClient.runQuery("INSERT INTO messenger_friendrequests(userid_to,userid_from,requestid) VALUES ('" + toID + "','" + userID + "','" + requestID + "')"); if (userManager.getUser(toID) != null) { userManager.getUser(toID).sendData("BD" + "I" + _Username + Convert.ToChar(2) + userID + Convert.ToChar(2)); } if (frEnabled == false) { sendData("BK" + "User is currently not accepting friend requests, request is deleted."); dbClient.runQuery("DELETE FROM messenger_friendrequests(userid_to,userid_from,requestid) VALUES ('" + toID + "','" + userID + "','" + requestID + "')"); } } } } } } break; case "@i": // Search in console { string Packet = "Fs"; string PacketFriends = ""; string PacketOthers = ""; string PacketAdd = ""; int CountFriends = 0; int CountOthers = 0; string[] IDs; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { string Search = currentPacket.Substring(4); Search = Search.Replace(@"\", "\\").Replace("'", @"\'"); dbClient.AddParamWithValue("search", Search); IDs = dataHandling.dColToArray((dbClient.getColumn("SELECT id FROM users WHERE name LIKE '" + Search + "%' LIMIT 20 "))); } for (int i = 0; i < IDs.Length; i++) { int thisID = Convert.ToInt32(IDs[i]); bool online = userManager.containsUser(thisID); string onlineStr = online ? "I" : "H"; DataRow row; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { row = dbClient.getRow("SELECT name, mission, lastvisit, figure FROM users WHERE id = " + thisID.ToString()); } PacketAdd = Encoding.encodeVL64(thisID) + row[0] + "" + row[1] + "" + onlineStr + onlineStr + "" + onlineStr + (online ? row[3] : "") + "" + (online ? "" : row[2]) + ""; if (Messenger.hasFriendship(thisID)) { CountFriends += 1; PacketFriends += PacketAdd; } else { CountOthers += 1; PacketOthers += PacketAdd; } } // Add count headers PacketFriends = Encoding.encodeVL64(CountFriends) + PacketFriends; PacketOthers = Encoding.encodeVL64(CountOthers) + PacketOthers; // Merge packets Packet += PacketFriends + PacketOthers; // Send packets sendData(Packet); break; } case "@e": // Messenger - accept friendrequest(s) { int Amount = Encoding.decodeVL64(currentPacket.Substring(2)); currentPacket = currentPacket.Substring(Encoding.encodeVL64(Amount).Length + 2); int updateAmount = 0; StringBuilder Updates = new StringBuilder(); virtualBuddy Me = new virtualBuddy(userID); for (int i = 0; i < Amount; i++) { if (currentPacket == "") { return; } int requestID = Encoding.decodeVL64(currentPacket); int fromUserID; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { fromUserID = dbClient.getInt("SELECT userid_from FROM messenger_friendrequests WHERE userid_to = '" + userID + "' AND requestid = '" + requestID + "'"); } if (fromUserID == 0) // Corrupt data { return; } virtualBuddy Buddy = new virtualBuddy(fromUserID); Updates.Append(Buddy.ToString(true)); updateAmount++; Messenger.addBuddy(Buddy, false); if (userManager.containsUser(fromUserID)) { if (userManager.getUser(fromUserID).Messenger != null) userManager.getUser(fromUserID).Messenger.addBuddy(Me, true); } using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("INSERT INTO messenger_friendships(userid,friendid) VALUES ('" + fromUserID + "','" + userID + "')"); dbClient.runQuery("DELETE FROM messenger_friendrequests WHERE userid_to = '" + userID + "' AND requestid = '" + requestID + "' LIMIT 1"); } currentPacket = currentPacket.Substring(Encoding.encodeVL64(requestID).Length); } if (updateAmount > 0) sendData("@M" + "HI" + Encoding.encodeVL64(updateAmount) + Updates.ToString()); } break; case "@f": // Messenger - decline friendrequests { if (Messenger != null) { int Amount = Encoding.decodeVL64(currentPacket.Substring(3)); currentPacket = currentPacket.Substring(Encoding.encodeVL64(Amount).Length + 3); for (int i = 0; i < Amount; i++) { if (currentPacket == "") { return; } int requestID = Encoding.decodeVL64(currentPacket); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("DELETE FROM messenger_friendrequests WHERE userid_to = '" + userID + "' AND requestid = '" + requestID + "' LIMIT 1"); } currentPacket = currentPacket.Substring(Encoding.encodeVL64(requestID).Length); } } break; } case "@h": // Messenger - remove buddy from friendlist { if (Messenger != null) { int buddyID = Encoding.decodeVL64(currentPacket.Substring(3)); Messenger.removeBuddy(buddyID); if (userManager.containsUser(buddyID)) { if (userManager.getUser(buddyID).Messenger != null) userManager.getUser(buddyID).Messenger.removeBuddy(userID); } using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("DELETE FROM messenger_friendships WHERE (userid = '" + userID + "' AND friendid = '" + buddyID + "') OR (userid = '" + buddyID + "' AND friendid = '" + userID + "') LIMIT 1"); } } break; } case "@a": // Messenger - send instant message to buddy { if (Messenger != null) { int buddyID = Encoding.decodeVL64(currentPacket.Substring(2)); string Message = currentPacket.Substring(Encoding.encodeVL64(buddyID).Length + 4); Message = stringManager.filterSwearwords(Message); // Filter swearwords if (Messenger.containsOnlineBuddy(buddyID)) // Buddy online userManager.getUser(buddyID).sendData("BF" + Encoding.encodeVL64(userID) + Message + Convert.ToChar(2)); else // Buddy offline (or user doesn't has user in buddylist) sendData("DE" + Encoding.encodeVL64(5) + Encoding.encodeVL64(userID)); } break; } case "DF": // Messenger - follow buddy to a room { if (Messenger != null) { int ID = Encoding.decodeVL64(currentPacket.Substring(2)); int errorID = -1; if (Messenger.hasFriendship(ID)) // Has friendship with user { if (userManager.containsUser(ID)) // User is online { virtualUser _User = userManager.getUser(ID); if (_User._roomID > 0) // User is in room { if (_User.followEnabled) { if (_User._inPublicroom) sendData("D^" + "I" + Encoding.encodeVL64(_User._roomID)); else sendData("D^" + "H" + Encoding.encodeVL64(_User._roomID)); break; } else { /// <summary> /// If follow me is disabled, we will check to see if the target's /// rank is lower than the user. If it is, then they will be able to follow /// the target anyway, but only if they are not staff. /// </summary> if (_User._Rank < _Rank) { switch (_User._Rank.ToString() + ":" + _Rank.ToString()) { case "1:2": case "1:3": case "2:3": errorID = 3; break; default: { if (_User._inPublicroom) sendData("D^" + "I" + Encoding.encodeVL64(_User._roomID)); else sendData("D^" + "H" + Encoding.encodeVL64(_User._roomID)); break; } } } else errorID = 3; } } else // User is not in a room errorID = 2; } else // User is offline errorID = 1; } else // User is not this virtual user's friend errorID = 0; if (errorID != -1) // Error occured sendData("E]" + Encoding.encodeVL64(errorID)); } break; } case "@b": // Messenger - invite buddies to your room { try { if (Messenger != null && roomUser != null) { int Amount = Encoding.decodeVL64(currentPacket.Substring(2)); int[] IDs = new int[Amount]; currentPacket = currentPacket.Substring(Encoding.encodeVL64(Amount).Length + 2); for (int i = 0; i < Amount; i++) { if (currentPacket == "") return; int ID = Encoding.decodeVL64(currentPacket); if (Messenger.hasFriendship(ID) && userManager.containsUser(ID)) IDs[i] = ID; currentPacket = currentPacket.Substring(Encoding.encodeVL64(ID).Length); } string Message = currentPacket.Substring(2); string Data = "BG" + Encoding.encodeVL64(userID) + Message + Convert.ToChar(2); for (int i = 0; i < Amount; i++) if (userManager.containsUser(IDs[i])) userManager.getUser(IDs[i]).sendData(Data); } break; } catch { sendData("BKSorry something went wrong during sending the invites."); } break; } #endregion #region Navigator actions case "BV": // Navigator - navigate through rooms and categories { int hideFull = Encoding.decodeVL64(currentPacket.Substring(2, 1)); int cataID = Encoding.decodeVL64(currentPacket.Substring(3)); string Name = navigatorManager.getNameAcces(_Rank, cataID); //editted for caching if (Name == "") // User has no access to this category/it does not exist { return; } int Type = navigatorManager.getType(cataID); int parentID = navigatorManager.getParent(cataID); StringBuilder Navigator = new StringBuilder(@"C\" + Encoding.encodeVL64(hideFull) + Encoding.encodeVL64(cataID) + Encoding.encodeVL64(Type) + Name + Convert.ToChar(2) + Encoding.encodeVL64(0) + Encoding.encodeVL64(10000) + Encoding.encodeVL64(parentID)); string _SQL_ORDER_HELPER = ""; if (Type == 0) // Publicrooms { if (hideFull == 1) _SQL_ORDER_HELPER = "AND visitors_now < visitors_max ORDER BY id ASC"; else _SQL_ORDER_HELPER = "ORDER BY id ASC"; } else // Guestrooms { if (hideFull == 1) _SQL_ORDER_HELPER = "AND visitors_now < visitors_max ORDER BY visitors_now DESC LIMIT 30"; else _SQL_ORDER_HELPER = "ORDER BY visitors_now DESC LIMIT " + Config.Navigator_openCategory_maxResults; } DataTable dTable; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dTable = dbClient.getTable("SELECT id,state,showname,visitors_now,visitors_max,name,description,owner,ccts FROM rooms WHERE category = '" + cataID + "' " + _SQL_ORDER_HELPER); } if (Type == 2) // Guestrooms Navigator.Append(Encoding.encodeVL64(dTable.Rows.Count)); bool canSeeHiddenNames = false; if (Type != 0) // Publicroom canSeeHiddenNames = rankManager.containsRight(_Rank, "fuse_enter_locked_rooms", userID); foreach (DataRow dRow in dTable.Rows) { if (Type == 0) Navigator.Append(Encoding.encodeVL64(Convert.ToInt32(dRow["id"])) + "I" + Convert.ToString(dRow["name"]) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow["visitors_now"])) + Encoding.encodeVL64(Convert.ToInt32(dRow["visitors_max"])) + Encoding.encodeVL64(cataID) + Convert.ToString(dRow["description"]) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow["id"])) + "H" + Convert.ToString(dRow["ccts"]) + Convert.ToChar(2) + "HI"); else { if (Convert.ToInt32(dRow["showname"]) == 0 && canSeeHiddenNames == false) continue; else Navigator.Append(Encoding.encodeVL64(Convert.ToInt32(dRow["id"])) + Convert.ToString(dRow["name"]) + Convert.ToChar(2) + Convert.ToString(dRow["owner"]) + Convert.ToChar(2) + roomManager.getRoomState(Convert.ToInt32(dRow["state"])) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow["visitors_now"])) + Encoding.encodeVL64(Convert.ToInt32(dRow["visitors_max"])) + Convert.ToString(dRow["description"]) + Convert.ToChar(2)); } } DataColumn dCol = navigatorManager.getAccesParent(_Rank, cataID); if (dCol.Table.Rows.Count > 0) // Sub categories { StringBuilder sb = new StringBuilder(); List<int> emptyIDs = new List<int>(); foreach (DataRow dRow in dCol.Table.Rows) { sb.Append(" OR category = '" + Convert.ToString(dRow[0]) + "'"); emptyIDs.Add(Convert.ToInt32(dRow[0])); } dTable = navigatorManager.getGuestroomQuery("SELECT SUM(visitors_now),SUM(visitors_max),category FROM rooms WHERE" + sb.ToString().Substring(3) + " GROUP BY category", false); foreach (DataRow dRow in dTable.Rows) { if (Convert.ToInt32(dRow[1]) > 0 && hideFull == 1 && Convert.ToInt32(dRow[0]) >= Convert.ToInt32(dRow[1])) continue; Navigator.Append(Encoding.encodeVL64(Convert.ToInt32(dRow[2])) + "H" + navigatorManager.getName(Convert.ToInt32(dRow[2])) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow[0])) + Encoding.encodeVL64(Convert.ToInt32(dRow[1])) + Encoding.encodeVL64(cataID)); emptyIDs.Remove(Convert.ToInt32(dRow[2])); } foreach (int emptyID in emptyIDs) Navigator.Append(Encoding.encodeVL64(emptyID) + "H" + navigatorManager.getName(emptyID) + Convert.ToChar(2) + "HH" + Encoding.encodeVL64(cataID)); } sendData(Navigator.ToString()); break; } case "BW": // Navigator - request index of categories to place guestroom on { StringBuilder Categories = new StringBuilder(); DataTable dTable; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dTable = dbClient.getTable("SELECT id,name FROM room_categories WHERE type = '2' AND parent > 0 AND access_rank_min <= " + _Rank); } foreach (DataRow dRow in dTable.Rows) Categories.Append(Encoding.encodeVL64(Convert.ToInt32(dRow["id"])) + dRow["name"] + Convert.ToChar(2)); sendData("C]" + Encoding.encodeVL64(dTable.Rows.Count) + Categories.ToString()); break; } case "DH": // Navigator - refresh recommended rooms (random guestrooms) { sendData("E_" + Encoding.encodeVL64(3) + navigatorManager.getRandomRooms()); break; } case "@P": // Navigator - view user's own guestrooms { DataTable dTable; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dTable = dbClient.getTable("SELECT id,name,description,state,showname,visitors_now,visitors_max FROM rooms WHERE owner = '" + _Username + "' ORDER BY id ASC"); } if (dTable.Rows.Count > 0) { StringBuilder Rooms = new StringBuilder(); foreach (DataRow dRow in dTable.Rows) Rooms.Append(Convert.ToString(dRow["id"]) + "\t" + Convert.ToString(dRow["name"]) + Convert.ToChar(9) + _Username + Convert.ToChar(9) + roomManager.getRoomState(Convert.ToInt32(dRow["state"])) + Convert.ToChar(9) + "x" + Convert.ToChar(9) + Convert.ToString(dRow["visitors_now"]) + Convert.ToChar(9) + Convert.ToString(dRow["visitors_max"]) + Convert.ToChar(9) + "null" + Convert.ToChar(9) + Convert.ToString(dRow["description"]) + Convert.ToChar(9) + Convert.ToString(dRow["description"]) + Convert.ToChar(9) + Convert.ToChar(13)); sendData("@P" + Rooms.ToString()); } else { sendData("@y" + _Username); } break; } case "@Q": // Navigator - perform guestroom search on name/owner with a given criticeria { bool seeAllRoomOwners = rankManager.containsRight(_Rank, "fuse_see_all_roomowners", userID); DataTable dTable; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("search", currentPacket.Substring(2)); dbClient.AddParamWithValue("max", Config.Navigator_roomSearch_maxResults); dTable = dbClient.getTable("SELECT id,name,owner,description,state,showname,visitors_now,visitors_max FROM rooms WHERE (owner = @search OR name LIKE '@search%') ORDER BY id ASC LIMIT @max"); } if (dTable.Rows.Count > 0) { StringBuilder Rooms = new StringBuilder(); string nameString; foreach (DataRow dRow in dTable.Rows) { nameString = Convert.ToString(dRow["owner"]); if (Convert.ToString(dRow["showname"]) == "0" && Convert.ToString(dRow["owner"]) != _Username && seeAllRoomOwners == false)// The room owner has hidden his name at the guestroom and this user hasn't got the fuseright to see all room owners nameString = "-"; Rooms.Append(Convert.ToString(dRow["id"]) + Convert.ToChar(9) + Convert.ToString(dRow["name"]) + Convert.ToChar(9) + Convert.ToString(dRow["owner"]) + Convert.ToChar(9) + roomManager.getRoomState(Convert.ToInt32(dRow["state"])) + Convert.ToChar(9) + "x" + Convert.ToChar(9) + Convert.ToString(dRow["visitors_now"]) + Convert.ToChar(9) + Convert.ToString(dRow["visitors_max"]) + Convert.ToChar(9) + "null" + Convert.ToChar(9) + Convert.ToString(dRow["description"]) + Convert.ToChar(9) + Convert.ToChar(13)); } sendData("@w" + Rooms.ToString()); } else sendData("@z"); break; } case "@U": // Navigator - get guestroom details { int roomID = int.Parse(currentPacket.Substring(2)); DataRow dRow; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dRow = dbClient.getRow("SELECT name,owner,description,model,state,superusers,showname,category,visitors_now,visitors_max FROM rooms WHERE id = '" + roomID + "' AND NOT(owner IS NULL)"); } if (dRow.Table.Rows.Count > 0) // Guestroom does exist { StringBuilder Details = new StringBuilder(Encoding.encodeVL64(Convert.ToInt32(dRow[5])) + Encoding.encodeVL64(Convert.ToInt32(dRow[4])) + Encoding.encodeVL64(roomID)); if (Convert.ToString(dRow[6]) == "0" && rankManager.containsRight(_Rank, "fuse_see_all_roomowners", userID)) // The room owner has decided to hide his name at this room, and this user hasn't got the fuseright to see all room owners, hide the name Details.Append("-"); else Details.Append(Convert.ToString(dRow[1])); Details.Append(Convert.ToChar(2) + "model_" + Convert.ToString(dRow[3]) + Convert.ToChar(2) + Convert.ToString(dRow[0]) + Convert.ToChar(2) + Convert.ToString(dRow[2]) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow[6]))); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if (dbClient.findsResult("SELECT id FROM room_categories WHERE id = '" + Convert.ToString(dRow[7]) + "' AND trading = '1'")) Details.Append("I"); // Allow trading else Details.Append("H"); // Disallow trading } Details.Append(Encoding.encodeVL64(Convert.ToInt32(dRow[8])) + Encoding.encodeVL64(Convert.ToInt32(dRow[9]))); sendData("@v" + Details.ToString()); } break; } case "@R": // Navigator - initialize user's favorite rooms { DataColumn dCol; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dCol = dbClient.getColumn("SELECT roomid FROM users_favourites WHERE userid = '" + userID + "' ORDER BY roomid DESC LIMIT " + Config.Navigator_Favourites_maxRooms); } System.Collections.Hashtable deletedIDs = new System.Collections.Hashtable(dCol.Table.Rows.Count); string roomIDs = " "; foreach (DataRow dRow in dCol.Table.Rows) { deletedIDs.Add(Convert.ToInt32(dRow["roomid"]), Convert.ToInt32(dRow["roomid"])); roomIDs += "id = '" + Convert.ToString(dRow["roomid"]) + "' OR "; } roomIDs = roomIDs.Substring(0, roomIDs.Length - 4); if (roomIDs.Length > 0) { int guestRoomAmount = 0; string nameString; bool seeHiddenRoomOwners = rankManager.containsRight(_Rank, "fuse_enter_locked_rooms", userID); StringBuilder Rooms = new StringBuilder(); DataTable dTable; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dTable = dbClient.getTable("SELECT name,owner,state,showname,visitors_now,visitors_max,description,category,ccts,id FROM rooms WHERE " + roomIDs); } foreach (DataRow dRow in dTable.Rows) { deletedIDs.Remove(Convert.ToInt32(dRow["id"])); if (Convert.ToString(dRow[1]) == "") Rooms.Append(Encoding.encodeVL64(Convert.ToInt32(dRow["id"])) + "I" + Convert.ToString(dRow[0]) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow[4])) + Encoding.encodeVL64(Convert.ToInt32(dRow[5])) + Encoding.encodeVL64(Convert.ToInt32(dRow[7])) + Convert.ToString(dRow[6]) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow["id"])) + "H" + Convert.ToString(dRow[8]) + Convert.ToChar(2) + "HI"); else // Guestroom { nameString = Convert.ToString(dRow[0]); if (Convert.ToString(dRow[3]) == "0" && _Username != Convert.ToString(dRow[1]) && seeHiddenRoomOwners == false) // Room owner doesn't wish to show his name, and this user isn't the room owner and this user doesn't has the right to see hidden room owners, change room owner to '-' nameString = "-"; Rooms.Append(Encoding.encodeVL64(Convert.ToInt32(dRow["id"])) + nameString + Convert.ToChar(2) + Convert.ToString(dRow[1]) + Convert.ToChar(2) + roomManager.getRoomState(Convert.ToInt32(dRow[2])) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow[4])) + Encoding.encodeVL64(Convert.ToInt32(dRow[5])) + Convert.ToString(dRow[6]) + Convert.ToChar(2)); guestRoomAmount++; } } using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { foreach (int rID in deletedIDs.Values) dbClient.runQuery("DELETE FROM users_favourites WHERE roomid = '" + rID + "' LIMIT 1"); } sendData("@}" + "HHJ" + Convert.ToChar(2) + "HHH" + Encoding.encodeVL64(guestRoomAmount - deletedIDs.Count) + Rooms.ToString()); } break; } case "@S": // Navigator - add room to favourite rooms list { int roomID = Encoding.decodeVL64(currentPacket.Substring(3)); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if (dbClient.findsResult("SELECT id FROM rooms WHERE id = '" + roomID + "'") == true && dbClient.findsResult("SELECT userid FROM users_favourites WHERE userid = '" + userID + "' AND roomid = '" + roomID + "'") == false) // The virtual room does exist, and the virtual user hasn't got it in the list already { if (dbClient.getInt("SELECT COUNT(userid) FROM users_favourites WHERE userid = '" + userID + "'") < Config.Navigator_Favourites_maxRooms) dbClient.runQuery("INSERT INTO users_favourites (userid,roomid) VALUES ('" + userID + "','" + roomID + "')"); else sendData("@a" + "nav_error_toomanyfavrooms"); } } break; } case "@T": // Navigator - remove room from favourite rooms list { int roomID = Encoding.decodeVL64(currentPacket.Substring(3)); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("DELETE FROM users_favourites WHERE userid = '" + userID + "' AND roomid = '" + roomID + "' LIMIT 1"); } break; } #endregion #region Room event actions case "EA": // Events - get setup sendData("Ep" + Encoding.encodeVL64(eventManager.categoryAmount)); break; case "EY": // Events - show/hide 'Host event' button if (_inPublicroom || roomUser == null || _hostsEvent) // In publicroom, not in room at all or already hosting event sendData("Eo" + "H"); // Hide else sendData("Eo" + "I"); // Show break; case "D{": // Events - check if event category is OK { int categoryID = Encoding.decodeVL64(currentPacket.Substring(2)); if (eventManager.categoryOK(categoryID)) sendData("Eb" + Encoding.encodeVL64(categoryID)); break; } case "E^": // Events - open category { int categoryID = Encoding.decodeVL64(currentPacket.Substring(2)); if (categoryID >= 1 && categoryID <= 11) sendData("Eq" + Encoding.encodeVL64(categoryID) + eventManager.getEvents(categoryID)); break; } case "EZ": // Events - create event { if (_isOwner && _hostsEvent == false && _inPublicroom == false && roomUser != null) { int categoryID = Encoding.decodeVL64(currentPacket.Substring(2)); if (eventManager.categoryOK(categoryID)) { int categoryLength = Encoding.encodeVL64(categoryID).Length; int nameLength = Encoding.decodeB64(currentPacket.Substring(categoryLength + 2, 2)); string Name = currentPacket.Substring(categoryLength + 4, nameLength); string Description = currentPacket.Substring(categoryLength + nameLength + 6); _hostsEvent = true; eventManager.createEvent(categoryID, userID, _roomID, Name, Description); Room.sendData("Er" + eventManager.getEvent(_roomID)); } } break; } case @"E\": // Events - edit event { if (_hostsEvent && _isOwner && _inPublicroom == false && roomUser != null) { int categoryID = Encoding.decodeVL64(currentPacket.Substring(2)); if (eventManager.categoryOK(categoryID)) { int categoryLength = Encoding.encodeVL64(categoryID).Length; int nameLength = Encoding.decodeB64(currentPacket.Substring(categoryLength + 2, 2)); string Name = currentPacket.Substring(categoryLength + 4, nameLength); string Description = currentPacket.Substring(categoryLength + nameLength + 6); eventManager.editEvent(categoryID, _roomID, Name, Description); Room.sendData("Er" + eventManager.getEvent(_roomID)); } } break; } case "E[": // Events - end event { if (_hostsEvent && _isOwner && _inPublicroom == false && roomUser != null) { _hostsEvent = false; eventManager.removeEvent(_roomID); Room.sendData("Er" + "-1"); } break; } #endregion #region Guestroom create and modify case "@]": // Create guestroom - phase 1 { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if (dbClient.getInt("SELECT COUNT(id) FROM rooms WHERE owner = '" + _Username + "'") < Config.Navigator_createRoom_maxRooms) { string[] roomSettings = currentPacket.Split('/'); roomSettings[2] = stringManager.filterSwearwords(roomSettings[2]); roomSettings[3] = roomSettings[3].Substring(6, 1); roomSettings[4] = roomManager.getRoomState(roomSettings[4]).ToString(); if (roomSettings[5] != "0" && roomSettings[5] != "1") return; dbClient.AddParamWithValue("rs2", roomSettings[2]); dbClient.AddParamWithValue("user", _Username); dbClient.AddParamWithValue("rs3", roomSettings[3]); dbClient.AddParamWithValue("rs4", roomSettings[4]); dbClient.AddParamWithValue("rs5", roomSettings[5]); dbClient.runQuery("INSERT INTO rooms (name, owner, model, state, showname) VALUES (@rs2,@user,@rs3,@rs4,@rs5)"); string roomID = dbClient.getString("SELECT MAX(id) FROM rooms WHERE owner = @user"); sendData("@{" + roomID + Convert.ToChar(13) + roomSettings[2]); } else sendData("@a" + "Error creating a private room"); } break; } case "@Y": // Create guestroom - phase 2 / modify guestroom { int roomID = 0; if (currentPacket.Substring(2, 1) == "/") roomID = int.Parse(currentPacket.Split('/')[1]); else roomID = int.Parse(currentPacket.Substring(2).Split('/')[0]); string superUsers = "0"; int maxVisitors = 25; string[] packetContent = currentPacket.Split(Convert.ToChar(13)); string roomDescription = ""; string roomPassword = ""; for (int i = 1; i < packetContent.Length; i++) // More proper way, thanks Jeax { string updHeader = packetContent[i].Split('=')[0]; string updValue = packetContent[i].Substring(updHeader.Length + 1); switch (updHeader) { case "description": roomDescription = stringManager.filterSwearwords(updValue); break; case "allsuperuser": superUsers = updValue; if (superUsers != "0" && superUsers != "1") superUsers = "0"; break; case "maxvisitors": maxVisitors = int.Parse(updValue); if (maxVisitors < 10 || maxVisitors > 50) maxVisitors = 25; break; case "password": roomPassword = updValue; break; default: return; } } using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("desc", roomDescription); dbClient.AddParamWithValue("super", superUsers); dbClient.AddParamWithValue("max", maxVisitors); dbClient.AddParamWithValue("pass", roomPassword); dbClient.AddParamWithValue("id", roomID); dbClient.AddParamWithValue("owner", _Username); dbClient.runQuery("UPDATE rooms SET description = @desc,superusers = @super,visitors_max = @max, password = @pass WHERE id = @id AND owner = @owner LIMIT 1"); } break; } case "@X": // Modify guestroom, save name, state and show/hide ownername { string[] packetContent = currentPacket.Substring(2).Split('/'); if (packetContent[3] != "1" && packetContent[2] != "0") packetContent[2] = "1"; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("name", stringManager.filterSwearwords(packetContent[1])); dbClient.AddParamWithValue("state", roomManager.getRoomState(packetContent[2])); dbClient.AddParamWithValue("show", packetContent[3]); dbClient.AddParamWithValue("id", packetContent[0]); dbClient.AddParamWithValue("owner", _Username); dbClient.runQuery("UPDATE rooms SET name = @name,state = @state,showname = @show WHERE id = @id AND owner = @owner LIMIT 1"); } break; } case "BX": // Navigator - trigger guestroom modify { int roomID = Encoding.decodeVL64(currentPacket.Substring(2)); string roomCategory; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { roomCategory = dbClient.getString("SELECT category FROM rooms WHERE id = '" + roomID + "' AND owner = '" + _Username + "'"); } if (roomCategory != "") sendData("C^" + Encoding.encodeVL64(roomID) + Encoding.encodeVL64(int.Parse(roomCategory))); break; } case "BY": // Navigator - edit category of a guestroom { int roomID = Encoding.decodeVL64(currentPacket.Substring(2)); int cataID = Encoding.decodeVL64(currentPacket.Substring(Encoding.encodeVL64(roomID).Length + 2)); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if (dbClient.findsResult("SELECT id FROM room_categories WHERE id = '" + cataID + "' AND type = '2' AND parent > 0 AND access_rank_min <= " + _Rank)) // Category is valid for this user dbClient.runQuery("UPDATE rooms SET category = '" + cataID + "' WHERE id = '" + roomID + "' AND owner = '" + _Username + "' LIMIT 1"); } break; } case "@W": // Guestroom - Delete { int roomID = int.Parse(currentPacket.Substring(2)); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if (dbClient.findsResult("SELECT id FROM rooms WHERE id = '" + roomID + "' AND owner = '" + _Username + "'") == true) { dbClient.runQuery("DELETE FROM room_rights WHERE roomid = '" + roomID + "'"); dbClient.runQuery("DELETE FROM rooms WHERE id = '" + roomID + "' LIMIT 1"); dbClient.runQuery("DELETE FROM users_favourites WHERE roomid = '" + _roomID + "'"); dbClient.runQuery("DELETE FROM room_votes WHERE roomid = '" + roomID + "'"); dbClient.runQuery("DELETE FROM room_bans WHERE roomid = '" + roomID + "' LIMIT 1"); dbClient.runQuery("DELETE FROM furniture WHERE roomid = '" + roomID + "'"); dbClient.runQuery("DELETE FROM furniture_moodlight WHERE roomid = '" + roomID + "'"); } } if (roomManager.containsRoom(roomID) == true) { roomManager.getRoom(roomID).kickUsers(byte.Parse("9"), "This room has been deleted"); } break; } case "BZ": // Navigator - 'Who's in here' feature for public rooms { int roomID = Encoding.decodeVL64(currentPacket.Substring(2)); if (roomManager.containsRoom(roomID)) sendData("C_" + roomManager.getRoom(roomID).Userlist); else sendData("C_"); break; } #endregion #region Enter/leave room - Preferences case "@u": // Rooms - Leave room { if (Room != null && roomUser != null) Room.removeUser(roomUser.roomUID, false, ""); else { if (gamePlayer != null) leaveGame(); } abortTrade(); break; } case "Bv": // Enter room - loading screen advertisement { Config.Rooms_LoadAvertisement_img = ""; if (Config.Rooms_LoadAvertisement_img == "") sendData("DB0"); else sendData("DB" + Config.Rooms_LoadAvertisement_img + Convert.ToChar(9) + Config.Rooms_LoadAvertisement_uri); } break; case "@B": // Enter room - determine room and check state + max visitors override { int roomID = Encoding.decodeVL64(currentPacket.Substring(3)); bool isPublicroom = (currentPacket.Substring(2, 1) == "A"); sendData("@S"); sendData("Bf" + "http://www.sunnieday.nl/"); if (gamePlayer != null && gamePlayer.Game != null) { if (gamePlayer.enteringGame) { Room.removeUser(roomUser.roomUID, false, ""); sendData("AE" + gamePlayer.Game.Lobby.Type + "_arena_" + gamePlayer.Game.mapID + " " + roomID); sendData("Cs" + gamePlayer.Game.getMap()); string s = gamePlayer.Game.getMap(); } else leaveGame(); } else { if (Room != null && roomUser != null) Room.removeUser(roomUser.roomUID, false, ""); if (_teleporterID == 0) { bool allowEnterLockedRooms = rankManager.containsRight(_Rank, "fuse_enter_locked_rooms", userID); int accessLevel; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { accessLevel = dbClient.getInt("SELECT state FROM rooms WHERE id = '" + roomID + "'"); } if (accessLevel == 3 && _clubMember == false && allowEnterLockedRooms == false) // Room is only for club subscribers and the user isn't club and hasn't got the fuseright for entering all rooms nomatter the state { sendData("C`" + "Kc"); return; } else if (accessLevel == 4 && allowEnterLockedRooms == false) // The room is only for staff and the user hasn't got the fuseright for entering all rooms nomatter the state { sendData("BK" + stringManager.getString("room_stafflocked")); return; } int nowVisitors; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { nowVisitors = dbClient.getInt("SELECT SUM(visitors_now) FROM rooms WHERE id = '" + roomID + "'"); if (nowVisitors > 0) { int maxVisitors = dbClient.getInt("SELECT SUM(visitors_max) FROM rooms WHERE id = '" + roomID + "'"); if (nowVisitors >= maxVisitors && rankManager.containsRight(_Rank, "fuse_enter_full_rooms", userID) == false) { if (isPublicroom == false) sendData("C`" + "I"); else sendData("BK" + stringManager.getString("room_full")); return; } } } } _roomID = roomID; _inPublicroom = isPublicroom; _ROOMACCESS_PRIMARY_OK = true; if (isPublicroom) { string roomModel; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { roomModel = dbClient.getString("SELECT model FROM rooms WHERE id = '" + roomID + "'"); } sendData("AE" + roomModel + " " + roomID); _ROOMACCESS_SECONDARY_OK = true; } } break; } case "@v": // Enter room - guestroom - enter room by using a teleporter { sendData("@S"); break; } case "@y": // Enter room - guestroom - check roomban/password/doorbell { if (_inPublicroom == false) { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { _isOwner = dbClient.findsResult("SELECT id FROM rooms WHERE id = '" + _roomID + "' AND owner = '" + _Username + "'"); if (_isOwner == false) _hasRights = dbClient.findsResult("SELECT userid FROM room_rights WHERE roomid = '" + _roomID + "' AND userid = '" + userID + "'"); if (_hasRights == false) _hasRights = dbClient.findsResult("SELECT id FROM rooms WHERE id = '" + _roomID + "' AND superusers = '1'"); if (_teleporterID == 0 && _isOwner == false && rankManager.containsRight(_Rank, "fuse_enter_locked_rooms", userID) == false) { int accessFlag = dbClient.getInt("SELECT state FROM rooms WHERE id = '" + _roomID + "'"); if (_ROOMACCESS_PRIMARY_OK == false && accessFlag != 2) { return; } // Check for roombans if (dbClient.findsResult("SELECT roomid FROM room_bans WHERE roomid = '" + _roomID + "' AND userid = '" + userID + "'")) { DateTime banExpireMoment = DateTime.Parse(dbClient.getString("SELECT ban_expire FROM room_bans WHERE roomid = '" + _roomID + "' AND userid = '" + userID + "'")); if (DateTime.Compare(banExpireMoment, DateTime.Now) > 0) { sendData("C`" + "PA"); sendData("@R"); return; } else dbClient.runQuery("DELETE FROM room_bans WHERE roomid = '" + _roomID + "' AND userid = '" + userID + "' LIMIT 1"); } if (accessFlag == 1) // Doorbell { if (roomManager.containsRoom(_roomID) == false) { sendData("BC"); return; } else { roomManager.getRoom(_roomID).sendDataToRights("A[" + _Username); sendData("A["); return; } } else if (accessFlag == 2) // Password { string givenPassword = ""; try { givenPassword = currentPacket.Split('/')[1]; } catch { } string roomPassword = dbClient.getString("SELECT password FROM rooms WHERE id = '" + _roomID + "'"); if (givenPassword != roomPassword) { sendData("@a" + "Incorrect flat password"); /*dbClient.Close();*/ return; } } } _ROOMACCESS_SECONDARY_OK = true; sendData("@i"); } } break; } case "Ab": // Answer guestroom doorbell { if (_hasRights == false && rankManager.containsRight(roomUser.User._Rank, "fuse_enter_locked_rooms", userID)) return; string ringer = currentPacket.Substring(4, Encoding.decodeB64(currentPacket.Substring(2, 2))); bool letIn = currentPacket.Substring(currentPacket.Length - 1) == "A"; virtualUser ringerData = userManager.getUser(ringer); if (ringerData == null) return; if (ringerData._roomID != _roomID) return; if (letIn) { ringerData._ROOMACCESS_SECONDARY_OK = true; Room.sendDataToRights("@i" + ringer + Convert.ToChar(2)); ringerData.sendData("@i"); } else { ringerData.sendData("BC"); ringerData._roomID = 0; ringerData._inPublicroom = false; ringerData._ROOMACCESS_PRIMARY_OK = false; ringerData._ROOMACCESS_SECONDARY_OK = false; ringerData._isOwner = false; ringerData._hasRights = false; ringerData.Room = null; ringerData.roomUser = null; } break; } case "@{": // Enter room - guestroom - guestroom only data: model, landscape, wallpaper, rights, room votes { if (_ROOMACCESS_SECONDARY_OK && _inPublicroom == false) { DataRow dRow; string Landscape; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dRow = dbClient.getRow("SELECT model, wallpaper, floor FROM rooms WHERE id = '" + _roomID + "'"); Landscape = dbClient.getString("SELECT landscape FROM rooms WHERE id = '" + _roomID + "'"); } string Model = "model_" + Convert.ToString(dRow["model"]); sendData("AE" + Model + " " + _roomID); int Wallpaper = Convert.ToInt32(dRow["wallpaper"]); int Floor = Convert.ToInt32(dRow["floor"]); sendData("@n" + "landscape/" + Landscape.Replace(",", ".")); if (Wallpaper > 0) sendData("@n" + "wallpaper/" + Wallpaper); if (Floor > 0) sendData("@n" + "floor/" + Floor); if (_isOwner == false) { _isOwner = rankManager.containsRight(_Rank, "fuse_any_room_controller", userID); } if (_isOwner) { _hasRights = true; sendData("@o"); } if (_hasRights) sendData("@j"); int voteAmount = -1; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if (dbClient.findsResult("SELECT userid FROM room_votes WHERE userid = '" + userID + "' AND roomid = '" + _roomID + "'")) { voteAmount = dbClient.getInt("SELECT SUM(vote) FROM room_votes WHERE roomid = '" + _roomID + "'"); if (voteAmount < 0) { voteAmount = 0; } } } sendData("EY" + Encoding.encodeVL64(voteAmount)); sendData("Er" + eventManager.getEvent(_roomID)); } break; } case "A~": // Enter room - get room advertisement { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if (_inPublicroom && dbClient.findsResult("SELECT roomid FROM room_ads WHERE roomid = '" + _roomID + "'")) { DataRow dRow = dbClient.getRow("SELECT img, uri FROM room_ads WHERE roomid = '" + _roomID + "'"); string advImg = Convert.ToString(dRow["img"]); string advUri = Convert.ToString(dRow["uri"]); sendData("CP" + advImg + Convert.ToChar(9) + advUri); } else sendData("CP" + "0"); } break; } case "@|": // Enter room - get roomclass + get heightmap { if (_ROOMACCESS_SECONDARY_OK) { if (roomManager.containsRoom(_roomID)) Room = roomManager.getRoom(_roomID); else { Room = new virtualRoom(_roomID, _inPublicroom); roomManager.addRoom(_roomID, Room); } sendData("@_" + Room.Heightmap); sendData(@"@\" + Room.dynamicUnits); } else { if (gamePlayer != null && gamePlayer.enteringGame && gamePlayer.teamID != -1 && gamePlayer.Game != null) { sendData("@_" + gamePlayer.Game.Heightmap); sendData("Cs" + gamePlayer.Game.getPlayers()); string s = gamePlayer.Game.getPlayers(); } gamePlayer.enteringGame = false; } break; } case "@}": // Enter room - get items { if (_ROOMACCESS_SECONDARY_OK && Room != null) { sendData("@^" + Room.PublicroomItems); sendData("@`" + Room.Flooritems); } break; } case "@~": // Enter room - get group badges, optional skill levels in game lobbies and sprite index { if (_ROOMACCESS_SECONDARY_OK && Room != null) { sendData("Du" + Room.Groups); if (Room.Lobby != null) { sendData("Cg" + "H" + Room.Lobby.Rank.Title + Convert.ToChar(2) + Encoding.encodeVL64(Room.Lobby.Rank.minPoints) + Encoding.encodeVL64(Room.Lobby.Rank.maxPoints)); sendData("Cz" + Room.Lobby.playerRanks); } sendData("DiH"); if (_receivedSpriteIndex == false) { sendData("Dg" + @"[SEshelves_norjaX~Dshelves_polyfonYmAshelves_siloXQHtable_polyfon_smallYmAchair_polyfonZbBtable_norja_medY_Itable_silo_medX~Dtable_plasto_4legY_Itable_plasto_roundY_Itable_plasto_bigsquareY_Istand_polyfon_zZbBchair_siloX~Dsofa_siloX~Dcouch_norjaX~Dchair_norjaX~Dtable_polyfon_medYmAdoormat_loveZbBdoormat_plainZ[Msofachair_polyfonX~Dsofa_polyfonZ[Msofachair_siloX~Dchair_plastyX~Dchair_plastoYmAtable_plasto_squareY_Ibed_polyfonX~Dbed_polyfon_one[dObed_trad_oneYmAbed_tradYmAbed_silo_oneYmAbed_silo_twoYmAtable_silo_smallX~Dbed_armas_twoYmAbed_budget_oneXQHbed_budgetXQHshelves_armasYmAbench_armasYmAtable_armasYmAsmall_table_armasZbBsmall_chair_armasYmAfireplace_armasYmAlamp_armasYmAbed_armas_oneYmAcarpet_standardY_Icarpet_armasYmAcarpet_polarY_Ifireplace_polyfonY_Itable_plasto_4leg*1Y_Itable_plasto_bigsquare*1Y_Itable_plasto_round*1Y_Itable_plasto_square*1Y_Ichair_plasto*1YmAcarpet_standard*1Y_Idoormat_plain*1Z[Mtable_plasto_4leg*2Y_Itable_plasto_bigsquare*2Y_Itable_plasto_round*2Y_Itable_plasto_square*2Y_Ichair_plasto*2YmAdoormat_plain*2Z[Mcarpet_standard*2Y_Itable_plasto_4leg*3Y_Itable_plasto_bigsquare*3Y_Itable_plasto_round*3Y_Itable_plasto_square*3Y_Ichair_plasto*3YmAcarpet_standard*3Y_Idoormat_plain*3Z[Mtable_plasto_4leg*4Y_Itable_plasto_bigsquare*4Y_Itable_plasto_round*4Y_Itable_plasto_square*4Y_Ichair_plasto*4YmAcarpet_standard*4Y_Idoormat_plain*4Z[Mdoormat_plain*6Z[Mdoormat_plain*5Z[Mcarpet_standard*5Y_Itable_plasto_4leg*5Y_Itable_plasto_bigsquare*5Y_Itable_plasto_round*5Y_Itable_plasto_square*5Y_Ichair_plasto*5YmAtable_plasto_4leg*6Y_Itable_plasto_bigsquare*6Y_Itable_plasto_round*6Y_Itable_plasto_square*6Y_Ichair_plasto*6YmAtable_plasto_4leg*7Y_Itable_plasto_bigsquare*7Y_Itable_plasto_round*7Y_Itable_plasto_square*7Y_Ichair_plasto*7YmAtable_plasto_4leg*8Y_Itable_plasto_bigsquare*8Y_Itable_plasto_round*8Y_Itable_plasto_square*8Y_Ichair_plasto*8YmAtable_plasto_4leg*9Y_Itable_plasto_bigsquare*9Y_Itable_plasto_round*9Y_Itable_plasto_square*9Y_Ichair_plasto*9YmAcarpet_standard*6Y_Ichair_plasty*1X~DpizzaYmAdrinksYmAchair_plasty*2X~Dchair_plasty*3X~Dchair_plasty*4X~Dbar_polyfonY_Iplant_cruddyYmAbottleYmAbardesk_polyfonX~Dbardeskcorner_polyfonX~DfloortileHbar_armasY_Ibartable_armasYmAbar_chair_armasYmAcarpet_softZ@Kcarpet_soft*1Z@Kcarpet_soft*2Z@Kcarpet_soft*3Z@Kcarpet_soft*4Z@Kcarpet_soft*5Z@Kcarpet_soft*6Z@Kred_tvY_Iwood_tvYmAcarpet_polar*1Y_Ichair_plasty*5X~Dcarpet_polar*2Y_Icarpet_polar*3Y_Icarpet_polar*4Y_Ichair_plasty*6X~Dtable_polyfonYmAsmooth_table_polyfonYmAsofachair_polyfon_girlX~Dbed_polyfon_girl_one[dObed_polyfon_girlX~Dsofa_polyfon_girlZ[Mbed_budgetb_oneXQHbed_budgetbXQHplant_pineappleYmAplant_fruittreeY_Iplant_small_cactusY_Iplant_bonsaiY_Iplant_big_cactusY_Iplant_yukkaY_Icarpet_standard*7Y_Icarpet_standard*8Y_Icarpet_standard*9Y_Icarpet_standard*aY_Icarpet_standard*bY_Iplant_sunflowerY_Iplant_roseY_Itv_luxusY_IbathZ\BsinkY_ItoiletYmAduckYmAtileYmAtoilet_redYmAtoilet_yellYmAtile_redYmAtile_yellYmApresent_gen[~Npresent_gen1[~Npresent_gen2[~Npresent_gen3[~Npresent_gen4[~Npresent_gen5[~Npresent_gen6[~Nbar_basicY_Ishelves_basicXQHsoft_sofachair_norjaX~Dsoft_sofa_norjaX~Dlamp_basicXQHlamp2_armasYmAfridgeY_IdoorYc[doorBYc[doorCYc[pumpkinYmAskullcandleYmAdeadduckYmAdeadduck2YmAdeadduck3YmAmenorahYmApuddingYmAhamYmAturkeyYmAxmasduckY_IhouseYmAtriplecandleYmAtree3YmAtree4YmAtree5X~Dham2YmAwcandlesetYmArcandlesetYmAstatueYmAheartY_IvaleduckYmAheartsofaX~DthroneYmAsamovarY_IgiftflowersY_IhabbocakeYmAhologramYmAeasterduckY_IbunnyYmAbasketY_IbirdieYmAediceX~Dclub_sofaZ[Mprize1YmAprize2YmAprize3YmAdivider_poly3X~Ddivider_arm1YmAdivider_arm2YmAdivider_arm3YmAdivider_nor1X~Ddivider_silo1X~Ddivider_nor2X~Ddivider_silo2Z[Mdivider_nor3X~Ddivider_silo3X~DtypingmachineYmAspyroYmAredhologramYmAcameraHjoulutahtiYmAhyacinth1YmAhyacinth2YmAchair_plasto*10YmAchair_plasto*11YmAbardeskcorner_polyfon*12X~Dbardeskcorner_polyfon*13X~Dchair_plasto*12YmAchair_plasto*13YmAchair_plasto*14YmAtable_plasto_4leg*14Y_ImocchamasterY_Icarpet_legocourtYmAbench_legoYmAlegotrophyYmAvalentinescreenYmAedicehcYmArare_daffodil_rugYmArare_beehive_bulbY_IhcsohvaYmAhcammeYmArare_elephant_statueYmArare_fountainY_Irare_standYmArare_globeYmArare_hammockYmArare_elephant_statue*1YmArare_elephant_statue*2YmArare_fountain*1Y_Irare_fountain*2Y_Irare_fountain*3Y_Irare_beehive_bulb*1Y_Irare_beehive_bulb*2Y_Irare_xmas_screenY_Irare_parasol*1XMVrare_parasol*2XMVrare_parasol*3XMVtree1X~Dtree2ZmBwcandleYxBrcandleYxBsoft_jaggara_norjaYmAhouse2YmAdjesko_turntableYmAmd_sofaZ[Mmd_limukaappiY_Itable_plasto_4leg*10Y_Itable_plasto_4leg*15Y_Itable_plasto_bigsquare*14Y_Itable_plasto_bigsquare*15Y_Itable_plasto_round*14Y_Itable_plasto_round*15Y_Itable_plasto_square*14Y_Itable_plasto_square*15Y_Ichair_plasto*15YmAchair_plasty*7X~Dchair_plasty*8X~Dchair_plasty*9X~Dchair_plasty*10X~Dchair_plasty*11X~Dchair_plasto*16YmAtable_plasto_4leg*16Y_Ihockey_scoreY_Ihockey_lightYmAdoorDYc[prizetrophy2*3Yd[prizetrophy3*3Yd[prizetrophy4*3Yd[prizetrophy5*3Yd[prizetrophy6*3Yd[prizetrophy*1Yd[prizetrophy2*1Yd[prizetrophy3*1Yd[prizetrophy4*1Yd[prizetrophy5*1Yd[prizetrophy6*1Yd[prizetrophy*2Yd[prizetrophy2*2Yd[prizetrophy3*2Yd[prizetrophy4*2Yd[prizetrophy5*2Yd[prizetrophy6*2Yd[prizetrophy*3Yd[rare_parasol*0XMVhc_lmp[fBhc_tblYmAhc_chrYmAhc_dskXQHnestHpetfood1ZvCpetfood2ZvCpetfood3ZvCwaterbowl*4XICwaterbowl*5XICwaterbowl*2XICwaterbowl*1XICwaterbowl*3XICtoy1XICtoy1*1XICtoy1*2XICtoy1*3XICtoy1*4XICgoodie1Yc[goodie1*1Yc[goodie1*2Yc[goodie2Yc[prizetrophy7*3Yd[prizetrophy7*1Yd[prizetrophy7*2Yd[scifiport*0Y_Iscifiport*9Y_Iscifiport*8Y_Iscifiport*7Y_Iscifiport*6Y_Iscifiport*5Y_Iscifiport*4Y_Iscifiport*3Y_Iscifiport*2Y_Iscifiport*1Y_Iscifirocket*9Y_Iscifirocket*8Y_Iscifirocket*7Y_Iscifirocket*6Y_Iscifirocket*5Y_Iscifirocket*4Y_Iscifirocket*3Y_Iscifirocket*2Y_Iscifirocket*1Y_Iscifirocket*0Y_Iscifidoor*10Y_Iscifidoor*9Y_Iscifidoor*8Y_Iscifidoor*7Y_Iscifidoor*6Y_Iscifidoor*5Y_Iscifidoor*4Y_Iscifidoor*3Y_Iscifidoor*2Y_Iscifidoor*1Y_Ipillow*5YmApillow*8YmApillow*0YmApillow*1YmApillow*2YmApillow*7YmApillow*9YmApillow*4YmApillow*6YmApillow*3YmAmarquee*1Y_Imarquee*2Y_Imarquee*7Y_Imarquee*aY_Imarquee*8Y_Imarquee*9Y_Imarquee*5Y_Imarquee*4Y_Imarquee*6Y_Imarquee*3Y_Iwooden_screen*1Y_Iwooden_screen*2Y_Iwooden_screen*7Y_Iwooden_screen*0Y_Iwooden_screen*8Y_Iwooden_screen*5Y_Iwooden_screen*9Y_Iwooden_screen*4Y_Iwooden_screen*6Y_Iwooden_screen*3Y_Ipillar*6Y_Ipillar*1Y_Ipillar*9Y_Ipillar*0Y_Ipillar*8Y_Ipillar*2Y_Ipillar*5Y_Ipillar*4Y_Ipillar*7Y_Ipillar*3Y_Irare_dragonlamp*4Y_Irare_dragonlamp*0Y_Irare_dragonlamp*5Y_Irare_dragonlamp*2Y_Irare_dragonlamp*8Y_Irare_dragonlamp*9Y_Irare_dragonlamp*7Y_Irare_dragonlamp*6Y_Irare_dragonlamp*1Y_Irare_dragonlamp*3Y_Irare_icecream*1Y_Irare_icecream*7Y_Irare_icecream*8Y_Irare_icecream*2Y_Irare_icecream*6Y_Irare_icecream*9Y_Irare_icecream*3Y_Irare_icecream*0Y_Irare_icecream*4Y_Irare_icecream*5Y_Irare_fan*7YxBrare_fan*6YxBrare_fan*9YxBrare_fan*3YxBrare_fan*0YxBrare_fan*4YxBrare_fan*5YxBrare_fan*1YxBrare_fan*8YxBrare_fan*2YxBqueue_tile1*3X~Dqueue_tile1*6X~Dqueue_tile1*4X~Dqueue_tile1*9X~Dqueue_tile1*8X~Dqueue_tile1*5X~Dqueue_tile1*7X~Dqueue_tile1*2X~Dqueue_tile1*1X~Dqueue_tile1*0X~DticketHrare_snowrugX~Dcn_lampZxIcn_sofaYmAsporttrack1*1YmAsporttrack1*3YmAsporttrack1*2YmAsporttrack2*1[~Nsporttrack2*2[~Nsporttrack2*3[~Nsporttrack3*1YmAsporttrack3*2YmAsporttrack3*3YmAfootylampX~Dbarchair_siloX~Ddivider_nor4*4X~Dtraffic_light*1ZxItraffic_light*2ZxItraffic_light*3ZxItraffic_light*4ZxItraffic_light*6ZxIrubberchair*1X~Drubberchair*2X~Drubberchair*3X~Drubberchair*4X~Drubberchair*5X~Drubberchair*6X~Dbarrier*1X~Dbarrier*2X~Dbarrier*3X~Drubberchair*7X~Drubberchair*8X~Dtable_norja_med*2Y_Itable_norja_med*3Y_Itable_norja_med*4Y_Itable_norja_med*5Y_Itable_norja_med*6Y_Itable_norja_med*7Y_Itable_norja_med*8Y_Itable_norja_med*9Y_Icouch_norja*2X~Dcouch_norja*3X~Dcouch_norja*4X~Dcouch_norja*5X~Dcouch_norja*6X~Dcouch_norja*7X~Dcouch_norja*8X~Dcouch_norja*9X~Dshelves_norja*2X~Dshelves_norja*3X~Dshelves_norja*4X~Dshelves_norja*5X~Dshelves_norja*6X~Dshelves_norja*7X~Dshelves_norja*8X~Dshelves_norja*9X~Dchair_norja*2X~Dchair_norja*3X~Dchair_norja*4X~Dchair_norja*5X~Dchair_norja*6X~Dchair_norja*7X~Dchair_norja*8X~Dchair_norja*9X~Ddivider_nor1*2X~Ddivider_nor1*3X~Ddivider_nor1*4X~Ddivider_nor1*5X~Ddivider_nor1*6X~Ddivider_nor1*7X~Ddivider_nor1*8X~Ddivider_nor1*9X~Dsoft_sofa_norja*2X~Dsoft_sofa_norja*3X~Dsoft_sofa_norja*4X~Dsoft_sofa_norja*5X~Dsoft_sofa_norja*6X~Dsoft_sofa_norja*7X~Dsoft_sofa_norja*8X~Dsoft_sofa_norja*9X~Dsoft_sofachair_norja*2X~Dsoft_sofachair_norja*3X~Dsoft_sofachair_norja*4X~Dsoft_sofachair_norja*5X~Dsoft_sofachair_norja*6X~Dsoft_sofachair_norja*7X~Dsoft_sofachair_norja*8X~Dsoft_sofachair_norja*9X~Dsofachair_silo*2X~Dsofachair_silo*3X~Dsofachair_silo*4X~Dsofachair_silo*5X~Dsofachair_silo*6X~Dsofachair_silo*7X~Dsofachair_silo*8X~Dsofachair_silo*9X~Dtable_silo_small*2X~Dtable_silo_small*3X~Dtable_silo_small*4X~Dtable_silo_small*5X~Dtable_silo_small*6X~Dtable_silo_small*7X~Dtable_silo_small*8X~Dtable_silo_small*9X~Ddivider_silo1*2X~Ddivider_silo1*3X~Ddivider_silo1*4X~Ddivider_silo1*5X~Ddivider_silo1*6X~Ddivider_silo1*7X~Ddivider_silo1*8X~Ddivider_silo1*9X~Ddivider_silo3*2X~Ddivider_silo3*3X~Ddivider_silo3*4X~Ddivider_silo3*5X~Ddivider_silo3*6X~Ddivider_silo3*7X~Ddivider_silo3*8X~Ddivider_silo3*9X~Dtable_silo_med*2X~Dtable_silo_med*3X~Dtable_silo_med*4X~Dtable_silo_med*5X~Dtable_silo_med*6X~Dtable_silo_med*7X~Dtable_silo_med*8X~Dtable_silo_med*9X~Dsofa_silo*2X~Dsofa_silo*3X~Dsofa_silo*4X~Dsofa_silo*5X~Dsofa_silo*6X~Dsofa_silo*7X~Dsofa_silo*8X~Dsofa_silo*9X~Dsofachair_polyfon*2X~Dsofachair_polyfon*3X~Dsofachair_polyfon*4X~Dsofachair_polyfon*6X~Dsofachair_polyfon*7X~Dsofachair_polyfon*8X~Dsofachair_polyfon*9X~Dsofa_polyfon*2Z[Msofa_polyfon*3Z[Msofa_polyfon*4Z[Msofa_polyfon*6Z[Msofa_polyfon*7Z[Msofa_polyfon*8Z[Msofa_polyfon*9Z[Mbed_polyfon*2X~Dbed_polyfon*3X~Dbed_polyfon*4X~Dbed_polyfon*6X~Dbed_polyfon*7X~Dbed_polyfon*8X~Dbed_polyfon*9X~Dbed_polyfon_one*2[dObed_polyfon_one*3[dObed_polyfon_one*4[dObed_polyfon_one*6[dObed_polyfon_one*7[dObed_polyfon_one*8[dObed_polyfon_one*9[dObardesk_polyfon*2X~Dbardesk_polyfon*3X~Dbardesk_polyfon*4X~Dbardesk_polyfon*5X~Dbardesk_polyfon*6X~Dbardesk_polyfon*7X~Dbardesk_polyfon*8X~Dbardesk_polyfon*9X~Dbardeskcorner_polyfon*2X~Dbardeskcorner_polyfon*3X~Dbardeskcorner_polyfon*4X~Dbardeskcorner_polyfon*5X~Dbardeskcorner_polyfon*6X~Dbardeskcorner_polyfon*7X~Dbardeskcorner_polyfon*8X~Dbardeskcorner_polyfon*9X~Ddivider_poly3*2X~Ddivider_poly3*3X~Ddivider_poly3*4X~Ddivider_poly3*5X~Ddivider_poly3*6X~Ddivider_poly3*7X~Ddivider_poly3*8X~Ddivider_poly3*9X~Dchair_silo*2X~Dchair_silo*3X~Dchair_silo*4X~Dchair_silo*5X~Dchair_silo*6X~Dchair_silo*7X~Dchair_silo*8X~Dchair_silo*9X~Ddivider_nor3*2X~Ddivider_nor3*3X~Ddivider_nor3*4X~Ddivider_nor3*5X~Ddivider_nor3*6X~Ddivider_nor3*7X~Ddivider_nor3*8X~Ddivider_nor3*9X~Ddivider_nor2*2X~Ddivider_nor2*3X~Ddivider_nor2*4X~Ddivider_nor2*5X~Ddivider_nor2*6X~Ddivider_nor2*7X~Ddivider_nor2*8X~Ddivider_nor2*9X~Dsilo_studydeskX~Dsolarium_norjaY_Isolarium_norja*1Y_Isolarium_norja*2Y_Isolarium_norja*3Y_Isolarium_norja*5Y_Isolarium_norja*6Y_Isolarium_norja*7Y_Isolarium_norja*8Y_Isolarium_norja*9Y_IsandrugX~Drare_moonrugYmAchair_chinaYmAchina_tableYmAsleepingbag*1YmAsleepingbag*2YmAsleepingbag*3YmAsleepingbag*4YmAsafe_siloY_Isleepingbag*7YmAsleepingbag*9YmAsleepingbag*5YmAsleepingbag*10YmAsleepingbag*6YmAsleepingbag*8YmAchina_shelveX~Dtraffic_light*5ZxIdivider_nor4*2X~Ddivider_nor4*3X~Ddivider_nor4*5X~Ddivider_nor4*6X~Ddivider_nor4*7X~Ddivider_nor4*8X~Ddivider_nor4*9X~Ddivider_nor5*2X~Ddivider_nor5*3X~Ddivider_nor5*4X~Ddivider_nor5*5X~Ddivider_nor5*6X~Ddivider_nor5*7X~Ddivider_nor5*8X~Ddivider_nor5*9X~Ddivider_nor5X~Ddivider_nor4X~Dwall_chinaYmAcorner_chinaYmAbarchair_silo*2X~Dbarchair_silo*3X~Dbarchair_silo*4X~Dbarchair_silo*5X~Dbarchair_silo*6X~Dbarchair_silo*7X~Dbarchair_silo*8X~Dbarchair_silo*9X~Dsafe_silo*2Y_Isafe_silo*3Y_Isafe_silo*4Y_Isafe_silo*5Y_Isafe_silo*6Y_Isafe_silo*7Y_Isafe_silo*8Y_Isafe_silo*9Y_Iglass_shelfY_Iglass_chairY_Iglass_stoolY_Iglass_sofaY_Iglass_tableY_Iglass_table*2Y_Iglass_table*3Y_Iglass_table*4Y_Iglass_table*5Y_Iglass_table*6Y_Iglass_table*7Y_Iglass_table*8Y_Iglass_table*9Y_Iglass_chair*2Y_Iglass_chair*3Y_Iglass_chair*4Y_Iglass_chair*5Y_Iglass_chair*6Y_Iglass_chair*7Y_Iglass_chair*8Y_Iglass_chair*9Y_Iglass_sofa*2Y_Iglass_sofa*3Y_Iglass_sofa*4Y_Iglass_sofa*5Y_Iglass_sofa*6Y_Iglass_sofa*7Y_Iglass_sofa*8Y_Iglass_sofa*9Y_Iglass_stool*2Y_Iglass_stool*4Y_Iglass_stool*5Y_Iglass_stool*6Y_Iglass_stool*7Y_Iglass_stool*8Y_Iglass_stool*3Y_Iglass_stool*9Y_ICF_10_coin_goldZvCCF_1_coin_bronzeZvCCF_20_moneybagZvCCF_50_goldbarZvCCF_5_coin_silverZvChc_crptYmAhc_tvZ\BgothgateX~DgothiccandelabraYxBgothrailingX~Dgoth_tableYmAhc_bkshlfYmAhc_btlrY_Ihc_crtnYmAhc_djsetYmAhc_frplcZbBhc_lmpstYmAhc_machineYmAhc_rllrXQHhc_rntgnX~Dhc_trllYmAgothic_chair*1X~Dgothic_sofa*1X~Dgothic_stool*1X~Dgothic_chair*2X~Dgothic_sofa*2X~Dgothic_stool*2X~Dgothic_chair*3X~Dgothic_sofa*3X~Dgothic_stool*3X~Dgothic_chair*4X~Dgothic_sofa*4X~Dgothic_stool*4X~Dgothic_chair*5X~Dgothic_sofa*5X~Dgothic_stool*5X~Dgothic_chair*6X~Dgothic_sofa*6X~Dgothic_stool*6X~Dval_cauldronX~Dsound_machineX~Dromantique_pianochair*3Y_Iromantique_pianochair*5Y_Iromantique_pianochair*2Y_Iromantique_pianochair*4Y_Iromantique_pianochair*1Y_Iromantique_divan*3Y_Iromantique_divan*5Y_Iromantique_divan*2Y_Iromantique_divan*4Y_Iromantique_divan*1Y_Iromantique_chair*3Y_Iromantique_chair*5Y_Iromantique_chair*2Y_Iromantique_chair*4Y_Iromantique_chair*1Y_Irare_parasolY_Iplant_valentinerose*3XICplant_valentinerose*5XICplant_valentinerose*2XICplant_valentinerose*4XICplant_valentinerose*1XICplant_mazegateYeCplant_mazeZcCplant_bulrushXICpetfood4Y_Icarpet_valentineZ|Egothic_carpetXICgothic_carpet2Z|Egothic_chairX~Dgothic_sofaX~Dgothic_stoolX~Dgrand_piano*3Z|Egrand_piano*5Z|Egrand_piano*2Z|Egrand_piano*4Z|Egrand_piano*1Z|Etheatre_seatZ@Kromantique_tray2Y_Iromantique_tray1Y_Iromantique_smalltabl*3Y_Iromantique_smalltabl*5Y_Iromantique_smalltabl*2Y_Iromantique_smalltabl*4Y_Iromantique_smalltabl*1Y_Iromantique_mirrortablY_Iromantique_divider*3Z[Mromantique_divider*2Z[Mromantique_divider*4Z[Mromantique_divider*1Z[Mjp_tatami2[dWjp_tatamiYGGhabbowood_chairYGGjp_bambooYGGjp_iroriXQHjp_pillowYGGsound_set_1[dWsound_set_2[dWsound_set_3[dWsound_set_4[dWsound_set_5[dWsound_set_6[dWsound_set_7[dWsound_set_8[dWsound_set_9[dWsound_machine*1Yc[spotlightY_Isound_machine*2Yc[sound_machine*3Yc[sound_machine*4Yc[sound_machine*5Yc[sound_machine*6Yc[sound_machine*7Yc[rom_lampZ|Erclr_sofaXQHrclr_gardenXQHrclr_chairZ|Esound_set_28[dWsound_set_27[dWsound_set_26[dWsound_set_25[dWsound_set_24[dWsound_set_23[dWsound_set_22[dWsound_set_21[dWsound_set_20[dWsound_set_19[dWsound_set_18[dWsound_set_17[dWsound_set_16[dWsound_set_15[dWsound_set_14[dWsound_set_13[dWsound_set_12[dWsound_set_11[dWsound_set_10[dWrope_dividerXQHromantique_clockY_Irare_icecream_campaignY_Ipura_mdl5*1Yc[pura_mdl5*2Yc[pura_mdl5*3Yc[pura_mdl5*4Yc[pura_mdl5*5Yc[pura_mdl5*6Yc[pura_mdl5*7Yc[pura_mdl5*8Yc[pura_mdl5*9Yc[pura_mdl4*1XQHpura_mdl4*2XQHpura_mdl4*3XQHpura_mdl4*4XQHpura_mdl4*5XQHpura_mdl4*6XQHpura_mdl4*7XQHpura_mdl4*8XQHpura_mdl4*9XQHpura_mdl3*1XQHpura_mdl3*2XQHpura_mdl3*3XQHpura_mdl3*4XQHpura_mdl3*5XQHpura_mdl3*6XQHpura_mdl3*7XQHpura_mdl3*8XQHpura_mdl3*9XQHpura_mdl2*1XQHpura_mdl2*2XQHpura_mdl2*3XQHpura_mdl2*4XQHpura_mdl2*5XQHpura_mdl2*6XQHpura_mdl2*7XQHpura_mdl2*8XQHpura_mdl2*9XQHpura_mdl1*1XQHpura_mdl1*2XQHpura_mdl1*3XQHpura_mdl1*4XQHpura_mdl1*5XQHpura_mdl1*6XQHpura_mdl1*7XQHpura_mdl1*8XQHpura_mdl1*9XQHjp_lanternXQHchair_basic*1XQHchair_basic*2XQHchair_basic*3XQHchair_basic*4XQHchair_basic*5XQHchair_basic*6XQHchair_basic*7XQHchair_basic*8XQHchair_basic*9XQHbed_budget*1XQHbed_budget*2XQHbed_budget*3XQHbed_budget*4XQHbed_budget*5XQHbed_budget*6XQHbed_budget*7XQHbed_budget*8XQHbed_budget*9XQHbed_budget_one*1XQHbed_budget_one*2XQHbed_budget_one*3XQHbed_budget_one*4XQHbed_budget_one*5XQHbed_budget_one*6XQHbed_budget_one*7XQHbed_budget_one*8XQHbed_budget_one*9XQHjp_drawerXQHtile_stellaZ[Mtile_marbleZ[Mtile_brownZ[Msummer_grill*1Y_Isummer_grill*2Y_Isummer_grill*3Y_Isummer_grill*4Y_Isummer_chair*1Y_Isummer_chair*2Y_Isummer_chair*3Y_Isummer_chair*4Y_Isummer_chair*5Y_Isummer_chair*6Y_Isummer_chair*7Y_Isummer_chair*8Y_Isummer_chair*9Y_Isound_set_36[dWsound_set_35[dWsound_set_34[dWsound_set_33[dWsound_set_32[dWsound_set_31[dWsound_set_30[dWsound_set_29[dWsound_machine_proYc[rare_mnstrY_Ione_way_door*1XQHone_way_door*2XQHone_way_door*3XQHone_way_door*4XQHone_way_door*5XQHone_way_door*6XQHone_way_door*7XQHone_way_door*8XQHone_way_door*9XQHexe_rugZ[Mexe_s_tableZGRsound_set_37[dWsummer_pool*1ZlIsummer_pool*2ZlIsummer_pool*3ZlIsummer_pool*4ZlIsong_diskYc[jukebox*1Yc[carpet_soft_tut[~Nsound_set_44[dWsound_set_43[dWsound_set_42[dWsound_set_41[dWsound_set_40[dWsound_set_39[dWsound_set_38[dWgrunge_chairZ@Kgrunge_mattressZ@Kgrunge_radiatorZ@Kgrunge_shelfZ@Kgrunge_signZ@Kgrunge_tableZ@Khabboween_crypt[uKhabboween_grassZ@Khal_cauldronZ@Khal_graveZ@Ksound_set_52[dWsound_set_51[dWsound_set_50[dWsound_set_49[dWsound_set_48[dWsound_set_47[dWsound_set_46[dWsound_set_45[dWxmas_icelampZ[Mxmas_cstl_wallZ[Mxmas_cstl_twrZ[Mxmas_cstl_gate[~Ntree7Z[Mtree6Z[Msound_set_54[dWsound_set_53[dWsafe_silo_pb[dOplant_mazegate_snowZ[Mplant_maze_snowZ[Mchristmas_sleighZ[Mchristmas_reindeer[~Nchristmas_poopZ[Mexe_bardeskZ[Mexe_chairZ[Mexe_chair2Z[Mexe_cornerZ[Mexe_drinksZ[Mexe_sofaZ[Mexe_tableZ[Msound_set_59[dWsound_set_58[dWsound_set_57[dWsound_set_56[dWsound_set_55[dWnoob_table*1[~Nnoob_table*2[~Nnoob_table*3[~Nnoob_table*4[~Nnoob_table*5[~Nnoob_table*6[~Nnoob_stool*1[~Nnoob_stool*2[~Nnoob_stool*3[~Nnoob_stool*4[~Nnoob_stool*5[~Nnoob_stool*6[~Nnoob_rug*1[~Nnoob_rug*2[~Nnoob_rug*3[~Nnoob_rug*4[~Nnoob_rug*5[~Nnoob_rug*6[~Nnoob_lamp*1[dOnoob_lamp*2[dOnoob_lamp*3[dOnoob_lamp*4[dOnoob_lamp*5[dOnoob_lamp*6[dOnoob_chair*1[~Nnoob_chair*2[~Nnoob_chair*3[~Nnoob_chair*4[~Nnoob_chair*5[~Nnoob_chair*6[~Nexe_globe[~Nexe_plantZ[Mval_teddy*1[dOval_teddy*2[dOval_teddy*3[dOval_teddy*4[dOval_teddy*5[dOval_teddy*6[dOval_randomizer[dOval_choco[dOteleport_doorYc[sound_set_61[dWsound_set_60[dWfortune[dOsw_tableZIPsw_raven[cQsw_chestZIPsand_cstl_wallZIPsand_cstl_twrZIPsand_cstl_gateZIPgrunge_candleZIPgrunge_benchZIPgrunge_barrelZIPrclr_lampZGRprizetrophy9*1Yd[prizetrophy8*1Yd[nouvelle_traxYc[md_rugZGRjp_tray6ZGRjp_tray5ZGRjp_tray4ZGRjp_tray3ZGRjp_tray2ZGRjp_tray1ZGRarabian_teamkZGRarabian_snakeZGRarabian_rugZGRarabian_pllwZGRarabian_divdrZGRarabian_chairZGRarabian_bigtbZGRarabian_tetblZGRarabian_tray1ZGRarabian_tray2ZGRarabian_tray3ZGRarabian_tray4ZGRsound_set_64[dWsound_set_63[dWsound_set_62[dWjukebox_ptv*1Yc[calippoZAStraxsilverYc[traxgoldYc[traxbronzeYc[bench_puffetYATCFC_500_goldbarZvCCFC_200_moneybagZvCCFC_10_coin_bronzeZvCCFC_100_coin_goldZvCCFC_50_coin_silverZvCjp_tableXMVjp_rareXMVjp_katana3XMVjp_katana2XMVjp_katana1XMVfootylamp_campaignXMVtiki_waterfall[dWtiki_tray4[dWtiki_tray3[dWtiki_tray2[dWtiki_tray1[dWtiki_tray0[dWtiki_toucan[dWtiki_torch[dWtiki_statue[dWtiki_sand[dWtiki_parasol[dWtiki_junglerug[dWtiki_corner[dWtiki_bflies[dWtiki_bench[dWtiki_bardesk[dWtampax_rug[dWsound_set_70[dWsound_set_69[dWsound_set_68[dWsound_set_67[dWsound_set_66[dWsound_set_65[dWnoob_rug_tradeable*1[dWnoob_rug_tradeable*2[dWnoob_rug_tradeable*3[dWnoob_rug_tradeable*4[dWnoob_rug_tradeable*5[dWnoob_rug_tradeable*6[dWnoob_plant[dWnoob_lamp_tradeable*1[dWnoob_lamp_tradeable*2[dWnoob_lamp_tradeable*3[dWnoob_lamp_tradeable*4[dWnoob_lamp_tradeable*5[dWnoob_lamp_tradeable*6[dWnoob_chair_tradeable*1[dWnoob_chair_tradeable*2[dWnoob_chair_tradeable*3[dWnoob_chair_tradeable*4[dWnoob_chair_tradeable*5[dWnoob_chair_tradeable*6[dWjp_teamaker[dWsvnr_uk[`_svnr_nlXhXsvnr_itXhXsvnr_de[gXsvnr_aus[gXdiner_tray_7[gXdiner_tray_6[gXdiner_tray_5[gXdiner_tray_4[gXdiner_tray_3[gXdiner_tray_2[gXdiner_tray_1[gXdiner_tray_0[gXdiner_sofa_2*1[gXdiner_sofa_2*2[gXdiner_sofa_2*3[gXdiner_sofa_2*4[gXdiner_sofa_2*5[gXdiner_sofa_2*6[gXdiner_sofa_2*7[gXdiner_sofa_2*8[gXdiner_sofa_2*9[gXdiner_shaker[gXdiner_rug[gXdiner_gumvendor*1[gXdiner_gumvendor*2[gXdiner_gumvendor*3[gXdiner_gumvendor*4[gXdiner_gumvendor*5[gXdiner_gumvendor*6[gXdiner_gumvendor*7[gXdiner_gumvendor*8[gXdiner_gumvendor*9[gXdiner_cashreg*1[gXdiner_cashreg*2[gXdiner_cashreg*3[gXdiner_cashreg*4[gXdiner_cashreg*5[gXdiner_cashreg*6[gXdiner_cashreg*7[gXdiner_cashreg*8[gXdiner_cashreg*9[gXdiner_table_2*1XiZdiner_table_2*2diner_table_2*2XiZdiner_table_2*3XiZdiner_table_2*4XiZdiner_table_2*5XiZdiner_table_2*6XiZdiner_table_2*7XiZdiner_table_2*8XiZdiner_table_2*9XiZdiner_table_1*1XiZdiner_table_1*2XiZdiner_table_1*3XiZdiner_table_1*4XiZdiner_table_1*5XiZdiner_table_1*6XiZdiner_table_1*7XiZdiner_table_1*8XiZdiner_table_1*9XiZdiner_sofa_1*1XiZdiner_sofa_1*2XiZdiner_sofa_1*3XiZdiner_sofa_1*4XiZdiner_sofa_1*5XiZdiner_sofa_1*6XiZdiner_sofa_1*7XiZdiner_sofa_1*8XiZdiner_sofa_1*9XiZdiner_chair*1XiZdiner_chair*2XiZdiner_chair*3XiZdiner_chair*4XiZdiner_chair*5XiZdiner_chair*6XiZdiner_chair*7XiZdiner_chair*8XiZdiner_chair*9XiZdiner_bardesk_gate*1XiZdiner_bardesk_gate*2XiZdiner_bardesk_gate*3XiZdiner_bardesk_gate*4XiZdiner_bardesk_gate*5XiZdiner_bardesk_gate*6XiZdiner_bardesk_gate*7XiZdiner_bardesk_gate*8XiZdiner_bardesk_gate*9XiZdiner_bardesk_corner*1XiZdiner_bardesk_corner*2XiZdiner_bardesk_corner*3XiZdiner_bardesk_corner*4XiZdiner_bardesk_corner*5XiZdiner_bardesk_corner*6XiZdiner_bardesk_corner*7XiZdiner_bardesk_corner*8XiZdiner_bardesk_corner*9XiZdiner_bardesk*1XiZdiner_bardesk*2XiZdiner_bardesk*3XiZdiner_bardesk*4XiZdiner_bardesk*5XiZdiner_bardesk*6XiZdiner_bardesk*7XiZdiner_bardesk*8XiZdiner_bardesk*9XiZads_dave_cnsXiZeasy_carpetYc[easy_bowl2Yc[greek_cornerYc[greek_gateYc[greek_pillarsYc[greek_seatYc[greektrophy*1[P\greektrophy*2[P\greektrophy*3[P\greek_blockXt[hcc_tableY`]hcc_shelfY`]hcc_sofaY`]hcc_minibarY`]hcc_chairY`]det_dividerY`]netari_carpetY`]det_bodyY`]hcc_stoolY`]hcc_sofachairY`]hcc_crnrXw]hcc_dvdrXw]sob_carpet[`_igor_seat[`_ads_igorbrainY_aads_igorswitchY_aads_711*1Y_aads_711*2Y_aads_711*3Y_aads_711*4Y_aads_igorraygunY_ahween08_sinkY[chween08_curtainY[chween08_bathY[chween08_defibsY[chween08_bbagY[chween08_curtain2Y[chween08_defibs2Y[chween08_bedY[chween08_sink2Y[chween08_bed2Y[chween08_bath2Y[chween08_manholeY[chween08_trllY[cPRpost.itHpost.it.vdHphotoHChessHTicTacToeHBattleShipHPokerHwallpaperHfloorHposterZ@KgothicfountainYxBhc_wall_lampZbBindustrialfanZ`BtorchZ\Bval_heartXBCwallmirrorZ|Ejp_ninjastarsXQHhabw_mirrorXQHhabbowheelZ[Mguitar_skullZ@Kguitar_vZ@Kxmas_light[~Nhrella_poster_3[Nhrella_poster_2ZIPhrella_poster_1[Nsw_swordsZIPsw_stoneZIPsw_holeZIProomdimmerYc[md_logo_wallZGRmd_canZGRjp_sheet3ZGRjp_sheet2ZGRjp_sheet1ZGRarabian_swordsZGRarabian_wndwZGRtiki_wallplnt[dWtiki_surfboard[dWtampax_wall[dWwindow_single_default[gXwindow_double_default[gXnoob_window_double[dWwindow_triple[gXwindow_square[gXwindow_romantic_wide[gXwindow_romantic_narrow[gXwindow_grunge[gXwindow_golden[gXwindow_chinese_wide[gXwindow_chinese_narrowYA\window_basic[gXwindow_70s_wide[gXwindow_70s_narrow[gXads_sunnydYlXwindow_diner2XiZwindow_dinerXiZdiner_walltableXiZads_dave_wallXiZwindow_holeYc[easy_posterYc[ads_nokia_logoYc[ads_nokia_phoneYc[landscapeXV^window_skyscraper[j\netari_posterY`]det_bholeY`]ads_campguitarXw]hween08_radY[chween08_wndwbY[chween08_wndwY[chween08_bioY[chw_08_xrayY[c"); _receivedSpriteIndex = true; } } break; } case "@": // Enter room - guestroom - get wallitems { if (_ROOMACCESS_SECONDARY_OK && Room != null) sendData("@m" + Room.Wallitems); break; } case "A@": // Enter room - add this user to room { if (_ROOMACCESS_SECONDARY_OK && Room != null && roomUser == null) { if (!sentSettings) { StringBuilder sb = new StringBuilder("BK:followme = Stalking friends\r\r"); if (followEnabled) sb.Append(stringManager.getString("follow_enabled") + "\r"); else sb.Append(stringManager.getString("follow_disabled") + "\r"); sb.Append("\rThis notice will only appear once per session."); sendData(sb.ToString()); sentSettings = true; } sendData("@b" + Room.dynamicStatuses); Room.addUser(this); } break; } #endregion #region Moderation - Preferences #region MOD-Tool - Preferences case "CH": // MOD-Tool { int messageLength = 0; string Message = ""; int staffNoteLength = 0; string staffNote = ""; string targetUser = ""; switch (currentPacket.Substring(2, 2)) // Select the action { #region Alert single user case "HH": // Alert single user { if (rankManager.containsRight(_Rank, "fuse_alert", userID) == false) { sendData("BK" + stringManager.getString("modtool_accesserror")); return; } messageLength = Encoding.decodeB64(currentPacket.Substring(4, 2)); Message = currentPacket.Substring(6, messageLength).Replace(Convert.ToChar(1).ToString(), " "); staffNoteLength = Encoding.decodeB64(currentPacket.Substring(messageLength + 6, 2)); staffNote = currentPacket.Substring(messageLength + 8, staffNoteLength); targetUser = currentPacket.Substring(messageLength + staffNoteLength + 10); if (Message == "" || targetUser == "") return; virtualUser _targetUser = userManager.getUser(targetUser); if (_targetUser == null) sendData("BK" + stringManager.getString("modtool_actionfail") + "\r" + stringManager.getString("modtool_usernotfound")); else { _targetUser.sendData("B!" + Message + Convert.ToChar(2)); staffManager.addStaffMessage("alert", userID, _targetUser.userID, Message, staffNote); } break; } #endregion #region Kick single user from room case "HI": // Kick single user from room { if (rankManager.containsRight(_Rank, "fuse_kick", userID) == false) { sendData("BK" + stringManager.getString("modtool_accesserror")); return; } messageLength = Encoding.decodeB64(currentPacket.Substring(4, 2)); Message = currentPacket.Substring(6, messageLength).Replace(Convert.ToChar(1).ToString(), " "); staffNoteLength = Encoding.decodeB64(currentPacket.Substring(messageLength + 6, 2)); staffNote = currentPacket.Substring(messageLength + 8, staffNoteLength); targetUser = currentPacket.Substring(messageLength + staffNoteLength + 10); if (Message == "" || targetUser == "") return; virtualUser _targetUser = userManager.getUser(targetUser); if (_targetUser == null) sendData("BK" + stringManager.getString("modtool_actionfail") + "\r" + stringManager.getString("modtool_usernotfound")); else { if (_targetUser.Room != null && _targetUser.roomUser != null) { if (_targetUser._Rank < _Rank) { _targetUser.Room.removeUser(_targetUser.roomUser.roomUID, true, Message); staffManager.addStaffMessage("kick", userID, _targetUser.userID, Message, staffNote); } else sendData("BK" + stringManager.getString("modtool_actionfail") + "\r" + stringManager.getString("modtool_rankerror")); } } break; } #endregion #region Ban single user case "HJ": // Ban single user / IP { if (rankManager.containsRight(_Rank, "fuse_ban", userID) == false) { sendData("BK" + stringManager.getString("modtool_accesserror")); return; } int targetUserLength = 0; int banHours = 0; bool banIP = (currentPacket.Substring(currentPacket.Length - 1, 1) == "I"); messageLength = Encoding.decodeB64(currentPacket.Substring(4, 2)); Message = currentPacket.Substring(6, messageLength).Replace(Convert.ToChar(1).ToString(), " "); staffNoteLength = Encoding.decodeB64(currentPacket.Substring(messageLength + 6, 2)); staffNote = currentPacket.Substring(messageLength + 8, staffNoteLength); targetUserLength = Encoding.decodeB64(currentPacket.Substring(messageLength + staffNoteLength + 8, 2)); targetUser = currentPacket.Substring(messageLength + staffNoteLength + 10, targetUserLength); banHours = Encoding.decodeVL64(currentPacket.Substring(messageLength + staffNoteLength + targetUserLength + 10)); if (Message == "" || targetUser == "" || banHours == 0) return; else { DataRow dRow; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("name", targetUser); dRow = dbClient.getRow("SELECT id,rank,ipaddress_last FROM users WHERE name = @name"); } if (dRow.Table.Rows.Count == 0) { sendData("BK" + stringManager.getString("modtool_actionfail") + "\r" + stringManager.getString("modtool_usernotfound")); return; } else if (Convert.ToByte(dRow["rank"]) >= _Rank) { sendData("BK" + stringManager.getString("modtool_actionfail") + "\r" + stringManager.getString("modtool_rankerror")); return; } int targetID = Convert.ToInt32(dRow["id"]); string Report = ""; staffManager.addStaffMessage("ban", userID, targetID, Message, staffNote); if (banIP && rankManager.containsRight(_Rank, "fuse_superban", userID)) // IP ban is chosen and allowed for this staff member { userManager.setBan(Convert.ToString(dRow["ipaddress_last"]), banHours, Message); Report = userManager.generateBanReport(Convert.ToString(dRow["ipaddress_last"])); } else { userManager.setBan(targetID, banHours, Message); Report = userManager.generateBanReport(targetID); } sendData("BK" + Report); } break; } #endregion #region Room alert case "IH": // Alert all users in current room { if (rankManager.containsRight(_Rank, "fuse_room_alert", userID) == false) { sendData("BK" + stringManager.getString("modtool_accesserror")); return; } if (Room == null || roomUser == null) { return; } messageLength = Encoding.decodeB64(currentPacket.Substring(4, 2)); Message = currentPacket.Substring(6, messageLength).Replace(Convert.ToChar(1).ToString(), " "); staffNoteLength = Encoding.decodeB64(currentPacket.Substring(messageLength + 6, 2)); staffNote = currentPacket.Substring(messageLength + 8, staffNoteLength); if (Message != "") { Room.sendData("B!" + Message + Convert.ToChar(2)); staffManager.addStaffMessage("ralert", userID, _roomID, Message, staffNote); } break; } #endregion #region Room kick case "II": // Kick all users below users rank from room { if (rankManager.containsRight(_Rank, "fuse_room_kick", userID) == false) { sendData("BK" + stringManager.getString("modtool_accesserror")); return; } if (Room == null || roomUser == null) { return; } messageLength = Encoding.decodeB64(currentPacket.Substring(4, 2)); Message = currentPacket.Substring(6, messageLength).Replace(Convert.ToChar(1).ToString(), " "); staffNoteLength = Encoding.decodeB64(currentPacket.Substring(messageLength + 6, 2)); staffNote = currentPacket.Substring(messageLength + 8, staffNoteLength); if (Message != "") { Room.kickUsers(_Rank, Message); staffManager.addStaffMessage("rkick", userID, _roomID, Message, staffNote); } break; } #endregion } break; } #endregion #region Call For Help - Preferences #region User Side - Preferences case "Cm": // User wants to send a CFH message { DataRow dRow; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dRow = dbClient.getRow("SELECT id, date, message FROM cms_help WHERE username = '******' AND picked_up = '0'"); } if (dRow.Table.Rows.Count == 0) sendData("D" + "H"); else sendData("D" + "I" + Convert.ToString(dRow[0]) + Convert.ToChar(2) + Convert.ToString(dRow[1]) + Convert.ToChar(2) + Convert.ToString(dRow[2]) + Convert.ToChar(2)); break; } case "Cn": // User deletes his pending CFH message { int cfhID; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { cfhID = dbClient.getInt("SELECT id FROM cms_help WHERE username = '******' AND picked_up = '0'"); dbClient.runQuery("DELETE FROM cms_help WHERE picked_up = '0' AND username = '******' LIMIT 1"); } sendData("DH"); userManager.sendToRank(Config.Minimum_CFH_Rank, true, "BT" + Encoding.encodeVL64(cfhID) + Convert.ToChar(2) + "I" + "User Deleted!" + Convert.ToChar(2) + "User Deleted!" + Convert.ToChar(2) + "User Deleted!" + Convert.ToChar(2) + Encoding.encodeVL64(0) + Convert.ToChar(2) + "" + Convert.ToChar(2) + "H" + Convert.ToChar(2) + Encoding.encodeVL64(0)); break; } case "AV": // User sends CFH message { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if (dbClient.findsResult("SELECT id FROM cms_help WHERE username = '******' AND picked_up = '0'") == true) return; } int messageLength = Encoding.decodeB64(currentPacket.Substring(2, 2)); if (messageLength == 0) return; string cfhMessage = currentPacket.Substring(4, messageLength); int cfhID; string roomName; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("username", _Username); dbClient.AddParamWithValue("ip", connectionSocket.RemoteEndPoint.ToString().Split(Char.Parse(":"))[0]); dbClient.AddParamWithValue("message", cfhMessage); dbClient.AddParamWithValue("date", DateTime.Now); dbClient.AddParamWithValue("roomid", _roomID.ToString()); dbClient.runQuery("INSERT INTO cms_help (username,ip,message,date,picked_up,subject,roomid) VALUES (@username,@ip,@message,@date,'0','CFH message [hotel]',@roomid)"); cfhID = dbClient.getInt("SELECT id FROM cms_help WHERE username = @username AND picked_up = '0'"); roomName = dbClient.getString("SELECT name FROM rooms WHERE id = @roomid");// H = Hide Room ID / I = Show Room ID } sendData("EAH"); // \_/ \_/ userManager.sendToRank(Config.Minimum_CFH_Rank, true, "BT" + Encoding.encodeVL64(cfhID) + Convert.ToChar(2) + "I" + "Sent: " + DateTime.Now + Convert.ToChar(2) + _Username + Convert.ToChar(2) + cfhMessage + Convert.ToChar(2) + Encoding.encodeVL64(_roomID) + Convert.ToChar(2) + roomName + Convert.ToChar(2) + "I" + Convert.ToChar(2) + Encoding.encodeVL64(_roomID)); break; } #endregion #region Staff Side case "CG": // CFH center - reply call { if (rankManager.containsRight(_Rank, "fuse_receive_calls_for_help", userID) == false) return; int cfhID = Encoding.decodeVL64(currentPacket.Substring(4, Encoding.decodeB64(currentPacket.Substring(2, 2)))); string cfhReply = currentPacket.Substring(Encoding.decodeB64(currentPacket.Substring(2, 2)) + 6); string toUserName; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { toUserName = dbClient.getString("SELECT username FROM cms_help WHERE id = '" + cfhID + "'"); } if (toUserName == null) sendData("BK" + stringManager.getString("cfh_fail")); else { int toUserID = userManager.getUserID(toUserName); virtualUser toVirtualUser = userManager.getUser(toUserID); if (toVirtualUser._isLoggedIn) { toVirtualUser.sendData("DR" + cfhReply + Convert.ToChar(2)); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE cms_help SET picked_up = '" + _Username + "' WHERE id = '" + cfhID + "' LIMIT 1"); } } } break; } case "CF": // CFH center - Delete (Downgrade) { if (rankManager.containsRight(_Rank, "fuse_receive_calls_for_help", userID) == false) return; int cfhID = Encoding.decodeVL64(currentPacket.Substring(4, Encoding.decodeB64(currentPacket.Substring(2, 2)))); DataRow dRow; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dRow = dbClient.getRow("SELECT picked_up FROM cms_help WHERE id = '" + cfhID + "'"); } if (dRow.Table.Columns.Count == 0) { return; } else { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("DELETE FROM cms_help WHERE id = '" + cfhID + "' LIMIT 1"); } userManager.sendToRank(Config.Minimum_CFH_Rank, true, "BT" + Encoding.encodeVL64(cfhID) + Convert.ToChar(2) + "H" + "Staff Deleted!" + Convert.ToChar(2) + "Staff Deleted!" + Convert.ToChar(2) + "Staff Deleted!" + Convert.ToChar(2) + "H" + Convert.ToChar(2) + Convert.ToChar(2) + "H" + Convert.ToChar(2) + "H"); } break; } case "@p": // CFH center - Pickup { int cfhID = Encoding.decodeVL64(currentPacket.Substring(4)); bool result; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { result = dbClient.findsResult("SELECT id FROM cms_help WHERE id = '" + cfhID + "'"); } if (result == false) { sendData("BK" + stringManager.getString("cfh_deleted")); return; } DataRow dRow; string roomName; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dRow = dbClient.getRow("SELECT picked_up,username,message,roomid FROM cms_help WHERE id = '" + cfhID + "'"); roomName = dbClient.getString("SELECT name FROM rooms WHERE id = '" + Convert.ToString(dRow[3]) + "'"); } if (Convert.ToString(dRow[0]) == "1") sendData("BK" + stringManager.getString("cfh_picked_up")); else userManager.sendToRank(Config.Minimum_CFH_Rank, true, "BT" + Encoding.encodeVL64(cfhID) + Convert.ToChar(2) + "I" + "Picked up: " + DateTime.Now + Convert.ToChar(2) + Convert.ToString(dRow[1]) + Convert.ToChar(2) + Convert.ToString(dRow[2]) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow[3])) + Convert.ToChar(2) + roomName + Convert.ToChar(2) + "I" + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow[3]))); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE cms_help SET picked_up = '1' WHERE id = '" + cfhID + "' LIMIT 1"); } break; } case "EC": // Go to the room that the call for help was sent from { if (rankManager.containsRight(_Rank, "fuse_receive_calls_for_help", userID) == false) return; int idLength = Encoding.decodeB64(currentPacket.Substring(2, 2)); int cfhID = Encoding.decodeVL64(currentPacket.Substring(4, idLength)); int roomID; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { roomID = dbClient.getInt("SELECT roomid FROM cms_help WHERE id = '" + cfhID + "'"); } if (roomID == 0) return; virtualRoom room = roomManager.getRoom(roomID); if (room.isPublicroom) sendData("D^" + "I" + Encoding.encodeVL64(roomID)); else sendData("D^" + "H" + Encoding.encodeVL64(roomID)); break; } #endregion #endregion #endregion #region In-room actions - Preferences #region Misc - Preferences //case "cI": // Ignore Habbo // { // if (Room != null && roomUser != null && statusManager.containsStatus("sit") == true && statusManager.containsStatus("lay") == true) // { // statusManager.dropCarrydItem(); // if (currentPacket.Length == 2) // statusManager.addStatus("ignore", ""); // statusManager.Refresh(); // } // break; // } case "AO": // Room - rotate user { if (Room != null && roomUser != null && statusManager.containsStatus("sit") == false && statusManager.containsStatus("lay") == false) { int X = int.Parse(currentPacket.Substring(2).Split(' ')[0]); int Y = int.Parse(currentPacket.Split(' ')[1]); roomUser.Z1 = Rooms.Pathfinding.Rotation.Calculate(roomUser.X, roomUser.Y, X, Y); roomUser.Z2 = roomUser.Z1; roomUser.Refresh(); } break; } case "AK": // Room - walk to a new square { if (Room != null && roomUser != null && roomUser.walkLock == false) { int goalX = Encoding.decodeB64(currentPacket.Substring(2, 2)); int goalY = Encoding.decodeB64(currentPacket.Substring(4, 2)); if (roomUser.SPECIAL_TELEPORTABLE) { roomUser.X = goalX; roomUser.Y = goalY; roomUser.goalX = -1; Room.Refresh(roomUser); refreshAppearance(false, false, true); } else { roomUser.goalX = goalX; roomUser.goalY = goalY; } } break; } case "As": // Room - click door to exit room { if (Room != null && roomUser != null && roomUser.walkDoor == false) { roomUser.walkDoor = true; roomUser.goalX = Room.doorX; roomUser.goalY = Room.doorY; } break; } case "At": // Room - select swimming outfit { if (Room != null || roomUser != null && Room.hasSwimmingPool) { virtualRoom.squareTrigger Trigger = Room.getTrigger(roomUser.X, roomUser.Y); if (Trigger.Object == "curtains1" || Trigger.Object == "curtains2") { roomUser.swimOutfit = currentPacket.Substring(2); Room.sendData(@"@\" + roomUser.detailsString); Room.sendSpecialCast(Trigger.Object, "open"); roomUser.walkLock = false; roomUser.goalX = Trigger.goalX; roomUser.goalY = Trigger.goalY; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("figure_swim", currentPacket.Substring(2)); dbClient.AddParamWithValue("id", userID); dbClient.runQuery("UPDATE users SET figure_swim = @figure_swim WHERE id = @id LIMIT 1"); } } } break; } case "B^": // Badges - switch or toggle on/off badge { if (Room != null && roomUser != null) { //Reset slots using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE users_badges SET slotid = '0' WHERE userid = '" + userID + "'"); } int enabledBadgeAmount = 0; string szWorkData = currentPacket.Substring(2); while (szWorkData != "") { int slotID = Encoding.decodeVL64(szWorkData); szWorkData = szWorkData.Substring(Encoding.encodeVL64(slotID).Length); int badgeNameLength = Encoding.decodeB64(szWorkData.Substring(0, 2)); if (badgeNameLength > 0) { string Badge = szWorkData.Substring(2, badgeNameLength); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE users_badges SET slotid = '" + slotID + "' WHERE userid = '" + userID + "' AND badgeid = '" + Badge + "' LIMIT 1"); // update slot } enabledBadgeAmount++; } szWorkData = szWorkData.Substring(badgeNameLength + 2); } // Active badges have their badge slot set now, other ones have '0' refreshBadges(); string szNotify = userID + Convert.ToChar(2).ToString() + Encoding.encodeVL64(enabledBadgeAmount); for (int x = 0; x < _Badges.Count; x++) { if (_badgeSlotIDs[x] > 0) // Badge enabled { szNotify += Encoding.encodeVL64(_badgeSlotIDs[x]); szNotify += _Badges[x]; szNotify += Convert.ToChar(2); } } Room.sendData("Cd" + szNotify); } break; } case "DG": // Tags - get tags of virtual user { int ownerID = Encoding.decodeVL64(currentPacket.Substring(2)); DataColumn dCol; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dCol = dbClient.getColumn("SELECT tag FROM cms_tags WHERE ownerid = '" + ownerID + "' LIMIT 20"); } StringBuilder List = new StringBuilder(Encoding.encodeVL64(ownerID) + Encoding.encodeVL64(dCol.Table.Rows.Count)); foreach (DataRow dRow in dCol.Table.Rows) List.Append(Convert.ToString(dRow["tag"]) + Convert.ToChar(2)); sendData("E^" + List.ToString()); break; } case "Cg": // Group badges - get details about a group [click badge] { if (Room != null && roomUser != null) { int groupID = Encoding.decodeVL64(currentPacket.Substring(2)); DataRow dRow; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dRow = dbClient.getRow("SELECT name,description,roomid FROM groups_details WHERE id = '" + groupID + "'"); } if (dRow.Table.Rows.Count == 1) { string roomName = ""; int roomID = Convert.ToInt32(dRow["roomid"]); if (roomID > 0) { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { roomName = dbClient.getString("SELECT name FROM rooms WHERE id = '" + roomID + "'"); } } else roomID = -1; sendData("Dw" + Encoding.encodeVL64(groupID) + Convert.ToString(dRow["name"]) + Convert.ToChar(2) + Convert.ToString(dRow["description"]) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow["roomid"])) + roomName + Convert.ToChar(2)); } } break; } case "AX": // Statuses - stop status { if (statusManager != null) { string Status = currentPacket.Substring(2); if (Status == "CarryItem") statusManager.dropCarrydItem(); else if (Status == "Dance") { statusManager.removeStatus("dance"); statusManager.Refresh(); } } break; } case "A^": // Statuses - wave { if (Room != null && roomUser != null && statusManager.containsStatus("wave") == false) { statusManager.removeStatus("dance"); statusManager.handleStatus("wave", "", Config.Statuses_Wave_waveDuration); } break; } case "A]": // Statuses - dance { if (Room != null && roomUser != null && statusManager.containsStatus("sit") == false && statusManager.containsStatus("lay") == false) { statusManager.dropCarrydItem(); if (currentPacket.Length == 2) statusManager.addStatus("dance", ""); else { if (rankManager.containsRight(_Rank, "fuse_use_club_dance", userID) == false) { return; } int danceID = Encoding.decodeVL64(currentPacket.Substring(2)); if (danceID < 0 || danceID > 4) { return; } statusManager.addStatus("dance", danceID.ToString()); } statusManager.Refresh(); } break; } case "AP": // Statuses - carry item { if (Room != null && roomUser != null) { string Item = currentPacket.Substring(2); if (statusManager.containsStatus("lay") || Item.Contains("/")) return; // THE HAX! \o/ try { int nItem = int.Parse(Item); if (nItem < 1 || nItem > 26) return; } catch { if (_inPublicroom == false && Item != "Water" && Item != "Milk" && Item != "Juice") // Not a drink that can be retrieved from the infobus minibar return; } statusManager.carryItem(Item); } break; } case "Ah": // Statuses - Lido Voting { if (Room != null && roomUser != null && statusManager.containsStatus("sit") == false && statusManager.containsStatus("lay") == false) { if (currentPacket.Length == 2) statusManager.addStatus("sign", ""); else { string signID = currentPacket.Substring(2); statusManager.handleStatus("sign", signID, Config.Statuses_Wave_waveDuration); } statusManager.Refresh(); } break; } #endregion #region Chat - Preferences case "@t": // Chat - say case "@w": // Chat - shout { try { if (_isMuted == false && (Room != null && roomUser != null)) { string Message = currentPacket.Substring(4); userManager.addChatMessage(_Username, _roomID, Message); Message = stringManager.filterSwearwords(Message); if (Message.Substring(0, 1) == ":" && isSpeechCommand(Message.Substring(1))) // Speechcommand invoked! { if (roomUser.isTyping) { Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "H"); roomUser.isTyping = false; } } else { if (currentPacket.Substring(1, 1) == "w") // Shout { Room.sendShout(roomUser, Message); } else { Room.sendSaying(roomUser, Message); } } } } catch (Exception e) { Out.WriteError(e.ToString()); } break; } case "@x": // Chat - whisper { if (_isMuted == false && Room != null && roomUser != null) { string Receiver = currentPacket.Substring(4).Split(' ')[0]; string Message = currentPacket.Substring(Receiver.Length + 5); userManager.addChatMessage(_Username, _roomID, Message); Message = stringManager.filterSwearwords(Message); Room.sendWhisper(roomUser, Receiver, Message); } break; } case "D}": // Chat - show speech bubble { if (_isMuted == false && Room != null && roomUser != null) { Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "I"); roomUser.isTyping = true; } break; } case "D~": // Chat - hide speech bubble { if (Room != null && roomUser != null) { Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "H"); roomUser.isTyping = false; } break; } #endregion #region Guestroom - rights, kicking, roombans and room voting case "A`": // Give rights { if (Room == null || roomUser == null || _inPublicroom || _isOwner == false) return; string Target = currentPacket.Substring(2); if (userManager.containsUser(Target) == false) return; virtualUser _Target = userManager.getUser(Target); if (_Target._roomID != _roomID || _Target._hasRights || _Target._isOwner) return; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { sendData("BK" + "You have sent " + _Target._Username + " rights in your room."); dbClient.runQuery("INSERT INTO room_rights(roomid,userid) VALUES ('" + _roomID + "','" + _Target.userID + "')"); } _Target._hasRights = true; _Target.statusManager.addStatus("flatctrl", "onlyfurniture"); _Target.roomUser.Refresh(); _Target.sendData("@j"); break; } case "Aa": // Take rights { if (Room == null || roomUser == null || _inPublicroom || _isOwner == false) return; string Target = currentPacket.Substring(2); if (userManager.containsUser(Target) == false) return; virtualUser _Target = userManager.getUser(Target); if (_Target._roomID != _roomID || _Target._hasRights == false || _Target._isOwner) return; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { sendData("BK" + "You have removed " + _Target._Username + "'s rights in your room."); dbClient.runQuery("DELETE FROM room_rights WHERE roomid = '" + _roomID + "' AND userid = '" + _Target.userID + "' LIMIT 1"); } _Target._hasRights = false; _Target.statusManager.removeStatus("flatctrl"); _Target.roomUser.Refresh(); _Target.sendData("@k"); break; } case "A_": // Kick user { if (Room == null || roomUser == null || _inPublicroom || _hasRights == false) return; string Target = currentPacket.Substring(2); if (userManager.containsUser(Target) == false) return; virtualUser _Target = userManager.getUser(Target); if (_Target._roomID != _roomID) return; if (_Target._isOwner || _Target._Rank > _Rank || rankManager.containsRight(_Target._Rank, "fuse_any_room_controller", userID)) return; _Target.roomUser.walkLock = true; _Target.roomUser.walkDoor = true; _Target.roomUser.goalX = Room.doorX; _Target.roomUser.goalY = Room.doorY; abortTrade(); break; } case "E@": // Kick and apply roomban { if (_hasRights == false || _inPublicroom || Room == null || roomUser == null) return; string Target = currentPacket.Substring(2); if (userManager.containsUser(Target) == false) return; virtualUser _Target = userManager.getUser(Target); if (_Target._roomID != _roomID) return; if (_Target._isOwner && (_Target._Rank > _Rank || rankManager.containsRight(_Target._Rank, "fuse_any_room_controller", userID))) return; string banExpireMoment = DateTime.Now.AddMinutes(Config.Rooms_roomBan_banDuration).ToString(); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("INSERT INTO room_bans (roomid,userid,ban_expire) VALUES ('" + _roomID + "','" + _Target.userID + "','" + banExpireMoment + "')"); } _Target.roomUser.walkLock = true; _Target.roomUser.walkDoor = true; _Target.roomUser.goalX = Room.doorX; _Target.roomUser.goalY = Room.doorY; abortTrade(); break; } case "DE": // Vote -1 or +1 on room { if (_inPublicroom || Room == null || roomUser == null) return; int Vote = Encoding.decodeVL64(currentPacket.Substring(2)); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if ((Vote == 1 || Vote == -1) && dbClient.findsResult("SELECT userid FROM room_votes WHERE userid = '" + userID + "' AND roomid = '" + _roomID + "'") == false) { dbClient.runQuery("INSERT INTO room_votes (userid,roomid,vote) VALUES ('" + userID + "','" + _roomID + "','" + Vote + "')"); int voteAmount = dbClient.getInt("SELECT SUM(vote) FROM room_votes WHERE roomid = '" + _roomID + "'"); if (voteAmount < 0) voteAmount = 0; roomUser.hasVoted = true; if (_isOwner == true) roomUser.Room.sendNewVoteAmount(voteAmount); } } break; } #endregion #region Catalogue and Recycler case "Ae": // Catalogue - open, retrieve index of pages { if (Room != null && roomUser != null) sendData("A~" + catalogueManager.getPageIndex(_Rank)); break; } case "Af": // Catalogue, open page, get page content { if (Room != null && roomUser != null) { string pageIndexName = currentPacket.Split('/')[1]; sendData("A" + catalogueManager.getPage(pageIndexName, _Rank)); } break; } #region buy catalogue case "Ad": // Catalogue - purchase { string[] packetContent = currentPacket.Split(Convert.ToChar(13)); string Page = packetContent[1]; string Item = packetContent[3]; string VarItem = packetContent[4]; int pageID; int templateID; int Cost; using (DatabaseClient dbClient1 = Eucalypt.dbManager.GetClient()) { dbClient1.AddParamWithValue("indexname", Page); dbClient1.AddParamWithValue("name_cct", Item); pageID = dbClient1.getInt("SELECT indexid FROM catalogue_pages WHERE indexname = @indexname AND minrank <= " + _Rank + "ORDER BY indexid"); templateID = dbClient1.getInt("SELECT tid FROM catalogue_items WHERE name_cct = @name_cct"); Cost = dbClient1.getInt("SELECT catalogue_cost FROM catalogue_items WHERE catalogue_id_page = '" + pageID + "' AND tid = '" + templateID + "'"); } if (Cost == 0 || Cost > _Credits) { sendData("AD"); return; } bool handlePresentbox = false; int receiverID = userID; int presentBoxID = 0; int roomID = 0; // -1 = present box, 0 = inhand if (packetContent[5] == "1") // Purchased as present { handlePresentbox = true; string receiverName = packetContent[6]; using (DatabaseClient dbClient2 = Eucalypt.dbManager.GetClient()) { dbClient2.AddParamWithValue("name", receiverName); if (receiverName != _Username) { int i = dbClient2.getInt("SELECT id FROM users WHERE name = @name LIMIT 1"); if (i > 0) receiverID = i; else { sendData("AL" + receiverName); return; } } } string boxSprite = "present_gen" + new Random().Next(1, 7); string boxTemplateID; using (DatabaseClient dbClient1 = Eucalypt.dbManager.GetClient()) { boxTemplateID = dbClient1.getString("SELECT tid FROM catalogue_items WHERE name_cct = '" + boxSprite + "'"); dbClient1.AddParamWithValue("tid", boxTemplateID); dbClient1.AddParamWithValue("ownerid", receiverID); dbClient1.AddParamWithValue("var", "!" + stringManager.filterSwearwords(packetContent[7])); dbClient1.runQuery("INSERT INTO furniture(tid,ownerid,var) VALUES (@tid,@ownerid,@var)"); presentBoxID = dbClient1.getInt("SELECT MAX(id) FROM furniture"); } roomID = -1; } _Credits -= Cost; sendData("@F" + _Credits); using (DatabaseClient dbClient1 = Eucalypt.dbManager.GetClient()) { dbClient1.runQuery("UPDATE users SET credits = '" + _Credits + "' WHERE id = '" + userID + "' LIMIT 1"); } if (stringManager.getStringPart(Item, 0, 4) == "deal") { int dealID = int.Parse(Item.Substring(4)); DataTable dTable; using (DatabaseClient dbClient1 = Eucalypt.dbManager.GetClient()) { dTable = dbClient1.getTable("SELECT tid,amount FROM catalogue_deals WHERE id = '" + dealID + "'"); } StringBuilder sb = new StringBuilder(); foreach (DataRow dRow in dTable.Rows) { for (int i = 0; i <= Convert.ToInt32(dRow["amount"]); i++) sb.Append(",('" + Convert.ToString(dRow["tid"]) + "','" + receiverID + "','" + roomID + "')"); using (DatabaseClient dbClient1 = Eucalypt.dbManager.GetClient()) { dbClient1.runQuery("INSERT INTO furniture(tid,ownerid,roomid) VALUES " + sb.ToString().Substring(1)); } for (int i = 0; i <= Convert.ToInt32(dRow["amount"]); i++) catalogueManager.handlePurchase(Convert.ToInt32(dRow["tid"]), receiverID, roomID, "0", presentBoxID, 0); } } else { int teleportid1 = 0; using (DatabaseClient dbClient1 = Eucalypt.dbManager.GetClient()) { dbClient1.runQuery("INSERT INTO furniture(tid,ownerid,roomid) VALUES ('" + templateID + "','" + receiverID + "','" + roomID + "' )"); teleportid1 = catalogueManager.lastItemID; } if (catalogueManager.getTemplate(templateID).Sprite == "wallpaper" || catalogueManager.getTemplate(templateID).Sprite == "floor" || catalogueManager.getTemplate(templateID).Sprite.Contains("landscape")) { string decorID = packetContent[4]; catalogueManager.handlePurchase(templateID, receiverID, 0, decorID, presentBoxID, 0); } else if ((stringManager.getStringPart(Item, 0, 11) == "greektrophy") || (stringManager.getStringPart(Item, 0, 11) == "prizetrophy")) { if (handlePresentbox == false) { using (DatabaseClient dbClient4 = Eucalypt.dbManager.GetClient()) { string vari = _Username + "\t" + DateTime.Today.ToShortDateString() + "\t" + stringManager.filterSwearwords(packetContent[4]); vari = vari.Replace(@"\", "\\").Replace("'", @"\'"); dbClient4.runQuery("UPDATE furniture SET var = '" + vari + "' WHERE id = '" + catalogueManager.lastItemID + "' LIMIT 1"); } } else { using (DatabaseClient dbClient4 = Eucalypt.dbManager.GetClient()) { string vari = _Username + "\t" + DateTime.Today.ToShortDateString() + "\t" + stringManager.filterSwearwords(packetContent[4]); vari = vari.Replace(@"\", "\\").Replace("'", @"\'"); dbClient4.runQuery("UPDATE furniture SET var = '" + vari + "' WHERE id = '" + catalogueManager.lastItemID + "' LIMIT 1"); dbClient4.runQuery("INSERT INTO furniture_presents(id,itemid) VALUES ('" + presentBoxID + "','" + teleportid1 + "')"); refreshHand("last"); break; } } } else catalogueManager.handlePurchase(templateID, receiverID, roomID, "0", presentBoxID, teleportid1); } if (receiverID == userID) refreshHand("last"); else if (userManager.containsUser(receiverID)) { userManager.getUser(receiverID); } break; } #endregion case "Ai": // Buy game-tickets { string args = currentPacket.Substring(2); int Amount = Encoding.decodeVL64(args.Substring(0, 3)); string Receiver = args.Substring(3); int Ticketamount = 0; int Price = 0; if (Amount == 1) // Look how much tickets you want { Ticketamount = 2; Price = 1; } else if (Amount == 2) // And again { Ticketamount = 20; Price = 6; } else // Wrong parameter return; if (Price > _Credits) // Enough credits? { sendData("AD"); return; } int ReceiverID; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("name", Receiver); ReceiverID = dbClient.getInt("SELECT id FROM users WHERE name = @name"); } if (!(ReceiverID > 0)) // Does the user exist? { sendData("AL" + Receiver); return; } _Credits -= Price; // New credit amount sendData("@F" + _Credits); // Send the new credits using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE users SET credits = '" + _Credits + "' WHERE id = '" + userID + "' LIMIT 1"); // Update receivers ticketamount dbClient.runQuery("UPDATE users SET tickets = tickets+" + Ticketamount + " WHERE id = '" + ReceiverID + "' LIMIT 1"); } if (userManager.containsUser(ReceiverID)) // Check or the user is online { virtualUser _Receiver = userManager.getUser(ReceiverID); // Get him/her _Receiver._Tickets = _Receiver._Tickets + Ticketamount; // Update ticketamount if (ReceiverID == userID) // Stop double kaching _Receiver.refreshValueables(false, true); // Kaching! else _Receiver.refreshValueables(true, true); // Kaching! } sendData("AC"); // Yey! Buying Successful break; } case "Ca": // Recycler - proceed input items { if (Config.enableRecycler == false || Room == null || recyclerManager.sessionExists(userID)) return; int itemCount = Encoding.decodeVL64(currentPacket.Substring(2)); if (recyclerManager.rewardExists(itemCount)) { recyclerManager.createSession(userID, itemCount); currentPacket = currentPacket.Substring(Encoding.encodeVL64(itemCount).ToString().Length + 2); for (int i = 0; i < itemCount; i++) { int itemID = Encoding.decodeVL64(currentPacket); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if (dbClient.findsResult("SELECT id FROM furniture WHERE ownerid = '" + userID + "' AND roomid = '0'")) { dbClient.runQuery("UPDATE furniture SET roomid = '-2' WHERE id = '" + itemID + "' LIMIT 1"); currentPacket = currentPacket.Substring(Encoding.encodeVL64(itemID).Length); } else { recyclerManager.dropSession(userID, true); sendData("DpH"); return; } } } sendData("Dp" + recyclerManager.sessionString(userID)); refreshHand("update"); } break; } case "Cb": // Recycler - redeem/cancel session { if (Config.enableRecycler == false || Room != null && recyclerManager.sessionExists(userID)) { bool Redeem = (currentPacket.Substring(2) == "I"); if (Redeem && recyclerManager.sessionReady(userID)) recyclerManager.rewardSession(userID); recyclerManager.dropSession(userID, Redeem); sendData("Dp" + recyclerManager.sessionString(userID)); if (Redeem) refreshHand("last"); else refreshHand("new"); } break; } #endregion #region Hand and item handling case "AA": // Hand { if (Room == null || roomUser == null) return; string Mode = currentPacket.Substring(2); refreshHand(Mode); break; } case "LB": // Hand { if (Room == null || roomUser == null) return; string Mode = currentPacket.Substring(2); refreshHand(Mode); break; } case "AB": // Item handling - apply wallpaper/floor/landscape to room { if (_hasRights == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Split('/')[1]); string decorType = currentPacket.Substring(2).Split('/')[0]; if (decorType != "wallpaper" && decorType != "floor" && decorType != "landscape") // Non-valid decoration type return; int templateID; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { templateID = dbClient.getInt("SELECT tid FROM furniture WHERE id = '" + itemID + "' AND ownerid = '" + userID + "' AND roomid = '0'"); if (catalogueManager.getTemplate(templateID).Sprite != decorType) // This item isn't the decoration item the client thinks it is. (obv scripter) If the item wasn't found (so the user didn't owned the item etc), then an empty item template isn't required, which also doesn't match this condition { return; } string decorVal = dbClient.getString("SELECT var FROM furniture WHERE id = '" + itemID + "'"); Room.sendData("@n" + decorType + "/" + decorVal); // "@n" (46) is a generic message for setting a room's decoration. Since the introduction of landscapes, it can be 'wallpaper', 'floor' and 'landscape' dbClient.runQuery("UPDATE rooms SET " + decorType + " = '" + decorVal + "' WHERE id = '" + _roomID + "' LIMIT 1"); // Generates query like 'UPDATE rooms SET floor/wallpaper/landscape blabla' (the string decorType is containing either 'floor', 'wallpaper' or 'landscape') dbClient.runQuery("DELETE FROM furniture WHERE id = '" + itemID + "' LIMIT 1"); } } break; case "AZ": // Item handling - place item down { if (_hasRights == false || _inPublicroom || Room == null || roomUser == null) return; int itemID; if (!int.TryParse((currentPacket.Split(' ')[0].Substring(2)), out itemID)) return; int templateID; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { templateID = dbClient.getInt("SELECT tid FROM furniture WHERE id = '" + itemID + "' AND ownerid = '" + userID + "' AND roomid = '0'"); } if (templateID == 0) { return; } if (catalogueManager.getTemplate(templateID).typeID == 0) { string _INPUTPOS = currentPacket.Substring(itemID.ToString().Length + 3); string _CHECKEDPOS = catalogueManager.wallPositionOK(_INPUTPOS); if (_CHECKEDPOS != _INPUTPOS) { return; } string Var; int VarValue = 0; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { Var = dbClient.getString("SELECT var FROM furniture WHERE id = '" + itemID + "'"); Int32.TryParse(Var, out VarValue); if (stringManager.getStringPart(catalogueManager.getTemplate(templateID).Sprite, 0, 7) == "post.it") { if (VarValue > 1) dbClient.runQuery("UPDATE furniture SET var = var - 1 WHERE id = '" + itemID + "' LIMIT 1"); else dbClient.runQuery("DELETE FROM furniture WHERE id = '" + itemID + "' LIMIT 1"); dbClient.runQuery("INSERT INTO furniture(tid,ownerid) VALUES ('" + templateID + "','" + userID + "')"); itemID = catalogueManager.lastItemID; dbClient.runQuery("INSERT INTO furniture_stickies(id) VALUES ('" + itemID + "')"); Var = "FFFF33"; dbClient.runQuery("UPDATE furniture SET var = '" + Var + "' WHERE id = '" + itemID + "' LIMIT 1"); } else if (stringManager.getStringPart(catalogueManager.getTemplate(templateID).Sprite, 0, 10) == "roomdimmer") dbClient.runQuery("UPDATE furniture_moodlight SET roomid = '" + _roomID + "' WHERE id = '" + itemID + "' LIMIT 1"); Room.wallItemManager.addItem(itemID, templateID, _CHECKEDPOS, Var, true); } } else { string[] locDetails = currentPacket.Split(' '); int X = int.Parse(locDetails[1]); int Y = int.Parse(locDetails[2]); byte Z = byte.Parse(locDetails[3]); byte typeID = catalogueManager.getTemplate(templateID).typeID; Room.floorItemManager.placeItem(itemID, templateID, X, Y, typeID, Z); } break; } case "AC": // Item handling - pickup item { if (_isOwner == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Split(' ')[2]); if (Room.floorItemManager.containsItem(itemID)) Room.floorItemManager.removeItem(itemID, userID); else if (Room.wallItemManager.containsItem(itemID) && stringManager.getStringPart(Room.wallItemManager.getItem(itemID).Sprite, 0, 7) != "post.it") // Can't pickup stickies from room Room.wallItemManager.removeItem(itemID, userID); else return; refreshHand("update"); break; } case "AI": // Item handling - move/rotate item { if (_hasRights == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Split(' ')[0].Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { string[] locDetails = currentPacket.Split(' '); int X = int.Parse(locDetails[1]); int Y = int.Parse(locDetails[2]); byte Z = byte.Parse(locDetails[3]); Room.floorItemManager.relocateItem(itemID, X, Y, Z); } break; } case "CV": // Item handling - toggle wallitem status { try { if (_inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Substring(4, Encoding.decodeB64(currentPacket.Substring(2, 2)))); int toStatus = Encoding.decodeVL64(currentPacket.Substring(itemID.ToString().Length + 4)); //Out.WritePlain(toStatus.ToString()); Room.wallItemManager.toggleItemStatus(itemID, toStatus); break; } catch { } break; } case "AJ": // Item handling - toggle flooritem status { try { int itemID = int.Parse(currentPacket.Substring(4, Encoding.decodeB64(currentPacket.Substring(2, 2)))); string toStatus = currentPacket.Substring(itemID.ToString().Length + 6); int tester; if (toStatus.ToLower() == "false" || toStatus.ToLower() == "on" || toStatus.ToLower() == "off" || toStatus.ToLower() == "true" || int.TryParse(toStatus, out tester) || toStatus.ToLower() == "c" || toStatus.ToLower() == "o") Room.floorItemManager.toggleItemStatus(itemID, toStatus, _hasRights); else Disconnect(); } catch { } break; } case "AN": // Item handling - open presentbox { if (_isOwner == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID) == false) return; //Database dbClient = new Database(true, false, 112); DataColumn dCol; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dCol = dbClient.getColumn("SELECT itemid FROM furniture_presents WHERE id = '" + itemID + "'"); if (dCol.Table.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); int lastItemID = 0; foreach (DataRow dRow in dCol.Table.Rows) { sb.Append(" OR id = '" + Convert.ToString(dRow["itemid"]) + "'"); lastItemID = Convert.ToInt32(dRow["itemid"]); } dbClient.runQuery("UPDATE furniture SET roomid = '-' WHERE " + sb.ToString().Substring(4)); Room.floorItemManager.removeItem(itemID, 0); int lastItemTID = dbClient.getInt("SELECT tid FROM furniture WHERE id = '" + lastItemID + "'"); catalogueManager.itemTemplate Template = catalogueManager.getTemplate(lastItemTID); if (Template.typeID > 0) sendData("BA" + Template.Sprite + "\r" + Template.Sprite + "\r" + Template.Length + Convert.ToChar(30) + Template.Width + Convert.ToChar(30) + Template.Colour); else sendData("BA" + Template.Sprite + "\r" + Template.Sprite + " " + Template.Colour + "\r"); } dbClient.runQuery("DELETE FROM furniture_presents WHERE id = '" + itemID + "' LIMIT " + dCol.Table.Rows.Count); dbClient.runQuery("DELETE FROM furniture WHERE id = '" + itemID + "' LIMIT 1"); } refreshHand("last"); break; } case "Bw": // Item handling - redeem credit item { if (_isOwner == false || _inPublicroom || Room == null || roomUser == null) return; int itemID = Encoding.decodeVL64(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { string Sprite = Room.floorItemManager.getItem(itemID).Sprite; if (Sprite.Substring(0, 3).ToLower() != "cf_" && Sprite.Substring(0, 4).ToLower() != "cfc_") return; int redeemValue = 0; try { redeemValue = int.Parse(Sprite.Split('_')[1]); } catch { return; } Room.floorItemManager.removeItem(itemID, 0); _Credits += redeemValue; sendData("@F" + _Credits); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE users SET credits = '" + _Credits + "' WHERE id = '" + userID + "' LIMIT 1"); } } break; } case "AQ": // Item handling - teleporters - enter teleporter { if (_inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { Rooms.Items.floorItem Teleporter = Room.floorItemManager.getItem(itemID); // Prevent clientside 'jumps' to teleporter, check if user is removed one coord from teleporter entrance if (Teleporter.Z == 2 && roomUser.X != Teleporter.X + 1 && roomUser.Y != Teleporter.Y) return; else if (Teleporter.Z == 4 && roomUser.X != Teleporter.X && roomUser.Y != Teleporter.Y + 1) return; roomUser.goalX = -1; Room.moveUser(roomUser, Teleporter.X, Teleporter.Y, true); } break; } case @"@\": // Item handling - teleporters - flash teleporter { if (_inPublicroom || Room == null || roomUser == null) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { Rooms.Items.floorItem Teleporter1 = Room.floorItemManager.getItem(itemID); if (roomUser.X != Teleporter1.X && roomUser.Y != Teleporter1.Y) return; //Database dbClient = new Database (true, false, 114); int roomIDTeleporter2; int idTeleporter2; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { idTeleporter2 = dbClient.getInt("SELECT teleportid FROM furniture WHERE id = '" + itemID + "'"); roomIDTeleporter2 = dbClient.getInt("SELECT roomid FROM furniture WHERE id = '" + idTeleporter2 + "'"); } if (roomIDTeleporter2 > 0) new TeleporterUsageSleep(useTeleporter).BeginInvoke(Teleporter1, idTeleporter2, roomIDTeleporter2, null, null); } break; } case "AM": // Item handling - dices - close dice { if (Room == null || roomUser == null || _inPublicroom) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { Rooms.Items.floorItem Item = Room.floorItemManager.getItem(itemID); string Sprite = Item.Sprite; if (Sprite != "edice" && Sprite != "edicehc") // Not a dice item return; if (!(Math.Abs(roomUser.X - Item.X) > 1 || Math.Abs(roomUser.Y - Item.Y) > 1)) // User is not more than one square removed from dice { Item.Var = "0"; Room.sendData("AZ" + itemID + " " + (itemID * 38)); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE furniture SET var = '0' WHERE id = '" + itemID + "' LIMIT 1"); } } } break; } case "AL": // Item handling - dices - spin dice { if (Room == null || roomUser == null || _inPublicroom) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID)) { Rooms.Items.floorItem Item = Room.floorItemManager.getItem(itemID); string Sprite = Item.Sprite; if (Sprite != "edice" && Sprite != "edicehc") // Not a dice item return; if (!(Math.Abs(roomUser.X - Item.X) > 1 || Math.Abs(roomUser.Y - Item.Y) > 1)) // User is not more than one square removed from dice { Room.sendData("AZ" + itemID); int rndNum = new Random(DateTime.Now.Millisecond).Next(1, 7); Room.sendData("AZ" + itemID + " " + ((itemID * 38) + rndNum), 2500); Item.Var = rndNum.ToString(); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE furniture SET var = '" + rndNum + "' WHERE id = '" + itemID + "' LIMIT 1"); } } } break; } case "Cw": // Item handling - spin Wheel of fortune { if (_hasRights == false || Room == null || roomUser == null || _inPublicroom) return; int itemID = Encoding.decodeVL64(currentPacket.Substring(2)); if (Room.wallItemManager.containsItem(itemID)) { Rooms.Items.wallItem Item = Room.wallItemManager.getItem(itemID); if (Item.Sprite == "habbowheel") { int rndNum = new Random(DateTime.Now.Millisecond).Next(0, 10); Room.sendData("AU" + itemID + Convert.ToChar(9) + "habbowheel" + Convert.ToChar(9) + " " + Item.wallPosition + Convert.ToChar(9) + "-1"); Room.sendData("AU" + itemID + Convert.ToChar(9) + "habbowheel" + Convert.ToChar(9) + " " + Item.wallPosition + Convert.ToChar(9) + rndNum, 4250); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE furniture SET var = '" + rndNum + "' WHERE id = '" + itemID + "' LIMIT 1"); } } } break; } case "Dz": // Item handling - activate Love shuffler sofa { if (Room == null || roomUser == null || _inPublicroom) return; int itemID = Encoding.decodeVL64(currentPacket.Substring(2)); if (Room.floorItemManager.containsItem(itemID) && Room.floorItemManager.getItem(itemID).Sprite == "val_randomizer") { int rndNum = new Random(DateTime.Now.Millisecond).Next(1, 5); Room.sendData("AX" + itemID + Convert.ToChar(2) + "123456789" + Convert.ToChar(2)); Room.sendData("AX" + itemID + Convert.ToChar(2) + rndNum + Convert.ToChar(2), 5000); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE furniture SET var = '" + rndNum + "' WHERE id = '" + itemID + "' LIMIT 1"); } } break; } case "AS": // Item handling - stickies/photo's - open stickie/photo { if (Room == null || roomUser == null || _inPublicroom) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.wallItemManager.containsItem(itemID)) { //Database dbClient = new Database(true, true, 119); string Message; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { Message = dbClient.getString("SELECT text FROM furniture_stickies WHERE id = '" + itemID + "'"); } sendData("@p" + itemID + Convert.ToChar(9) + Room.wallItemManager.getItem(itemID).Var + " " + Message); } break; } case "AT": // Item handling - stickies - edit stickie colour/message { if (_hasRights == false || Room == null || roomUser == null || _inPublicroom) return; int itemID = int.Parse(currentPacket.Substring(2, currentPacket.IndexOf("/") - 2)); if (Room.wallItemManager.containsItem(itemID)) { Rooms.Items.wallItem Item = Room.wallItemManager.getItem(itemID); string Sprite = Item.Sprite; if (Sprite != "post.it" && Sprite != "post.it.vd") return; string Colour = "FFFFFF"; // Valentine stickie default colour if (Sprite == "post.it") // Normal stickie { Colour = currentPacket.Substring(2 + itemID.ToString().Length + 1, 6); if (Colour != "FFFF33" && Colour != "FF9CFF" && Colour != "9CFF9C" && Colour != "9CCEFF") return; } string Message = currentPacket.Substring(2 + itemID.ToString().Length + 7); if (Message.Length > 684) return; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("text", stringManager.filterSwearwords(Message).Replace("/r", Convert.ToChar(13).ToString())); //dbClient.Open(); if (Colour != Item.Var) dbClient.runQuery("UPDATE furniture SET var = '" + Colour + "' WHERE id = '" + itemID + "' LIMIT 1"); Item.Var = Colour; dbClient.runQuery("UPDATE furniture_stickies SET text = @text WHERE id = '" + itemID + "' LIMIT 1"); } Room.sendData("AU" + itemID + Convert.ToChar(9) + Sprite + Convert.ToChar(9) + " " + Item.wallPosition + Convert.ToChar(9) + Colour); } break; } case "AU": // Item handling - stickies/photo - delete stickie/photo { if (_isOwner == false || Room == null || roomUser == null || _inPublicroom) return; int itemID = int.Parse(currentPacket.Substring(2)); if (Room.wallItemManager.containsItem(itemID) && stringManager.getStringPart(Room.wallItemManager.getItem(itemID).Sprite, 0, 7) == "post.it") { Room.wallItemManager.removeItem(itemID, 0); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("DELETE FROM furniture_stickies WHERE id = '" + itemID + "' LIMIT 1"); } } break; } #endregion #region Pets and Their statistics case "B@": // Pet Stats (e.g. Sleep, etc.) { // nothing here yet } break; #endregion #region Trax - Preferences case "Ct": // Soundmachine - initialize songs in soundmachine { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) sendData("EB" + soundMachineManager.getMachineSongList(Room.floorItemManager.soundMachineID)); break; } case "Cu": // Soundmachine - enter room initialize playlist { if (Room != null && Room.floorItemManager.soundMachineID > 0) sendData("EC" + soundMachineManager.getMachinePlaylist(Room.floorItemManager.soundMachineID)); break; } case "C]": // Soundmachine - get song title and data of certain song { if (Room != null && Room.floorItemManager.soundMachineID > 0) { int songID = Encoding.decodeVL64(currentPacket.Substring(2)); sendData("Dl" + soundMachineManager.getSong(songID)); } break; } case "Cs": // Soundmachine - save playlist { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int Amount = Encoding.decodeVL64(currentPacket.Substring(2)); if (Amount < 6) // Max playlist size { currentPacket = currentPacket.Substring(Encoding.encodeVL64(Amount).Length + 2); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("DELETE FROM soundmachine_playlists WHERE machineid = '" + Room.floorItemManager.soundMachineID + "'"); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < Amount; i++) { int songID = Encoding.decodeVL64(currentPacket); sb.Append(" ,('" + Room.floorItemManager.soundMachineID + "','" + songID + "','" + i + "')"); currentPacket = currentPacket.Substring(Encoding.encodeVL64(songID).Length); } if (sb.Length != 0) { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("INSERT INTO soundmachine_playlists(machineid,songid,pos) VALUES " + sb.ToString().Substring(2)); } } Room.sendData("EC" + soundMachineManager.getMachinePlaylist(Room.floorItemManager.soundMachineID)); // Refresh playlist } } break; } case "C~": // Sound machine - burn song to disk { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int songID = Encoding.decodeVL64(currentPacket.Substring(2)); bool result = false; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { result = dbClient.findsResult("SELECT id FROM soundmachine_songs WHERE id = '" + songID + "' AND userid = '" + userID + "' AND machineid = '" + Room.floorItemManager.soundMachineID + "'"); } if (_Credits > 0 && result) { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { DataRow dRow = dbClient.getRow("SELECT title, length FROM soundmachine_songs WHERE id = '" + songID + "'"); string Status = Encoding.encodeVL64(songID) + _Username + "\n" + DateTime.Today.Day + "\n" + DateTime.Today.Month + "\n" + DateTime.Today.Year + "\n" + Convert.ToString(dRow["length"]) + "\n" + Convert.ToString(dRow["title"]); dbClient.AddParamWithValue("tid", Config.Soundmachine_burnToDisk_diskTemplateID); dbClient.AddParamWithValue("ownerid", userID); dbClient.AddParamWithValue("var", Status); dbClient.runQuery("INSERT INTO furniture(tid,ownerid,var) VALUES (@tid,@ownerid,@var)"); dbClient.runQuery("UPDATE soundmachine_songs SET burnt = '1' WHERE id = '" + songID + "' LIMIT 1"); dbClient.runQuery("UPDATE users SET credits = credits - 1 WHERE id = '" + userID + "' LIMIT 1"); } _Credits--; sendData("@F" + _Credits); sendData("EB" + soundMachineManager.getMachineSongList(Room.floorItemManager.soundMachineID)); refreshHand("last"); } else // Virtual user doesn't has enough credits to burn this song to disk, or this song doesn't exist in his/her soundmachine sendData("AD"); } break; } case "Cx": // Sound machine - delete song { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int songID = Encoding.decodeVL64(currentPacket.Substring(2)); bool result = false; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { result = dbClient.findsResult("SELECT id FROM soundmachine_songs WHERE id = '" + songID + "' AND machineid = '" + Room.floorItemManager.soundMachineID + "'"); } if (result) { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE soundmachine_songs SET machineid = '0' WHERE id = '" + songID + "' AND burnt = '1'"); // If the song is burnt atleast once, then the song is removed from this machine dbClient.runQuery("DELETE FROM soundmachine_songs WHERE id = '" + songID + "' AND burnt = '0' LIMIT 1"); // If the song isn't burnt; delete song from database dbClient.runQuery("DELETE FROM soundmachine_playlists WHERE machineid = '" + Room.floorItemManager.soundMachineID + "' AND songid = '" + songID + "'"); // Remove song from playlist } Room.sendData("EC" + soundMachineManager.getMachinePlaylist(Room.floorItemManager.soundMachineID)); } } break; } #region Song editor case "Co": // Soundmachine - song editor - initialize soundsets and samples { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { songEditor = new virtualSongEditor(Room.floorItemManager.soundMachineID, userID); songEditor.loadSoundsets(); sendData("Dm" + songEditor.getSoundsets()); sendData("Dn" + soundMachineManager.getHandSoundsets(userID)); } break; } case "C[": // Soundmachine - song editor - add soundset { if (songEditor != null && _isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int soundSetID = Encoding.decodeVL64(currentPacket.Substring(2)); int slotID = Encoding.decodeVL64(currentPacket.Substring(Encoding.encodeVL64(soundSetID).Length + 2)); if (slotID > 0 && slotID < 5 && songEditor.slotFree(slotID)) { songEditor.addSoundset(soundSetID, slotID); sendData("Dn" + soundMachineManager.getHandSoundsets(userID)); sendData("Dm" + songEditor.getSoundsets()); } } break; } case @"C\": // Soundmachine - song editor - remove soundset { if (songEditor != null && _isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int slotID = Encoding.decodeVL64(currentPacket.Substring(2)); if (songEditor.slotFree(slotID) == false) { songEditor.removeSoundset(slotID); sendData("Dm" + songEditor.getSoundsets()); sendData("Dn" + soundMachineManager.getHandSoundsets(userID)); } } break; } case "Cp": // Soundmachine - song editor - save new song { if (songEditor != null && _isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int nameLength = Encoding.decodeB64(currentPacket.Substring(2, 2)); string Title = currentPacket.Substring(4, nameLength); string Data = currentPacket.Substring(nameLength + 6); int Length = soundMachineManager.calculateSongLength(Data); if (Length != -1) { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.AddParamWithValue("userid", userID); dbClient.AddParamWithValue("machineid", Room.floorItemManager.soundMachineID); dbClient.AddParamWithValue("title", stringManager.filterSwearwords(Title)); dbClient.AddParamWithValue("length", Length); dbClient.AddParamWithValue("data", Data); dbClient.runQuery("INSERT INTO soundmachine_songs (userid,machineid,title,length,data) VALUES (@userid,@machineid,@title,@length,@data)"); } sendData("EB" + soundMachineManager.getMachineSongList(Room.floorItemManager.soundMachineID)); sendData("EK" + Encoding.encodeVL64(Room.floorItemManager.soundMachineID) + Title + Convert.ToChar(2)); } } break; } case "Cq": // Soundmachine - song editor - request edit of existing song { if (_isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int songID = Encoding.decodeVL64(currentPacket.Substring(2)); sendData("Dl" + soundMachineManager.getSong(songID)); songEditor = new virtualSongEditor(Room.floorItemManager.soundMachineID, userID); sendData("Dm" + songEditor.getSoundsets()); sendData("Dn" + soundMachineManager.getHandSoundsets(userID)); } break; } case "Cr": // Soundmachine - song editor - save edited existing song { if (songEditor != null && _isOwner && Room != null && Room.floorItemManager.soundMachineID > 0) { int songID = Encoding.decodeVL64(currentPacket.Substring(2)); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { if (dbClient.findsResult("SELECT id FROM soundmachine_songs WHERE id = '" + songID + "' AND userid = '" + userID + "' AND machineid = '" + Room.floorItemManager.soundMachineID + "'")) { int idLength = Encoding.encodeVL64(songID).Length; int nameLength = Encoding.decodeB64(currentPacket.Substring(idLength + 2, 2)); string Title = currentPacket.Substring(idLength + 4, nameLength); string Data = currentPacket.Substring(idLength + nameLength + 6); int Length = soundMachineManager.calculateSongLength(Data); if (Length != -1) { dbClient.AddParamWithValue("id", songID); dbClient.AddParamWithValue("title", stringManager.filterSwearwords(Title)); dbClient.AddParamWithValue("length", Length); dbClient.AddParamWithValue("data", Data); dbClient.runQuery("UPDATE soundmachine_songs SET title = @title,data = @data,length = @length WHERE id = @id LIMIT 1"); sendData("ES"); sendData("EB" + soundMachineManager.getMachineSongList(Room.floorItemManager.soundMachineID)); Room.sendData("EC" + soundMachineManager.getMachinePlaylist(Room.floorItemManager.soundMachineID)); } } } } break; } #endregion Song editor #endregion #region Trading - Preferences case "AG": // Trading - start { if (Room != null || roomUser != null || _tradePartnerRoomUID == -1) { if (Config.enableTrading == false) { sendData("BK" + stringManager.getString("trading_disabled")); return; } int partnerUID = int.Parse(currentPacket.Substring(2)); if (Room.containsUser(partnerUID)) { virtualUser Partner = Room.getUser(partnerUID); if (Partner.statusManager.containsStatus("trd")) return; _tradePartnerRoomUID = partnerUID; statusManager.addStatus("trd", ""); roomUser.Refresh(); Partner._tradePartnerRoomUID = roomUser.roomUID; Partner.statusManager.addStatus("trd", ""); Partner.roomUser.Refresh(); refreshTradeBoxes(); Partner.refreshTradeBoxes(); } } break; } case "AH": // Trading - offer item { if (Room != null && roomUser != null && _tradePartnerRoomUID != -1 && Room.containsUser(_tradePartnerRoomUID)) { int itemID = int.Parse(currentPacket.Substring(2)); int templateID; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { templateID = dbClient.getInt("SELECT tid FROM furniture WHERE id = '" + itemID + "' AND ownerid = '" + userID + "' AND roomid = '0'"); } if (templateID == 0) return; _tradeItems[_tradeItemCount] = itemID; _tradeItemCount++; virtualUser Partner = Room.getUser(_tradePartnerRoomUID); _tradeAccept = false; Partner._tradeAccept = false; refreshTradeBoxes(); Partner.refreshTradeBoxes(); } using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { int nonTrade = 0; dbClient.runQuery("SELECT FROM catalogue_items WHERE catalogue_id_page = '77' AND tradeable = " + nonTrade + ""); if (nonTrade == 0) // add nonTrade as part of the query so it can read it. { sendData("VIP Furniture isn't allowed to be traded."); sendData("EAH + Someone has tried attempting to trade VIP Furniture!<br>Message created by: Echo Emulator Trading System."); // Sends CFH to Staff // Closes trade completely. abortTrade(); } } break; } case "AD": // Trading - decline trade { if (Room != null && roomUser != null && _tradePartnerRoomUID != -1 && Room.containsUser(_tradePartnerRoomUID)) { virtualUser Partner = Room.getUser(_tradePartnerRoomUID); _tradeAccept = false; Partner._tradeAccept = false; refreshTradeBoxes(); Partner.refreshTradeBoxes(); } break; } case "AE": // Trading - accept trade (and, if both partners accept, swap items] { if (Room != null && roomUser != null && _tradePartnerRoomUID != -1 && Room.containsUser(_tradePartnerRoomUID)) { virtualUser Partner = Room.getUser(_tradePartnerRoomUID); _tradeAccept = true; refreshTradeBoxes(); Partner.refreshTradeBoxes(); if (Partner._tradeAccept) { StringBuilder sb = new StringBuilder("'a'='b'"); for (int i = 0; i < _tradeItemCount; i++) if (_tradeItems[i] > 0) sb.Append(" OR id = '" + _tradeItems[i] + "'"); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE furniture SET ownerid = '" + Partner.userID + "',roomid = '0' WHERE" + sb.ToString()); } sb.Remove(7, sb.Length - 7); for (int i = 0; i < Partner._tradeItemCount; i++) if (Partner._tradeItems[i] > 0) sb.Append(" OR id = '" + Partner._tradeItems[i] + "'"); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dbClient.runQuery("UPDATE furniture SET ownerid = '" + userID + "',roomid = '0' WHERE" + sb.ToString()); } abortTrade(); } } break; } case "AF": // Trading - abort trade { if (Room != null && roomUser != null && _tradePartnerRoomUID != -1 && Room.containsUser(_tradePartnerRoomUID)) { abortTrade(); refreshHand("update"); } break; } #endregion #region Game Lobby - Preferences case "B_": // Gamelobby - refresh gamelist { if (Room != null && Room.Lobby != null) sendData("Ch" + Room.Lobby.gameList()); break; } case "B`": // Gamelobby - checkout single game sub { if (Room != null && roomUser != null && Room.Lobby != null && gamePlayer == null) { int gameID = Encoding.decodeVL64(currentPacket.Substring(2)); if (Room.Lobby.Games.ContainsKey(gameID)) { gamePlayer = new gamePlayer(this, roomUser.roomUID, (Game)Room.Lobby.Games[gameID]); gamePlayer.Game.Subviewers.Add(gamePlayer); sendData("Ci" + gamePlayer.Game.Sub); } } break; } case "Bb": // Gamelobby - request new game create { if (Room != null && roomUser != null && Room.Lobby != null && gamePlayer == null) { if (_Tickets > 1) // Atleast two tickets in inventory { if (Room.Lobby.validGamerank(roomUser.gamePoints)) { if (Room.Lobby.isBattleBall) sendData("Ck" + Room.Lobby.getCreateGameSettings()); else sendData("Ck" + "RA" + "secondsUntilRestart" + Convert.ToChar(2) + "HIRGIHHfieldType" + Convert.ToChar(2) + "HKIIIISAnumTeams" + Convert.ToChar(2) + "HJJIII" + "PA" + "gameLengthChoice" + Convert.ToChar(2) + "HJIIIIK" + "name" + Convert.ToChar(2) + "IJ" + Convert.ToChar(2) + "H" + "secondsUntilStart" + Convert.ToChar(2) + "HIRBIHH"); } else sendData("Cl" + "K"); // Error [3] = Skillevel not valid in this lobby } else sendData("Cl" + "J"); // Error [2] = Not enough tickets } break; } case "Bc": // Gamelobby - process new created game { if (Room != null && roomUser != null && Room.Lobby != null && gamePlayer == null) { if (_Tickets > 1) // Atleast two tickets in inventory { if (Room.Lobby.validGamerank(roomUser.gamePoints)) { try { int mapID = -1; int teamAmount = -1; int[] Powerups = null; string Name = ""; #region Game settings decoding int keyAmount = Encoding.decodeVL64(currentPacket.Substring(2)); currentPacket = currentPacket.Substring(Encoding.encodeVL64(keyAmount).Length + 2); for (int i = 0; i < keyAmount; i++) { int j = Encoding.decodeB64(currentPacket.Substring(0, 2)); string Key = currentPacket.Substring(2, j); if (currentPacket.Substring(j + 2, 1) == "H") // VL64 value { int Value = Encoding.decodeVL64(currentPacket.Substring(j + 3)); switch (Key) { case "fieldType": mapID = Value; break; case "numTeams": teamAmount = Value; break; } int k = Encoding.encodeVL64(Value).Length; currentPacket = currentPacket.Substring(j + k + 3); } else // B64 value { int valLen = Encoding.decodeB64(currentPacket.Substring(j + 3, 2)); string Value = currentPacket.Substring(j + 5, valLen); switch (Key) { case "allowedPowerups": string[] ps = Value.Split(','); Powerups = new int[ps.Length]; for (int p = 0; p < ps.Length; p++) { int P = int.Parse(ps[p]); if (Room.Lobby.allowsPowerup(P)) Powerups[p] = P; else // Powerup not allowed in this lobby return; } break; case "name": Name = stringManager.filterSwearwords(Value); break; } currentPacket = currentPacket.Substring(j + valLen + 5); } } #endregion if (mapID == -1 || teamAmount == -1 || Name == "") // Incorrect keys supplied by client return; gamePlayer = new gamePlayer(this, roomUser.roomUID, null); Room.Lobby.createGame(gamePlayer, Name, mapID, teamAmount, Powerups); } catch { } } else sendData("Cl" + "K"); // Error [3] = Skillevel not valid in this lobby } else sendData("Cl" + "J"); // Error [2] = Not enough tickets } break; } case "Be": // Gamelobby - switch team in game { if (Room != null && Room.Lobby != null && gamePlayer != null && gamePlayer.Game.State == Game.gameState.Waiting) { if (_Tickets > 1) // Atleast two tickets in inventory { if (Room.Lobby.validGamerank(roomUser.gamePoints)) { int j = Encoding.decodeVL64(currentPacket.Substring(2)); int teamID = Encoding.decodeVL64(currentPacket.Substring(Encoding.encodeVL64(j).Length + 2)); if (teamID != gamePlayer.teamID && gamePlayer.Game.teamHasSpace(teamID)) { if (gamePlayer.teamID == -1) // User was a subviewer gamePlayer.Game.Subviewers.Remove(gamePlayer); gamePlayer.Game.movePlayer(gamePlayer, gamePlayer.teamID, teamID); } else sendData("Cl" + "H"); // Error [0] = Team full } else sendData("Cl" + "K"); // Error [3] = Skillevel not valid in this lobby } else sendData("Cl" + "J"); // Error [2] = Not enough tickets } break; } case "Bg": // Gamelobby - leave single game sub { leaveGame(); break; } case "Bh": // Gamelobby - kick player from game { if (Room != null && Room.Lobby != null && gamePlayer != null && gamePlayer.Game != null && gamePlayer == gamePlayer.Game.Owner) { int roomUID = Encoding.decodeVL64(currentPacket.Substring(2)); for (int i = 0; i < gamePlayer.Game.Teams.Length; i++) { foreach (gamePlayer Member in gamePlayer.Game.Teams[i]) { if (Member.roomUID == roomUID) { Member.sendData("Cl" + "RA"); // Error [6] = kicked from game gamePlayer.Game.movePlayer(Member, i, -1); return; } } } } break; } case "Bj": // Gamelobby - start game { if (Room != null && Room.Lobby != null && gamePlayer != null && gamePlayer == gamePlayer.Game.Owner) { gamePlayer.Game.startGame(); } break; } case "Bk": // Game - ingame - move unit { if (gamePlayer != null && gamePlayer.Game.State == Game.gameState.Started && gamePlayer.teamID != -1) { gamePlayer.goalX = Encoding.decodeVL64(currentPacket.Substring(3)); gamePlayer.goalY = Encoding.decodeVL64(currentPacket.Substring(Encoding.encodeVL64(gamePlayer.goalX).Length + 3)); } break; } case "Bl": // Game - ingame - proceed with restart of game { if (gamePlayer != null && gamePlayer.Game.State == Game.gameState.Ended && gamePlayer.teamID != -1) { gamePlayer.Game.sendData("BK" + "" + _Username + " wants to replay!"); } break; } #endregion #region Guide system case "Ej": { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) dbClient.runQuery("UPDATE users SET guideavailable = '1' WHERE id = '" + userID + "' LIMIT 1"); break; } case "Ek": { using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) dbClient.runQuery("UPDATE users SET guideavailable = '0' WHERE id = '" + userID + "' LIMIT 1"); break; } #endregion #region Games Joystick case "FC": { //Not coded yet (NOT A BUG)! break; } #endregion #region Moodlight case "EW": // Turn moodlight on/off { if (_isOwner == false && _hasRights == false) return; roomManager.moodlight.setSettings(_roomID, false, 0, 0, null, 0); break; } case "EU": // Load moodlight settings { if (_isOwner == false && _hasRights == false) return; string settingData = roomManager.moodlight.getSettings(_roomID); if (settingData != null) sendData("Em" + settingData); break; } case "EV": // Apply modified moodlight settings { if (_isOwner == false && _hasRights == false) return; int presetID = Encoding.decodeVL64(currentPacket.Substring(2, 1)); int bgState = Encoding.decodeVL64(currentPacket.Substring(3, 1)); string presetColour = currentPacket.Substring(6, Encoding.decodeB64(currentPacket.Substring(4, 2))); int presetDarkF = Encoding.decodeVL64(currentPacket.Substring(presetColour.Length + 6)); roomManager.moodlight.setSettings(_roomID, true, presetID, bgState, presetColour, presetDarkF); break; } #endregion #region lido //temp removed! big-ass error =] #endregion #endregion #region Games Joystick case "_B": { if (Room != null && Room.Lobby != null) sendData("Ch" + Room.Lobby.gameList()); break; } case "_TH": { if (Room != null && roomUser != null && Room.Lobby != null && gamePlayer == null) { int gameID = Encoding.decodeVL64(currentPacket.Substring(2)); if (Room.Lobby.Games.ContainsKey(gameID)) { this.gamePlayer = new gamePlayer(this, roomUser.roomUID, (Game)Room.Lobby.Games[gameID]); gamePlayer.Game.Subviewers.Add(gamePlayer); sendData("Ci" + gamePlayer.Game.Sub); } } break; } case "_b": { if (Room != null && roomUser != null && Room.Lobby != null && gamePlayer == null) { if (Room.Lobby.validGamerank(roomUser.gamePoints)) { if (Room.Lobby.isBattleBall) sendData("Ck" + Room.Lobby.getCreateGameSettings()); else sendData("Ck" + "RA" + "secondsUntilRestart" + Convert.ToChar(2) + "HIRGIHHfieldType" + Convert.ToChar(2) + "HKIIIISAnumTeams" + Convert.ToChar(2) + "HJJIII" + "PA" + "gameLengthChoice" + Convert.ToChar(2) + "HJIIIIK" + "name" + Convert.ToChar(2) + "IJ" + Convert.ToChar(2) + "H" + "secondsUntilStart" + Convert.ToChar(2) + "HIRBIHH"); } else sendData("Cl" + "K"); // Error [3] = Skillevel not valid in this lobby } break; } case "_c": { if (Room != null && roomUser != null && Room.Lobby != null && gamePlayer == null) { if (Room.Lobby.validGamerank(roomUser.gamePoints)) { try { int mapID = -1; int teamAmount = -1; int[] Powerups = null; string Name = ""; #region Game settings decoding int keyAmount = Encoding.decodeVL64(currentPacket.Substring(2)); currentPacket = currentPacket.Substring(Encoding.encodeVL64(keyAmount).Length + 2); for (int i = 0; i < keyAmount; i++) { int j = Encoding.decodeB64(currentPacket.Substring(0, 2)); string Key = currentPacket.Substring(2, j); if (currentPacket.Substring(j + 2, 1) == "H") // VL64 value { int Value = Encoding.decodeVL64(currentPacket.Substring(j + 3)); switch (Key) { case "fieldType": mapID = Value; break; case "numTeams": teamAmount = Value; break; } int k = Encoding.encodeVL64(Value).Length; currentPacket = currentPacket.Substring(j + k + 3); } else // B64 value { int valLen = Encoding.decodeB64(currentPacket.Substring(j + 3, 2)); string Value = currentPacket.Substring(j + 5, valLen); switch (Key) { case "allowedPowerups": string[] ps = Value.Split(','); Powerups = new int[ps.Length]; for (int p = 0; p < ps.Length; p++) { int P = int.Parse(ps[p]); if (Room.Lobby.allowsPowerup(P)) Powerups[p] = P; else // Powerup not allowed in this lobby return; } break; case "name": Name = stringManager.filterSwearwords(Value); break; } currentPacket = currentPacket.Substring(j + valLen + 5); } } #endregion if (mapID == -1 || teamAmount == -1 || Name == "") // Incorrect keys supplied by client return; this.gamePlayer = new gamePlayer(this, roomUser.roomUID, null); Room.Lobby.createGame(this.gamePlayer, Name, mapID, teamAmount, Powerups); } catch { } } else sendData("Cl" + "K"); // Error [3] = Skillevel not valid in this lobby } break; } case "_e": { if (Room != null && Room.Lobby != null && gamePlayer != null && gamePlayer.Game.State == Game.gameState.Waiting) { if (Room.Lobby.validGamerank(roomUser.gamePoints)) { int j = Encoding.decodeVL64(currentPacket.Substring(2)); int teamID = Encoding.decodeVL64(currentPacket.Substring(Encoding.encodeVL64(j).Length + 2)); if (teamID != gamePlayer.teamID && gamePlayer.Game.teamHasSpace(teamID)) { if (gamePlayer.teamID == -1) // User was a subviewer gamePlayer.Game.Subviewers.Remove(gamePlayer); gamePlayer.Game.movePlayer(gamePlayer, gamePlayer.teamID, teamID); } else sendData("Cl" + "H"); // Error [0] = Team full } else sendData("Cl" + "K"); // Error [3] = Skillevel not valid in this lobby } break; } case "_g": { leaveGame(); break; } case "_h": { if (Room != null && Room.Lobby != null && gamePlayer != null && gamePlayer.Game != null && gamePlayer == gamePlayer.Game.Owner) { int roomUID = Encoding.decodeVL64(currentPacket.Substring(2)); for (int i = 0; i < gamePlayer.Game.Teams.Length; i++) { foreach (gamePlayer Member in gamePlayer.Game.Teams[i]) { if (Member.roomUID == roomUID) { Member.sendData("Cl" + "RA"); // Error [6] = kicked from game gamePlayer.Game.movePlayer(Member, i, -1); return; } } } } break; } case "_j": { if (Room != null && Room.Lobby != null && gamePlayer != null && gamePlayer == gamePlayer.Game.Owner) { gamePlayer.Game.startGame(); } break; } case "_k": { if (gamePlayer != null && gamePlayer.Game.State == Game.gameState.Started && gamePlayer.teamID != -1) { gamePlayer.goalX = Encoding.decodeVL64(currentPacket.Substring(3)); gamePlayer.goalY = Encoding.decodeVL64(currentPacket.Substring(Encoding.encodeVL64(gamePlayer.goalX).Length + 3)); } break; } case "_l": { if (gamePlayer != null && gamePlayer.Game.State == Game.gameState.Ended && gamePlayer.teamID != -1) { gamePlayer.Game.sendData("BK" + "" + _Username + " wants to replay!" + Convert.ToChar(2)); } break; } case "_V": { //not coded? break; } case "Dn": { sendData("FY" + "QA1Bouncing Ball level 1III2Bouncing Ball level 2IJI3Bouncing Ball level 3IKI4Bouncing Ball level 4IPAI5Bouncing Ball level 5IQAHFYQA1Bouncing Ball level 1III2Bouncing Ball level 2IJI3Bouncing Ball level 3IKI4Bouncing Ball level 4IPAI5Bouncing Ball level 5IQAH"); break; } case "Dc": { sendData("DcFG"); break; } case "Da": { if (Room != null && roomUser != null) statusManager.addStatus("joingame", "3 1/"); break; } case "Dl": { sendData("FI" + "RA"); break; } case "Dw": { sendData("DwFL"); break; } case "Dr": { sendData("Br" + "Da"); break; } case "Du": { sendData("FL" + "PBH"); break; } case "Dv": { sendData("DvBK" + "Dv"); break; } case "Ds": { if (gamePlayer != null && gamePlayer.Game.Owner.User == this) { gamePlayer.Game.startGame(); } break; } case "Dx": { sendData("DxQA"); break; } #endregion } #endregion } }