Home

[Package Index | Mudlib Index | Effect Index]

File /global/player.c

The main player object. Does all the player related stuff.

Written by Pinkfish

Started December 1991

Inherits

This class inherits the following classes /global/path.c, /global/more_file.c, /global/pweath.c, /global/finger.c, /global/start_position.c, /global/guild-race.c, /global/psoul.c, /global/line_ed.c, /global/family.c, /std/living/living.c, /global/spells.c, /global/log.c, /global/more_string.c and /global/events.c

Includes

This class includes the following files /include/clubs.h, /include/bounty.h, /include/board.h, /include/group_handler.h, /include/db.h, /include/refresh.h, /include/weather.h, /include/top_ten_tables.h, /include/playtesters.h, /include/quest_handler.h, /include/player_handler.h, /include/drinks.h, /include/am_time.h, /include/skills.h, /include/mail.h, /include/command.h, /include/log.h, /include/login.h, /include/living.h, /include/library.h, /include/config.h, /include/playerinfo.h, /include/error_handler.h, /include/nroff.h, /include/tune.h, /include/player.h, /include/login_handler.h, /include/guilds.h and /include/deity.h

Class Index

Method index

  • adjust_deaths(int)
    This method changes the number of times the player has died.
  • adjust_max_deaths(int)
    Changes the current number of maxium deaths.
  • allow_save()
    This method allows the player to save again after they have been disallowed.
  • check_dark(int)
    Can the player see?
  • disallow_save()
    This method stops the player from being able to save.
  • do_load_auto()
    Starts the autoloading process.
  • do_quit()
    quits the player.
  • examine(string)
    Forces the player to examine something.
  • extra_score()
    This method returns any extra information associated with the score.
  • glance(string)
    Force the player to glance.
  • heart_beat()
    The main heart beat function.
  • idle_out()
    Checks to see if they have idled out.
  • look_me(string)
    Force the player to look.
  • move_player_to_start(string, int, string, string, int)
    This method is called from within the login code to start up the new player, set their name and move them into the correct location on the mud.
  • net_dead()
    Called when the player goes net dead.
  • query_activity_counter()
    Return the current value of this players activity_counter (used for debugging)
  • query_cap_name()
    This method returns the current capitalised name of the player.
  • query_creator()
    This method returns if the object is a creator or not.
  • query_deaths()
    This method returns the number of times the player has died.
  • query_last_log_on()
    This method returns the time at which the player last logged on.
  • query_level()
    Returns the players level.
  • query_mature()
    This method determins if the player is mature or not yet.
  • query_max_deaths()
    Returns the maxium number of deaths.
  • query_monitor()
    Is rthe monitor turned on?
  • query_no_logins()
    This method returns the number of times the player has logged onto Discworld.
  • query_object_type(object)
    This method returns the one letter object type which is used in the finger command to display the type of object.
  • query_prevent_shadow(object)
    Prevent the object from shadowing us?
  • query_refresh_time()
    This method returns the time at which the player last refreshed.
  • query_save_inhibit()
    This method returns the value of the disallowing save variable.
  • query_sight_levels()
    This returns the sight values for the race/player.
  • query_snoopee()
    Returns the object snooping us.
  • query_start_time()
    This is the date on which the character was started.
  • query_time_on()
    The amount of time on line.
  • query_title()
    This method returns the list of titles associated with this player.
  • query_titles()
    This method returns the mapping of all the title associated with this player.
  • query_wizard()
  • quit()
    A forced quit.
  • quit_alt(int)
    This is the quit code called by the command 'quit'
  • remove_ghost()
    This method removes the ghost from the player.
  • remove_title(string)
    This method removes the title of the given type from the title mapping.
  • restart_heart_beat()
    Restarts their heartbeat if it has got turned off for some reason.
  • run_away()
    Called when the player wimpys out of a place.
  • save()
    This method is deprecated.
  • save_me()
    Saves the player.
  • save_with_auto_load(mixed)
  • second_life()
    This method is called when the player dies.
  • set_max_deaths(int)
    Sets the maximum number of deaths.
  • set_monitor(int)
    Set the hit point minitor.
  • set_title(string, string)
    This method sets the current title type to be of a certain name.
  • toggle_wimpy(string)
    This method changes the current value of the wimpy variables.
  • write_prompt()

Public Functions

These are functions that everyone can access.

