Advertisement
Guest User

Habbo Hotel Login Component Class v0.5

a guest
Jun 20th, 2024
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | Source Code | 0 0
  1. --Login
  2. --Component
  3. --v.0.5
  4.  
  5.  
  6. --| public:
  7. --| construct
  8. --| deconstruct
  9. --| initA
  10. --| initB
  11. --| connect
  12. --| disconnect
  13. --| isOkToLogin
  14.  
  15.  
  16. property pOkToLogin
  17.  
  18.  
  19. -- Public methods: -- -- -- -- -- -- -- -- -- -- --//
  20.  
  21.  
  22. -- Constructor.
  23.  
  24. on construct(me)
  25.  
  26. pOkToLogin = FALSE
  27.  
  28. if(variableExists("stats.tracking.url")) then
  29. createObject(#statsBroker, "Statistics Broker Class")
  30. end if
  31.  
  32. -- Create Figure System object...
  33.  
  34. if(not objectExists("Figure_System")) then
  35. if(createObject("Figure_System",["Figure System Class"]) <> FALSE) then
  36. tUrl = getVariable("external.figurepartlist.txt")
  37. getObject("Figure_System").define(["type":"url", "source":tUrl])
  38. end if
  39. end if
  40.  
  41. -- Create Figure Preview object...
  42.  
  43. if(not objectExists("Figure_Preview")) then
  44. createObject("Figure_Preview",["Figure Preview Class"])
  45. end if
  46.  
  47. -- Prepare user rights list...
  48.  
  49. getObject(#session).set("user_rights", [])
  50.  
  51. -- Skip over login dialogs if quick login is enabled...
  52.  
  53. if(not variableExists("quickLogin")) then
  54. setVariable("quickLogin", FALSE)
  55. end if
  56.  
  57. if(getIntVariable("quickLogin", FALSE)) and (the runMode contains "Author") then
  58. if(not voidP(getPref(getVariable("fuse.project.id", "fusepref")))) then
  59. tTemp = value(getPref(getVariable("fuse.project.id","fusepref")))
  60. getObject(#session).set(#username, tTemp[1])
  61. getObject(#session).set(#password, tTemp[2])
  62. pOkToLogin = TRUE
  63. return(me.connect())
  64. end if
  65. end if
  66.  
  67.  
  68. registerMessage(#initialize, me.getID(), #initA)
  69.  
  70. -- Initialize help tooltip
  71.  
  72. if(not objectExists("Help_Tooltip_Manager")) then
  73. createObject("Help_Tooltip_Manager", "Help Tooltip Manager Class")
  74. end if
  75.  
  76. -- Initialize game ticket window manager.
  77.  
  78. if(not objectExists("Ticket_Window_Manager")) then
  79. createObject("Ticket_Window_Manager", "Ticket Window Manager Class")
  80. end if
  81.  
  82. return(TRUE)
  83.  
  84. end
  85.  
  86.  
  87. -- Deconstruct.
  88.  
  89. on deconstruct(me)
  90.  
  91. pOkToLogin = FALSE
  92.  
  93. if(objectExists("Figure_System")) then
  94. removeObject("Figure_System")
  95. end if
  96.  
  97. if(objectExists("Figure_Preview")) then
  98. removeObject("Figure_Preview")
  99. end if
  100.  
  101. if(objectExists("nav_problem_obj")) then
  102. removeObject("nav_problem_obj")
  103. end if
  104.  
  105. if(objectExists(#statsBroker)) then
  106. removeObject(#statsBroker)
  107. end if
  108.  
  109. if(objectExists(#getServerDate)) then
  110. removeObject(#getServerDate)
  111. end if
  112.  
  113. if(objectExists("Help_Tooltip_Manager")) then
  114. removeObject("Help_Tooltip_Manager")
  115. end if
  116.  
  117. if(connectionExists(getVariable("connection.info.id", #info))) then
  118. return(me.disconnect())
  119. else
  120. return(TRUE)
  121. end if
  122.  
  123. end
  124.  
  125.  
  126. -- Everything should be ready for some action.
  127.  
  128. on initA(me)
  129.  
  130. -- Figure definition list _must_ be loaded...
  131.  
  132. if(getIntVariable("figurepartlist.loaded", TRUE) = FALSE) then
  133. return(me.delay(250, #initA))
  134. end if
  135.  
  136. return(me.delay(1000, #initB))
  137.  
  138. end
  139.  
  140.  
  141. on initB(me)
  142.  
  143. return(me.getInterface().showLogin())
  144.  
  145. end
  146.  
  147.  
  148. -- Starts connection/login process.
  149.  
  150. on connect(me)
  151.  
  152. tHost = getVariable("connection.info.host")
  153. tPort = getIntVariable("connection.info.port")
  154. tConn = getVariable("connection.info.id", #info)
  155.  
  156. -- Validate parameters...
  157.  
  158. if(voidP(tHost) or voidP(tPort)) then
  159. return(error(me, "Server port/host data not found!", #connect))
  160. end if
  161.  
  162. -- Create connection...
  163.  
  164. if(not createConnection(tConn, tHost, tPort)) then
  165. return(error(me, "Failed to create connection!", #connect))
  166. end if
  167.  
  168. -- Create object witch retrieves date from server...
  169.  
  170. if(not objectExists(#getServerDate)) then
  171. createObject(#getServerDate, "Server Date Class")
  172. end if
  173.  
  174. -- Create object which helps user if login fails...
  175.  
  176. if(not objectExists("nav_problem_obj")) then
  177. createObject("nav_problem_obj", "Connection Problem Class")
  178. end if
  179.  
  180. -- Construct hobba thread...
  181.  
  182. if(not threadExists(#hobba)) then
  183. initThread("thread.hobba")
  184. end if
  185.  
  186.  
  187. return(TRUE)
  188.  
  189. end
  190.  
  191.  
  192. -- Disconnects current connection.
  193.  
  194. on disconnect(me)
  195.  
  196. tConn = getVariable("connection.info.id", #info)
  197.  
  198. if(connectionExists(tConn)) then
  199. return(removeConnection(tConn))
  200. else
  201. return(error(me, "Connection not found!", #disconnect))
  202. end if
  203.  
  204. end
  205.  
  206.  
  207. on isOkToLogin(me)
  208.  
  209. return(me.pOkToLogin)
  210.  
  211. end
  212.  
  213.  
  214. -- End of file. -- -- -- -- -- -- -- -- -- -- -- --//
  215.  
  216. --Login Component Class
  217. --Antti Kaseva
  218.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement