artifact.c

demise/src/artifact.c · 30.6 KB

From the archive dodbackup-final.tar.gz

Download the archive   « Back to the archive contents

/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/

/***************************************************************************
 *  God Wars Mud improvements copyright (C) 1994, 1995, 1996 by Richard    *
 *  Woolcock.  This mud is NOT to be copied in whole or in part, or to be  *
 *  run without the permission of Richard Woolcock.  Nobody else has       *
 *  permission to authorise the use of this code.                          *
 ***************************************************************************/

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"

/*int clan_table_search args( (CHAR_DATA *ch) );*/
/*void format_string_spaces args ( (char *argument,int spaces) );*/

void
artifact_table_write (void)
{
  int art_pos;
  FILE *fp;

  if ((fp = fopen (ART_LIST, "w")) == NULL)
    {
      log_string ("Error writing to artifact.txt");
    }

  for (art_pos = 0; art_pos < MAX_ART; art_pos++)
    {
      fprintf (fp, "%d\n%s~\n",
	       artifact_table[art_pos].object_vnum,
	       artifact_table[art_pos].player_name);
    }
  fclose (fp);
  return;
}

void
artifact_table_read (void)
{
  int art_pos;
  FILE *fp;

  if ((fp = fopen (ART_LIST, "r")) == NULL)
    {
      log_string ("Error: artifact.txt not found!");
      return;
    }

  for (art_pos = 0; art_pos < MAX_ART; art_pos++)
    {
      artifact_table[art_pos].object_vnum = fread_number (fp);
      if (artifact_table[art_pos].object_vnum)
	artifact_table[art_pos].object_vnum = 0;
      artifact_table[art_pos].player_name = fread_string (fp);
      if (artifact_table[art_pos].player_name == NULL)
	artifact_table[art_pos].player_name = str_dup ("none");
      if (!str_cmp ((artifact_table[art_pos].player_name), "Corim")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Nymph")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Linksys")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Ixia")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Vertigo")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Victoria")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Tavillion")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Agni")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Graendal")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Shandi")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Shinzon")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Annalise")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Yurika")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Xanthes")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Amaryllis")
	  || !str_cmp ((artifact_table[art_pos].player_name), "Mysql"))
	{
	  artifact_table[art_pos].player_name = str_dup ("none");
	}

    }
  fclose (fp);

  if (artifact_table[0].object_vnum != 29500)
    artifact_table[0].object_vnum = 29500;
  if (artifact_table[1].object_vnum != 29501)
    artifact_table[1].object_vnum = 29501;
  if (artifact_table[2].object_vnum != 29502)
    artifact_table[2].object_vnum = 29502;
  if (artifact_table[3].object_vnum != 29503)
    artifact_table[3].object_vnum = 29503;
  if (artifact_table[4].object_vnum != 29504)
    artifact_table[4].object_vnum = 29504;
  if (artifact_table[5].object_vnum != 29505)
    artifact_table[5].object_vnum = 29505;
  if (artifact_table[6].object_vnum != 29506)
    artifact_table[6].object_vnum = 29506;
  if (artifact_table[7].object_vnum != 29507)
    artifact_table[7].object_vnum = 29507;
  if (artifact_table[8].object_vnum != 29508)
    artifact_table[8].object_vnum = 29508;
  if (artifact_table[9].object_vnum != 29509)
    artifact_table[9].object_vnum = 29509;
  if (artifact_table[10].object_vnum != 29510)
    artifact_table[10].object_vnum = 29510;
  if (artifact_table[11].object_vnum != 29511)
    artifact_table[11].object_vnum = 29511;
  if (artifact_table[12].object_vnum != 29512)
    artifact_table[12].object_vnum = 29512;
  if (artifact_table[13].object_vnum != 29513)
    artifact_table[13].object_vnum = 29513;
  if (artifact_table[14].object_vnum != 29514)
    artifact_table[14].object_vnum = 29514;
  if (artifact_table[15].object_vnum != 29515)
    artifact_table[15].object_vnum = 29515;
  if (artifact_table[16].object_vnum != 29516)
    artifact_table[16].object_vnum = 29516;
  if (artifact_table[17].object_vnum != 29517)
    artifact_table[17].object_vnum = 29517;
  if (artifact_table[18].object_vnum != 29518)
    artifact_table[18].object_vnum = 29518;
  if (artifact_table[19].object_vnum != 29519)
    artifact_table[19].object_vnum = 29519;
  if (artifact_table[20].object_vnum != 29520)
    artifact_table[20].object_vnum = 29520;
  if (artifact_table[21].object_vnum != 29521)
    artifact_table[21].object_vnum = 29521;
  return;
}

