Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

handler.c File Reference

#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "magic.h"
#include "recycle.h"
#include "tables.h"

Include dependency graph for handler.c:

Go to the source code of this file.

Functions

char * act_bit_name (int act_flags)
char * affect_bit_name (int vector)
void affect_check (CHAR_DATA *ch, int where, int vector)
void affect_enchant (OBJ_DATA *obj)
AFFECT_DATAaffect_find (AFFECT_DATA *paf, int sn)
void affect_join (CHAR_DATA *ch, AFFECT_DATA *paf)
char * affect_loc_name (int location)
void affect_modify (CHAR_DATA *ch, AFFECT_DATA *paf, bool fAdd)
void affect_remove (CHAR_DATA *ch, AFFECT_DATA *paf)
void affect_remove_obj (OBJ_DATA *obj, AFFECT_DATA *paf)
void affect_strip (CHAR_DATA *ch, int sn)
void affect_to_char (CHAR_DATA *ch, AFFECT_DATA *paf)
void affect_to_obj (OBJ_DATA *obj, AFFECT_DATA *paf)
void all_colour (CHAR_DATA *ch, char *argument)
int apply_ac (OBJ_DATA *obj, int iWear, int type)
void affect_modify args ((CHAR_DATA *ch, AFFECT_DATA *paf, bool fAdd))
int attack_lookup (const char *name)
int can_carry_n (CHAR_DATA *ch)
int can_carry_w (CHAR_DATA *ch)
bool can_drop_obj (CHAR_DATA *ch, OBJ_DATA *obj)
bool can_see (CHAR_DATA *ch, CHAR_DATA *victim)
bool can_see_obj (CHAR_DATA *ch, OBJ_DATA *obj)
bool can_see_room (CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex)
void char_from_room (CHAR_DATA *ch)
void char_to_room (CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex)
int check_immune (CHAR_DATA *ch, int dam_type)
int class_lookup (const char *name)
char * comm_bit_name (int comm_flags)
char * cont_bit_name (int cont_flags)
int count_obj_list (OBJ_INDEX_DATA *pObjIndex, OBJ_DATA *list)
int count_users (OBJ_DATA *obj)
OBJ_DATAcreate_money (int gold, int silver)
void deduct_cost (CHAR_DATA *ch, int cost)
void default_colour (CHAR_DATA *ch)
void equip_char (CHAR_DATA *ch, OBJ_DATA *obj, int iWear)
char * extra_bit_name (int extra_flags)
void extract_char (CHAR_DATA *ch, bool fPull)
void extract_obj (OBJ_DATA *obj)
char * form_bit_name (int form_flags)
int get_age (CHAR_DATA *ch)
CHAR_DATAget_char_room (CHAR_DATA *ch, char *argument)
CHAR_DATAget_char_world (CHAR_DATA *ch, char *argument)
int get_curr_stat (CHAR_DATA *ch, int stat)
OBJ_DATAget_eq_char (CHAR_DATA *ch, int iWear)
int get_max_train (CHAR_DATA *ch, int stat)
OBJ_DATAget_obj_carry (CHAR_DATA *ch, char *argument, CHAR_DATA *viewer)
OBJ_DATAget_obj_here (CHAR_DATA *ch, char *argument)
OBJ_DATAget_obj_list (CHAR_DATA *ch, char *argument, OBJ_DATA *list)
int get_obj_number (OBJ_DATA *obj)
OBJ_DATAget_obj_type (OBJ_INDEX_DATA *pObjIndex)
OBJ_DATAget_obj_wear (CHAR_DATA *ch, char *argument)
int get_obj_weight (OBJ_DATA *obj)
OBJ_DATAget_obj_world (CHAR_DATA *ch, char *argument)
int get_skill (CHAR_DATA *ch, int sn)
int get_true_weight (OBJ_DATA *obj)
int get_trust (CHAR_DATA *ch)
int get_weapon_skill (CHAR_DATA *ch, int sn)
int get_weapon_sn (CHAR_DATA *ch)
char * imm_bit_name (int imm_flags)
bool is_affected (CHAR_DATA *ch, int sn)
bool is_clan (CHAR_DATA *ch)
bool is_exact_name (char *str, char *namelist)
bool is_friend (CHAR_DATA *ch, CHAR_DATA *victim)
bool is_full_name (const char *str, char *namelist)
bool is_kingdom (CHAR_DATA *ch)
bool is_name (char *str, char *namelist)
bool is_old_mob (CHAR_DATA *ch)
bool is_room_owner (CHAR_DATA *ch, ROOM_INDEX_DATA *room)
bool is_same_clan (CHAR_DATA *ch, CHAR_DATA *victim)
bool is_same_kingdom (CHAR_DATA *ch, CHAR_DATA *victim)
char * item_name (int item_type)
int material_lookup (const char *name)
void obj_from_char (OBJ_DATA *obj)
void obj_from_obj (OBJ_DATA *obj)
void obj_from_room (OBJ_DATA *obj)
void obj_to_char (OBJ_DATA *obj, CHAR_DATA *ch)
void obj_to_obj (OBJ_DATA *obj, OBJ_DATA *obj_to)
void obj_to_room (OBJ_DATA *obj, ROOM_INDEX_DATA *pRoomIndex)
char * off_bit_name (int off_flags)
char * part_bit_name (int part_flags)
void reset_char (CHAR_DATA *ch)
bool room_is_dark (ROOM_INDEX_DATA *pRoomIndex)
bool room_is_private (ROOM_INDEX_DATA *pRoomIndex)
void unequip_char (CHAR_DATA *ch, OBJ_DATA *obj)
char * weapon_bit_name (int weapon_flags)
int weapon_lookup (const char *name)
char * weapon_name (int weapon_type)
int weapon_type (const char *name)
char * wear_bit_name (int wear_flags)
long wiznet_lookup (const char *name)


