Vendily

Cram-o-Matic

Aug 29th, 2020 (edited)
2,262
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===============================================================================
  2. # Cram-o-Matic - By Vendily and KyureJL [v17/v18]
  3. #===============================================================================
  4. # This script adds in the Cram-o-Matic, the combinational machine from the SwSh
  5. #  Isle of Armor DLC.
  6. #===============================================================================
  7. # The you only need to call pbCramOMatic in an event, and the script will allow
  8. #  you to pick 4 items to convert. Canceling early returns the items.
  9. #  Only items in CRAMOMATIC_ITEMDATA can be chosen.
  10. #
  11. # CRAMOMATIC_ITEMDATA contains entries where the key is the symbol for the item
  12. #  and the value is an array of the item type (doesn't actually have to be a type)
  13. #  and the value of the item.
  14. #
  15. # There are a few hard coded recipies, and the generic type based recipies
  16. #  are defined in CRAMOMATIC_TYPERECIPIES
  17. #
  18. # CRAMOMATIC_TYPERECIPIES contains entries where the key is the type (doesn't
  19. #  have to be a type) and the value is an array of item symbols. The array has to
  20. #  be the same length as CRAMOMATIC_RATIO. You can set a slot as an array of
  21. #  item symbols to pick one at random.
  22. #===============================================================================
  23. begin
  24. PluginManager.register({
  25.   :name    => "Cram-o-Matic",
  26.   :version => "1.0",
  27.   :link    => "https://reliccastle.com/resources/449/",
  28.   :credits => ["Vendily","KyureJL"]
  29. })
  30. rescue
  31.   # not v18
  32. end
  33. CRAMOMATIC_ITEMDATA={
  34.   :BUGMEMORY=>[:BUG,40],
  35.   :GRIPCLAW=>[:BUG,26],
  36.   :SILVERPOWDER=>[:BUG,10],
  37.   :SHEDSHELL=>[:BUG,10],
  38.   :TANGABERRY=>[:BUG,4],
  39.   :ENIGMABERRY=>[:BUG,10],
  40.   :HONEY=>[:BUG,2],
  41.  
  42.   :DARKMEMORY=>[:DARK,40],
  43.   :BINDINGBAND=>[:DARK,8],
  44.   :BLKAPRICORN=>[:DARK,0],
  45.   :BLACKAPRICORN=>[:DARK,0],
  46.   :BLACKGLASSES=>[:DARK,14],
  47.   :BLUNDERPOLICY=>[:DARK,24],
  48.   :COLBURBERRY=>[:DARK,4],
  49.   :DUBIOUSDISC=>[:DARK,32],
  50.   :IAPAPABERRY=>[:DARK,4],
  51.   :MARANGABERRY=>[:DARK,6],
  52.   :RAZORCLAW=>[:DARK,26],
  53.   :RINGTARGET=>[:DARK,14],
  54.   :ROWAPBERRY=>[:DARK,6],
  55.   :SCOPELENS=>[:DARK,12],
  56.   :WEAKNESSPOLICY=>[:DARK,30],
  57.   :WIDELENS=>[:DARK,22],
  58.   :ZOOMLENS=>[:DARK,22],
  59.    
  60.   :DRAGONMEMORY=>[:DRAGON,40],
  61.   :EVIOLITE=>[:DRAGON,32],
  62.   :LIFEORB=>[:DRAGON,20],
  63.   :DRAGONFANG=>[:DRAGON,18],
  64.   :DRAGONSCALE=>[:DRAGON,18],
  65.   :FOSSILIZEDDRAKE=>[:DRAGON,10],
  66.   :DYNAMAXCANDY=>[:DRAGON,6],
  67.   :JABOCABERRY=>[:DRAGON,6],
  68.   :AGUAVBERRY=>[:DRAGON,4],
  69.   :HABANBERRY=>[:DRAGON,4],
  70.  
  71.   :ELECTRICMEMORY=>[:ELECTRIC,40],
  72.   :LIGHTBALL=>[:ELECTRIC,20],
  73.   :MAGNET=>[:ELECTRIC,20],
  74.   :CELLBATTERY=>[:ELECTRIC,14],
  75.   :FOSSILIZEDBIRD=>[:ELECTRIC,10],
  76.   :ELECTRICSEED=>[:ELECTRIC,8],
  77.   :THUNDERSTONE=>[:ELECTRIC,6],
  78.   :WACANBERRY=>[:ELECTRIC,4],
  79.   :PECHABERRY=>[:ELECTRIC,2],
  80.   :YLWAPRICORN=>[:ELECTRIC,0],
  81.   :YELLOWAPRICORN=>[:ELECTRIC,0],
  82.  
  83.   :FAIRYMEMORY=>[:FAIRY,40],
  84.   :BERRYSWEET=>[:FAIRY,30],
  85.   :CLOVERSWEET=>[:FAIRY,30],
  86.   :FLOWERSWEET=>[:FAIRY,30],
  87.   :LOVESWEET=>[:FAIRY,30],
  88.   :RIBBONSWEET=>[:FAIRY,30],
  89.   :STARSWEET=>[:FAIRY,30],
  90.   :STRAWBERRYSWEET=>[:FAIRY,30],
  91.   :WHIPPEDDREAM=>[:FAIRY,26],
  92.   :SACHET=>[:FAIRY,20],
  93.   :BRIGHTPOWDER=>[:FAIRY,14],
  94.   :MISTYSEED=>[:FAIRY,8],
  95.   :KEEBERRY=>[:FAIRY,6],
  96.   :MOONSTONE=>[:FAIRY,40],
  97.   :SHINYSTONE=>[:FAIRY,6],
  98.   :ROSELIBERRY=>[:FAIRY,4],
  99.   :PIXIEPLATE=>[:FAIRY,2],
  100.   :PNKAPRICORN=>[:FAIRY,0],
  101.   :PINKAPRICORN=>[:FAIRY,0],
  102.  
  103.   :FIGHTINGMEMORY=>[:FIGHTING,40],
  104.   :EXPERTBELT=>[:FIGHTING,32],
  105.   :ARMORITEORE=>[:FIGHTING,28],
  106.   :MACHOBRACE=>[:FIGHTING,26],
  107.   :CHOICEBAND=>[:FIGHTING,20],
  108.   :POWERANKLET=>[:FIGHTING,20],
  109.   :POWERBAND=>[:FIGHTING,20],
  110.   :POWERBELT=>[:FIGHTING,20],
  111.   :POWERBRACER=>[:FIGHTING,20],
  112.   :BLACKBELT=>[:FIGHTING,14],
  113.   :MUSCLEBAND=>[:FIGHTING,14],
  114.   :FOCUSBAND=>[:FIGHTING,12],
  115.   :FOCUSSASH=>[:FIGHTING,12],
  116.   :PROTECTIVEPADS=>[:FIGHTING,12],
  117.   :SALACBERRY=>[:FIGHTING,12],
  118.   :KELPSYBERRY=>[:FIGHTING,6],
  119.   :CALCIUM=>[:FIGHTING,4],
  120.   :CARBOS=>[:FIGHTING,4],
  121.   :CHOPLEBERRY=>[:FIGHTING,4],
  122.   :HPUP=>[:FIGHTING,4],
  123.   :IRON=>[:FIGHTING,4],
  124.   :PROTEIN=>[:FIGHTING,4],
  125.   :ZINC=>[:FIGHTING,4],
  126.   :LEPPABERRY=>[:FIGHTING,2],
  127.  
  128.   :FIREMEMORY=>[:FIRE,40],
  129.   :CHARCOAL=>[:FIRE,32],
  130.   :REDCARD=>[:FIRE,16],
  131.   :FLAMEORB=>[:FIRE,14],
  132.   :HEATROCK=>[:FIRE,12],
  133.   :FIRESTONE=>[:FIRE,6],
  134.   :SUNSTONE=>[:FIRE,6],
  135.   :FIGYBERRY=>[:FIRE,4],
  136.   :OCCABERRY=>[:FIRE,4],
  137.   :CHERIBERRY=>[:FIRE,2],
  138.   :REDAPRICORN=>[:FIRE,0],
  139.  
  140.   :FLYINGMEMORY=>[:FLYING,40],
  141.   :UTILITYUMBRELLA=>[:FLYING,20],
  142.   :AIRBALLOON=>[:FLYING,20],
  143.   :SHARPBEAK=>[:FLYING,10],
  144.   :LANSATBERRY=>[:FLYING,10],
  145.   :CLEVERFEATHER=>[:FLYING,6],
  146.   :GENIOUSFEATHER=>[:FLYING,6],
  147.   :GREPABERRY=>[:FLYING,6],
  148.   :HEALTHFEATHER=>[:FLYING,6],
  149.   :MUSCLEFEATHER=>[:FLYING,6],
  150.   :PRETTYFEATHER=>[:FLYING,6],
  151.   :RESISTFEATHER=>[:FLYING,6],
  152.   :SWIFTFEATHER=>[:FLYING,6],
  153.   :COBABERRY=>[:FLYING,4],
  154.   :LUMBERRY=>[:FLYING,2],
  155.  
  156.   :GHOSTREMORY=>[:GHOST,40],
  157.   :REAPERCLOTH=>[:GHOST,32],
  158.   :SPELLTAG=>[:GHOST,26],
  159.   :CLEANSETAG=>[:GHOST,24],
  160.   :ADRENALINEORB=>[:GHOST,12],
  161.   :CUSTAPBERRY=>[:GHOST,10],
  162.   :DUSKSTONE=>[:GHOST,6],
  163.   :KASIBBERRY=>[:GHOST,4],
  164.   :MAGOBERRY=>[:GHOST,4],
  165.   :ODDINCENSE=>[:GHOST,2],
  166.  
  167.   :GRASSMEMORY=>[:GRASS,40],
  168.   :SWEETAPPLE=>[:GRASS,30],
  169.   :TARTAPPLE=>[:GRASS,30],
  170.   :BALMMUSHROOM=>[:GRASS,24],
  171.   :LEFTOVERS=>[:GRASS,20],
  172.   :LEEK=>[:GRASS,18],
  173.   :ADAMANTRINT=>[:GRASS,16],
  174.   :BOLDMINT=>[:GRASS,16],
  175.   :BRAVEMINT=>[:GRASS,16],
  176.   :CALMMINT=>[:GRASS,16],
  177.   :CAREFULMINT=>[:GRASS,16],
  178.   :GENTLEMINT=>[:GRASS,16],
  179.   :HASTYMINT=>[:GRASS,16],
  180.   :IMPISHMINT=>[:GRASS,16],
  181.   :LAXMINT=>[:GRASS,16],
  182.   :LONELYMINT=>[:GRASS,16],
  183.   :MILDMINT=>[:GRASS,16],
  184.   :MODESTRINT=>[:GRASS,16],
  185.   :NAIVEMINT=>[:GRASS,16],
  186.   :NAUGHTYMINT=>[:GRASS,16],
  187.   :QUIETRINT=>[:GRASS,16],
  188.   :RASHMINT=>[:GRASS,16],
  189.   :RELAXEDMINT=>[:GRASS,16],
  190.   :SASSYMINT=>[:GRASS,16],
  191.   :SERIOUSMINT=>[:GRASS,16],
  192.   :TIMIDMINT=>[:GRASS,16],
  193.   :BIGMUSHROOM=>[:GRASS,14],
  194.   :MENTALHERB=>[:GRASS,14],
  195.   :MIRACLESEED=>[:GRASS,14],
  196.   :WHITEHERB=>[:GRASS,14],
  197.   :LIECHIBERRY=>[:GRASS,12],
  198.   :POWERHERB=>[:GRASS,10],
  199.   :STICKYBARB=>[:GRASS,10],
  200.   :ABSORBBULB=>[:GRASS,8],
  201.   :BIGROOT=>[:GRASS,8],
  202.   :GRASSYSEED=>[:GRASS,8],
  203.   :LUMINOUSMOSS=>[:GRASS,8],
  204.   :LEAFSTONE=>[:GRASS,6],
  205.   :GALARICATWIG=>[:GRASS,4],
  206.   :RINDOBERRY=>[:GRASS,4],
  207.   :RAWSTBERRY=>[:GRASS,2],
  208.   :ROSEINCENSE=>[:GRASS,2],
  209.   :TINYMUSHROOM=>[:GRASS,2],
  210.   :GRNAPRICORN=>[:GRASS,0],
  211.   :GREENAPRICORN=>[:GRASS,0],
  212.  
  213.   :GROUNDMEMORY=>[:GROUND,40],
  214.   :BIGNUGGET=>[:GROUND,38],
  215.   :CHIPPEDPOT=>[:GROUND,36],
  216.   :CRACKEDPOT=>[:GROUND,30],
  217.   :SOFTSAND=>[:GROUND,20],
  218.   :THICKCLUB=>[:GROUND,18],
  219.   :NUGGET=>[:GROUND,16],
  220.   :HEAVYDUTYBOOTS=>[:GROUND,16],
  221.   :APICOTBERRY=>[:GROUND,12],
  222.   :RAREBONE=>[:GROUND,12],
  223.   :TERRAINEXTENDER=>[:GROUND,12],
  224.   :STARDUST=>[:GROUND,8],
  225.   :HONDEWBERRY=>[:GROUND,6],
  226.   :SHUCABERRY=>[:GROUND,4],
  227.   :PERSIMBERRY=>[:GROUND,2],
  228.  
  229.   :ICEMEMORY=>[:ICE,40],
  230.   :COMETSHARD=>[:ICE,34],
  231.   :NEVERMELTICE=>[:ICE,14],
  232.   :GANLONBERRY=>[:ICE,12],
  233.   :ICYROCK=>[:ICE,12],
  234.   :FOSSILIZEDDINO=>[:ICE,10],
  235.   :SNOWBALL=>[:ICE,8],
  236.   :ICESTONE=>[:ICE,6],
  237.   :POMEGBERRY=>[:ICE,6],
  238.   :YACHEBERRY=>[:ICE,4],
  239.   :ASPEARBERRY=>[:ICE,2],
  240.  
  241.   :ABILITYCAPSULE=>[:NORMAL,40],
  242.   :PPMAX=>[:NORMAL,40],
  243.   :PPUP=>[:NORMAL,38],
  244.   :AMULETCOIN=>[:NORMAL,32],
  245.   :UPGRADE=>[:NORMAL,30],
  246.   :QUICKPOWDER=>[:NORMAL,28],
  247.   :QUICKCLAW=>[:NORMAL,26],
  248.   :SILKSCARF=>[:NORMAL,22],
  249.   :CHOICESCARF=>[:NORMAL,20],
  250.   :LUCKYEGG=>[:NORMAL,20],
  251.   :SAFETYGOGGLES=>[:NORMAL,10],
  252.   :NORMALGEM=>[:NORMAL,8],
  253.   :CHILANBERRY=>[:NORMAL,4],
  254.   :FULLINCENSE=>[:NORMAL,2],
  255.   :LUCKINCENSE=>[:NORMAL,2],
  256.   :WHTAPRICORN=>[:NORMAL,0],
  257.   :WHITEAPRICORN=>[:NORMAL,0],
  258.  
  259.   :POISONMEMORY=>[:POISON,40],
  260.   :POISONBARB=>[:POISON,32],
  261.   :WISHINGPIECE=>[:POISON,28],
  262.   :SMOKEBALL=>[:POISON,22],
  263.   :GALARICACUFF=>[:POISON,18],
  264.   :TOXICORB=>[:POISON,14],
  265.   :PETAYABERRY=>[:POISON,12],
  266.   :BLACKSLUDGE=>[:POISON,10],
  267.   :QUALOTBERRY=>[:POISON,6],
  268.   :KEBIABERRY=>[:POISON,4],
  269.   :MAXREPEL=>[:POISON,2],
  270.   :ORANBERRY=>[:POISON,2],
  271.   :REPEL=>[:POISON,2],
  272.   :SUPERREPEL=>[:POISON,2],
  273.  
  274.   :RARECANDY=>[:PSYCHIC,40],
  275.   :PSYCHICMEMORY=>[:PSYCHIC,40],
  276.   :DESTINYKNOT=>[:PSYCHIC,28],
  277.   :ROOMSERVICE=>[:PSYCHIC,24],
  278.   :CHOICESPECS=>[:PSYCHIC,20],
  279.   :LIGHTCLAY=>[:PSYCHIC,20],
  280.   :POWERLENS=>[:PSYCHIC,20],
  281.   :TWISTEDSPOON=>[:PSYCHIC,18],
  282.   :EXPCANDYXL=>[:PSYCHIC,10],
  283.   :STARFBERRY=>[:PSYCHIC,10],
  284.   :WISEGLASSES=>[:PSYCHIC,10],
  285.   :EXPCANDYL=>[:PSYCHIC,8],
  286.   :PSYCHICSEED=>[:PSYCHIC,8],
  287.   :DAWNSTONE=>[:PSYCHIC,6],
  288.   :EXPCANDYM=>[:PSYCHIC,6],
  289.   :TAMATOBERRY=>[:PSYCHIC,6],
  290.   :EXPCANDYS=>[:PSYCHIC,4],
  291.   :PAYAPABERRY=>[:PSYCHIC,4],
  292.   :EXPCANDYXS=>[:PSYCHIC,2],
  293.   :LAXINCENSE=>[:PSYCHIC,2],
  294.   :PUREINCENSE=>[:PSYCHIC,2],
  295.   :SITRUSBERRY=>[:PSYCHIC,2],
  296.  
  297.   :ROCKMEMORY=>[:ROCK,40],
  298.   :ROCKYHELMET=>[:ROCK,26],
  299.   :PROTECTOR=>[:ROCK,24],
  300.   :EVERSTONE=>[:ROCK,20],
  301.   :STARPIECE=>[:ROCK,20],
  302.   :HARDSTONE=>[:ROCK,14],
  303.   :OVALSTONE=>[:ROCK,12],
  304.   :SMOOTHROCK=>[:ROCK,12],
  305.   :LAGGINGTAIL=>[:ROCK,10],
  306.   :MICLEBERRY=>[:ROCK,10],
  307.   :FLOATSTONE=>[:ROCK,8],
  308.   :CHARTIBERRY=>[:ROCK,4],
  309.   :WIKIBERRY=>[:ROCK,4],
  310.   :ROCKINCENSE=>[:ROCK,2],
  311.  
  312.   :BOTTLECAP=>[:STEEL,40],
  313.   :GOLDBOTTLECAP=>[:STEEL,40],
  314.   :STEELMEMORY=>[:STEEL,40],
  315.   :KINGSROCK=>[:STEEL,32],
  316.   :METALCOAT=>[:STEEL,24],
  317.   :METRONOME=>[:STEEL,22],
  318.   :ASSAULTVEST=>[:STEEL,20],
  319.   :EJECTBUTTON=>[:STEEL,16],
  320.   :EJECTPACK=>[:STEEL,16],
  321.   :IRONBALL=>[:STEEL,16],
  322.   :METALPOWDER=>[:STEEL,14],
  323.   :SOOTHEBELL=>[:STEEL,14],
  324.   :BABIRIBERRY=>[:STEEL,4],
  325.   :RUSTEDSHIELD=>[:STEEL,2],
  326.   :RUSTEDSWORD=>[:STEEL,2],
  327.  
  328.   :WATERMEMORY=>[:WATER,40],
  329.   :PEARLSTRING=>[:WATER,30],
  330.   :PRISMSCALE=>[:WATER,26],
  331.   :SHELLBELL=>[:WATER,14],
  332.   :BIGPEARL=>[:WATER,12],
  333.   :DAMPROCK=>[:WATER,12],
  334.   :THROATSPRAY=>[:WATER,12],
  335.   :FOSSILIZEDFISH=>[:WATER,10],
  336.   :MYSTICWATER=>[:WATER,10],
  337.   :PEARL=>[:WATER,6],
  338.   :WATERSTONE=>[:WATER,6],
  339.   :PASSHOBERRY=>[:WATER,4],
  340.   :CHESTOBERRY=>[:WATER,2],
  341.   :SEAINCENSE=>[:WATER,2],
  342.   :WAVEINCENSE=>[:WATER,2],
  343.   :BLUAPRICORN=>[:WATER,0],
  344.   :BLUEAPRICORN=>[:WATER,0],
  345. }
  346.  
  347. CRAMOMATIC_TYPERECIPIES={
  348.   :BUG=>[:TR60,:TR18,:BRIGHTPOWDER,:WISHINGPIECE,:SILVERPOWDER,:BALMMUSHROOM,:TR61,:SHEDSHELL,:PEARLSTRING,:TR96,:COMETSHARD,:TR28,:RARECANDY,:BOTTLECAP,:PPUP],
  349.   :DARK=>[:TR37,:WIDELENS,:TR68,:WISHINGPIECE,:STARPIECE,:BALMMUSHROOM,:TR81,:SCOPELENS,:TR95,:TR58,:TR32,:TR93,:RARECANDY,:BOTTLECAP,:PPUP],
  350.   :DRAGON=>[:TR47,:DRAGONFANG,:BIGMUSHROOM,:WISHINGPIECE,:STARPIECE,:BALMMUSHROOM,:DRAGONSCALE,:LIFEORB,:TR62,:KINGSROCK,:TR51,:TR24,:RARECANDY,:BOTTLECAP,:PPUP],
  351.   :ELECTRIC=>[:ELECTRICSEED,:TR80,:CELLBATTERY,:WISHINGPIECE,:MAGNET,:TR86,:UPGRADE,:LIGHTBALL,:PEARLSTRING,:DUBIOUSDISC,:TR08,:TR09,:RARECANDY,:BOTTLECAP,:PPUP],
  352.   :FAIRY=>[:STARDUST,:MISTYSEED,:BIGMUSHROOM,:WISHINGPIECE,:SACHET,:ROOMSERVICE,:WHIPPEDDREAM,:DESTINYKNOT,
  353.     [:BERRYSWEET,:CLOVERSWEET,:FLOWERSWEET,:LOVESWEET,:STRAWBERRYSWEET],:TR92,
  354.     [:RIBBONSWEET,:STARSWEET,:STRAWBERRYSWEET],:TR90,:RARECANDY,:BOTTLECAP,:PPUP],
  355.   :FIGHTING=>[:TR07,:TR56,:MUSCLEBAND,:WISHINGPIECE,:TR48,:TR21,:MACHOBRACE,:TM00,:EXPERTBELT,:TR64,:TR39,:TR53,:RARECANDY,:BOTTLECAP,:PPUP],
  356.   :FIRE=>[:TR88,:FLAMEORB,:TR41,:WISHINGPIECE,:TR02,:BALMMUSHROOM,:TR36,:REDCARD,:TR15,:CHARCOAL,:TR55,:TR43,:RARECANDY,:BOTTLECAP,:PPUP],
  357.   :FLYING=>[:PRETTYFEATHER,:SHARPBEAK,:BIGMUSHROOM,:WISHINGPIECE,:AIRBALLOON,:BLUNDERPOLICY,:GRIPCLAW,:AIRBALLOONN,:WEAKNESSPOLICY,:TR89,:COMETSHARD,:TR66,:RARECANDY,:BOTTLECAP,:PPUP],
  358.   :GHOST=>[:ODDINCENSE,:ADRENALINEORB,:RINGTARGET,:WISHINGPIECE,:STARPIECE,:BALMMUSHROOM,:CLEANSETAG,:SPELLTAG,:CRACKEDPOT,:REAPERCLOTH,:COMETSHARD,:TR33,:RARECANDY,:BOTTLECAP,:PPUP],
  359.   :GRASS=>[:GRASSYSEED,:TR59,:WHITEHERB,:WISHINGPIECE,:TR77,:TR50,:TR65,:ABSORBBULB,:PEARLSTRING,:TR72,:COMETSHARD,:TR71,:RARECANDY,:BOTTLECAP,:PPUP],
  360.   :GROUND=>[:STARDUST,:TR23,:BIGMUSHROOM,:WISHINGPIECE,:LIGHTCLAY,:TR87,:TR67,:TERRAINEXTENDER,:PEARLSTRING,:TR94,:COMETSHARD,:TR10,:RARECANDY,:BOTTLECAP,:PPUP],
  361.   :ICE=>[:SNOWBALL,:ICYROCK,:NEVERMELTICE,:WISHINGPIECE,:STARPIECE,:BALMMUSHROOM,:RAZORCLAW,:SNOWBALL,:PEARLSTRING,:TR05,:COMETSHARD,:TR06,:RARECANDY,:BOTTLECAP,:PPUP],
  362.   :NORMAL=>[:TR85,:TR14,:TR26,:TR13,:TR27,:TR35,:TR01,:TR19,:TR29,:TR30,:TR20,:TR00,:TR42,:BOTTLECAP,:PPUP],
  363.   :POISON=>[:BLACKSLUDGE,:TOXICORB,:TR91,:WISHINGPIECE,:TR54,:SMOKEBALL,:TR57,:QUICKPOWDER,:POISONBARB,:TR22,:TR78,:TR73,:RARECANDY,:BOTTLECAP,:PPUP],
  364.   :PSYCHIC=>[:TR12,:TR34,:TR40,:TR82,:TR44,:TR83,:TR25,:TR69,:TR17,:TR38,:TR49,:TR97,:TR11,:BOTTLECAP,:PPUP],
  365.   :ROCK=>[:FLOATSTONE,:OVALSTONE,:HARDSTONE,:WISHINGPIECE,:EVERSTONE,:PROTECTOR,:ROCKYHELMET,:TR63,:WISHINGPIECE,:EVIOLITE,:TR76,:TR75,:RARECANDY,:BOTTLECAP,:PPUP],
  366.   :STEEL=>[:TR31,:TR46,:METALPOWDER,:WISHINGPIECE,:UTILITYUMBRELLA,:METALCOAT,:TR52,:ASSAULTVEST,:TR79,:AMULETCOIN,:TR70,:TR64,:RARECANDY,:BOTTLECAP,:PPUP],
  367.   :WATER=>[:SEAINCENSE,:TR04,:SHELLBELL,:WISHINGPIECE,:TR16,:TR98,:PRISMSCALE,:MYSTICWATER,:PEARLSTRING,:TR45,:TR84,:TR03,:RARECANDY,:BOTTLECAP,:PPUP],
  368. }
  369. CRAMOMATIC_RATIO=[20,30,40,50,60,70,80,90,100,110,120,130,140,150,-1]
  370.  
  371. def pbCramOMatic
  372.   if Kernel.pbConfirmMessage(_INTL("Combine Items?"))
  373.     Kernel.pbMessage(_INTL("Select the items to be combined.\\1"))
  374.     items=[]
  375.     4.times do
  376.       craft=0
  377.       pbFadeOutIn(99999){
  378.         scene = PokemonBag_Scene.new
  379.         screen = PokemonBagScreen.new(scene,$PokemonBag)
  380.         craft = screen.pbChooseItemScreen(Proc.new{|item| CRAMOMATIC_ITEMDATA.keys.include?(getConstantName(PBItems,item).to_sym) })
  381.       }
  382.       break if craft==0
  383.       items.push(craft)
  384.       $PokemonBag.pbDeleteItem(craft)
  385.     end
  386.     if items.length<4
  387.       items.each{|item| $PokemonBag.pbStoreItem(item)}
  388.       return
  389.     end
  390.     qty=1
  391.     if items.all?{|item| pbIsApricorn?(item)}
  392.       ratio=[247,247,247,247,10,1,1]
  393.       craft=items[rand(items.length)]
  394.       case craft
  395.       when getID(PBItems,:BLKAPRICORN),getID(PBItems,:BLACKAPRICORN)
  396.         table=[:POKEBALL,:GREATBALL,:DUSKBALL,:LUXURYBALL,:HEAVYBALL,:SAFARIBALL,:SPORTBALL]
  397.       when getID(PBItems,:BLUAPRICORN),getID(PBItems,:BLUEAPRICORN)
  398.         table=[:POKEBALL,:GREATBALL,:DIVEBALL,:NETBALL,:LUREBALL,:SAFARIBALL,:SPORTBALL]
  399.       when getID(PBItems,:GRNAPRICORN),getID(PBItems,:GREENAPRICORN)
  400.         table=[:POKEBALL,:GREATBALL,:ULTRABALL,:NESTBALL,:FRIENDBALL,:SAFARIBALL,:SPORTBALL]
  401.       when getID(PBItems,:PNKAPRICORN),getID(PBItems,:PINKAPRICORN)
  402.         table=[:POKEBALL,:GREATBALL,:ULTRABALL,:HEALBALL,:LOVEBALL,:SAFARIBALL,:SPORTBALL]
  403.       when getID(PBItems,:REDAPRICORN)
  404.         table=[:POKEBALL,:GREATBALL,:ULTRABALL,:REPEATBALL,:LEVELBALL,:SAFARIBALL,:SPORTBALL]
  405.       when getID(PBItems,:WHTAPRICORN),getID(PBItems,:WHITEAPRICORN)
  406.         table=[:POKEBALL,:GREATBALL,:PREMIERBALL,:TIMERBALL,:FASTBALL,:SAFARIBALL,:SPORTBALL]
  407.       when getID(PBItems,:YLWAPRICORN),getID(PBItems,:YELLOWAPRICORN)
  408.         table=[:POKEBALL,:GREATBALL,:ULTRABALL,:QUICKBALL,:MOONBALL,:SAFARIBALL,:SPORTBALL]
  409.       end
  410.       total=0
  411.       ratio.each{|r| total+=r}
  412.       num=rand(total)
  413.       cumtotal=0
  414.       for i in 0...table.length
  415.         cumtotal+=ratio[i]
  416.         if num<cumtotal
  417.           ball=i
  418.           break
  419.         end
  420.       end
  421.       item=getID(PBItems,table[ball])
  422.       qty=(rand(100)==0)? 5 : 1
  423.     elsif isConst?(items[0],PBItems,:TINYMUSHROOM) &&
  424.           isConst?(items[2],PBItems,:TINYMUSHROOM) &&
  425.           isConst?(items[3],PBItems,:TINYMUSHROOM)
  426.       item=getID(PBItems,:BIGMUSHROOM)
  427.     elsif isConst?(items[0],PBItems,:PEARL) &&
  428.           isConst?(items[2],PBItems,:PEARL) &&
  429.           isConst?(items[3],PBItems,:PEARL)
  430.       item=getID(PBItems,:BIGPEARL)
  431.     elsif isConst?(items[0],PBItems,:BIGPEARL) &&
  432.           isConst?(items[2],PBItems,:BIGPEARL) &&
  433.           isConst?(items[3],PBItems,:BIGPEARL)
  434.       item=getID(PBItems,:PEARLSTRING)
  435.     elsif isConst?(items[0],PBItems,:STARDUST) &&
  436.           isConst?(items[2],PBItems,:STARDUST) &&
  437.           isConst?(items[3],PBItems,:STARDUST)
  438.       item=getID(PBItems,:STARPIECE)
  439.     elsif isConst?(items[0],PBItems,:BIGMUSHROOM) &&
  440.           isConst?(items[2],PBItems,:BIGMUSHROOM) &&
  441.           isConst?(items[3],PBItems,:BIGMUSHROOM)
  442.       item=getID(PBItems,:BALMMUSHROOM)
  443.     elsif isConst?(items[0],PBItems,:NUGGET) &&
  444.           isConst?(items[2],PBItems,:NUGGET) &&
  445.           isConst?(items[3],PBItems,:NUGGET)
  446.       item=getID(PBItems,:BIGNUGGET)
  447.     elsif isConst?(items[0],PBItems,:RARECANDY) &&
  448.           isConst?(items[2],PBItems,:RARECANDY) &&
  449.           isConst?(items[3],PBItems,:RARECANDY)
  450.       item=getID(PBItems,:ABILITYCAPSULE)
  451.     elsif isConst?(items[0],PBItems,:BOTTLECAP) &&
  452.           isConst?(items[2],PBItems,:BOTTLECAP) &&
  453.           isConst?(items[3],PBItems,:BOTTLECAP)
  454.       item=getID(PBItems,:GOLDBOTTLECAP)
  455.     elsif isConst?(items[0],PBItems,:ARMORITEORE) &&
  456.           isConst?(items[2],PBItems,:ARMORITEORE) &&
  457.           isConst?(items[3],PBItems,:ARMORITEORE)
  458.       item=getID(PBItems,:PPUP)  
  459.     elsif isConst?(items[0],PBItems,:STARPIECE) &&
  460.           isConst?(items[2],PBItems,:STARPIECE) &&
  461.           isConst?(items[3],PBItems,:STARPIECE)
  462.       item=getID(PBItems,:COMETSHARD)
  463.     else
  464.       type=CRAMOMATIC_ITEMDATA[getConstantName(PBItems,items[0]).to_sym][0]
  465.       value=0
  466.       items.each{|item|
  467.         value+=CRAMOMATIC_ITEMDATA[getConstantName(PBItems,item).to_sym][1]
  468.       }
  469.       list=CRAMOMATIC_TYPERECIPIES[type]
  470.       index=0
  471.       CRAMOMATIC_RATIO.each_index{|i|
  472.         if CRAMOMATIC_RATIO[i]==-1 || value<=CRAMOMATIC_RATIO[i]
  473.           index=i
  474.           break
  475.         end
  476.       }
  477.       item=list[index]
  478.       if item.is_a?(Array)
  479.         item=item[rand(item.length)]
  480.       end
  481.       item=getID(PBItems,item)
  482.     end
  483.     item=getID(PBItems,:REPEL) if item<=0
  484.     Kernel.pbMessage(_INTL("Combination process complete!\n*BUZZ*\\1"))
  485.     Kernel.pbReceiveItem(item,qty)
  486.   end
  487. end
RAW Paste Data