cotn25/area/
cotn25/src/




/*********************************************
 * COTN RUNE 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"



void do_runebuy( CHAR_DATA *ch, char *argument )
{
  OBJ_INDEX_DATA *pObjIndex;
  OBJ_DATA *obj;
  char arg[MAX_INPUT_LENGTH];
  int vnum = 0;

  argument = one_argument( argument, arg );

  if (IS_NPC(ch)) return;

//  if (arg[0] == '\0')
//  {
//  send_to_char("RUNES: Fire, Water, Air, Earth                                            
//\n\r",ch);
    //return;
  //}

  if ( ch->pcdata->quest < 1000000 )
  {
    send_to_char("You don't have the 1 Mill qps needed.\n\r",ch);
    return;
  }
/*
  if      (!str_cmp(arg,"fire"        )) vnum = 80902;
  else if (!str_cmp(arg,"water"      )) vnum = 80903;
  else if (!str_cmp(arg,"air"      )) vnum = 80905;
  else if (!str_cmp(arg,"earth"      )) vnum = 80904;
  else
*/
vnum =  80906;
  /*{
    do_runebuy(ch,"");
    return;
  }
*/
  if ( vnum == 0 || (pObjIndex = get_obj_index( vnum )) == NULL)
  {
    send_to_char("Missing object, please inform Xrakisis .\n\r",ch);
    return;
  }
  if(!IS_IMMORTAL(ch)) ch->pcdata->quest -= 1000000;
  obj = create_object(pObjIndex, 50);
  obj->questowner = str_dup(ch->pcdata->switchname);
  obj_to_char(obj, ch);
  act("You transform the 1000K qp into $p.",ch,obj,NULL,TO_CHAR);
  act("$n forms $p out of 10000K qp.",ch,obj,NULL,TO_ROOM);
  return;
}



void do_connect( CHAR_DATA *ch, char *argument )
{
  OBJ_DATA * first_ob;
  OBJ_DATA * second_ob;
  OBJ_DATA * new_ob;

  char arg1[MAX_STRING_LENGTH], arg2[MAX_STRING_LENGTH];
  char buf[MAX_STRING_LENGTH];

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

  if ( arg1[0] == '\0' || arg2[0] == '\0' )
  {
    send_to_char( "Syntax: Connect <firstobj> <secondobj>.\n\r", ch );
    return;
  }

  if ( ( first_ob =  get_obj_carry( ch, arg1 ) )  == NULL )
  {
    sprintf( buf, "You must be holding both parts!!\n\r" );
    send_to_char( buf, ch );
    return;
  }



  if ( ( second_ob =  get_obj_carry( ch, arg2 ) )  == NULL )
  {
    sprintf( buf, "You must be holding both parts!!\n\r" );
    send_to_char( buf, ch );
    return;
  }

  if ( first_ob->item_type != ITEM_PIECE || second_ob->item_type !=ITEM_PIECE )
  {
    send_to_char( "Both items must be pieces of another item!\n\r", ch );
    return;
  }

  /* check to see if the pieces connect */

  if (  ( first_ob->value[0] == second_ob->pIndexData->vnum )
     || ( first_ob->value[1] == second_ob->pIndexData->vnum )  )
 /* good connection  */
  {
    new_ob = create_object( get_obj_index( first_ob->value[2] ), ch->level );
    extract_obj( first_ob );
    extract_obj( second_ob );
    obj_to_char( new_ob , ch );
    act( "$n jiggles some pieces together...\r\n ...suddenly they snap in place, creating $p!", ch, new_ob,NULL,  TO_ROOM );
    act( "You jiggle the pieces together...\r\n ...suddenly they snap into place, creating $p!", ch, new_ob, NULL, TO_CHAR);

  }
  else
  {
    act( "$n jiggles some pieces together, but can't seem to make them connect.", ch, NULL, NULL, TO_ROOM);
    act( "You try to fit them together every which way, but they just don't want to fit together.", ch, NULL, NULL, TO_CHAR);

    return;
  }

  return;
}




void do_cotnbuy( CHAR_DATA *ch, char *argument )
{
  OBJ_INDEX_DATA *pObjIndex;
  OBJ_DATA *obj;
  char arg[MAX_INPUT_LENGTH];
  int vnum = 0;

  argument = one_argument( argument, arg );

  if (IS_NPC(ch)) return;

  if (arg[0] == '\0')
  {
  send_to_char("COTN SHORTSWORD PARTS: Hilt, Handle, Demon steel, Elven Steel       \n\r",ch);
    return;
  }

  if ( ch->pcdata->quest < 300000 )
  {
    send_to_char("You don't have the 300K qps needed.\n\r",ch);
    return;
  }
  if      (!str_cmp(arg,"hilt"        )) vnum = 80908;
  else if (!str_cmp(arg,"handle"      )) vnum = 80909;
  else if (!str_cmp(arg,"demon"      )) vnum = 80911;
  else if (!str_cmp(arg,"elven"      )) vnum = 80912;
  else
  {
    do_cotnbuy(ch,"");
    return;
  }
  if ( vnum == 0 || (pObjIndex = get_obj_index( vnum )) == NULL)
  {
    send_to_char("Missing object, please inform Xrakisis .\n\r",ch);
    return;
  }
  if(!IS_IMMORTAL(ch)) ch->pcdata->quest -= 300000;
  obj = create_object(pObjIndex, 50);
  obj->questowner = str_dup(ch->pcdata->switchname);
  obj_to_char(obj, ch);
  act("You transform the 300K qp into $p.",ch,obj,NULL,TO_CHAR);
  act("$n forms $p out of 300K qp.",ch,obj,NULL,TO_ROOM);
  return;
}