buffer manor(buffer source)
{
    static string check = "<span style='color:green'>&#"+10003+";</span> ";
    static string batsu = "<span style='color:red'>&#"+10007+";</span> ";
	
    buffer info;
    info.append( "<div style='text-align:center;color:blue;font-family:serif'>" );
    if ( item_amount( $item[spookyraven library key] ) > 0 ) {
	info.append( check );
	info.append( "Library open" );
    } else {
	info.append( batsu );
	info.append( "Library locked" );
    }
    info.append( "<br />" );
    if ( item_amount( $item[spookyraven gallery key] ) > 0 ) {
	info.append( check );
	info.append( "Gallery open" );
    } else if ( to_int( get_property( "lastGalleryUnlock" ) ) == my_ascensions() ) {
	info.append( batsu );
	info.append( "Gallery key available in Conservatory" );
    } else {
	info.append( batsu );
	info.append( "Gallery key requires reading at the Library" );
    }
    info.append( "<br />" );
    if ( !source.contains_text( "manor2.php" ) ) {
	info.append( batsu );
	info.append( "Upstairs closed" );
    } else {
	info.append( check );
	info.append( "Upstairs open" );
    }
    info.append( "</div>" );
    return insert( source, index_of( source, "</table>" ) + 8, info );
}
void main()
{
    write( manor( visit_url() ) );
}
	void check(buffer a, string b)
{
   static string check = "<span style='color:green'>&#"+10003+";</span> ";
   a.append(check);
   a.append(b);
}
void batsu(buffer a, string b)
{
   static string batsu = "<span style='color:red'>&#"+10007+";</span> ";
   a.append(batsu);
   a.append(b);
}
buffer manor(buffer source)
{
   buffer info;
   info.append( "<div style='text-align:center;color:blue;font-family:serif'>" );
   if ( item_amount( $item[spookyraven library key] ) > 0 )
      info.check( "Library open" );
   else
      info.batsu( "Library locked" );
   info.append( "<br />" );
   if ( item_amount( $item[spookyraven gallery key] ) > 0 )
      info.check( "Gallery open" );
   else if ( to_int( get_property( "lastGalleryUnlock" ) ) == my_ascensions() )
      info.batsu( "Gallery key available in Conservatory" );
   else
      info.batsu( "Gallery key requires reading at the Library" );
   info.append( "<br />" );
   if ( !source.contains_text( "manor2.php" ) )
      info.batsu( "Upstairs closed" );
   else
      info.check( "Upstairs open" );
   info.append( "</div>" );
   return insert( source, index_of( source, "</table>" ) + 8, info );
}
void main()
{
   write( manor( visit_url() ) );
}
	Would have been nice if you'd have adopted my efficiency suggestions, too.
But, what do I know? I'm not an ash scripter...
I intentionally didn't make the staircase unclickable. If mafia or someone's settings get out of synch somehow, I don't want to prevent them from going upstairs, especially since it only costs 4 HP or so if you click there when upstairs isn't open.
	if ( item_amount( $item[spookyraven library key] ) > 0 )
	{
		info.append( check ).append( "<span style='color:blue'>Library open</span><br />" );
	}
	else
	{
		info.append( batsu ).append( "Library locked<br />" );
	}
	On the topic of optimizations, there's unnecessary integer conversion and string concatenation going on here:
static string check = "<span style='color:green'>&#"+10003+";</span> ";
static string batsu = "<span style='color:red'>&#"+10007+";</span> ";
This is better: (Edit: Can't figure out how to write it without it showing the character entity.)
static string check = "<span style='color:green'>✓</span> ";
static string batsu = "<span style='color:red'>✗</span> ";
Thanks!I changed the posted version after Veracity's post. She wasn't listed in the comments when she made that post.
Dunno if someone cares, but here is my final version.
I care and I like it, and prefer the enhanced version. Thanks.