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.
L2 ArenaWar: Low Rate PvP Server with Free Buffs & Autofarm [PVP]⚔️ [Free]🆓
Classic Interlude with 3x XP rates!
Free starter pack(no grade) to kickstart your adventure!
Autofarm for convenient grinding!
Free buffs to keep you fighting fit! (2 job buffs)
No experience loss on death! (Except with Karma)
Clear Karma system to keep things fair! ⚖️
Active community of 800-1k players!
Join our Discord to learn more!
>> Discord <<
Server website: https://l2arenawar.com/en/
You indeed have to save player position over Enterworld to properly clean it up later (if you don't, even trying to delete packet content would eventually keep it up), that's what we do with debug packet (which is a reusable Map of ExServerPrimitive packets) on aCis.
It doesn't solve the FPS stuttering - more you draw/delete lines, more your client becomes laggy. It's like if client wasn't deleting drawn points/lines properly, but instead simply hide them and redrawn content above.
If you got a solution, I would happy to integrate it.
You should check aCis#Player _debug packet integration, it allows very big amount of lines/points to be drawn, it is also reusable.
https://gitlab.com/Tryskell/acis_public/-/blob/master/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java?ref_type=heads
https://gitlab.com/Tryskell/acis_public/-/blob/master/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java?ref_type=heads
we sell website templates, make websites to order. Great selection at very good prices.
My contacts
discord : advert1231
telegram : https://t.me/ggwpins
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?
Link to comment
Share on other sites
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.