Atavism Version 2018.1AGIS API

atavism.agis.plugins
Class AgisLoginPlugin

java.lang.Object
  extended by atavism.server.engine.EnginePlugin
      extended by atavism.server.worldmgr.LoginPlugin
          extended by atavism.agis.plugins.AgisLoginPlugin
All Implemented Interfaces:
MessageCallback, StatusMapCallback, TcpAcceptCallback

public class AgisLoginPlugin
extends LoginPlugin

Agis LoginPlugin implementation. Reads and stores characters using the Engine database.


Nested Class Summary
 
Nested classes/interfaces inherited from class atavism.server.worldmgr.LoginPlugin
LoginPlugin.CharacterCreateMessage, LoginPlugin.CharacterCreateResponseMessage, LoginPlugin.CharacterDeleteMessage, LoginPlugin.CharacterDeleteResponseMessage, LoginPlugin.CharacterRequestMessage, LoginPlugin.CharacterResponseMessage, LoginPlugin.CharacterSelectRequestMessage, LoginPlugin.CharacterSelectResponseMessage, LoginPlugin.HeartbeatMessage, LoginPlugin.HeartbeatResponseMessage, LoginPlugin.ServerListRequestMessage, LoginPlugin.ServerListResponseMessage, LoginPlugin.SocketHandler
 
Nested classes/interfaces inherited from class atavism.server.engine.EnginePlugin
EnginePlugin.DeleteHook, EnginePlugin.DeleteSubObjHook, EnginePlugin.GenerateSubObjectHook, EnginePlugin.GetPropertyMessage, EnginePlugin.GetPropertyNamesMessage, EnginePlugin.LoadHook, EnginePlugin.LoadSubObjHook, EnginePlugin.PluginActivateHook, EnginePlugin.PluginStateMessage, EnginePlugin.SaveHook, EnginePlugin.SaveSubObjHook, EnginePlugin.SetPropertyMessage, EnginePlugin.SubObjData, EnginePlugin.TransferFilter, EnginePlugin.TransferObjectMessage, EnginePlugin.UnloadHook, EnginePlugin.UnloadSubObjHook
 
Field Summary
static int ACCOUNT_ADMIN
           
static int ACCOUNT_GM
           
static int ACCOUNT_NORMAL
           
protected  AccountDatabase aDB
           
protected  AuthDatabase authDB
           
static boolean CHARACTER_NAME_ALLOW_NUMBERS
           
static boolean CHARACTER_NAME_ALLOW_SPACES
           
static int CHARACTER_NAME_MAX_LENGTH
           
static int CHARACTER_NAME_MIN_LENGTH
           
protected static java.util.Map<Namespace,java.util.Set<java.lang.String>> characterProps
           
static java.util.Map<java.lang.String,CharacterTemplate> characterTemplates
          A CharacterTemplate Map that has keys based on Race and Class (combined into one String).
static int PLAYER_PERCEPTION_RADIUS
           
 
Fields inherited from class atavism.server.worldmgr.LoginPlugin
LOGIN_IDLE_TIMEOUT, MSGCODE_CHARACTER_CREATE, MSGCODE_CHARACTER_CREATE_RESPONSE, MSGCODE_CHARACTER_DELETE, MSGCODE_CHARACTER_DELETE_RESPONSE, MSGCODE_CHARACTER_REQUEST, MSGCODE_CHARACTER_RESPONSE, MSGCODE_CHARACTER_SELECT_REQUEST, MSGCODE_CHARACTER_SELECT_RESPONSE, MSGCODE_HEARTBEAT, MSGCODE_HEARTBEAT_RESPONSE, MSGCODE_SECURE_CHARACTER_REQUEST, MSGCODE_SERVER_LIST_REQUEST, MSGCODE_SERVER_LIST_RESPONSE, SecureToken, TokenValidTime, WorldId
 
Fields inherited from class atavism.server.engine.EnginePlugin
deleteSubObjectSubscription, dumpAllThreadSubscription, dumpAllThreadSubscriptionLock, loadSubObjectSubscription, lock, MSG_TYPE_DUMP_ALL_THREAD_STACKS, MSG_TYPE_GET_PROPERTY, MSG_TYPE_GET_PROPERTY_NAMES, MSG_TYPE_PLUGIN_STATE, MSG_TYPE_SET_PROPERTY, MSG_TYPE_SET_PROPERTY_NONBLOCK, MSG_TYPE_TRANSFER_OBJECT, pluginStateSubscription, propertySubscription, saveSubObjectSubscription, selectionFilter, selectionSubscription, setSubObjectPersistenceSubscription, subObjectSubscription, unloadSubObjectSubscription
 
