home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / d / d-linux.zip / dm-dist / act.obj2.c < prev    next >
C/C++ Source or Header  |  1992-11-24  |  27KB  |  1,013 lines

  1. /* ************************************************************************
  2. *  file: act.obj2.c , Implementation of commands.         Part of DIKUMUD *
  3. *  Usage : Commands mainly using objects.                                 *
  4. *  Copyright (C) 1990, 1991 - see 'license.doc' for complete information. *
  5. ************************************************************************* */
  6.  
  7. #include <stdio.h>
  8. #include <string.h>
  9. #include <assert.h>
  10.  
  11. #include "structs.h"
  12. #include "utils.h"
  13. #include "comm.h"
  14. #include "interpreter.h"
  15. #include "handler.h"
  16. #include "db.h"
  17. #include "spells.h"
  18.  
  19. /* extern variables */
  20.  
  21. extern struct str_app_type str_app[];
  22. extern struct room_data *world;
  23. extern struct descriptor_data *descriptor_list;
  24. extern struct room_data *world;
  25. extern char *drinks[];
  26. extern int drink_aff[][3];
  27.  
  28. /* extern functions */
  29.  
  30. struct obj_data *get_object_in_equip_vis(struct char_data *ch,
  31.                          char *arg, struct obj_data **equipment, int *j);
  32.  
  33.  
  34.  
  35. void weight_change_object(struct obj_data *obj, int weight)
  36. {
  37.     struct obj_data *tmp_obj;
  38.     struct char_data *tmp_ch;
  39.  
  40.     if (obj->in_room != NOWHERE) {
  41.         GET_OBJ_WEIGHT(obj) += weight;
  42.     } else if (tmp_ch = obj->carried_by) {
  43.         obj_from_char(obj);
  44.         GET_OBJ_WEIGHT(obj) += weight;
  45.         obj_to_char(obj, tmp_ch);
  46.     } else if (tmp_obj = obj->in_obj) {
  47.         obj_from_obj(obj);
  48.         GET_OBJ_WEIGHT(obj) += weight;
  49.         obj_to_obj(obj, tmp_obj);
  50.     } else {
  51.         log("Unknown attempt to subtract weight from an object.");
  52.     }
  53. }
  54.  
  55.  
  56.  
  57. void name_from_drinkcon(struct obj_data *obj)
  58. {
  59.     int i;
  60.    char *new_name;
  61.  
  62.     for(i=0; (*((obj->name)+i)!=' ') && (*((obj->name)+i)!='\0'); i++)  ;
  63.  
  64.     if (*((obj->name)+i)==' ') {
  65.         new_name=strdup((obj->name)+i+1);
  66.         free(obj->name);
  67.         obj->name=new_name;
  68.     }
  69. }
  70.  
  71.  
  72.  
  73. void name_to_drinkcon(struct obj_data *obj,int type)
  74. {
  75.     char *new_name;
  76.     extern char *drinknames[];
  77.  
  78.     CREATE(new_name,char,strlen(obj->name)+strlen(drinknames[type])+2);
  79.     sprintf(new_name,"%s %s",drinknames[type],obj->name);
  80.     free(obj->name);
  81.     obj->name=new_name;
  82. }
  83.  
  84.  
  85.  
  86. void do_drink(struct char_data *ch, char *argument, int cmd)
  87. {
  88.     char buf[100];
  89.     struct obj_data *temp;
  90.     struct affected_type af;
  91.     int amount,i;
  92.  
  93.  
  94.     one_argument(argument,buf);
  95.  
  96.     if(!(temp = get_obj_in_list_vis(ch,buf,ch->carrying)))
  97.     {
  98.         act("You can't find it!",FALSE,ch,0,0,TO_CHAR);
  99.         return;
  100.     }
  101.  
  102.     if (temp->obj_flags.type_flag!=ITEM_DRINKCON)
  103.     {
  104.         act("You can't drink from that!",FALSE,ch,0,0,TO_CHAR);
  105.         return;
  106.     }
  107.  
  108.     if((GET_COND(ch,DRUNK)>10)&&(GET_COND(ch,THIRST)>0)) /* The pig is drunk */
  109.     {
  110.         act("You simply fail to reach your mouth!", FALSE, ch, 0, 0, TO_CHAR);
  111.         act("$n tried to drink but missed $s mouth!", TRUE, ch, 0, 0, TO_ROOM);
  112.         return;
  113.     }
  114.  
  115.     if((GET_COND(ch,FULL)>20)&&(GET_COND(ch,THIRST)>0)) /* Stomach full */
  116.     {
  117.         act("Your stomach can't contain anymore!",FALSE,ch,0,0,TO_CHAR);
  118.         return;
  119.     }
  120.  
  121.   if (temp->obj_flags.type_flag==ITEM_DRINKCON){
  122.         if(temp->obj_flags.value[1]>0)  /* Not empty */
  123.         {    
  124.             sprintf(buf,"$n drinks %s from $p",drinks[temp->obj_flags.value[2]]);
  125.             act(buf, TRUE, ch, temp, 0, TO_ROOM);
  126.             sprintf(buf,"You drink the %s.\n\r",drinks[temp->obj_flags.value[2]]);
  127.             send_to_char(buf,ch);
  128.  
  129.             if (drink_aff[temp->obj_flags.value[2]][DRUNK] > 0 )
  130.                 amount = (25-GET_COND(ch,THIRST))/drink_aff[temp->obj_flags.value[2]][DRUNK];
  131.             else
  132.               amount = number(3,10);
  133.  
  134.             amount = MIN(amount,temp->obj_flags.value[1]);
  135.  
  136.             weight_change_object(temp, -amount);  /* Subtract amount */
  137.  
  138.             gain_condition(ch,DRUNK,(int)((int)drink_aff
  139.                 [temp->obj_flags.value[2]][DRUNK]*amount)/4);
  140.  
  141.             gain_condition(ch,FULL,(int)((int)drink_aff
  142.                 [temp->obj_flags.value[2]][FULL]*amount)/4);
  143.  
  144.             gain_condition(ch,THIRST,(int)((int)drink_aff
  145.                 [temp->obj_flags.value[2]][THIRST]*amount)/4);
  146.  
  147.             if(GET_COND(ch,DRUNK)>10)
  148.                 act("You feel drunk.",FALSE,ch,0,0,TO_CHAR);
  149.  
  150.             if(GET_COND(ch,THIRST)>20)
  151.                 act("You do not feel thirsty.",FALSE,ch,0,0,TO_CHAR);
  152.  
  153.             if(GET_COND(ch,FULL)>20)
  154.                 act("You are full.",FALSE,ch,0,0,TO_CHAR);
  155.  
  156.             if(temp->obj_flags.value[3]) /* The shit was poisoned ! */
  157.             {
  158.                 act("Ooups, it tasted rather strange ?!!?",FALSE,ch,0,0,TO_CHAR);
  159.                 act("$n chokes and utters some strange sounds.",
  160.                    TRUE,ch,0,0,TO_ROOM);
  161.                 af.type = SPELL_POISON;
  162.                 af.duration = amount*3;
  163.                 af.modifier = 0;
  164.                 af.location = APPLY_NONE;
  165.                 af.bitvector = AFF_POISON;
  166.                 affect_join(ch,&af, FALSE, FALSE);
  167.             }
  168.  
  169.             /* empty the container, and no longer poison. */
  170.             temp->obj_flags.value[1]-= amount;
  171.             if(!temp->obj_flags.value[1]) {  /* The last bit */
  172.                 temp->obj_flags.value[2]=0;
  173.                 temp->obj_flags.value[3]=0;
  174.                 name_from_drinkcon(temp);
  175.             }
  176.             return;
  177.  
  178.         }
  179.     }
  180.  
  181.     act("It's empty already.",FALSE,ch,0,0,TO_CHAR);
  182.     
  183.     return;
  184. }
  185.  
  186.  
  187.  
  188. void do_eat(struct char_data *ch, char *argument, int cmd)
  189. {
  190.     char buf[100];
  191.     struct obj_data *temp;
  192.     struct affected_type af;
  193.  
  194.     one_argument(argument,buf);
  195.  
  196.     if(!(temp = get_obj_in_list_vis(ch,buf,ch->carrying)))
  197.     {
  198.         act("You can't find it!",FALSE,ch,0,0,TO_CHAR);
  199.         return;
  200.     }
  201.  
  202.     if((temp->obj_flags.type_flag != ITEM_FOOD) && (GET_LEVEL(ch) < 22))
  203.     {
  204.         act("Your stomach refuses to eat that!?!",FALSE,ch,0,0,TO_CHAR);
  205.         return;
  206.     }
  207.  
  208.     if(GET_COND(ch,FULL)>20) /* Stomach full */
  209.     {    
  210.         act("You are to full to eat more!",FALSE,ch,0,0,TO_CHAR);
  211.         return;
  212.     }
  213.  
  214.     act("$n eats $p",TRUE,ch,temp,0,TO_ROOM);
  215.     act("You eat the $o.",FALSE,ch,temp,0,TO_CHAR);
  216.  
  217.     gain_condition(ch,FULL,temp->obj_flags.value[0]);
  218.  
  219.     if(GET_COND(ch,FULL)>20)
  220.         act("You are full.",FALSE,ch,0,0,TO_CHAR);
  221.  
  222.     if(temp->obj_flags.value[3] && (GET_LEVEL(ch) < 21)) /* The shit was poisoned ! */
  223.     {
  224.         act("Ooups, it tasted rather strange ?!!?",FALSE,ch,0,0,TO_CHAR);
  225.         act("$n coughs and utters some strange sounds.",FALSE,ch,0,0,TO_ROOM);
  226.  
  227.         af.type = SPELL_POISON;
  228.         af.duration = temp->obj_flags.value[0]*2;
  229.         af.modifier = 0;
  230.         af.location = APPLY_NONE;
  231.         af.bitvector = AFF_POISON;
  232.         affect_join(ch,&af, FALSE, FALSE);
  233.     }
  234.  
  235.     extract_obj(temp);
  236. }
  237.  
  238.  
  239. void do_pour(struct char_data *ch, char *argument, int cmd)
  240. {
  241.     char arg1[MAX_STRING_LENGTH];
  242.     char arg2[MAX_STRING_LENGTH];
  243.     char buf[MAX_STRING_LENGTH];
  244.     struct obj_data *from_obj;
  245.     struct obj_data *to_obj;
  246.     int amount;
  247.  
  248.     argument_interpreter(argument, arg1, arg2);
  249.  
  250.     if(!*arg1) /* No arguments */
  251.     {
  252.         act("What do you want to pour from?",FALSE,ch,0,0,TO_CHAR);
  253.         return;
  254.     }
  255.  
  256.     if(!(from_obj = get_obj_in_list_vis(ch,arg1,ch->carrying)))
  257.     {
  258.         act("You can't find it!",FALSE,ch,0,0,TO_CHAR);
  259.         return;
  260.     }
  261.  
  262.     if(from_obj->obj_flags.type_flag!=ITEM_DRINKCON)
  263.     {
  264.         act("You can't pour from that!",FALSE,ch,0,0,TO_CHAR);
  265.         return;
  266.     }
  267.  
  268.     if(from_obj->obj_flags.value[1]==0)
  269.     {
  270.         act("The $p is empty.",FALSE, ch,from_obj, 0,TO_CHAR);
  271.         return;
  272.     }
  273.  
  274.     if(!*arg2)
  275.     {
  276.         act("Where do you want it? Out or in what?",FALSE,ch,0,0,TO_CHAR);
  277.         return;
  278.     }
  279.  
  280.     if(!str_cmp(arg2,"out"))
  281.     {
  282.         act("$n empties $p", TRUE, ch,from_obj,0,TO_ROOM);
  283.         act("You empty the $p.", FALSE, ch,from_obj,0,TO_CHAR);
  284.  
  285.         weight_change_object(from_obj, -from_obj->obj_flags.value[1]); /* Empty */
  286.  
  287.         from_obj->obj_flags.value[1]=0;
  288.         from_obj->obj_flags.value[2]=0;
  289.         from_obj->obj_flags.value[3]=0;
  290.         name_from_drinkcon(from_obj);
  291.         
  292.         return;
  293.  
  294.     }
  295.  
  296.     if(!(to_obj = get_obj_in_list_vis(ch,arg2,ch->carrying)))
  297.     {
  298.         act("You can't find it!",FALSE,ch,0,0,TO_CHAR);
  299.         return;
  300.     }
  301.  
  302.     if(to_obj->obj_flags.type_flag!=ITEM_DRINKCON)
  303.     {
  304.         act("You can't pour anything into that.",FALSE,ch,0,0,TO_CHAR);
  305.         return;
  306.     }
  307.  
  308.     if((to_obj->obj_flags.value[1]!=0)&&
  309.         (to_obj->obj_flags.value[2]!=from_obj->obj_flags.value[2]))
  310.     {
  311.         act("There is already another liquid in it!",FALSE,ch,0,0,TO_CHAR);
  312.         return;
  313.     }
  314.  
  315.     if(!(to_obj->obj_flags.value[1]<to_obj->obj_flags.value[0]))
  316.     {
  317.         act("There is no room for more.",FALSE,ch,0,0,TO_CHAR);
  318.         return;
  319.     }
  320.  
  321.     sprintf(buf,"You pour the %s into the %s.",
  322.         drinks[from_obj->obj_flags.value[2]],arg2);
  323.     send_to_char(buf,ch);
  324.  
  325.     /* New alias */
  326.     if (to_obj->obj_flags.value[1]==0) 
  327.         name_to_drinkcon(to_obj,from_obj->obj_flags.value[2]);
  328.  
  329.     /* First same type liq. */
  330.     to_obj->obj_flags.value[2]=from_obj->obj_flags.value[2];
  331.  
  332.     /* Then how much to pour */
  333.     from_obj->obj_flags.value[1]-= (amount=
  334.         (to_obj->obj_flags.value[0]-to_obj->obj_flags.value[1]));
  335.  
  336.     to_obj->obj_flags.value[1]=to_obj->obj_flags.value[0];
  337.  
  338.     if(from_obj->obj_flags.value[1]<0)    /* There was to little */
  339.     {
  340.         to_obj->obj_flags.value[1]+=from_obj->obj_flags.value[1];
  341.         amount += from_obj->obj_flags.value[1];
  342.         from_obj->obj_flags.value[1]=0;
  343.         from_obj->obj_flags.value[2]=0;
  344.         from_obj->obj_flags.value[3]=0;
  345.         name_from_drinkcon(from_obj);
  346.     }
  347.  
  348.     /* Then the poison boogie */
  349.     to_obj->obj_flags.value[3]=
  350.         (to_obj->obj_flags.value[3]||from_obj->obj_flags.value[3]);
  351.  
  352.     /* And the weight boogie */
  353.  
  354.     weight_change_object(from_obj, -amount);
  355.     weight_change_object(to_obj, amount);   /* Add weight */
  356.  
  357.     return;
  358. }
  359.  
  360. void do_sip(struct char_data *ch, char *argument, int cmd)
  361. {
  362.     struct affected_type af;
  363.     char arg[MAX_STRING_LENGTH];
  364.     char buf[MAX_STRING_LENGTH];
  365.     struct obj_data *temp;
  366.  
  367.     one_argument(argument,arg);
  368.  
  369.     if(!(temp = get_obj_in_list_vis(ch,arg,ch->carrying)))
  370.     {
  371.         act("You can't find it!",FALSE,ch,0,0,TO_CHAR);
  372.         return;
  373.     }
  374.  
  375.     if(temp->obj_flags.type_flag!=ITEM_DRINKCON)
  376.     {
  377.         act("You can't sip from that!",FALSE,ch,0,0,TO_CHAR);
  378.         return;
  379.     }
  380.  
  381.     if(GET_COND(ch,DRUNK)>10) /* The pig is drunk ! */
  382.     {
  383.         act("You simply fail to reach your mouth!",FALSE,ch,0,0,TO_CHAR);
  384.         act("$n tries to sip, but fails!",TRUE,ch,0,0,TO_ROOM);
  385.         return;
  386.     }
  387.  
  388.     if(!temp->obj_flags.value[1])  /* Empty */
  389.     {
  390.         act("But there is nothing in it?",FALSE,ch,0,0,TO_CHAR);
  391.         return;
  392.     }
  393.  
  394.     act("$n sips from the $o",TRUE,ch,temp,0,TO_ROOM);
  395.     sprintf(buf,"It tastes like %s.\n\r",drinks[temp->obj_flags.value[2]]);
  396.     send_to_char(buf,ch);
  397.  
  398.     gain_condition(ch,DRUNK,(int)(drink_aff[temp->obj_flags.value[2]][DRUNK]/4));
  399.  
  400.     gain_condition(ch,FULL,(int)(drink_aff[temp->obj_flags.value[2]][FULL]/4));
  401.  
  402.     gain_condition(ch,THIRST,(int)(drink_aff[temp->obj_flags.value[2]][THIRST]/4));
  403.  
  404.     weight_change_object(temp, -1);  /* Subtract one unit */
  405.  
  406.     if(GET_COND(ch,DRUNK)>10)
  407.         act("You feel drunk.",FALSE,ch,0,0,TO_CHAR);
  408.  
  409.     if(GET_COND(ch,THIRST)>20)
  410.         act("You do not feel thirsty.",FALSE,ch,0,0,TO_CHAR);
  411.  
  412.     if(GET_COND(ch,FULL)>20)
  413.         act("You are full.",FALSE,ch,0,0,TO_CHAR);
  414.  
  415.     if(temp->obj_flags.value[3]&&!IS_AFFECTED(ch,AFF_POISON)) /* The shit was poisoned ! */
  416.     {
  417.         act("But it also had a strange taste!",FALSE,ch,0,0,TO_CHAR);
  418.  
  419.         af.type = SPELL_POISON;
  420.         af.duration = 3;
  421.         af.modifier = 0;
  422.         af.location = APPLY_NONE;
  423.         af.bitvector = AFF_POISON;
  424.         affect_to_char(ch,&af);
  425.     }
  426.  
  427.     temp->obj_flags.value[1]--;
  428.  
  429.     if(!temp->obj_flags.value[1])  /* The last bit */
  430.     {
  431.         temp->obj_flags.value[2]=0;
  432.         temp->obj_flags.value[3]=0;
  433.         name_from_drinkcon(temp);
  434.     }
  435.  
  436.     return;
  437.  
  438. }
  439.  
  440.  
  441. void do_taste(struct char_data *ch, char *argument, int cmd)
  442. {
  443.     struct affected_type af;
  444.     char arg[MAX_STRING_LENGTH];
  445.     char buf[MAX_STRING_LENGTH];
  446.     struct obj_data *temp;
  447.  
  448.     one_argument(argument,arg);
  449.  
  450.     if(!(temp = get_obj_in_list_vis(ch,arg,ch->carrying)))
  451.     {
  452.         act("You can't find it!",FALSE,ch,0,0,TO_CHAR);
  453.         return;
  454.     }
  455.  
  456.     if(temp->obj_flags.type_flag==ITEM_DRINKCON)
  457.     {
  458.         do_sip(ch,argument,0);
  459.         return;
  460.     }
  461.  
  462.     if(!(temp->obj_flags.type_flag==ITEM_FOOD))
  463.     {
  464.         act("Taste that?!? Your stomach refuses!",FALSE,ch,0,0,TO_CHAR);
  465.         return;
  466.     }
  467.  
  468.     act("$n tastes the $o", FALSE, ch, temp, 0, TO_ROOM);
  469.     act("You taste the $o", FALSE, ch, temp, 0, TO_CHAR);
  470.  
  471.     gain_condition(ch,FULL,1);
  472.  
  473.     if(GET_COND(ch,FULL)>20)
  474.         act("You are full.",FALSE,ch,0,0,TO_CHAR);
  475.  
  476.     if(temp->obj_flags.value[3]&&!IS_AFFECTED(ch,AFF_POISON)) /* The shit was poisoned ! */
  477.     {
  478.         act("Ooups, it did not taste good at all!",FALSE,ch,0,0,TO_CHAR);
  479.  
  480.         af.type = SPELL_POISON;
  481.         af.duration = 2;
  482.         af.modifier = 0;
  483.         af.location = APPLY_NONE;
  484.         af.bitvector = AFF_POISON;
  485.         affect_to_char(ch,&af);
  486.     }
  487.  
  488.     temp->obj_flags.value[0]--;
  489.  
  490.     if(!temp->obj_flags.value[0])    /* Nothing left */
  491.     {
  492.         act("There is nothing left now.",FALSE,ch,0,0,TO_CHAR);
  493.         extract_obj(temp);
  494.     }
  495.  
  496.     return;
  497.  
  498. }
  499.  
  500.  
  501.  
  502. /* functions related to wear */
  503.  
  504. perform_wear(struct char_data *ch, struct obj_data *obj_object, int keyword)
  505. {
  506.     char buffer[MAX_STRING_LENGTH];
  507.     struct char_data *i;
  508.  
  509.     switch(keyword) {
  510.         case 0 :
  511.             act("$n light $p and holds it.", FALSE, ch, obj_object,0,TO_ROOM);
  512.             break;
  513.         case 1 : 
  514.             act("$n wears $p on $s finger.", TRUE, ch, obj_object,0,TO_ROOM);
  515.             break;
  516.         case 2 : 
  517.             act("$n wears $p around $s neck.", TRUE, ch, obj_object,0,TO_ROOM);
  518.             break;
  519.         case 3 : 
  520.             act("$n wears $p on $s body.", TRUE, ch, obj_object,0,TO_ROOM);
  521.             break;
  522.         case 4 : 
  523.             act("$n wears $p on $s head.",TRUE, ch, obj_object,0,TO_ROOM);
  524.             break;
  525.         case 5 : 
  526.             act("$n wears $p on $s legs.",TRUE, ch, obj_object,0,TO_ROOM);
  527.             break;
  528.         case 6 : 
  529.             act("$n wears $p on $s feet.",TRUE, ch, obj_object,0,TO_ROOM);
  530.             break;
  531.         case 7 : 
  532.             act("$n wears $p on $s hands.",TRUE, ch, obj_object,0,TO_ROOM);
  533.             break;
  534.         case 8 : 
  535.             act("$n wears $p on $s arms.",TRUE, ch, obj_object,0,TO_ROOM);
  536.             break;
  537.         case 9 : 
  538.             act("$n wears $p about $s body.",TRUE, ch, obj_object,0,TO_ROOM);
  539.             break;
  540.         case 10 : 
  541.             act("$n wears $p about $s waist.",TRUE, ch, obj_object,0,TO_ROOM);
  542.             break;
  543.         case 11 : 
  544.             act("$n wears $p around $s wrist.",TRUE, ch, obj_object,0,TO_ROOM);
  545.             break;
  546.         case 12 : 
  547.             act("$n wields $p.",TRUE, ch, obj_object,0,TO_ROOM);
  548.             break;
  549.         case 13 : 
  550.             act("$n grabs $p.",TRUE, ch, obj_object,0,TO_ROOM);
  551.             break;
  552.         case 14 : 
  553.             act("$n starts using $p as shield.", TRUE, ch, obj_object,0,TO_ROOM);
  554.             break;
  555.     }
  556. }
  557.  
  558.  
  559.  
  560. void wear(struct char_data *ch, struct obj_data *obj_object, int keyword)
  561. {
  562.     char buffer[MAX_STRING_LENGTH];
  563.  
  564.     switch(keyword) {
  565.         case 0: {  /* LIGHT SOURCE */
  566.             if (ch->equipment[WEAR_LIGHT])
  567.                 send_to_char("You are already holding a light source.\n\r", ch);
  568.             else {
  569.                 send_to_char("Ok.\n\r", ch);
  570.                 perform_wear(ch,obj_object,keyword);
  571.                 obj_from_char(obj_object);
  572.                 equip_char(ch,obj_object, WEAR_LIGHT);
  573.                 if (obj_object->obj_flags.value[2])
  574.                     world[ch->in_room].light++;
  575.             }
  576.         } break;
  577.  
  578.         case 1: {
  579.             if (CAN_WEAR(obj_object,ITEM_WEAR_FINGER)) {
  580.                 if ((ch->equipment[WEAR_FINGER_L]) && (ch->equipment[WEAR_FINGER_R])) {
  581.                     send_to_char(
  582.                         "You are already wearing something on your fingers.\n\r", ch);
  583.                 } else {
  584.                     perform_wear(ch,obj_object,keyword);
  585.                     if (ch->equipment[WEAR_FINGER_L]) {
  586.                         sprintf(buffer, "You put the %s on your right finger.\n\r", 
  587.                             fname(obj_object->name));
  588.                         send_to_char(buffer, ch);
  589.                         obj_from_char(obj_object);
  590.                         equip_char(ch, obj_object, WEAR_FINGER_R);
  591.                     } else {
  592.                         sprintf(buffer, "You put the %s on your left finger.\n\r", 
  593.                             fname(obj_object->name));
  594.                         send_to_char(buffer, ch);
  595.                         obj_from_char(obj_object);
  596.                         equip_char(ch, obj_object, WEAR_FINGER_L);
  597.                     }
  598.                 }
  599.             } else {
  600.                 send_to_char("You can't wear that on your finger.\n\r", ch);
  601.             }
  602.         } break;
  603.         case 2: {
  604.             if (CAN_WEAR(obj_object,ITEM_WEAR_NECK)) {
  605.                 if ((ch->equipment[WEAR_NECK_1]) && (ch->equipment[WEAR_NECK_2])) {
  606.                     send_to_char("You can't wear any more around your neck.\n\r", ch);
  607.                 } else {
  608.                     send_to_char("OK.\n\r", ch);
  609.                     perform_wear(ch,obj_object,keyword);
  610.                     if (ch->equipment[WEAR_NECK_1]) {
  611.                         obj_from_char(obj_object);
  612.                         equip_char(ch, obj_object, WEAR_NECK_2);
  613.                     } else {
  614.                         obj_from_char(obj_object);
  615.                         equip_char(ch, obj_object, WEAR_NECK_1);
  616.                     }
  617.                 }
  618.             } else {
  619.                             send_to_char("You can't wear that around your neck.\n\r", ch);
  620.             }
  621.         } break;
  622.         case 3: {
  623.             if (CAN_WEAR(obj_object,ITEM_WEAR_BODY)) {
  624.                 if (ch->equipment[WEAR_BODY]) {
  625.                     send_to_char("You already wear something on your body.\n\r", ch);
  626.                 } else {
  627.                     send_to_char("OK.\n\r", ch);
  628.                     perform_wear(ch,obj_object,keyword);
  629.                     obj_from_char(obj_object);
  630.                     equip_char(ch,  obj_object, WEAR_BODY);
  631.                 }
  632.             } else {
  633.                 send_to_char("You can't wear that on your body.\n\r", ch);
  634.             }
  635.         } break;
  636.         case 4: {
  637.             if (CAN_WEAR(obj_object,ITEM_WEAR_HEAD)) {
  638.                 if (ch->equipment[WEAR_HEAD]) {
  639.                     send_to_char("You already wear something on your head.\n\r", ch);
  640.                 } else {
  641.                     send_to_char("OK.\n\r", ch);
  642.                     perform_wear(ch,obj_object,keyword);
  643.                     obj_from_char(obj_object);
  644.                     equip_char(ch, obj_object, WEAR_HEAD);
  645.                 }
  646.             } else {
  647.                 send_to_char("You can't wear that on your head.\n\r", ch);
  648.             }
  649.         } break;
  650.         case 5: {
  651.             if (CAN_WEAR(obj_object,ITEM_WEAR_LEGS)) {
  652.                 if (ch->equipment[WEAR_LEGS]) {
  653.                     send_to_char("You already wear something on your legs.\n\r", ch);
  654.                 } else {
  655.                     send_to_char("OK.\n\r", ch);
  656.                     perform_wear(ch,obj_object,keyword);
  657.                     obj_from_char(obj_object);
  658.                     equip_char(ch, obj_object, WEAR_LEGS);
  659.                 }
  660.             } else {
  661.                 send_to_char("You can't wear that on your legs.\n\r", ch);
  662.             }
  663.         } break;
  664.         case 6: {
  665.             if (CAN_WEAR(obj_object,ITEM_WEAR_FEET)) {
  666.                 if (ch->equipment[WEAR_FEET]) {
  667.                     send_to_char("You already wear something on your feet.\n\r", ch);
  668.                 } else {
  669.                     send_to_char("OK.\n\r", ch);
  670.                     perform_wear(ch,obj_object,keyword);
  671.                     obj_from_char(obj_object);
  672.                     equip_char(ch, obj_object, WEAR_FEET);
  673.                 }
  674.             } else {
  675.                 send_to_char("You can't wear that on your feet.\n\r", ch);
  676.             }
  677.         } break;
  678.         case 7: {
  679.             if (CAN_WEAR(obj_object,ITEM_WEAR_HANDS)) {
  680.                 if (ch->equipment[WEAR_HANDS]) {
  681.                     send_to_char("You already wear something on your hands.\n\r", ch);
  682.                 } else {
  683.                     send_to_char("OK.\n\r", ch);
  684.                     perform_wear(ch,obj_object,keyword);
  685.                     obj_from_char(obj_object);
  686.                     equip_char(ch, obj_object, WEAR_HANDS);
  687.                 }
  688.             } else {
  689.                 send_to_char("You can't wear that on your hands.\n\r", ch);
  690.             }
  691.         } break;
  692.         case 8: {
  693.             if (CAN_WEAR(obj_object,ITEM_WEAR_ARMS)) {
  694.                 if (ch->equipment[WEAR_ARMS]) {
  695.                     send_to_char("You already wear something on your arms.\n\r", ch);
  696.                 } else {
  697.                     send_to_char("OK.\n\r", ch);
  698.                     perform_wear(ch,obj_object,keyword);
  699.                     obj_from_char(obj_object);
  700.                     equip_char(ch, obj_object, WEAR_ARMS);
  701.                 }
  702.             } else {
  703.                 send_to_char("You can't wear that on your arms.\n\r", ch);
  704.             }
  705.         } break;
  706.         case 9: {
  707.             if (CAN_WEAR(obj_object,ITEM_WEAR_ABOUT)) {
  708.                 if (ch->equipment[WEAR_ABOUT]) {
  709.                     send_to_char("You already wear something about your body.\n\r", ch);
  710.                 } else {
  711.                     send_to_char("OK.\n\r", ch);
  712.                     perform_wear(ch,obj_object,keyword);
  713.                     obj_from_char(obj_object);
  714.                     equip_char(ch, obj_object, WEAR_ABOUT);
  715.                 }
  716.             } else {
  717.                 send_to_char("You can't wear that about your body.\n\r", ch);
  718.             }
  719.         } break;
  720.         case 10: {
  721.             if (CAN_WEAR(obj_object,ITEM_WEAR_WAISTE)) {
  722.                 if (ch->equipment[WEAR_WAISTE]) {
  723.                     send_to_char("You already wear something about your waiste.\n\r",
  724.                         ch);
  725.                 } else {
  726.                     send_to_char("OK.\n\r", ch);
  727.                     perform_wear(ch,obj_object,keyword);
  728.                     obj_from_char(obj_object);
  729.                     equip_char(ch,  obj_object, WEAR_WAISTE);
  730.                 }
  731.             } else {
  732.                 send_to_char("You can't wear that about your waist.\n\r", ch);
  733.             }
  734.         } break;
  735.         case 11: {
  736.             if (CAN_WEAR(obj_object,ITEM_WEAR_WRIST)) {
  737.                 if ((ch->equipment[WEAR_WRIST_L]) && (ch->equipment[WEAR_WRIST_R])) {
  738.                     send_to_char(
  739.                         "You already wear something around both your wrists.\n\r", ch);
  740.                 } else {
  741.                     perform_wear(ch,obj_object,keyword);
  742.                     obj_from_char(obj_object);
  743.                     if (ch->equipment[WEAR_WRIST_L]) {
  744.                         sprintf(buffer, "You wear the %s around your right wrist.\n\r", 
  745.                             fname(obj_object->name));
  746.                         send_to_char(buffer, ch);
  747.                         equip_char(ch,  obj_object, WEAR_WRIST_R);
  748.                     } else {
  749.                         sprintf(buffer, "You wear the %s around your left wrist.\n\r", 
  750.                             fname(obj_object->name));
  751.                         send_to_char(buffer, ch);
  752.                         equip_char(ch, obj_object, WEAR_WRIST_L);
  753.                     }
  754.                 }
  755.             } else {
  756.                 send_to_char("You can't wear that around your wrist.\n\r", ch);
  757.             }
  758.         } break;
  759.  
  760.         case 12:
  761.             if (CAN_WEAR(obj_object,ITEM_WIELD)) {
  762.                 if (ch->equipment[WIELD]) {
  763.                     send_to_char("You are already wielding something.\n\r", ch);
  764.                 } else {
  765.                     /* Cleric execption has been removed, and is temporarily placed */
  766.                     /* at the end of this file                                      */
  767.  
  768.                     if (GET_OBJ_WEIGHT(obj_object) >
  769.                         str_app[STRENGTH_APPLY_INDEX(ch)].wield_w) {
  770.                         send_to_char("It is too heavy for you to use.\n\r",ch);
  771.                     } else {
  772.                         send_to_char("OK.\n\r", ch);
  773.                         perform_wear(ch,obj_object,keyword);
  774.                         obj_from_char(obj_object);
  775.                         equip_char(ch, obj_object, WIELD);
  776.                     }
  777.                 }
  778.             } else {
  779.                 send_to_char("You can't wield that.\n\r", ch);
  780.             }
  781.             break;
  782.  
  783.         case 13:
  784.             if (CAN_WEAR(obj_object,ITEM_HOLD)) {
  785.                 if (ch->equipment[HOLD]) {
  786.                     send_to_char("You are already holding something.\n\r", ch);
  787.                 } else {
  788.                     /* Cleric execption has been removed, and is temporarily placed */
  789.                     /* at the end of this file                                      */
  790.  
  791.                     send_to_char("OK.\n\r", ch);
  792.                     perform_wear(ch,obj_object,keyword);
  793.                     obj_from_char(obj_object);
  794.                     equip_char(ch, obj_object, HOLD);
  795.                 }
  796.             } else {
  797.                 send_to_char("You can't hold this.\n\r", ch);
  798.             }
  799.             break;
  800.         case 14: {
  801.             if (CAN_WEAR(obj_object,ITEM_WEAR_SHIELD)) {
  802.                 if ((ch->equipment[WEAR_SHIELD])) {
  803.                     send_to_char(
  804.                         "You are already using a shield\n\r", ch);
  805.                 } else {
  806.                     perform_wear(ch,obj_object,keyword);
  807.                     sprintf(buffer, "You start using the %s.\n\r", 
  808.                         fname(obj_object->name));
  809.                     send_to_char(buffer, ch);
  810.                     obj_from_char(obj_object);
  811.                     equip_char(ch, obj_object, WEAR_SHIELD);
  812.                 }
  813.             } else {
  814.                 send_to_char("You can't use that as a shield.\n\r", ch);
  815.             }
  816.         } break;
  817.         case -1: {
  818.             sprintf(buffer,"Wear %s where?.\n\r", fname(obj_object->name));
  819.             send_to_char(buffer, ch);
  820.         } break;
  821.         case -2: {
  822.             sprintf(buffer,"You can't wear the %s.\n\r", fname(obj_object->name));
  823.             send_to_char(buffer, ch);
  824.         } break;
  825.         default: {
  826.             log("Unknown type called in wear.");
  827.         } break;
  828.     }
  829. }
  830.  
  831.  
  832. void do_wear(struct char_data *ch, char *argument, int cmd) {
  833. char arg1[MAX_STRING_LENGTH];
  834. char arg2[MAX_STRING_LENGTH];
  835. char buf[256];
  836. char buffer[MAX_STRING_LENGTH];
  837. struct obj_data *obj_object;
  838. int keyword;
  839. static char *keywords[] = {
  840.     "finger",
  841.     "neck",
  842.     "body",
  843.     "head",
  844.     "legs",
  845.     "feet",
  846.     "hands",
  847.     "arms",
  848.     "about",
  849.     "waist",
  850.     "wrist",
  851.     "shield",
  852.     "\n"
  853. };
  854.  
  855.     argument_interpreter(argument, arg1, arg2);
  856.     if (*arg1) {
  857.         obj_object = get_obj_in_list_vis(ch, arg1, ch->carrying);
  858.         if (obj_object) {
  859.             if (*arg2) {
  860.                 keyword = search_block(arg2, keywords, FALSE); /* Partial Match */
  861.                 if (keyword == -1) {
  862.                     sprintf(buf, "%s is an unknown body location.\n\r", arg2);
  863.                     send_to_char(buf, ch);
  864.                 } else {
  865.                     wear(ch, obj_object, keyword+1);
  866.                 }
  867.             } else {
  868.                 keyword = -2;
  869.         if (CAN_WEAR(obj_object,ITEM_WEAR_SHIELD)) keyword = 14;
  870.                 if (CAN_WEAR(obj_object,ITEM_WEAR_FINGER)) keyword = 1;
  871.                 if (CAN_WEAR(obj_object,ITEM_WEAR_NECK)) keyword = 2;
  872.                 if (CAN_WEAR(obj_object,ITEM_WEAR_WRIST)) keyword = 11;
  873.                 if (CAN_WEAR(obj_object,ITEM_WEAR_WAISTE)) keyword = 10;
  874.                 if (CAN_WEAR(obj_object,ITEM_WEAR_ARMS)) keyword = 8;
  875.                 if (CAN_WEAR(obj_object,ITEM_WEAR_HANDS)) keyword = 7;
  876.                 if (CAN_WEAR(obj_object,ITEM_WEAR_FEET)) keyword = 6;
  877.                 if (CAN_WEAR(obj_object,ITEM_WEAR_LEGS)) keyword = 5;
  878.                 if (CAN_WEAR(obj_object,ITEM_WEAR_ABOUT)) keyword = 9;
  879.                 if (CAN_WEAR(obj_object,ITEM_WEAR_HEAD)) keyword = 4;
  880.                 if (CAN_WEAR(obj_object,ITEM_WEAR_BODY)) keyword = 3;
  881.  
  882.                 wear(ch, obj_object, keyword);
  883.             }
  884.         } else {
  885.             sprintf(buffer, "You do not seem to have the '%s'.\n\r",arg1);
  886.             send_to_char(buffer,ch);
  887.         }
  888.     } else {
  889.         send_to_char("Wear what?\n\r", ch);
  890.     }
  891. }
  892.  
  893.  
  894. void do_wield(struct char_data *ch, char *argument, int cmd) {
  895. char arg1[MAX_STRING_LENGTH];
  896. char arg2[MAX_STRING_LENGTH];
  897. char buffer[MAX_STRING_LENGTH];
  898. struct obj_data *obj_object;
  899. int keyword = 12;
  900.  
  901.     argument_interpreter(argument, arg1, arg2);
  902.     if (*arg1) {
  903.         obj_object = get_obj_in_list_vis(ch, arg1, ch->carrying);
  904.         if (obj_object) {
  905.             wear(ch, obj_object, keyword);
  906.         } else {
  907.             sprintf(buffer, "You do not seem to have the '%s'.\n\r",arg1);
  908.             send_to_char(buffer,ch);
  909.         }
  910.     } else {
  911.         send_to_char("Wield what?\n\r", ch);
  912.     }
  913. }
  914.  
  915.  
  916. void do_grab(struct char_data *ch, char *argument, int cmd)
  917. {
  918.     char arg1[MAX_STRING_LENGTH];
  919.     char arg2[MAX_STRING_LENGTH];
  920.     char buffer[MAX_STRING_LENGTH];
  921.     struct obj_data *obj_object;
  922.     int keyword = 13;
  923.  
  924.  
  925.     argument_interpreter(argument, arg1, arg2);
  926.  
  927.     if (*arg1) {
  928.         obj_object = get_obj_in_list(arg1, ch->carrying);
  929.         if (obj_object) {
  930.             if (obj_object->obj_flags.type_flag == ITEM_LIGHT)
  931.                 wear(ch, obj_object, WEAR_LIGHT);
  932.             else
  933.                 wear(ch, obj_object, 13);
  934.         } else {
  935.             sprintf(buffer, "You do not seem to have the '%s'.\n\r",arg1);
  936.             send_to_char(buffer,ch);
  937.         }
  938.     } else {
  939.         send_to_char("Hold what?\n\r", ch);
  940.     }
  941. }
  942.  
  943.  
  944. void do_remove(struct char_data *ch, char *argument, int cmd)
  945. {
  946.     char arg1[MAX_STRING_LENGTH];
  947.     char buffer[MAX_STRING_LENGTH];
  948.     char buffer1[MAX_STRING_LENGTH];
  949.     struct obj_data *obj_object;
  950.     struct char_data *tmp_char;
  951.     int i, j;
  952.  
  953.     one_argument(argument, arg1);
  954.  
  955.     if (*arg1) {
  956.         obj_object = get_object_in_equip_vis(ch, arg1, ch->equipment, &j);
  957.         if (obj_object) {
  958.             if (CAN_CARRY_N(ch) != IS_CARRYING_N(ch)) {
  959.  
  960.                 obj_to_char(unequip_char(ch, j), ch);
  961.  
  962.                 if (obj_object->obj_flags.type_flag == ITEM_LIGHT)
  963.                     if (obj_object->obj_flags.value[2])
  964.                         world[ch->in_room].light--;
  965.  
  966.                 act("You stop using $p.",FALSE,ch,obj_object,0,TO_CHAR);
  967.                 act("$n stops using $p.",TRUE,ch,obj_object,0,TO_ROOM);
  968.  
  969.             } else {
  970.                 send_to_char("You can't carry that many items.\n\r", ch);
  971.             }
  972.         } else {
  973.             send_to_char("You are not using it.\n\r", ch);
  974.         }
  975.     } else {
  976.         send_to_char("Remove what?\n\r", ch);
  977.     }
  978. }
  979.  
  980. /* case 12: ...
  981.  
  982.                     if ( ( (ch->player.class == CLASS_CLERIC) && 
  983.                         ( (GET_ITEM_TYPE(obj_object) == ITEM_WEAPON) && 
  984.                         (sharp[obj_object->obj_flags.value[3]]) ) ||
  985.                         ( (ch->player.class == CLASS_CLERIC) && 
  986.                         ( (GET_ITEM_TYPE(obj_object) == ITEM_FIREWEAPON) &&
  987.                         (sharp[obj_object->obj_flags.value[3]]) ) ) ) ) {
  988.                             if (GET_ITEM_TYPE(obj_object) == ITEM_WEAPON) {
  989.                                 strcpy(buffer, "You can't wield that! its SHARP.\n\r");
  990.                                 strcat(buffer, "You are forbidden to use sharp weapons!\n\r");
  991.                                 send_to_char(buffer, ch);
  992.                             }
  993.                             if (GET_ITEM_TYPE(obj_object) == ITEM_FIREWEAPON) {
  994.                                 strcpy(buffer, 
  995.                                     "You can't wield that! it fires only SHARP things.\n\r");
  996.                                 strcat(buffer, "You are forbidden to use sharp weapons!\n\r");
  997.                                 send_to_char(buffer, ch);
  998.                             }
  999.                         } else {
  1000. */
  1001.  
  1002. /* case 13: ...
  1003.  
  1004.                     if ( (ch->player.class == CLASS_CLERIC) && 
  1005.                         ( (GET_ITEM_TYPE(obj_object) == ITEM_MISSILE) && 
  1006.                         (sharp[obj_object->obj_flags.value[3]]) ) ) {
  1007.                         strcpy(buffer,
  1008.                             "This is a SHARP thing, to be used in a weapon.\n\r.");
  1009.                         strcat(buffer, "You are forbidden to use sharp weapons!\n\r");
  1010.                         send_to_char(buffer, ch);
  1011.                     } else {
  1012. */
  1013.