Hello, I want to add an option to have the chance of 2 different masterwork items when crafting something (for example when crafting Vesper Helmet having the chance of getting the normal item, the masterwork item and the chance of getting a custom masterwork one)
I don't know much about java but I've made things by looking at others stuff that works similar and copying/adapting, this is what my RecipeData.java looks like:
Spoiler
@Overridepublicvoid parseDocument(Document doc){// TODO: Cleanup checks enforced by XSD.
final List<L2RecipeInstance> recipePartList =newArrayList<>();
final List<L2RecipeStatInstance> recipeStatUseList =newArrayList<>();
final List<L2RecipeStatInstance> recipeAltStatChangeList =newArrayList<>();for(Node n = doc.getFirstChild(); n !=null; n = n.getNextSibling()){if("list".equalsIgnoreCase(n.getNodeName())){
RECIPES_FILE:for(Node d = n.getFirstChild(); d !=null; d = d.getNextSibling()){if("item".equalsIgnoreCase(d.getNodeName())){
recipePartList.clear();
recipeStatUseList.clear();
recipeAltStatChangeList.clear();NamedNodeMap attrs = d.getAttributes();Node att;int id =-1;
boolean haveRare =false;
boolean haveRare2 =false;
boolean haveRare3 =false;StatsSetset=newStatsSet();
att = attrs.getNamedItem("id");if(att ==null){
LOG.error("{}: Missing id for recipe item, skipping!", getClass().getSimpleName());continue;}
id =Integer.parseInt(att.getNodeValue());set.set("id", id);
att = attrs.getNamedItem("recipeId");if(att ==null){
LOG.error("{}: Missing recipeId for recipe item ID: {}, skipping!", getClass().getSimpleName(), id);continue;}set.set("recipeId",Integer.parseInt(att.getNodeValue()));
att = attrs.getNamedItem("name");if(att ==null){
LOG.error("{}: Missing name for recipe item ID: {}, skipping!", getClass().getSimpleName(), id);continue;}set.set("recipeName", att.getNodeValue());
att = attrs.getNamedItem("craftLevel");if(att ==null){
LOG.error("{}: Missing level for recipe item ID: {}, skipping!", getClass().getSimpleName(), id);continue;}set.set("craftLevel",Integer.parseInt(att.getNodeValue()));
att = attrs.getNamedItem("type");if(att ==null){
LOG.error("{}: Missing type for recipe item ID: {}, skipping!", getClass().getSimpleName(), id);continue;}set.set("isDwarvenRecipe", att.getNodeValue().equalsIgnoreCase("dwarven"));
att = attrs.getNamedItem("successRate");if(att ==null){
LOG.error("{}: Missing successRate for recipe item ID: {}, skipping!", getClass().getSimpleName(), id);continue;}set.set("successRate",Integer.parseInt(att.getNodeValue()));for(Node c = d.getFirstChild(); c !=null; c = c.getNextSibling()){if("statUse".equalsIgnoreCase(c.getNodeName())){String statName = c.getAttributes().getNamedItem("name").getNodeValue();int value =Integer.parseInt(c.getAttributes().getNamedItem("value").getNodeValue());try{
recipeStatUseList.add(new L2RecipeStatInstance(statName, value));}catch(Exception e){
LOG.error("{}: Error in StatUse parameter for recipe item ID: {}, skipping!", getClass().getSimpleName(), id);continue RECIPES_FILE;}}elseif("altStatChange".equalsIgnoreCase(c.getNodeName())){String statName = c.getAttributes().getNamedItem("name").getNodeValue();int value =Integer.parseInt(c.getAttributes().getNamedItem("value").getNodeValue());try{
recipeAltStatChangeList.add(new L2RecipeStatInstance(statName, value));}catch(Exception e){
LOG.error("{}: Error in AltStatChange parameter for recipe item ID: {}, skipping!", getClass().getSimpleName(), id);continue RECIPES_FILE;}}elseif("ingredient".equalsIgnoreCase(c.getNodeName())){int ingId =Integer.parseInt(c.getAttributes().getNamedItem("id").getNodeValue());int ingCount =Integer.parseInt(c.getAttributes().getNamedItem("count").getNodeValue());
recipePartList.add(new L2RecipeInstance(ingId, ingCount));}elseif("production".equalsIgnoreCase(c.getNodeName())){set.set("itemId",Integer.parseInt(c.getAttributes().getNamedItem("id").getNodeValue()));set.set("count",Integer.parseInt(c.getAttributes().getNamedItem("count").getNodeValue()));}elseif("productionRare".equalsIgnoreCase(c.getNodeName())){set.set("rareItemId",Integer.parseInt(c.getAttributes().getNamedItem("id").getNodeValue()));set.set("rareCount",Integer.parseInt(c.getAttributes().getNamedItem("count").getNodeValue()));set.set("rarity",Integer.parseInt(c.getAttributes().getNamedItem("rarity").getNodeValue()));
haveRare =true;}elseif("productionRare2".equalsIgnoreCase(c.getNodeName())){set.set("rareItemId2",Integer.parseInt(c.getAttributes().getNamedItem("id2").getNodeValue()));set.set("rareCount",Integer.parseInt(c.getAttributes().getNamedItem("count").getNodeValue()));set.set("rarity2",Integer.parseInt(c.getAttributes().getNamedItem("rarity2").getNodeValue()));
haveRare =true;}}
L2RecipeList recipeList =new L2RecipeList(set, haveRare);for(L2RecipeInstance recipePart : recipePartList){
recipeList.addRecipe(recipePart);}for(L2RecipeStatInstance recipeStatUse : recipeStatUseList){
recipeList.addStatUse(recipeStatUse);}for(L2RecipeStatInstance recipeAltStatChange : recipeAltStatChangeList){
recipeList.addAltStatChange(recipeAltStatChange);}
_recipes.put(id, recipeList);}}}}}
But when I start the server I get the error on the pic
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
I present to your attention two options for the Hellbound location map
details in the archive
if you have larger effect files, you do not need to replace them
download
updates can be made behind the scenes, so if you catch a crit, post on the forum or download the archive, it may have already been fixed
additionally you can download
all la2 music from the latest version of the game 2025 download
the entire La2 ambisound from the latest version of the game 2025 download
I do what I like because I don't need to push myself to do things for L2 as a means of income. You, on the other hand, are here trying to scam people for $20k files...
But, since you're so talented and competent, I suppose you must be thriving on the fruits of your talents as an L2Off dev, no?
Oh wait
Guess not
If you have error
[ERR] 1067 - Invalid default value for 'createDate'
`createDate` date DEFAULT NULL '00-00-0000',
need use
`createDate` date DEFAULT NULL,
What game client do you need here?
I can't even log in!
# Auto account creation
# ----------------------------
# Auto account creation
# Default: True
AutoCreateAccounts = True
What did I do wrong?
ServerAddr=127.0.0.1
Question
Kyboi
Hello, I want to add an option to have the chance of 2 different masterwork items when crafting something (for example when crafting Vesper Helmet having the chance of getting the normal item, the masterwork item and the chance of getting a custom masterwork one)
Something like this:
I don't know much about java but I've made things by looking at others stuff that works similar and copying/adapting, this is what my RecipeData.java looks like:
But when I start the server I get the error on the pic
Any ideas of what is wrong?
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.