Fields inherited from interface atavism.msgsys.MessageCallback
NO_FLAGS, RESPONSE_EXPECTED
 
Constructor Summary
AgisLoginPlugin()
           
 
Method Summary
protected  DisplayContext getDisplayContext(Entity entity)
          Gets the Display Context for the player.
protected  LoginPlugin.CharacterCreateResponseMessage handleCharacterCreateMessage(LoginPlugin.CharacterCreateMessage message, LoginPlugin.SocketHandler clientSocket)
          Create a character.
protected  LoginPlugin.CharacterDeleteResponseMessage handleCharacterDeleteMessage(LoginPlugin.CharacterDeleteMessage message, LoginPlugin.SocketHandler clientSocket)
          Delete a character.
protected  LoginPlugin.CharacterResponseMessage handleCharacterRequestMessage(LoginPlugin.CharacterRequestMessage message, LoginPlugin.SocketHandler clientSocket)
          Return character list.
protected  LoginPlugin.ServerListResponseMessage handleServerListRequestMessage(LoginPlugin.ServerListRequestMessage message, LoginPlugin.SocketHandler clientSocket)
          Returns a list of servers that the player can connect to.
 java.lang.String isNameTaken(java.lang.String name)
          Checks if the name is already used by another player.
 void loadCharacterFactoryTemplatesFromDatabase()
          Loads in Character Creation Templates from the Content Database.
protected  java.lang.String marshallDisplayContext(DisplayContext displayContext)
          Converts the display context into a String for sending to the client.
 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.
static void registerCharacterProperty(Namespace namespace, java.lang.String propName)
          Registers a property into the characterProps Map.
protected  void setCharacterProperties(java.util.Map<java.lang.String,java.io.Serializable> props, Entity entity)
          Fills the props Map with properties from the character.
 
Methods inherited from class atavism.server.worldmgr.LoginPlugin
dbConnect, getCharacterGenerator, getTCPPort, handleCharacterSelectRequestMessage, handleHeartbeatMessage, onTcpAccept, selectBestProxy, selectProxyPlugin, setProxyProperties, setTCPPort
 
Methods inherited from class atavism.server.engine.EnginePlugin
activate, createMBeanInstance, createSubscription, getHookManager, getMessageHandler, getName, getObjectLockManager, getObjectProperties, getObjectProperties, getObjectProperty, getObjectPropertyNames, getPercentCPULoad, getPluginAvailable, getPluginInfo, getPluginNamespaces, getPluginState, getPluginStatus, getPluginType, getPropertyImpl, getPropertyNamesImpl, getStatusMap, handleMessage, handleMessageImpl, logDepsOutstanding, processKeysAndValues, registerActivateHook, registerDeleteHook, registerLoadHook, registerPluginNamespace, registerPluginNamespaces, registerPluginNamespaces, registerPluginNamespaces, registerSaveHook, registerTransferHook, registerUnloadHook, sendSubObjectResponse, sendSubObjectResponse, sendSubObjectResponse, setMessageHandler, setName, setObjectProperties, setObjectProperties, setObjectProperties, setObjectPropertiesNoResponse, setObjectPropertiesNoResponse, setObjectPropertiesNoResponse, setObjectProperty, setObjectPropertyNoResponse, setPercentCPULoad, setPluginAvailable, setPluginInfo, setPluginType, setPropertyImpl, transferObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

characterProps

protected static java.util.Map<Namespace,java.util.Set<java.lang.String>> characterProps

characterTemplates

public static java.util.Map<java.lang.String,CharacterTemplate> characterTemplates
A CharacterTemplate Map that has keys based on Race and Class (combined into one String).


aDB

protected AccountDatabase aDB

authDB

protected AuthDatabase authDB

ACCOUNT_ADMIN

public static final int ACCOUNT_ADMIN
See Also:
Constant Field Values

ACCOUNT_GM

public static final int ACCOUNT_GM
See Also:
Constant Field Values

ACCOUNT_NORMAL

public static final int ACCOUNT_NORMAL
See Also:
Constant Field Values

CHARACTER_NAME_MIN_LENGTH

public static int CHARACTER_NAME_MIN_LENGTH

CHARACTER_NAME_MAX_LENGTH

public static int CHARACTER_NAME_MAX_LENGTH

CHARACTER_NAME_ALLOW_SPACES

public static boolean CHARACTER_NAME_ALLOW_SPACES