Function Documentation

char* act_bit_name int  act_flags  ) 
 

Definition at line 2954 of file handler.c.

References ACT_AGGRESSIVE, ACT_CLERIC, act_flags, ACT_GAIN, ACT_IS_CHANGER, ACT_IS_HEALER, ACT_IS_NPC, ACT_MAGE, ACT_NOALIGN, ACT_NOPURGE, ACT_PET, ACT_PRACTICE, ACT_SCAVENGER, ACT_SENTINEL, ACT_STAY_AREA, ACT_THIEF, ACT_TRAIN, ACT_UNDEAD, ACT_UPDATE_ALWAYS, ACT_WARRIOR, ACT_WIMPY, IS_SET, PLR_AUTOASSIST, PLR_AUTOEXIT, PLR_AUTOGOLD, PLR_AUTOLOOT, PLR_AUTOSAC, PLR_AUTOSPLIT, PLR_CANLOOT, PLR_FREEZE, PLR_HOLYLIGHT, PLR_KILLER, PLR_NOFOLLOW, PLR_NOSUMMON, and PLR_THIEF.

Referenced by do_mstat().

02955 {
02956     static char buf[512];
02957 
02958     buf[0] = '\0';
02959 
02960     if (IS_SET (act_flags, ACT_IS_NPC))
02961     {
02962         strcat (buf, " npc");
02963         if (act_flags & ACT_SENTINEL)
02964             strcat (buf, " sentinel");
02965         if (act_flags & ACT_SCAVENGER)
02966             strcat (buf, " scavenger");
02967         if (act_flags & ACT_AGGRESSIVE)
02968             strcat (buf, " aggressive");
02969         if (act_flags & ACT_STAY_AREA)
02970             strcat (buf, " stay_area");
02971         if (act_flags & ACT_WIMPY)
02972             strcat (buf, " wimpy");
02973         if (act_flags & ACT_PET)
02974             strcat (buf, " pet");
02975         if (act_flags & ACT_TRAIN)
02976             strcat (buf, " train");
02977         if (act_flags & ACT_PRACTICE)
02978             strcat (buf, " practice");
02979         if (act_flags & ACT_UNDEAD)
02980             strcat (buf, " undead");
02981         if (act_flags & ACT_CLERIC)
02982             strcat (buf, " cleric");
02983         if (act_flags & ACT_MAGE)
02984             strcat (buf, " mage");
02985         if (act_flags & ACT_THIEF)
02986             strcat (buf, " thief");
02987         if (act_flags & ACT_WARRIOR)
02988             strcat (buf, " warrior");
02989         if (act_flags & ACT_NOALIGN)
02990             strcat (buf, " no_align");
02991         if (act_flags & ACT_NOPURGE)
02992             strcat (buf, " no_purge");
02993         if (act_flags & ACT_IS_HEALER)
02994             strcat (buf, " healer");
02995         if (act_flags & ACT_IS_CHANGER)
02996             strcat (buf, " changer");
02997         if (act_flags & ACT_GAIN)
02998             strcat (buf, " skill_train");
02999         if (act_flags & ACT_UPDATE_ALWAYS)
03000             strcat (buf, " update_always");
03001     }
03002     else
03003     {
03004         strcat (buf, " player");
03005         if (act_flags & PLR_AUTOASSIST)
03006             strcat (buf, " autoassist");
03007         if (act_flags & PLR_AUTOEXIT)
03008             strcat (buf, " autoexit");
03009         if (act_flags & PLR_AUTOLOOT)
03010             strcat (buf, " autoloot");
03011         if (act_flags & PLR_AUTOSAC)
03012             strcat (buf, " autosac");
03013         if (act_flags & PLR_AUTOGOLD)
03014             strcat (buf, " autogold");
03015         if (act_flags & PLR_AUTOSPLIT)
03016             strcat (buf, " autosplit");
03017         if (act_flags & PLR_HOLYLIGHT)
03018             strcat (buf, " holy_light");
03019         if (act_flags & PLR_CANLOOT)
03020             strcat (buf, " loot_corpse");
03021         if (act_flags & PLR_NOSUMMON)
03022             strcat (buf, " no_summon");
03023         if (act_flags & PLR_NOFOLLOW)
03024             strcat (buf, " no_follow");
03025         if (act_flags & PLR_FREEZE)
03026             strcat (buf, " frozen");
03027         if (act_flags & PLR_THIEF)
03028             strcat (buf, " thief");
03029         if (act_flags & PLR_KILLER)
03030             strcat (buf, " killer");
03031     }
03032     return (buf[0] != '\0') ? buf + 1 : "none";
03033 }

