ToontownClient: Update receiveDatagram
This commit is contained in:
parent
e14b665058
commit
8a411126b0
|
|
@ -1,15 +1,21 @@
|
|||
CLIENT_DISCONNECT = 37
|
||||
CLIENT_GET_AVATARS = 3
|
||||
|
||||
CLIENT_HEARTBEAT = 52
|
||||
CLIENT_DISCONNECT = 37
|
||||
|
||||
CLIENT_HEARTBEAT = 52
|
||||
|
||||
CLIENT_ADD_INTEREST = 97
|
||||
CLIENT_REMOVE_INTEREST = 99
|
||||
|
||||
-- new toontown specific login message, adds last logged in, and if child account has parent acount
|
||||
CLIENT_LOGIN_TOONTOWN = 125
|
||||
CLIENT_LOGIN_TOONTOWN_RESP = 126
|
||||
|
||||
CLIENT_DISCONNECT_GENERIC = 1
|
||||
CLIENT_DISCONNECT_RELOGIN = 100
|
||||
CLIENT_DISCONNECT_ACCOUNT_ERROR = 122
|
||||
CLIENT_DISCONNECT_BAD_VERSION = 125
|
||||
CLIENT_DISCONNECT_GENERIC = 1
|
||||
CLIENT_DISCONNECT_RELOGIN = 100
|
||||
CLIENT_DISCONNECT_OVERSIZED_DATAGRAM = 106
|
||||
CLIENT_DISCONNECT_ACCOUNT_ERROR = 122
|
||||
CLIENT_DISCONNECT_BAD_VERSION = 125
|
||||
|
||||
DATABASE_OBJECT_TYPE_ACCOUNT = 1
|
||||
|
||||
|
|
|
|||
|
|
@ -48,9 +48,16 @@ function receiveDatagram(client, dgi)
|
|||
client:handleDisconnect()
|
||||
elseif msgType == CLIENT_LOGIN_TOONTOWN then
|
||||
handleLoginToontown(client, dgi)
|
||||
-- We have reached the only message types unauthenticated clients can use.
|
||||
elseif not client:authenticated() then
|
||||
client:sendDisconnect(CLIENT_DISCONNECT_GENERIC, "First datagram is not CLIENT_LOGIN_TOONTOWN", true)
|
||||
else
|
||||
client:sendDisconnect(CLIENT_DISCONNECT_GENERIC, string.format("Unknown message type: %d", msgType), true)
|
||||
end
|
||||
|
||||
if dgi:getRemainingSize() ~= 0 then
|
||||
client:sendDisconnect(CLIENT_DISCONNECT_OVERSIZED_DATAGRAM, string.format("Datagram contains excess data.\n%s", tostring(dgi)), true)
|
||||
end
|
||||
end
|
||||
|
||||
function handleLoginToontown(client, dgi)
|
||||
|
|
@ -190,11 +197,13 @@ function loginAccount(client, account, accountId, playToken, openChat, isPaid, d
|
|||
|
||||
resp:addString(os.date("%Y-%m-%d %H:%M:%S")) -- lastLoggedInStr
|
||||
resp:addInt32(math.floor(date.diff(account.LAST_LOGIN, account.CREATED):spandays())) -- accountDays
|
||||
|
||||
if linkedToParent then
|
||||
resp:addString("WITH_PARENT_ACCOUNT") -- toonAccountType
|
||||
else
|
||||
resp:addString("NO_PARENT_ACCOUNT") -- toonAccountType
|
||||
end
|
||||
|
||||
resp:addString(playToken) -- userName
|
||||
|
||||
-- Dispatch the response to the client.
|
||||
|
|
|
|||
Loading…
Reference in New Issue