Marauroa Core API: Difference between revisions

Content deleted Content added
No edit summary
imported>StephenIerodiaconou
No edit summary
Line 82:
* ''void isA(RPClass parent)''
 
These methods add attributes to the RPClass and set their type and visibility. You can also set the parent of this class. Of course, however, a class can have no parent (be parentless).
 
Once the class has been filled, you can query the data using these methods. These methods alow you to get the class name of the class, the the type of an attribute, determine if an attribute exists and to know if that RPClass is a subclass of another.<br>
Line 117:
</pre>
 
Each time you create a new RPClass and, as long as you give it a name ( ie: player, position, ... ), it will be added to the system list of classes.<br>
Notice onin the example that the HIDDEN attribute, must be specified if you want the RPClass to have this property otherwise by default an attribute is visible.<br>
Note: You can choose not to use RPClasses onin your application butBUT the performance penalty will be big both on bandwidth and CPU usage.
 
= RPAction =
ItRPAction is aan object used to represent actions that a player wants to do.
It is up to you to create these when you design your game aboutas howthey toare definespecific theto contenteach game ( you should also define a RPClass for these ).
 
= RPObject and RPSlot =
AnRPObjects RPObject isare the containtercontainters of data in Arianne. An RPObject is an (''isa'' function) Attributes element with a list of RPSlots attached. Think about RPSlots as backpacks, pockets, boxes, ...<br>
RPSlots are slots on objects that items can be placed on/in, such as backpacks, pockets, boxes, ...<br>
The new methods are:
The methods of the RPObject to modify slots are:
* ''void addSlot(RPSlot slot)''
* RPSlot getSlot(String name)
* void''RPSlot removeSlotgetSlot(String name)''
* boolean''void hasSlotremoveSlot(String name)''
* RPSlot''boolean getSlothasSlot(String name)''
* ''Iterator slotIterator()''
TheseThe above methods addsare used to add a slot to the object, retrieve it, remove it and test if the slot exists. Finally the slot iterator is used to visit all the slots in the object.
 
* ''RPObject.ID getID()''
These methods adds a slot to the object, retrieve it, remove it and test if the slot exists. Finally the slot iterator is used to visit all the slots in the object.
This is a helper method to get the unique ID of the object.
 
RPSlot hasclass elements also ahave verya simple API:
* RPObject.ID getID()
This is a helper method to get the ID of the object.
 
RPSlot has also a very simple API:
* void add(RPObject object)
* RPObject get(RPObject.ID id)
Line 145:
* RPObject remove(RPObject.ID id)
* void clear()
These methods modify objects in the RPSlot.
 
The clear() method removes all the objectobjects ofin the slot.
 
* Iterator iterator()
Line 164:
</pre>
 
Now for the complex part,. whereWhere it all thebecomes nutsa arelittle nuts!: IRPZone and IRPRuleProcessor interfaces
 
=RPWorld=
TODO
 
=IRPZone=
ThisIRPZone is the class that handlehandles the world content and the perceptions. It would be wise to forget about it, or extend MarauroaRPZone instead as it is's a really complex and bugerror prone class. <br>
The methods are:
<pre>
/** This method is called when the zone is created to popullatepopulate it */
public void onInit() throws Exception;
/** This method is called when the server finish to save the content of the zone */
Line 204 ⟶ 205:
</pre>
 
In most of the cases all you will likewish to modify are:
* onInit
* onFinish
Line 211 ⟶ 212:
 
=IRPRuleProcessor=
This class *MUST* be implemented fully, but it is a childchilds toy compared to IRPZone :). HereThis is where you code all your games rules.<br>
The API is as follows:
<pre>
/** Set the context where the actions are executed.