char* affect_bit_name int  vector  ) 
 

Definition at line 2838 of file handler.c.

References AFF_BERSERK, AFF_BLIND, AFF_CALM, AFF_CHARM, AFF_CURSE, AFF_DARK_VISION, AFF_DETECT_EVIL, AFF_DETECT_GOOD, AFF_DETECT_HIDDEN, AFF_DETECT_INVIS, AFF_DETECT_MAGIC, AFF_FAERIE_FIRE, AFF_FLYING, AFF_HASTE, AFF_HIDE, AFF_INFRARED, AFF_INVISIBLE, AFF_PASS_DOOR, AFF_PLAGUE, AFF_POISON, AFF_PROTECT_EVIL, AFF_PROTECT_GOOD, AFF_SANCTUARY, AFF_SLEEP, AFF_SLOW, and AFF_SNEAK.

Referenced by do_mstat(), do_ostat(), and spell_identify().

02839 {
02840     static char buf[512];
02841 
02842     buf[0] = '\0';
02843     if (vector & AFF_BLIND)
02844         strcat (buf, " blind");
02845     if (vector & AFF_INVISIBLE)
02846         strcat (buf, " invisible");
02847     if (vector & AFF_DETECT_EVIL)
02848         strcat (buf, " detect_evil");
02849     if (vector & AFF_DETECT_GOOD)
02850         strcat (buf, " detect_good");
02851     if (vector & AFF_DETECT_INVIS)
02852         strcat (buf, " detect_invis");
02853     if (vector & AFF_DETECT_MAGIC)
02854         strcat (buf, " detect_magic");
02855     if (vector & AFF_DETECT_HIDDEN)
02856         strcat (buf, " detect_hidden");
02857     if (vector & AFF_SANCTUARY)
02858         strcat (buf, " sanctuary");
02859     if (vector & AFF_FAERIE_FIRE)
02860         strcat (buf, " faerie_fire");
02861     if (vector & AFF_INFRARED)
02862         strcat (buf, " infrared");
02863     if (vector & AFF_CURSE)
02864         strcat (buf, " curse");
02865     if (vector & AFF_POISON)
02866         strcat (buf, " poison");
02867     if (vector & AFF_PROTECT_EVIL)
02868         strcat (buf, " prot_evil");
02869     if (vector & AFF_PROTECT_GOOD)
02870         strcat (buf, " prot_good");
02871     if (vector & AFF_SLEEP)
02872         strcat (buf, " sleep");
02873     if (vector & AFF_SNEAK)
02874         strcat (buf, " sneak");
02875     if (vector & AFF_HIDE)
02876         strcat (buf, " hide");
02877     if (vector & AFF_CHARM)
02878         strcat (buf, " charm");
02879     if (vector & AFF_FLYING)
02880         strcat (buf, " flying");
02881     if (vector & AFF_PASS_DOOR)
02882         strcat (buf, " pass_door");
02883     if (vector & AFF_BERSERK)
02884         strcat (buf, " berserk");
02885     if (vector & AFF_CALM)
02886         strcat (buf, " calm");
02887     if (vector & AFF_HASTE)
02888         strcat (buf, " haste");
02889     if (vector & AFF_SLOW)
02890         strcat (buf, " slow");
02891     if (vector & AFF_PLAGUE)
02892         strcat (buf, " plague");
02893     if (vector & AFF_DARK_VISION)
02894         strcat (buf, " dark_vision");
02895     return (buf[0] != '\0') ? buf + 1 : "none";
02896 }

void affect_check CHAR_DATA ch,
int  where,
int  vector
 

Definition at line 1205 of file handler.c.

References obj_index_data::affected, obj_data::affected, affect_data::bitvector, obj_data::enchanted, affect_data::next, obj_data::next_content, obj_data::pIndexData, SET_BIT, TO_AFFECTS, TO_IMMUNE, TO_OBJECT, TO_RESIST, TO_VULN, TO_WEAPON, obj_data::wear_loc, and affect_data::where.

Referenced by affect_remove(), affect_remove_obj(), and unequip_char().

