Marauroa Core API: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>Hendrik Brummermann |
imported>Hendrik Brummermann |
||
| Line 242: | Line 242: | ||
=IRPZone= |
=IRPZone= |
||
IRPZone is the |
IRPZone is the interface that handles the world content and the perceptions. In most cases you should use the implementation MarauroaRPZone and extend it. |
||
The methods are: |
The methods are: |
||
<source lang="java"> |
|||
<pre> |
|||
/** This method is called when the zone is created to populate it */ |
/** This method is called when the zone is created to populate it */ |
||
public void onInit() throws Exception; |
public void onInit() throws Exception; |
||
/** This method is called when the server finish to save the content of the zone */ |
/** This method is called when the server finish to save the content of the zone */ |
||
public void onFinish() throws Exception; |
public void onFinish() throws Exception; |
||
| Line 252: | Line 254: | ||
/** This method adds an object to the Zone */ |
/** This method adds an object to the Zone */ |
||
public void add(RPObject object) throws RPObjectInvalidException; |
public void add(RPObject object) throws RPObjectInvalidException; |
||
/** This method tag an object of the Zone as modified */ |
/** This method tag an object of the Zone as modified */ |
||
public void modify(RPObject object) throws RPObjectInvalidException; |
public void modify(RPObject object) throws RPObjectInvalidException; |
||
/** This method removed an object of the Zone and return it.*/ |
/** This method removed an object of the Zone and return it.*/ |
||
public RPObject remove(RPObject.ID id) throws RPObjectNotFoundException; |
public RPObject remove(RPObject.ID id) throws RPObjectNotFoundException; |
||
/** This method returns an object of the Zone */ |
/** This method returns an object of the Zone */ |
||
public RPObject get(RPObject.ID id) throws RPObjectNotFoundException; |
public RPObject get(RPObject.ID id) throws RPObjectNotFoundException; |
||
/** This method returns true if the object exists in the Zone */ |
/** This method returns true if the object exists in the Zone */ |
||
public boolean has(RPObject.ID id); |
public boolean has(RPObject.ID id); |
||
| Line 266: | Line 272: | ||
/** Iterates over the elements of the zone */ |
/** Iterates over the elements of the zone */ |
||
public Iterator iterator(); |
public Iterator iterator(); |
||
/** Returns the number of elements of the zone */ |
/** Returns the number of elements of the zone */ |
||
public long size(); |
public long size(); |
||
| Line 271: | Line 278: | ||
/** This method return the perception of a zone for a player */ |
/** This method return the perception of a zone for a player */ |
||
public Perception getPerception(RPObject.ID id, byte type); |
public Perception getPerception(RPObject.ID id, byte type); |
||
/** This method is called to take zone to the next turn */ |
/** This method is called to take zone to the next turn */ |
||
public void nextTurn(); |
public void nextTurn(); |
||
/** Method to create the map to send to player's client */ |
/** Method to create the map to send to player's client */ |
||
public java.util.List buildMapObjectsList(RPObject.ID id); |
public java.util.List buildMapObjectsList(RPObject.ID id); |
||
</ |
</source> |
||
In most of the cases all you will wish to modify are: |
In most of the cases all you will wish to modify are: |
||
| Line 281: | Line 290: | ||
* onFinish |
* onFinish |
||
* buildMapObjectsList |
* buildMapObjectsList |
||
=IRPRuleProcessor= |
=IRPRuleProcessor= |
||