Atavism Version 2018.1AGIS API

atavism.agis.plugins
Class ArenaPlugin

java.lang.Object
  extended by atavism.server.engine.EnginePlugin
      extended by atavism.agis.plugins.ArenaPlugin
All Implemented Interfaces:
MessageCallback, StatusMapCallback

public class ArenaPlugin
extends EnginePlugin

This class is responsible for catching the messages sent out by the ArenaClient then dealing with the data received appropriately. In particular, this class handles the queuing for arenas and will create new arenas when enough players are queued.

Author:
Andrew Harrison

Nested Class Summary
 
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 java.lang.String ARENA_PLUGIN_NAME
           
protected static java.util.Map<java.lang.Integer,ArenaCategory> arenaCategories
           
protected  int arenaCheckType
           
protected static java.util.Map<OID,java.lang.Integer> arenaOids
           
protected static java.util.Map<java.lang.Integer,Arena> arenas
           
protected static java.util.ArrayList<ArenaTemplate> arenaTemplates
           
static int CTF_ARENA
           
static int DEATHMATCH_ARENA
           
protected static java.util.Map<java.lang.Integer,DuelChallenge> duelChallenges
           
static int duelFlagTemplateID
           
protected static java.util.Map<java.lang.Integer,Duel> duels
           
static int FIRST_GAME_MULTIPLIER
           
protected static Logger log
           
static int MUNCHER_ARENA
           
protected static java.util.Map<java.lang.Integer,ArenaQueue> queues
           
static java.lang.String RACE_SMOO
           
static int SECOND_GAME_MULTIPLIER
           
protected static java.util.HashMap<OID,ArenaStats> statsMap
           
static int THIRD_GAME_MULTIPLIER
           
protected static java.lang.String WORLD_TIME_ZONE
           
 
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
ArenaPlugin()
           
 
Method Summary
static void addArenaTemplate(ArenaTemplate template)
          Adds the given arenaTemplate to the ArrayList of arenaTemplates then creates a new ArenaQueue object to handle players queuing for that arena type.
 void checkArenas()
          Checks all queues to see if there are any that have enough players in them to start an arena.
static ArenaCategory getArenaCategory(int categoryID)
          Gets the ArenaCategory object for the given category id.
static java.util.Map<java.lang.Integer,ArenaQueue> getArenaQueues()
           
static java.util.Map<java.lang.Integer,Arena> getArenas()
           
static java.util.Map<java.lang.Integer,DuelChallenge> getDuelChallenges()
           
static java.util.Map<java.lang.Integer,Duel> getDuels()
           
 java.lang.String getName()
          Returns the name of the plugin.
static int getNextArenaID()
           
static ArenaStats getPlayerArenaStats(OID oid)
           
 void loadArenasFromDatabase()
           
 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.
protected  void registerHooks()
           
 void SendArenasQueued(OID oid)
          Whenever a player joins or leaves an arena queue this function should be called so the current list of arenas currently queued for can be sent down to the client.
static void sendChangePlayerRaceMessage(OID oid, java.lang.String race, boolean temporary)
           
static void serverTimeUpdate(int hour, int minute)
           
static void updateArenaStats(int arenaType, int arenaSubType, OID oid, int kills, int deaths, boolean wonArena, int expAwarded, int ratingAdjustment)
          Updates the players stats for this arena type based on their performance in the arena battle.
 
Methods inherited from class atavism.server.engine.EnginePlugin
activate, createMBeanInstance, createSubscription, getHookManager, getMessageHandler, 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

ARENA_PLUGIN_NAME

public static java.lang.String ARENA_PLUGIN_NAME

log

protected static final Logger log

arenaCategories

protected static java.util.Map<java.lang.Integer,ArenaCategory> arenaCategories

arenaTemplates

protected static java.util.ArrayList<ArenaTemplate> arenaTemplates

arenas

protected static java.util.Map<java.lang.Integer,Arena> arenas

arenaOids

protected static java.util.Map<OID,java.lang.Integer> arenaOids

queues

protected static java.util.Map<java.lang.Integer,ArenaQueue> queues

arenaCheckType

protected int arenaCheckType

statsMap

protected static java.util.HashMap<OID,ArenaStats> statsMap

duelChallenges

protected static java.util.Map<java.lang.Integer,DuelChallenge> duelChallenges

duels

protected static java.util.Map<java.lang.Integer,Duel> duels

MUNCHER_ARENA

public static final int MUNCHER_ARENA
See Also:
Constant Field Values

DEATHMATCH_ARENA

public static final int DEATHMATCH_ARENA
See Also:
Constant Field Values

CTF_ARENA

public static final int CTF_ARENA
See Also:
Constant Field Values

duelFlagTemplateID

public static int duelFlagTemplateID

FIRST_GAME_MULTIPLIER

public static int FIRST_GAME_MULTIPLIER

SECOND_GAME_MULTIPLIER

public static int SECOND_GAME_MULTIPLIER

THIRD_GAME_MULTIPLIER

public static int THIRD_GAME_MULTIPLIER

WORLD_TIME_ZONE

protected static java.lang.String WORLD_TIME_ZONE

RACE_SMOO

public static java.lang.String RACE_SMOO
Constructor Detail

ArenaPlugin

public ArenaPlugin()
Method Detail

getName

public java.lang.String getName()
Description copied from class: EnginePlugin
Returns the name of the plugin. Engine.registerPlugin() will call this method and associate the name with the plugin, which can be retrieved by calling Engine.getPlugin()

Overrides:
getName in class EnginePlugin
Returns:
the name of this plugin
See Also:
EnginePlugin.setName(String)

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 EnginePlugin

registerHooks

protected void registerHooks()

loadArenasFromDatabase

public void loadArenasFromDatabase()

serverTimeUpdate

public static void serverTimeUpdate(int hour,
                                    int minute)

sendChangePlayerRaceMessage

public static void sendChangePlayerRaceMessage(OID oid,
                                               java.lang.String race,
                                               boolean temporary)

checkArenas

public void checkArenas()
Checks all queues to see if there are any that have enough players in them to start an arena. Called when a player has joined an arena queue.


getArenaCategory

public static ArenaCategory getArenaCategory(int categoryID)
Gets the ArenaCategory object for the given category id.


updateArenaStats

public static void updateArenaStats(int arenaType,
                                    int arenaSubType,
                                    OID oid,
                                    int kills,
                                    int deaths,
                                    boolean wonArena,
                                    int expAwarded,
                                    int ratingAdjustment)
Updates the players stats for this arena type based on their performance in the arena battle.

Parameters:
oid -

getPlayerArenaStats

public static ArenaStats getPlayerArenaStats(OID oid)

addArenaTemplate

public static void addArenaTemplate(ArenaTemplate template)
Adds the given arenaTemplate to the ArrayList of arenaTemplates then creates a new ArenaQueue object to handle players queuing for that arena type.

Parameters:
template: - the ArenaTemplate to add

SendArenasQueued

public void SendArenasQueued(OID oid)
Whenever a player joins or leaves an arena queue this function should be called so the current list of arenas currently queued for can be sent down to the client.

Parameters:
oid: - the oid of the player who needs their arenas queued for data sent

getArenas

public static java.util.Map<java.lang.Integer,Arena> getArenas()

getArenaQueues

public static java.util.Map<java.lang.Integer,ArenaQueue> getArenaQueues()

getDuelChallenges

public static java.util.Map<java.lang.Integer,DuelChallenge> getDuelChallenges()

getDuels

public static java.util.Map<java.lang.Integer,Duel> getDuels()

getNextArenaID

public static int getNextArenaID()


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