Advertisement
ereinion

Bountyhunting

Jul 13th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import <CanAdv.ash>;
  2.  
  3. int get_price(item item_to_check, float acceptable_age) {
  4.     return ((historical_age(item_to_check) <= acceptable_age)? historical_price(item_to_check) : mall_price(item_to_check));
  5. }
  6.  
  7. boolean can_use_familiars() {
  8.     switch (my_path()) {
  9.         case "Avatar of Boris":
  10.             if (item_amount($item[Clancy's lute]) > 0) {
  11.                 use(1, $item[Clancy's lute]);
  12.             }
  13.             equip($slot[weapon], $item[Trusty]);
  14.             return false;
  15.         case "Avatar of Sneaky Pete":
  16.             return false;
  17.         case "Avatar of Jarlsberg":
  18.             return false;
  19.         case "Zombie Slayer":
  20.             return false;
  21.         default:
  22.             return true;
  23.     }
  24. }
  25.  
  26. void select_familiar_and_familiar_eq() {
  27.     // If cheerleader steam is less than 100, the hound dog is just as good.
  28.     // Better, since it has greater choice of familiar equipment without depleting steam.
  29.     // Backup is BGF. Everyone has one of those, right?
  30.     // Could implement greater choice of familiars (and familiar equipment), but why bother :P
  31.     if (can_use_familiars()) {
  32.         if (have_familiar($familiar[Steam-Powered Cheerleader]) && to_int(get_property("_cheerleaderSteam")) > 100) {
  33.             use_familiar($familiar[Steam-Powered Cheerleader]);
  34.             equip($slot[familiar], $item[school spirit socket set]);
  35.         } else if (have_familiar($familiar[Jumpsuited Hound Dog])) {
  36.             use_familiar($familiar[Jumpsuited Hound Dog]);
  37.             if (item_amount($item[Mayflower bouquet]) >= 1 || have_equipped($item[Mayflower bouquet])) {
  38.                 equip($slot[familiar], $item[Mayflower bouquet]);
  39.             } else {
  40.                 equip($slot[familiar], $item[ittah bittah hookah]);
  41.             }
  42.         } else {
  43.             use_familiar($familiar[Baby Gravy Fairy]);
  44.             equip($slot[familiar], $item[ittah bittah hookah]);
  45.         }
  46.     }
  47. }
  48.  
  49. boolean use_map() {
  50.     // Choose which item to get from the choiceadventure (1 = distention pill, 2 = dog hair pill)
  51.     if (item_amount($item[distention pill]) <= item_amount($item[synthetic dog hair pill])) {
  52.         set_property("choiceAdventure536", "1");
  53.     } else {
  54.         set_property("choiceAdventure536", "2");
  55.     }
  56.     // Use the map, return false on failed use
  57.     if (use(1, $item[Map to Safety Shelter Grimace Prime])) {
  58.         return true;
  59.     } else {
  60.         return false;
  61.     }
  62. }
  63.  
  64. void expanders() {
  65.     // Use transponder (buy if necessary)
  66.     if (have_effect($effect[transpondent]) < 1) {
  67.         if (item_amount($item[transporter transponder]) < 1) {
  68.             buy(1, $item[transporter transponder], 15000);
  69.         }
  70.         use(1, $item[transporter transponder]);
  71.     }
  72.    
  73.     // Pick what familiar to use
  74.     select_familiar_and_familiar_eq();
  75.    
  76.     // Maximize item drop
  77.     maximize("item, -current, -tie, 0.01 mp regen, -familiar", false);
  78.    
  79.     // Adventure while being transpondent
  80.     while(have_effect($effect[transpondent]) > 0 && my_adventures() > 0) {
  81.         // Use maps, if you have them. Exit if use fails.
  82.         if (item_amount($item[Map to Safety Shelter Grimace Prime]) > 0) {
  83.             if (!use_map()) {
  84.                 print("Something went wrong!", "red");
  85.                 return;
  86.             }
  87.         // Adventure, if out of maps.
  88.         } else {
  89.             if (adventure(1, $location[domed city of grimacia])) {}
  90.         }
  91.     }
  92. }
  93.  
  94. void reinstitute_goals(string[int] former_goals) {
  95.     foreach i, g in former_goals {
  96.         if (!g.contains_text("filthy lucre")) {
  97.             cli_execute("conditions add " + g);
  98.         }
  99.     }
  100. }
  101.  
  102. boolean non_effect_check(string cmd) {
  103.     if (cmd.contains_text("Meatsmith")) {
  104.         return (get_campground() contains $item[jar of psychoses (The Meatsmith)]);
  105.     } else if (cmd.contains_text("Suspicious")) {
  106.         return (get_campground() contains $item[jar of psychoses (The Suspicious-Looking Guy)]);
  107.     } else if (cmd.contains_text("Agua de Vida")) {
  108.         return true;
  109.     }
  110.     return false;
  111. }
  112.  
  113. boolean get_effect(string how_to_get_effect, effect effect_to_get) {
  114.     if (effect_to_get != $effect[none]) {
  115.         if (have_effect(effect_to_get) > 0 || effect_to_get == $effect[Transpondent]) {
  116.             return true;
  117.         }
  118.         cli_execute(how_to_get_effect);
  119.         // Special cases :P
  120.         if (effect_to_get == $effect[Consumed by Anger] && have_effect($effect[Consumed by Anger]) <= 0) {
  121.             if (adv1($location[Anger Man's Level], 0, ""));
  122.         }
  123.         return to_boolean(have_effect(effect_to_get) > 0);
  124.     } else {
  125.         if (non_effect_check(how_to_get_effect)) {
  126.             return true;
  127.         }
  128.         cli_execute(how_to_get_effect);
  129.         return to_boolean(non_effect_check(how_to_get_effect));
  130.     }
  131.     return false;
  132. }
  133.  
  134. boolean doSpecialBounty() {
  135.     int[string] bountyCost;
  136.     string bountyName;
  137.    
  138.     bountyCost["glittery skate key"] = get_price($item[tiny bottle of absinthe],0.5);
  139.     bountyCost["greasy string"] = get_price($item[jar of psychoses (The Meatsmith)],0.5);
  140.     bountyCost["grizzled stubble"] = get_price($item[transporter transponder],0.5);
  141.     bountyCost["hardened lava glob"] = get_price($item[one-day ticket to That 70s Volcano],0.5);
  142.     bountyCost["hickory daiquiri"] = get_price($item[devilish folio],0.5);
  143.     bountyCost["pile of country guano"] = get_price($item[astral mushroom],0.5);
  144.     bountyCost["pixellated ashes"] = get_price($item[jar of psychoses (The Crackpot Mystic)],0.5);
  145.     bountyCost["pop art banana peel"] = get_price($item[llama lama gong],0.5);
  146.     bountyCost["purple butt"] = get_price($item[empty Agua de Vida bottle],0.5);
  147.     bountyCost["unlucky claw"] = get_price($item[jar of psychoses (The Suspicious-Looking Guy)],0.5);
  148.     bountyCost["vivisected hair"] = get_price($item[one-day ticket to Conspiracy Island],0.5);
  149.     bountyCost["wig powder"] = get_price($item[&quot;DRINK ME&quot; potion],0.5);
  150.     // bountyCost[""] = get_price($item[],0.5);
  151.     bountyName = to_string(get_property("_untakenSpecialBountyItem"));
  152.     if (length(bountyName) != 0) {
  153.         visit_url("bounty.php");
  154.         bountyName = to_string(get_property("_untakenSpecialBountyItem"));
  155.     }
  156.    
  157.     if (bountyCost contains bountyName) {
  158.         if (bountyCost[bountyName] > to_int(get_property("autoBuyPriceLimit"))*2.5) {
  159.             print("It is too expensive to buy " + bountyName + ", in order to access the area where the special bounty is located. Skipping special bounty.", "red");
  160.             return false;
  161.         } else {
  162.             return true;
  163.         }
  164.     }
  165.     print("The current list of special bounties does not contain " + bountyName + ". Aborting...", "red");
  166.     return false;
  167. }
  168.  
  169. int adventure_for_bounty(location whereToAdv) {
  170.     string[int] former_goals;
  171.    
  172.     if (can_adv(whereToAdv, false)) {
  173.         former_goals = get_goals();
  174.         cli_execute("conditions clear");
  175.         if (have_effect($effect[On the Trail]) > 0) {
  176.             cli_execute("shrug on the trail");
  177.         }
  178.         add_item_condition(1, $item[filthy lucre]);
  179.         adventure(my_adventures(), whereToAdv);
  180.         reinstitute_goals(former_goals);
  181.         return 1;
  182.     } else {
  183.         if (user_confirm("Can't adventure in " + whereToAdv + ". Fix this and run the script again. Do you want to abort now, and attempt to get the other bounties later?",30000,false)) {
  184.             return -1;
  185.         } else {
  186.             return 0;
  187.         }
  188.     }
  189. }
  190.  
  191. int get_bounty() {
  192.     record specialBounty {
  193.         effect needed_effect;
  194.         string how_to_get_effect;
  195.         location where_to_go;
  196.         boolean burn_all_turns;
  197.     };
  198.     location[string] easyItem;
  199.     location[string] hardItem;
  200.     specialBounty[string] specialItem;
  201.     string current_property; boolean b;
  202.     string[int] former_goals;
  203.    
  204.     easyItem["bean-shaped rock"] = $location[The Beanbat Chamber];
  205.     easyItem["bloodstained briquette"] = $location[The Outskirts of Cobb's Knob];
  206.     easyItem["brightly-colored bottlecap"] = $location[The Overgrown Lot];
  207.     easyItem["broken petri dish"] = $location[Cobb's Knob Laboratory];
  208.     easyItem["broken plunger handle"] = $location[The Degrassi Knoll Restroom];
  209.     easyItem["bundle of receipts"] = $location[Cobb's Knob Treasury];
  210.     easyItem["callused fingerbone"] = $location[South of the Border];
  211.     easyItem["cherry stem"] = $location[The Skeleton Store];
  212.     easyItem["crumpled pink slip"] = $location[A Barroom Brawl];
  213.     easyItem["drop of filthy ichor"] = $location[The Sleazy Back Alley];
  214.     easyItem["empty greasepaint tube"] = $location[The "Fun" House];
  215.     easyItem["half-empty bottle of eyedrops"] = $location[The Degrassi Knoll Gym];
  216.     easyItem["handful of meatberries"] = $location[The Haunted Conservatory];
  217.     easyItem["important bat file"] = $location[Guano Junction];
  218.     easyItem["paper towel"] = $location[The Haunted Kitchen];
  219.     easyItem["pink bat eye"] = $location[The Bat Hole Entrance];
  220.     easyItem["triffid bark"] = $location[The Spooky Forest];
  221.     easyItem["shredded can label"] = $location[The Haunted Pantry];
  222.     easyItem["sugar button"] = $location[Madness Bakery];
  223.     easyItem["suspicious mole"] = $location[Cobb's Knob Menagerie, Level 3];
  224.     //easyItem[""] = $location[];
  225.    
  226.     hardItem["absence of moss"] = $location[The Oasis];
  227.     hardItem["beard crumbs"] = $location[The Castle in the Clouds in the Sky (Basement)];
  228.     hardItem["bit of wilted lettuce"] = $location[Inside the Palindome];
  229.     hardItem["black eye"] = $location[The Black Forest];
  230.     hardItem["burned-out arcanodiode"] = $location[The Penultimate Fantasy Airship];
  231.     hardItem["dirty coal button"] = $location[Lair of the Ninja Snowmen];
  232.     hardItem["discarded pacifier"] = $location[The Castle in the Clouds in the Sky (Top Floor)];
  233.     hardItem["distintegrating cork"] = $location[The Haunted Wine Cellar];
  234.     hardItem["dusty wing"] = $location[The Arid, Extra-Dry Desert];
  235.     hardItem["filthy rag"] = $location[The Copperhead Club];
  236.     hardItem["length of bent pipe"] = $location[The Smut Orc Logging Camp];
  237.     hardItem["non-Euclidean hoof"] = $location[The Haunted Gallery];
  238.     hardItem["rubber rib"] = $location[The Haunted Laboratory];
  239.     hardItem["rusty tap handle"] = $location[The Haunted Bathroom];
  240.     hardItem["spare abacus bead"] = $location[The Hidden Office Building];
  241.     hardItem["sticky stardust"] = $location[The Hole in the Sky];
  242.     hardItem["spent handwarmer"] = $location[The eXtreme Slope];
  243.     hardItem["warrrrrt"] = $location[The Poop Deck];
  244.     hardItem["worthless piece of yellow glass"] = $location[The Dungeons of Doom];
  245.     //hardItem[""] = $location[];
  246.    
  247.     specialItem["empty rum bottle"].needed_effect = $effect[none];
  248.     specialItem["empty rum bottle"].how_to_get_effect = "use one-day ticket to Dinseylandfill";
  249.     specialItem["empty rum bottle"].where_to_go = $location[Pirates of the Garbage Barges];
  250.     specialItem["empty rum bottle"].burn_all_turns = false;
  251.     specialItem["glittery skate key"].needed_effect = $effect[Absinthe-Minded];
  252.     specialItem["glittery skate key"].how_to_get_effect = "use tiny bottle of absinthe";
  253.     specialItem["glittery skate key"].where_to_go = $location[The Stately Pleasure Dome];
  254.     specialItem["glittery skate key"].burn_all_turns = false;
  255.     specialItem["greasy string"].needed_effect = $effect[none];
  256.     specialItem["greasy string"].how_to_get_effect = "buy jar of psychoses (The Meatsmith);use jar of psychoses (The Meatsmith);";
  257.     specialItem["greasy string"].where_to_go = $location[The Nightmare Meatrealm];
  258.     specialItem["greasy string"].burn_all_turns = true;
  259.     specialItem["grizzled stubble"].needed_effect = $effect[Transpondent];
  260.     specialItem["grizzled stubble"].how_to_get_effect = "use transporter transponder";
  261.     specialItem["grizzled stubble"].where_to_go = $location[Domed City of Grimacia];
  262.     specialItem["grizzled stubble"].burn_all_turns = true;
  263.     specialItem["hardened lava glob"].needed_effect = $effect[none];
  264.     specialItem["hardened lava glob"].how_to_get_effect = "use one-day ticket to That 70s Volcano";
  265.     specialItem["hardened lava glob"].where_to_go = $location[LavaCo&trade; Lamp Factory];
  266.     specialItem["hardened lava glob"].burn_all_turns = false;
  267.     specialItem["hickory daiquiri"].needed_effect = $effect[Dis Abled];
  268.     specialItem["hickory daiquiri"].how_to_get_effect = "use devilish folio";
  269.     specialItem["hickory daiquiri"].where_to_go = $location[The Clumsiness Grove];
  270.     specialItem["hickory daiquiri"].burn_all_turns = false;
  271.     specialItem["pile of country guano"].needed_effect = $effect[Half-Astral];
  272.     specialItem["pile of country guano"].how_to_get_effect = "use astral mushroom";
  273.     specialItem["pile of country guano"].where_to_go = $location[An Incredibly Strange Place (Bad Trip)];
  274.     specialItem["pile of country guano"].burn_all_turns = true;
  275.     specialItem["pixellated ashes"].needed_effect = $effect[Consumed by Anger];
  276.     specialItem["pixellated ashes"].how_to_get_effect = "buy jar of psychoses (The Crackpot Mystic);use jar of psychoses (The Crackpot Mystic)";
  277.     specialItem["pixellated ashes"].where_to_go = $location[Anger Man's Level];
  278.     specialItem["pixellated ashes"].burn_all_turns = false;
  279.     specialItem["pop art banana peel"].needed_effect = $effect[Shape of...Mole!];
  280.     specialItem["pop art banana peel"].how_to_get_effect = "gong mole";
  281.     specialItem["pop art banana peel"].where_to_go = $location[Mt. Molehill];
  282.     specialItem["pop art banana peel"].burn_all_turns = true;
  283.     specialItem["purple butt"].needed_effect = $effect[none];
  284.     specialItem["purple butt"].how_to_get_effect = "use empty Agua de Vida bottle";
  285.     specialItem["purple butt"].where_to_go = $location[The Jungles of Ancient Loathing];
  286.     specialItem["purple butt"].burn_all_turns = false;
  287.     specialItem["unlucky claw"].needed_effect = $effect[none];
  288.     specialItem["unlucky claw"].how_to_get_effect = "buy jar of psychoses (The Suspicious-Looking Guy);use jar of psychoses (The Suspicious-Looking Guy)";
  289.     specialItem["unlucky claw"].where_to_go = $location[Chinatown Shops];
  290.     specialItem["unlucky claw"].burn_all_turns = false;
  291.     specialItem["vivisected hair"].needed_effect = $effect[none];
  292.     specialItem["vivisected hair"].how_to_get_effect = "use one-day ticket to Conspiracy Island";
  293.     specialItem["vivisected hair"].where_to_go = $location[The Secret Government Laboratory];
  294.     specialItem["vivisected hair"].burn_all_turns = false;
  295.     specialItem["wig powder"].needed_effect = $effect[Down the Rabbit Hole];
  296.     specialItem["wig powder"].how_to_get_effect = "use " + to_string($item[&quot;DRINK ME&quot; potion]);
  297.     specialItem["wig powder"].where_to_go = $location[The Red Queen's Garden];
  298.     specialItem["wig powder"].burn_all_turns = false;
  299.     /*specialItem[""].needed_effect = $effect[];
  300.     specialItem[""].how_to_get_effect = "";
  301.     specialItem[""].where_to_go = $location[];
  302.     specialItem[""].burn_all_turns = false;*/
  303.    
  304.     cli_execute("bounty easy");
  305.     if (get_property("currentEasyBountyItem") != "") {
  306.         maximize("item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
  307.         current_property = substring(get_property("currentEasyBountyItem"),0,last_index_of(get_property("currentEasyBountyItem"),":"));
  308.         if (easyItem contains current_property) {
  309.             return adventure_for_bounty(easyItem[current_property]);
  310.         } else {
  311.             print("Mismatch of easy properties", "red");
  312.             return -1;
  313.         }
  314.     }
  315.     cli_execute("bounty hard");
  316.     if (get_property("currentHardBountyItem") != "") {
  317.         current_property = substring(get_property("currentHardBountyItem"),0,last_index_of(get_property("currentHardBountyItem"),":"));
  318.         print(current_property);
  319.         if (current_property == "warrrrrt") {
  320.             maximize("item, -current, -tie, equip ittah bittah hookah, equip pirate fledges, switch Jumpsuited Hound Dog", false);
  321.         } else if (current_property == "dirty coal button") {
  322.             maximize("-combat, 0.8 item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
  323.         } else {
  324.             maximize("item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
  325.         }
  326.         if (hardItem contains current_property) {
  327.             return adventure_for_bounty(hardItem[current_property]);
  328.         } else {
  329.             print("Mismatch of hard properties", "red");
  330.             return -1;
  331.         }
  332.     }
  333.     if (doSpecialBounty()) {
  334.         cli_execute("bounty special");
  335.         if (get_property("currentSpecialBountyItem") != "") {
  336.             current_property = substring(get_property("currentSpecialBountyItem"),0,last_index_of(get_property("currentSpecialBountyItem"),":"));
  337.             if (specialItem contains current_property) {
  338.                 former_goals = get_goals();
  339.                 cli_execute("conditions clear");
  340.                 cli_execute("shrug on the trail");
  341.                 add_item_condition(1, $item[filthy lucre]);
  342.                 while (is_goal($item[filthy lucre]) && get_effect(specialItem[current_property].how_to_get_effect, specialItem[current_property].needed_effect)) {
  343.                     if (specialItem[current_property].where_to_go == $location[The Clumsiness Grove]) {
  344.                         if (adventure(1, specialItem[current_property].where_to_go)) {}
  345.                         visit_url("bounty.php");
  346.                     } else if (specialItem[current_property].where_to_go == $location[Domed City of Grimacia]) {
  347.                         expanders();
  348.                     } else if (specialItem[current_property].where_to_go == $location[The Nightmare Meatrealm]) {
  349.                         maximize("meat, -current, -tie, equip ittah bittah hookah, switch leprechaun", false);
  350.                         cli_execute("mood meat-realm");
  351.                         adventure(my_adventures(), specialItem[current_property].where_to_go);
  352.                         maximize("item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
  353.                         cli_execute("mood bounty");
  354.                     } else if (specialItem[current_property].where_to_go == $location[Anger Man's Level]) {
  355.                         maximize("prismatic damage, moxie, 0.1 mp, 0.01 item, -melee, -tie, -current, equip hookah, switch Jumpsuited Hound Dog", false);
  356.                         adventure(have_effect(specialItem[current_property].needed_effect), specialItem[current_property].where_to_go);
  357.                         cli_execute("shrug " + to_string(specialItem[current_property].needed_effect));
  358.                         maximize("item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
  359.                     } else if (specialItem[current_property].needed_effect == $effect[none]) {
  360.                         adventure(my_adventures(), specialItem[current_property].where_to_go);
  361.                     } else {
  362.                         print(to_string(specialItem[current_property].where_to_go));
  363.                         if (adventure(have_effect(specialItem[current_property].needed_effect), specialItem[current_property].where_to_go)) {}
  364.                     }
  365.                 }
  366.                 reinstitute_goals(former_goals);
  367.             } else {
  368.                 print("Mismatch of special properties", "red");
  369.                 reinstitute_goals(former_goals);
  370.                 return -1;
  371.             }
  372.             if (specialItem[current_property].burn_all_turns) {
  373.                 if (specialItem[current_property].needed_effect == $effect[none]) {
  374.                     if (specialItem[current_property].where_to_go == $location[The Nightmare Meatrealm]) {
  375.                         maximize("meat, -current, -tie, equip ittah bittah hookah, switch leprechaun", false);
  376.                         cli_execute("mood meat-realm");
  377.                         while (adventure(1, specialItem[current_property].where_to_go)) {}
  378.                         maximize("item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
  379.                         cli_execute("mood bounty");
  380.                     } else {
  381.                         return -1;
  382.                     }
  383.                 } else if (have_effect(specialItem[current_property].needed_effect) > 0) {
  384.                     if (adventure(have_effect(specialItem[current_property].needed_effect), specialItem[current_property].where_to_go)) {}
  385.                 }
  386.             }
  387.             if (is_goal($item[filthy lucre])) {
  388.                 print("Failed to get special bounty", "red");
  389.                 cli_execute("conditions_clear");
  390.                 return -1;
  391.             } else {
  392.                 return 1;
  393.             }
  394.         }
  395.     } else {
  396.         print("Skipping special bounty because of cost.", "red");
  397.     }
  398.     return 0;
  399. }
  400.  
  401. boolean bounty_hunting() {
  402.     if(my_inebriety() <= inebriety_limit()) {
  403.         string s; int i;
  404.         s = visit_url("bounty.php");
  405.         while (my_adventures() > 0) {
  406.             i = get_bounty();
  407.             if (i == 0) {
  408.                 return true;
  409.             } else if (i == -1) {
  410.                 return false;
  411.             }
  412.         }
  413.     }
  414.     return false;
  415. }
  416.  
  417. void main() {
  418.     if (bounty_hunting()) {}
  419. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement