Advertisement
iAmTheSonic

MapleArchive Drop Fetcher - DropEntry.java

Nov 9th, 2012
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.07 KB | None | 0 0
  1. package tools.dropfetcher;
  2.  
  3. import client.inventory.MapleInventoryType;
  4. import constants.GameConstants;
  5.  
  6.  
  7. /**
  8.  * @author Simon
  9.  * @author Sonic - only a few small changes
  10.  */
  11. public class DropEntry {
  12.    
  13.     private final int version;
  14.     private final int item_id;
  15.     private final int monster_id;
  16.     private final int chance;
  17.     private int mindrop;
  18.     private int maxdrop;
  19.     private final boolean isBoss;
  20.    
  21.     /**
  22.      * Creates a new drop entry object. Duh.
  23.      *
  24.      * @param item_id
  25.      *        The item ID of the drop.
  26.      * @param monster_id
  27.      *        The monster ID of the dropper.
  28.      * @param isBoss
  29.      *        Is this monster a boss monster?
  30.      * @param version
  31.      *        What version is the drop from. Does almost nothing, actually.
  32.      */
  33.     public DropEntry(final int item_id, final int monster_id, final boolean isBoss, final int version) {
  34.     this.item_id = item_id;
  35.     this.monster_id = monster_id;
  36.     mindrop = 1;
  37.     maxdrop = 1;
  38.     chance = calculateChance(item_id, monster_id);
  39.     this.version = version;
  40.     this.isBoss = isBoss;
  41.     }
  42.    
  43.     /**
  44.      * Calculates the drop chance for a given Item ID. The chances are
  45.      * estimated, and I have no idea how to get the real ones. Deal with it.
  46.      * Thing is, this is probably outdated with v120. So if anyone wants to
  47.      * update it - have fun.
  48.      *
  49.      * @param item_id
  50.      *        The Item ID to calculate the drop chance for.
  51.      * @return The drop chance for the given Item ID.
  52.      */
  53.     private int calculateChance(final int item_id, final int monsterId) {
  54.     MapleInventoryType mit = GameConstants.getInventoryType(item_id);
  55.     int number = (item_id / 1000) % 1000;
  56.     switch (mit) {
  57.         case EQUIP:
  58.         if (isBoss) {
  59.             return 300000;
  60.         }
  61.         return 7000;
  62.         case USE:
  63.         if (isBoss) {
  64.             mindrop = 1;
  65.             maxdrop = 4;
  66.         }
  67.         switch (number) {
  68.             case 0: // Normal potions
  69.             mindrop = 1;
  70.             if (version > 98) {
  71.                 maxdrop = 5;
  72.             }
  73.             return 100000;
  74.             case 1: // watermelons, pills, speed potions, etc
  75.             case 2: // same thing
  76.             return 50000;
  77.             case 3: // advanced potions from crafting (should not drop)
  78.             case 4: // same thing
  79.             case 11: // poison mushroom
  80.             case 28: // cool items
  81.             case 30: // return scrolls
  82.             case 46: // gallant scrolls
  83.             return 0;
  84.             case 10: // strange potions like apples, eggs
  85.             case 12: // drakes blood, sap of ancient tree (rare use)
  86.             case 20: // salad, fried chicken, dews
  87.             case 22: // air bubbles and stuff. ALSO nependeath honey but oh well
  88.             case 50: // antidotes and stuff
  89.             case 290: // mastery books
  90.             return 10000;
  91.             case 40:
  92.             case 41:
  93.             case 43:
  94.             case 44:
  95.             case 48: // pet scrolls
  96.             case 100: // summon bags
  97.             case 101: // summon bags
  98.             case 102: // summon bags
  99.             case 109: // summon bags
  100.             case 120: // pet food
  101.             case 211: // cliffs special potion
  102.             case 240: // rings
  103.             case 270: // pheromone, additional weird stuff
  104.             case 310: // teleport rock
  105.             case 320: // weird drops
  106.             case 390: // weird
  107.             case 430: // quiz things? compass?
  108.             case 440: // jukebox
  109.             case 460: // magnifying glass
  110.             case 470: // golden hammer
  111.             case 490: // crystanol
  112.             case 500: // sp reset
  113.             return 0;
  114.             case 47: // tablets from dragon rider
  115.             return 250000;
  116.             case 49: // clean slats, potential scroll, ees
  117.             case 70: // throwing stars
  118.             case 210: // rare monster piece drops
  119.             case 330: // bullets
  120.             return 1000;
  121.             case 60: // bow arrows
  122.             case 61: // crossbow arrows
  123.             mindrop = 10;
  124.             maxdrop = 50;
  125.             return 20000;
  126.             case 213: // boss transfrom
  127.             return 300000;
  128.             case 280: // skill books
  129.             return 200000;
  130.             case 381: // monster book things
  131.             case 382:
  132.             case 383:
  133.             case 384:
  134.             case 385:
  135.             case 386:
  136.             case 387:
  137.             case 388:
  138.             return 20000;
  139.             case 510: // recipes
  140.             case 511:
  141.             case 512:
  142.             return 10000;
  143.             default:
  144.             return 0;
  145.            
  146.         }
  147.         case ETC:
  148.         switch (number) {
  149.             case 0: // monster pieces
  150.             return 400000;
  151.             case 4: // crystal ores
  152.             case 130: // simulators
  153.             case 131: // manuals
  154.             return 10000;
  155.             case 30: // game pieces
  156.             return 50000;
  157.             case 32: // misc items
  158.             return 250000;
  159.             default:
  160.             return 10000;
  161.         }
  162.         default:
  163.         return 10000;
  164.     }
  165.     }
  166.    
  167.     /**
  168.      * Builds a query string from the data.
  169.      *
  170.      * @return The query string.
  171.      */
  172.     public String getQuerySegment() {
  173.     StringBuilder sb = new StringBuilder();
  174.     sb.append("(");
  175.     sb.append(monster_id);
  176.     sb.append(", ");
  177.     sb.append(item_id);
  178.     sb.append(", ");
  179.     sb.append(mindrop); // Minimum amount of items to drop at once
  180.     sb.append(", ");
  181.     sb.append(maxdrop); // Maximum amount of items to drop at once
  182.     sb.append(", ");
  183.     sb.append(0); // Quest ID. Too lazy to even look at that
  184.     sb.append(", ");
  185.     sb.append(chance); // Drop chance. Again, estimated
  186.     sb.append(")");
  187.     return sb.toString();
  188.     }
  189. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement