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.
Account Features
➡ EARLY SUPPORTER BADGE
➡ NO QUEST BADGE
➡ 24 MONTHS BOOST BADGE
➡ 1 YEAR NITRO SUBSCRIPTION
➡ CREATION DATE IS 2017
➡ ACCOUNT STANDING STATUS IS ALL GOOD
➡ CLEAN BILLING
➡ OGE MAIL OUTLOOK
PAYMENT METHODS
➡ CRYPTO
➡ PAYPAL
➡ CASHAPP
➡ BANK TRANSFER
➡ GIFTCARDS
➡ ZELLE
➡ VENMO
CONTACTS
➡ DISCORD : crh11s
➡ TELEGRAM : crh11s
CONTACT WITH ME IF YOU ARE SERIOUS BUYE
To check the operation of npc movement. You can turn off all movement in the game and move only the npc you want using the move to package. This way you will reduce a lot of unnecessary code and understand where the problem is.
And all your maps are not thread safe and you are using multithreading
startQuestTimer("move", 5000, npc, null);
Verify if following is supposed to be the way to handle movement
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(point.getX(), point.getY(), point.getZ()));
For me, it's not enough. And if it's the case, whole AI system is probably buggy.
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.