Atavism Version 2018.1AGIS API

atavism.agis.objects
Class SurvivalArena

java.lang.Object
  extended by atavism.agis.objects.SurvivalArena
All Implemented Interfaces:
MessageCallback, java.io.Serializable

public class SurvivalArena
extends java.lang.Object
implements java.io.Serializable, MessageCallback

The Arena class handles an arena instance. It has numerous scheduled executors and a state variable to control the flow of the arena from setup to the end. This class is complete, it relies on no other class to perform it's duties.

Author:
Andrew Harrison
See Also:
Serialized Form

Nested Class Summary
 class SurvivalArena.ArenaCleanup
          Teleports all players out and then sends out a message to remove this arena instance from the Map stored in the ArenaPlugin.
 class SurvivalArena.ArenaStart
          Starts the arena.
 class SurvivalArena.NewRound
           
 
Field Summary
protected  int activePlayers
           
protected  int arenaID
           
protected  java.lang.String arenaName
           
protected  int arenaType
           
protected  java.util.ArrayList<OID> creatures
           
protected  java.util.ArrayList<java.lang.Integer>[] creatureSpawns
           
protected  int currentRound
           
protected  java.util.ArrayList<java.lang.Integer> damageDealt
           
protected  java.util.ArrayList<java.lang.Integer> damageTaken
           
protected  java.util.ArrayList<java.lang.Integer> deaths
           
protected  OID instanceOid
           
protected  int instanceTemplateID
           
protected  java.util.ArrayList<java.lang.Integer> kills
           
protected  int length
           
protected  java.util.ArrayList<java.lang.String> names
           
protected  int numRounds
           
protected  java.util.ArrayList<OID> players
           
protected  java.util.ArrayList<ArenaStats> ratings
           
protected  java.util.ArrayList<java.lang.Integer> scores
           
protected  int startTime
           
protected  java.util.ArrayList<java.lang.Long> subs
           
protected  boolean teamActive
           
protected  java.lang.String teamName
           
protected  int teamScore
           
protected  long timeArenaStarted
           
protected  int victoryCondition
           
protected  java.util.HashMap<java.lang.Integer,java.lang.Integer> victoryPayment
           
 
Fields inherited from interface atavism.msgsys.MessageCallback
NO_FLAGS, RESPONSE_EXPECTED
 
Constructor Summary
SurvivalArena(int numRounds)
          The default constructor.
SurvivalArena(int id, int numRounds, java.util.ArrayList<java.lang.Integer>[] creatureSpawns, java.util.ArrayList<OID> oids, java.util.ArrayList<java.lang.String> names, int type, java.lang.String arenaName, int dur, int condition, int instanceTemplateID, java.util.HashMap<java.lang.Integer,java.lang.Integer> victoryPayment)
          Constructor that takes in two lists that contain the oids of the players on each team.
 
Method Summary
 void addArenaCreature(OID creatureOid)
          Adds a newly spawned creature oid to the list of creatures alive in the arena and sets up a subscription to catch their damage messages.
 int getArenaID()
           
 OID getArenaInstanceOid()
           
 int getArenaType()
           
 java.util.ArrayList<java.lang.Integer> getDeaths()
           
 int getInstanceTemplateID()
           
 java.util.ArrayList<java.lang.Integer> getKills()
           
 int getLength()
           
 java.util.ArrayList<java.lang.String> getNames()
           
 java.util.ArrayList<OID> getPlayers()
           
 java.util.ArrayList<java.lang.Integer> getScores()
           
 int getState()
           
 java.lang.String getTeamName()
           
 void handleDeath(OID attackerOid, OID victimOid)
          This will be called whenever a player or creature in the arena dies.
 void handleMessage(Message msg, int flags)
          process network messages
 void removePlayer(OID oid)
          Removes a player from the arena.
 void setArenaID(int arenaID)
           
 void setArenaInstanceOid(OID instanceOid)
           
 void setArenaType(int arenaType)
           
 void setDeaths(java.util.ArrayList<java.lang.Integer> deaths)
           
 void setInstanceTemplateID(int instanceTemplateID)
           
 void setKills(java.util.ArrayList<java.lang.Integer> kills)
           
 void setLength(int length)
           
 void setNames(java.util.ArrayList<java.lang.String> names)
           
 void setPlayers(java.util.ArrayList<OID> players)
           
 void setScores(java.util.ArrayList<java.lang.Integer> scores)
           
 void setState(int state)
           
 void setTeamName(java.lang.String teamName)
           
 void setup()
          This is run once the Arena object is created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arenaID

protected int arenaID

arenaType

protected int arenaType

arenaName

protected java.lang.String arenaName

instanceOid

protected OID instanceOid

length

protected int length

startTime

protected int startTime

instanceTemplateID

protected int instanceTemplateID

