sub heal { my $pro = shift; $agent->get("http://$url/index.php?act=atkshop"); my ($money) = $agent->content =~ m/Euro:<\/strong> (\d+(?:,\d+)?)/; my ($s_potions) = $agent->content =~ m/.+>War Pills \((\d+)\) 1) { print gettime(), "Using small Potion\n"; $agent->get("http://$url/index.php?act=atkshop&do=use&item=1"); } elsif (($s_potions == 0) and ($money > 125)) { print gettime(), "Buying small Potion\n"; $agent->get("http://$url/index.php?act=atkshop&do=buy&item=1"); print gettime(), "Using small Potion\n"; $agent->get("http://$url/index.php?act=atkshop&do=use&item=1"); } elsif (($s_potions == 0) and ($money < 125)) { print gettime(), "No Money, No Potions, sleeping...\n"; goto SLEEP; } } elsif ($pro == '25') { print("Got 25 percent\n"); if ($s_potions > 1) { print gettime(), "Using small Potion\n"; $agent->get("http://$url/index.php?act=atkshop&do=use&item=1"); } elsif (($s_potions == 0) and ($money > 125)) { print gettime(), "Buying small Potion\n"; $agent->get("http://$url/index.php?act=atkshop&do=buy&item=1"); print gettime(), "Using small Potion\n"; $agent->get("http://$url/index.php?act=atkshop&do=use&item=1"); } elsif (($s_potions == 0) and ($money < 125)) { print gettime(), "No Money, No Potions, sleeping...\n"; goto SLEEP; } } }