VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "clsFunctions" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = False Function forceError(Index As Integer) 'Send a 'SERVER ERROR' message to a user Send Index, "Dk" & encodeVL64(Index) & Time & " " & Format(Date, "dd/mm/yyyy") & Chr(2) & Chr(1) End Function Function checkBanned(Index As Integer) As Boolean 'Check if the user with the name as Holo(Index).Name is banned 'Load the row with the criteria where searching bRow = HoloDB.runRead("SELECT * FROM bans WHERE name = '" & Holo(Index).Name & "' OR ipaddress = '" & hSYS.sckGame(Index).RemoteHostIP & "'") If bRow <> "" Then 'Woah, it's banned! bLen = Split(bRow, Chr(9))(2) If DateDiff("h", bLen, Now()) < 0 Then 'If the ban is still valid bReason = Replace(Split(bRow, Chr(9))(3), Chr(129), "'") 'Send the ban window Send Index, "@c" & bReason & Chr(1) checkBanned = True Else 'The ban has elapsed bName = Split(bRow, Chr(129))(0) bAddress = Split(bRow, Chr(9))(1) 'Delete it from the database, proceed with login If bName <> "" Then HoloDB.runQuery ("DELETE FROM bans WHERE name = '" & bName & "'") If bAddress <> "" Then HoloDB.runQuery ("DELETE FROM bans WHERE name = '" & bAddress & "'") End If End If End Function Function V7Register(strData As String, Index As Integer) Dim wName As String, fName As String 'Normal, non-SSO register 'Get the parts from that nasty string, you don't need to get a hang of this strTemp = Mid(strData, 5) wName = Mid(strTemp, 3, decodeB64(Left(strTemp, 2))) strTemp = Mid(strTemp, 3 + decodeB64(Left(strTemp, 2)) + 2) wFigure = Mid(strTemp, 3, decodeB64(Left(strTemp, 2))) strTemp = Mid(strTemp, 3 + decodeB64(Left(strTemp, 2)) + 2) wSex = Mid(strTemp, 3, decodeB64(Left(strTemp, 2))) strTemp = Mid(strTemp, 3 + decodeB64(Left(strTemp, 2)) + 6) wMail = Mid(strTemp, 3, decodeB64(Left(strTemp, 2))) strTemp = Mid(strTemp, 3 + decodeB64(Left(strTemp, 2)) + 2) wBirth = Mid(strTemp, 3, decodeB64(Left(strTemp, 2))) strTemp = Mid(strTemp, 3 + decodeB64(Left(strTemp, 2)) + 11) wPass = Mid(strTemp, 3, decodeB64(Left(strTemp, 2))) If HoloDB.checkExists("SELECT id FROM users WHERE name = '" & wName & "'") = False Then 'If the user doesn't exist yet (double check) fName = wName fName = bFilter(fName, Index) 'Get a wordfiltered copy of the name 'If the original username is different than the filtered name (so it contained a swear word), or it contains a forbidden part (double check) If (LCase(fName) <> LCase(wName)) Or checkForbidden(wName) = True Then 'Disconnect him! Probably a @k packet sender... hSYS.closeSocket Index Exit Function End If nID = HoloDB.runRead("SELECT users FROM system") + 1 'Get the new users ID HoloDB.runQuery ("UPDATE system SET users = users + 1") 'Update the usercount in system table with + 1 HoloDB.runQuery ("INSERT INTO users (id,name,password,email,birth,hbirth,figure,sex,credits,rank,lastvisit,badges) VALUES ('" & nID & "','" & fName & "','" & wPass & "','" & wMail & "','" & wBirth & "','" & Date & "','" & wFigure & "','" & wSex & "','0','1','" & Now() & "','0,')") HoloDB.runQuery ("INSERT INTO messenger(name,mcount,mdat) VALUES ('" & fName & "','0','0')") 'Write the users info in the database 'Done, now the user will send @D and normal login will proceed End If End Function Function V7Login(strData As String, Index As Integer) 'Normal login, non-SSO login 'Get the username + password from the packet (@D) uName = Mid(strData, 5, decodeB64(Mid(strData, 3, 2))) uPass = Mid(strData, 7 + Len(uName)) 'Search a row from the database that contains this criticeria cRow = HoloDB.runRead("SELECT name,password FROM users WHERE name = '" & uName & "'") If cRow = "" Then GoTo nF cPass = Split(cRow, Chr(9))(1) 'Get the password from the row If cPass <> "" And cPass = uPass Then 'If the password from the row is the same as the sent password, and both passwords are not blank, the user exists and login! Holo(Index).Name = Split(cRow, Chr(9))(0) 'Set the name for the User profile If checkBanned(Index) = False Then funcLib.processLogin Index 'If the user is not banned, process the login Else 'The user is not found/password wrong nF: Send Index, "@alogin incorrect: Wrong password" & Chr(1) End If End Function Function V12Login(strData As String, Index As Integer) 'SSO login (site login) 'strTicket = Mid(strData, 5, decodeB64(Mid(strData, 3, 2))) 'NOT NEEDED TO DECODE strTicket = Mid(strData, 5) 'Get the ticket from the packet ticketRow = HoloDB.runRead("SELECT name,ipaddress FROM sso WHERE ticket = '" & strTicket & "'") 'Get the name from the sso table in the database matching this ticket If ticketRow <> "" Then 'There was a ticket like the one sent If Split(ticketRow, Chr(9))(1) = hSYS.sckGame(Index).RemoteHostIP Then 'If the IP trying to log in from is the same as the one who requested the ticket Holo(Index).Name = Split(ticketRow, Chr(9))(0) 'Set the name for the user profile If checkBanned(Index) = False Then 'If the user is not banned HoloDB.runQuery ("DELETE FROM sso WHERE name = '" & Holo(Index).Name & "'") 'Delete all tickets in the table for this user (since logging in has succeeded) funcLib.processLogin Index 'Process with login End If Else forceError Index hSYS.closeSocket Index End If Else forceError Index hSYS.closeSocket Index End If End Function Function processLogin(Index As Integer) 'Proceed with login modServer.stopUser Index 'Disconnect previous logged in clones of this user 'Pick an untoken room identifier for the user For n = 5 To 500 If InStr(Server.rNums, "[" & n & "]") = False Then Holo(Index).rNum = n Exit For End If Next n 'Update the list Server.rNums = Server.rNums & "[" & Holo(Index).rNum & "]" Send Index, "@C" & Chr(1) 'Send the 'let the login begin' packet End Function Function getUserInfo(Index As Integer) Dim uArray() As String 'Prepare the users info in the memory uArray() = Split(Replace(HoloDB.runRead("SELECT figure,sex,mission,consolemission,credits,tickets,rank FROM users WHERE name = '" & Holo(Index).Name & "'"), Chr(129), "'"), Chr(9)) Holo(Index).Figure = uArray(0) Holo(Index).Sex = uArray(1) Holo(Index).Mission = uArray(2) Holo(Index).Credits = uArray(4) 'Holo(Index).Tickets = uArray(5) Holo(Index).Rank = uArray(6) Send Index, "@B" & Rank(Holo(Index).Rank).fuseRights & Chr(1) 'Send the fuserights that match the users rank End Function Function processBadges(Index As Integer) Dim uBadges() As String Dim wearBadge As Integer, showBadge As Integer, cntBadges As Integer 'Send the users badges [!] Haven't tested yet, can't enter rooms so... ^^ uBadges() = Split(HoloDB.runRead("SELECT badges FROM users WHERE name = '" & Holo(Index).Name & "'"), "/") If uBadges(0) = "1" Then 'If the user has his badge enabled Holo(Index).showBadge = True showBadge = 1 End If If UBound(uBadges) > 0 Then 'If the user has badges wearBadge = 1 For b = 1 To UBound(uBadges) badgePack = badgePack & uBadges(b) & Chr(2) cntBadges = cntBadges + 1 Next b End If 'Holo(Index).nowBadge = uBadges(1) 'Set the users current badge 'Send the data to the user Send Index, "Ce" & encodeVL64(UBound(uBadges)) & badgePack & encodeVL64(wearBadge) & encodeVL64(showBadge) & Chr(1) End Function Function grabConsole(Index As Integer) End Function Function processClub(Index As Integer) 'Get Club days [!] Nothing done yet [!] Send Index, "@Gclub_habbo" & Chr(2) & encodeVL64(0) & encodeVL64(0) & encodeVL64(0) & encodeVL64(0) & Chr(1) End Function Function processUserInfo(Index As Integer) 'Send the users final login data Send Index, "@E" & Index & Chr(2) & Holo(Index).Name & Chr(2) & Holo(Index).Figure & Chr(2) & Holo(Index).Sex & Chr(2) & Holo(Index).Mission & Chr(2) & "Hch=s02/253,146,160" & Chr(2) & "HI" & Chr(1) & "@F" & Holo(Index).Credits & Chr(1) & "A|" & Holo(Index).Tickets & Chr(1) & "@DH" & Chr(1) & "DtI" & Chr(1) & "DoH" & Chr(1) Holo(Index).receivedFurniIndex = False If Server.welcMessage <> "" Then Send Index, "BK" & Replace(Replace(Server.welcMessage, "%name%", Holo(Index).Name), "%release%", "V" & App.Major & "." & App.Minor & " R" & App.Revision) & Chr(1) End Function Function checkName(strData As String, Index As Integer) Dim wName As String, fName As String 'Check if the name doesn't exist yet and if it's not containing swearwords and/or forbidden names/words wName = Mid(strData, 5, decodeB64(Mid(strData, 3, 2))) 'Get the name from the packet (@j) If HoloDB.checkExists("SELECT id FROM users WHERE name = '" & wName & "'") = True Then 'If there's already a user with that name 'Send the name is already taken Send Index, "@dPA" & Chr(1) Else 'Get a wordfiltered copy of the name fName = wName fName = bFilter(fName, Index) If (LCase(fName) <> LCase(wName)) Or checkForbidden(wName) = True Then 'If the original username is different than the filtered name (so it contained a swear word), or it contains a forbidden part 'Send it's an unacceptable name Send Index, "@dK" & Chr(1) Else 'Let the new-user proceed in registration Send Index, "@dH" & Chr(1) End If End If End Function Function checkPassword(strData As String, Index As Integer) 'Check if it's a valid password 'Get the password from the packet wName = Mid(strData, 5, decodeB64(Mid(strData, 3, 2))) wPass = Mid(strData, 7 + Len(wName)) If Len(wPass) > 5 And Len(wPass) < 10 Then gLen = True 'If the passwords length is okay For n = 0 To 9 If InStr(wPass, n) Then gNum = True 'If the password contains a number Next n If gLen = True And gNum = True Then 'Send that the password is valid Send Index, "DZH" & Chr(1) Else 'Send that the password is invalid Send Index, "DZI" & Chr(1) End If End Function Function updateDetails(strData As String, Index As Integer) 'Update Mission, look and/or sex via Hotel View 'Get the data from the packet wLook = Mid(strData, 7, decodeB64(Mid(strData, 5, 2))) wMisSex = Mid(strData, 7 + Len(wLook)) rPart = Mid(strData, Len(wLook) + 7) 'Split the packet till the stuff we want is found rePart: If Left(rPart, 2) = "@E" Then sLen = decodeB64(Mid(rPart, 3, 2)) wSex = Mid(rPart, 5, sLen) rPart = Mid(rPart, 5 + sLen) GoTo rePart End If If Left(rPart, 2) = "@F" Then mLen = decodeB64(Mid(rPart, 3, 2)) wMission = bFilter(Mid(rPart, 5, mLen), Index) rPart = Mid(rPart, 5 + mLen) GoTo rePart End If 'Update the look in the database (users table) HoloDB.runQuery ("UPDATE users SET figure = '" & wLook & "' WHERE name = '" & Holo(Index).Name & "'") 'Update the look in the servers memory Holo(Index).Figure = wLook If wSex <> "" Then 'If the user has changed it's sex 'Update the sex in the database + servers memory HoloDB.runQuery ("UPDATE users SET sex = '" & wSex & "' WHERE name = '" & Holo(Index).Name & "'") Holo(Index).Sex = wSex End If If wMission <> "" Then 'If the user has changed it's mission 'Update the mission in the database + servers memory HoloDB.runQuery ("UPDATE users SET mission = '" & Replace(wMission, "'", Chr(129)) & "' WHERE name = '" & Holo(Index).Name & "'") Holo(Index).Mission = wMission End If 'Send the data to the client (to show the changes) Send Index, "@E" & Index & Chr(2) & Holo(Index).Name & Chr(2) & Holo(Index).Figure & Chr(2) & Holo(Index).Sex & Chr(2) & Holo(Index).Mission & Chr(2) & "Hch=s02/253,146,160" & Chr(2) & "HI" & Chr(1) 'If the user is in a room, poof! If Holo(Index).guestRoom > 0 Then sendGuestRoom Holo(Index).guestRoom, "DJ" & encodeVL64(Holo(Index).rNum) & Holo(Index).Figure & Chr(2) & Holo(Index).Sex & Chr(2) & Holo(Index).Mission & Chr(2) & Chr(1) End Function Function changeConsoleMission(strData As String, Index As Integer) Dim cMission As String 'Change Console mission in the Console (by clicking it away, client sends the update) 'Wordfilter and trim the new Console mission retrieved from the packet cMission = bFilter(Trim(Mid(strData, 5, decodeB64(Mid(strData, 3, 2)))), Index) If cMission = "" Then cMission = " " 'If the new Console mission is blank then it's one space 'Update the console mission in the database HoloDB.runQuery ("UPDATE users SET consolemission = '" & Replace(cMission, "'", Chr(129)) & "' WHERE name = '" & Holo(Index).Name & "'") 'Send the data to the client (to show the changes) Send Index, "BS" & cMission & Chr(2) & Chr(1) End Function Function redeemVoucher(strData As String, Index As Integer) 'Redeem a credit voucher via your Purse sVoucher = Mid(strData, 5, decodeB64(Mid(strData, 3, 2))) 'Get the vouchercode sent from the packet sAmount = HoloDB.runRead("SELECT credits FROM vouchers WHERE voucher = '" & sVoucher & "'") 'Get the row matching that voucher code from the database If sAmount <> "" Then 'If the row is not blank (so there is a row with that voucher) If IsNumeric(sAmount) Then 'If the amount of the voucher is numeric (so, valid) Holo(Index).Credits = Holo(Index).Credits + Val(sAmount) 'Make the new Credits count HoloDB.runQuery ("UPDATE users SET credits = '" & Holo(Index).Credits & "' WHERE name = '" & Holo(Index).Name & "'") 'Set the users new Credits in the database updateCredits Index 'Send the ka-ching! sound and the new Credits count, Send Index, "CT" & Chr(1) 'Send the 'The code was valid. You've got the Credits.' message End If 'Delete the voucher from the database If sVoucher <> "" Then HoloDB.runQuery ("DELETE FROM vouchers WHERE voucher = '" & sVoucher & "'") Else 'The row was blank, meaning there was no such row with that code, so the code doesn't exist Send Index, "CU1" & Chr(1) End If End Function Function buyClub(strData As String, Index As Integer) Dim upDays As Integer Dim upMonths As Integer Dim dPrice As Integer 'Buy Club subscription [!] Not working yet [!] mChoice = decodeVL64(Right(strData, 1)) Select Case mChoice Case 1 upDays = 31 upMonths = 1 dPrice = 30 Case 2 upDays = 93 upMonths = 3 dPrice = 70 Case 3 upDays = 186 upMonths = 6 dPrice = 120 Case Else Exit Function End Select If Holo(Index).Credits < dPrice Then Send Index, "@tt=552" & Chr(13) & "p=0" & Chr(1) Exit Function End If HoloDB.runRead ("SELECT clubdays,clubmonths,badges FROM users WHERE name = '" & Holo(Index).Name & "'") End Function Function messengerSearch(strData As String, Index As Integer) Dim mDat() As String 'Search a user on the Console (messenger) mQry = Mid(strData, 5, decodeB64(Mid(strData, 3, 2))) 'Get the search query from the packet (so, the name you are searching) mRow = Replace(HoloDB.runRead("SELECT id,name,figure,consolemission,sex,lastvisit FROM users WHERE name = '" & mQry & "'"), Chr(129), "'") 'Get the row from users table matching that user If mRow <> "" Then 'The row was not blank, the user you searched for exists mDat() = Split(mRow, Chr(9)) 'Split the user content out of the row If mDat(4) = "F" Then mDat(4) = "H" Else mDat(4) = "I" 'Determinde the users sex If mDat(5) = "" Then 'If the user has no 'lastvisit' moment 'Set it's lastvisit moment to 'now' mDat(5) = Format(Date, "dd-mm-yyyy") & " " & Format(Time, "hh:mm") HoloDB.runQuery ("UPDATE users SET lastvisit = '" & mDat(5) & "' WHERE name = '" & mQry & "'") End If mPos = findPos(mDat(1)) 'Find the current Hotel position of the user 'The user exists, send it's result to the 'searcher' Send Index, "B@MESSENGER" & Chr(2) & encodeVL64(mDat(0)) & mDat(1) & Chr(2) & mDat(4) & Replace(mDat(3), Chr(129), "'") & Chr(2) & mPos & Chr(2) & mDat(5) & Chr(2) & mDat(2) & Chr(2) & Chr(1) Else 'The user does not exist, send that it does not exist to the 'searcher' Send Index, "B@MESSENGER" & Chr(2) & "H" & Chr(1) End If End Function Function newRoom(strData As String, Index As Integer) Dim roomDat() As String strData = Mid(strData, 3) 'Cut the header off roomDat() = Split(strData, "/") 'Put the parts in an array rName = bFilter(roomDat(2), Index) rModel = Replace(roomDat(3), "model_", "") rState = roomDat(4) rShowname = roomDat(5) 'Check if it's a valid room model, if not, stop creating! If (InStr(Server.roomModels, "|" & rModel & "|") And Len(rModel) = 1) = False Then Exit Function myRoomCount = UBound(Split(HoloDB.runRead("SELECT id FROM guestrooms WHERE owner = '" & Holo(Index).Name & "'"), Chr(13))) + 1 If myRoomCount <= 10 Then If rState = "closed" Then 'Doorbell rState = 1 ElseIf rState = "password" Then 'Password rState = 2 Else 'Open rState = 0 End If rID = HoloDB.runRead("SELECT guestrooms FROM system") + 1 HoloDB.runQuery ("UPDATE system SET guestrooms = guestrooms + 1") HoloDB.runQuery ("INSERT INTO guestrooms (id,name,owner,model,decor,state,showname,incnt) VALUES ('" & rID & "','" & Replace(rName, "'", Chr(129)) & "','" & Holo(Index).Name & "','" & rModel & "','0,0','" & rState & "','" & rShowname & "','0')") Send Index, "@{" & rID & Chr(13) & rName & Chr(1) Else Send Index, "BK" & "Sorry, but you've reached your guestrooms limit, which is 10 rooms per user.
Please delete some rooms to make space." & Chr(1) End If End Function Function updateRoom(strData As String, Index As Integer) Dim roomDat() As String, rID As Integer, rEveryoneRights As Integer strData = Mid(strData, 3) 'Cut the header (@Y) off If Left(strData, 1) = "/" Then 'Phase 2 of creating a new room rID = Mid(strData, 2, InStr(strData, "/")) 'Get the room number roomDat() = Split(strData, Chr(13)) rDesc = Replace(Replace(roomDat(1), "description=", ""), "'", Chr(129)) rPassword = Replace(Replace(roomDat(2), "password=", ""), "'", Chr(129)) rEveryoneRights = Replace(roomDat(3), "allsuperuser=", "") rMaxIN = 25 Else 'Modify room rID = Left(strData, InStr(strData, "/") - 1) roomDat() = Split(strData, Chr(13)) rDesc = Replace(Replace(roomDat(1), "description=", ""), "'", Chr(129)) If InStr(strData, "password=") = False Then rEveryoneRights = Replace(roomDat(2), "allsuperuser=", "") rMaxIN = Replace(roomDat(3), "maxvisitors=", "") Else rPassword = Replace(roomDat(2), "password=", "") rEveryoneRights = Replace(roomDat(3), "allsuperuser=", "") rMaxIN = Replace(roomDat(4), "maxvisitors=", "") End If End If If HoloDB.runRead("SELECT owner FROM guestrooms WHERE id = '" & rID & "'") = Holo(Index).Name Then 'If the user is the owner of this room 'Okay, the user is the owner of the room, let's write in the database! HoloDB.runQuery ("UPDATE guestrooms SET descr = '" & rDesc & "',password = '" & rPassword & "',superuser = '" & rEveryoneRights & "',maxin = '" & rMaxIN & "' WHERE id = '" & rID & "'") funcLib.seeUserRooms "", Index End If End Function Function modifyRoom(strData As String, Index As Integer, editMode As Integer) If editMode = 0 Then 'Load the room data after the button click roomID = decodeVL64(Mid(strData, 3)) roomRow = HoloDB.runRead("SELECT owner,category FROM guestrooms WHERE id = '" & roomID & "'") If Split(roomRow, Chr(9))(0) = Holo(Index).Name Then Send Index, "C^" & encodeVL64(roomID) & catNum(Val(Split(roomRow, Chr(9))(1)), True) & Chr(1) ElseIf editMode = 1 Then '@X packet 'strData = Mid(strData, 3) Dim roomDat() As String roomDat() = Split(Mid(strData, 3), "/") If HoloDB.runRead("SELECT owner FROM guestrooms WHERE id = '" & roomDat(0) & "'") = Holo(Index).Name Then If roomDat(2) = "open" Then roomDat(2) = 0 ElseIf roomDat(2) = "closed" Then roomDat(2) = 1 ElseIf roomDat(2) = "password" Then roomDat(2) = 2 Else roomDat(2) = 0 End If HoloDB.runQuery ("UPDATE guestrooms SET name = '" & roomDat(1) & "',state = '" & roomDat(2) & "',showname = '" & roomDat(3) & "' WHERE id = '" & roomDat(0) & "'") End If ElseIf editMode = 2 Then 'Update category roomID = decodeVL64(Mid(strData, 3)) catID = catNum(Mid(strData, 3 + Len(encodeVL64(roomID))), False) If catID = 1 And Rank(Holo(Index).Rank).staffFloor = False Or (IsNumeric(roomID) = False) Then Exit Function If HoloDB.runRead("SELECT owner FROM guestrooms WHERE id = '" & roomID & "'") = Holo(Index).Name Then HoloDB.runQuery ("UPDATE guestrooms SET category = '" & catID & "' WHERE id = '" & roomID & "'") End If End If End Function Function seeUserRooms(strData As String, Index As Integer) Dim roomPack As String Dim userRoom() As String, roomDat() As String roomStr = HoloDB.runRead("SELECT id,name,descr,maxin,state,incnt FROM guestrooms WHERE owner = '" & Holo(Index).Name & "' ORDER BY guestrooms.incnt DESC") If roomStr <> "" Then 'User has rooms userRoom() = Split(roomStr, Chr(13)) For R = 0 To UBound(userRoom) roomDat() = Split(userRoom(R), Chr(9)) 'Determine room status If roomDat(4) = "1" Then roomDat(4) = "closed" ElseIf roomDat(4) = "2" Then roomDat(4) = "password" Else roomDat(4) = "open" End If 'Add to our packet roomPack = roomPack & roomDat(0) & Chr(9) & Replace(roomDat(1), Chr(129), "'") & Chr(9) & Holo(Index).Name & Chr(9) & roomDat(4) & Chr(9) & "x" & Chr(9) & roomDat(5) & Chr(9) & roomDat(3) & Chr(9) & "null" & Chr(9) & Replace(roomDat(2), Chr(129), "'") & Chr(9) & Chr(13) Next R Send Index, "@P" & roomPack & Chr(1) Else 'User has no rooms Send Index, "@y" & Holo(Index).Name & Chr(1) End If End Function Function searchRoom(strData As String, Index As Integer) Dim roomSplit() As String, roomDat() As String toSearch = Mid(strData, 4, Len(strData) - 4) roomStr = HoloDB.runRead("SELECT id,name,owner,descr,state,showname,maxin,incnt FROM guestrooms WHERE owner = '" & toSearch & "' OR name LIKE '%" & toSearch & "'") If roomStr <> "" Then roomSplit() = Split(roomStr, Chr(13)) For D = 0 To UBound(roomSplit) roomDat() = Split(roomSplit(D), Chr(9)) If roomDat(5) = "0" Then If roomDat(2) <> Holo(Index).Name And Rank(Holo(Index).Rank).seeAllOwners = False Then roomDat(2) = "" End If roomDat(4) = roomState(Int(roomDat(4))) roomPack = roomPack & roomDat(0) & Chr(9) & Replace(roomDat(1), Chr(129), "'") & Chr(9) & roomDat(2) & Chr(9) & roomDat(5) & Chr(9) & "x" & Chr(9) & roomDat(7) & Chr(9) & roomDat(6) & Chr(9) & "null" & Chr(9) & Replace(roomDat(3), Chr(129), "'") & Chr(9) & Chr(13) Next D Send Index, "@w" & roomPack & Chr(1) Else Send Index, "@z" & Chr(1) End If End Function Function refreshRecRooms(Index As Integer) Dim roomDat() As String cntRooms = Int(HoloDB.runRead("SELECT guestrooms FROM system")) 'Get the current guestroom count If cntRooms = 0 Then Exit Function 'If there are no guestrooms then exit gotRooms = "|" If cntRooms < 3 Then mR = cntRooms Else mR = 3 For g = 1 To mR reGrab: rID = rndVal(1, cntRooms) If InStr(gotRooms, "|" & rID & "|") Then GoTo reGrab 'If the room is already picked roomRow = HoloDB.runRead("SELECT name,owner,descr,maxin,showname,state,incnt FROM guestrooms WHERE id = '" & rID & "'") If roomRow = "" Then GoTo reGrab 'If there was no room with that number found (so it was deleted) roomDat() = Split(roomRow, Chr(9)) 'If roomDat(4) = "0" Then GoTo reGrab 'If the room owner doesn't want to show it's room) [DISABLED] roomPack = roomPack & encodeVL64(rID) & Replace(roomDat(0), Chr(129), "'") & Chr(2) & roomDat(1) & Chr(2) & roomState(roomDat(5)) & Chr(2) & encodeVL64(roomDat(6)) & encodeVL64(roomDat(3)) & Replace(roomDat(2), Chr(129), "'") & Chr(2) 'Add the data to the packet gotRooms = gotRooms & rID & "|" 'Add the room to the 'already added rooms' list Next g 'Send the data Send Index, "E_" & encodeVL64(mR) & roomPack & Chr(2) & Chr(1) End Function Function navLists(strData As String, Index As Integer) Dim catSection As String, navPack As String catSection = Mid(strData, 3) '.slinkyMassiva = 1 'Uncomment this to see the part of a category in action With pubCounts 'Prepare prefix for pubCounts (less typing =]) .holoLido2 = 0 Select Case catSection 'Determine what part of the category's the user wants to see Case "HKI", "IKI" 'Public Rooms root category navPack = "C\HKH" & "Public Rooms" & "" navPack = navPack & "YzAZj^IRKI" & "Welcome Lounge" & "" & encodeVL64(.welcomeLounge) & "POKwelcome_lounge[M{Hhh_room_nlobbyHISBI" navPack = navPack & "Safety Spa" & "" & encodeVL64(.safetySpa) & "POKcafe_goldZP{Hhh_room_goldHIR`I" navPack = navPack & "Sporty Gym" & "" & encodeVL64(.sportRoom) & "PYKsportYW{Hhh_room_sportHIRUI" navPack = navPack & "The Theatre" & "" & encodeVL64(.theatreDome) & "PYKtheatredrome_xmasXS{Hhh_room_theater_xmasHIP\H" navPack = navPack & "Entertainment" & "" & encodeVL64(.theDen + .hotelCinema + .theLibrary) & "PrKQQH" navPack = navPack & "Outside spaces" & "" & encodeVL64(.holoLido + .holoLido2 + .rooftopRumble + .holoHarbor + .picknickPark + .zenGarden + .thePark + .infoBus + .sunTerrace + .sakuraSquare + .sakuraSquare2 + .hotelRoof + .hotelRoof2) & "XGBKYBAH" navPack = navPack & "SnowStorm lobbies" & "" & encodeVL64(0) & "YQAKPaH" navPack = navPack & "BattleBall: Rebound! lobbies" & "" & encodeVL64(0) & "XbSKSPH" navPack = navPack & "Cafes" & "" & encodeVL64(.cafeOle + .galleryCafe + .iceCafe) & "PYKQuH" navPack = navPack & "Holo Club rooms" & "" & encodeVL64(.flyingCarrots + .theMajestic) & "PrKPQH" navPack = navPack & "Dance, clubs & pubs" & "" & encodeVL64(.dirtyDuck + .chromideClub + .slinkyMassiva + .slinkyDancefloor + .dirtyDuck) & "ZRAKSFI" navPack = navPack & "Hotel Kitchen" & "" & encodeVL64(.hotelKitchen) & "SHKhotel_kitchenXO{Hhh_room_kitchenHIRPH" navPack = navPack & "The Lobbies" & "" & encodeVL64(.lobbyMain + .lobbySkylight + .lobbyMedian + .lobbyBasement) & "[NAKS[H" navPack = navPack & "Restaurants" & "" & encodeVL64(.burgerRestaurant + .pizzaRestaurant) & "QPKSwH" navPack = navPack & "The Hallways" & "" & encodeVL64(.hallwayOne + .hallwayTwo) & "PrKRGH" navPack = navPack & "Cumming Focks Gamehall" & "" & encodeVL64(.gameLobby + .ticTacToe + .battleShips + .gameChess + .gamePoker) & "PwK" Case "HP\I" 'Public Rooms - Entertainment category navPack = "C\HP\H" & "Entertainment" & "POPrKSJI" & "The Den" & "" & encodeVL64(.theDen) & "PJP\the_denZM{Hhh_room_denHIQEI" & "Hotel Cinema" & "" & encodeVL64(.hotelCinema) & "POP\habbo_cinemaYN{Hhh_room_cinemaHIRYI" & "The Library" & "" & encodeVL64(.theLibrary) & "PYP\libraryZT{Hhh_room_libraryHI" Case "HQQI" 'Public Rooms - Outside spaces category navPack = "C\HQQH" & "Outside spaces" & "PoXGBKREI" & "The Holo Lido" & "" & encodeVL64(.holoLido + .holoLido2) & "PYQQhabbo_lidoXU{Hhh_room_pool,hh_people_poolHIPHI" & "Rooftop Rumble" & "" & encodeVL64(.rooftopRumble) & "QFQQrooftop_rumbleYP{Hhh_room_terrace,hh_paalu,hh_people_pool,hh_people_paaluHIQHI" & "Rooftop Rumble II" & "" & encodeVL64(.rooftopRumble) & "QFQQrooftop_rumble_iiXQ{Hhh_room_terrace,hh_paalu,hh_people_pool,hh_people_paaluHIQ{I" & "Holo Harbor" & "" & encodeVL64(.holoHarbor) & "HQQfloatinggarden[n{Hhh_room_floatinggardenHISYI" & "Picknick Park" & "" & encodeVL64(.picknickPark) & "QKQQpicnic[T{Hhh_room_picnicHIS_I" & "Zen Garden" & "" & encodeVL64(.zenGarden) & "PJQQchillZV{Hhh_room_chillHI[AAI" & _ "Hotel Rooftop" & "" & encodeVL64(.hotelRoof + .hotelRoof2) & "RLQQrooftop[r{Hhh_room_rooftopHIQII" & "The Park" & "" & encodeVL64(.thePark + .infoBus) & "PJQQparkZU{Hhh_room_park_general,hh_room_parkHISzI" & "Sakura Square" & "" & encodeVL64(.sakuraSquare) & "PYQQgate_parkYn{Hhh_room_gate_parkHIPZI" & "Sun Terrace" & "" & encodeVL64(.sunTerrace) & "PTQQsun_terraceYT{Hhh_room_sun_terraceHI" Case "HYBAI" 'Public Rooms - SnowStorm root category Send Index, "C\HYBAI" & "The lobbies are closed" & Chr(2) & "HI" Case "HPaI" 'Public Rooms - BattleBall root category Send Index, "C\HPaH" & "The lobbies are closed" & Chr(2) & "HI" Case "HSPI" 'Public Rooms - Cafes category navPack = "C\HSPH" & "Cafes" & "RAPYKPCI" & "Cafe Olé" & "" & encodeVL64(.cafeOle) & "QFSPcafe_oleZK{Hhh_room_cafeHIPEI" & "Gallery Cafe" & "" & encodeVL64(.galleryCafe) & "RLSPeric's_eaterieZN{Hhh_room_ericsHISII" & "Ice Cafe" & "" & encodeVL64(.iceCafe) & "QFSPice_cafeYO{Hhh_room_icecafeHI" Case "HQuI" 'Public Rooms - Holo Club rooms category navPack = "C\HQuH" & "Holo Club rooms" & "PKPrKQ`I" & "House of Flying Carrots" & "" & encodeVL64(.flyingCarrots) & "PYQuorientXW{Hhh_room_orientHIP`I" & "The Majestic" & "" & encodeVL64(.theMajestic) & "PYQuclub_mammoth[V{Hhh_room_clubmammothHI" Case "HPQI" 'Public Rooms - Dance, clubs & pubs category navPack = "C\HPQH" & "Dance, clubs & pubs" & "PQZRAKPKI" & "The Dirty Duck pub" & "" & encodeVL64(.dirtyDuck) & "RLPQthe_dirty_duck_pubXL{Hhh_room_pubHIRJI" & "The Chromide Club" & "" & encodeVL64(.chromideClub) & "PTPQthe_chromide_clubXN{Hhh_room_disco" & "HIQCH" & "Slinky Helsinki" & "" & encodeVL64(.slinkyMassiva + .slinkyDancefloor) & "PrPQ" Case "HQCI" 'Public Rooms - Chromide Club sub navPack = "C\HQCH" & "Chromide Club" & "QGPrPQPGI" & "Club Massiva" & "" & encodeVL64(.slinkyMassiva) & "PYQCclub_massivaZR{Hhh_room_barHIQGI" & "The Dancefloor" & "" & encodeVL64(.slinkyDancefloor) & "PYQCclub_massivaZR{Ihh_room_barHI" Case "HRPI" 'Public Rooms - The Lobbies category navPack = "C\HRPH" & "The Lobbies" & "I[NAKRHI" & "Main Lobby" & "" & encodeVL64(.lobbyMain) & "P^RPmain_lobby[K{Hhh_room_lobbyHISII" & "Skylight Lobby" & "" & encodeVL64(.lobbySkylight) & "RLRPskylight_lobbyYM{Hhh_room_floorlobbiesHIPII" & "Median Lobby" & "" & encodeVL64(.lobbyMedian) & "QFRPmedian_lobbyXM{Hhh_room_floorlobbiesHIRBI" & "Basement Lobby" & "" & encodeVL64(.lobbyBasement) & "P^RPbasement_lobby[L{Hhh_room_floorlobbiesHI" Case "HS[I" 'Public Rooms - Restaurants category navPack = "C\HS[H" & "Restaurants" & "PBQPKPFI" & "McHolo's" & "" & encodeVL64(.burgerRestaurant) & "PJS[habburger'sYL{Hhh_room_habburgerHIRII" & "Slice of Life" & "" & encodeVL64(.pizzaRestaurant) & "QFS[pizzeriaYQ{Hhh_room_pizzaHI" Case "HRGI" 'Public Rooms - Gamehall category navPack = "C\HRGH" & "Cumming Focks Gamehall" & "KPwKSCI" & "Gamehall Lobby" & "" & encodeVL64(.gameLobby) & "PORGcunning_fox_gamehall[N{Hhh_room_gamehall,hh_gamesHIPDI" & "Tic Tac Toe" & "" & encodeVL64(.ticTacToe) & "PJRGcunning_fox_gamehall[N{Ihh_room_gamehall,hh_gamesHIQDI" & "Battleships" & "" & encodeVL64(.battleShips) & "SJRGcunning_fox_gamehall[N{Jhh_room_gamehall,hh_gamesHIRDI" & "Chess" & "" & encodeVL64(.gameChess) & "PJRGcunning_fox_gamehall[N{Khh_room_gamehall,hh_gamesHISDI" & "Poker" & "" & encodeVL64(.gamePoker) & "PJRGcunning_fox_gamehall[N{PAhh_room_gamehall,hh_gamesHI" Case "HSwI" 'Public Rooms - The Hallways category navPack = "C\HSwH" & "The Hallways" & "SBPrKQFI" & "Hallway I" & "" & encodeVL64(.hallwayOne) & "PYSwhallway[U{Hhh_room_hallwayHIRFI" & "Hallway II" & "" & encodeVL64(.hallwayTwo) & "PYSwhallway_iiXV{Hhh_room_hallwayHI" Case "HPAI", "IPAI" 'Guestrooms root category Dim gC(1 To 10) As String For C = 1 To 10 gC(C) = HoloDB.runRead("SELECT SUM(incnt) FROM guestrooms WHERE category = '" & C & "'") If gC(C) = "" Then gC(C) = 0 gC(C) = gC(C) * 8 Next C navPack = "C\HPAH" & "Guest Rooms" & "" & "Q_PAHSLJ" & guestCat(1) & "" & encodeVL64(gC(1)) & "YRBPAHRLJ" & guestCat(2) & "" & encodeVL64(gC(2)) & "[pEPAHPRJ" & guestCat(3) & "" & encodeVL64(gC(3)) & "XwEPAHRQJ" & guestCat(4) & "" & encodeVL64(gC(4)) & "ZyEPAHS\J" & guestCat(5) & "" & encodeVL64(gC(5)) & "XwEPAHQ]J" & guestCat(6) & "" & encodeVL64(gC(6)) & "ZtEPAHR]J" & guestCat(7) & "" & encodeVL64(gC(7)) & "XmEPAHS]J" & guestCat(8) & "" & encodeVL64(gC(8)) & "XPFPAHP^J" & guestCat(9) & "" & encodeVL64(gC(9)) & "XZFPAHSRJ" & guestCat(10) & "" & encodeVL64(gC(10)) & "ZyEPAH" Case "GCINDEX" 'Guestroom category index for users (where they can put their rooms in) navPack = "H" & "No category" & Chr(2) 'Make the first packet If Rank(Holo(Index).Rank).staffFloor = True Then navPack = navPack & "SL" & guestCat(1) & Chr(2) 'If the user has access to the staff category (staff floor) then add it 'Add the categories navPack = navPack & "RL" & guestCat(2) & Chr(2) & "PR" & guestCat(3) & Chr(2) & "RQ" & guestCat(4) & Chr(2) & "S\" & guestCat(5) & Chr(2) & "Q]" & guestCat(6) & Chr(2) & "R]" & guestCat(7) & Chr(2) & "S]" & guestCat(8) & Chr(2) & "P^" & guestCat(9) & Chr(2) & "SR" & guestCat(10) & Chr(2) 'Complete the pack navPack = "C]" & encodeVL64(UBound(Split(navPack, Chr(2)))) & navPack & Chr(1) Case Else 'A different packet If Left(catSection, 1) = "H" Or Left(catSection, 1) = "I" Then 'Guestroom category - User opens a category Dim catID As String catID = Mid(catSection, 2, 2) 'Determine the ID catHeader = "H" & catID & "J" & guestCat(catNum(catID, False)) 'Determine the category header 'Get all data from the rooms in the category roomStr = HoloDB.runRead("SELECT id,name,owner,descr,maxin,showname,state,incnt FROM guestrooms WHERE category = '" & catNum(catID, False) & "' ORDER BY guestrooms.incnt DESC LIMIT 30") If roomStr <> "" Then 'If there were rooms Dim catSplit() As String Dim roomDat() As String catSplit() = Split(roomStr, Chr(13)) For R = 0 To UBound(catSplit) roomDat() = Split(catSplit(R), Chr(9)) If roomDat(5) = "0" Then If roomDat(2) <> Holo(Index).Name And Rank(Holo(Index).Rank).seeAllOwners = False Then roomDat(2) = "-" roomPack = roomPack & encodeVL64(roomDat(0)) & Replace(roomDat(1), Chr(129), "'") & Chr(2) & roomDat(2) & Chr(2) & roomState(roomDat(6)) & Chr(2) & encodeVL64(roomDat(7)) & encodeVL64(roomDat(4)) & Replace(roomDat(3), Chr(129), "'") & Chr(2) Next R roomCount = UBound(catSplit) + 1 navPack = "C\" & catHeader & Chr(2) & "I" & encodeVL64(15 * roomCount) & "PA" & encodeVL64(roomCount) & roomPack & Chr(1) Else navPack = "C\" & catHeader & Chr(2) & "IHPAH" & Chr(1) End If End If End Select End With 'Close prefix for pubCounts If navPack <> "" Then Send Index, Replace(Replace(navPack, Chr(2) & Chr(2), ""), Chr(1) & Chr(1), "") 'Tidy up the navPack and transmit it End Function Function enterRoom(strData As String, Index As Integer) strData = Mid(strData, 3) 'Cut the header off Send Index, "@S" & Chr(1) If Holo(Index).guestRoom > 0 Then leaveRoom Index, False If Left(strData, 1) = "A" Then 'User enters a publicroom [!] no publicrooms yet [!] pubID = Mid(strData, 2, 3) Select Case pubID Case "NO PUBS YET!" End Select End If End Function Function enterGuestroom(strData As String, Index As Integer) Dim roomID As Long, roomDat() As String roomID = Mid(strData, 3) roomRow = HoloDB.runRead("SELECT name,owner,descr,model,state,superuser,showname,maxin,incnt FROM guestrooms WHERE id = '" & roomID & "'") If roomRow <> "" Then roomDat() = Split(roomRow, Chr(9)) Send Index, "@v" & encodeVL64(roomDat(5)) & encodeVL64(roomDat(4)) & encodeVL64(roomID) & roomDat(1) & Chr(2) & "model_" & roomDat(3) & Chr(2) & Replace(roomDat(0), Chr(129), "'") & Chr(2) & Replace(roomDat(2), Chr(129), "'") & Chr(2) & encodeVL64(roomDat(6)) & "H" & "H" & encodeVL64(roomDat(7)) & encodeVL64(roomDat(8)) & Chr(1) Else forceError Index End If End Function Function enterGuestroom_State(strData As String, Index As Integer) Dim roomID As Long, roomDat() As String roomID = Val(Mid(strData, 3)) 'Get the room id 'Reset the users room privileges Holo(Index).isOwner = False Holo(Index).hasRights = False If InStr(strData, "/") Then sPassword = Mid(strData, InStr(strData, "/") + 1) 'User sent password for this room roomRow = HoloDB.runRead("SELECT owner,state,password,maxin,roomrights,incnt FROM guestrooms WHERE id = '" & roomID & "'") If roomRow = "" Then 'The room with number: roomID was not found! Not entering! Send Index, "BK" & "There is an error with this room!
It's not possible to enter this room." & Chr(1) & "@r" & Chr(1) Exit Function End If 'Put the row in an array, we'll by using the members later roomDat() = Split(roomRow, Chr(9)) 'If the max inside users limit is reached, or already over it and your rank doesn't allow you to enter all rooms If roomDat(5) >= roomDat(3) And Rank(Holo(Index).Rank).enterAllRooms = False Then Send Index, "C`I" & Chr(1) 'Send 'Room is full' message Exit Function End If 'Determine user rights If Holo(Index).Name = roomDat(0) Then Holo(Index).isOwner = True Else Holo(Index).isOwner = False If InStr(roomDat(4), "[" & Holo(Index).ID & "]") Then Holo(Index).hasRights = True Else Holo(Index).hasRights = False If roomDat(1) = "2" Then 'If it's a password room If (sPassword <> roomDat(2)) And Holo(Index).isOwner = False Then 'If password was wrong and you aren't the room owner 'Send wrong password message + exit entering room Send Index, "@aIncorrect flat password" & Chr(1) Exit Function End If ElseIf roomDat(1) = "1" And Holo(Index).hasRights = False Then 'If it's a doorbell room, and you don't have rights Dim rightHolo() As Integer, u As Integer 'Send the 'USER' waits on the doorbell message to all right having people of this room rightHolo() = Split(roomDat(4), "[") For u = 1 To UBound(rightUser) rightHolo(R) = Replace(rightHolo(R), "]", "") f = findSocket(rightHolo(R)) If u > 0 And Holo(u).guestRoom = roomID Then Send u, "A[" & Holo(Index).Name & Chr(1) Next u Exit Function End If Holo(Index).guestRoom = roomID 'Process loading Send Index, "@i" & Chr(1) End Function Function enterGuestroom_Decor(strData As String, Index As Integer) Dim roomID As Long, roomDat() As String roomID = Mid(strData, 3) If roomID = Holo(Index).guestRoom Then roomRow = HoloDB.runRead("SELECT owner,model,decor,superuser,roomrights FROM guestrooms WHERE id = '" & roomID & "'") If roomRow <> "" Then roomVotes = HoloDB.runRead("SELECT score FROM roomvotes WHERE id = '" & roomID & "'") If roomVotes = "" Then roomVotes = 0 roomDat() = Split(roomRow, Chr(9)) Send Index, "Bfhttp://www.habbohotel.co.uk/en.client.PrivateRoom.0" & Chr(1) & "AE" & "model_" & roomDat(1) & " 15065" & Chr(1) & "@nwallpaper/" & Split(roomDat(2), ",")(0) & Chr(1) & "@nfloor/" & Split(roomDat(2), ",")(1) & Chr(1) & "EY" & "M" & Chr(1) & "DiH" & Chr(1) If Holo(Index).Name = roomDat(0) Then hasRights = True Send Index, "@o" & Chr(1) Exit Function Else If roomDat(3) = "1" Then hasRights = True Else If checkRights(roomDat(4), Index) = True Then hasRights = True End If End If If hasRights = True Then Send Index, "@j" & Chr(1) End If End If End Function Function enterGuestroom_Content(Index As Integer) Dim rModel As Integer If Holo(Index).guestRoom > 0 Then Dim rM As String For a = 1 To Server.sckCount If Holo(a).guestRoom = Holo(Index).guestRoom And Holo(a).rNum <> Holo(Index).rNum Then If Holo(a).showBadge = True Then uB = Holo(a).nowBadge inPack = inPack & "i:" & Holo(a).rNum & Chr(13) & "n:" & Holo(a).Name & Chr(13) & "f:" & Holo(a).Figure & Chr(13) & "l:" & Holo(a).PosX & " " & Holo(a).PosY & " " & Holo(a).PosH & Chr(13) & "c:" & Holo(a).Mission & Chr(13) & "s:" & Holo(a).Sex & Chr(13) & "b:" & AB & Chr(13) End If Next a Holo(Index).guestMapSlot = 0 'Check if there is already a map For s = 1 To UBound(mINDEX) If mINDEX(s) = Holo(Index).guestRoom Then Holo(Index).guestMapSlot = s Exit For End If Next s 'No map yet, make one and set it as your map slot (double function) If Holo(Index).guestMapSlot = 0 Then Holo(Index).guestMapSlot = mapProcessor.craftMap(Holo(Index).guestRoom) 'Get the furnitures inside itemRow = HoloDB.runRead("SELECT id,name,pos,rot,height,ftype,colour,var FROM furniture WHERE room = '" & Holo(Index).guestRoom & "'") If itemRow <> "" Then Dim roomItem() As String, itemDat() As String roomItem() = Split(itemRow, Chr(13)) For R = 0 To UBound(roomItem) itemDat() = Split(roomItem(R), Chr(9)) If itemDat(5) = "poster" Then posterPack = posterPack & itemDat(0) & Chr(9) & itemDat(1) & Chr(9) & " " & Chr(9) & itemDat(2) & Chr(9) & itemDat(6) & Chr(13) Else furniCount = furniCount + 1 furniPack = furniPack & itemDat(0) & Chr(2) & itemDat(1) & Chr(2) & encodeVL64(Split(itemDat(2), " ")(0)) & encodeVL64(Split(itemDat(2), " ")(1)) & encodeVL64(Split(itemDat(6), Chr(30))(0)) & encodeVL64(Split(itemDat(6), Chr(30))(1)) & encodeVL64(itemDat(3)) & itemDat(4) & Chr(2) & Split(itemDat(6), Chr(30))(2) & Chr(2) & Chr(2) & itemDat(7) & Chr(2) End If Next R End If Send Index, "@_" & staticModel(mWALK(Holo(Index).guestMapSlot, -1, 0)).strMap & Chr(1) DoEvents Send Index, "@\" & inPack & Chr(1) & "@^" & Chr(1) Send Index, "@`" & encodeVL64(furniCount) & furniPack & Chr(1) Send Index, "@m" & posterPack & Chr(1) End If End Function Function enterGuestroom_Personal(Index As Integer) If Holo(Index).guestRoom > 0 Then Dim rM As Integer, inCount As Integer 'Get the inside users count For s = 1 To Server.sckCount If Holo(s).guestRoom = roomID And s <> Index Then inCount = inCount + 1 Next s 'Make the inside count up-to-date HoloDB.runQuery ("UPDATE guestrooms SET incnt = '" & inCount + 1 & "' WHERE id = '" & Holo(Index).guestRoom & "'") rM = modelID(HoloDB.runRead("SELECT model FROM guestrooms WHERE id = '" & Holo(Index).guestRoom & "'")) Holo(Index).PosX = staticModel(rM).doorX Holo(Index).PosY = staticModel(rM).doorY Holo(Index).PosH = staticModel(rM).doorH If Holo(Index).showBadge = True Then uB = Holo(Index).nowBadge sendGuestRoom Holo(Index).guestRoom, "@\i:" & Holo(Index).rNum & Chr(13) & "n:" & Holo(Index).Name & Chr(13) & "f:" & Holo(Index).Figure & Chr(13) & "l:" & Holo(Index).PosX & " " & Holo(Index).PosY & " " & Holo(Index).PosH & Chr(13) & "c:" & Holo(Index).Mission & Chr(13) & "s:" & Holo(Index).Sex & Chr(13) & "b:" & uB & Chr(1) End If End Function Function stopAction(strData As String, Index As Integer) Select Case Mid(strData, 3) Case "CarryItem" 'Stop carrying an item Case "Dance" 'Stop dancing Holo(Index).Actions(4) = 0 End Select Holo(Index).forceUpdate = True End Function Function leaveRoom(Index As Integer, doKick As Boolean) If doKick = True Then Send Index, "@R" & Chr(1) With Holo(Index) If .guestRoom > 0 Then HoloDB.runQuery ("UPDATE guestrooms SET incnt = incnt - 1 WHERE id = '" & Holo(Index).guestRoom & "'") sendGuestRoom Holo(Index).guestRoom, "@]" & Holo(Index).rNum & Chr(1) .guestRoom = 0 ElseIf .publicRoom > 0 Then sendPublicRoom Holo(Index).publicRoom, "@]" & Holo(Index).rNum & Chr(1) .publicRoom = 0 End If .PosX = 0 .PosY = 0 .DestX = 0 .DestY = 0 .isOwner = False .hasRights = False .guestMapSlot = False For a = 1 To 5 .Actions(a) = 0 Next a End With End Function Function doChat(strData As String, Index As Integer) speechText = bFilter(Mid(strData, 5, decodeB64(Mid(strData, 3, 2))), Index) 'Get the text and put it through the wordfilter sH = Left(strData, 2) 'Determine the header If sH = "@t" Then sH = "@X" 'Talk If sH = "@w" Then sH = "@Z" 'Shout If sH = "@x" Then sH = "@Y" 'Whisper moveMouth = True 'Check if it could be a speech command If Left(speechText, 1) = ":" Then If InStr(speechText, " ") Then cH = Left(speechText, InStr(speechText, " ") - 1) Else cH = speechText moveMouth = False 'Select the speechcommand Select Case cH Case ":about" 'Info about this server Send Index, "BK" & "Holograph Emulator
V1

Copyright ©2007-2008 by Holograph Team" & Chr(1) Case ":debug" 'Useful debugging stuff Send Index, "BK" & "HoloDEBUG
Your name: " & Holo(Index).Name & "
Your num: " & Holo(Index).rNum & "
Map slot: " & Holo(Index).guestMapSlot & Chr(1) Case Else 'It wasn't as speechcommand moveMouth = True End Select End If 'If it's no speech command, send the speech balloon to the room If moveMouth = True Then Holo(Index).Actions(5) = Len(speechText) * 100 sendGuestRoom Holo(Index).guestRoom, sH & encodeVL64(Holo(Index).rNum) & speechText & Chr(2) & Chr(1) End If End Function Function setLook(Index As Integer, ToX As Integer, ToY As Integer) With Holo(Index) If .PosY > ToY Then .rotHead = 0 If .PosX < ToX Then .rotHead = 2 If .PosY < ToY Then .rotHead = 4 If .PosX > ToX Then .rotHead = 6 If .PosX < ToX And .PosY > ToY Then .rotHead = 1 If .PosX < ToX And .PosY < ToY Then .rotHead = 3 If .PosX > ToX And .PosY < ToY Then .rotHead = 5 If .PosX > ToX And .PosY > ToY Then .rotHead = 7 .rotBody = .rotHead .forceUpdate = True End With End Function Function sendCFH(strData As String, Index As Integer) 'Send the call to all online users that have rights to receive CFHs For x = 1 To Server.sckCount If hSYS.sckGame(x).State = sckConnected And Rank(Holo(x).Rank).receiveCFH = True Then hSYS.sckGame(x).SendData staffPack Next x 'Tell the 'help-wanting' user that his message has been sent 'Send Index, "EAH" & Chr(1) End Function Function loadCatIndex(Index As Integer) Dim catPage() As String pR = Server.catalogueIndex If Rank(Holo(Index).Rank).adminCatalogue = True Then pR = Replace(pR & Server.catalogueIndexAdmin, ";;", ";") 'If the user also has access to the admin catalogue, merge the lists and filter any double ; chars catPage() = Split(pR, ";") For C = 0 To UBound(catPage) If catPage(C) <> "" Then pP = pP & catPage(C) & Chr(9) & catPage(C) & Chr(13) 'Add the pages to the packet Next C Send Index, "A~" & pP & Chr(1) 'Send the packet End Function Function loadCatPage(strData As String, Index As Integer) cP = Split(strData, "/")(1) 'Get the wanted page name pD = FSO.OpenTextFile(App.Path & "\bin\catalogue\page_" & cP & ".bin", ForReading).ReadAll If pD <> "" Then Send Index, "A" & Chr(127) & pD Else Send Index, "BK" & "Sorry, but it seems the page '" & cP & "' page was not found!" & Chr(1) End If End Function Function doHand(strMode As String, Index As Integer) Dim handItem() As String, itemCount As Integer, stowedCount As Integer, handSubs As Integer, itemDat() As String If strMode = "next" Then Holo(Index).handSub = Holo(Index).handSub + 1 ElseIf strMode = "prev" Then Holo(Index).handSub = Holo(Index).handSub - 1 ElseIf strMode = "last" Then lastSub = True ElseIf strMode = "new" Or strMode = "" Then Holo(Index).handSub = 0 End If hRow = HoloDB.runRead("SELECT hand FROM users WHERE name = '" & Holo(Index).Name & "'") handItem() = Split(hRow, "/") itemCount = UBound(handItem) - 1 If lastSub = True Then 'Fix the pages count, took a look at Flex/USA111 source to figure it out =] pagesTest = Int((itemCount) / 9) If (itemCount) - (pagesTest * 9) > 0 Then pagesTest = pagesTest + 1 Holo(Index).handSub = pagesTest - 1 End If prevHand = Holo(Index).handSub * 9 For s = 1 To UBound(handItem) If s <= itemCount Then If prevHand = 0 Then If stowedCount = 9 Then Exit For itemDat() = Split(HoloDB.runRead("SELECT name,colour,ftype FROM furniture WHERE id = '" & handItem(s) & "'"), Chr(9)) If InStr(itemDat(1), "#") Then If InStr(itemDat(1), Chr(30) & Chr(30)) = False Then itemDat(1) = Mid(itemDat(1), 1, 4) & Chr(30) & Mid(itemDat(1), 5) If itemDat(2) = "poster" Or itemDat(0) = "wallpaper" Or itemDat(0) = "floor" Then hStat = "I" Else hStat = "S" handitems = handitems & "SI" & Chr(30) & handItem(s) & Chr(30) & handSubs & Chr(30) & hStat & Chr(30) & handItem(s) & Chr(30) & itemDat(0) & Chr(30) & itemDat(1) & Chr(30) & "0" & Chr(30) & itemDat(0) & Chr(30) & "/" handSubs = handSubs + 1 stowedCount = stowedCount + 1 Else prevHand = prevHand - 1 handSubs = handSubs + 1 End If End If Next s Send Index, "BL" & handitems & Chr(13) & itemCount & Chr(1) End Function Function buyFurniture(strData As String, Index As Integer) Dim fArray() As String, isPresent As Boolean, fCost As Integer fArray() = Split(strData, Chr(13)) If fArray(5) <> "0" Then 'If the user wants to buy it as present isPresent = True pReceiver = fArray(6) 'Check if the present receiver exists, if it doesn't, exit function If HoloDB.checkExists("SELECT id FROM users WHERE name = '" & pReceiver & "'") = False Then Send Index, "BK" & "Sorry, but the destination user doesn't exist!
Purchasing rejected." & Chr(1) Exit Function End If pNote = bFilter(fArray(7), Index) 'Get the note the user left, filter it on swearwords End If 'Determine the name of the furni the user wants, if it's a poster, take that If Split(fArray(3), " ")(0) <> "poster" Then fName = Split(fArray(3), " ")(1) Else 'It's a poster pID = Split(fArray(3), " ")(1) End If Dim catChar() As String catChar() = Split(FSO.OpenTextFile(App.Path & "\bin\catalogue\page_" & fArray(1) & ".bin", ForReading).ReadAll, Chr(13)) For C = 0 To UBound(catChar) If InStr(catChar(C), "p:") Then If InStr(Split(catChar(C), Chr(9))(8), fName) Then fCost = Val(Split(catChar(C), Chr(9))(2)) Exit For End If End If Next C If fCost = 0 Then GoTo buyError If Holo(Index).Credits < fCost Then Send Index, "AD" & Chr(1) Exit Function End If fID = Val(HoloDB.runRead("SELECT furnitures FROM system")) + 1 Dim itemDat() As String If pID = "" Then 'If it's no poster fRow = HoloDB.runRead("SELECT name_client,colour,ftype,var,top FROM furniture_template WHERE name_catalogue = '" & fName & "'") If fRow = "" Then GoTo buyError itemDat() = Split(fRow, Chr(9)) If itemDat(0) = "wallpaper" Or itemDat(0) = "floor" Then itemDat(3) = fArray(4) HoloDB.runQuery ("INSERT INTO furniture (id,name,ftype,colour,var,top,room) VALUES ('" & fID & "','" & itemDat(0) & "','" & itemDat(2) & "','" & itemDat(1) & "','" & itemDat(3) & "','" & itemDat(4) & "','0')") Else 'If it's a poster HoloDB.runQuery ("INSERT INTO furniture (id,name,ftype,colour,var,top,room) VALUES ('" & fID & "','poster','poster','" & pID & "','H','0','0')") End If uRow = HoloDB.runRead("SELECT credits,hand FROM users WHERE name = '" & Holo(Index).Name & "'") Holo(Index).Credits = Val(Split(uRow, Chr(9))(0)) - fCost HoloDB.runQuery ("UPDATE users SET credits = '" & Holo(Index).Credits & "',hand = '" & Split(uRow, Chr(9))(1) & fID & "/" & "' WHERE name = '" & Holo(Index).Name & "'") HoloDB.runQuery ("UPDATE system SET furnitures = '" & fID & "'") updateCredits Index doHand "last", Index Exit Function buyError: Send Index, "BK" & "Oops!
There appeared to be something wrong with this furniture.
You are not able to buy it, sorry!" & Chr(1) End Function Function changeDecor(strData As String, Index As Integer) If Holo(Index).isOwner = True Then fID = Split(strData, "/")(1) userHand = HoloDB.runRead("SELECT hand FROM users WHERE name = '" & Holo(Index).Name & "'") If InStr(userHand, "/" & fID & "/") Then fRow = HoloDB.runRead("SELECT name,var FROM furniture WHERE id = '" & fID & "'") rDecor = HoloDB.runRead("SELECT decor FROM guestrooms WHERE id = '" & Holo(Index).guestRoom & "'") decoVar = Split(fRow, Chr(9))(1) If Split(fRow, Chr(9))(0) = "floor" Then rDecor = Split(rDecor, ",")(0) & "," & Split(fRow, Chr(9))(1) isFloor = True Else rDecor = decoVar & "," & Split(rDecor, ",")(1) End If If IsNumeric(Replace(rDecor, ",", "")) = True Then HoloDB.runQuery ("UPDATE users SET hand = '" & Replace(userHand, fID & "/", "") & "' WHERE name = '" & Holo(Index).Name & "'") HoloDB.runQuery ("UPDATE guestrooms SET decor = '" & rDecor & "' WHERE id = '" & Holo(Index).guestRoom & "'") If isFloor = True Then Send Index, "@nfloor/" & decoVar & Chr(1) Else Send Index, "@nwallpaper/" & decoVar & Chr(1) doHand "last", Index End If End If End If End Function Function placeFurniture(strData As String, Index As Integer) Dim dataSplit() As String, roomPack As String dataSplit() = Split(Mid(strData, 3), " ") fID = dataSplit(0) uHand = HoloDB.runRead("SELECT hand FROM users WHERE name = '" & Holo(Index).Name & "'") grabFromHand = True If InStr(uHand, "/" & fID & "/") Then Dim itemDat() As String itemDat() = Split(HoloDB.runRead("SELECT name,ftype,colour,var,top FROM furniture WHERE id = '" & fID & "'"), Chr(9)) 'Prevent non-owners from putting furniture in the room, except stickies If Holo(Index).isOwner = False Then If itemDat(0) <> "post.it" Then Exit Function If itemDat(1) = "poster" Then 'It's a wallitem Dim pPos As String pPos = dataSplit(1) & " " & dataSplit(2) & " " & dataSplit(3) If itemDat(0) = "post.it" Then 'It's a new stickie If itemDat(2) > 0 Then itemDat(2) = itemDat(2) - 1 If itemDat(2) = 0 Then padID = fID nID = HoloDB.runRead("SELECT furnitures FROM system") + 1 HoloDB.runQuery ("UPDATE system SET furnitures = furnitures + 1") HoloDB.runQuery ("INSERT INTO furniture (id,name,ftype,colour,pos,room) VALUES ('" & nID & "','post.it','poster','FFFF33','" & pPos & "','" & Holo(Index).guestRoom & "')") HoloDB.runQuery ("UPDATE furniture SET colour = '" & itemDat(2) & "' WHERE id = '" & fID & "'") itemDat(2) = "FFFF33" fID = nID End If Else HoloDB.runQuery ("UPDATE furniture SET room = '" & Holo(Index).guestRoom & "',pos = '" & pPos & "' WHERE id = '" & fID & "'") End If roomPack = "Ac" & fID & Chr(1) & "AS" & fID & Chr(9) & itemDat(0) & Chr(9) & " " & Chr(9) & pPos & Chr(9) & itemDat(2) & Chr(1) Else 'It's a furniture 'This is where the server grabs the new position of the furniture, so the squares the furniture will take in 'The colouring of a furniture combinated with the rotation depends the squares it takes, pretty weird, but meh it's like that grabFromHand = False Dim modelID As Integer, colourPart() As String, spotX As Integer, spotY As Integer, blockedSpot As Boolean modelID = mWALK(Holo(Index).guestMapSlot, -1, 0) fHeight = staticModel(modelID).mapSpot(dataSplit(1), dataSplit(2)) If fHeight = 20 Then Exit Function colourPart() = Split(itemDat(2), Chr(30)) If Val(dataSplit(5)) = 0 Or Val(dataSplit(5)) = 4 Then extX = Val(colourPart(0)) extY = Val(colourPart(1)) Else extX = Val(colourPart(1)) extY = Val(colourPart(0)) End If 'Get the possible peoples on room, only if it's a sit or rug furni If itemDat(1) <> "sit" Or itemDat(1) <> "rug" Then Dim roomUsers(1 To maxConnections) As Integer For u = 1 To Server.sckCount If Holo(u).guestRoom = Holo(Index).guestRoom Then R = R + 1 roomUsers(R) = u End If Next u End If For spotX = dataSplit(1) To dataSplit(1) + extX - 1 For spotY = dataSplit(2) To dataSplit(2) + extY - 1 'Check if it's put on an elevated square If staticModel(modelID).mapSpot(dataSplit(1), dataSplit(2)) <> fHeight Then Exit Function 'Check if a user is on the spot For p = 1 To R If Holo(p).PosX = spotX And Holo(p).PosY = spotY Then blockedSpot = True End If Next p 'Check if the spot is token by something solid If mWALK(Holo(Index).guestMapSlot, spotX, spotY) > 0 Then blockRow = HoloDB.runRead("SELECT ftype,height,top FROM furniture WHERE pos = '" & spotX & " " & spotY & "' ORDER BY height DESC LIMIT 1") '// STACKING If blockRow <> "" Then 'There is a furniture under it 'If it's solid furniture, then calculate the new height If Split(blockRow, Chr(9))(0) = "solid" Then fHeight = Val(Split(blockRow, Chr(9))(1)) + Val(Split(blockRow, Chr(9))(2)) Else blockedSpot = True End If Else blockedSpot = True End If '\\ STACKING End If Next spotY Next spotX 'Determine the square filling Select Case itemDat(1) Case "solid" newBlock = 1 Case "sit" newBlock = 2 Case "bed" newBlock = 3 Case "roller" newBlock = 4 Case Else newBlock = 0 End Select If blockedSpot = False Or newBlock > 0 Then If itemDat(1) <> "rug" Then 'If it's a furniture that should modify the heightmap For spotX = dataSplit(1) To dataSplit(1) + extX - 1 For spotY = dataSplit(2) To dataSplit(2) + extY - 1 mWALK(Holo(Index).guestMapSlot, spotX, spotY) = newBlock If itemDat(1) = "sit" Then 'If it's a sit furni, add it to the rotation and sitheights mROT(Holo(Index).guestMapSlot, spotX, spotY) = dataSplit(5) mHSIT(Holo(Index).guestMapSlot, spotX, spotY) = Replace(fHeight + Val(itemDat(4)), ",", ".") End If Next spotY Next spotX End If fHeight = Replace(fHeight, ",", ".") HoloDB.runQuery ("UPDATE furniture SET pos = '" & dataSplit(1) & " " & dataSplit(2) & "',rot = '" & dataSplit(5) & "',height = '" & fHeight & "',room = '" & Holo(Index).guestRoom & "' WHERE id = '" & fID & "'") roomPack = "A]" & fID & Chr(2) & itemDat(0) & Chr(2) & encodeVL64(dataSplit(1)) & encodeVL64(dataSplit(2)) & encodeVL64(dataSplit(3)) & encodeVL64(dataSplit(4)) & encodeVL64(dataSplit(5)) & fHeight & Chr(2) & Split(itemDat(2), Chr(30))(2) & ",0,0" & Chr(2) & Chr(2) & itemDat(3) & Chr(2) & Chr(1) grabFromHand = True End If End If If grabFromHand = True Or padID <> "" Then 'Remove the furniture from the hand If padID <> "" Then fID = padID HoloDB.runQuery ("UPDATE users SET hand = '" & Replace(uHand, fID & "/", "") & "' WHERE name = '" & Holo(Index).Name & "'") If padID <> "" Then HoloDB.runQuery ("DELETE FROM furniture WHERE id = '" & padID & "'") End If 'Transmit the data If roomPack <> "" Then sendGuestRoom Holo(Index).guestRoom, roomPack End If End Function Function pickupFurniture(strData As String, Index As Integer) Dim roomPack As String If Holo(Index).isOwner = True Then fID = Split(Mid(strData, 3), " ")(2) fRow = HoloDB.runRead("SELECT pos,rot,ftype,colour,height,room FROM furniture WHERE id = '" & fID & "'") Dim itemDat() As String If fRow <> "" Then itemDat() = Split(fRow, Chr(9)) Else Exit Function If itemDat(5) = Holo(Index).guestRoom Then 'Check if it's a wallitem or a furniture If itemDat(2) = "poster" Then 'Wall item roomPack = "AT" & fID & Chr(1) Else Dim colourPart() As String, spotX As Integer, spotY As Integer, fX As Integer, fY As Integer colourPart() = Split(itemDat(3), Chr(30)) fX = Split(itemDat(0), " ")(0) fY = Split(itemDat(0), " ")(1) If Val(itemDat(1)) = 0 Or Val(itemDat(1)) = 4 Then extX = Val(colourPart(0)) extY = Val(colourPart(1)) Else extX = Val(colourPart(1)) extY = Val(colourPart(0)) End If blockNew = 0 If Val(itemDat(4)) > 0 And itemDat(2) = "sit" Then 'If it's a stacked chair, then set the base to solid rRow = HoloDB.runRead("SELECT ftype FROM furniture WHERE pos = '" & itemDat(0) & "' AND height = '0' AND not(ftype = 'sit')") If rRow <> "" Then If Split(rRow, Chr(9))(0) = "solid" Then blockNew = 1 End If For spotX = fX To fX + extX - 1 For spotY = fY To fY + extY - 1 mWALK(Holo(Index).guestMapSlot, spotX, spotY) = blockNew Next spotY Next spotX roomPack = "A^" & fID & Chr(1) End If 'Get the current hand uHand = HoloDB.runRead("SELECT hand FROM users WHERE name = '" & Holo(Index).Name & "'") 'Update the database HoloDB.runQuery ("UPDATE furniture SET pos = '',rot = '',room = '0' WHERE id = '" & fID & "'") 'Add the furniture to the hand uHand = uHand & fID & "/" HoloDB.runQuery ("UPDATE users SET hand = '" & uHand & "' WHERE name = '" & Holo(Index).Name & "'") 'Transmit the data If roomPack <> "" Then sendGuestRoom Holo(Index).guestRoom, roomPack doHand "last", Index End If End If End Function Function rotateFurniture(strData As String, Index As Integer) Dim dataSplit() As String, roomPack As String 'Prevent non(owners/right having/staff) from rotating/moving furniture If Holo(Index).isOwner = False And Holo(Index).hasRights = False And Rank(Holo(Index).Rank).rightsEverywhere = False Then Exit Function dataSplit() = Split(Mid(strData, 3), " ") fID = dataSplit(0) Dim itemDat() As String itemDat() = Split(HoloDB.runRead("SELECT name,ftype,colour,var,top,room,pos,height FROM furniture WHERE id = '" & fID & "'"), Chr(9)) 'If there is something wrong If itemDat(1) = "poster" Or itemDat(5) <> Holo(Index).guestRoom Then Exit Function Dim modelID As Integer, colourPart() As String, spotX As Integer, spotY As Integer, blockedSpot As Boolean modelID = mWALK(Holo(Index).guestMapSlot, -1, 0) fHeight = staticModel(modelID).mapSpot(dataSplit(1), dataSplit(2)) If fHeight = 20 Then Exit Function colourPart() = Split(itemDat(2), Chr(30)) If Val(dataSplit(3)) = 0 Or Val(dataSplit(3)) = 4 Then extX = Val(colourPart(0)) extY = Val(colourPart(1)) Else extX = Val(colourPart(1)) extY = Val(colourPart(0)) End If 'Get the possible peoples on room, only if it's a sit or rug furni Dim R As Integer If (itemDat(1) = "sit" Or itemDat(1) = "rug") = False Then Dim roomUsers(1 To maxConnections) As Integer For u = 1 To Server.sckCount If Holo(u).guestRoom = Holo(Index).guestRoom Then R = R + 1 roomUsers(R) = u End If Next u End If For spotX = dataSplit(1) To dataSplit(1) + extX - 1 For spotY = dataSplit(2) To dataSplit(2) + extY - 1 'Check if it's put on an elevated square If staticModel(modelID).mapSpot(dataSplit(1), dataSplit(2)) <> fHeight Then Exit Function 'Check if a user is on the spot For p = 1 To R If Holo(p).PosX = spotX And Holo(p).PosY = spotY Then Exit Function Next p 'Check if the spot is token by something solid If mWALK(Holo(Index).guestMapSlot, spotX, spotY) > 0 Then blockRow = HoloDB.runRead("SELECT ftype,height,top FROM furniture WHERE pos = '" & spotX & " " & spotY & "' AND not(ftype = 'sit') ORDER BY height DESC LIMIT 1") '// STACKING If blockRow <> "" Then 'There is a furniture under it 'If it's solid furniture, then calculate the new height If Split(blockRow, Chr(9))(0) = "solid" Then fHeight = Val(Split(blockRow, Chr(9))(1)) + Val(Split(blockRow, Chr(9))(2)) Else blockedSpot = True End If Else blockedSpot = True End If '\\ STACKING End If Next spotY Next spotX 'Determine the square filling Select Case itemDat(1) Case "solid" newBlock = 1 Case "sit" newBlock = 2 Case "bed" newBlock = 3 Case "roller" newBlock = 4 Case Else newBlock = 0 End Select If blockedSpot = False Or newBlock > 0 Then 'Clear the old location oldX = Split(itemDat(6), " ")(0) oldY = Split(itemDat(6), " ")(1) blockRepair = 0 If Val(itemDat(7)) > 0 And itemDat(1) = "sit" Then 'If it's a stacked chair and you remove it, then set the base to solid rRow = HoloDB.runRead("SELECT ftype FROM furniture WHERE pos = '" & itemDat(6) & "' AND height = '0' AND not(ftype = 'sit')") If rRow <> "" Then If Split(rRow, Chr(9))(0) = "solid" Then blockRepair = 1 End If For spotX = oldX To oldX + extX - 1 For spotY = oldY To oldY + extY - 1 mWALK(Holo(Index).guestMapSlot, spotX, spotY) = blockRepair If itemDat(1) = "sit" Then 'If it's a sit furni, remove it from the heightmap mROT(Holo(Index).guestMapSlot, spotX, spotY) = 0 mHSIT(Holo(Index).guestMapSlot, spotX, spotY) = 0 End If Next spotY Next spotX If itemDat(1) <> "rug" Then 'If it's a furniture that should modify the heightmap For spotX = dataSplit(1) To dataSplit(1) + extX - 1 For spotY = dataSplit(2) To dataSplit(2) + extY - 1 mWALK(Holo(Index).guestMapSlot, spotX, spotY) = newBlock If itemDat(1) = "sit" Then 'If it's a sit furni, add it to the rotation and sitheights mROT(Holo(Index).guestMapSlot, spotX, spotY) = Val(dataSplit(3)) mHSIT(Holo(Index).guestMapSlot, spotX, spotY) = Replace(fHeight + Val(itemDat(4)), ",", ".") End If Next spotY Next spotX End If fHeight = Replace(fHeight, ",", ".") HoloDB.runQuery ("UPDATE furniture SET pos = '" & dataSplit(1) & " " & dataSplit(2) & "',rot = '" & dataSplit(3) & "',height = '" & fHeight & "' WHERE id = '" & fID & "'") roomPack = "A_" & fID & Chr(2) & itemDat(0) & Chr(2) & encodeVL64(dataSplit(1)) & encodeVL64(dataSplit(2)) & encodeVL64(colourPart(0)) & encodeVL64(colourPart(1)) & encodeVL64(dataSplit(3)) & fHeight & Chr(2) & Split(itemDat(2), Chr(30))(2) & Chr(2) & Chr(2) & itemDat(3) & Chr(2) & Chr(1) End If 'Transmit the data If roomPack <> "" Then sendGuestRoom Holo(Index).guestRoom, roomPack funcLib.forceUpdate Holo(Index).guestRoom End Function Function bFilter(strData As String, Index As Integer) If Server.filterEnabled = True Then 'If the wordfilter is enabled If Rank(Holo(Index).Rank).ignoreFilter = False Then 'If the users rank allows the user to pass the wordfilter For w = 0 To UBound(Server.filterWord) 'Go along all swearwords If InStr(LCase(strData), Server.filterWord(w)) Then strData = Replace(strData, Server.filterWord(w), Server.filterReplacement) 'Check if swearword xx is inside the input string, if so, filter it Next w 'Check for next swearword End If End If bFilter = strData 'Set the output data End Function Function checkForbidden(strData As String) As Boolean strData = LCase(strData) For f = 0 To UBound(Server.forbiddenName) 'Go along all forbidden names/words If InStr(strData, Server.forbiddenName(w)) Then 'If the input string contains forbidden word/name xx, then it's a forbidden input string! checkForbidden = True 'Set that the input word/name/sentence was forbidden Exit For 'Stop checking for more, it's already a forbidden word so we're done End If Next f End Function Function findPos(strName As String) As String Dim fID As Integer 'Find the Hotel position of a user with name = strName For m = 1 To Server.sckCount 'Go along all online users If hSYS.sckGame(m).State = sckConnected And strName = Holo(m).Name Then 'If user xx is named the name we are searching fID = m 'Set fID equal to it's socket ID Exit For 'We've found him, stop searching End If Next m If fID > 0 Then 'If there was a socket number found (so the user is online) If Holo(fID).guestRoom > 0 Then 'If the user is in guestroom mPos = "Floor1b" 'Output that he's in a guestroom Else 'The user is on Hotel View mPos = "I" & "on Hotel View" 'Output that the he's on Hotel View End If Else 'There was no socket number found (so the user is offline) mPos = "H" 'Output that he's offline End If findPos = mPos 'Final output of data for this function End Function Function updateCredits(Index As Integer) Send Index, "@F" & Holo(Index).Credits & Chr(1) End Function Function checkRights(strRights As String, Index As Integer) As Boolean Dim rightHolo() As String If strRights = "" Then strRights = "[" rightHolo() = Split(strRights, "[") 'Put the rights in an array For u = 1 To UBound(rightUser) 'Go along all IDs rightHolo(R) = Replace(rightHolo(R), "]", "") 'Filter the [ from it If rightHolo(R) = Holo(Index).ID Then 'If the user is found checkRights = True 'Output the user has rights Exit For 'Stop searching End If Next u End Function Function forceUpdate(roomID As Long) For a = 1 To Server.sckCount 'For all users If hSYS.sckGame(a).State = sckConnected And Holo(a).guestRoom = roomID Then Holo(a).forceUpdate = True Next a End Function Function roomState(numState As String) As String If numState = 1 Then roomState = "closed" ElseIf numState = 2 Then roomState = "password" Else roomState = "open" End If End Function Private Function catNum(strID As String, reverseUse As Boolean) As String If reverseUse = False Then Select Case strID Case "H" catNum = 0 Case "SL" catNum = 1 Case "RL" catNum = 2 Case "PR" catNum = 3 Case "RQ" catNum = 4 Case "S\" catNum = 5 Case "Q]" catNum = 6 Case "R]" catNum = 7 Case "S]" catNum = 8 Case "P^" catNum = 9 Case "SR" catNum = 10 Case Else catNum = 10 End Select Else Select Case strID Case 0 catNum = "H" Case 1 catNum = "SL" Case 2 catNum = "RL" Case 3 catNum = "PR" Case 4 catNum = "RQ" Case 5 catNum = "S\" Case 6 catNum = "Q]" Case 7 catNum = "R]" Case 8 catNum = "S]" Case 9 catNum = "P^" Case 10 catNum = "SR" Case Else catNum = "H" End Select End If End Function