victoryPayment

protected java.util.HashMap<java.lang.Integer,java.lang.Integer> victoryPayment

numRounds

protected int numRounds

currentRound

protected int currentRound

timeArenaStarted

protected long timeArenaStarted

teamActive

protected boolean teamActive

teamScore

protected int teamScore

teamName

protected java.lang.String teamName

activePlayers

protected int activePlayers

creatures

protected java.util.ArrayList<OID> creatures

players

protected java.util.ArrayList<OID> players

names

protected java.util.ArrayList<java.lang.String> names

scores

protected java.util.ArrayList<java.lang.Integer> scores

kills

protected java.util.ArrayList<java.lang.Integer> kills

deaths

protected java.util.ArrayList<java.lang.Integer> deaths

damageTaken

protected java.util.ArrayList<java.lang.Integer> damageTaken

damageDealt

protected java.util.ArrayList<java.lang.Integer> damageDealt

creatureSpawns

protected java.util.ArrayList<java.lang.Integer>[] creatureSpawns

subs

protected transient java.util.ArrayList<java.lang.Long> subs

ratings

protected java.util.ArrayList<ArenaStats> ratings

victoryCondition

protected int victoryCondition
Constructor Detail

SurvivalArena

public SurvivalArena(int numRounds)
The default constructor. This creates the Arrays and ArrayLists. This needs to be called by the other constructors.

Parameters:
numTeams: - the number of teams in the arena

SurvivalArena

public SurvivalArena(int id,
                     int numRounds,
                     java.util.ArrayList<java.lang.Integer>[] creatureSpawns,
                     java.util.ArrayList<OID> oids,
                     java.util.ArrayList<java.lang.String> names,
                     int type,
                     java.lang.String arenaName,
                     int dur,
                     int condition,
                     int instanceTemplateID,
                     java.util.HashMap<java.lang.Integer,java.lang.Integer> victoryPayment)
Constructor that takes in two lists that contain the oids of the players on each team.

Parameters:
one: - the list of oids for players on team one
two: - the list of oids for players on team two
type: - the arena type
dur: - the duration of the arena
goals: - the goal score for the teams
loc: - the centre point of the arena
id: - the identification number of the arena
minPlayers: - the minimum number of players in each team
Method Detail

setup

public void setup()
This is run once the Arena object is created. It will be responsible for teleporting players to their bases, sending the setup extension message to all players and then getting arenaStart() to be activated in 30 seconds.


handleMessage

public void handleMessage(Message msg,
                          int flags)
process network messages

Specified by:
handleMessage in interface MessageCallback
Parameters:
msg - Message sent from other agent.
flags - Bitwise OR of MessageCallback.NO_FLAGS, MessageCallback.RESPONSE_EXPECTED.

addArenaCreature

public void addArenaCreature(OID creatureOid)
Adds a newly spawned creature oid to the list of creatures alive in the arena and sets up a subscription to catch their damage messages.

Parameters:
creatureOid -

removePlayer

public void removePlayer(OID oid)
Removes a player from the arena.

Parameters:
oid: - The player being removed from the arena

handleDeath

public void handleDeath(OID attackerOid,
                        OID victimOid)
This will be called whenever a player or creature in the arena dies.

Parameters:
attackerOid: - the oid of the attacker
victimOid: - the oid of the victim

getArenaID

public int getArenaID()

setArenaID

public void setArenaID(int arenaID)

getArenaInstanceOid

public OID getArenaInstanceOid()

setArenaInstanceOid

public void setArenaInstanceOid(OID instanceOid)

getArenaType

public int getArenaType()

setArenaType

public void setArenaType(int arenaType)

getLength

public int getLength()

setLength

public void setLength(int length)

getInstanceTemplateID

public int getInstanceTemplateID()

setInstanceTemplateID

public void setInstanceTemplateID(int instanceTemplateID)

getState

public int getState()

setState

public void setState(int state)

getTeamName

public java.lang.String getTeamName()

setTeamName

public void setTeamName(java.lang.String teamName)

getPlayers

public java.util.ArrayList<OID> getPlayers()

setPlayers

public void setPlayers(java.util.ArrayList<OID> players)

getNames

public java.util.ArrayList<java.lang.String> getNames()

setNames

public void setNames(java.util.ArrayList<java.lang.String> names)

getScores

public java.util.ArrayList<java.lang.Integer> getScores()

setScores

public void setScores(java.util.ArrayList<java.lang.Integer> scores)

getKills

public java.util.ArrayList<java.lang.Integer> getKills()

setKills

public void setKills(java.util.ArrayList<java.lang.Integer> kills)

getDeaths

public java.util.ArrayList<java.lang.Integer> getDeaths()

setDeaths

public void setDeaths(java.util.ArrayList<java.lang.Integer> deaths)


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