CHARACTER_NAME_ALLOW_NUMBERS

public static boolean CHARACTER_NAME_ALLOW_NUMBERS

PLAYER_PERCEPTION_RADIUS

public static int PLAYER_PERCEPTION_RADIUS
Constructor Detail

AgisLoginPlugin

public AgisLoginPlugin()
Method Detail

onActivate

public void onActivate()
Description copied from class: EnginePlugin
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. this is an alternative to calling registerActivateHook()

Overrides:
onActivate in class LoginPlugin

loadCharacterFactoryTemplatesFromDatabase

public void loadCharacterFactoryTemplatesFromDatabase()
Loads in Character Creation Templates from the Content Database.


handleCharacterRequestMessage

protected LoginPlugin.CharacterResponseMessage handleCharacterRequestMessage(LoginPlugin.CharacterRequestMessage message,
                                                                             LoginPlugin.SocketHandler clientSocket)
Return character list. For each character, the following properties are returned:
  • Long characterId: character oid
  • String characterName
  • String race
  • String gender
  • String model
  • String world
  • This implementation does not truly authorize the auth token. The auth token should contain a 32-bit integer which is taken as the account id. (bitwise negated if SecureToken is true).

    The returned world token is a fixed place holder.

    Overrides:
    handleCharacterRequestMessage in class LoginPlugin
    Parameters:
    message - Character request message.
    clientSocket - Socket to the client.

    handleCharacterDeleteMessage

    protected LoginPlugin.CharacterDeleteResponseMessage handleCharacterDeleteMessage(LoginPlugin.CharacterDeleteMessage message,
                                                                                      LoginPlugin.SocketHandler clientSocket)
    Delete a character. On success, the returned properties is the supplied properties plus new properties:
  • Boolean status: TRUE
  • whatever the character factory adds to the properties
  • On an internal failure, the returned properties contain only:

  • Boolean status: FALSE
  • String errorMessage
  • Overrides:
    handleCharacterDeleteMessage in class LoginPlugin
    Parameters:
    message - Character delete message.
    clientSocket - Socket to the client.

    handleCharacterCreateMessage

    protected LoginPlugin.CharacterCreateResponseMessage handleCharacterCreateMessage(LoginPlugin.CharacterCreateMessage message,
                                                                                      LoginPlugin.SocketHandler clientSocket)
    Create a character. The character properties are passed to the global character generator. On success, the returned properties is the supplied properties plus new properties:
  • Boolean status: TRUE
  • Long characterId: new character's oid
  • whatever the character factory adds to the properties
  • If the properties contains "errorMessage" after calling the character factory, the character is not saved, and the properties are returned to the client.

    On an internal failure, the returned properties contain only:

  • Boolean status: FALSE
  • String errorMessage
  • Overrides:
    handleCharacterCreateMessage in class LoginPlugin
    Parameters:
    message - Character create message.
    clientSocket - Socket to the client.

    handleServerListRequestMessage

    protected LoginPlugin.ServerListResponseMessage handleServerListRequestMessage(LoginPlugin.ServerListRequestMessage message,
                                                                                   LoginPlugin.SocketHandler clientSocket)
    Returns a list of servers that the player can connect to. The returned world token is a fixed place holder.

    Overrides:
    handleServerListRequestMessage in class LoginPlugin
    Parameters:
    message - Server List request message.
    clientSocket - Socket to the client.

    isNameTaken

    public java.lang.String isNameTaken(java.lang.String name)
    Checks if the name is already used by another player. Will be updated to also check a list of banned names in the future.

    Parameters:
    name -
    Returns:

    getDisplayContext

    protected DisplayContext getDisplayContext(Entity entity)
    Gets the Display Context for the player. Note: The plan is to remove the display content system from Atavism.

    Parameters:
    entity -
    Returns:

    marshallDisplayContext

    protected java.lang.String marshallDisplayContext(DisplayContext displayContext)
    Converts the display context into a String for sending to the client.

    Parameters:
    displayContext -
    Returns:

    setCharacterProperties

    protected void setCharacterProperties(java.util.Map<java.lang.String,java.io.Serializable> props,
                                          Entity entity)
    Fills the props Map with properties from the character.

    Parameters:
    props -
    entity -

    registerCharacterProperty

    public static void registerCharacterProperty(Namespace namespace,
                                                 java.lang.String propName)
    Registers a property into the characterProps Map.

    Parameters:
    namespace -
    propName -


    Copyright © 2018 Dragonsan Studios Sp. z o.o.