01206 {
01207     AFFECT_DATA *paf;
01208     OBJ_DATA *obj;
01209 
01210     if (where == TO_OBJECT || where == TO_WEAPON || vector == 0)
01211         return;
01212 
01213     for (paf = ch->affected; paf != NULL; paf = paf->next)
01214         if (paf->where == where && paf->bitvector == vector)
01215         {
01216             switch (where)
01217             {
01218                 case TO_AFFECTS:
01219                     SET_BIT (ch->affected_by, vector);
01220                     break;
01221                 case TO_IMMUNE:
01222                     SET_BIT (ch->imm_flags, vector);
01223                     break;
01224                 case TO_RESIST:
01225                     SET_BIT (ch->res_flags, vector);
01226                     break;
01227                 case TO_VULN:
01228                     SET_BIT (ch->vuln_flags, vector);
01229                     break;
01230             }
01231             return;
01232         }
01233 
01234     for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
01235     {
01236         if (obj->wear_loc == -1)
01237             continue;
01238 
01239         for (paf = obj->affected; paf != NULL; paf = paf->next)
01240             if (paf->where == where && paf->bitvector == vector)
01241             {
01242                 switch (where)
01243                 {
01244                     case TO_AFFECTS:
01245                         SET_BIT (ch->affected_by, vector);
01246                         break;
01247                     case TO_IMMUNE:
01248                         SET_BIT (ch->imm_flags, vector);
01249                         break;
01250                     case TO_RESIST:
01251                         SET_BIT (ch->res_flags, vector);
01252                         break;
01253                     case TO_VULN:
01254                         SET_BIT (ch->vuln_flags, vector);
01255 
01256                 }
01257                 return;
01258             }
01259 
01260         if (obj->enchanted)
01261             continue;
01262 
01263         for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
01264             if (paf->where == where && paf->bitvector == vector)
01265             {
01266                 switch (where)
01267                 {
01268                     case TO_AFFECTS:
01269                         SET_BIT (ch->affected_by, vector);
01270                         break;
01271                     case TO_IMMUNE:
01272                         SET_BIT (ch->imm_flags, vector);
01273                         break;
01274                     case TO_RESIST:
01275                         SET_BIT (ch->res_flags, vector);
01276                         break;
01277                     case TO_VULN:
01278                         SET_BIT (ch->vuln_flags, vector);
01279                         break;
01280                 }
01281                 return;
01282             }
01283     }
01284 }

void affect_enchant OBJ_DATA obj  ) 
 

Definition at line 1012 of file handler.c.

References affect_data::bitvector, affect_data::duration, affect_data::level, affect_data::location, affect_data::modifier, new_affect(), affect_data::next, TRUE, affect_data::type, UMAX, and affect_data::where.

Referenced by acid_effect().

01013 {
01014     /* okay, move all the old flags into new vectors if we have to */
01015     if (!obj->enchanted)
01016     {
01017         AFFECT_DATA *paf, *af_new;
01018         obj->enchanted = TRUE;
01019 
01020         for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
01021         {
01022             af_new = new_affect ();
01023 
01024             af_new->next = obj->affected;
01025             obj->affected = af_new;
01026 
01027             af_new->where = paf->where;
01028             af_new->type = UMAX (0, paf->type);
01029             af_new->level = paf->level;
01030             af_new->duration = paf->duration;
01031             af_new->location = paf->location;
01032             af_new->modifier = paf->modifier;
01033             af_new->bitvector = paf->bitvector;
01034         }
01035     }
01036 }

Here is the call graph for this function:

AFFECT_DATA* affect_find AFFECT_DATA paf,
int  sn
 

Definition at line 1191 of file handler.c.

References affect_data::next, and affect_data::type.

Referenced by char_update(), one_hit(), spell_bless(), and spell_curse().

01192 {
01193     AFFECT_DATA *paf_find;
01194 
01195     for (paf_find = paf; paf_find != NULL; paf_find = paf_find->next)
01196     {
01197         if (paf_find->type == sn)
01198             return paf_find;
01199     }
01200 
01201     return NULL;
01202 }

void affect_join CHAR_DATA ch,
AFFECT_DATA paf
 

Definition at line 1487 of file handler.c.

References affect_remove(), affect_to_char(), affect_data::duration, FALSE, affect_data::level, affect_data::modifier, affect_data::next, and affect_data::type.

Referenced by char_to_room(), char_update(), cold_effect(), do_drink(), do_eat(), one_hit(), poison_effect(), spell_chill_touch(), spell_plague(), spell_poison(), and spell_sleep().

01488 {
01489     AFFECT_DATA *paf_old;
01490     bool found;
01491 
01492     found = FALSE;
01493     for (paf_old = ch->affected; paf_old != NULL; paf_old = paf_old->next)
01494     {
01495         if (paf_old->type == paf->type)
01496         {
01497             paf->level = (paf->level += paf_old->level) / 2;
01498             paf->duration += paf_old->duration;
01499             paf->modifier += paf_old->modifier;
01500             affect_remove (ch, paf_old);
01501             break;
01502         }
01503     }
01504 
01505     affect_to_char (ch, paf);
01506     return;
01507 }

Here is the call graph for this function:

char* affect_loc_name int  location  ) 
 

Definition at line 2775 of file handler.c.

