Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import <clanhop.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));
- }
- int clanLeaderID() {
- buffer clanInfo;
- matcher m;
- int leaderID;
- leaderID = -1;
- clanInfo = visit_url("showclan.php?recruiter=1&whichclan=" + get_clan_id());
- m = create_matcher("Leader:</td><td valign=top><b><a href=\"showplayer\\.php\\?who=(\\d+?)\">", clanInfo);
- if (find(m)) {
- leaderID = to_int(group(m,1));
- }
- return leaderID;
- }
- float average_price(int first_item_id, int last_item_id) {
- float[item] weightOfRares; item it;
- float total;
- weightOfRares[$item[divine champagne popper]] = 0.1;
- weightOfRares[$item[divine champagne flute]] = 0.1;
- weightOfRares[$item[divine cracker]] = 0.1;
- weightOfRares[$item[resolution: be kinder]] = 0.1;
- weightOfRares[$item[resolution: be luckier]] = 0.1;
- weightOfRares[$item[resolution: be more adventurous]] = 0.1;
- weightOfRares[$item[pulled indigo taffy]] = 0.1;
- weightOfRares[$item[pulled green taffy]] = 0.1;
- weightOfRares[$item[pulled yellow taffy]] = 0.1;
- for i from first_item_id to last_item_id {
- it = to_item(i);
- if (weightOfRares contains it) {
- total = total + (get_price(to_item(i), 1) * weightOfRares[it]);
- } else {
- total = total + get_price(to_item(i), 1);
- }
- }
- return (total / (1 + last_item_id - first_item_id));
- }
- skill most_valuable_libram_skill() {
- float[skill] averageSummonValue;
- skill bestSkill;
- string s;
- averageSummonValue[$skill[Summon Candy Heart]] = (have_skill($skill[Summon Candy Heart]))? average_price(2304, 2309) : 0;
- averageSummonValue[$skill[Summon Party Favor]] = (have_skill($skill[Summon Party Favor]))? average_price(3118, 3123) : 0;
- averageSummonValue[$skill[Summon Love Song]] = (have_skill($skill[Summon Love Song]))? average_price(3754, 3759) : 0;
- averageSummonValue[$skill[Summon BRICKOs]] = (have_skill($skill[Summon BRICKOs]))? average_price(4469, 4470) : 0;
- averageSummonValue[$skill[Summon Dice]] = (have_skill($skill[Summon Dice]))? average_price(5285, 5290) : 0;
- averageSummonValue[$skill[Summon Resolutions]] = (have_skill($skill[Summon Resolutions]))? average_price(5464, 5472) : 0;
- averageSummonValue[$skill[Summon Taffy]] = (have_skill($skill[Summon Taffy]))? average_price(6361, 6367) : 0;
- #sort averageSummonValue by -value;
- foreach sk in averageSummonValue {
- if (averageSummonValue[sk] > averageSummonValue[bestSkill]) {
- bestSkill = sk;
- }
- if (averageSummonValue[sk] != 0) {
- s = substring(to_string(averageSummonValue[sk]), 0, last_index_of(to_string(averageSummonValue[sk]),".") + 2);
- print("Average mallprice for the items from " + to_string(sk) + " is: " + s + ".", "green");
- }
- }
- if (averageSummonValue[bestSkill] != 0) {
- s = substring(to_string(averageSummonValue[bestSkill]), 0, last_index_of(to_string(averageSummonValue[bestSkill]),".") + 2);
- print("The largest return on tome-summons is from " + to_string(bestSkill) + " which gives " + s + " meat on average.", "blue");
- return bestSkill;
- }
- return $skill[none];
- }
- void buff_mp() {
- string current_clan;
- // Ballpit
- if (item_amount($item[Clan VIP Lounge key]) > 0 && !to_boolean(get_property("_ballpit")) && clanLeaderID() != to_int(my_id())) {
- if (to_int(get_property("ballpitBonus")) < 100) {
- clanhop("Bonus Adventures From Hell");
- cli_execute("ballpit");
- } else {
- cli_execute("ballpit");
- }
- }
- // Telescope
- if (to_int(get_property("telescopeUpgrades")) > 0 && !to_boolean(get_property("telescopeLookedHigh"))) {
- cli_execute("telescope high");
- }
- // Maximize
- if (have_familiar($familiar[Disembodied Hand])) {
- maximize("mp, -tie, -current, -equip staff of ed, switch Disembodied Hand", false);
- } else {
- maximize("mp, -tie, -current, -equip staff of ed", false);
- }
- }
- boolean restore_without_overshooting() {
- int free_rests_available; int rest_mp;
- boolean return_value;
- return_value = false;
- buffer vip_lounge;
- // Nuns
- if (get_property("sidequestNunsCompleted") == "fratboy") {
- while (my_maxmp() - my_mp() >= 1000 && to_int(get_property("nunsVisits")) < 3) {
- cli_execute("nuns");
- return_value = true;
- }
- }
- // Shower mp
- if (!to_boolean(get_property("_aprilShower"))) {
- vip_lounge = visit_url("clan_viplounge.php?whichfloor=2");
- if (my_maxmp() - my_mp() >= 1000) {
- vip_lounge.append(visit_url("clan_viplounge.php"));
- if (!vip_lounge.contains_text("vip_trendy.gif")) {
- if (!vip_lounge.contains_text("aprilshower.gif") && clanLeaderID() != to_int(my_id())) {
- clanhop("Bonus Adventures from Hell");
- }
- if (vip_lounge.contains_text("aprilshower.gif")) {
- cli_execute("shower mp");
- return_value = true;
- }
- }
- }
- }
- // Oscus's neverending soda
- if (!to_boolean(get_property("oscusSodaUsed")) && item_amount($item[Oscus's neverending soda]) > 0) {
- if (my_maxmp() - my_mp() >= 300) {
- use(1, $item[Oscus's neverending soda]);
- return_value = true;
- }
- }
- // Campground
- free_rests_available = total_free_rests();
- free_rests_available -= to_int(get_property("timesRested"));
- if (free_rests_available > 0) {
- if (item_amount($item[Pantsgiving]) > 0) {
- equip($slot[pants], $item[Pantsgiving]);
- }
- rest_mp = numeric_modifier("Base Resting MP") * (numeric_modifier("Resting MP Percent")+100) / 100 + numeric_modifier("Bonus Resting MP");
- #if (to_boolean(get_property("chateauAvailable"))) {
- # if (rest_mp < 125) {
- # set_property("restUsingChateau", "true");
- # rest_mp = 150;
- # } else {
- # set_property("restUsingChateau", "false");
- # }
- #}
- while (my_maxmp() - my_mp() >= rest_mp && free_rests_available > 0) {
- cli_execute("rest");
- free_rests_available -= 1;
- return_value = true;
- }
- }
- return return_value;
- }
- boolean restore_with_overshooting() {
- int free_rests_available;
- buffer vip_lounge;
- // Nuns
- if (get_property("sidequestNunsCompleted") == "fratboy") {
- if (my_maxmp() > my_mp() && to_int(get_property("nunsVisits")) < 3) {
- cli_execute("nuns");
- return true;
- }
- }
- // Shower mp
- if (!to_boolean(get_property("_aprilShower"))) {
- vip_lounge = visit_url("clan_viplounge.php?whichfloor=2");
- if (my_maxmp() > my_mp()) {
- vip_lounge.append(visit_url("clan_viplounge.php"));
- if (!vip_lounge.contains_text("vip_trendy.gif")) {
- if (!vip_lounge.contains_text("aprilshower.gif") && clanLeaderID() != to_int(my_id())) {
- clanhop("Bonus Adventures from Hell");
- }
- if (vip_lounge.contains_text("aprilshower.gif")) {
- cli_execute("shower mp");
- return true;
- }
- }
- }
- }
- // Oscus's neverending soda
- if (!to_boolean(get_property("oscusSodaUsed")) && item_amount($item[Oscus's neverending soda]) > 0) {
- if (my_maxmp() > my_mp()) {
- use(1, $item[Oscus's neverending soda]);
- return true;
- }
- }
- // Campground
- free_rests_available = total_free_rests();
- free_rests_available -= to_int(get_property("timesRested"));
- if (free_rests_available > 0) {
- if (item_amount($item[Pantsgiving]) > 0) {
- equip($slot[pants], $item[Pantsgiving]);
- }
- if (my_maxmp() > my_mp() && free_rests_available > 0) {
- cli_execute("rest");
- return true;
- }
- }
- return false;
- }
- void cast_while_affordable(skill skill_to_use) {
- while (mp_cost(skill_to_use) < my_mp()) {
- use_skill(1, skill_to_use);
- }
- }
- boolean use_pyec() {
- string pyec_taken_from; string property_value;
- // Check if PYEC is available
- if (!(item_amount($item[Platinum Yendorian Express Card]) > 0) && can_interact()) {
- if(display_amount($item[Platinum Yendorian Express Card]) > 0) {
- take_display(1, $item[Platinum Yendorian Express Card]);
- pyec_taken_from = "display";
- } else if (closet_amount($item[Platinum Yendorian Express Card]) > 0) {
- take_closet(1, $item[Platinum Yendorian Express Card]);
- pyec_taken_from = "closet";
- } else if (shop_amount($item[Platinum Yendorian Express Card]) > 0) {
- take_shop(1, $item[Platinum Yendorian Express Card]);
- pyec_taken_from = "shop";
- } else if (storage_amount($item[Platinum Yendorian Express Card]) > 0) {
- take_storage(1, $item[Platinum Yendorian Express Card]);
- pyec_taken_from = "storage";
- } else if (stash_amount($item[Platinum Yendorian Express Card]) > 0) {
- if (take_stash(1, $item[Platinum Yendorian Express Card])) {
- pyec_taken_from = "stash";
- }
- } else if (clanhop("Hardcore Oxygenation")) {
- if (stash_amount($item[Platinum Yendorian Express Card]) > 0) {
- if (take_stash(1, $item[Platinum Yendorian Express Card])) {
- pyec_taken_from = "stash";
- }
- }
- } else {
- return false;
- }
- }
- if (item_amount($item[Platinum Yendorian Express Card]) >= 1) {
- // Burn as much mp as possible, before using the card.
- // First mood.
- cli_execute("burn * mp");
- // Then leash.
- if (mp_cost($skill[Leash of Linguini]) < my_mp() && have_skill($skill[Leash of Linguini])) {
- use_skill(to_int(my_mp() / mp_cost($skill[Leash of Linguini])), $skill[Leash of Linguini]);
- }
- // Then extend buffs.
- property_value = get_property("allowNonMoodBurning");
- set_property("allowNonMoodBurning", "true");
- cli_execute("burn * mp");
- set_property("allowNonMoodBurning", property_value);
- use(1, $item[Platinum Yendorian Express Card]);
- switch (pyec_taken_from) {
- case "display":
- put_display(1, $item[Platinum Yendorian Express Card]);
- break;
- case "closet":
- put_closet(1, $item[Platinum Yendorian Express Card]);
- break;
- case "shop":
- put_shop(0, 0, 1, $item[Platinum Yendorian Express Card]);
- break;
- case "stash":
- put_stash(1, $item[Platinum Yendorian Express Card]);
- break;
- }
- }
- return true;
- }
- void manaburn() {
- string current_clan;
- skill skill_to_use = most_valuable_libram_skill();
- if (skill_to_use != $skill[none]) {
- current_clan = get_clan_name();
- buff_mp();
- // Run down current mp before using PYEC.
- // First libram skill
- cast_while_affordable(skill_to_use);
- // First try to restore mp without going over max mp
- while (restore_without_overshooting() && mp_cost(skill_to_use) <= my_maxmp()) {
- cast_while_affordable(skill_to_use);
- }
- // Then allow going over maz mp
- while (restore_with_overshooting() && mp_cost(skill_to_use) <= my_maxmp()) {
- cast_while_affordable(skill_to_use);
- }
- // Then use PYEC, if available
- if (!to_boolean(get_property("expressCardUsed"))) {
- use_pyec();
- cast_while_affordable(skill_to_use);
- }
- if (get_clan_name() != current_clan) {
- clanhop (current_clan);
- }
- print("Done! The next libram summon will cost " + mp_cost(skill_to_use) + " mp.", "blue");
- } else {
- print("You don't have any libram skills.", "red");
- }
- }
- void main() {
- manaburn();
- }
Advertisement
Add Comment
Please, Sign In to add comment