.

    adjust_deaths
    void adjust_deaths(int i)
    

    This method changes the number of times the player has died. This can only be positive.
    adjust_max_deaths
    int adjust_max_deaths(int i)
    

    Changes the current number of maxium deaths. This adjust the number of times a player can die before they are totaly dead.
    • Parameters:
      i - the amount of deaths to adjust by, must be +ve
    • Returns:
      the current total maximum deaths
        allow_save
        void allow_save()
        

        This method allows the player to save again after they have been disallowed.
        • See also:
          disallow_save() and query_save_inhibit()
            check_dark
            int check_dark(int light)
            

            Can the player see? Checks to see if the player can see at the passed in light level.
            • Returns:
              1 if they can see, 0 if they cannot
                disallow_save
                void disallow_save()
                

                This method stops the player from being able to save. This is done while the inventory is regenerating to stop problems with inventory loss due to logging off before it has finished.
                • See also:
                  allow_save() and query_save_inhibit()
                    do_load_auto
                    void do_load_auto()
                    

                    Starts the autoloading process. This is called just after a player logs in to start up the auto loading process.
                      do_quit
                      int do_quit()
                      

                      quits the player.
                      • Returns:
                        zero if it failed, non zero on success
                      • See also:
                        quit() and quit_alt()
                          examine
                          int examine(string arg)
                          

                          Forces the player to examine something. This does the same as the look_me function.
                          • Parameters:
                            arg - the thing to look at.
                          • Returns:
                            0 on a failure, non zero on success.
                          • See also:
                            look_me()
                              extra_score
                              string extra_score()
                              

                              This method returns any extra information associated with the score. This method will mostly be overridden by shadows which wish to place more information into the score command.
                              • Returns:
                                the extra information to place in the score
                                  glance
                                  int glance(string str)
                                  

                                  Force the player to glance. Forces the player to glance in a certain direction.
                                  • Parameters:
                                    str - the direction to glance in
                                  • Returns:
                                    0 ifg the command failed, non zer if it succeeded
                                      heart_beat
                                      void heart_beat()
                                      

                                      The main heart beat function. This is called by the driver every 2 seconds on the player. Does all the maintence stuff like fixing up hps and stuff like that.
                                        idle_out
                                        void idle_out()
                                        

                                        Checks to see if they have idled out. This is called from within the heart beat code.
                                        • See also:
                                          heart_beat()
                                            look_me
                                            int look_me(string str)
                                            

                                            Force the player to look. Forces the player to look at something or just around. If the input is set to "" then they look around.
                                            • Parameters:
                                              str - what to look at
                                            • Returns:
                                              0 if it failed, non zero on success
                                            • See also:
                                              efun::command()
                                                move_player_to_start
                                                void move_player_to_start(string bong,
                                                                          int new_flag,
                                                                          string c_name,
                                                                          string ident,
                                                                          int go_invis)
                                                

                                                This method is called from within the login code to start up the new player, set their name and move them into the correct location on the mud.
                                                • Parameters:
                                                  bong - the name of the player
                                                  new_flag - are the a new player?
                                                  c_name - their capital name
                                                  ident - the ident from the authorisation code
                                                  go_invis - go invsible on login
                                                    net_dead
                                                    void net_dead()
                                                    

                                                    Called when the player goes net dead. This is called by the driver when a player goes net dead. Turns them into a statue and stuff.
                                                      query_activity_counter
                                                      int query_activity_counter()
                                                      

                                                      Return the current value of this players activity_counter (used for debugging)
                                                        query_cap_name
                                                        nomask string query_cap_name()
                                                        

                                                        This method returns the current capitalised name of the player.
                                                        • Returns:
                                                          the current capitalised name
                                                        • See also:
                                                          set_cap_name()
                                                            query_creator
                                                            int query_creator()
                                                            

                                                            This method returns if the object is a creator or not.
                                                            • Returns:
                                                              1 if the object is a creator, 0 if not
                                                                query_deaths
                                                                int query_deaths()
                                                                

                                                                This method returns the number of times the player has died.
                                                                • Returns:
                                                                  the number of times the player has died
                                                                • See also:
                                                                  adjust_deaths() and adjust_max_deaths()
                                                                    query_last_log_on
                                                                    int query_last_log_on()
                                                                    

                                                                    This method returns the time at which the player last logged on.
                                                                    • Returns:
                                                                      the last logged on time
                                                                        query_level
                                                                        int query_level()
                                                                        

                                                                        Returns the players level. Uses their current guild to determine their guild level.
                                                                        • Returns:
                                                                          their guild level
                                                                            query_mature
                                                                            int query_mature()
                                                                            

                                                                            This method determins if the player is mature or not yet. It is based on the amount of time on.
                                                                            • Returns:
                                                                              1 if the player is mature, 0 if they are not
                                                                                query_max_deaths
                                                                                int query_max_deaths()
                                                                                

                                                                                Returns the maxium number of deaths. This is the maxium number of times they can die before they are totaly dead.
                                                                                • Returns:
                                                                                  the maxiumm number fo deaths
                                                                                    query_monitor
                                                                                    int query_monitor()
                                                                                    

                                                                                    Is rthe monitor turned on? The hit point monitor which is displyed during combat...
                                                                                    • Returns:
                                                                                      1 if it is on, 0 if not
                                                                                        query_no_logins
                                                                                        int query_no_logins()
                                                                                        

                                                                                        This method returns the number of times the player has logged onto Discworld.
                                                                                        • Returns:
                                                                                          the number of logins
                                                                                            query_object_type
                                                                                            string query_object_type(object player)
                                                                                            

                                                                                            This method returns the one letter object type which is used in the finger command to display the type of object.
                                                                                            • Returns:
                                                                                              the one letter object type
                                                                                                query_prevent_shadow
                                                                                                int query_prevent_shadow(object ob)
                                                                                                

                                                                                                Prevent the object from shadowing us? This checks to see if we should prevent this object from shadowing the player.
                                                                                                • Returns:
                                                                                                  1 if we are prventing the shadow
                                                                                                    query_refresh_time
                                                                                                    int query_refresh_time()
                                                                                                    

                                                                                                    This method returns the time at which the player last refreshed.
                                                                                                    • Returns:
                                                                                                      the last refresh time
                                                                                                        query_save_inhibit
                                                                                                        int query_save_inhibit()
                                                                                                        

                                                                                                        This method returns the value of the disallowing save variable. If this is a non-zero value then the player must not be saved.
                                                                                                        • See also:
                                                                                                          allow_save() and disallow_save()
                                                                                                            query_sight_levels
                                                                                                            int * query_sight_levels()
                                                                                                            

                                                                                                            This returns the sight values for the race/player. It is changed by any of the dark sight/whatever effects that are used. It returns an array of 4 values.
                                                                                                            • Returns:
                                                                                                              ({ TOO DARK, DARK, BRIGHT, TOO BRIGHT })
                                                                                                                query_snoopee
                                                                                                                nomask object query_snoopee()
                                                                                                                

                                                                                                                Returns the object snooping us. If someone is snooping the player it returns the object doing the snooping. If no one is snooping the player it returns 0.
                                                                                                                • Returns:
                                                                                                                  the object snooping the player
                                                                                                                • See also:
                                                                                                                  efun::snoop()
                                                                                                                    query_start_time
                                                                                                                    int query_start_time()
                                                                                                                    

                                                                                                                    This is the date on which the character was started. The very first time the player ever logged on.
                                                                                                                    • Returns:
                                                                                                                      the time at which the player first logged on
                                                                                                                        query_time_on
                                                                                                                        nomask int query_time_on()
                                                                                                                        

                                                                                                                        The amount of time on line. This is the total amount of time online in seconds from when they first started playing. The return from this method is *negative*, you will need to make it positive to use it most likely.
                                                                                                                        • Returns:
                                                                                                                          the total log on time in seconds (the return value is *negative*)
                                                                                                                            query_title
                                                                                                                            string query_title()
                                                                                                                            

                                                                                                                            This method returns the list of titles associated with this player.
                                                                                                                            • Returns:
                                                                                                                              the list of titles
                                                                                                                            • See also:
                                                                                                                              query_titles(), set_title() and remove_title()
                                                                                                                                query_titles
                                                                                                                                mapping query_titles()
                                                                                                                                

                                                                                                                                This method returns the mapping of all the title associated with this player.
                                                                                                                                • Returns:
                                                                                                                                  the current mapping of titles
                                                                                                                                • See also:
                                                                                                                                  query_title(), set_title() and remove_title()
                                                                                                                                    query_wizard
                                                                                                                                    int query_wizard()
                                                                                                                                    
                                                                                                                                      quit
                                                                                                                                      int quit()
                                                                                                                                      

                                                                                                                                      A forced quit. This is the function called by external objects to quit a player. It avoids checks for things like being in combat.
                                                                                                                                      • Returns:
                                                                                                                                        0 if it failed, non zero if it succeeded.
                                                                                                                                      • See also:
                                                                                                                                        do_quit(), quit_alt() and efun::command()
                                                                                                                                          quit_alt
                                                                                                                                          int quit_alt(int verbose)
                                                                                                                                          

                                                                                                                                          This is the quit code called by the command 'quit'
                                                                                                                                          • Returns:
                                                                                                                                            1 if successful, 0 if failed
                                                                                                                                          • See also:
                                                                                                                                            quit() and do_quit()
                                                                                                                                              remove_ghost
                                                                                                                                              void remove_ghost()
                                                                                                                                              

                                                                                                                                              This method removes the ghost from the player. This stops them being a ghost and turns them back into a real person.
                                                                                                                                              • See also:
                                                                                                                                                second_life()
                                                                                                                                                  remove_title
                                                                                                                                                  void remove_title(string type)
                                                                                                                                                  

                                                                                                                                                  This method removes the title of the given type from the title mapping.
                                                                                                                                                  • Parameters:
                                                                                                                                                    type - the type of title to remove
                                                                                                                                                  • See also:
                                                                                                                                                    query_title(), set_title() and remove_title()
                                                                                                                                                      restart_heart_beat
                                                                                                                                                      int restart_heart_beat()
                                                                                                                                                      

                                                                                                                                                      Restarts their heartbeat if it has got turned off for some reason.
                                                                                                                                                      • Returns:
                                                                                                                                                        always returns 1
                                                                                                                                                          run_away
                                                                                                                                                          int run_away()
                                                                                                                                                          

                                                                                                                                                          Called when the player wimpys out of a place. This does all the run away stuff anfd things like that.
                                                                                                                                                          • Returns:
                                                                                                                                                            1 if succeeded in running away, 0 if not
                                                                                                                                                              save
                                                                                                                                                              nomask int save()
                                                                                                                                                              

                                                                                                                                                              This method is deprecated.
                                                                                                                                                              • Returns:
                                                                                                                                                                always returns 1
                                                                                                                                                              • See also:
                                                                                                                                                                save_me()
                                                                                                                                                                  save_me
                                                                                                                                                                  void save_me()
                                                                                                                                                                  

                                                                                                                                                                  Saves the player. Saves the player to disc, doing all the autoload stuff and such like.
                                                                                                                                                                  • See also:
                                                                                                                                                                    save()
                                                                                                                                                                      save_with_auto_load
                                                                                                                                                                      void save_with_auto_load(mixed al)
                                                                                                                                                                      
                                                                                                                                                                        second_life
                                                                                                                                                                        mixed second_life()
                                                                                                                                                                        

                                                                                                                                                                        This method is called when the player dies. It creates the corpse and handles all the bits and pieces that should be dealth with when a player dies.

                                                                                                                                                                        If this method returns 0 then the automatic death handling code in the living object is used instead of this.

                                                                                                                                                                        • Returns:
                                                                                                                                                                          always returns 1
                                                                                                                                                                            set_monitor
                                                                                                                                                                            void set_monitor(int i)
                                                                                                                                                                            

                                                                                                                                                                            Set the hit point minitor. This sets the value of the hit point monitor flag. If it is set to 0, the monitor is turned off. If it is set to 1 the monitor is turned on, higher values cause the monitor to be displayed every N heartbeats.
                                                                                                                                                                            • Parameters:
                                                                                                                                                                              i - the new value for the hit point monitor flag
                                                                                                                                                                                set_title
                                                                                                                                                                                void set_title(string type,
                                                                                                                                                                                               string title)
                                                                                                                                                                                

                                                                                                                                                                                This method sets the current title type to be of a certain name.
                                                                                                                                                                                • Parameters:
                                                                                                                                                                                  type - the type of title to set
                                                                                                                                                                                  title - the string to set it to
                                                                                                                                                                                • See also:
                                                                                                                                                                                  query_title(), set_title() and remove_title()
                                                                                                                                                                                    toggle_wimpy
                                                                                                                                                                                    int toggle_wimpy(string str)
                                                                                                                                                                                    

                                                                                                                                                                                    This method changes the current value of the wimpy variables.
                                                                                                                                                                                    • Parameters:
                                                                                                                                                                                      str - the new value of the wimpy variable
                                                                                                                                                                                    • Returns:
                                                                                                                                                                                      0 on failure and 1 on success

                                                                                                                                                                                      Protected Functions

                                                                                                                                                                                      These are functions that only objects inheriting the class can access.

                                                                                                                                                                                        set_max_deaths
                                                                                                                                                                                        void set_max_deaths(int i)
                                                                                                                                                                                        

                                                                                                                                                                                        Sets the maximum number of deaths. This sets the maximum number of times a player can die.
                                                                                                                                                                                        • Parameters:
                                                                                                                                                                                          i - the nukber of deaths to set it to
                                                                                                                                                                                        • See also:
                                                                                                                                                                                          adjust_max_deaths()
                                                                                                                                                                                            write_prompt
                                                                                                                                                                                            void write_prompt()
                                                                                                                                                                                            

                                                                                                                                                                                            Classes

                                                                                                                                                                                            These are nice data types for dealing with... Data!

                                                                                                                                                                                            • player_info
                                                                                                                                                                                              class player_info {
                                                                                                                                                                                                                  int hb_num;
                                                                                                                                                                                                                  int level;
                                                                                                                                                                                                                  int level_time;
                                                                                                                                                                                                                  int save_inhibit;
                                                                                                                                                                                                                  int update_tmps_call_out;
                                                                                                                                                                                                                  int last_save;
                                                                                                                                                                                                                  object snoopee;
                                                                                                                                                                                                                  mapping titles;
                                                                                                                                                                                              }
                                                                                                                                                                                              
                                                                                                                                                                                              
Valid HTML 4.01 Transitional
Valid CSS!
Read More