## Slime Speed Run Script by Alhifar
notify Alhifar;
string version = "1.3.3";
string download_location = "http://alhifar.dyndns.org/mafia/scriptlets/";
## Outfit names may include "f=familiar name" and "m=mood name" to specify a mood/familiar to use.
## Note that the script takes care of aria, so it should NOT be in the mood being used.
string max_ml_outfit = "maxml f=purse rat";
string min_ml_outfit = "minml f=volleyball";
## Set use_tatter_like to true to use a tatter to escape from combat, or to false to simply kill the slime and use an adventure.
## Set which_tatter to which tatter-like item to use to escape from combats
## Reccommended not to use tattered scraps as your tatter-like, large chance of failure makes them inefficient.
boolean use_tatter_like = true;
item which_tatter = $item[divine champagne popper];
## Set jump_clan to the clan that you will jump to when getting Coated in Slime at max turns!
## This should be a clan without any bladders squeezed in their tube. Leave blank to disable switching clans.
string jump_clan = "";
boolean use_hottub = true;
## End Options
## Do not modify anything below this line unless you know what you are doing!
###################################################
float[int] slime_percent;
slime_percent[1] = 5.334167;
slime_percent[2] = 4.001677;
slime_percent[3] = 2.9025;
slime_percent[4] = 2.016667;
slime_percent[5] = 1.325;
slime_percent[6] = .805833;
slime_percent[7] = .4391667;
slime_percent[8] = .200833;
slime_percent[9] = .066667;
slime_percent[10] = 0;
int min( int a , int b )
{
if( a < b ) return a;
return b;
}
boolean check_version()
{
return visit_url( download_location + "slime_ver.txt" ).to_string() == version;
}
int slime_damage()
{
int damage = my_maxhp() * slime_percent[ min( have_effect( $effect[Covered in Slime] ) , 10 ) ];
return ceil( damage * ( ( 100 - elemental_resistance( $element[slime] ) ) / 100 ) ) + expected_damage( $monster[slime1] );
}
boolean chamois()
{
visit_url( "clan_slimetube.php?action=chamois" );
if ( have_effect( $effect[Coated in Slime] ) > 0 )
{
## Tub code stolen... err... "borrowed" from matt.chugg
print( "Chamois failed!" , "red" );
if( use_hottub && get_property( "_hotTubSoaks" ).to_int() < 5 )
{
print ( "Using VIP bath..." );
cli_execute( "soak 1" );
if ( have_effect( $effect[Coated in Slime] ) > 0 )
{
return false;
}
return true;
}
return false;
}
print( "Chamois successfully used." );
return true;
}
int max_mcd()
{
return 10 + ( in_mysticality_sign().to_int() );
}
boolean join_clan( string clan_name )
{
## Find clan number
buffer find_clan = visit_url( "clan_signup.php?action=search&searchstring=" + clan_name.url_encode() + "&whichfield=1&searchform=Search&countoper=0&countqty=&furn1=0&furn2=0&furn3=0&furn4=0&furn5=0&furn9=0&pwd" );
if( contains_text( find_clan , "(Search returned no results.)" ) )
{
print( "No clan named " + clan_name + " exists! Check that you correctly spelled the clan name." );
return false;
}
string clan_num;
matcher m_clan = create_matcher( "showclan.php\\?recruiter=\\d&whichclan=(\\d+)" , find_clan );
if( m_clan.find() )
{
clan_num = m_clan.group( 1 );
}
else
{
abort( "Something happened! This shouldn't ever happen! Yell at Alhifar!" );
}
## Join clan
buffer apply = visit_url( "showclan.php?recruiter=1&whichclan=" + clan_num + "&action=joinclan&apply=Apply+to+this+Clan&confirm=on&pwd" );
if( contains_text( apply , "Recent Announcements" ) )
{
print( "Successfully joined " + clan_name + " on a whitelist!" , "green" );
return true;
}
else if( contains_text( apply , "You have submitted a request to join" ) )
{
print( "Successfully applied to " + clan_name + "! You will receive a message when your application is processed!" , "blue" );
return false;
}
else
{
print( "Could not join " + clan_name + "! You may already be a member of this clan." , "red" );
return false;
}
print( "Error, the impossible occured!" , "red" );
return false;
}
string get_clan()
{
string hall = visit_url( "clan_hall.php" );
matcher m_clan = create_matcher( "<td><center><b>([^<]+)</b><br>" , hall );
if( m_clan.find() )
{
return m_clan.group( 1 );
}
return "none";
}
string run_adv( string page_text )
{
matcher m_choice = create_matcher( "whichchoice value=(\\d+)" , page_text );
while( contains_text( page_text , "choice.php" ) )
{
m_choice.reset( page_text );
m_choice.find();
string choice_adv_num = m_choice.group( 1 );
string choice_adv_prop = "choiceAdventure" + choice_adv_num;
string choice_num = get_property( choice_adv_prop );
if( choice_num == "" ) abort( "Unsupported Choice Adventure!" );
string url = "choice.php?pwd&whichchoice=" + choice_adv_num + "&option=" + choice_num;
page_text = visit_url( url );
}
if( contains_text( page_text , "Combat" )) run_combat();
return page_text;
}
void main( int adv_to_use )
{
if( !check_version() )
{
if( !user_confirm( "You do not have the latest version of the script!\nYou can download the latest version from " + download_location + "slime.ash.\nWould you still like to continue?" ) )
{
abort( "Download the latest version from " + download_location + "slime.ash" );
}
}
string old_action;
string page_text;
string my_clan = get_clan();
if( adv_to_use < 1 ) adv_to_use = my_adventures();
cli_execute( "autoattack disabled" );
while( my_adventures() > 0 && adv_to_use > 0 )
{
if( have_effect( $effect[Coated in Slime] ) == 0 )
{
if( jump_clan != "" )
{
if( !join_clan( jump_clan ) ) abort( "Clan joining failed! Check that you have the correct clan name!" );
}
outfit( min_ml_outfit );
change_mcd( 0 );
if( have_skill( $skill[Ur-Kel's Aria of Annoyance] ) )
{
cli_execute( "uneffect Ur-kels" );
}
if( use_tatter_like )
{
old_action = get_property( "battleAction" );
set_property( "battleAction" , "item " + which_tatter.to_string() );
}
page_text = visit_url( to_url( $location[The Slime Tube] ) );
page_text = run_adv( page_text );
if( use_tatter_like )
{
set_property( "battleAction" , old_action );
}
if( jump_clan != "" )
{
if( !join_clan( my_clan ) ) abort( "Clan return failed!" );
}
}
else if( slime_damage() > my_maxhp() )
{
if( !chamois() ) abort( "Slime removal failed! You won't survive another turn!" );
if( !restore_hp( my_hp() + slime_damage() + expected_damage( $monster[slime1] ) + 10 ) ) abort( "Unable to restore HP!" );
}
else
{
outfit( max_ml_outfit );
change_mcd( max_mcd() );
if( have_skill( $skill[Ur-Kel's Aria of Annoyance] ) && have_effect( $effect[Ur-Kel's Aria of Annoyance] ) == 0 )
{
use_skill( 1 , $skill[Ur-Kel's Aria of Annoyance] );
}
adventure( 1 , $location[The Slime Tube] );
adv_to_use = adv_to_use - 1;
}
}
}