References APPLY_AC, APPLY_AGE, APPLY_CLASS, APPLY_CON, APPLY_DAMROLL, APPLY_DEX, APPLY_EXP, APPLY_GOLD, APPLY_HIT, APPLY_HITROLL, APPLY_INT, APPLY_LEVEL, APPLY_MANA, APPLY_MOVE, APPLY_NONE, APPLY_SAVES, APPLY_SAVING_BREATH, APPLY_SAVING_PETRI, APPLY_SAVING_ROD, APPLY_SAVING_SPELL, APPLY_SEX, APPLY_SPELL_AFFECT, APPLY_STR, APPLY_WIS, and bug().

Referenced by do_affects(), do_mstat(), do_ostat(), and spell_identify().

02776 {
02777     switch (location)
02778     {
02779         case APPLY_NONE:
02780             return "none";
02781         case APPLY_STR:
02782             return "strength";
02783         case APPLY_DEX:
02784             return "dexterity";
02785         case APPLY_INT:
02786             return "intelligence";
02787         case APPLY_WIS:
02788             return "wisdom";
02789         case APPLY_CON:
02790             return "constitution";
02791         case APPLY_SEX:
02792             return "sex";
02793         case APPLY_CLASS:
02794             return "class";
02795         case APPLY_LEVEL:
02796             return "level";
02797         case APPLY_AGE:
02798             return "age";
02799         case APPLY_MANA:
02800             return "mana";
02801         case APPLY_HIT:
02802             return "hp";
02803         case APPLY_MOVE:
02804             return "moves";
02805         case APPLY_GOLD:
02806             return "gold";
02807         case APPLY_EXP:
02808             return "experience";
02809         case APPLY_AC:
02810             return "armor class";
02811         case APPLY_HITROLL:
02812             return "hit roll";
02813         case APPLY_DAMROLL:
02814             return "damage roll";
02815         case APPLY_SAVES:
02816             return "saves";
02817         case APPLY_SAVING_ROD:
02818             return "save vs rod";
02819         case APPLY_SAVING_PETRI:
02820             return "save vs petrification";
02821         case APPLY_SAVING_BREATH:
02822             return "save vs breath";
02823         case APPLY_SAVING_SPELL:
02824             return "save vs spell";
02825         case APPLY_SPELL_AFFECT:
02826             return "none";
02827     }
02828 
02829     bug ("Affect_location_name: unknown location %d.", location);
02830     return "(unknown)";
02831 }

Here is the call graph for this function:

void affect_modify CHAR_DATA ch,
AFFECT_DATA paf,
bool  fAdd
 

Definition at line 1042 of file handler.c.

References act, APPLY_AC, APPLY_AGE, APPLY_CLASS, APPLY_CON, APPLY_DAMROLL, APPLY_DEX, APPLY_EXP, APPLY_GOLD, APPLY_HEIGHT, APPLY_HIT, APPLY_HITROLL, APPLY_INT, APPLY_LEVEL, APPLY_MANA, APPLY_MOVE, APPLY_NONE, APPLY_SAVES, APPLY_SAVING_BREATH, APPLY_SAVING_PETRI, APPLY_SAVING_ROD, APPLY_SAVING_SPELL, APPLY_SEX, APPLY_SPELL_AFFECT, APPLY_STR, APPLY_WEIGHT, APPLY_WIS, bug(), get_curr_stat(), get_eq_char(), get_obj_weight(), IS_NPC, affect_data::modifier, obj_from_char(), obj_to_room(), REMOVE_BIT, SET_BIT, STAT_CON, STAT_DEX, STAT_INT, STAT_STR, STAT_WIS, str_app, TO_AFFECTS, TO_CHAR, TO_IMMUNE, TO_RESIST, TO_ROOM, TO_VULN, and WEAR_WIELD.

Referenced by affect_remove(), affect_remove_obj(), affect_to_char(), equip_char(), and unequip_char().

