From thunder1@fast.net Thu Apr  2 15:52:53 1998
Date: Sun, 08 Feb 1998 00:47:50 -0500
From: Thunder <thunder1@fast.net>
To: Steve K Martell <smartell@mail.valpo.edu>
Cc: rom@rom.org
Subject: [Code] Sorted Who list
Resent-Date: Sat, 7 Feb 1998 21:48:42 -0800 (PST)
Resent-From: rom@rom.org

Steve K Martell wrote:
> 
> I know this is something very trivial, but I'm hoping someone out there
> has a version of do_who that lists the players by descending level (i.e.,
> Imms at the top, level 1s at the bottom) that they would be willing to
> share.  Anyone?
> 
> SM

The following is for a sorted who list from highest to lowest level.
It's not really as difficult as it sounds... here's what you need to do:
Note:  ++ stands for code you need to add.
       The other lines of code are code already in the function.

-----------------------------------------------------------------------
Use this code as you wish following all the ROM licenses and such.
I hold no liability for anything that happens to you or your system
as a result of using this either. (Gotta cover my ass)

And if you have a helpfile somewhere giving credit to code snips ya use
I wouldn't mind an entry there for myself. ;)  But no biggie if ya
don't.

Feel free to put this on any webpage or whatever, all that I ask is
if you put this on a webpage that you email me of the fact and also
if you decide to use this code I would appreciate an email as well.
Reason simply is because I like to keep record of such things.
I know it's no major code feat here, but it's my addition. :)
-----------------------------------------------------------------------


/*
 * New 'who' command originally by Alander of Rivers of Mud.
 */
void do_who( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    char buf2[MAX_STRING_LENGTH];
    BUFFER *output;
    DESCRIPTOR_DATA *d;
++  int wlevel;
    int iClass;
    int iRace;
    int iClan;
    int iLevelLower;
    int iLevelUpper;
    int nNumber;

------> Skipping down to next code segment <------

    /*
     * Now show matching chars.
     */
    nMatch = 0;
    buf[0] = '\0';
    output = new_buf();

++  /* Thunder -- Beginning for-loop for sorted who */
++  for( wlevel=MAX_LEVEL; wlevel>0; wlevel-- )
++  {
    for ( d = descriptor_list; d != NULL; d = d->next )
    {
        CHAR_DATA *wch;
        char const *class;
 
        /*
         * Check for match against restrictions.
         * Don't use trust as that exposes trusted mortals.
         */
        if ( d->connected != CON_PLAYING || !can_see( ch, d->character )
)
            continue;


------> Skipping down to next code segment <------

	    clan_table[wch->clan].who_name,
	    IS_SET(wch->comm, COMM_AFK) ? "[AFK] " : "",
            IS_SET(wch->act, PLR_KILLER) ? "(KILLER) " : "",
            IS_SET(wch->act, PLR_THIEF)  ? "(THIEF) "  : "",
	    wch->name,
	    IS_NPC(wch) ? "" : wch->pcdata->title );
	add_buf(output,buf);
    }
++  } /* End of wlevel for-loop for sorted who */

    sprintf( buf2, "\n\rPlayers found: %d\n\r", nMatch );
    add_buf(output,buf2);
    page_to_char( buf_string(output), ch );
    free_buf(output);
    return;
}


---
ROM Mailing List  --  To unsubscribe mail "unsubscribe" to rom-request@rom.org
           For help with SmartList features mail "help" to rom-request@rom.org
From thunder1@fast.net Thu Apr  2 15:53:39 1998
Date: Sun, 08 Feb 1998 02:50:01 -0500
From: Thunder <thunder1@fast.net>
To: rom@rom.org
Subject: [Code] Sorted Who list (Problem fixed)
Resent-Date: Sat, 7 Feb 1998 23:50:40 -0800 (PST)
Resent-From: rom@rom.org

Thanks Zanthras...

	I apologize for this reposting, but Zanthras pointed out that
it wasn't working and well sure enough somehow the most important part
of the entire code was left out... the if check!  Again sorry for that
inconvenience.... this code will now deffinately work. :)
 
	-- Thunder
	-------+--  The Shadowy Wastelands  --+-------
	telnet://wastelands.dirt.org:9000
	http://www.sagelink.net/~wizard

 -----------------------------------------------------------------------

