st_at.c

skylib_fluffos_v3/mudlib/cmds/creator/st_at.c · 1.4 KB

From the archive skylib_fluffos_v3.zip

Download the archive   « Back to the archive contents

#include <creator.h>

inherit COMMAND_BASE;

/** @ignore yes */
int cmd( string str ) {
    object *ob, thing;
    mixed ob1, thing1;
    string s, bing;
    string long_fields, temp;
    int long_length, cols;

    bing = "";
    cols = (int)TP->query_cols();
    str = (string)TP->expand_nickname( str );
    ob = WIZ_PRESENT->wiz_present( str, TP );

    if( !sizeof(ob) ) {
        write("No such object.\n");
        return 1;
    }

    foreach( thing in ob ) {
        if( !pointerp( ob1 = (mixed)thing->stats() ) ) {
            bing += "No stats available for "+
                WIZ_PRESENT->desc_f_object(thing)+".\n";
            continue;
        }

        s = "";
        long_fields = "";
        long_length = ( cols / 3 ) - 1;

        foreach( thing1 in ( pointerp(ob1[0][0] ) ? ob1[0] : ob1 ) ) {
            if( thing1[1] ) {
                temp = thing1[0]+": "+sprintf("%O", thing1[1] )+"\n";
                if( strlen(temp) > long_length )
                    long_fields += temp;
                else
                    s += temp;
            }
        }

        if( s == "" && long_fields == "")
            bing += "No stats available for "+
                WIZ_PRESENT->desc_f_object(thing)+".\n";
        else
            bing += sprintf("%-*#s\n", cols, long_fields )+
                    sprintf("%-*#s\n", cols, s );
    }

    TP->more_string( bing, "Stat");
    return 1;

} /* cmd() */

Site Stats

Snippets: 1791
Codebases: 571