01043 {
01044     OBJ_DATA *wield;
01045     int mod, i;
01046 
01047     mod = paf->modifier;
01048 
01049     if (fAdd)
01050     {
01051         switch (paf->where)
01052         {
01053             case TO_AFFECTS:
01054                 SET_BIT (ch->affected_by, paf->bitvector);
01055                 break;
01056             case TO_IMMUNE:
01057                 SET_BIT (ch->imm_flags, paf->bitvector);
01058                 break;
01059             case TO_RESIST:
01060                 SET_BIT (ch->res_flags, paf->bitvector);
01061                 break;
01062             case TO_VULN:
01063                 SET_BIT (ch->vuln_flags, paf->bitvector);
01064                 break;
01065         }
01066     }
01067     else
01068     {
01069         switch (paf->where)
01070         {
01071             case TO_AFFECTS:
01072                 REMOVE_BIT (ch->affected_by, paf->bitvector);
01073                 break;
01074             case TO_IMMUNE:
01075                 REMOVE_BIT (ch->imm_flags, paf->bitvector);
01076                 break;
01077             case TO_RESIST:
01078                 REMOVE_BIT (ch->res_flags, paf->bitvector);
01079                 break;
01080             case TO_VULN:
01081                 REMOVE_BIT (ch->vuln_flags, paf->bitvector);
01082                 break;
01083         }
01084         mod = 0 - mod;
01085     }
01086 
01087     switch (paf->location)
01088     {
01089         default:
01090             bug ("Affect_modify: unknown location %d.", paf->location);
01091             return;
01092 
01093         case APPLY_NONE:
01094             break;
01095         case APPLY_STR:
01096             ch->mod_stat[STAT_STR] += mod;
01097             break;
01098         case APPLY_DEX:
01099             ch->mod_stat[STAT_DEX] += mod;
01100             break;
01101         case APPLY_INT:
01102             ch->mod_stat[STAT_INT] += mod;
01103             break;
01104         case APPLY_WIS:
01105             ch->mod_stat[STAT_WIS] += mod;
01106             break;
01107         case APPLY_CON:
01108             ch->mod_stat[STAT_CON] += mod;
01109             break;
01110         case APPLY_SEX:
01111             ch->sex += mod;
01112             break;
01113         case APPLY_CLASS:
01114             break;
01115         case APPLY_LEVEL:
01116             break;
01117         case APPLY_AGE:
01118             break;
01119         case APPLY_HEIGHT:
01120             break;
01121         case APPLY_WEIGHT:
01122             break;
01123         case APPLY_MANA:
01124             ch->max_mana += mod;
01125             break;
01126         case APPLY_HIT:
01127             ch->max_hit += mod;
01128             break;
01129         case APPLY_MOVE:
01130             ch->max_move += mod;
01131             break;
01132         case APPLY_GOLD:
01133             break;
01134         case APPLY_EXP:
01135             break;
01136         case APPLY_AC:
01137             for (i = 0; i < 4; i++)
01138                 ch->armor[i] += mod;
01139             break;
01140         case APPLY_HITROLL:
01141             ch->hitroll += mod;
01142             break;
01143         case APPLY_DAMROLL:
01144             ch->damroll += mod;
01145             break;
01146         case APPLY_SAVES:
01147             ch->saving_throw += mod;
01148             break;
01149         case APPLY_SAVING_ROD:
01150             ch->saving_throw += mod;
01151             break;
01152         case APPLY_SAVING_PETRI:
01153             ch->saving_throw += mod;
01154             break;
01155         case APPLY_SAVING_BREATH:
01156             ch->saving_throw += mod;
01157             break;
01158         case APPLY_SAVING_SPELL:
01159             ch->saving_throw += mod;
01160             break;
01161         case APPLY_SPELL_AFFECT:
01162             break;
01163     }
01164 
01165     /*
01166      * Check for weapon wielding.
01167      * Guard against recursion (for weapons with affects).
01168      */
01169     if (!IS_NPC (ch) && (wield = get_eq_char (ch, WEAR_WIELD)) != NULL
01170         && get_obj_weight (wield) >
01171         (str_app[get_curr_stat (ch, STAT_STR)].wield * 10))
01172     {
01173         static int depth;
01174 
01175         if (depth == 0)
01176         {
01177             depth++;
01178             act ("You drop $p.", ch, wield, NULL, TO_CHAR);
01179             act ("$n drops $p.", ch, wield, NULL, TO_ROOM);
01180             obj_from_char (wield);
01181             obj_to_room (wield, ch->in_room);
01182             depth--;
01183         }
01184     }
01185 
01186     return;
01187 }

Here is the call graph for this function:

void affect_remove CHAR_DATA ch,
AFFECT_DATA paf
 

Definition at line 1340 of file handler.c.

References affect_check(), affect_modify(), affect_data::bitvector, bug(), FALSE, free_affect(), affect_data::next, and affect_data::where.

Referenced by affect_join(), affect_strip(), char_update(), free_char(), raw_kill(), and unequip_char().

01341 {
01342     int where;
01343     int vector;
01344 
01345     if (ch->affected == NULL)
01346     {
01347         bug ("Affect_remove: no affect.", 0);
01348         return;
01349     }
01350 
01351     affect_modify (ch, paf, FALSE);
01352     where = paf->where;
01353     vector = paf->bitvector;
01354 
01355     if (paf == ch->affected)
01356     {
01357         ch->affected = paf->next;
01358     }
01359     else
01360     {
01361         AFFECT_DATA *prev;
01362 
01363         for (prev = ch->affected; prev != NULL; prev = prev->next)
01364         {
01365             if (prev->next == paf)
01366             {
01367                 prev->next = paf->next;
01368                 break;
01369             }
01370         }
01371 
01372         if (prev == NULL)
01373         {
01374             bug ("Affect_remove: cannot find paf.", 0);
01375             return;
01376         }
01377     }
01378 
01379     free_affect (paf);
01380 
01381     affect_check (ch, where, vector);
01382     return;
01383 }

Here is the call graph for this function:

void affect_remove_obj OBJ_DATA obj,
AFFECT_DATA paf
 

Definition at line 1385 of file handler.c.

