ereinion icon

Bountyhunting

ereinion | PRO | 07/13/17 10:30:27 PM UTC | 0 ⭐ | 328 👁️ | Never ⏰ | []
JavaScript |

18.94 KB

|

None

|

0 👍

/

0 👎

import <CanAdv.ash>;
 
int get_price(item item_to_check, float acceptable_age) {
    return ((historical_age(item_to_check) <= acceptable_age)? historical_price(item_to_check) : mall_price(item_to_check));
}
 
boolean can_use_familiars() {
    switch (my_path()) {
        case "Avatar of Boris":
            if (item_amount($item[Clancy's lute]) > 0) {
                use(1, $item[Clancy's lute]);
            }
            equip($slot[weapon], $item[Trusty]);
            return false;
        case "Avatar of Sneaky Pete":
            return false;
        case "Avatar of Jarlsberg":
            return false;
        case "Zombie Slayer":
            return false;
        default:
            return true;
    }
}
 
void select_familiar_and_familiar_eq() {
    // If cheerleader steam is less than 100, the hound dog is just as good.
    // Better, since it has greater choice of familiar equipment without depleting steam.
    // Backup is BGF. Everyone has one of those, right?
    // Could implement greater choice of familiars (and familiar equipment), but why bother :P
    if (can_use_familiars()) {
        if (have_familiar($familiar[Steam-Powered Cheerleader]) && to_int(get_property("_cheerleaderSteam")) > 100) {
            use_familiar($familiar[Steam-Powered Cheerleader]);
            equip($slot[familiar], $item[school spirit socket set]);
        } else if (have_familiar($familiar[Jumpsuited Hound Dog])) {
            use_familiar($familiar[Jumpsuited Hound Dog]);
            if (item_amount($item[Mayflower bouquet]) >= 1 || have_equipped($item[Mayflower bouquet])) {
                equip($slot[familiar], $item[Mayflower bouquet]);
            } else {
                equip($slot[familiar], $item[ittah bittah hookah]);
            }
        } else {
            use_familiar($familiar[Baby Gravy Fairy]);
            equip($slot[familiar], $item[ittah bittah hookah]);
        }
    }
}
 
boolean use_map() {
    // Choose which item to get from the choiceadventure (1 = distention pill, 2 = dog hair pill)
    if (item_amount($item[distention pill]) <= item_amount($item[synthetic dog hair pill])) {
        set_property("choiceAdventure536", "1");
    } else {
        set_property("choiceAdventure536", "2");
    }
    // Use the map, return false on failed use
    if (use(1, $item[Map to Safety Shelter Grimace Prime])) {
        return true;
    } else {
        return false;
    }
}
 
void expanders() {
    // Use transponder (buy if necessary)
    if (have_effect($effect[transpondent]) < 1) {
        if (item_amount($item[transporter transponder]) < 1) {
            buy(1, $item[transporter transponder], 15000);
        }
        use(1, $item[transporter transponder]);
    }
    
    // Pick what familiar to use
    select_familiar_and_familiar_eq();
    
    // Maximize item drop
    maximize("item, -current, -tie, 0.01 mp regen, -familiar", false);
    
    // Adventure while being transpondent
    while(have_effect($effect[transpondent]) > 0 && my_adventures() > 0) {
        // Use maps, if you have them. Exit if use fails.
        if (item_amount($item[Map to Safety Shelter Grimace Prime]) > 0) {
            if (!use_map()) {
                print("Something went wrong!", "red");
                return;
            }
        // Adventure, if out of maps.
        } else {
            if (adventure(1, $location[domed city of grimacia])) {}
        }
    }
}
 
void reinstitute_goals(string[int] former_goals) {
    foreach i, g in former_goals {
        if (!g.contains_text("filthy lucre")) {
            cli_execute("conditions add " + g);
        }
    }
}
 
boolean non_effect_check(string cmd) {
    if (cmd.contains_text("Meatsmith")) {
        return (get_campground() contains $item[jar of psychoses (The Meatsmith)]);
    } else if (cmd.contains_text("Suspicious")) {
        return (get_campground() contains $item[jar of psychoses (The Suspicious-Looking Guy)]);
    } else if (cmd.contains_text("Agua de Vida")) {
        return true;
    }
    return false;
}
 
boolean get_effect(string how_to_get_effect, effect effect_to_get) {
    if (effect_to_get != $effect[none]) {
        if (have_effect(effect_to_get) > 0 || effect_to_get == $effect[Transpondent]) {
            return true;
        }
        cli_execute(how_to_get_effect);
        // Special cases :P
        if (effect_to_get == $effect[Consumed by Anger] && have_effect($effect[Consumed by Anger]) <= 0) {
            if (adv1($location[Anger Man's Level], 0, ""));
        }
        return to_boolean(have_effect(effect_to_get) > 0);
    } else {
        if (non_effect_check(how_to_get_effect)) {
            return true;
        }
        cli_execute(how_to_get_effect);
        return to_boolean(non_effect_check(how_to_get_effect));
    }
    return false;
}
 
boolean doSpecialBounty() {
    int[string] bountyCost;
    string bountyName;
    
    bountyCost["glittery skate key"] = get_price($item[tiny bottle of absinthe],0.5);
    bountyCost["greasy string"] = get_price($item[jar of psychoses (The Meatsmith)],0.5);
    bountyCost["grizzled stubble"] = get_price($item[transporter transponder],0.5);
    bountyCost["hardened lava glob"] = get_price($item[one-day ticket to That 70s Volcano],0.5);
    bountyCost["hickory daiquiri"] = get_price($item[devilish folio],0.5);
    bountyCost["pile of country guano"] = get_price($item[astral mushroom],0.5);
    bountyCost["pixellated ashes"] = get_price($item[jar of psychoses (The Crackpot Mystic)],0.5);
    bountyCost["pop art banana peel"] = get_price($item[llama lama gong],0.5);
    bountyCost["purple butt"] = get_price($item[empty Agua de Vida bottle],0.5);
    bountyCost["unlucky claw"] = get_price($item[jar of psychoses (The Suspicious-Looking Guy)],0.5);
    bountyCost["vivisected hair"] = get_price($item[one-day ticket to Conspiracy Island],0.5);
    bountyCost["wig powder"] = get_price($item[&quot;DRINK ME&quot; potion],0.5);
    // bountyCost[""] = get_price($item[],0.5);
    bountyName = to_string(get_property("_untakenSpecialBountyItem"));
    if (length(bountyName) != 0) {
        visit_url("bounty.php");
        bountyName = to_string(get_property("_untakenSpecialBountyItem"));
    }
    
    if (bountyCost contains bountyName) {
        if (bountyCost[bountyName] > to_int(get_property("autoBuyPriceLimit"))*2.5) {
            print("It is too expensive to buy " + bountyName + ", in order to access the area where the special bounty is located. Skipping special bounty.", "red");
            return false;
        } else {
            return true;
        }
    }
    print("The current list of special bounties does not contain " + bountyName + ". Aborting...", "red");
    return false;
}
 
int adventure_for_bounty(location whereToAdv) {
    string[int] former_goals;
    
    if (can_adv(whereToAdv, false)) {
        former_goals = get_goals();
        cli_execute("conditions clear");
        if (have_effect($effect[On the Trail]) > 0) {
            cli_execute("shrug on the trail");
        }
        add_item_condition(1, $item[filthy lucre]);
        adventure(my_adventures(), whereToAdv);
        reinstitute_goals(former_goals);
        return 1;
    } else {
        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)) {
            return -1;
        } else {
            return 0;
        }
    }
}
 
int get_bounty() {
    record specialBounty {
        effect needed_effect;
        string how_to_get_effect;
        location where_to_go;
        boolean burn_all_turns;
    };
    location[string] easyItem;
    location[string] hardItem;
    specialBounty[string] specialItem;
    string current_property; boolean b;
    string[int] former_goals;
    
    easyItem["bean-shaped rock"] = $location[The Beanbat Chamber];
    easyItem["bloodstained briquette"] = $location[The Outskirts of Cobb's Knob];
    easyItem["brightly-colored bottlecap"] = $location[The Overgrown Lot];
    easyItem["broken petri dish"] = $location[Cobb's Knob Laboratory];
    easyItem["broken plunger handle"] = $location[The Degrassi Knoll Restroom];
    easyItem["bundle of receipts"] = $location[Cobb's Knob Treasury];
    easyItem["callused fingerbone"] = $location[South of the Border];
    easyItem["cherry stem"] = $location[The Skeleton Store];
    easyItem["crumpled pink slip"] = $location[A Barroom Brawl];
    easyItem["drop of filthy ichor"] = $location[The Sleazy Back Alley];
    easyItem["empty greasepaint tube"] = $location[The "Fun" House];
    easyItem["half-empty bottle of eyedrops"] = $location[The Degrassi Knoll Gym];
    easyItem["handful of meatberries"] = $location[The Haunted Conservatory];
    easyItem["important bat file"] = $location[Guano Junction];
    easyItem["paper towel"] = $location[The Haunted Kitchen];
    easyItem["pink bat eye"] = $location[The Bat Hole Entrance];
    easyItem["triffid bark"] = $location[The Spooky Forest];
    easyItem["shredded can label"] = $location[The Haunted Pantry];
    easyItem["sugar button"] = $location[Madness Bakery];
    easyItem["suspicious mole"] = $location[Cobb's Knob Menagerie, Level 3];
    //easyItem[""] = $location[];
    
    hardItem["absence of moss"] = $location[The Oasis];
    hardItem["beard crumbs"] = $location[The Castle in the Clouds in the Sky (Basement)];
    hardItem["bit of wilted lettuce"] = $location[Inside the Palindome];
    hardItem["black eye"] = $location[The Black Forest];
    hardItem["burned-out arcanodiode"] = $location[The Penultimate Fantasy Airship];
    hardItem["dirty coal button"] = $location[Lair of the Ninja Snowmen];
    hardItem["discarded pacifier"] = $location[The Castle in the Clouds in the Sky (Top Floor)];
    hardItem["distintegrating cork"] = $location[The Haunted Wine Cellar];
    hardItem["dusty wing"] = $location[The Arid, Extra-Dry Desert];
    hardItem["filthy rag"] = $location[The Copperhead Club];
    hardItem["length of bent pipe"] = $location[The Smut Orc Logging Camp];
    hardItem["non-Euclidean hoof"] = $location[The Haunted Gallery];
    hardItem["rubber rib"] = $location[The Haunted Laboratory];
    hardItem["rusty tap handle"] = $location[The Haunted Bathroom];
    hardItem["spare abacus bead"] = $location[The Hidden Office Building];
    hardItem["sticky stardust"] = $location[The Hole in the Sky];
    hardItem["spent handwarmer"] = $location[The eXtreme Slope];
    hardItem["warrrrrt"] = $location[The Poop Deck];
    hardItem["worthless piece of yellow glass"] = $location[The Dungeons of Doom];
    //hardItem[""] = $location[];
    
    specialItem["empty rum bottle"].needed_effect = $effect[none];
    specialItem["empty rum bottle"].how_to_get_effect = "use one-day ticket to Dinseylandfill";
    specialItem["empty rum bottle"].where_to_go = $location[Pirates of the Garbage Barges];
    specialItem["empty rum bottle"].burn_all_turns = false;
    specialItem["glittery skate key"].needed_effect = $effect[Absinthe-Minded];
    specialItem["glittery skate key"].how_to_get_effect = "use tiny bottle of absinthe";
    specialItem["glittery skate key"].where_to_go = $location[The Stately Pleasure Dome];
    specialItem["glittery skate key"].burn_all_turns = false;
    specialItem["greasy string"].needed_effect = $effect[none];
    specialItem["greasy string"].how_to_get_effect = "buy jar of psychoses (The Meatsmith);use jar of psychoses (The Meatsmith);";
    specialItem["greasy string"].where_to_go = $location[The Nightmare Meatrealm];
    specialItem["greasy string"].burn_all_turns = true;
    specialItem["grizzled stubble"].needed_effect = $effect[Transpondent];
    specialItem["grizzled stubble"].how_to_get_effect = "use transporter transponder";
    specialItem["grizzled stubble"].where_to_go = $location[Domed City of Grimacia];
    specialItem["grizzled stubble"].burn_all_turns = true;
    specialItem["hardened lava glob"].needed_effect = $effect[none];
    specialItem["hardened lava glob"].how_to_get_effect = "use one-day ticket to That 70s Volcano";
    specialItem["hardened lava glob"].where_to_go = $location[LavaCo&trade; Lamp Factory];
    specialItem["hardened lava glob"].burn_all_turns = false;
    specialItem["hickory daiquiri"].needed_effect = $effect[Dis Abled];
    specialItem["hickory daiquiri"].how_to_get_effect = "use devilish folio";
    specialItem["hickory daiquiri"].where_to_go = $location[The Clumsiness Grove];
    specialItem["hickory daiquiri"].burn_all_turns = false;
    specialItem["pile of country guano"].needed_effect = $effect[Half-Astral];
    specialItem["pile of country guano"].how_to_get_effect = "use astral mushroom";
    specialItem["pile of country guano"].where_to_go = $location[An Incredibly Strange Place (Bad Trip)];
    specialItem["pile of country guano"].burn_all_turns = true;
    specialItem["pixellated ashes"].needed_effect = $effect[Consumed by Anger];
    specialItem["pixellated ashes"].how_to_get_effect = "buy jar of psychoses (The Crackpot Mystic);use jar of psychoses (The Crackpot Mystic)";
    specialItem["pixellated ashes"].where_to_go = $location[Anger Man's Level];
    specialItem["pixellated ashes"].burn_all_turns = false;
    specialItem["pop art banana peel"].needed_effect = $effect[Shape of...Mole!];
    specialItem["pop art banana peel"].how_to_get_effect = "gong mole";
    specialItem["pop art banana peel"].where_to_go = $location[Mt. Molehill];
    specialItem["pop art banana peel"].burn_all_turns = true;
    specialItem["purple butt"].needed_effect = $effect[none];
    specialItem["purple butt"].how_to_get_effect = "use empty Agua de Vida bottle";
    specialItem["purple butt"].where_to_go = $location[The Jungles of Ancient Loathing];
    specialItem["purple butt"].burn_all_turns = false;
    specialItem["unlucky claw"].needed_effect = $effect[none];
    specialItem["unlucky claw"].how_to_get_effect = "buy jar of psychoses (The Suspicious-Looking Guy);use jar of psychoses (The Suspicious-Looking Guy)";
    specialItem["unlucky claw"].where_to_go = $location[Chinatown Shops];
    specialItem["unlucky claw"].burn_all_turns = false;
    specialItem["vivisected hair"].needed_effect = $effect[none];
    specialItem["vivisected hair"].how_to_get_effect = "use one-day ticket to Conspiracy Island";
    specialItem["vivisected hair"].where_to_go = $location[The Secret Government Laboratory];
    specialItem["vivisected hair"].burn_all_turns = false;
    specialItem["wig powder"].needed_effect = $effect[Down the Rabbit Hole];
    specialItem["wig powder"].how_to_get_effect = "use " + to_string($item[&quot;DRINK ME&quot; potion]);
    specialItem["wig powder"].where_to_go = $location[The Red Queen's Garden];
    specialItem["wig powder"].burn_all_turns = false;
    /*specialItem[""].needed_effect = $effect[];
    specialItem[""].how_to_get_effect = "";
    specialItem[""].where_to_go = $location[];
    specialItem[""].burn_all_turns = false;*/
    
    cli_execute("bounty easy");
    if (get_property("currentEasyBountyItem") != "") {
        maximize("item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
        current_property = substring(get_property("currentEasyBountyItem"),0,last_index_of(get_property("currentEasyBountyItem"),":"));
        if (easyItem contains current_property) {
            return adventure_for_bounty(easyItem[current_property]);
        } else {
            print("Mismatch of easy properties", "red");
            return -1;
        }
    }
    cli_execute("bounty hard");
    if (get_property("currentHardBountyItem") != "") {
        current_property = substring(get_property("currentHardBountyItem"),0,last_index_of(get_property("currentHardBountyItem"),":"));
        print(current_property);
        if (current_property == "warrrrrt") {
            maximize("item, -current, -tie, equip ittah bittah hookah, equip pirate fledges, switch Jumpsuited Hound Dog", false);
        } else if (current_property == "dirty coal button") {
            maximize("-combat, 0.8 item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
        } else {
            maximize("item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
        }
        if (hardItem contains current_property) {
            return adventure_for_bounty(hardItem[current_property]);
        } else {
            print("Mismatch of hard properties", "red");
            return -1;
        }
    } 
    if (doSpecialBounty()) {
        cli_execute("bounty special");
        if (get_property("currentSpecialBountyItem") != "") {
            current_property = substring(get_property("currentSpecialBountyItem"),0,last_index_of(get_property("currentSpecialBountyItem"),":"));
            if (specialItem contains current_property) {
                former_goals = get_goals();
                cli_execute("conditions clear");
                cli_execute("shrug on the trail");
                add_item_condition(1, $item[filthy lucre]);
                while (is_goal($item[filthy lucre]) && get_effect(specialItem[current_property].how_to_get_effect, specialItem[current_property].needed_effect)) {
                    if (specialItem[current_property].where_to_go == $location[The Clumsiness Grove]) {
                        if (adventure(1, specialItem[current_property].where_to_go)) {}
                        visit_url("bounty.php");
                    } else if (specialItem[current_property].where_to_go == $location[Domed City of Grimacia]) {
                        expanders();
                    } else if (specialItem[current_property].where_to_go == $location[The Nightmare Meatrealm]) {
                        maximize("meat, -current, -tie, equip ittah bittah hookah, switch leprechaun", false);
                        cli_execute("mood meat-realm");
                        adventure(my_adventures(), specialItem[current_property].where_to_go);
                        maximize("item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
                        cli_execute("mood bounty");
                    } else if (specialItem[current_property].where_to_go == $location[Anger Man's Level]) {
                        maximize("prismatic damage, moxie, 0.1 mp, 0.01 item, -melee, -tie, -current, equip hookah, switch Jumpsuited Hound Dog", false);
                        adventure(have_effect(specialItem[current_property].needed_effect), specialItem[current_property].where_to_go);
                        cli_execute("shrug " + to_string(specialItem[current_property].needed_effect));
                        maximize("item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
                    } else if (specialItem[current_property].needed_effect == $effect[none]) {
                        adventure(my_adventures(), specialItem[current_property].where_to_go);
                    } else {
                        print(to_string(specialItem[current_property].where_to_go));
                        if (adventure(have_effect(specialItem[current_property].needed_effect), specialItem[current_property].where_to_go)) {}
                    }
                }
                reinstitute_goals(former_goals);
            } else {
                print("Mismatch of special properties", "red");
                reinstitute_goals(former_goals);
                return -1;
            }
            if (specialItem[current_property].burn_all_turns) {
                if (specialItem[current_property].needed_effect == $effect[none]) {
                    if (specialItem[current_property].where_to_go == $location[The Nightmare Meatrealm]) {
                        maximize("meat, -current, -tie, equip ittah bittah hookah, switch leprechaun", false);
                        cli_execute("mood meat-realm");
                        while (adventure(1, specialItem[current_property].where_to_go)) {}
                        maximize("item, -current, -tie, equip ittah bittah hookah, switch Jumpsuited Hound Dog", false);
                        cli_execute("mood bounty");
                    } else {
                        return -1;
                    }
                } else if (have_effect(specialItem[current_property].needed_effect) > 0) {
                    if (adventure(have_effect(specialItem[current_property].needed_effect), specialItem[current_property].where_to_go)) {}
                }
            }
            if (is_goal($item[filthy lucre])) {
                print("Failed to get special bounty", "red");
                cli_execute("conditions_clear");
                return -1;
            } else {
                return 1;
            }
        }
    } else {
        print("Skipping special bounty because of cost.", "red");
    }
    return 0;
}
 
boolean bounty_hunting() {
    if(my_inebriety() <= inebriety_limit()) {
        string s; int i;
        s = visit_url("bounty.php");
        while (my_adventures() > 0) {
            i = get_bounty();
            if (i == 0) {
                return true;
            } else if (i == -1) {
                return false;
            }
        }
    }
    return false;
}
 
void main() {
    if (bounty_hunting()) {}
}

Comments