Diddy Ranqe 0 Posted January 10, 2022 Report Share Posted January 10, 2022 (edited) I know its not much, but its nice to give back to the community, and there isn't really much released on elvarg for new coders so thought I'd release. Firstly go to your client and find Itemdefinition.java Search for switch (itemId) { Add this under. Quote Quote case 6829: itemDef.name = "Pet Mystery Box"; itemDef.stackable = false; itemDef.actions = new String[5]; itemDef.actions[0] ="Open"; break; Then go back to your server files and make a new package called content. Quote elvarg.game.content In this package create PetMbox.java Paste this to PetMbox.java package com.elvarg.game.content; import java.util.Random; import com.elvarg.world.entity.impl.player.Player; /** * * @author Insidia X aka DR AHK * Discord: Diddy Ranqe#4105 * */ public class PetMbox { /** * The item id of the PetMbox is below. */ public static final int PET_MYSTERY_BOX = 6829; /** * If the roll is between 0 and 250 it pays out these items. {} - FILL THE BLANKS BELOW */ public static int[] WORST_PET_PRIZE = new int[] { 272 }; /** * If the roll is between 251 and 399 it pays out these items. {} - FILL THE BLANKS BELOW */ public static int [] MED_PET_PRIZE = new int[] { 7582, 7583, 1561, 11995 }; /** * If the roll is between 401, and 487 it pays out these items. {} - FILL THE BLANKS BELOW */ public static int [] RARE_PET_PRIZE = new int[] { 13177, 13178 }; /** * Generates the roll the pay out the prize. */ public static int generateRandomNumber() { return new Random().nextInt(611 - 0) + 0; } /** * Gets the random item from the item arrays at the top. */ public static int getRandomItem(int[] array) { return array[new Random().nextInt(array.length)]; } /** * Opens the box and gives the player a random pet or fish food. */ public static void openPetMbox(Player player) { int randomNumber = generateRandomNumber(); int randomItem = 0; player.getInventory().delete(PET_MYSTERY_BOX, 1); player.getPacketSender().sendMessage("You open the box, thank you for donating. Good luck!"); if (randomNumber > 0 && randomNumber < 250) { // Select low quality item to give player randomItem = getRandomItem(WORST_PET_PRIZE); player.getPacketSender().sendMessage("@red@You got fish food, unlucky."); } if (randomNumber > 251 && randomNumber < 399) { // Select med quality item to give player randomItem = getRandomItem(MED_PET_PRIZE); player.getPacketSender().sendMessage("@gre@You just got a PET!!!!!"); } if (randomNumber > 401 && randomNumber < 487) { // Select high quality item to give player randomItem = getRandomItem(RARE_PET_PRIZE); player.getPacketSender().sendMessage("@blu@You just got a RARE PET!!!!!"); } player.getInventory().add(randomItem, 1); } } Then go into ItemPacketListener.java Add this import in. import com.elvarg.game.content.PetMbox; Search for public void handleOption(Player player, int option) And under Quote break; Add case PetMbox.PET_MYSTERY_BOX: PetMbox.openPetMbox(player); break; Edited January 10, 2022 by Diddy Ranqe Link to comment Share on other sites More sharing options...
raellec7 0 Posted January 18, 2022 Report Share Posted January 18, 2022 thanks Link to comment Share on other sites More sharing options...
kkjjrsps 0 Posted February 11, 2022 Report Share Posted February 11, 2022 thank you Link to comment Share on other sites More sharing options...
siikanus 7 Posted February 12, 2022 Report Share Posted February 12, 2022 Good detailed tutorial, it's nice to have good tutorials like this. Link to comment Share on other sites More sharing options...
The Man Stan 8 Posted February 12, 2022 Report Share Posted February 12, 2022 thanks for this Link to comment Share on other sites More sharing options...
Ary3x 0 Posted February 14, 2022 Report Share Posted February 14, 2022 will use thanks Link to comment Share on other sites More sharing options...
b0ats 0 Posted May 29, 2022 Report Share Posted May 29, 2022 This worked thank you. Link to comment Share on other sites More sharing options...
Jeremuz 0 Posted June 1, 2022 Report Share Posted June 1, 2022 Ty for your work Link to comment Share on other sites More sharing options...
Diddy Ranqe 0 Posted June 6, 2022 Author Report Share Posted June 6, 2022 no prob please remember to rep. Link to comment Share on other sites More sharing options...
mrwalkhimdown 1 Posted June 10, 2022 Report Share Posted June 10, 2022 thanks! Link to comment Share on other sites More sharing options...
jonas1373 0 Posted June 26, 2022 Report Share Posted June 26, 2022 nice Link to comment Share on other sites More sharing options...
juy67 0 Posted October 12, 2022 Report Share Posted October 12, 2022 thanks bro Link to comment Share on other sites More sharing options...
 nordvpn123 1 Posted October 13, 2022 Report Share Posted October 13, 2022 very nice sir. Link to comment Share on other sites More sharing options...
Sir Dope 2 Posted October 13, 2022 Report Share Posted October 13, 2022 Thanks for this! Link to comment Share on other sites More sharing options...
Sadie 2 Posted October 15, 2022 Report Share Posted October 15, 2022 very useful thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now