References affect_check(), affect_modify(), affect_data::bitvector, bug(), FALSE, free_affect(), ITEM_WEAPON, affect_data::next, REMOVE_BIT, TO_OBJECT, TO_WEAPON, and affect_data::where.

Referenced by obj_update(), spell_bless(), and spell_curse().

01386 {
01387     int where, vector;
01388     if (obj->affected == NULL)
01389     {
01390         bug ("Affect_remove_object: no affect.", 0);
01391         return;
01392     }
01393 
01394     if (obj->carried_by != NULL && obj->wear_loc != -1)
01395         affect_modify (obj->carried_by, paf, FALSE);
01396 
01397     where = paf->where;
01398     vector = paf->bitvector;
01399 
01400     /* remove flags from the object if needed */
01401     if (paf->bitvector)
01402         switch (paf->where)
01403         {
01404             case TO_OBJECT:
01405                 REMOVE_BIT (obj->extra_flags, paf->bitvector);
01406                 break;
01407             case TO_WEAPON:
01408                 if (obj->item_type == ITEM_WEAPON)
01409                     REMOVE_BIT (obj->value[4], paf->bitvector);
01410                 break;
01411         }
01412 
01413     if (paf == obj->affected)
01414     {
01415         obj->affected = paf->next;
01416     }
01417     else
01418     {
01419         AFFECT_DATA *prev;
01420 
01421         for (prev = obj->affected; prev != NULL; prev = prev->next)
01422         {
01423             if (prev->next == paf)
01424             {
01425                 prev->next = paf->next;
01426                 break;
01427             }
01428         }
01429 
01430         if (prev == NULL)
01431         {
01432             bug ("Affect_remove_object: cannot find paf.", 0);
01433             return;
01434         }
01435     }
01436 
01437     free_affect (paf);
01438 
01439     if (obj->carried_by != NULL && obj->wear_loc != -1)
01440         affect_check (obj->carried_by, where, vector);
01441     return;
01442 }

Here is the call graph for this function:

void affect_strip CHAR_DATA ch,
int  sn
 

Definition at line 1449 of file handler.c.

References affect_remove(), affect_data::next, and affect_data::type.

Referenced by check_dispel(), check_killer(), damage(), do_land(), do_restore(), do_sneak(), do_steal(), do_visible(), set_fighting(), spell_faerie_fog(), and stop_follower().

01450 {
01451     AFFECT_DATA *paf;
01452     AFFECT_DATA *paf_next;
01453 
01454     for (paf = ch->affected; paf != NULL; paf = paf_next)
01455     {
01456         paf_next = paf->next;
01457         if (paf->type == sn)
01458             affect_remove (ch, paf);
01459     }
01460 
01461     return;
01462 }

Here is the call graph for this function:

void affect_to_char CHAR_DATA ch,
AFFECT_DATA paf
 

Definition at line 1289 of file handler.c.

References affect_modify(), new_affect(), affect_data::next, TRUE, and VALIDATE.

Referenced by affect_join(), clone_mobile(), create_mobile(), do_berserk(), do_dirt(), do_sneak(), equip_char(), fire_effect(), spell_armor(), spell_bless(), spell_blindness(), spell_calm(), spell_change_sex(), spell_charm_person(), spell_curse(), spell_detect_evil(), spell_detect_good(), spell_detect_hidden(), spell_detect_invis(), spell_detect_magic(), spell_faerie_fire(), spell_fly(), spell_frenzy(), spell_giant_strength(), spell_haste(), spell_infravision(), spell_invis(), spell_mass_invis(), spell_pass_door(), spell_protection_evil(), spell_protection_good(), spell_sanctuary(), spell_shield(), spell_slow(), spell_stone_skin(), and spell_weaken().

01290 {
01291     AFFECT_DATA *paf_new;
01292 
01293     paf_new = new_affect ();
01294 
01295     *paf_new = *paf;
01296 
01297     VALIDATE (paf);                /* in case we missed it when we set up paf */
01298     paf_new->next = ch->affected;
01299     ch->affected = paf_new;
01300 
01301     affect_modify (ch, paf_new, TRUE);
01302     return;
01303 }

Here is the call graph for this function:

void affect_to_obj OBJ_DATA obj,
AFFECT_DATA paf
 

Definition at line 1306 of file handler.c.

References ITEM_WEAPON, new_affect(), affect_data::next, SET_BIT, TO_OBJECT, TO_WEAPON, and VALIDATE.

Referenced by clone_object(), create_object(), do_envenom(), spell_bless(), spell_curse(), spell_fireproof(), spell_invis(), and spell_poison().

01307 {
01308     AFFECT_DATA *paf_new;
01309 
01310     paf_new = new_affect ();
01311 
01312     *paf_new = *paf;
01313 
01314     VALIDATE (paf);                /* in case we missed it when we set up paf */
01315     paf_new->next = obj->affected;
01316     obj->affected = paf_new;
01317 
01318     /* apply any affect vectors to the object's extra_flags */
01319     if (paf->bitvector)
01320         switch (paf->where)
01321         {
01322             case TO_OBJECT:
01323                 SET_BIT (obj->extra_flags, paf->bitvector);
01324                 break;
01325             case TO_WEAPON:
01326                 if (obj->item_type == ITEM_WEAPON)
01327                     SET_BIT (obj->value[4], paf->bitvector);
01328                 break;
01329         }
01330 
01331 
01332     return;
01333 }

