/* ** The New Moon Player Object ** ** Death altered by Newstyle, 25/08/93 ** Pking added by Newstyle, 26/08/93 ** Ansi colours put in for events by Newstyle, 26/08/93 ** Adapted to man style by Newstyle, 31/08/93 ** Alignments totally re-done by Newstyle, 31/08/93 ** Equipment for new characters by Newstyle, 16/09/93 ** ** Harshly optimised, Newstyle, 16/09/93 ** News on/off added, Newstyle, 10/10/93 ** #pragma save_binary added, Bannor 31-OCT-93 ** Query_domain() function added, Newstyle, 18/01/94 ** changed inventory regen to use load_auto_load_alt, also ** added checks in exit() and do_su() to make sure the regen ** is compleate before allowing exit or su, Bannor 1-APR-94 */ #pragma save_binary #define TB(x) if(find_player("bannor")) \ tell_object(find_player("bannor"),x) #include "library.h" #include "tune.h" #include "login_handler.h" #include "drinks.h" #include "weather.h" #include "log.h" inherit "/global/line_ed"; inherit "/global/auto_load"; inherit "/global/events"; inherit "/global/log"; inherit "/global/spells"; inherit "/global/help"; inherit "/global/more_string"; inherit "/global/finger"; inherit "/global/pweath"; inherit "/global/stats-rear"; inherit "/global/psoul"; inherit "/global/guild-race"; inherit "/global/drunk"; inherit "/global/last"; inherit "/global/more_file"; inherit "/global/path"; inherit "/std/living/living"; inherit "/std/living/handle"; #include "money.h" #include "mail.h" #include "player.h" #define START_POS "/d/home/city/newbiepub1" #define COL "%^CYAN%^" string cap_name, title, al_title, *auto_load, last_on_from, last_pos; object *attacker_list; static object snoopee; int headache, time_on, max_deaths, monitor, ntime_last_saved, *saved_co_ords, start_time, creator, app_creator, deaths, level, last_log_on, alignment, *news; int ed_setup, invis; /* Used by other prog blocks */ static int hb_num; mixed *money_array; void start_player(); void run_away(); void set_title( string str ); void public_commands(); int save_me(); int save(); void set_desc( string str ); string query_title(); int query_creator(); void set_name( string str ); int check_dark( int light ); int query_invis() { return invis; } string query_in_editor() { return 0; } void create() { living::create(); events::create(); pweath::create(); psoul::create(); line_ed::create(); add_property( "determinate", "" ); /* What IS this used for? */ spells = ({ }); /* This should be in race-guild */ money_array = ({ }); news = ({ 0, 0, 0 }); time_on = time(); start_time = time(); seteuid( "PLAYER" ); Str = Dex = Int = Con = Wis = 13; max_social_points = 50; max_deaths = 7; desc = 0; add_attack( "hands", 0, 75, 30, 0, 0, "blunt" ); add_attack( "feet", 0, 25, 40, 0, 0, "blunt" ); add_ac( "skin", "blunt", ({ 5, 2, 5 }) ); add_ac( "skin", "sharp", ({ 5, 2, 5 }) ); add_ac( "skin", "pierce", ({ 5, 2, 5 }) ); add_property( "player", 1 ); cols = 79; rows = 24; verbose = 1; last_log_on = time(); race_ob = RACE_STD; sscanf( file_name( this_object() ), "%s#", my_file_name ); } string query_start_pos() { string start_pos; if( !guild_ob ) start_pos = START_POS; else catch( start_pos = (string)guild_ob->query_start_pos() ); if( !find_object( start_pos ) ) if( catch( call_other( start_pos, "??" ) ) ) start_pos = START_POS; return start_pos; } string query_cap_name() { return cap_name; } void move_player_to_start( string bong, int new, string c_name ) { object money; if( file_name( previous_object() )[ 0..13 ] != "/secure/login#" ) { notify_fail( "You dont have the security clearance to do that.\n" ); return; } seteuid( "Root" ); set_name( bong ); log_file( "ENTER", "Enter : " + (query_property( "guest" ) ? "(guest) " : "") + name + ctime( time() ) + time() + (query_ip_name()? query_ip_name() : query_ip_number()) + "\n" ); restore_object( "/players/" + name[ 0..0 ] + "/" + name, 1 ); add_property( "player", 1 ); cap_name = c_name; set_short( cap_name ); add_property( "determinate", "" ); if( this_player()->query_creator() ) seteuid( name ); else seteuid( "PLAYER" ); write( "You last logged in from " + last_on_from + ".\n" ); last_on_from = query_ip_name( this_object() ) + " (" + query_ip_number( this_object() ) + ")"; bonus_cache = ([ ]); level_cache = ([ ]); if( time_on < -43200000 ) time_on += time(); /* -500*24*60*60 = 500 days */ if( time_on > 0 ) time_on = 0; time_on += time(); guild_joined += time(); ntime_last_saved += time(); /* This moves us to the player. */ start_player(); if( !msgin || msgin[ 0 ] == '@' ) /* Erm .. why, I wonder? */ msgin = msgout = mmsgin = mmsgout = 0; if( !msgin ) msgin = "$N arrive$s from $F."; if( !msgout ) msgout = "$N leave$s $T."; if( !mmsgin ) mmsgin = "$N appear$s from elsewhere."; if( !mmsgout ) mmsgout = "$N %vanish%."; if( !news || sizeof( news ) != 3 ) news = ({ 0, 0, 0 }); if( news[ 0 ] == 0 ) cat( "/doc/NEWS" ); else if( file_size( "/doc/NEWS" ) != news[ 0 ] ) { cat( "/doc/NEWS" ); news[ 0 ] = file_size( "/doc/NEWS" ); } if( this_object()->query_creator() ) { if( news[ 1 ] == 0 ) cat( "/doc/CREATORNEWS" ); else if( file_size( "/doc/CREATORNEWS" ) != news[ 1 ] ) { cat( "/doc/CREATORNEWS" ); news[ 1 ] = file_size( "/doc/CREATORNEWS" ); } } if( this_object()->query_lord() ) { if( news[ 2 ] == 0 ) cat( "/doc/LORDNEWS" ); else if( file_size( "/doc/LORDNEWS" ) != news[ 2 ] ) { cat( "/doc/LORDNEWS" ); news[ 2 ] = file_size( "/doc/LORDNEWS" ); } } if( !last_pos || catch( call_other( last_pos, "??" ) ) ) { last_pos = query_start_pos(); saved_co_ords = 0; } move( last_pos ); if( !last_pos->query_co_ord() && saved_co_ords ) last_pos->set_co_ord( saved_co_ords ); event( users(), "inform", "%^GREEN%^" + cap_name + " enters " + (query_property( "guest" ) ? "as a guest of " : "") + "New Moon" + (query_property( "new player" ) ? " (New player)" : "") + "%^RESET%^", "logon" ); say( "%^GREEN%^" + cap_name + " enters the game.%^RESET%^\n" ); if( verbose ) command( "look" ); else command( "glance" ); no_time_left(); last_pos->enter( this_object() ); money = clone_object( MONEY_OBJECT ); money->set_money_array( money_array ); money->move( this_object() ); if( query_property( PASSED_OUT_PROP ) ) call_out( "remove_property", 10 + random( 30 ), PASSED_OUT_PROP ); init_after_save(); curses_start(); write( (string)MAILER->new_mail( name ) ); /* Added by Newstyle, 12/4/94 */ if(PARCEL_OFFICE->query_parcels( this_object() ) ) if( this_object()->query_creator() ) write("You have been sent some parcels. Type 'collect' to collect them.\n"); else write("You have been sent some parcels. Go to the parcel-office to collect them.\n"); if( query_property( "dead" ) ) { money = clone_object( DEATH_SHADOW ); money->setup_shadow( this_object() ); } if( query_property( "noregen" ) ) DEATH_CHAR->person_died( query_name() ); last_log_on = time(); set_title( (string)"obj/handlers/library"->query_title( query_name() ) ); /* Added by Newstyle */ if( query_property( "new player" ) ) { remove_property( "new player" ); clone_object( "/obj/misc/race_chooser.c" )->move( this_object() ); clone_object( "/d/home/city/items/weapons/dagger.wep" )->move( this_object() ); clone_object( "/d/home/city/items/armours/robe.arm" )->move( this_object() ); } LOGIN_HANDLER->player_logon( bong ); if( my_file_name != "/global/player" ) if( file_size( "/w/" + name + "/" + PLAYER_ERROR_LOG ) > 0 ) write( "You have ERRORS in /w/" + name + "/" + PLAYER_ERROR_LOG + "\n" ); exec_alias( "login", "" ); } void start_player() { if( app_creator && my_file_name != "/global/player" ) { this_player()->all_commands(); this_player()->app_commands(); } if( this_object()->query_creator() && my_file_name != "/global/player" ) this_player()->wiz_commands(); reset_get(); enable_commands(); public_commands(); parser_commands(); handle_commands(); force_commands(); race_guild_commands(); soul_commands(); event_commands(); finger_commands(); communicate_commands(); living_commands(); spell_commands(); logging_commands(); weather_commands(); editor_commands(); set_living_name( name ); set_no_check( 1 ); /* What does this do? */ set_con( Con ); set_str( Str ); set_int( Int ); set_dex( Dex ); set_wis( Wis ); reset_all(); current_path = home_dir; call_out( "do_load_auto", 1 ); birthday_gifts(); /* check if birthday today and give gifts */ set_heart_beat( 1 ); if( wimpy > 100 ) wimpy = 25; if( ntime_last_saved < 0 ) call_out( "do_auto_save", TIME_BETWEEN_SAVES ); else call_out( "do_update_tmps", TIME_BETWEEN_SAVES ); } int do_load_auto() { load_auto_load_alt( auto_load, this_object(), this_object() ); } void public_commands() { add_action( "rearrange", "rearrange" ); add_action( "do_su", "su" ); add_action( "help_func", "help" ); add_action( "last", "last" ); add_action( "restart_heart_beat", "restart" ); add_action( "look_me", "l*ook" ); add_action( "look_me", "ex*amine" ); add_action( "glance", "glance" ); add_action( "kill", "kill" ); add_action( "stop", "stop" ); add_action( "invent", "i*nventory", -1 ); add_action( "score", "score" ); add_action( "brief_verbose", "brief" ); add_action( "brief_verbose", "verbose" ); add_action( "save", "save" ); add_action( "quit", "quit" ); add_action( "setmin", "setmin" ); add_action( "setmout", "setmout" ); add_action( "setmmin", "setmmin" ); add_action( "setmmout", "setmmout" ); add_action( "review", "review" ); add_action( "toggle_wimpy", "wimpy" ); add_action( "monitor", "mon*itor" ); add_action( "consider", "con*sider" ); add_action( "do_refresh", "refresh" ); add_action( "do_teach", "teach" ); add_action( "do_cap", "cap" ); add_action( "do_news", "news" ); } void do_auto_save() { save(); call_out( "do_update_tmps", TIME_BETWEEN_SAVES ); ntime_last_saved = time(); } void do_update_tmps() { update_tmps(); call_out( "do_auto_save", TIME_BETWEEN_SAVES ); ntime_last_saved = -time(); } int invent() { write( query_living_contents( 1 ) ); if( (find_call_out( "auto_clone_alt" ) != -1) || (find_call_out( "load_auto_load_alt" ) != -1) ) { write( "\n%^YELLOW%^Please note that your inventory is still being "+ "generated.%^RESET%^\n" ); } return 1; } int glance( string arg ) { object *ob; int i, dark; if( !environment() ) { notify_fail( "You are in limbo... sorry you can't look at anything.\n" ); return 0; } dark = check_dark( (int)environment()->query_light() ); if( !arg ) { if( this_object()->query_creator() ) write( COL + file_name( environment() ) + "%^RESET%^\n" ); if( dark ) write( (string)environment()->short( dark, 1 ) + ".\n" ); else write( (string)environment()->short( dark, 1 ) + ".\n" + (string)environment()->query_contents() ); return 1; } if( !sscanf( arg, "at %s", arg ) ) { notify_fail( "Glance at something!\n" ); return 0; } ob = find_match( arg, ({ this_object(), environment() }) ); if( sizeof( ob ) ) { for( i = 0; i < sizeof( ob ); i++ ) write( ob[ i ]->short( dark ) + ".\n" ); return 1; } notify_fail( "You do not think that the " + arg + " is here.\n" ); return 0; } int look_me( string arg ) { object *ob; int i, dark; string ret; if( !environment() ) { notify_fail( "You are in limbo... sorry you can't look at anything.\n" ); return 0; } dark = check_dark( (int)environment()->query_light() ); if( !arg ) { if( this_object()->query_creator() ) write( COL + file_name( environment() ) + "%^RESET%^\n" ); write( environment()->long( 0, dark ) ); this_player()->adjust_time_left( -5 ); return 1; } sscanf( arg, "at %s", arg ); /* Added by Newstyle, 2/5/94 */ if(arg == "soul") { more_string( "/obj/handlers/soul"->query_long() ); return 1; } ob = find_match( arg, ({ this_object(), environment() }) ); ret = ""; this_player()->adjust_time_left( -DEFAULT_TIME ); if( sizeof( ob ) ) { for( i = 0; i < sizeof( ob ); i++ ) { ret += ob[ i ]->long( arg, dark ); this_player()->adjust_time_left( 2 ); } more_string( ret, "Look" ); return 1; } notify_fail( "There is no " + arg + " here.\n" ); return 0; } int setmin( string str ) { string junk; if( my_file_name == "/global/player" && !this_player()->query_property( "setm" ) ) { notify_fail( "You do not have that power yet.\n" ); return 0; } str = str + " "; if( sscanf( " " + str, "%s$N%s", junk, junk ) != 2 || sscanf( " " + str, "%s$F%s", junk, junk ) != 2 ) { notify_fail( "Must have a $N and a $F in your entry message.\n" ); return 0; } msgin = str; write( "Entry message set.\n" ); return 1; } int setmout( string str ) { string junk; if( my_file_name == "/global/player" && !this_player()->query_property( "setm" ) ) { notify_fail( "You do not have that power yet.\n" ); return 0; } str = str + " "; if( sscanf( " " + str, "%s$N%s", junk, junk ) != 2 || sscanf( " " + str, "%s$T%s", junk, junk ) != 2 ) { notify_fail( "Must have a $N and a $T in your exit message.\n" ); return 0; } msgout = str; write( "Exit message set.\n" ); return 1; } int setmmin( string str ) { string junk; if( my_file_name == "/global/player" && !this_player()->query_property( "setmm" ) ) { notify_fail( "You do not have that power yet.\n" ); return 0; } str = str + " "; if( sscanf( " " + str, "%s$N%s", junk, junk ) != 2 ) { notify_fail( "Must have a $N in your teleport in message.\n" ); return 0; } mmsgin = str; write( "Teleport in message set.\n" ); return 1; } int setmmout( string str ) { string junk; if( my_file_name == "/global/player" && !this_player()->query_property( "setmm" ) ) { notify_fail( "You do not have that power yet.\n" ); return 0; } str = str + " "; if( sscanf( " " + str, "%s$N%s", junk, junk ) != 2 ) { notify_fail( "Must have a $N in your teleport out message.\n" ); return 0; } mmsgout = str; write( "Teleport out message set.\n" ); return 1; } int review() { write( "Entry : " + msgin + "\n" ); write( "Exit : " + msgout + "\n" ); write( "MEntry : " + mmsgin + "\n" ); write( "MExit : " + mmsgout + "\n" ); write( "Editor : " + editor + "\n" ); return 1; } string short( int dark ) { if( !interactive( this_object() ) ) return "The net dead statue of " + ::short( dark ); else return ::short( dark ); } int toggle_wimpy( string str ) { int new_wimpy; if( !str ) { notify_fail("Useage: "+query_verb()+" <percentage>\n"); return 0; } if( str == "off" ) new_wimpy = 0; else if( sscanf( str, "%d", new_wimpy ) != 1 ) { notify_fail( "You must set wimpy to a number.\n" ); return 0; } if( new_wimpy < 0 || new_wimpy > 100 ) { notify_fail( "Valid values are 0-100 only.\n" ); return 0; } wimpy = new_wimpy; if( wimpy ) write( "You will now run away at " + wimpy + "% of your maximum hit points.\n" ); else write( "You will fight to the death now.\n" ); return 1; } int brief_verbose( string str ) { if( str == "on" ) verbose = (query_verb() == "verbose"); else if( str == "off" ) verbose = (query_verb() == "brief"); else if( str ) { notify_fail( "Usage: " + query_verb() + " <on/off>\n" ); return 0; } else verbose = !verbose; if( verbose ) write( "You are now in verbose mode.\n" ); else write( "You are now in brief mode.\n" ); return 1; } int score( string str ) { int age; string junk; if( !str ) str = ""; if( (verbose && sscanf( str, "%sbrief%s", junk, junk ) != 2) || sscanf( str, "%sverbose%s", junk, junk ) == 2 ) { write( "Player attributes of " + cap_name + " :- \n\n" ); if( sscanf( str, "%sstats%s", junk, junk ) == 2 ) { write( "Your stats are :-\n" ); printf( "%-#*s\n", query_cols(), "Strength : " + stat_string( query_str() ) + "\nIntelligence : " + stat_string( query_int() ) + "\nDexterity : " + stat_string( query_dex() ) + "\nConstitution : " + stat_string( query_con() ) + "\nWisdom : " + stat_string( query_wis() ) + "\n" ); return 1; } if(guild_ob) catch(junk = (string)guild_ob->query_gp_name() ); else junk = "guild points"; write( "You have :-\n " + hp + " hit points (" + max_hp + " maximum),\n " + gp + " "+junk+" (" + max_gp + " maximum),\n and " + social_points + " social points (" + max_social_points + " maximum).\n\n" ); write( "You have " + xp + " experience points.\n" ); write( "You have died " + deaths + " times, and can die " ); if( max_deaths - deaths == 1 ) write( "once more before you are finally dead.\n" ); else write( max_deaths - deaths + " more times before you are finally dead.\n" ); write( "You are " ); age = time() - time_on; if( age > 86400 ) printf( "%d days, ", age / 86400 ); if( age > 3600 ) printf( "%d hours, ", ( age / 3600 ) % 24 ); if( age > 60 ) printf( "%d minutes and ", ( age / 60 ) % 60 ); printf( "%d seconds old.\n", age % 60 ); if( wimpy ) write( "You will runaway at " + wimpy + "% of your maximum hit points.\n" ); else write( "You will fight to the death.\n" ); return 1; } else if( sscanf( str, "%sstats%s", junk, junk ) == 2 ) { write( "Your basic stats are :-\n" ); printf( "%-#*s\n", query_cols(), "Str : " + stat_string( query_str() ) + "\nInt : " + stat_string( query_int() ) + "\nDex : " + stat_string( query_dex() ) + "\nCon : " + stat_string( query_con() ) + "\nWis : " + stat_string( query_wis() ) + "\n" ); return 1; } if(guild_ob) catch(junk = (string)guild_ob->query_gp_name() ); else junk = "Gp"; junk = capitalize(junk); write( "Hp: " + hp + "(" + max_hp + ")" + " "+junk+": " + gp + "(" + max_gp + ")" + " Xp: " + xp + "\n" ); return 1; } nomask int save() { if( query_property( "guest" ) ) { notify_fail( "Sorry, no saving for guests.\n" ); return 0; } if( my_file_name == "/global/player" || query_verb() == "save" ) tell_object( this_object(), "Saving...\n" ); save_me(); return 1; } void save_me() { object ob; string old; string junk1; int junk2; if( query_property( "guest" ) ) return; /* Added by newstyle, 15/02/94 */ if( sscanf( file_name( this_object() ), "%s#%d", junk1, junk2 ) != 2 ) return; if( (ob = present( "Some Money For Me", this_object() )) ) money_array = (mixed *)ob->query_money_array(); else money_array = ({ }); if( guild_ob ) guild_ob->player_save(); if( race_ob ) race_ob->player_save(); if( environment() ) last_pos = file_name( environment() ); else last_pos = query_start_pos(); if( last_pos[ 0..2 ] == "/w/" ) if( last_pos[ 3..strlen( name ) + 2 ] != name && last_pos[ 3..8 ] != "common" ) last_pos = query_start_pos(); auto_load = ""; auto_load = create_auto_load( all_inventory(), 0 ); saved_co_ords = (int *)last_pos->query_co_ord(); time_on -= time(); guild_joined -= time(); ntime_last_saved -= time(); old = geteuid(); seteuid( "Root" ); catch( save_object( "/players/" + name[ 0..0 ] + "/" + name, 1 ) ); seteuid( old ); time_on += time(); guild_joined += time(); ntime_last_saved += time(); } int quit() { object *ob, money; int i; if( this_player( 1 ) != this_player() && (string)this_player()->query_cap_name() != "Logon" && file_name( previous_object() )[ 0..8 ] != "/obj/shut" ) { log_file( "ILLEGAL", this_player( 1 )->query_cap_name() + " tried to quit() " + this_player()->query_cap_name() + "\n" ); return 1; } if( this_player() != this_object() ) { time_left = 100; /* Make sure it gets done... */ return command( "quit" ); } if( (find_call_out( "auto_clone_alt" ) != -1) || (find_call_out( "load_auto_load_alt" ) != -1) ) { write( "\n%^YELLOW%^You cannot quit yet: your inventory is still "+ "being generated.%^RESET%^\n" ); return 1; } last_log_on = time(); log_file( "ENTER", sprintf( "Exit : %15-s %s[%d]\n", name, ctime( time() ) + (query_property( "guest" ) ? "(guest)" : ""), time() ) ); catch( editor_check_do_quit() ); write( "Thanks for playing here.\n" + "May the light of the New Moon guide you always.\n" ); say( cap_name + " left the game.\n" ); event( users(), "inform", "%^GREEN%^" + cap_name + " left New Moon%^RESET%^", "logon" ); LOGIN_HANDLER->player_logout( query_name() ); if( race_ob ) catch( race_ob->player_quit( this_object() ) ); if( guild_ob ) catch( guild_ob->player_quit( this_object() ) ); curses_quit(); save_me(); if( (money = present( "Some Money For Me", this_object() )) ) money->dest_me(); ob = all_inventory( this_object() ); for( i = 0; i < sizeof( ob ); i++ ) if( ob[ i ]->query_auto_load() || ob[ i ]->query_static_auto_load() ) ob[ i ]->dest_me(); transfer_all_to( environment() ); ob = all_inventory( this_object() ); for( i = 0; i < sizeof( ob ); i++ ) ob[ i ]->dest_me(); dest_me(); return 1; } string query_title() { return title; } void set_title( string str ) { title = str; } string query_atitle() { return al_title; } void set_atitle( string str ) { al_title = str; } int query_deaths() { return deaths; } string query_stime() { if( ntime_last_saved > 0 ) return ctime( ntime_last_saved ); return ctime( -ntime_last_saved ); } void set_name( string str ) { if( name && name != "object" ) return; name = str; set_living_name( name ); set_main_plural( name ); } string long( string str, int dark ) { string s; if( str == "soul" ) return( string ) "/obj/handlers/soul"->query_long(); if( str == "sun" || str == "moon" || str == "weather" || str == "sky" || str == "rain" || str == "hail" || str == "snow" || str == "cloud" || str == "clouds" ) return weather_long( str ); if( this_player() == this_object() ) write( "You look yourself over.\n" ); else tell_object( this_object(), ( string ) this_player()->query_cap_name() + " looks at you.\n" ); s = "You see " + cap_name; if( guild_ob ) s += " " + (string)guild_ob->query_title( this_object() ); if( al_title ) s += " (" + al_title + ")"; s += ".\n"; if( race_ob ) s += (string)race_ob->query_desc( this_object() ); if( desc && desc != "" ) s += cap_name + " " + desc + "\n"; s += capitalize( query_pronoun() ) + " " + health_string() + ".\n"; labels = labels - ({ 0 }); if( sizeof( labels ) ) s += "There is " + query_multiple_short( labels ) + " stuck on " + query_objective() + ".\n"; s += calc_extra_look(); s += weather_extra_look(); s += query_living_contents( 0 ); return s; } int second_life() { string str; int i; make_corpse()->move( environment() ); str = cap_name + " killed by "; if( !sizeof( attacker_list ) ) str += this_player()->query_cap_name() + " (with a call)"; else for( i = 0; i < sizeof( attacker_list ); i++ ) if( attacker_list[ i ] ) { str += attacker_list[ i ]->query_name() + "<" + geteuid( attacker_list[ i ] ) + "> "; attacker_list[ i ]->stop_fight( this_object() ); } log_file( "DEATH", ctime( time() ) + ": " + str + "\n" ); event( users(), "inform", "%^RED%^" + str + "%^RESET%^", "death" ); /* Call to wipe spells - NS, 11/04/94, by request of manshoon */ catch("/d/guilds/wizards/do_forget"->do_forget("") ); attacker_list = ({ }); for( i = 0; i < sizeof( call_outed ); i++ ) call_outed[ i ]->stop_fight( this_object() ); call_outed = ({ }); weapon = 0; deaths++; if( deaths > max_deaths ) { write( "You have just died for the last time.\n" + "Your name will be recorded for posterity.\n" ); shout( cap_name + " has just completely died. " + "All mourn " + query_possessive() + " passing.\n" ); LIBRARY->complete_death( query_name() ); } say( "%^RED%^" + cap_name + " dies.%^RESET%^\n" ); save_me(); DEATH_CHAR->person_died( query_name() ); hp = gp = xp = 0; contmp -= 5; strtmp -= 5; dextmp -= 5; inttmp -= 5; wistmp -= 5; this_object()->add_property( "dead", 1 ); clone_object( DEATH_SHADOW )->setup_shadow( this_object() ); return 1; } void remove_ghost() { if( deaths > max_deaths ) { if( this_player() != this_object() ) { tell_object( this_object(), this_player()->query_cap_name() + " tried to raise you, but you are completely dead.\n" ); tell_object( this_player(), cap_name + " is completely dead. You cannot raise " + query_objective() + " from the dead.\n" ); } else { write( "You are completely dead. You cannot be raised.\n" ); say( cap_name + " tries to live again, but fails.\n" ); } return; } remove_property( "dead" ); if( this_object() == this_player() ) { write( "You restore yourself to a more solid form.\n" ); say( cap_name + " appears in a more solid form.\n" ); } else { tell_object( this_object(), "You reappear in a more solid form.\n" ); tell_object( this_player(), "You restore " + cap_name + " to a more solid form.\n" ); tell_object( environment( this_object() ), this_player()->query_cap_name() + " restores " + cap_name + " to a more solid form.\n" ); } this_object()->dest_death_shadow(); } void net_dead() { int i; if( name == "guest" || name == "root" ) { say( cap_name + " just vanished in a puff of logic.\n" ); quit(); } else { say( cap_name + " has lost " + query_possessive() + " link.\n" ); event( users(), "inform", "%^GREEN%^" + cap_name + " has lost " + query_possessive() + " link%^RESET%^", "link-death" ); save_me(); for( i = 0; i < sizeof( attacker_list ); i++ ) attacker_list[ i ]->stop_fight( this_object() ); } if( time() - last_command > MAX_IDLE ) { say( cap_name + " vanishes in a puff of boredom.\n" ); quit(); return; } } void heart_beat() { int intox; flush_queue(); intox = query_volume( D_ALCOHOL ); if( drunk_heart_beat( intox ) && time_left > 0 ) { attack(); if( sizeof( attacker_list ) ) time_left -= (int)environment()->attack_speed(); } do_spell_effects( attackee ); if( (time() - last_command > MAX_IDLE) && my_file_name != "/global/lord" && !this_object()->query_in_editor() ) { say( cap_name + " vanishes in a puff of boredom.\n" ); write( "You have been idle for too long.\n" ); quit(); } if( guild_ob ) guild_ob->player_heart_beat( ); /* Commented out by Newstyle, 20/4/94 guild_ob->player_heart_beat(); */ else { if( hp < max_hp ) hp++; if( gp < max_gp ) gp++; } if( headache ) { headache--; if( !headache ) write( "Your headache disapears.\n" ); } if( intox ) { intox--; if( !intox ) { headache = 20; tell_object( this_object(), "You now have a hangover.\n" ); hp -= 50; if( hp < 1 ) hp = 1; } } if( ++hb_num % 4 ) { if( social_points < max_social_points ) social_points++; if( monitor && sizeof( attacker_list ) && gp > 0 ) { gp--; if(guild_ob) write("Hp: "+hp+" "+guild_ob->query_gp_name()+": "+gp+"\n"); else write("Hp: "+hp+" Gp: "+gp+"\n"); } if( hb_num > 512 ) { max_social_points++; hb_num = 0; } } if( sizeof( attacker_list ) && wimpy && hp < max_hp * wimpy / 100 ) run_away(); update_volumes(); } int monitor( string str ) { if( !str ) monitor = !monitor; else if( str == "on" ) monitor = 1; else if( str == "off" ) monitor = 0; else { notify_fail( "Syntax: monitor <on/off>\n" ); return 0; } if( monitor ) write( "Hit point monitor turned on.\n" ); else write( "Hit point monitor turned off.\n" ); return 1; } void run_away() { mixed * direcs; int i, bong; direcs = (mixed *)environment()->query_dest_dir(); while( !bong && sizeof( direcs ) ) { i = random( sizeof( direcs ) / 2 ) * 2; bong = command( direcs[ i ] ); if( !bong ) direcs = delete( direcs, i, 2 ); else write( "You run away in terror!\n" ); } if( !bong ) write( "You try to run away but can't find any exits!\n" ); } int help_func( string str ) { string rest, help; if( !str ) return do_help( 0 ); if( sscanf( str, "spell %s", rest ) == 1 ) { if( help = help_spell( rest ) ) { write( help ); return 1; } notify_fail( "Unknown spell : " + rest + ".\n" ); return 0; } if( sscanf( str, "command %s", rest ) == 1 ) { if( help = help_command( rest ) ) { write( help ); return 1; } notify_fail( "Unknown command : " + rest + ".\n" ); return 0; } help = do_help( str ); /* in '/global/help.c' */ if( help ) { write( help ); return 1; } if( (help = help_spell( str )) || (help = help_command( str )) ) { write( help ); return 1; } notify_fail( "No help found on " + str + ".\n" ); return 0; } /* int query_wizard() { return creator; } int query_app_creator() { return app_creator; } */ int kill( string str ) { int i; object *obs, *aobs, *fobs; if( !str || str == "" ) { notify_fail( "Usage: kill <object(s)>\n" ); return 0; } obs = find_match( str, environment() ); if( !sizeof( obs ) ) { notify_fail( "Cannot find " + str + "\n" ); return 0; } aobs = fobs = ({ }); for( i = 0; i < sizeof( obs ); i++ ) { if( living( obs[ i ] ) ) { if( obs[ i ]->query_property( "player" ) ) { if( obs[ i ] == this_object() ) continue; if(!interactive(obs[i])) { fobs += ({ obs[i] }); continue; } if( !this_player()->query_property( "players killed" ) ) { write( "You are not a registered player killer. You cannot attack " + obs[ i ]->query_cap_name() + "!\n" ); tell_object( obs[ i ], this_player()->query_cap_name() + " tried to attack you, but is not a player killer!\n" ); fobs += ({ obs[ i ] }); continue; } if( !obs[ i ]->query_property( "players killed" ) ) { write( obs[ i ]->query_cap_name() + " is not a registered player " + "killer. You cannot attack " + obs[ i ]->query_objective() + "!\n" ); tell_object( obs[ i ], this_player()->query_cap_name() + " tried to attack you, but couldn't, as you are not" + " a registered player killer.\n" ); fobs += ({ obs[ i ] }); continue; } if( obs[ i ] != this_player() ) { if( obs[ i ]->attack_by( this_object() ) ) aobs += ({ obs[ i ] }); else fobs += ({ obs[ i ] }); continue; } } else { /* if(find_player("newstyle")) tell_object(find_player("newstyle"), obs[i]->query_cap_name()+" returning "+obs[i]->attack_by(this_object())+" when attacked by "+this_object()->query_cap_name()+".\n"); */ if( attack_ob( obs[ i ] ) ) aobs += ({ obs[ i ] }); else fobs += ({ obs[ i ] }); continue; } } else if( obs[ i ] != this_object() ) fobs += ({ obs[ i ] }); } if( sizeof( aobs ) ) write( "You attack " + query_multiple_short( aobs ) + ".\n" ); if( sizeof( fobs ) ) write( "You fail to attack " + query_multiple_short( fobs ) + ".\n" ); return 1; } int stop( string str ) { int i; object *obs; if( !str ) { obs = attacker_list + call_outed; if( !sizeof( obs ) ) { notify_fail( "You are not fighting anyone currently.\n" ); return 0; } for( i = 0; i < sizeof( obs ); i++ ) stop_fight( obs[ i ] ); write( "Stopped fighting " + query_multiple_short( obs ) + ".\n" ); return 1; } obs = find_match( str, environment() ); if( find_living( str ) ) obs += ({ find_living( str ) }); if( !sizeof( obs ) ) { notify_fail( "Cannot find " + str + ".\n" ); return 0; } for( i = 0; i < sizeof( obs ); i++ ) stop_fight( obs[ i ] ); write( "Stopped fighting " + str + ".\n" ); return 1; } void set_al( int i ) { alignment = i; } int query_al() { return alignment; } void reset_align_title() { int val; if( al_title = (string)LOGIN_HANDLER->query_al_string() ) return; val = alignment / 20; if( val < 1 || val > 1 ) val /= 2; if( val < 3 || val > 3 ) val /= 2; if( val < 5 || val > 5 ) val /= 2; if( val < 7 || val > 7 ) val /= 2; if( val > 10 ) val = 10; if( val < -10 ) val = -10; val += 10; al_title = ({ "the worst", "demonically evil", "terribly wicked", "utterly evil", "extremely evil", "very evil", "downright wicked", "bad", "nasty", "not nice", "neutral", "nice", "quite good", "good", "very good", "extremely good", "utterly good", "saintly", "angelic", "near-perfect", "perfect" })[ val ]; } int adjust_align( int i ) { alignment = 19 * (alignment + i) / 20; reset_align_title(); return alignment; } int query_time_on() { return time_on - time(); } int query_last_joined_guild() { return guild_joined - time(); } int check_dark( int light ) { int i; if( race_ob ) if( catch( i = (int)race_ob->query_dark( light ) ) ) race_ob = RACE_STD; else return i; return( int ) race_ob->query_dark( light ); } int query_level() { if( guild_ob ) return( int ) guild_ob->query_level( this_object() ); return 0; } int restart_heart_beat() { set_heart_beat( 1 ); write( "Heartbeat restarted.\n" ); return 1; } void set_snoopee( object ob ) { snoopee = ob; } object query_snoopee() { return snoopee; } int do_su( string str ) { if( !str || str == "" ) { notify_fail( "Usage: su <name>\n" ); return 0; } if( (find_call_out( "auto_clone_alt" ) != -1) || (find_call_out( "load_auto_load_alt" ) != -1) ) { write( "\n%^YELLOW%^You cannot quit yet: your inventory is still "+ "being generated.%^RESET%^\n" ); return 1; } notify_fail( "" ); clone_object( "/secure/login" )->do_su( str ); return 1; } void set_creator( int i ) { if( file_name( previous_object() ) != "/secure/master" ) { write( "Illegal attempt to set creator!\n" ); log_file( "ILLEGAL", this_player( 1 ) + " Illegal attempt to set_creator " + "at " + ctime( time() ) + " from " + file_name( previous_object() ) + "\n" ); return; } creator = app_creator = i; if( i ) home_dir = "/w/" + name; else home_dir = 0; save_me(); } int query_prevent_shadow( object ob ) { if( function_exists( "query_prevent_shadow", ob ) || function_exists( "query_name", ob ) || function_exists( "query_creator", ob ) || function_exists( "query_hidden", ob ) || function_exists( "dest_me", ob ) || function_exists( "save_me", ob ) ) return 1; return 0; } int query_max_deaths() { return max_deaths; } void set_max_deaths( int i ) { max_deaths = i; } int adjust_max_deaths( int i ) { return( max_deaths += i ); } int move( object dest, string msgin, string msgout ) { int i; object env; if( (env = environment()) ) WEATHER->unnotify_me( environment() ); i =::move( dest, msgin, msgout ); if( environment() ) WEATHER->notify_me( environment() ); if( !i ) me_moveing( env ); return i; } int consider( string str ) { object *obs; int level, i, ok, dif; if( !str ) { notify_fail( "Syntax: consider <name(s)>.\n" ); return 0; } obs = find_match( str, environment() ); if( !sizeof( obs ) ) { notify_fail( "Cannot find " + str + " to consider!\n" ); return 0; } level = query_level(); for( i = 0; i < sizeof( obs ); i++ ) { if( !living( obs[ i ] ) ) continue; ok = 1; dif = (int)obs[ i ]->query_level() - level; if( dif > 100 ) { write( obs[ i ]->short() + " is way too tough for you.\n" ); continue; } if( level > 5 ) { dif /= 10; if( dif > 2 || dif < -2 ) dif /= 2; if( dif > 5 ) dif = 5; if( dif < -5 ) dif = -5; dif += 5; write( obs[ i ]->short() + ({ " is too weak to bother attacking.\n", " is some one you look down on.\n", " is a lot weaker than you are.\n", " is weaker than you are.\n", " is slightly weaker than you are.\n", " is marginally weaker then you.\n", " is about equal with you.\n", " is marginally tougher than you.\n", " is slightly tougher than you are.\n", " is tougher than you are.\n", " is a lot tougher than you are.\n", " looks pretty nasty.\n", " is way tougher than you.\n" })[ dif ] ); } else if( dif < 0 ) write( obs[ i ]->short() + " would be an easy target.\n" ); else { dif /= 2; if( dif > 5 ) dif = 5; write( obs[ i ]->short() + ({ " is about equal with you.\n", " is slightly tougher than you are.\n", " is tougher than you are.\n", " is a lot tougher than you are.\n", " looks pretty nasty.\n", " is into don't think about it region.\n" })[ dif ] ); } } if( !ok ) { notify_fail( "Failed to consider " + str + ".\n" ); return 0; } return 1; } static int do_refresh() { write( "%^RED%^Warning, read 'help refresh' first.\n" + "Are you sure you wish to do this?%^RESET%^\n" ); input_to( "refresh2" ); return 1; } static int refresh2( string str ) { mapping temp; str = lower_case( str ); if( str[ 0 ] != 'n' && str[ 0 ] != 'y' ) { write( "Answer yes or no.\n" ); input_to( "refresh2" ); return 1; } if( str[ 0 ] == 'n' ) { write( "Ok, not refreshing.\n" ); return 1; } write( "Doing refresh.\n" ); Str = Con = Int = Wis = Dex = 13; inttmp = dextmp = wistmp = strtmp = contmp = 0; race_ob = RACE_STD; clone_object( "/obj/misc/race_chooser.c" )->move( this_object() ); skills = spells = ({ }); guild_ob = 0; xp = deaths = 0; max_deaths = 7; level_cache = bonus_cache = gr_commands = ([ ]); race_guild_commands(); stat_cache = ([ ]); temp["news rc"] = map_prop["news rc"]; temp["inform"] = map_prop["inform"]; temp["earmuffs"] = map_prop["earmuffs"]; map_prop = temp; reset_all(); write( "Done.\n" ); say( cap_name + " refreshes " + query_objective() + "self.\n" ); return 1; } int query_creator_playing() { return creator; } int do_teach( string str ) { string person; object *obs; notify_fail( "Syntax: teach <spell/command> to <person>\n" ); if( !str ) return 0; if( sscanf( str, "%s to %s", str, person ) != 2 ) return 0; obs = find_match( person, environment() ); if( !sizeof( obs ) ) { notify_fail( "You must teach someone.\n" ); return 0; } if( !command_teach( obs, str ) && !spell_teach( obs, str ) && !teach_skill( obs, str ) ) { notify_fail( "You do not know the spell or command " + str + ".\n" ); return 0; } return 1; } string query_object_type() { if( this_object()->query_creator() ) return "W"; return " "; } int do_cap( string str ) { if( !str ) { notify_fail( "Syntax: " + query_verb() + " <cap_name>\n" ); return 0; } if( lower_case( str ) != name ) { notify_fail( "Capitalized name must contain the same letters!\n" ); return 0; } cap_name = str; write( "Capitalised name set to " + cap_name + ".\n" ); return 1; } int do_news( string str ) { if( !str ) { cat( "/doc/NEWS" ); if( this_object()->query_creator() ) cat( "/doc/CREATORNEWS" ); if( this_player()->query_lord() ) cat( "/doc/LORDNEWS" ); return 1; } if( str == "on" ) { news = ({ 0, 0, 0 }); write( "News will now be given at login.\n" ); return 1; } if( str == "off" ) { news = ({ file_size( "/doc/NEWS" ), file_size( "/doc/CREATORNEWS" ), file_size( "/doc/LORDNEWS" ) }); write( "Only new news will be displayed now.\n" ); return 1; } if( news[ 0 ] == 0 ) write( "You currently have news turned on.\n" ); else write( "You currently have news turned off.\n" ); notify_fail( "Use news <on/off> to change your news setting.\n" ); return 0; } string query_domain() { string room; if( !environment() ) return "none"; room = file_name( environment() ); if( room[ 0..2 ] == "/w/" ) return "creator"; if( room[ 0..2 ] == "/d/" ) return explode( room, "/" )[ 1 ]; return "none"; }