The following is for a sorted who list from highest to lowest level.
 It's not really as difficult as it sounds... here's what you need to do
 Note:  ++ stands for code you need to add.
        The other lines of code are code already in the function.
 
 -----------------------------------------------------------------------
 Use this code as you wish following all the ROM licenses and such.
 I hold no liability for anything that happens to you or your system
 as a result of using this either. (Gotta cover my ass)
 
 And if you have a helpfile somewhere giving credit to code snips ya use
 I wouldn't mind an entry there for myself. ;)  But no biggie if ya
 don't.
 
 Feel free to put this on any webpage or whatever, all that I ask is
 if you put this on a webpage that you email me of the fact and also
 if you decide to use this code I would appreciate an email as well.
 Reason simply is because I like to keep record of such things.
 I know it's no major code feat here, but it's my addition. :)
 -----------------------------------------------------------------------
 
 /*
  * New 'who' command originally by Alander of Rivers of Mud.
  */
 void do_who( CHAR_DATA *ch, char *argument )
 {
     char buf[MAX_STRING_LENGTH];
     char buf2[MAX_STRING_LENGTH];
     BUFFER *output;
     DESCRIPTOR_DATA *d;
 ++  int wlevel;
     int iClass;
     int iRace;
     int iClan;
     int iLevelLower;
     int iLevelUpper;
     int nNumber;
 
 ------> Skipping down to next code segment <------
 
     /*
      * Now show matching chars.
      */
     nMatch = 0;
     buf[0] = '\0';
     output = new_buf();
 
 ++  /* Thunder -- Beginning for-loop for sorted who */
 ++  for( wlevel=MAX_LEVEL; wlevel>0; wlevel-- )
 ++  {
     for ( d = descriptor_list; d != NULL; d = d->next )
     {
         CHAR_DATA *wch;
         char const *class;
 
         /*
          * Check for match against restrictions.
          * Don't use trust as that exposes trusted mortals.
          */
         if ( d->connected != CON_PLAYING || !can_see( ch, d->character
) )
             continue;

        wch   = ( d->original != NULL ) ? d->original : d->character;

 ++     if( wch->level != level )
 ++	   continue;

	if (!can_see(ch,wch) || !IS_IMMORTAL(wch) )
	    continue;


 
 ------> Skipping down to next code segment <------
 
             clan_table[wch->clan].who_name,
             IS_SET(wch->comm, COMM_AFK) ? "[AFK] " : "",
             IS_SET(wch->act, PLR_KILLER) ? "(KILLER) " : "",
             IS_SET(wch->act, PLR_THIEF)  ? "(THIEF) "  : "",
             wch->name,
             IS_NPC(wch) ? "" : wch->pcdata->title );
         add_buf(output,buf);
     }
 ++  } /* End of wlevel for-loop for sorted who */
 
     sprintf( buf2, "\n\rPlayers found: %d\n\r", nMatch );
     add_buf(output,buf2);
     page_to_char( buf_string(output), ch );
     free_buf(output);
     return;
 }


---
ROM Mailing List  --  To unsubscribe mail "unsubscribe" to rom-request@rom.org
           For help with SmartList features mail "help" to rom-request@rom.org
From thunder1@fast.net Thu Apr  2 15:53:48 1998
Date: Sun, 08 Feb 1998 02:54:46 -0500
From: Thunder <thunder1@fast.net>
To: rom list <rom@rom.org>
Subject: [Code] Sorted Who list (Typo fixed)
Resent-Date: Sat, 7 Feb 1998 23:55:25 -0800 (PST)
Resent-From: rom@rom.org

Damn it.. sorry about this but I typoed that last post in the code..
the check was wch->level != level when it should be wch->level !=
wlevel..
Well at least you can't say I never post. :P

         -- Thunder
         -------+--  The Shadowy Wastelands  --+-------
         telnet://wastelands.dirt.org:9000
         http://www.sagelink.net/~wizard
 
 
-----------------------------------------------------------------------
 
 The following is for a sorted who list from highest to lowest level.
  It's not really as difficult as it sounds... here's what you need to
do
  Note:  ++ stands for code you need to add.
         The other lines of code are code already in the function.
 
 
-----------------------------------------------------------------------
  Use this code as you wish following all the ROM licenses and such.
  I hold no liability for anything that happens to you or your system
  as a result of using this either. (Gotta cover my ass)
 
  And if you have a helpfile somewhere giving credit to code snips ya
use
  I wouldn't mind an entry there for myself. ;)  But no biggie if ya
  don't.
 
  Feel free to put this on any webpage or whatever, all that I ask is
  if you put this on a webpage that you email me of the fact and also
  if you decide to use this code I would appreciate an email as well.
  Reason simply is because I like to keep record of such things.
  I know it's no major code feat here, but it's my addition. :)
 
-----------------------------------------------------------------------
 
  /*
   * New 'who' command originally by Alander of Rivers of Mud.
   */
  void do_who( CHAR_DATA *ch, char *argument )
  {
      char buf[MAX_STRING_LENGTH];
      char buf2[MAX_STRING_LENGTH];
      BUFFER *output;
      DESCRIPTOR_DATA *d;
  ++  int wlevel;
      int iClass;
      int iRace;
      int iClan;
      int iLevelLower;
      int iLevelUpper;
      int nNumber;
 
  ------> Skipping down to next code segment <------
 
      /*
       * Now show matching chars.
       */
      nMatch = 0;
      buf[0] = '\0';
      output = new_buf();
 
  ++  /* Thunder -- Beginning for-loop for sorted who */
  ++  for( wlevel=MAX_LEVEL; wlevel>0; wlevel-- )
  ++  {
      for ( d = descriptor_list; d != NULL; d = d->next )
      {
          CHAR_DATA *wch;
          char const *class;
 
          /*
           * Check for match against restrictions.
           * Don't use trust as that exposes trusted mortals.
           */
          if ( d->connected != CON_PLAYING || !can_see( ch, d->character
) )
              continue;
 
         wch   = ( d->original != NULL ) ? d->original : d->character;
 
  ++     if( wch->level != wlevel )
  ++        continue;
 
         if (!can_see(ch,wch) || !IS_IMMORTAL(wch) )
             continue;
 
 
  ------> Skipping down to next code segment <------
 
              clan_table[wch->clan].who_name,
              IS_SET(wch->comm, COMM_AFK) ? "[AFK] " : "",
              IS_SET(wch->act, PLR_KILLER) ? "(KILLER) " : "",
              IS_SET(wch->act, PLR_THIEF)  ? "(THIEF) "  : "",
              wch->name,
              IS_NPC(wch) ? "" : wch->pcdata->title );
          add_buf(output,buf);
      }
  ++  } /* End of wlevel for-loop for sorted who */
 
      sprintf( buf2, "\n\rPlayers found: %d\n\r", nMatch );
      add_buf(output,buf2);
      page_to_char( buf_string(output), ch );
      free_buf(output);
      return;
  }


---
ROM Mailing List  --  To unsubscribe mail "unsubscribe" to rom-request@rom.org
           For help with SmartList features mail "help" to rom-request@rom.org