HowToAddItemsStendhal: Difference between revisions

Content deleted Content added
imported>Kymara
m Move extendors to extenders
imported>Ufizavipupu
No edit summary
Line 1:
----
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
----
=[http://ezemitekywe.co.cc Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly]=
----
=[http://ezemitekywe.co.cc CLICK HERE]=
----
</div>
{{Navigation for Stendhal Top}}
{{Navigation for Stendhal Extenders}}
Line 7 ⟶ 15:
The file contains all the description of the items in game.
Lets start with how to do weapons, for example in swords.xml:
<&lt;pre>&gt;
<&lt;item name="&quot;dagger">&quot;&gt;
<&lt;type class="&quot;sword"&quot; subclass="&quot;dagger"&quot; tileid="&quot;-1"&quot;/>&gt;
<&lt;description>&gt;You see a dagger, it is little more than decorative but you can jab pretty fast with it.<&lt;/description>&gt;
<&lt;implementation class-name="&quot;games.stendhal.server.entity.item.Item"&quot;/>&gt; <&lt;attributes>&gt;
<&lt;atk value="&quot;8"&quot;/>&gt;
<&lt;rate value="&quot;3"&quot;/>&gt;
<&lt;/attributes>&gt;
<&lt;weight value="&quot;0.2"&quot;/>&gt;
<&lt;value value="&quot;8533"&quot;/>&gt;
<&lt;equipable>&gt;
<&lt;slot name="&quot;bag"&quot;/>&gt;
<&lt;slot name="&quot;lhand"&quot;/>&gt;
<&lt;slot name="&quot;rhand"&quot;/>&gt;
<&lt;/equipable>&gt;
<&lt;/item>&gt;
<&lt;/pre>&gt;
 
It is important to understand how it works.
Line 40 ⟶ 48:
The implementation tag should be copied from above, unless the item is stackable, in which case use:
 
<&lt;pre>&gt;
<&lt;implementation class-name="&quot;games.stendhal.server.entity.item.StackableItem"&quot;/>&gt;
<&lt;/pre>&gt;
 
Inside the ''attributes'' tag you can specify the attributes the weapon has:
Line 74 ⟶ 82:
 
For scrolls, most of which are teleport scrolls, follow the examples in scrolls.xml for what implementation to use. The attribute INFOSTRING for marked scrolls is the destination of the scroll, e.g.
<&lt;pre>&gt;
<&lt;infostring value="&quot;0_nalwor_city 40 60"&quot;/>&gt;
<&lt;/pre>&gt;
For summon scrolls the INFOSTRING is the creature name, but the implementation
<&lt;pre>&gt;
<&lt;implementation class-name="&quot;games.stendhal.server.entity.item.scroll.SummonScroll"&quot;/>&gt;
<&lt;/pre>&gt;
takes care of this, so you do not set it.
 
Line 101 ⟶ 109:
= Add GFX=
 
Now place the 32x32 sprite in the folder '''data/sprites/items/<&lt;class>&gt;/<&lt;subclass>&gt;.png'''
 
See also [[StendhalRefactoringGraphics#Items| How to know graphics specifications for items]]
Line 110 ⟶ 118:
Usually you need to register your item class unless it really does nothing. If you're adding an item which is like what we already have (i.e. just a new shield) it's done for you, the shield class is registered. Add your item to the rest in ''src/games/stendhal/client/entity/EntityMap.java''
 
register("&quot;item"&quot;,null,Item.class);
register("&quot;item"&quot;,"&quot;book"&quot;,Book.class);
register("&quot;item"&quot;,"&quot;food"&quot;,StackableItem.class);
register("&quot;item"&quot;,"&quot;drink"&quot;,StackableItem.class);
register("&quot;item"&quot;,"&quot;money"&quot;,StackableItem.class);
register("&quot;item"&quot;,"&quot;projectiles"&quot;,StackableItem.class);