gp.c

skylib_mudos_v1/mudlib/cmds/player/gp.c · 1.5 KB

From the archive skylib_mudos_v1.tar.gz

Download the archive   « Back to the archive contents

/*
 * Original by Manshoon of Newmoon in February 1995
 * Rewritten for Discworld by Deutha in March 1995
 */

/*
 * This command shows a player how many of their guild points are
 * available for use for different commands. With commands using
 * query_specific_gp( string type ) instead of the straight query_gp()
 * the various stupid paradoxes of the old system will be avoided by
 * making sure that a player's available points for a given command
 * depend on the points skill most relevant.
 */

#include <skills.h>

inherit COMMAND_BASE;


int cmd() {
   int i, gp, max_gp, other_gp;
   gp = (int)this_player()->query_gp();
   max_gp = (int)this_player()->query_max_gp();
   write( "You have "+ gp +" ("+ max_gp +") guild points.\n" );
   for ( i = 0; i < sizeof( STD_SKILLS ); i += SKILL_ARR_SIZE ) {
      other_gp = (int)this_player()->query_skill_bonus( STD_SKILLS[ i ]
            +".points" ) + 50;
      if ( other_gp >= max_gp ) {
         write( "* All of your guild points can be used for "+
               STD_SKILLS[ i ] +" commands.\n" );
         continue;
      }
      if ( gp + other_gp <= max_gp ) {
         write( "* You cannot use any guild points for "+
               STD_SKILLS[ i ] +" commands until\n    your points "+
               "reach "+ ( max_gp - other_gp ) +".\n" );     
         continue;
      }
      write( "* You can use "+ ( gp + other_gp - max_gp ) +" ("+ other_gp +
            ") for "+ STD_SKILLS[ i ] +" commands.\n" );
   }
   return 1;
} /* cmd() */

Site Stats

Snippets: 1791
Codebases: 571