Here is the call graph for this function:

void all_colour CHAR_DATA ch,
char *  argument
 

Definition at line 3503 of file handler.c.

References BLACK, BLUE, BRIGHT, colour(), CYAN, GREEN, IS_NPC, MAGENTA, NORMAL, RED, send_to_char_bw(), str_prefix(), WHITE, and YELLOW.

Referenced by do_colour().

03504 {
03505     char buf[100];
03506     char buf2[100];
03507     int colour;
03508     int bright;
03509 
03510     if (IS_NPC (ch) || !ch->pcdata)
03511         return;
03512 
03513     if (!*argument)
03514         return;
03515 
03516     if (!str_prefix (argument, "red"))
03517     {
03518         colour = (RED);
03519         bright = NORMAL;
03520         sprintf (buf2, "Red");
03521     }
03522     if (!str_prefix (argument, "hi-red"))
03523     {
03524         colour = (RED);
03525         bright = BRIGHT;
03526         sprintf (buf2, "Red");
03527     }
03528     else if (!str_prefix (argument, "green"))
03529     {
03530         colour = (GREEN);
03531         bright = NORMAL;
03532         sprintf (buf2, "Green");
03533     }
03534     else if (!str_prefix (argument, "hi-green"))
03535     {
03536         colour = (GREEN);
03537         bright = BRIGHT;
03538         sprintf (buf2, "Green");
03539     }
03540     else if (!str_prefix (argument, "yellow"))
03541     {
03542         colour = (YELLOW);
03543         bright = NORMAL;
03544         sprintf (buf2, "Yellow");
03545     }
03546     else if (!str_prefix (argument, "hi-yellow"))
03547     {
03548         colour = (YELLOW);
03549         bright = BRIGHT;
03550         sprintf (buf2, "Yellow");
03551     }
03552     else if (!str_prefix (argument, "blue"))
03553     {
03554         colour = (BLUE);
03555         bright = NORMAL;
03556         sprintf (buf2, "Blue");
03557     }
03558     else if (!str_prefix (argument, "hi-blue"))
03559     {
03560         colour = (BLUE);
03561         bright = BRIGHT;
03562         sprintf (buf2, "Blue");
03563     }
03564     else if (!str_prefix (argument, "magenta"))
03565     {
03566         colour = (MAGENTA);
03567         bright = NORMAL;
03568         sprintf (buf2, "Magenta");
03569     }
03570     else if (!str_prefix (argument, "hi-magenta"))
03571     {
03572         colour = (MAGENTA);
03573         bright = BRIGHT;
03574         sprintf (buf2, "Magenta");
03575     }
03576     else if (!str_prefix (argument, "cyan"))
03577     {
03578         colour = (CYAN);
03579         bright = NORMAL;
03580         sprintf (buf2, "Cyan");
03581     }
03582     else if (!str_prefix (argument, "hi-cyan"))
03583     {
03584         colour = (CYAN);
03585         bright = BRIGHT;
03586         sprintf (buf2, "Cyan");
03587     }
03588     else if (!str_prefix (argument, "white"))
03589     {
03590         colour = (WHITE);
03591         bright = NORMAL;
03592         sprintf (buf2, "White");
03593     }
03594     else if (!str_prefix (argument, "hi-white"))
03595     {
03596         colour = (WHITE);
03597         bright = BRIGHT;
03598         sprintf (buf2, "White");
03599     }
03600     else if (!str_prefix (argument, "grey"))
03601     {
03602         colour = (BLACK);
03603         bright = BRIGHT;
03604         sprintf (buf2, "White");
03605     }
03606     else
03607     {
03608         send_to_char_bw ("Unrecognised colour, unchanged.\n\r", ch);
03609         return;
03610     }
03611 
03612     ch->pcdata->text[1] = colour;
03613     ch->pcdata->auction[1] = colour;
03614     ch->pcdata->gossip[1] = colour;
03615     ch->pcdata->music[1] = colour;
03616     ch->pcdata->question[1] = colour;
03617     ch->pcdata->answer[1] = colour;
03618     ch->pcdata->quote[1] = colour;
03619     ch->pcdata->quote_text[1] = colour;
03620     ch->pcdata->immtalk_text[1] = colour;
03621     ch->pcdata->immtalk_type[1] = colour;
03622     ch->pcdata->info[1] = colour;
03623     ch->pcdata->say[1] = colour;
03624     ch->pcdata->say_text[1] = colour;
03625     ch->pcdata->tell[1] = colour;
03626     ch->pcdata->tell_text[1] = colour;
03627     ch->pcdata->reply[1] = colour;
03628     ch->pcdata->reply_text[1] =