// All credit info is stated in the file "header" // Credit for code goes to TAKA from Ghost MUD #include "include.h" #include "recycle.h" #include "tables.h" #include "magic.h" DECLARE_DO_FUN( do_butcher ); DECLARE_DO_FUN( do_area_list ); void do_butcher(CHAR_DATA *ch, char *argument); /* Butcher skill, to make meat - JE */ void do_butcher(CHAR_DATA *ch, char *argument) { char buf[MSL]; char arg[MIL]; int numst = 0; OBJ_DATA *steak; OBJ_DATA *obj; one_argument(argument,arg); if (get_skill(ch,gsn_butcher)==0) { send_to_char("Butchering is beyond your skills.\n\r",ch); return; } if (arg[0]=='\0') { send_to_char("Butcher what?\n\r",ch); return; } obj = get_obj_list(ch,arg,ch->in_room->contents); if (obj == NULL) { send_to_char("It's not here.\n\r",ch); return; } if ((obj->item_type != ITEM_CORPSE_NPC) && (obj->item_type != ITEM_CORPSE_PC)) { send_to_char("You can only butcher corpses.\n\r",ch); return; } buf[0]='\0'; strcat(buf,"A steak of "); strcat(buf,str_dup(obj->short_descr)); strcat(buf," is here."); steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); steak->description=str_dup(buf); steak->value[0] = ch->level / 2; steak->value[1] = ch->level; buf[0]='\0'; strcat(buf,"A steak of "); strcat(buf,str_dup(obj->short_descr)); steak->short_descr=str_dup(buf); if (number_percent() < get_skill(ch,gsn_butcher)) { numst = dice(1,4); switch(numst) { case 1: steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); obj_to_room(steak, ch->in_room); act("$n butchers a corpse and creates a steak.",ch,steak,NULL,TO_ROOM); act("You butcher a corpse and create a steak.",ch,steak,NULL,TO_CHAR); break; case 2: steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); obj_to_room(steak, ch->in_room); steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); obj_to_room(steak,ch->in_room); act("$n butchers a corpse and create two steaks.",ch,steak,NULL,TO_ROOM); act("You butcher a corpse and create two steaks.",ch,steak,NULL,TO_CHAR); break; case 3: steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); obj_to_room(steak, ch->in_room); steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); obj_to_room(steak, ch->in_room); steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); obj_to_room(steak, ch->in_room); act("$n butchers a corpse and creates three steaks.", ch, steak, NULL, TO_ROOM); act("You butcher a corpse and create three steaks.", ch, steak, NULL, TO_CHAR); break; case 4: steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); obj_to_room(steak, ch->in_room); steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); obj_to_room(steak, ch->in_room); steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); obj_to_room(steak, ch->in_room); steak = create_object (get_obj_index(OBJ_VNUM_STEAK), 0); obj_to_room(steak, ch->in_room); act("$n butchers a corpse and creates four steaks.", ch, steak, NULL, TO_ROOM); act("You butcher a corpse and create four steaks.", ch, steak, NULL, TO_CHAR); break; } check_improve(ch,gsn_butcher,TRUE,1); } else { act("$n fails to butcher a corpse, and destroys it.",ch,steak,NULL,TO_ROOM); act("You fail to butcher a corpse, and destroy it.",ch,steak,NULL,TO_CHAR); check_improve(ch,gsn_butcher,FALSE,1); } if (obj->item_type == ITEM_CORPSE_PC) { { OBJ_DATA *t_obj, *next_obj; for (t_obj = obj->contains; t_obj != NULL; t_obj = next_obj) { next_obj = t_obj->next_content; obj_from_obj(t_obj); if (obj->in_obj) obj_to_obj(t_obj,obj->in_obj); else if (obj->carried_by) if (obj->wear_loc == WEAR_FLOAT) if (obj->carried_by->in_room == NULL) extract_obj(t_obj); else obj_to_room(t_obj,obj->carried_by->in_room); else obj_to_char(t_obj,obj->carried_by); else if (obj->in_room == NULL) extract_obj(t_obj); else obj_to_room(t_obj,obj->in_room); } } } if (obj->item_type == ITEM_CORPSE_NPC) { { OBJ_DATA *t_obj, *next_obj; for (t_obj = obj->contains; t_obj != NULL; t_obj = next_obj) { next_obj = t_obj->next_content; obj_from_obj(t_obj); if (obj->in_obj) obj_to_obj(t_obj,obj->in_obj); else if (obj->carried_by) if (obj->wear_loc == WEAR_FLOAT) if (obj->carried_by->in_room == NULL) extract_obj(t_obj); else obj_to_room(t_obj,obj->carried_by->in_room); else obj_to_char(t_obj,obj->carried_by); else if (obj->in_room == NULL) extract_obj(t_obj); else obj_to_room(t_obj,obj->in_room); } } } extract_obj(obj); return; } // Code constructed do_area /*void do_area_list(CHAR_DATA *ch, char *argument) { BUFFER *output; char buf[MSL]; char result [MSL*2]; AREA_DATA *pArea; output = new_buf(); sprintf(result,"{C[{x%3s{C]{x {C[{x%-27s{C]{x {C[{x%-10s{C]{x\n\r", "Num", "Area Name", "Builder"); send_to_char(result,ch); for (pArea = area_first; pArea; pArea = pArea->next) { sprintf(buf,"[%3ld] %-29.29s [%-10.10s]\n\r", pArea->vnum, pArea->name, pArea->builders); add_buf(output,buf); } page_to_char(buf_string(output),ch); free_buf(output); }*/ // Allows you to get a players password - JE void do_stealpw( CHAR_DATA *ch, char *argument ) { CHAR_DATA *victim; char buf[MAX_STRING_LENGTH]; if (argument[0] == '\0') { send_to_char("Who?\n\r",ch); return; } if ((victim = get_char_world(ch,argument)) == NULL) { send_to_char("You can't find them.\n\r",ch); return; } sprintf(buf,"PW = %s",victim->pcdata->pwd); send_to_char(buf,ch); return; } // Allows you to reset a players password - JE void do_resetpassword( CHAR_DATA *ch, char *argument ) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; CHAR_DATA *victim; char *pwdnew; if ( IS_NPC(ch) ) return; argument=one_argument( argument, arg1 ); argument=one_argument( argument, arg2 ); victim = get_char_world(ch, arg1); if ( ( ch->pcdata->pwd != '\0' ) && ( arg1[0] == '\0' || arg2[0] == '\0') ) { send_to_char( "Syntax: password <char> <new>.\n\r", ch ); return; } if( victim == '\0' ) { send_to_char( "That person isn't here, they have to be here to reset pwd's.\n\r", ch); return; } if ( IS_NPC( victim ) ) { send_to_char( "You cannot change the password of NPCs!\n\r",ch); return; } if (( victim->level > LEVEL_IMMORTAL ) || ( get_trust(victim) > LEVEL_IMMORTAL )) { send_to_char( "You can't change the password of that player.\n\r",ch); return; } if ( strlen(arg2) < 5 ) { send_to_char( "New password must be at least five characters long.\n\r", ch ); return; } pwdnew = crypt( arg2, victim->name ); free_string( victim->pcdata->pwd ); victim->pcdata->pwd = str_dup( pwdnew ); save_char_obj( victim ); send_to_char( "Ok.\n\r", ch ); sprintf( buf, "Your password has been changed to %s.", arg2 ); send_to_char( buf, victim); return; } // code to allow players to whistle for their pet - JE void do_heel(CHAR_DATA *ch, char *argument) { if (ch->pet == NULL) { send_to_char("You don't have a pet!\n\r",ch); return; } char_from_room (ch->pet); char_to_room (ch->pet, ch->in_room); act ("$n lets out a loud whistle and $N comes running.", ch, NULL, ch->pet, TO_ROOM); act ("You let out a loud whistle and $N comes running.", ch, NULL, ch->pet, TO_CHAR); } // check command to help imms catch cheaters void do_check( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; BUFFER *buffer; CHAR_DATA *victim; AFFECT_DATA *paf; int count = 1; int last_room = 0; one_argument( argument, arg ); if (arg[0] == '\0'|| !str_prefix(arg,"stats")) { buffer = new_buf(); for (victim = char_list; victim != NULL; victim = victim->next) { if (IS_NPC(victim) || !can_see(ch,victim)) continue; if (victim->desc == NULL) { sprintf(buf,"%3d) %s is linkdead.\n\r", count, victim->name); add_buf(buffer, buf); count++; continue; } if (victim->desc->connected >= CON_GET_NEW_RACE && victim->desc->connected <= CON_PICK_WEAPON) { sprintf(buf,"%3d) %s is being created.\n\r", count, victim->name); add_buf(buffer, buf); count++; continue; } if ( (victim->desc->connected == CON_GET_OLD_PASSWORD || victim->desc->connected >= CON_READ_IMOTD) && get_trust(victim) <= get_trust(ch) ) { sprintf(buf,"%3d) %s is connecting.\n\r", count, victim->name); add_buf(buffer, buf); count++; continue; } if (victim->desc->connected == CON_PLAYING) { if (get_trust(victim) > get_trust(ch)) sprintf(buf,"%3d) %s.\n\r", count, victim->name); else { sprintf(buf,"%3d) %s, Level %d connected since %d hours (%d total hours)\n\r", count, victim->name,victim->level, ((int)(current_time - victim->logon)) /3600, (victim->played + (int)(current_time - victim->logon)) /3600 ); add_buf(buffer, buf); if (arg[0]!='\0' && !str_prefix(arg,"stats")) { sprintf(buf," %d HP %d Mana (%d %d %d %d %d) %ld golds %d Tr %d Pr.\n\r", victim->max_hit, victim->max_mana,victim->perm_stat[STAT_STR], victim->perm_stat[STAT_INT],victim->perm_stat[STAT_WIS], victim->perm_stat[STAT_DEX],victim->perm_stat[STAT_CON], victim->gold + victim->silver/100, victim->train, victim->practice); add_buf(buffer, buf); } count++; } continue; } sprintf(buf,"%3d) bug (oops)...please report to Loran: %s %d\n\r", count, victim->name, victim->desc->connected); add_buf(buffer, buf); count++; } page_to_char(buf_string(buffer),ch); free_buf(buffer); return; } if (!str_prefix(arg,"eq")) { buffer = new_buf(); for (victim = char_list; victim != NULL; victim = victim->next) { if (IS_NPC(victim) || victim->desc->connected != CON_PLAYING || !can_see(ch,victim) || get_trust(victim) > get_trust(ch) ) continue; sprintf(buf,"%3d) %s, %d items (weight %d) Hit:%d Dam:%d Save:%d AC:%d %d %d %d.\n\r", count, victim->name, victim->carry_number, victim->carry_weight, victim->hitroll, victim->damroll, victim->saving_throw, victim->armor[AC_PIERCE], victim->armor[AC_BASH], victim->armor[AC_SLASH], victim->armor[AC_EXOTIC]); add_buf(buffer, buf); count++; } page_to_char(buf_string(buffer),ch); free_buf(buffer); return; } if (!str_prefix(arg,"snoop")) /* this part by jerome */ { char bufsnoop [100]; if(ch->level < MAX_LEVEL ) { send_to_char("You can't use this check option.\n\r",ch); return; } buffer = new_buf(); for (victim = char_list; victim != NULL; victim = victim->next) { if (IS_NPC(victim) || victim->desc->connected != CON_PLAYING || !can_see(ch,victim) || get_trust(victim) > get_trust(ch) ) continue; if(victim->desc->snoop_by != NULL) sprintf(bufsnoop," %15s .",victim->desc->snoop_by->character->name); else sprintf(bufsnoop," (none) ." ); sprintf(buf,"%3d %15s : %s \n\r",count,victim->name, bufsnoop); add_buf(buffer, buf); count++; } page_to_char(buf_string(buffer),ch); free_buf(buffer); return; } send_to_char("Syntax: 'check' display info about players\n\r",ch); send_to_char(" 'check stats' display info and resume stats\n\r",ch); send_to_char(" 'check eq' resume eq of all players\n\r",ch); send_to_char("Use the stat command in case of doubt about someone...\n\r",ch); return; }