void
do_artitest (CHAR_DATA * ch, char *argument)
{
  DESCRIPTOR_DATA *d;
  CHAR_DATA *gch;

  if (IS_NPC (ch))
    return;

  if (!IS_CREATOR (ch))
    return;

  stc ("Artifact table Updated.\n\r", ch);
  for (d = descriptor_list; d != NULL; d = d->next)
    {
      if (d->connected != CON_PLAYING)
	continue;
      if ((gch = d->character) == NULL)
	continue;
      if (IS_NPC (gch))
	continue;
      if (has_artifact (gch))
	{
	  updatearti (gch);
	}
    }
  artifact_table_write ();
  return;
}

void
updatearti (CHAR_DATA * ch)
{
  OBJ_DATA *obj;

  if (IS_NPC (ch))
    return;

  if (!has_artifact (ch))
    return;

  if (!str_cmp (ch->name, "Corim") || !str_cmp (ch->name, "Nymph") ||
      !str_cmp (ch->name, "Tijer") || !str_cmp (ch->name, "Ixia") ||
      !str_cmp (ch->name, "Vertigo") || !str_cmp (ch->name, "Victoria") ||
      !str_cmp (ch->name, "Tavillion") || !str_cmp (ch->name, "Agni") ||
      !str_cmp (ch->name, "Graendal") || !str_cmp (ch->name, "Shandi") ||
      !str_cmp (ch->name, "Shinzon") || !str_cmp (ch->name, "Annalise") ||
      !str_cmp (ch->name, "Yurika"))
    {
      return;
    }
  else
    {
      if (ch->pcdata->artinum == ARTI_1
	  && str_cmp ((artifact_table[0].player_name), ch->name))
	artifact_table[0].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_2
	  && str_cmp ((artifact_table[1].player_name), ch->name))
	artifact_table[1].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_3
	  && str_cmp ((artifact_table[2].player_name), ch->name))
	artifact_table[2].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_4
	  && str_cmp ((artifact_table[3].player_name), ch->name))
	artifact_table[3].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_5
	  && str_cmp ((artifact_table[4].player_name), ch->name))
	artifact_table[4].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_6
	  && str_cmp ((artifact_table[5].player_name), ch->name))
	artifact_table[5].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_7
	  && str_cmp ((artifact_table[6].player_name), ch->name))
	artifact_table[6].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_8
	  && str_cmp ((artifact_table[7].player_name), ch->name))
	artifact_table[7].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_9
	  && str_cmp ((artifact_table[8].player_name), ch->name))
	artifact_table[8].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_10
	  && str_cmp ((artifact_table[9].player_name), ch->name))
	artifact_table[9].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_11
	  && str_cmp ((artifact_table[10].player_name), ch->name))
	artifact_table[10].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_12
	  && str_cmp ((artifact_table[11].player_name), ch->name))
	artifact_table[11].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_13
	  && str_cmp ((artifact_table[12].player_name), ch->name))
	artifact_table[12].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_14
	  && str_cmp ((artifact_table[13].player_name), ch->name))
	artifact_table[13].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_15
	  && str_cmp ((artifact_table[14].player_name), ch->name))
	artifact_table[14].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_16
	  && str_cmp ((artifact_table[15].player_name), ch->name))
	artifact_table[15].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_17
	  && str_cmp ((artifact_table[16].player_name), ch->name))
	artifact_table[16].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_18
	  && str_cmp ((artifact_table[17].player_name), ch->name))
	artifact_table[17].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_19
	  && str_cmp ((artifact_table[18].player_name), ch->name))
	artifact_table[18].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_20
	  && str_cmp ((artifact_table[19].player_name), ch->name))
	artifact_table[19].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_21
	  && str_cmp ((artifact_table[20].player_name), ch->name))
	artifact_table[20].player_name = str_dup (ch->name);

      if (ch->pcdata->artinum == ARTI_22
	  && str_cmp ((artifact_table[21].player_name), ch->name))
	artifact_table[21].player_name = str_dup (ch->name);
    }
  return;
}


