|
|||||||||
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.plugins.InstanceClient
public class InstanceClient
API for instance management. An instance is created from an instance template and optional override template. The instance template specifies the instance world file, initialization script, and load script. Instances may be persistent or non-persistent. Persistent instances can be unloaded and later loaded. Persistent instances will have the same oid when reloaded.
Note: Instance names may not be unique.
The initial instances should be created by a "post" script passed to the InstancePlugin process. If you're using the supplied 'atavism.sh' or 'start-atavism.bat', then the script is named $AO_HOME/config/myworld/startup_instance.py.
Instance objects are searchable using
ObjectTypes.instance
and
PropertySearch
. The
search result is a collection of java.util.Map objects containing the
selected properties. Select properties by name in the SearchSelection.
If the selection mode is SearchSelection.RESULT_KEY_ONLY
, then the
result is a collection of instance oids. If the selection mode
is SearchSelection.RESULT_KEYED
, the result is a collection of
SearchEntry where the key is the instance oid and the value is a
java.util.Map.
SearchManager.searchObjects(atavism.server.objects.ObjectType, atavism.server.engine.SearchClause, atavism.server.engine.SearchSelection)
Nested Class Summary | |
---|---|
static class |
InstanceClient.CreateInstanceMessage
|
static class |
InstanceClient.GetInstanceInfoMessage
|
static class |
InstanceClient.GetMatchingEntityOidsMessage
Request the oids of the entities that match the given name. |
static class |
InstanceClient.GetNavMeshPathMessage
|
static class |
InstanceClient.GetRegionMessage
|
static class |
InstanceClient.InstanceEntryReqMessage
Request object instance entry. |
static class |
InstanceClient.InstanceInfo
Instance information. |
static class |
InstanceClient.RegisterInstanceTemplateMessage
|
static class |
InstanceClient.SetInstanceGroupMessage
|
Field Summary | |
---|---|
static java.lang.String |
COLLECTION_MARKER_OBJECTS
Name of a property of entity objects that contain world collection information. |
static java.lang.String |
COLLECTION_STATIC_OBJECTS
Name of a property of entity objects that contain world collection information. |
static int |
FLAG_ALL_INFO
Get all available instance information. |
static int |
FLAG_AMBIENT_LIGHT
Get instance ambient light. |
static int |
FLAG_DIR_LIGHT
Get instance directional light. |
static int |
FLAG_FOG
Get instance fog. |
static int |
FLAG_GROUP_OID
Get current instance group oid. |
static int |
FLAG_GUILD_OID
Get current instance guild oid. |
static int |
FLAG_MULTIPLE
Get list of InstanceInfo. |
static int |
FLAG_NAME
Get instance name. |
static int |
FLAG_OCEAN
Get instance ocean data. |
static int |
FLAG_OID
Get instance oid. |
static int |
FLAG_PLAYER_OID
Get current instance player oid. |
static int |
FLAG_PLAYER_POPULATION
Get current instance player population. |
static int |
FLAG_POPULATION_LIMIT
Get current instance population limit. |
static int |
FLAG_REGION_CONFIG
Get instance regions. |
static int |
FLAG_SKYBOX
Get instance skybox. |
static int |
FLAG_TEMPLATE_ID
Get instance template name. |
static int |
FLAG_TEMPLATE_NAME
Get instance template name. |
static int |
FLAG_TERRAIN
Get instance terrain data. |
static int |
FLAG_WORLDFILE
Get instance terrain data. |
static MessageType |
MSG_TYPE_CREATE_INSTANCE
|
static MessageType |
MSG_TYPE_DELETE_INSTANCE
|
static MessageType |
MSG_TYPE_GET_ENTITY_OIDS
|
static MessageType |
MSG_TYPE_GET_INSTANCE_INFO
|
static MessageType |
MSG_TYPE_GET_MARKER
|
static MessageType |
MSG_TYPE_GET_NAVMESH_PATH
|
static MessageType |
MSG_TYPE_GET_REGION
|
static MessageType |
MSG_TYPE_INSTANCE_DELETED
|
static MessageType |
MSG_TYPE_INSTANCE_ENTRY_REQ
|
static MessageType |
MSG_TYPE_INSTANCE_LOADED
|
static MessageType |
MSG_TYPE_INSTANCE_UNLOADED
|
static MessageType |
MSG_TYPE_LOAD_INSTANCE
|
static MessageType |
MSG_TYPE_LOAD_INSTANCE_BY_ID
|
static MessageType |
MSG_TYPE_LOAD_INSTANCE_CONTENT
|
static MessageType |
MSG_TYPE_REGISTER_INSTANCE_TEMPLATE
|
static MessageType |
MSG_TYPE_SET_INSTANCE_GROUP
|
static MessageType |
MSG_TYPE_UNLOAD_INSTANCE
|
static Namespace |
NAMESPACE
Instance sub-object namespace. |
static long |
REGION_ALL
Get all region information (search selection flag). |
static long |
REGION_BOUNDARY
Get the region boundary (search selection flag). |
static long |
REGION_PROPERTIES
Get the region properties (search selection flag). |
static int |
RESULT_ERROR_INTERNAL
|
static int |
RESULT_ERROR_NO_WORLD_MANAGER
|
static int |
RESULT_ERROR_RETRY
|
static int |
RESULT_ERROR_UNKNOWN_OBJECT
|
static int |
RESULT_OK
|
static java.lang.String |
TEMPL_ASSET_INFO
Map associated with an instance with an entry for each of the various flash assets required to display an instance. |
static java.lang.String |
TEMPL_COLLISION_POINTS
Instance collision points. |
static java.lang.String |
TEMPL_INIT_SCRIPT_FILE_NAME
Instance init script file name. |
static java.lang.String |
TEMPL_INSTANCE_NAME
Instance name. |
static java.lang.String |
TEMPL_INSTANCE_TEMPLATE_ID
Instance template name. |
static java.lang.String |
TEMPL_INSTANCE_TEMPLATE_NAME
Instance template name. |
static java.lang.String |
TEMPL_INSTANCE_TYPE
Instance type. |
static java.lang.String |
TEMPL_LOAD_SCRIPT_FILE_NAME
Instance load script file name. |
static java.lang.String |
TEMPL_LOADER_OVERRIDE_NAME
World loader override name. |
static java.lang.String |
TEMPL_POPULATION_LIMIT
Property name for the population Limit |
static java.lang.String |
TEMPL_TERRAIN_CONFIG_FILE
Instance terrain config file (.aot). |
static java.lang.String |
TEMPL_UNIQUE_NAME
Unique name flag (Boolean). |
static java.lang.String |
TEMPL_WORLD_COLLECTION_DATABASE_KEYS
Property name for the list of database persistence keys for the collections that should be loaded as part of our instance load. |
static java.lang.String |
TEMPL_WORLD_COLLECTION_FILES
Property name for the list of files that should be loaded as part of our instance load. |
static java.lang.String |
TEMPL_WORLD_FILE_NAME
Instance world file name. |
Constructor Summary | |
---|---|
InstanceClient()
|
Method Summary | |
---|---|
static OID |
createInstance(int templateID,
Template override)
Create an instance. |
static OID |
createInstance(int templateID,
Template override,
OID groupOid,
OID playerOid,
int guildID)
|
static boolean |
deleteInstance(OID instanceOid)
Delete an instance. |
static InstanceClient.InstanceInfo |
getInstanceInfo(OID instanceOid,
int flags)
Get instance information. |
static InstanceClient.InstanceInfo |
getInstanceInfo(OID instanceOid,
int flags,
boolean createIfDoesntExist)
Get instance information. |
static java.util.List<InstanceClient.InstanceInfo> |
getInstanceInfoByName(java.lang.String instanceName,
int flags)
Get instance information by instance name. |
static OID |
getInstanceOid(int instanceID)
Get instance oid from an instance name. |
static OID |
getInstanceOid(int instanceID,
OID groupOid,
OID playerOid,
int guildOid)
Get instance oid from an instance name. |
static OID |
getInstanceOid(int instanceID,
OID groupOid,
OID playerOid,
int guildOid,
boolean createIfDoesntExist)
Get instance oid from an instance name. |
static OID |
getInstanceOid(java.lang.String instanceName)
Get instance oid from an instance name. |
static java.util.List<OID> |
getInstanceOids(java.lang.String instanceName)
Get loaded instance oids from an instance name. |
static Marker |
getMarker(OID defaultInstanceOid,
java.lang.String markerName)
Create a marker based on the underlying marker type object from a loaded instance. |
static Point |
getMarkerPoint(OID instanceOid,
java.lang.String markerName)
Get marker location from a loaded instance. |
static java.util.List<OID> |
getMatchingEntityOids(java.lang.String entityName)
Get entity oids from an entity name. |
static java.util.List<Point> |
getNavMeshPath(OID mobOid,
Point startLoc,
Point endLoc)
Gets the points of a path from the NavMesh to get from startLoc to endLoc. |
static Region |
getRegion(OID instanceOid,
java.lang.String regionName,
long flags)
Get region information from a loaded instance. |
static OID |
loadInstance(int instanceID,
OID groupOid,
OID playerOid,
int guidId)
Sends a message out to load a new instance matching the given instanceID. |
static int |
loadInstance(OID instanceOid)
Load a persistent instance. |
static boolean |
objectInstanceEntry(OID oid,
BasicWorldNode instanceLoc,
int flags)
Move an object to a different instance. |
static boolean |
objectInstanceEntry(OID oid,
BasicWorldNode instanceLoc,
int flags,
BasicWorldNode restoreWnode)
Move an object to a different instance. |
static boolean |
objectInstanceEntry(OID oid,
java.lang.String instanceName,
BasicWorldNode instanceLoc,
int flags)
Move an object to a different instance. |
static boolean |
registerInstanceTemplate(Template template)
Register an instance template. |
static void |
setInstanceGroup(OID instanceOid,
OID groupOid)
|
static boolean |
unloadInstance(OID instanceOid)
Unload a persistent instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FLAG_OID
public static final int FLAG_NAME
public static final int FLAG_TEMPLATE_NAME
public static final int FLAG_TEMPLATE_ID
public static final int FLAG_SKYBOX
public static final int FLAG_FOG
public static final int FLAG_AMBIENT_LIGHT
public static final int FLAG_DIR_LIGHT
public static final int FLAG_OCEAN
public static final int FLAG_WORLDFILE
public static final int FLAG_TERRAIN
public static final int FLAG_REGION_CONFIG
public static final int FLAG_PLAYER_POPULATION
public static final int FLAG_POPULATION_LIMIT
public static final int FLAG_GROUP_OID
public static final int FLAG_PLAYER_OID
public static final int FLAG_GUILD_OID
public static final int FLAG_MULTIPLE
public static final int FLAG_ALL_INFO
public static final long REGION_BOUNDARY
public static final long REGION_PROPERTIES
public static final long REGION_ALL
public static final int RESULT_OK
public static final int RESULT_ERROR_UNKNOWN_OBJECT
public static final int RESULT_ERROR_INTERNAL
public static final int RESULT_ERROR_NO_WORLD_MANAGER
public static final int RESULT_ERROR_RETRY
public static Namespace NAMESPACE
public static final java.lang.String TEMPL_INSTANCE_TEMPLATE_NAME
public static final java.lang.String TEMPL_INSTANCE_TEMPLATE_ID
public static final java.lang.String TEMPL_WORLD_FILE_NAME
registerInstanceTemplate(Template)
,
Constant Field Valuespublic static final java.lang.String TEMPL_INIT_SCRIPT_FILE_NAME
registerInstanceTemplate(Template)
,
Constant Field Valuespublic static final java.lang.String TEMPL_LOAD_SCRIPT_FILE_NAME
registerInstanceTemplate(Template)
,
Constant Field Valuespublic static final java.lang.String TEMPL_TERRAIN_CONFIG_FILE
registerInstanceTemplate(Template)
,
Constant Field Valuespublic static final java.lang.String TEMPL_INSTANCE_NAME
public static final java.lang.String TEMPL_LOADER_OVERRIDE_NAME
public static final java.lang.String TEMPL_UNIQUE_NAME
public static final java.lang.String TEMPL_INSTANCE_TYPE
public static final java.lang.String TEMPL_COLLISION_POINTS
public static final java.lang.String TEMPL_ASSET_INFO
public static final java.lang.String TEMPL_WORLD_COLLECTION_FILES
public static final java.lang.String TEMPL_WORLD_COLLECTION_DATABASE_KEYS
public static final java.lang.String TEMPL_POPULATION_LIMIT
public static final java.lang.String COLLECTION_STATIC_OBJECTS
public static final java.lang.String COLLECTION_MARKER_OBJECTS
public static final MessageType MSG_TYPE_REGISTER_INSTANCE_TEMPLATE
public static final MessageType MSG_TYPE_CREATE_INSTANCE
public static final MessageType MSG_TYPE_GET_INSTANCE_INFO
public static final MessageType MSG_TYPE_GET_MARKER
public static final MessageType MSG_TYPE_GET_REGION
public static final MessageType MSG_TYPE_LOAD_INSTANCE
public static final MessageType MSG_TYPE_UNLOAD_INSTANCE
public static final MessageType MSG_TYPE_DELETE_INSTANCE
public static final MessageType MSG_TYPE_LOAD_INSTANCE_CONTENT
public static final MessageType MSG_TYPE_INSTANCE_UNLOADED
public static final MessageType MSG_TYPE_INSTANCE_DELETED
public static final MessageType MSG_TYPE_INSTANCE_LOADED
public static MessageType MSG_TYPE_INSTANCE_ENTRY_REQ
public static MessageType MSG_TYPE_GET_ENTITY_OIDS
public static MessageType MSG_TYPE_LOAD_INSTANCE_BY_ID
public static MessageType MSG_TYPE_GET_NAVMESH_PATH
public static MessageType MSG_TYPE_SET_INSTANCE_GROUP
Constructor Detail |
---|
public InstanceClient()
Method Detail |
---|
public static boolean registerInstanceTemplate(Template template)
The supported properties are:
TEMPL_WORLD_FILE_NAME
-- name of the world file
TEMPL_INIT_SCRIPT_FILE_NAME
-- instance initialization script
TEMPL_LOAD_SCRIPT_FILE_NAME
-- load script
The world file should be a .aow
file. The init script is
run once when the instance is created. The load script is run
each time a persistent instance is loaded after creation.
The file names undergo variable expansion prior to use. The supported variables are:
public static OID createInstance(int templateID, Template override)
templateName
merged with the
override
. Properties in the override template take
precedence over those in the registered template. See
registerInstanceTemplate(Template)
.
To make a persistent instance, set the persistent property in the registered or override template:
Java: template.put(Namespace.OBJECT_MANAGER, ObjectManagerClient.TEMPL_PERSISTENT, true) Python: template.put(Namespace.OBJECT_MANAGER, ObjectManagerClient.TEMPL_PERSISTENT, Boolean(True))
Instance creation has the following steps:
TEMPL_INIT_SCRIPT_FILE_NAME
)
public static OID createInstance(int templateID, Template override, OID groupOid, OID playerOid, int guildID)
public static int loadInstance(OID instanceOid)
Instance loading has the following steps:
TEMPL_LOAD_SCRIPT_FILE_NAME
)
RESULT_OK
on success, RESULT_ERROR_UNKNOWN_OBJECT
if the
instanceOid does not exist, RESULT_ERROR_NO_WORLD_MANAGER
if there's no world manager to host the instance,
RESULT_ERROR_RETRY
if the instance is in an intermediate
state,
and RESULT_ERROR_INTERNAL
for any
other error.public static boolean unloadInstance(OID instanceOid)
A MSG_TYPE_INSTANCE_UNLOADED SubjectMessage is published after the content is unloaded, but before the instance object is unloaded. The message is published as a broadcast RPC and the caller waits for all subscribers to respond.
This operation is actually implemented in the object manager plugin.
public static boolean deleteInstance(OID instanceOid)
A MSG_TYPE_INSTANCE_DELETED SubjectMessage is published after the content is deleted, but before the instance object is deleted. The message is published as a broadcast RPC and the caller waits for all subscribers to respond.
This operation is actually implemented in the object manager plugin.
public static OID loadInstance(int instanceID, OID groupOid, OID playerOid, int guidId)
public static OID getInstanceOid(java.lang.String instanceName)
public static OID getInstanceOid(int instanceID)
public static OID getInstanceOid(int instanceID, OID groupOid, OID playerOid, int guildOid)
public static OID getInstanceOid(int instanceID, OID groupOid, OID playerOid, int guildOid, boolean createIfDoesntExist)
public static java.util.List<OID> getInstanceOids(java.lang.String instanceName)
public static java.util.List<OID> getMatchingEntityOids(java.lang.String entityName)
public static java.util.List<Point> getNavMeshPath(OID mobOid, Point startLoc, Point endLoc)
public static InstanceClient.InstanceInfo getInstanceInfo(OID instanceOid, int flags)
flags
parameter. Information for unloaded instances
is limited to the 'oid' and 'loaded' status.
instanceOid
- Instance identifier.flags
- Bit-mask of the FLAG_* constants.
public static InstanceClient.InstanceInfo getInstanceInfo(OID instanceOid, int flags, boolean createIfDoesntExist)
flags
parameter. Information for unloaded instances
is limited to the 'oid' and 'loaded' status.
instanceOid
- Instance identifier.flags
- Bit-mask of the FLAG_* constants.
public static java.util.List<InstanceClient.InstanceInfo> getInstanceInfoByName(java.lang.String instanceName, int flags)
flags
parameter. Currently does not support getting
information for unloaded instances.
instanceName
- Instance name.flags
- Bit-mask of the FLAG_* constants.
public static Marker getMarker(OID defaultInstanceOid, java.lang.String markerName)
defaultInstanceOid
- Instance identifier.markerName
- Marker name.
public static Point getMarkerPoint(OID instanceOid, java.lang.String markerName)
instanceOid
- Instance identifier.markerName
- Marker name.
public static Region getRegion(OID instanceOid, java.lang.String regionName, long flags)
flags
parameter.
instanceOid
- Instance identifier.regionName
- Region name.flags
- Bit-mask of REGION_* constants; REGION_BOUNDARY
,
REGION_PROPERTIES
, REGION_ALL
.
public static boolean objectInstanceEntry(OID oid, BasicWorldNode instanceLoc, int flags, BasicWorldNode restoreWnode)
instanceLoc
. The destination instance must already be loaded.
Passing InstanceClient.InstanceEntryReqMessage.FLAG_PUSH
for flags
pushes the current instance
and location onto the player's instance restore stack. A
subsequent instance entry with InstanceClient.InstanceEntryReqMessage.FLAG_POP
will instance back to
this location.
Passing InstanceClient.InstanceEntryReqMessage.FLAG_POP
for flags
removes the top entry from
the player instance stack and moves the player to that instance
and location. The bottom of the instance restore stack is the
fail-safe location and is never removed.
The destination instance may be the same as the current instance.
Blocks until the instance entry is complete. Currently only supported for player objects.
See InstanceClient.InstanceEntryReqMessage
for additional instance
entry options.
oid
- Object identifier (only players are supported).instanceLoc
- Instance and location.flags
- One of FLAG_NONE, FLAG_POP, or FLAG_PUSH fromrestoreWnode
- Location to push onto instance restore stack
InstanceClient.InstanceEntryReqMessage
.
InstanceClient.InstanceEntryReqMessage
public static boolean objectInstanceEntry(OID oid, BasicWorldNode instanceLoc, int flags)
objectInstanceEntry()
.
public static boolean objectInstanceEntry(OID oid, java.lang.String instanceName, BasicWorldNode instanceLoc, int flags)
objectInstanceEntry(atavism.server.engine.OID,BasicWorldNode,int)
,
InstanceClient.InstanceEntryReqMessage
public static void setInstanceGroup(OID instanceOid, OID groupOid)
|
Copyright © 2018 Dragonsan Studios Sp. z o.o. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |