예제 #1
0
파일: save.c 프로젝트: zachflower/oasis-mud
/*
 * Write the char.
 */
void fwrite_char( CHAR_DATA * ch, FILE * fp ) {
  AFFECT_DATA * paf;
  int           sn;

  fprintf( fp, "#%s\n", IS_NPC( ch ) ? "MOB" : "PLAYER" );

  fprintf( fp, "Nm          %s~\n", ch->name );

  if ( ch->pcdata->lname && ch->pcdata->lname[ 0 ] != '\0' ) {
    fprintf( fp, "Lnm         %s~\n", ch->pcdata->lname );
  }

  fprintf( fp, "ShtDsc      %s~\n", ch->short_descr );
  fprintf( fp, "LngDsc      %s~\n", ch->long_descr );
  fprintf( fp, "Dscr        %s~\n", ch->description );
  fprintf( fp, "Prmpt       %s~\n", ch->prompt );
  fprintf( fp, "Sx          %d\n", ch->sex );
  fprintf( fp, "Cla         %s\n", class_numbers( ch, TRUE ) );
  fprintf( fp, "Rce         %d\n", ch->race );
  fprintf( fp, "Wiznet      %d\n", ch->wiznet );
  fprintf( fp, "Clan        %d\n", ch->clan );
  fprintf( fp, "Clvl        %d\n", ch->clev );
  fprintf( fp, "Ctmr        %d\n", ch->ctimer );
  fprintf( fp, "Stun        %d %d %d %d %d\n",
           ch->stunned[ 0 ], ch->stunned[ 1 ], ch->stunned[ 2 ],
           ch->stunned[ 3 ], ch->stunned[ 4 ] );
  fprintf( fp, "WizLev      %d\n", ch->wizinvis );
  fprintf( fp, "ClkLev      %d\n", ch->cloaked );
  fprintf( fp, "Lvl         %d\n", ch->level );
  fprintf( fp, "Antidisarm  %d\n", ch->antidisarm );
  fprintf( fp, "Trst        %d\n", ch->trust );
  fprintf( fp, "Security    %d\n", ch->pcdata->security );          /* OLC */
  fprintf( fp, "Wizbt       %d\n", ch->wizbit );
  fprintf( fp, "Playd       %d\n",
           ch->played + (int) ( current_time - ch->logon ) );
  fprintf( fp, "Note        %ld\n", ch->last_note );
  fprintf( fp, "Room        %d\n",
           (  ch->in_room == get_room_index( ROOM_VNUM_LIMBO )
              && ch->was_in_room )
           ? ch->was_in_room->vnum
           : ch->in_room->vnum );

  fprintf( fp, "HpMnMv    %d %d %d %d %d %d %d %d %d\n",
           ch->hit, ch->perm_hit, ch->mod_hit, ch->mana, ch->perm_mana,
           ch->mod_mana, ch->move, ch->perm_move, ch->mod_move );
  fprintf( fp, "Gold	      %d\n", ch->money.gold );
  fprintf( fp, "Silver      %d\n", ch->money.silver );
  fprintf( fp, "Copper      %d\n", ch->money.copper );
  fprintf( fp, "Exp         %d\n", ch->exp );
  fprintf( fp, "Act         %d\n", ch->act );
  fprintf( fp, "Act2        %d\n", ch->act2 );
  fprintf( fp, "AffdBy      %ld\n", ch->affected_by );
  fprintf( fp, "AffdBy2     %ld\n", ch->affected_by2 );
  fprintf( fp, "ImmBits     %ld\n", ch->imm_flags );
  fprintf( fp, "ResBits     %ld\n", ch->res_flags );
  fprintf( fp, "VulBits     %ld\n", ch->vul_flags );
  /* Bug fix from Alander */
  fprintf( fp, "Pos         %d\n", ch->position == POS_FIGHTING ? POS_STANDING : ch->position );
  fprintf( fp, "Size        %d\n", ch->size );

  fprintf( fp, "Prac        %d\n", ch->practice );
  fprintf( fp, "SavThr      %d\n", ch->saving_throw );
  fprintf( fp, "Align       %d\n", ch->alignment );
  fprintf( fp, "SAlign      %c\n", ch->start_align );
  fprintf( fp, "Hit         %d\n", ch->hitroll );
  fprintf( fp, "Dam         %d\n", ch->damroll );
  fprintf( fp, "Armr        %d\n", ch->armor );
  fprintf( fp, "Wimp        %d\n", ch->wimpy );
  fprintf( fp, "Deaf        %d\n", ch->deaf );
  fprintf( fp, "Email	      %s~\n", ch->pcdata->email );
  fprintf( fp, "Plan	      %s~\n", ch->pcdata->plan );
  fprintf( fp, "Corpses     %d\n", ch->pcdata->corpses );

  if ( ch->cquestpnts  != 0 ) {
    fprintf( fp, "Cquestpnts  %d\n", ch->cquestpnts );
  }

  if ( ch->questpoints != 0 ) {
    fprintf( fp, "QuestPnts   %d\n", ch->questpoints );
  }

  if ( ch->nextquest != 0 ) {
    fprintf( fp, "QuestNext   %d\n", ch->nextquest );
  } else if ( ch->countdown != 0 ) {
    fprintf( fp, "QuestNext   %d\n", 30 );
  }

  /* 30 */
  if ( IS_NPC( ch ) ) {
    fprintf( fp, "Vnum        %d\n", ch->pIndexData->vnum );
  } else {
    fprintf( fp, "Paswd       %s~\n", ch->pcdata->pwd );
    fprintf( fp, "Bmfin       %s~\n", ch->pcdata->bamfin );
    fprintf( fp, "Bmfout      %s~\n", ch->pcdata->bamfout );
    fprintf( fp, "Bmfsee      %s~\n", ch->pcdata->bamfusee );
    fprintf( fp, "Trnsto      %s~\n", ch->pcdata->transto );
    fprintf( fp, "Trnsfrom    %s~\n", ch->pcdata->transfrom );
    fprintf( fp, "Trnvict     %s~\n", ch->pcdata->transvict );
    fprintf( fp, "Slyuc       %s~\n", ch->pcdata->slayusee );
    fprintf( fp, "Slyrm       %s~\n", ch->pcdata->slayroom );
    fprintf( fp, "Slyvict     %s~\n", ch->pcdata->slayvict );
    fprintf( fp, "Afkmes      %s~\n", ch->pcdata->afkchar );
    /* EotS stats tracking */
    fprintf( fp, "Pkills      %d\n", ch->pkills );
    fprintf( fp, "pkilled     %d\n", ch->pkilled );
    fprintf( fp, "Incarnations %d\n", ch->incarnations );
    fprintf( fp, "Raisepts    %d\n", ch->raisepts );

    fprintf( fp, "Bank      %d %d %d\n",
             ch->pcdata->bankaccount.gold,
             ch->pcdata->bankaccount.silver,
             ch->pcdata->bankaccount.copper );
    fprintf( fp, "Ttle        %s~\n", ch->pcdata->title );
    fprintf( fp, "Whotype	  %s~\n", ch->pcdata->whotype );
    fprintf( fp, "AtrPrm      %d %d %d %d %d %d\n",
             ch->pcdata->perm_str,
             ch->pcdata->perm_int,
             ch->pcdata->perm_wis,
             ch->pcdata->perm_dex,
             ch->pcdata->perm_con,
             ch->pcdata->perm_cha );

    fprintf( fp, "AtrMd       %d %d %d %d %d %d\n",
             ch->pcdata->mod_str,
             ch->pcdata->mod_int,
             ch->pcdata->mod_wis,
             ch->pcdata->mod_dex,
             ch->pcdata->mod_con,
             ch->pcdata->mod_cha );

    fprintf( fp, "Cond        %d %d %d\n",
             ch->pcdata->condition[ 0 ],
             ch->pcdata->condition[ 1 ],
             ch->pcdata->condition[ 2 ] );

    fprintf( fp, "Pglen       %d\n", ch->pcdata->pagelen );
    fprintf( fp, "Empower     %s~\n", ch->pcdata->empowerments );
    fprintf( fp, "Detract     %s~\n", ch->pcdata->detractments );

    for ( sn = 0; skill_table[ sn ].name[ 0 ] != '\0'; sn++ ) {
      if ( skill_table[ sn ].name && ch->pcdata->learned[ sn ] > 0 ) {
        fprintf( fp, "Skll        %d '%s'\n",
                 ch->pcdata->learned[ sn ], skill_table[ sn ].name );
      }
    }
  }

  for ( paf = ch->affected; paf; paf = paf->next ) {
    if ( paf->deleted ) {
      continue;
    }

    fprintf( fp, "Aff       %3d %3d %3d %3d %10d %3d\n",
             skill_table[ paf->type ].slot,
             paf->duration,
             paf->modifier,
             paf->location,
             paf->bitvector,
             paf->level );
  }

  for ( paf = ch->affected2; paf; paf = paf->next ) {
    if ( paf->deleted ) {
      continue;
    }

    fprintf( fp, "Aff2       %3d %3d %3d %3d %10d %3d\n",
             skill_table[ paf->type ].slot,
             paf->duration,
             paf->modifier,
             paf->location,
             paf->bitvector,
             paf->level );
  }

  if ( ch->pcdata && ch->pcdata->alias_list ) {
    ALIAS_DATA * pAl;

    for ( pAl = ch->pcdata->alias_list; pAl; pAl = pAl->next ) {
      fprintf( fp, "Alias      %s~ %s~\n",
               pAl->old, pAl->new );
    }
  }
예제 #2
0
void do_mpstat(CHAR_DATA * ch, char *argument)
{
	char buf[MAX_STRING_LENGTH];
	char arg[MAX_INPUT_LENGTH];
	MPROG_DATA *mprg;
	CHAR_DATA *victim;

	one_argument(argument, arg);

	if (arg[0] == '\0') {
		send_to_char(C_DEFAULT, "MobProg stat whom?\n\r", ch);
		return;
	}

	if ((victim = get_char_world(ch, arg)) == NULL) {
		send_to_char(C_DEFAULT, "They aren't here.\n\r", ch);
		return;
	}

	if (!IS_NPC(victim)) {
		send_to_char(C_DEFAULT, "Only Mobiles can have Programs!\n\r",
			     ch);
		return;
	}

	if (!(victim->pIndexData->progtypes)) {
		send_to_char(C_DEFAULT, "That Mobile has no Programs set.\n\r",
			     ch);
		return;
	}

	sprintf(buf, "Name: %s.  Vnum: %d.\n\r",
		victim->name, victim->pIndexData->vnum);
	send_to_char(C_DEFAULT, buf, ch);

	sprintf(buf, "Short description: %s.\n\rLong  description: %s",
		victim->short_descr,
		victim->long_descr[0] != '\0' ?
		victim->long_descr : "(none).\n\r");
	send_to_char(C_DEFAULT, buf, ch);

	sprintf(buf, "Hp: %d/%d(%d).  Mana: %d/%d(%d).  Move: %d/%d(%d).\n\r",
		victim->hit, victim->perm_hit, MAX_HIT(victim),
		victim->mana, victim->perm_mana, MAX_MANA(victim),
		victim->move, victim->perm_move, MAX_MOVE(victim));
	send_to_char(C_DEFAULT, buf, ch);

#ifdef NEW_MONEY
	sprintf(buf,
		"Lv: %d.  Class: %s.  Align: %d.  AC: %d.  Exp: %d.\n\r",
		victim->level, class_numbers(victim, FALSE), victim->alignment,
		GET_AC(victim), victim->exp);
	send_to_char(C_DEFAULT, buf, ch);
	sprintf(buf, "Gold: %d   Silver: %d   Copper: %d.\n\r",
		victim->money.gold, victim->money.silver, victim->money.copper);
	send_to_char(C_DEFAULT, buf, ch);
#else
	sprintf(buf,
		"Lv: %d.  Class: %s.  Align: %d.  AC: %d.  Gold: %d.  Exp: %d.\n\r",
		victim->level, class_numbers(victim, FALSE), victim->alignment,
		GET_AC(victim), victim->gold, victim->exp);
	send_to_char(C_DEFAULT, buf, ch);
#endif
	for (mprg = victim->pIndexData->mobprogs; mprg != NULL;
	     mprg = mprg->next) {
		sprintf(buf, ">%s %s\n\r%s\n\r\n\r",
			mprog_type_to_name(mprg->type),
			mprg->arglist, mprg->comlist);
		send_to_char(C_DEFAULT, buf, ch);
	}

	return;

}