void
do_show_artifacts (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  char art[MSL];
  OBJ_INDEX_DATA *pObjIndex;
  int art_pos;

  send_to_char
    ("       #0-=> #yA r t i f a c t s   o f   t h e   g a m e #0<=-#n\n\r",
     ch);
  send_to_char
    ("#R[#0Artifact Name                    #R] [#0Discovered by:           #R]#n\n\r",
     ch);

// arti 1

  if ((pObjIndex = get_obj_index (ARTI_1)) == NULL)
    {
      sprintf (art, "Artifact 1 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[0].player_name) < 3 ||
      !str_cmp ((artifact_table[0].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[0].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 2

  if ((pObjIndex = get_obj_index (ARTI_2)) == NULL)
    {
      sprintf (art, "Artifact 2 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[1].player_name) < 3 ||
      !str_cmp ((artifact_table[1].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[1].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 3

  if ((pObjIndex = get_obj_index (ARTI_3)) == NULL)
    {
      sprintf (art, "Artifact 3 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[2].player_name) < 3 ||
      !str_cmp ((artifact_table[2].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[2].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 4

  if ((pObjIndex = get_obj_index (ARTI_4)) == NULL)
    {
      sprintf (art, "Artifact 4 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[3].player_name) < 3 ||
      !str_cmp ((artifact_table[3].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[3].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 5

  if ((pObjIndex = get_obj_index (ARTI_5)) == NULL)
    {
      sprintf (art, "Artifact 5 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[4].player_name) < 3 ||
      !str_cmp ((artifact_table[4].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[4].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 6

  if ((pObjIndex = get_obj_index (ARTI_6)) == NULL)
    {
      sprintf (art, "Artifact 6 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[5].player_name) < 3 ||
      !str_cmp ((artifact_table[5].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[5].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 7

  if ((pObjIndex = get_obj_index (ARTI_7)) == NULL)
    {
      sprintf (art, "Artifact 7 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[6].player_name) < 3 ||
      !str_cmp ((artifact_table[6].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[6].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 8

  if ((pObjIndex = get_obj_index (ARTI_8)) == NULL)
    {
      sprintf (art, "Artifact 8 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[7].player_name) < 3 ||
      !str_cmp ((artifact_table[7].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[7].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 9

  if ((pObjIndex = get_obj_index (ARTI_9)) == NULL)
    {
      sprintf (art, "Artifact 9 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[8].player_name) < 3 ||
      !str_cmp ((artifact_table[8].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[8].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 10

  if ((pObjIndex = get_obj_index (ARTI_10)) == NULL)
    {
      sprintf (art, "Artifact 10 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[9].player_name) < 3 ||
      !str_cmp ((artifact_table[9].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[9].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 11

  if ((pObjIndex = get_obj_index (ARTI_11)) == NULL)
    {
      sprintf (art, "Artifact 11 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[10].player_name) < 3 ||
      !str_cmp ((artifact_table[10].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[10].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 12

  if ((pObjIndex = get_obj_index (ARTI_12)) == NULL)
    {
      sprintf (art, "Artifact 12 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[11].player_name) < 3 ||
      !str_cmp ((artifact_table[11].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[11].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 13

  if ((pObjIndex = get_obj_index (ARTI_13)) == NULL)
    {
      sprintf (art, "Artifact 13 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[12].player_name) < 3 ||
      !str_cmp ((artifact_table[12].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[12].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 14

  if ((pObjIndex = get_obj_index (ARTI_14)) == NULL)
    {
      sprintf (art, "Artifact 14 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[13].player_name) < 3 ||
      !str_cmp ((artifact_table[13].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[13].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 15

  if ((pObjIndex = get_obj_index (ARTI_15)) == NULL)
    {
      sprintf (art, "Artifact 15 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[14].player_name) < 3 ||
      !str_cmp ((artifact_table[14].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[14].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 16

  if ((pObjIndex = get_obj_index (ARTI_16)) == NULL)
    {
      sprintf (art, "Artifact 16 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[15].player_name) < 3 ||
      !str_cmp ((artifact_table[15].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[15].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 17

  if ((pObjIndex = get_obj_index (ARTI_17)) == NULL)
    {
      sprintf (art, "Artifact 17 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[16].player_name) < 3 ||
      !str_cmp ((artifact_table[16].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[16].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 18

  if ((pObjIndex = get_obj_index (ARTI_18)) == NULL)
    {
      sprintf (art, "Artifact 18 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[17].player_name) < 3 ||
      !str_cmp ((artifact_table[17].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[17].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 19

  if ((pObjIndex = get_obj_index (ARTI_19)) == NULL)
    {
      sprintf (art, "Artifact 19 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[18].player_name) < 3 ||
      !str_cmp ((artifact_table[18].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[18].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 20

  if ((pObjIndex = get_obj_index (ARTI_20)) == NULL)
    {
      sprintf (art, "Artifact 20 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[19].player_name) < 3 ||
      !str_cmp ((artifact_table[19].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[19].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 21

  if ((pObjIndex = get_obj_index (ARTI_21)) == NULL)
    {
      sprintf (art, "Artifact 21 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[20].player_name) < 3 ||
      !str_cmp ((artifact_table[20].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[20].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);

// arti 22

  if ((pObjIndex = get_obj_index (ARTI_22)) == NULL)
    {
      sprintf (art, "Artifact 22 missing tell Corim!", ch);
    }
  else
    {
      sprintf (art, "%s", pObjIndex->short_descr);
    }
  if (strlen (artifact_table[21].player_name) < 3 ||
      !str_cmp ((artifact_table[21].player_name), "none"))
    {
      sprintf (buf, "#R[#n%s#R] [#0Has not been discovered. #R]#n\n\r",
	       align_text (art, 33));
    }
  else
    {
      sprintf (buf, "#R[#n%-33s#R] [#7%-25s#R]#n\n\r", align_text (art, 33),
	       artifact_table[21].player_name);
    }
  buf[0] = UPPER (buf[0]);
  send_to_char (buf, ch);


  send_to_char
    ("#R[#PNymph#c'#Ps#L M#la#7g#li#Lc#c W#Can#cd               #R] [#7Well...Nymph lost it.....#R]#n\n\r",
     ch);
  return;
}

/*
struct artifact_type artifact_table[MAX_ART] = {
  {"none", 29500},
  {"none", 29501},
  {"none", 29502},
  {"none", 29503},
  {"none", 29504},
  {"none", 29505},
  {"none", 29506},
  {"none", 29507},
  {"none", 29508},
  {"none", 29509},
  {"none", 29510},
  {"none", 29511},
  {"none", 29512},
  {"none", 29513},
  {"none", 29514},
  {"none", 29515},
  {"none", 29516},
  {"none", 29517},
  {"none", 29518},
  {"none", 29519},
  {"none", 29520},
  {"none", 29521}
};
*/

void
do_takeapart (CHAR_DATA * ch, char *argument)
{
  char arg1[MIL];
  char arg2[MIL];
  char buf[MSL];
  OBJ_INDEX_DATA *pObjIndex;
  OBJ_DATA *obj1;
  OBJ_DATA *obj2;
  int number = 0;
  int temp = 0;

  argument = one_argument (argument, arg1);
  argument = one_argument (argument, arg2);

  if (IS_NPC (ch))
    return;

  if (arg1[0] == '\0' || arg2[0] == '\0' || !is_number (arg2))
    {
      send_to_char ("Syntax : takeapart [object] [pieces]\n\r", ch);
      return;
    }

  if ((obj1 = get_obj_carry (ch, arg1)) == NULL)
    {
      send_to_char ("You are not carrying that object.\n\r", ch);
      return;
    }

  number = atoi (arg2);

  if (number < 1 || number > 25)
    {
      send_to_char ("Range is 1 to 25.\n\r", ch);
      return;
    }

  if ((pObjIndex = get_obj_index (OBJ_VNUM_PROTOPLASM)) == NULL)
    {
      send_to_char ("Error....missing object, please inform an imp.\n\r", ch);
      return;
    }

  for (temp = 0; temp < number; temp++)
    {
      obj2 = create_object (pObjIndex, obj1->level);
      obj2->item_type = ITEM_PIECE;
      obj2->value[0] = obj1->pIndexData->vnum;
      obj2->value[1] = number;
      obj2->value[2] = 1;
      obj2->value[3] = 0;
      obj2->weight = 1;
      obj_to_char (obj2, ch);
      FILL_STRING (obj2->questmaker, ch->name);
      sprintf (buf, "piece %s", obj1->name);
      FILL_STRING (obj2->name, buf);
      sprintf (buf, "a piece of %s", obj1->short_descr);
      FILL_STRING (obj2->short_descr, buf);
      sprintf (buf, "A piece of %s lies here.", obj1->short_descr);
      FILL_STRING (obj2->description, buf);
      SET_BIT (obj2->extra_flags, ITEM_NOSUMMON);
     }

  sprintf (buf, "You break $p into %d pieces.", number);
  act (buf, ch, obj1, NULL, TO_CHAR);

  sprintf (buf, "$n breaks $p into %d pieces.", number);
  act (buf, ch, obj1, NULL, TO_ROOM);

  if (obj1 != NULL)
    extract_obj (obj1);

  return;
}

void
do_puttogether (CHAR_DATA * ch, char *argument)
{
  char arg1[MIL];
  char arg2[MIL];
  char buf[MSL];
  OBJ_INDEX_DATA *pObjIndex;
  OBJ_DATA *obj1;
  OBJ_DATA *obj2;
  OBJ_DATA *obj3;
  OBJ_DATA *create;

  argument = one_argument (argument, arg1);
  argument = one_argument (argument, arg2);

  if (arg1[0] == '\0' || arg2[0] == '\0')
    {
      send_to_char ("Syntax : puttogether [obj1] [obj2]\n\r", ch);
      return;
    }

  if ((obj1 = get_obj_carry (ch, arg1)) == NULL)
    {
      sprintf (buf, "You are not carrying %s.\n\r", arg1);
      send_to_char (buf, ch);
      return;
    }

  if ((obj2 = get_obj_carry (ch, arg2)) == NULL)
    {
      sprintf (buf, "You are not carrying %s.\n\r", arg2);
      send_to_char (buf, ch);
      return;
    }

  if (obj1->item_type != ITEM_PIECE || obj2->item_type != ITEM_PIECE)
    {
      send_to_char ("Both pieces must be pieces of an item.\n\r", ch);
      return;
    }

  if (obj1->value[0] != obj2->value[0])
    {
      send_to_char ("Both pieces must from them same item.\n\r", ch);
      return;
    }

  if (obj1 == obj2)
    {
      send_to_char ("You can't attach the same piece to itself.\n\r", ch);
      return;
    }

  if (obj1->value[1] != obj2->value[1])
    {
      send_to_char ("They don't seem to fit together.\n\r", ch);
      return;
    }

  if ((pObjIndex = get_obj_index (OBJ_VNUM_PROTOPLASM)) == NULL)
    {
      send_to_char ("Error...item missing, please inform an imp.\n\r", ch);
      return;
    }
  obj3 = create_object (pObjIndex, obj1->level);
  obj3->item_type = ITEM_PIECE;
  obj3->value[0] = obj1->value[0];
  obj3->value[1] = obj1->value[1];
  obj3->value[2] = obj1->value[2] + obj2->value[2];
  obj3->value[3] = 0;
  obj3->weight = 1;
  obj_to_char (obj3, ch);
  FILL_STRING (obj3->questmaker, obj1->questmaker);
  FILL_STRING (obj3->name, obj1->name);
  FILL_STRING (obj3->short_descr, obj1->short_descr);
  FILL_STRING (obj3->description, obj1->description);

  sprintf (buf, "You fix %s to %s.\n\r", obj1->short_descr,
	   obj2->short_descr);
  send_to_char (buf, ch);

  sprintf (buf, "$n fixes $p to %s.", obj2->short_descr);
  act (buf, ch, obj1, NULL, TO_ROOM);

  extract_obj (obj1);
  extract_obj (obj2);

  if (obj3->value[1] <= obj3->value[2])
    {
      if ((pObjIndex = get_obj_index (obj3->value[0])) == NULL)
	{
	  send_to_char ("Object missing, please inform an imp.\n\r", ch);
	  return;
	}

      create = create_object (pObjIndex, obj3->level);
      obj_to_char (create, ch);
      act ("You have put together $p.", ch, create, NULL, TO_CHAR);
      act ("$n has put together $p.", ch, create, NULL, TO_ROOM);
      sprintf (log_buf, "%s -> put together %s", ch->name,
	       create->short_descr);
      log_string (log_buf);
      FILL_STRING (create->questmaker, obj3->questmaker);
      extract_obj (obj3);
  REMOVE_BIT (ch->xxxbits, XXX_PIECE);
      sprintf (buf, "#C%s#c has created #n%s#c.#n", capitalize (ch->name),
	       create->short_descr);
      do_info (ch, buf);
      return;
    }
  else
    {
      sprintf (buf, "There are %d more pieces out there.\n\r",
	       (obj3->value[1] - obj3->value[2]));
      send_to_char (buf, ch);
      return;
    }
  return;
}

void
do_hideaway (CHAR_DATA * ch, char *argument)
{
  int room = 0;
  char buf[MSL];
  int i;
  char arg[MSL];
  ROOM_INDEX_DATA *location;
  OBJ_DATA *obj;
  int value;

  argument = one_argument (argument, arg);

  if (arg[0] == '\0')
    {
      stc ("Syntax is hideaway <object>\n\r", ch);
      return;
    }

  if ((obj = get_obj_carry (ch, arg)) == NULL)
    {
      sprintf (buf, "You are not carrying %s.\n\r", arg);
      send_to_char (buf, ch);
      return;
    }
//  for (i = 0; i < atoi (arg); i++)
//    {
      location = NULL;
     room = 0;
      while ((location = get_room_index (room)) == NULL || location->area->plane == PLANE_TRANQ)
	{
	  room = number_range (0, 32000);
	}
      obj_from_char (obj);
      obj_to_room (obj, location);
//    }
  send_to_char ("Ok.\n\r", ch);
  sprintf (buf, "%s has been hidden somewhere in the MUD.\n\r",
	   obj->short_descr);
if (IS_IMMORTAL (ch))
  stc (buf, ch);
  return;
}

Site Stats

Snippets: 1791
Codebases: 571