
Originally Posted by
DominicGunn
y read 3 bytes wen onli 1 needed to check policy

also i have a feeling the above snippet will fail at reading messages properly if the client sends multiple msg ids in one packet
Probably will, I know it's possible but I've never seen the client actually send such a message.
Pushed the last V13 suitable build to Github and i fixed a possible issue in my handling of ServerMessage's.
Turns out the flash client is more particular and was picking up on the tiny-bug in my implementation of 'ServerMessage' so the client now sends the SSOTicket - pushed to Github.
Can a mod change the topic to:
Crowley - R63 (pre-shuffle) - Java - Hibernate/BoneCP (MySQL)
Currently looking at writing the Web frontend using the SpringMVC framework so that i can use RMI to get stats such as online users and instruct the server to perform certain operations for administrators.
Now only read the first byte for the policy (might as well avoid overhead where possible) mapped the Users and Habbo classes so we can now handle the SSOTicket message.
PHP Code:
package styx.habbo.message.outgoing;
import org.apache.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import styx.habbo.beans.Habbo;
import styx.habbo.game.GameSession;
import styx.habbo.message.ServerMessage;
import styx.util.DatastoreUtil;
/**
* "THE BEER-WARE LICENSE" (Revision 42):
* <crowlie@hybridcore.net> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return Crowley.
*/
public class LoginHabbo implements Runnable {
private static Logger logger = Logger.getLogger(LoginHabbo.class.getName());
private GameSession networkGameSession;
private String ssoTicket;
public LoginHabbo(GameSession networkGameSession, String ssoTicket) {
this.networkGameSession = networkGameSession;
this.ssoTicket = ssoTicket;
}
public void run() {
Session session = DatastoreUtil.currentSession();
Habbo habbo = (Habbo)session.createCriteria(Habbo.class).add(Restrictions.eq("ssoTicket", this.ssoTicket)).uniqueResult();
// Invalid login ticket :o
if (habbo == null) {
this.networkGameSession.sendMessage(
new ServerMessage(161)
.appendString("Invalid login ticket, refresh the client and try again.")
);
this.networkGameSession.getChannel().close();
return;
}
//TODO: Check if ticket has expired and the IP matches the current clients
//TODO: Check for bans
//TODO: Send fuse rights
/*
msg-id 2
wired int count
string right
*/
//TODO: Show mod tools if has fuse_mod
//TODO: Send effects inventory
this.networkGameSession.getMessageHandler().unregisterLoginHandlers();
//TODO: Register other handlers
}
}
Code:
INFO [main] (Crowley.java132) - Server bound on 127.0.0.1:9001
INFO [New I/O server boss #1 ([id: 0x5e725967, /127.0.0.1:9001])] (SessionManager.java26) - Accepted gameSession (id: 1 ip: 127.0.0.1)
INFO [New I/O server worker #1-1] (Encoder.java37) - Message sent (string possible policy response) to client #1
INFO [New I/O server worker #1-1] (Decoder.java43) - Sent policy to client #1
INFO [New I/O server boss #1 ([id: 0x5e725967, /127.0.0.1:9001])] (SessionManager.java26) - Accepted gameSession (id: 2 ip: 127.0.0.1)
INFO [New I/O server worker #1-2] (Decoder.java60) - Message received (id: 206 length: 1) from client #2
DEBUG [New I/O server worker #1-2] (Decoder.java61) - Message data: CNH
INFO [New I/O server worker #1-2] (Encoder.java28) - Message sent (id: 277 length: 32) to client #2
DEBUG [New I/O server worker #1-2] (Encoder.java29) - Message data: DU576b145a0c17f8a385971e0b6324a4bc
INFO [New I/O server worker #1-2] (Decoder.java60) - Message received (id: 2002 length: 127) from client #2
DEBUG [New I/O server worker #1-2] (Decoder.java61) - Message data: _RA}26287857330965620209588911483532825267711412350069960934103840731132801428748005396153626463827555369048202098929707512226560
INFO [New I/O server worker #1-2] (Encoder.java28) - Message sent (id: 257 length: 49) to client #2
DEBUG [New I/O server worker #1-2] (Encoder.java29) - Message data: DAHMIHKHJIPANQAdd-MM-yyyyRAISAHPBhotel-co.ukQBH
INFO [New I/O server worker #1-2] (Decoder.java60) - Message received (id: 415 length: 12) from client #2
DEBUG [New I/O server worker #1-2] (Decoder.java61) - Message data: F_@JtestTicket
DEBUG [pool-2-thread-1] (SessionImpl.java265) - opened session at timestamp: 13288443953
DEBUG [pool-2-thread-1] (AbstractBatcher.java410) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG [pool-2-thread-1] (ConnectionManager.java444) - opening JDBC connection
DEBUG [pool-2-thread-1] (SQLStatementLogger.java111) - select this_.id as id1_0_, this_.name as name1_0_, this_.user_id as user3_1_0_, this_.figure as figure1_0_, this_.sso_ticket as sso5_1_0_, this_.sso_ip as sso6_1_0_, this_.sso_expires as sso7_1_0_ from habbos this_ where this_.sso_ticket=?
DEBUG [pool-2-thread-1] (AbstractBatcher.java426) - about to open ResultSet (open ResultSets: 0, globally: 0)
DEBUG [pool-2-thread-1] (AbstractBatcher.java433) - about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG [pool-2-thread-1] (AbstractBatcher.java418) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG [pool-2-thread-1] (StatefulPersistenceContext.java893) - initializing non-lazy collections
DEBUG [pool-2-thread-1] (ConnectionManager.java427) - aggressively releasing JDBC connection
DEBUG [pool-2-thread-1] (ConnectionManager.java464) - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
INFO [pool-2-thread-1] (Encoder.java28) - Message sent (id: 161 length: 57) to client #2
DEBUG [pool-2-thread-1] (Encoder.java29) - Message data: BaInvalid login ticket, refresh the client and try again.
Process finished with exit code 143
Just implemented Fuseranks => Fuserights and Bans :)