Atavism Version 2018.1AGIS API

atavism.agis.objects
Class Claim

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

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

A claim is an area of the world that a user has control of and can perform actions (such as build, dig) and place objects in.

Author:
Andrew Harrison
See Also:
Serialized Form

Nested Class Summary
 class Claim.ClaimEntity
          Sub-class needed for the interpolated world node so a perceiver can be created.
 class Claim.ClaimTask
          A Runnable class that adds an object to the claim when it is run.
 
Field Summary
static int CLAIM_EDIT_RADIUS
           
static int PERMISSION_ADD_DELETE
           
static int PERMISSION_ADD_ONLY
           
static int PERMISSION_ADD_USERS
           
static int PERMISSION_MANAGE_USERS
           
static int PERMISSION_OWNER
           
 
Fields inherited from interface atavism.msgsys.MessageCallback
NO_FLAGS, RESPONSE_EXPECTED
 
Constructor Summary
Claim()
           
Claim(int id, AOVector loc, int size, OID instanceOID, int claimType, OID owner, long instanceOwner, long instanceGuild, DisplayContext dc, java.util.HashMap<java.lang.String,java.io.Serializable> props)
           
 
Method Summary
 void activate()
          Subscribes the instance to receive certain relevant messages that are sent to the world object created by this instance.
 void AddActionData(int id, java.lang.String action, java.lang.String type, AOVector size, AOVector loc, AOVector normal, int material)
          Add in an action from the database.
 void AddClaimObject(int id, int templateId, int stage, boolean complete, int parent, java.lang.String gameObject, AOVector loc, Quaternion orient, int itemID, java.lang.String state, int health, int maxHealth, java.util.HashMap<java.lang.Integer,java.lang.Integer> itemCounts, int lockTemplateId, int lockDurability)
          Add in an object from the database
 void AddClaimPermission(OID playerOid, java.lang.String playerName, int permissionLevel)
          Add in a permission from the database
 void AddClaimResource(int id, int itemID, int count)
          Add in a resource from the database.
 boolean addItemToUpgradeClaimObject(OID playerOid, int objectID, java.util.ArrayList<java.lang.Integer> itemIDs, java.util.ArrayList<OID> itemOids, java.util.ArrayList<java.lang.Integer> counts)
          Adds the specified item to a claim object with the aim of upgrading it.
 void addPermission(OID giverOid, OID giverAccountID, OID targetOid, java.lang.String playerName, int permissionLevel)
          Adds a players permission to the claim.
 void addPlayer(OID playerOID)
          Add a player to the update list for this Claim.
 void addPurchaseItemReq(int purchaseItemReq)
           
 void alterResource(OID playerOid, int itemID, int count)
           
 void attackBuildObject(OID playerOid, int objectID)
          Starts an Attack task to deal damage to the specified claim building object.
 boolean buildClaimObject(OID playerOid, BuildObjectTemplate buildObjectTemplate, AOVector loc, Quaternion orient, int parent, int itemID, OID itemOid)
          Kicks off a BuildTask to add a claim object to the claim based on the given buildObjectTemplate.
 OID changeClaimOwner(OID buyerOID, OID newOwner, OID abandoningCharacter)
          Changes the claim owner to the buyer of the claim.
 void claimDeleted()
          Alerts all nearby players that the claim has been deleted, then despawns the world object.
 void claimUpdated(OID currentPlayer)
          Alerts the players and owner of the Claim that its settings have been updated.
 void deactivate()
           
 boolean getActive()
           
 int getBondItemTemplate()
           
 long getBondPaidUntil()
           
 OID getChestStorageKey(int objectID)
           
 int getClaimItemTemplate()
           
 int getClaimType()
           
 int getCost()
           
 int getCurrency()
           
 java.lang.String getData()
           
 boolean getForSale()
           
 int getID()
           
 long getInstanceGuild()
           
 int getInstanceID()
           
 OID getInstanceOID()
           
 long getInstanceOwner()
           
 AOVector getLoc()
           
 java.lang.String getName()
           
 OID getObjectOID()
           
 OID getOwner()
           
 int getPlayerPermission(OID playerOid, OID accountID)
          Returns the permission level for the player.
 int getPriority()
           
 java.util.HashMap<java.lang.String,java.io.Serializable> getProps()
           
 java.util.LinkedList<java.lang.Integer> getPurchaseItemReqs()
           
 java.lang.String getSellerName()
           
 int getSize()
           
 int getSizeZ()
           
 long getTaxPaidUntil()
           
 void handleMessage(Message msg, int flags)
          Deals with the messages the instance has picked up.
 boolean interruptBuildTask(OID playerOid)
           
 void moveClaimObject(int objectID, AOVector loc, Quaternion orient, int parent)
           
 void performClaimAction(java.lang.String action, java.lang.String type, AOVector size, AOVector loc, AOVector normal, int material)
          Add an action to the claim.
 void removeClaimObject(OID playerOid, int objectID)
           
 void removePermission(OID removerOid, OID removerAccountID, OID targetOid)
          Removes a players permission from the claim.
 void removePlayer(OID playerOID, boolean removeLastID)
          Removes a player from the claim.
 void sendActionsToPlayers()
           
 void sendClaimData(OID playerOid)
          Sends down the claim information to the specified player.
 void sendClaimRemovedData(OID playerOID)
           
 void sendObjectInfo(OID playerOid, int objectID)
          Sends down the information about a claim object to the requesting player.
 void setAccountDatabase(AccountDatabase cDB)
           
 void setActive(boolean active)
           
 void setBondItemTemplate(int bondItemTemplate)
           
 void setBondPaidUntil(long bondPaidUntil)
           
 void setClaimItemTemplate(int claimItemTemplate)
           
 void setClaimType(int claimType)
           
 void setCost(int cost)
           
 void setCurrency(int currency)
           
 void setData(java.lang.String data)
           
 void setForSale(boolean forSale)
           
 void setID(int id)
           
 void setInstanceGuild(long instanceGuild)
           
 void setInstanceID(int instanceID)
           
 void setInstanceOID(OID instanceOID)
           
 void setInstanceOwner(long instanceOwner)
           
 void setLoc(AOVector loc)
           
 void setName(java.lang.String name)
           
 void setObjectOID(OID objectOID)
           
 void setOwner(OID owner)
           
 void setPriority(int priority)
           
 void setProps(java.util.HashMap<java.lang.String,java.io.Serializable> props)
           
 void setPurchaseItemReqs(java.util.LinkedList<java.lang.Integer> purchaseItemReqs)
           
 void setSellerName(java.lang.String sellerName)
           
 void setSize(int size)
           
 void setSizeZ(int sizeZ)
           
 void setTaxPaidUntil(long taxPaidUntil)
           
 void spawn()
          Spawn a world object for the claim.
 void spawn(OID instanceOID)
          An external call to spawn a world object for the claim.
 void takeResource(OID playerOid, int itemID)
           
 void undoAction()
          Undo the last action performed.
 void updateClaimObjectState(int objectID, java.lang.String state)
           
 void useClaimObject(OID playerOid, int objectID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLAIM_EDIT_RADIUS

public static final int CLAIM_EDIT_RADIUS
See Also:
Constant Field Values

PERMISSION_ADD_ONLY

public static final int PERMISSION_ADD_ONLY
See Also:
Constant Field Values

PERMISSION_ADD_DELETE

public static final int PERMISSION_ADD_DELETE
See Also:
Constant Field Values

PERMISSION_ADD_USERS

public static final int PERMISSION_ADD_USERS
See Also:
Constant Field Values

PERMISSION_MANAGE_USERS

public static final int PERMISSION_MANAGE_USERS
See Also:
Constant Field Values

PERMISSION_OWNER

public static final int PERMISSION_OWNER
See Also:
Constant Field Values
Constructor Detail

Claim

public Claim()

Claim

public Claim(int id,
             AOVector loc,
             int size,
             OID instanceOID,
             int claimType,
             OID owner,
             long instanceOwner,
             long instanceGuild,
             DisplayContext dc,
             java.util.HashMap<java.lang.String,java.io.Serializable> props)
Method Detail

AddActionData

public void AddActionData(int id,
                          java.lang.String action,
                          java.lang.String type,
                          AOVector size,
                          AOVector loc,
                          AOVector normal,
                          int material)
Add in an action from the database.

Parameters:
id -
action -
type -
size -
loc -
material -

AddClaimObject

public void AddClaimObject(int id,
                           int templateId,
                           int stage,
                           boolean complete,
                           int parent,
                           java.lang.String gameObject,
                           AOVector loc,
                           Quaternion orient,
                           int itemID,
                           java.lang.String state,
                           int health,
                           int maxHealth,
                           java.util.HashMap<java.lang.Integer,java.lang.Integer> itemCounts,
                           int lockTemplateId,
                           int lockDurability)
Add in an object from the database

Parameters:
id -
templateId -
stage -
complete -
gameObject -
loc -
orient -
itemID -
state -
health -
maxHealth -
itemCounts -

AddClaimResource

public void AddClaimResource(int id,
                             int itemID,
                             int count)
Add in a resource from the database.

Parameters:
id -
itemID -
count -

AddClaimPermission

public void AddClaimPermission(OID playerOid,
                               java.lang.String playerName,
                               int permissionLevel)
Add in a permission from the database

Parameters:
playerOid -
playerName -
permissionLevel -

activate

public void activate()
Subscribes the instance to receive certain relevant messages that are sent to the world object created by this instance.


deactivate

public void deactivate()

handleMessage

public void handleMessage(Message msg,
                          int flags)
Deals with the messages the instance has picked up.

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

addPlayer

public void addPlayer(OID playerOID)
Add a player to the update list for this Claim. The player will receive data about the claim and any updates that occur.

Parameters:
playerOID -

removePlayer

public void removePlayer(OID playerOID,
                         boolean removeLastID)
Removes a player from the claim. They will no longer receive updates.

Parameters:
playerOID -
removeLastID -

claimUpdated

public void claimUpdated(OID currentPlayer)
Alerts the players and owner of the Claim that its settings have been updated.

Parameters:
currentPlayer -

sendClaimData

public void sendClaimData(OID playerOid)
Sends down the claim information to the specified player.

Parameters:
playerOID -

sendClaimRemovedData

public void sendClaimRemovedData(OID playerOID)

spawn

public void spawn(OID instanceOID)
An external call to spawn a world object for the claim.

Parameters:
instanceOID -

spawn

public void spawn()
Spawn a world object for the claim.


changeClaimOwner

public OID changeClaimOwner(OID buyerOID,
                            OID newOwner,
                            OID abandoningCharacter)
Changes the claim owner to the buyer of the claim. Alerts all players nearby that the claim owner has changed.

Parameters:
buyerOID -
newOwner -
Returns:

claimDeleted

public void claimDeleted()
Alerts all nearby players that the claim has been deleted, then despawns the world object.


addPermission

public void addPermission(OID giverOid,
                          OID giverAccountID,
                          OID targetOid,
                          java.lang.String playerName,
                          int permissionLevel)
Adds a players permission to the claim. Verifies that the permission giver can give the permission and that the user does not already have a higher permission level.

Parameters:
giverOid -
targetOid -
playerName -
permissionLevel -

removePermission

public void removePermission(OID removerOid,
                             OID removerAccountID,
                             OID targetOid)
Removes a players permission from the claim. Verifies that the permission remover does have the permission required to remove another users permission and that the target is not the owner of the claim.

Parameters:
removerOid -
targetOid -

getPlayerPermission

public int getPlayerPermission(OID playerOid,
                               OID accountID)
Returns the permission level for the player. Checks if the players account matches the owner, and failing that will see if it can find the characters permission level.

Parameters:
playerOid -
accountID -
Returns:

performClaimAction

public void performClaimAction(java.lang.String action,
                               java.lang.String type,
                               AOVector size,
                               AOVector loc,
                               AOVector normal,
                               int material)
Add an action to the claim. The data is stored in the database and sent down to all players within the draw/reaction radius.

Parameters:
action -
type -
size -
loc -
material -

undoAction

public void undoAction()
Undo the last action performed. Deletes the last entry from the database and sends the undo message to all players within the reaction radius.


sendActionsToPlayers

public void sendActionsToPlayers()

buildClaimObject

public boolean buildClaimObject(OID playerOid,
                                BuildObjectTemplate buildObjectTemplate,
                                AOVector loc,
                                Quaternion orient,
                                int parent,
                                int itemID,
                                OID itemOid)
Kicks off a BuildTask to add a claim object to the claim based on the given buildObjectTemplate.

Parameters:
playerOid -
buildObjectTemplate -
loc -
orient -
itemID -
itemOid -
Returns:

interruptBuildTask

public boolean interruptBuildTask(OID playerOid)

getChestStorageKey

public OID getChestStorageKey(int objectID)

removeClaimObject

public void removeClaimObject(OID playerOid,
                              int objectID)

moveClaimObject

public void moveClaimObject(int objectID,
                            AOVector loc,
                            Quaternion orient,
                            int parent)

updateClaimObjectState

public void updateClaimObjectState(int objectID,
                                   java.lang.String state)

useClaimObject

public void useClaimObject(OID playerOid,
                           int objectID)

addItemToUpgradeClaimObject

public boolean addItemToUpgradeClaimObject(OID playerOid,
                                           int objectID,
                                           java.util.ArrayList<java.lang.Integer> itemIDs,
                                           java.util.ArrayList<OID> itemOids,
                                           java.util.ArrayList<java.lang.Integer> counts)
Adds the specified item to a claim object with the aim of upgrading it. Kicks off a BuildTask if the right item is provided.

Parameters:
playerOid -
objectID -
itemID -
itemOid -
count -

sendObjectInfo

public void sendObjectInfo(OID playerOid,
                           int objectID)
Sends down the information about a claim object to the requesting player. The message will contain information such as what items are needed for it to be upgraded.

Parameters:
playerOid -
objectID -

attackBuildObject

public void attackBuildObject(OID playerOid,
                              int objectID)
Starts an Attack task to deal damage to the specified claim building object.

Parameters:
playerOid -
objectID -

alterResource

public void alterResource(OID playerOid,
                          int itemID,
                          int count)

takeResource

public void takeResource(OID playerOid,
                         int itemID)

getID

public int getID()

setID

public void setID(int id)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getInstanceID

public int getInstanceID()

setInstanceID

public void setInstanceID(int instanceID)

getLoc

public AOVector getLoc()

setLoc

public void setLoc(AOVector loc)

getSize

public int getSize()

setSize

public void setSize(int size)

getSizeZ

public int getSizeZ()

setSizeZ

public void setSizeZ(int sizeZ)

getProps

public java.util.HashMap<java.lang.String,java.io.Serializable> getProps()

setProps

public void setProps(java.util.HashMap<java.lang.String,java.io.Serializable> props)

getInstanceOID

public OID getInstanceOID()

setInstanceOID

public void setInstanceOID(OID instanceOID)

getObjectOID

public OID getObjectOID()

setObjectOID

public void setObjectOID(OID objectOID)

getClaimType

public int getClaimType()

setClaimType

public void setClaimType(int claimType)

getInstanceOwner

public long getInstanceOwner()

setInstanceOwner

public void setInstanceOwner(long instanceOwner)

getOwner

public OID getOwner()

setOwner

public void setOwner(OID owner)

getInstanceGuild

public long getInstanceGuild()

setInstanceGuild

public void setInstanceGuild(long instanceGuild)

getForSale

public boolean getForSale()

setForSale

public void setForSale(boolean forSale)

getCost

public int getCost()

setCost

public void setCost(int cost)

getCurrency

public int getCurrency()

setCurrency

public void setCurrency(int currency)

getSellerName

public java.lang.String getSellerName()

setSellerName

public void setSellerName(java.lang.String sellerName)

getClaimItemTemplate

public int getClaimItemTemplate()

setClaimItemTemplate

public void setClaimItemTemplate(int claimItemTemplate)

getBondItemTemplate

public int getBondItemTemplate()

setBondItemTemplate

public void setBondItemTemplate(int bondItemTemplate)

addPurchaseItemReq

public void addPurchaseItemReq(int purchaseItemReq)

getPurchaseItemReqs

public java.util.LinkedList<java.lang.Integer> getPurchaseItemReqs()

setPurchaseItemReqs

public void setPurchaseItemReqs(java.util.LinkedList<java.lang.Integer> purchaseItemReqs)

getTaxPaidUntil

public long getTaxPaidUntil()

setTaxPaidUntil

public void setTaxPaidUntil(long taxPaidUntil)

getBondPaidUntil

public long getBondPaidUntil()

setBondPaidUntil

public void setBondPaidUntil(long bondPaidUntil)

getPriority

public int getPriority()

setPriority

public void setPriority(int priority)

getData

public java.lang.String getData()

setData

public void setData(java.lang.String data)

getActive

public boolean getActive()

setActive

public void setActive(boolean active)

setAccountDatabase

public void setAccountDatabase(AccountDatabase cDB)


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