Affects screen for spell affects [by Jon Barrett]
Snippet Posted Wednesday, August 12th @ 11:23:36 PM, by George Greer in the Commands dept.
Added Jul 6, 1998. Click the link below to read it or download it.

From: Jon Barrett <mizzrym@hotmail.com>
Subject: Affects screen for spell affects

  This small function will display a well organized list of all of the players
spell affects.  It will only display spell/skill affect, ie: no flags or object
affects.  The information will get more specific as the char gains levels.
There are 4 states, currently they are:
  level   1-6: will show only the spell name
  level  7-13: will show the spell name, how many applies it has and  the



   duration of the spell
  level 14-20: will show all of the abov plus the apply name
  level   20+: will show all of the above plus the added AFF_X bit

  To change the levels for the states, just change the number at each stage
to the minimum level of the char for that stage.  Each stage is marked.

To add this function:

Add the following to act.informative.c:

// Affects screen for spell affects {Jon Barrett, mizzrym@hotmail.com, 26APR98}
ACMD(do_affects)
{

struct affected_type* af;

int type=1;

char sname[256];

char added_aff[MAX_STRING_LENGTH];

extern char *spells[];

extern char *apply_types[];

extern char *affected_bits[];


send_to_char("You carry these affections: \r\n", ch);


for (af = ch->affected; af; af = af->next) {





strcpy(sname, spells[af->type]);


strcat(sname, ":");


if (GET_LEVEL(ch) >= 7) {  // first state is here



sprintf(buf, "   %s%-22s%s    affects %s%s%s by %s%d%s for %s%d%s hours\r\n",




CCCYN(ch, C_NRM),
(type ? sname : ""), CCNRM(ch, C_NRM),




CCCYN(ch, C_NRM),




((GET_LEVEL(ch)>=14 && af->location) ? apply_types[af->location] : "Something")
,  // second state is here




CCNRM(ch, C_NRM),




CCCYN(ch, C_NRM), af->modifier, CCNRM(ch, C_NRM),




CCCYN(ch, C_NRM), af->duration, CCNRM(ch, C_NRM));






send_to_char(buf, ch);



if (GET_LEVEL(ch) >= 21 && (af->bitvector && (!af->next || af->next->bitvector
!= af->bitvector))) {  // third state is here




sprintbit(af->bitvector, affected_bits, added_aff);




sprintf(buf1, "%35sadds %s%s\r\n", CCCYN(ch, C_NRM), added_aff, CCNRM(ch, C_NRM
));




send_to_char(buf1, ch);



}


}


else if (type){



sprintf(buf, "   %s%-25s%s\r\n", CCCYN(ch, C_NRM), sname, CCNRM(ch, C_NRM));



send_to_char(buf, ch);


}


type = af->next ? (af->next->type != af->type) : 1;

}
}

Add this to the function declarations in interpreter.c:

ACMD(do_affects);

Finally add this to the command table in interpreter.c:

{ "affects"  , POS_DEAD    , do_affects  , 0, 0 },

That should do it.  This code was tested, and it worked fine, but I am not
responsible for any problem it may cause.  Hope you like it.



<< Add Object Applies [by Frollo] | Reply | View as text | Threaded | AFK Code [by Mark Komus] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.