|
|||||||||
Atavism Version 2018.1 | AGIS API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatavism.server.engine.EnginePlugin
atavism.server.worldmgr.LoginPlugin
public class LoginPlugin
Supports the character selection and creation protocols. The plugin returns a list characters available to the user. Includes character properties and the proxy server host/port for each character.
The user can create a character by supplying a set of character properties. The plugin returns the new character properties or an error if the character could not be created.
LoginPlugin must be sub-classed to implement character selection
and creation. A sub-class must implement #handleCharacterRequestMessage(CharacterRequestMessage, SocketChannel)
and may implement #handleCharacterCreateMessage(CharacterCreateMessage , SocketChannel , AOByteBuffer)
if character
creation is supported and #handleCharacterDeleteMessage(CharacterDeleteMessage , SocketChannel , AOByteBuffer)
if character
deletion is supported. Sub-classes should not need to call any
LoginPlugin methods except getCharacterGenerator().
For a sample implementation see atavism.mars.plugins#MarsLoginPlugin
Nested Class Summary | |
---|---|
static class |
LoginPlugin.CharacterCreateMessage
Message to create a character using the given properties. |
static class |
LoginPlugin.CharacterCreateResponseMessage
Message to return new character properties. |
static class |
LoginPlugin.CharacterDeleteMessage
Message to delete a character using the given properties. |
static class |
LoginPlugin.CharacterDeleteResponseMessage
Message to return new character properties. |
static class |
LoginPlugin.CharacterRequestMessage
Message to authorize user and get their character list. |
static class |
LoginPlugin.CharacterResponseMessage
Message to return world token and character list. |
static class |
LoginPlugin.CharacterSelectRequestMessage
Message to log in as the selected character. |
static class |
LoginPlugin.CharacterSelectResponseMessage
Message to return access token and hostname/port for selected character. |
static class |
LoginPlugin.HeartbeatMessage
Message to get the server list. |
static class |
LoginPlugin.HeartbeatResponseMessage
Message to return world token and server list. |
static class |
LoginPlugin.ServerListRequestMessage
Message to get the server list. |
static class |
LoginPlugin.ServerListResponseMessage
Message to return world token and server list. |
protected class |
LoginPlugin.SocketHandler
|
Field Summary | |
---|---|
static int |
LOGIN_IDLE_TIMEOUT
|
static int |
MSGCODE_CHARACTER_CREATE
|
static int |
MSGCODE_CHARACTER_CREATE_RESPONSE
|
static int |
MSGCODE_CHARACTER_DELETE
|
static int |
MSGCODE_CHARACTER_DELETE_RESPONSE
|
static int |
MSGCODE_CHARACTER_REQUEST
|
static int |
MSGCODE_CHARACTER_RESPONSE
|
static int |
MSGCODE_CHARACTER_SELECT_REQUEST
|
static int |
MSGCODE_CHARACTER_SELECT_RESPONSE
|
static int |
MSGCODE_HEARTBEAT
|
static int |
MSGCODE_HEARTBEAT_RESPONSE
|
static int |
MSGCODE_SECURE_CHARACTER_REQUEST
|
static int |
MSGCODE_SERVER_LIST_REQUEST
|
static int |
MSGCODE_SERVER_LIST_RESPONSE
|
static boolean |
SecureToken
The master server sends us the account id in a secure manner by default. |
static long |
TokenValidTime
|
static java.lang.Integer |
WorldId
If WorldId is set, the LoginPlugin only accepts master tokens that specify the correct world id. |
Fields inherited from interface atavism.msgsys.MessageCallback |
---|
NO_FLAGS, RESPONSE_EXPECTED |
Constructor Summary | |
---|---|
LoginPlugin()
|
Method Summary | |
---|---|
void |
dbConnect()
This method connects to the database. |
static CharacterGenerator |
getCharacterGenerator()
Get the global character generator. |
int |
getTCPPort()
This method returns the port the login plugin will listen to for incoming tcp connection. |
protected LoginPlugin.CharacterCreateResponseMessage |
handleCharacterCreateMessage(LoginPlugin.CharacterCreateMessage message,
LoginPlugin.SocketHandler clientSocket)
Respond to a character creation request from the client. |
protected LoginPlugin.CharacterDeleteResponseMessage |
handleCharacterDeleteMessage(LoginPlugin.CharacterDeleteMessage message,
LoginPlugin.SocketHandler clientSocket)
|
protected LoginPlugin.CharacterResponseMessage |
handleCharacterRequestMessage(LoginPlugin.CharacterRequestMessage message,
LoginPlugin.SocketHandler clientSocket)
Respond to a character list request message from the client. |
protected LoginPlugin.CharacterSelectResponseMessage |
handleCharacterSelectRequestMessage(LoginPlugin.CharacterSelectRequestMessage message,
LoginPlugin.SocketHandler clientSocket)
|
protected LoginPlugin.HeartbeatResponseMessage |
handleHeartbeatMessage(LoginPlugin.HeartbeatMessage message,
LoginPlugin.SocketHandler clientSocket)
|
protected LoginPlugin.ServerListResponseMessage |
handleServerListRequestMessage(LoginPlugin.ServerListRequestMessage message,
LoginPlugin.SocketHandler clientSocket)
|
void |
onActivate()
for developers extending the EnginePlugin object, it may be easier to use the onActivate() method which gets called when the plugin is being activated by the Engine. |
void |
onTcpAccept(java.nio.channels.SocketChannel clientSocket)
|
protected PluginStatus |
selectBestProxy(java.util.List<PluginStatus> plugins,
java.util.Map<java.lang.String,java.io.Serializable> characterProperties)
|
protected PluginStatus |
selectProxyPlugin(java.util.Map<java.lang.String,java.io.Serializable> characterProperties)
|
protected boolean |
setProxyProperties(java.util.Map<java.lang.String,java.io.Serializable> props,
PluginStatus proxy)
Use the information in the plugin status's info field to tell the client what the external address is for the proxy plugin. |
void |
setTCPPort(int port)
Set the port the login plugin will listen to for incoming tcp connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MSGCODE_CHARACTER_RESPONSE
public static final int MSGCODE_CHARACTER_DELETE
public static final int MSGCODE_CHARACTER_DELETE_RESPONSE
public static final int MSGCODE_CHARACTER_CREATE
public static final int MSGCODE_CHARACTER_CREATE_RESPONSE
public static final int MSGCODE_CHARACTER_REQUEST
public static final int MSGCODE_CHARACTER_SELECT_REQUEST
public static final int MSGCODE_CHARACTER_SELECT_RESPONSE
public static final int MSGCODE_SECURE_CHARACTER_REQUEST
public static final int MSGCODE_SERVER_LIST_REQUEST
public static final int MSGCODE_SERVER_LIST_RESPONSE
public static final int MSGCODE_HEARTBEAT
public static final int MSGCODE_HEARTBEAT_RESPONSE
public static final int LOGIN_IDLE_TIMEOUT
public static boolean SecureToken
public static long TokenValidTime
public static java.lang.Integer WorldId
Constructor Detail |
---|
public LoginPlugin()
Method Detail |
---|
public void dbConnect()
public void setTCPPort(int port)
port
- the port number used for incoming tcp connectionspublic int getTCPPort()
setTCPPort(int)
public void onActivate()
EnginePlugin
onActivate
in class EnginePlugin
public void onTcpAccept(java.nio.channels.SocketChannel clientSocket)
onTcpAccept
in interface TcpAcceptCallback
protected LoginPlugin.CharacterResponseMessage handleCharacterRequestMessage(LoginPlugin.CharacterRequestMessage message, LoginPlugin.SocketHandler clientSocket)
message
contains the client's auth token and
client version. Implementations should verify the
authenticity of the token and return an empty world token if
the token is invalid. If the auth token is valid, then LoginPlugin.CharacterResponseMessage.setWorldToken(String)
should be set
to a non-empty string. This will indicate to the LoginPlugin
base class that the user is authorized. The auth token to be
passed to subsequent handleCharacterCreateMessage() calls only
if the user is authorized.
The auth token should
contain (or otherwise supply) the user's identity. The user's
characters are returned in a LoginPlugin.CharacterResponseMessage
.
Implementations must not read or write data to the clientSocket
.
message
- request for character list and authorization.clientSocket
- the client's socket connection. Useful for
determining the client's source IP and port number.
Implementations must not read or write data to the socket.protected LoginPlugin.CharacterCreateResponseMessage handleCharacterCreateMessage(LoginPlugin.CharacterCreateMessage message, LoginPlugin.SocketHandler clientSocket)
message
contains the desired character properties.
If character creation is successful, the returned CharacterCreateResponseMessage should contain the new character properties. In addition, the response should also contain a Boolean "status" property that is TRUE for success and FALSE for failure. In case of failure, the response should contain a String "errorMessage" property.
Implementations must not read or write data to the clientSocket
.
protected LoginPlugin.CharacterDeleteResponseMessage handleCharacterDeleteMessage(LoginPlugin.CharacterDeleteMessage message, LoginPlugin.SocketHandler clientSocket)
protected LoginPlugin.CharacterSelectResponseMessage handleCharacterSelectRequestMessage(LoginPlugin.CharacterSelectRequestMessage message, LoginPlugin.SocketHandler clientSocket)
protected LoginPlugin.ServerListResponseMessage handleServerListRequestMessage(LoginPlugin.ServerListRequestMessage message, LoginPlugin.SocketHandler clientSocket)
protected boolean setProxyProperties(java.util.Map<java.lang.String,java.io.Serializable> props, PluginStatus proxy)
props
- proxy
-
protected LoginPlugin.HeartbeatResponseMessage handleHeartbeatMessage(LoginPlugin.HeartbeatMessage message, LoginPlugin.SocketHandler clientSocket)
public static CharacterGenerator getCharacterGenerator()
protected final PluginStatus selectProxyPlugin(java.util.Map<java.lang.String,java.io.Serializable> characterProperties)
protected PluginStatus selectBestProxy(java.util.List<PluginStatus> plugins, java.util.Map<java.lang.String,java.io.Serializable> characterProperties)
|
Copyright © 2018 Dragonsan Studios Sp. z o.o. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |