Difference for server/c_wiz.c from version 1.35 to 1.36


version 1.35 version 1.36
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_c_wiz_c =   * static char *rcsid_c_wiz_c =
  *   "$Id: c_wiz.c,v 1.35 2003/08/21 20:00:07 temitchell Exp $";   *   "$Id: c_wiz.c,v 1.36 2003/09/13 05:02:09 mwedel Exp $";
  */   */
   
 /*  /*
Line 37
 
Line 37
 #ifndef __CEXTRACT__  #ifndef __CEXTRACT__
 #include <sproto.h>  #include <sproto.h>
 #endif  #endif
 #include <version.h>  
 #include <spells.h>  #include <spells.h>
 #include <treasure.h>  #include <treasure.h>
 #include <skills.h>  #include <skills.h>
Line 93
 
Line 92
  for (x=0; x<settings.worldmaptilesx; x++)   for (x=0; x<settings.worldmaptilesx; x++)
  for (y=0; y<settings.worldmaptilesy; y++){   for (y=0; y<settings.worldmaptilesy; y++){
  sprintf (buf,"/world/world_%d_%d",x+settings.worldmapstartx,y+settings.worldmapstarty);   sprintf (buf,"/world/world_%d_%d",x+settings.worldmapstartx,y+settings.worldmapstarty);
  //new_draw_info_format(NDI_UNIQUE, 0, op,"going to %s",buf);   /*new_draw_info_format(NDI_UNIQUE, 0, op,"going to %s",buf);*/
  command_goto (op, buf);   command_goto (op, buf);
  }   }
    return 0;
 }  }
   
 int command_hide(object *op, char *params)  int command_hide(object *op, char *params)
Line 134
 
Line 134
  */   */
 int command_setgod(object *op, char *params)  int command_setgod(object *op, char *params)
 {  {
     object *ob;      object *ob, *god;
     char    *str;      char    *str;
   
     if (!params || !(str=strchr(params,' '))) {      if (!params || !(str=strchr(params,' '))) {
Line 154
 
Line 154
     new_draw_info_format(NDI_UNIQUE,0,op,"%s is not a player - can not change its god",ob->name);      new_draw_info_format(NDI_UNIQUE,0,op,"%s is not a player - can not change its god",ob->name);
     return 1;      return 1;
     }      }
     change_skill(ob,SK_PRAYING);      god = find_god(str);
     if(!ob->chosen_skill||ob->chosen_skill->stats.sp!=SK_PRAYING) {      if(god==NULL) {
     new_draw_info_format(NDI_UNIQUE,0,op,"%s doesn't have praying skill.",ob->name);  
     return 1;  
     }  
     if(find_god(str)==NULL) {  
     new_draw_info_format(NDI_UNIQUE,0,op,"No such god %s.",str);      new_draw_info_format(NDI_UNIQUE,0,op,"No such god %s.",str);
     return 1;      return 1;
     }      }
     become_follower(ob,find_god(str));      become_follower(ob,god);
     return 1;      return 1;
 }  }
   
Line 819
 
Line 815
     tmp = get_object();      tmp = get_object();
     copy_object(&at->clone, tmp);      copy_object(&at->clone, tmp);
     tmp = insert_ob_in_ob(tmp, victim);      tmp = insert_ob_in_ob(tmp, victim);
     (void)link_player_skill(victim, tmp);  
     at = find_archetype("skill_melee_weapon");      at = find_archetype("skill_melee_weapon");
     tmp = get_object();      tmp = get_object();
     copy_object(&at->clone, tmp);      copy_object(&at->clone, tmp);
     tmp = insert_ob_in_ob(tmp, victim);      tmp = insert_ob_in_ob(tmp, victim);
     (void)link_player_skill(victim, tmp);  
     at = find_archetype("skill_missile_weapon");      at = find_archetype("skill_missile_weapon");
     tmp = get_object();      tmp = get_object();
     copy_object(&at->clone, tmp);      copy_object(&at->clone, tmp);
     tmp = insert_ob_in_ob(tmp, victim);      tmp = insert_ob_in_ob(tmp, victim);
     (void)link_player_skill(victim, tmp);  
     at = find_archetype("skill_use_magic_item");      at = find_archetype("skill_use_magic_item");
     tmp = get_object();      tmp = get_object();
     copy_object(&at->clone, tmp);      copy_object(&at->clone, tmp);
     tmp = insert_ob_in_ob(tmp, victim);      tmp = insert_ob_in_ob(tmp, victim);
     (void)link_player_skill(victim, tmp);  
     at = find_archetype("skill_spellcasting");      at = find_archetype("skill_spellcasting");
     tmp = get_object();      tmp = get_object();
     copy_object(&at->clone, tmp);      copy_object(&at->clone, tmp);
     tmp = insert_ob_in_ob(tmp, victim);      tmp = insert_ob_in_ob(tmp, victim);
     (void)link_player_skill(victim, tmp);  
     at = find_archetype("skill_praying");      at = find_archetype("skill_praying");
     tmp = get_object();      tmp = get_object();
     copy_object(&at->clone, tmp);      copy_object(&at->clone, tmp);
     tmp = insert_ob_in_ob(tmp, victim);      tmp = insert_ob_in_ob(tmp, victim);
     (void)link_player_skill(victim, tmp);  
     /* send the inventory to the client */      /* send the inventory to the client */
     curinv = victim->inv;      curinv = victim->inv;
     while (curinv != NULL) {      while (curinv != NULL) {
Line 933
 
Line 923
     return 1;      return 1;
   }    }
   
   /* This adds exp to a player.  We now allow adding to a specific skill.
    */
 int command_addexp (object *op, char *params)  int command_addexp (object *op, char *params)
 {  {
     char buf[MAX_BUF];      char buf[MAX_BUF], skill[MAX_BUF];
     int i;      int i, q;
     object *exp_ob,*skill;      object *skillob=NULL;
     player *pl;      player *pl;
   
   if(params==NULL || sscanf(params, "%s %d", buf, &i)!=2) {      if(params==NULL || ((q=sscanf(params, "%s %d", buf, &i))<2)) {
        new_draw_info(NDI_UNIQUE, 0,op,"Usage: addexp [who] [how much].");         new_draw_info(NDI_UNIQUE, 0,op,"Usage: addexp [who] [how much].");
        return 1;         return 1;
     }      }
   
     for(pl=first_player;pl!=NULL;pl=pl->next)       for(pl=first_player;pl!=NULL;pl=pl->next)
       if(!strncmp(pl->ob->name,buf,MAX_NAME))         if(!strncmp(pl->ob->name,buf,MAX_NAME))
         break;          break;
   
     if(pl==NULL) {      if(pl==NULL) {
       new_draw_info(NDI_UNIQUE, 0,op,"No such player.");        new_draw_info(NDI_UNIQUE, 0,op,"No such player.");
       return 1;        return 1;
     }      }
   
     /* In new system: for dm adding experience to a player, only can       if (q >= 3) {
      * add exp if we satisfy the following:    skillob = find_skill_by_name(pl->ob, skill);
      * 1) there is an associated skill readied by the player    if (!skillob) {
      * 2) added exp doesnt result in exp_ob->stats.exp>MAX_EXP_IN_OBJ        new_draw_info_format(NDI_UNIQUE, 0,op,"Unable to find skill %s in %s", skill, buf);
      */  
   
     if((skill = pl->ob->chosen_skill) && ((exp_ob = pl->ob->chosen_skill->exp_obj)  
        || link_player_skill(pl->ob, skill))) {   
  i = check_exp_adjust(exp_ob,i);  
  exp_ob->stats.exp += i;  
  player_lvl_adj(pl->ob, exp_ob);  
     } else {  
       new_draw_info(NDI_UNIQUE, 0,op,"Can't find needed experience object.");  
       new_draw_info(NDI_UNIQUE, 0,op,"Player has no associated skill readied.");  
       return 1;        return 1;
     }      }
    i = check_exp_adjust(skillob,i);
    skillob->stats.exp += i;
    calc_perm_exp(skillob);
    player_lvl_adj(pl->ob, skillob);
       }
   
   
     pl->ob->stats.exp += i;      pl->ob->stats.exp += i;
       calc_perm_exp(pl->ob);
     player_lvl_adj(pl->ob, NULL);      player_lvl_adj(pl->ob, NULL);
   
     if (settings.real_wiz == FALSE)      if (settings.real_wiz == FALSE)
  SET_FLAG(pl->ob, FLAG_WAS_WIZ);   SET_FLAG(pl->ob, FLAG_WAS_WIZ);
     return 1;      return 1;
Line 1240
 
Line 1233
 static int command_learn_spell_or_prayer (object *op, char *params,  static int command_learn_spell_or_prayer (object *op, char *params,
                                           int special_prayer)                                            int special_prayer)
 {  {
     int spell;      object *tmp;
   
     if (op->contr == NULL || params == NULL)      if (op->contr == NULL || params == NULL)
         return 0;          return 0;
   
     if ((spell = look_up_spell_name (params)) <= 0) {      tmp = get_archetype(params);
         new_draw_info (NDI_UNIQUE, 0, op, "Unknown spell.");      if (!tmp) {
         return 1;   new_draw_info_format(NDI_UNIQUE, 0, op,
    "Could not find a spell by name of %s\n", params);
    return 0;
     }      }
       do_learn_spell (op, tmp, special_prayer);
     do_learn_spell (op, spell, special_prayer);      free_object(tmp);
     return 1;      return 1;
 }  }
   
Line 1266
 
Line 1261
   
 int command_forget_spell (object *op, char *params)  int command_forget_spell (object *op, char *params)
 {  {
     int spell;  
   
     if (op->contr == NULL || params == NULL)      if (op->contr == NULL || params == NULL)
         return 0;          return 0;
   
     if ((spell = look_up_spell_name (params)) <= 0) {      do_forget_spell (op, params);
         new_draw_info (NDI_UNIQUE, 0, op, "Unknown spell.");  
         return 1;  
     }  
   
     do_forget_spell (op, spell);  
     return 1;      return 1;
 }  }
 /* GROS */  /* GROS */


Legend:
line(s) removed in v.1.35 
line(s) changed
 line(s) added in v.1.36

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:30