Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.Flenarn;
- import java.util.concurrent.ThreadLocalRandom;
- /**
- * Holds droptable logic, info stored in XML.
- * @author Flenarn
- */
- public class Main {
- public static void main(String[] args) {
- System.out.println("=== Drop Table Rework 0.1 ===");
- System.out.println("Logic created and developed by Flenarn.");
- System.out.println("System split up into several rolls, constants and the like");
- System.out.println("Later revisions will fetch data from XML document.");
- System.out.println("Currently NPC IDs are randomized from 1 - 10.");
- System.out.println("Every other ID (1,3,5,7,9) currently is set to contain a constant drop.");
- System.out.println("Rare/Gem Drop Table effected by Ring of Wealth, reducing max number by 25%.");
- System.out.println("Makes use of \"ThreadLocalRandom\" instead of default Javas default Random util to greatly increase performance.");
- System.out.println(" ");
- /**
- * NPC ID Randomization
- */
- int NPCIDmax = 10;
- int NPCID = ThreadLocalRandom.current().nextInt(1, NPCIDmax + 1);
- /**
- * Value organization for later calls
- */
- int RareRollmax = 128; //Default to 128, 96 if Ring of Wealth is available.
- int GemRollmax = 128; //Default to 128, 96 if Ring of Wealth is available.
- int MegaRollmax = 10; //Dynamic based on population of loot table.
- /**
- * Ring Of Wealth Randomization
- */
- System.out.println(" === Ring of Wealth Configuration ===");
- int RingOfWealth = 1; //On/Off, information will be fetched from server later.
- if (RingOfWealth <= 1) {
- RareRollmax = (RareRollmax/4)*3;
- GemRollmax = (GemRollmax/4)*3;
- System.out.println("Ring Of Wealth = True");
- System.out.println(" ");
- } else {
- System.out.println("Ring of Wealth = False");
- System.out.println(" ");
- }
- System.out.println(" === NPC Configuration ===");
- System.out.println("NPC ID: " + NPCID);
- System.out.println(" ");
- /**
- * Always Drop Configuration
- */
- int AlwaysDrop;
- int QuestDrop;
- int NPCAlwaysID;
- int NPCQuestID;
- //NPCs with constant drops - will be fetched from XML.
- if (NPCID == 1 | NPCID == 3 | NPCID == 5 | NPCID == 7 | NPCID == 9) {
- AlwaysDrop = 1;
- System.out.println("=== Constant Drop Configuration ===");
- System.out.println("Constant drop: True");
- } else {
- AlwaysDrop = 0;
- System.out.println("=== Constant Drop Configuration ===");
- System.out.println("Constant drop: False");
- System.out.println(" ");
- }
- if (NPCID == 1 | NPCID == 9) {
- NPCAlwaysID = 1; //Bones
- } else if (NPCID == 3 | NPCID == 7) {
- NPCAlwaysID = 2; //Dragon Bones
- } else if (NPCID == 5) {
- NPCAlwaysID = 3; //Slime Spores
- } else {
- NPCAlwaysID = 0;
- }
- if (AlwaysDrop == 1) {
- if (NPCAlwaysID == 1) {
- System.out.println("Dropped: Bones");
- } else if (NPCAlwaysID == 2) {
- System.out.println("Dropped: Dragon Bones");
- } else if (NPCAlwaysID == 3) {
- System.out.println("Dropped: Slime Spores");
- }
- //Randomizing the amount on constant drops, min and max will be fetched from XML later.
- int AlwaysAmountmax = 10;
- int AlwaysAmountmin = 1;
- int AlwaysAmount = ThreadLocalRandom.current().nextInt(AlwaysAmountmin, AlwaysAmountmax + 1);
- System.out.println("Amount: " + AlwaysAmount);
- System.out.println(" ");
- /**
- * Quest Drop Configuration
- */
- System.out.println("=== Quest Drop Configuration ===");
- //NPCs with quest drops - will be fetched from XML.
- if (NPCID == 2 | NPCID == 4 | NPCID == 6) {
- QuestDrop = 1;
- System.out.println("Quest Drop: True");
- } else {
- QuestDrop = 0;
- System.out.println("Quest Drop: False");
- System.out.println(" ");
- }
- if (NPCID == 2) {
- NPCQuestID = 1; //Seeds
- } else if (NPCID == 4) {
- NPCQuestID = 2; //Sacred Book
- } else if (NPCID == 6) {
- NPCQuestID = 3; //Magic Logs
- } else {
- NPCQuestID = 0;
- }
- if (QuestDrop == 1) {
- if (NPCQuestID == 1) {
- System.out.println("");
- }
- }
- /**
- * Main Roll
- */
- int MainRollmax = 16; //Default to 128, can be overwritten by XML value.
- int MainRoll = ThreadLocalRandom.current().nextInt(1, MainRollmax + 1);
- System.out.println(" === Main Roll Configuration ===");
- System.out.println(MainRoll + "/" + MainRollmax);
- if (MainRoll == 1) {
- System.out.println("Rare Drop Table Accessed!");
- System.out.println(" ");
- /**
- * Rare Roll Configuration
- */
- System.out.println(" === Rare Roll Configuration ===");
- int RareRoll = ThreadLocalRandom.current().nextInt(1, RareRollmax + 1);
- System.out.println(RareRoll + "/" + RareRollmax);
- if (RareRoll <= 20) {
- System.out.println("Gem Drop Table Accessed!");
- System.out.println(" ");
- /**
- * Gem Roll Configuration
- */
- System.out.println("=== Gem Roll Configuration ===");
- int GemRoll = ThreadLocalRandom.current().nextInt(1, GemRollmax + 1);
- System.out.println(GemRoll + "/" + GemRollmax);
- if (GemRoll == 1) {
- System.out.println("Mega Rare Drop Table Accessed!");
- System.out.println(" ");
- /**
- * Mega Rare Roll Configuration
- */
- System.out.println("=== Mega Rare Roll Configuration ===");
- //Clue Scroll Roll
- int ClueRoll = ThreadLocalRandom.current().nextInt(1, 351 + 1);
- System.out.println(ClueRoll + "/" + 351);
- if (ClueRoll == 1) {
- System.out.println("Clue Scroll Drop Table Accessed!");
- System.out.println(" ");
- /**
- * Clue Scroll Configuration
- */
- System.out.println("=== Clue Scroll Drop Configuration ===");
- int ClueNR = ThreadLocalRandom.current().nextInt(1, 10 + 1);
- if (ClueNR <= 8) {
- System.out.println("A normal clue scroll has fallen to the ground!");
- } else {
- System.out.println("A rare clue scroll has fallen to the ground!");
- }
- }
- }
- }
- } else {
- System.out.println("Standard Drop Table Accessed!");
- //Push to Array
- int[] Mainlist;
- int Weight2 = 565; //565 - Blood Rune
- int Weight3 = 556; //556 - Air Rune
- int Weight4 = 440; //440 - Iron Ore
- int Weight5 = 377; //377 - Raw Lobster
- int Weight6 = 7936; //7936 - Pure Essence
- int Weight7 = 1513; //1513 - Magic Logs
- Mainlist = new int[17];
- Mainlist[0] = 0; //Null Array Listing
- //Mainlist[1] = Rare Drop Table, Null Array Listing
- Mainlist[2] = Weight2;
- Mainlist[3] = Weight3;
- Mainlist[4] = Weight4;
- Mainlist[5] = Weight5;
- Mainlist[6] = Weight6;
- Mainlist[7] = Weight7;
- /*Mainlist[8] = "385 - Shark";
- Mainlist[9] = "311 - Harpoon";
- Mainlist[10] = "995 - Coins";
- Mainlist[11] = "1089 - Black Plateskirt";
- Mainlist[12] = "8784 - Gold leaf";
- Mainlist[13] = "10721 - Frog mask";
- Mainlist[14] = "1739 - Cowhide";
- Mainlist[15] = "1617 - Uncut Diamond";
- Mainlist[16] = "863 - Iron knife"; */
- if (MainRoll > 0) {
- System.out.println("Item ID & name: " + Mainlist[MainRoll]);
- }
- System.out.println(Mainlist[4]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement