cotn25/area/
cotn25/src/
/***************************************************************************
 *  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.                                                  *
 ***************************************************************************/

/*********************************
 * Upgrade commands for Dystopia *
 *********************************/

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

/* local functions */


bool is_upgrade(CHAR_DATA *ch)
{
  if (IS_NPC(ch)) return FALSE;
  
  if (IS_CLASS(ch, CLASS_DROW))           return TRUE;
  if (IS_CLASS(ch, CLASS_ASSASSIN))       return TRUE;
  if (IS_CLASS(ch, CLASS_DEMON))          return TRUE;
  if (IS_CLASS(ch, CLASS_VAMPIRE))        return TRUE;
  if (IS_CLASS(ch, CLASS_ELEMENTAL))      return TRUE;
  if (IS_CLASS(ch, CLASS_PALADIN))        return TRUE;
  if (IS_CLASS(ch, CLASS_WEREWOLF))       return TRUE;
  if (IS_CLASS(ch, CLASS_WRAITH))         return TRUE;
  if (IS_CLASS(ch, CLASS_TANARRI))        return TRUE;
  if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT))  return TRUE;
  if (IS_CLASS(ch, CLASS_ANGEL))          return TRUE;
  if (IS_CLASS(ch, CLASS_GHOUL))	  return TRUE;

  return FALSE;
}


void do_upgrade(CHAR_DATA *ch, char *argument)
{
  OBJ_INDEX_DATA *pObjIndex;
  OBJ_DATA *obj;
char buf[MAX_STRING_LENGTH];
  int mana_needed = 150000;
  int hit_needed  = 150000;
  int move_needed = 150000;
  int qp_needed = 0;
  // int pkscore_needed = 2000;
  int status_needed = 5;
  int vnum = 0;
  int i;

if (IS_NPC(ch)) return;

if (ch->in_room->vnum != 3054)
{
send_to_char("You must be at the Temple Alter to use this command.\n\r",ch);
return;
}

 do_clearstats(ch,"");

  if (ch->pcdata->upgrade_level >= 10)
  {
    send_to_char("You have reached the maximum level.\n\r",ch);
    return;
  }
 
  status_needed = ((ch->pcdata->upgrade_level + 1) * 5);
  qp_needed = ((ch->pcdata->upgrade_level+1) * 10000);
  hit_needed = hit_needed + (ch->pcdata->upgrade_level * 25000);
  mana_needed = mana_needed + (ch->pcdata->upgrade_level * 25000);
  move_needed = move_needed + (ch->pcdata->upgrade_level * 25000);
 // pkscore_needed = pkscore_needed + ch->pcdata->upgrade_level * 500;
  
  if (ch->pStatus < status_needed)
  {
  	sprintf(buf,"You need %d more status.\n\r", status_needed - ch->pStatus);
  	send_to_char(buf,ch);
  	return;
  }	
  
  if (ch->max_hit < hit_needed)
  {
    sprintf(buf,"You need %d more hitpoints.\n\r", hit_needed - ch->max_hit);
    send_to_char(buf,ch);
    return;
  }
  if (ch->max_mana < mana_needed)
  {
    sprintf(buf,"You need %d more manapoints.\n\r", mana_needed - ch->max_mana);
    send_to_char(buf,ch);
    return;
  }
  if (ch->max_move < move_needed)
  {
    sprintf(buf,"You need %d more movepoints.\n\r", move_needed - ch->max_move);
    send_to_char(buf,ch);
    return;
  }
  if (ch->pcdata->quest < qp_needed)
  {
    sprintf(buf,"You need %d more qps.\n\r", qp_needed - ch->pcdata->quest);
    send_to_char(buf,ch);
    return;
  }
  if (ch->pcdata->upgrade_level > 4)
  {
    send_to_char("Max upgrade is 6 for time being.\n\r",ch);
    return;
  }

/*
  if (ch->pcdata->questtotal < qp_needed)
  {
    send_to_char("You need to have actually earned the qps.\n\r",ch);
    return;
  }
*/

/*
  if (get_ratio(ch) < pkscore_needed)
  {
    send_to_char("Your pkscore is to low.\n\r",ch);
    return;
  }
  */

//  for (i = 19; i <= 23; i++)
//  {
//    if (ch->stance[i] == -1)
//    {
//      send_to_char("You need all your superstances to upgrade.\n\r", ch);
//      return;
//    }
//  }

//  if (ch->pcdata->upgrade_level == 0) vnum = 33330;
//  else if (ch->pcdata->upgrade_level == 1) vnum = 33331;
//  else if (ch->pcdata->upgrade_level == 2) vnum = 33332;
//  else if (ch->pcdata->upgrade_level == 3) vnum = 33333;
//  else if (ch->pcdata->upgrade_level == 4) vnum = 33334; 
//  else if (ch->pcdata->upgrade_level == 5) vnum = 33335;
  
// if ( vnum == 0 || (pObjIndex = get_obj_index( vnum )) == NULL)
//  {
//    send_to_char("Missing object, please inform Marcus.\n\r",ch);
//        return;
//  }
//  obj = create_object(pObjIndex, 50);
//  obj->questowner = str_dup(ch->pcdata->switchname);
//  obj_to_char(obj,ch);

  ch->pcdata->upgrade_level++;
  ch->pcdata->quest -= qp_needed;
  ch->max_hit  = 5000;
  ch->hit      = 5000;
  ch->max_move = 5000;
  ch->move     = 5000;
  ch->max_mana = 5000;
  ch->mana     = 5000;
  ch->exp      = 0;
  ch->expmult  = 0;
  if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT)) sprintf(buf,"The torments and horrors of undead life has made %s even more powerful",ch->name);
  else if (IS_CLASS(ch, CLASS_ANGEL)) sprintf(buf,"The sky shakes with thunder as %s is proclaimed the messanger of God",ch->name);
  else if (IS_CLASS(ch, CLASS_TANARRI)) sprintf(buf,"Through hardwon battles in the famous Blood Wars, %s has gained skills beyond this world",ch->name);
  else if (IS_CLASS(ch, CLASS_VAMPIRE)) sprintf(buf,"%s the Trueblood Vampire has grown stronger and has come back to suck your blood",ch->name);
  else if (IS_CLASS(ch, CLASS_ASSASSIN)) sprintf(buf,"Through the studies and knowledge of art of killing,%s has grown stronger",ch->name);
  else if (IS_CLASS(ch, CLASS_DROW)) sprintf(buf,"Fighting along the side of Lloth,%s has become stronger and has come out of the darkness to kill more victims",ch->name);
  else if (IS_CLASS(ch, CLASS_WEREWOLF)) sprintf(buf,"With a greater knowledge of his totems , %s has grown stronger and has come back to slay more people",ch->name);
  else if (IS_CLASS(ch, CLASS_ELEMENTAL)) sprintf(buf,"%s has been granted strength and more power over the elements",ch->name);
  else if (IS_CLASS(ch, CLASS_DEMON)) sprintf(buf,"%s takes his blade and gores it through his own chest and falls to the ground... only to rise again stronger than ever before",ch->name);
  else if (IS_CLASS(ch, CLASS_PALADIN)) sprintf(buf,"God smiles down upon %s grants %s more strength",ch->name, ch->name);
  else if (IS_CLASS(ch, CLASS_WRAITH)) sprintf(buf,"The world shudders in fear as %s lets out a piercing screech while devouring thousands of souls, increasing his terrible power further.",ch->name);
  else if (IS_CLASS(ch, CLASS_GHOUL)) sprintf(buf, "The sickest of feeling enters your soul as %s mutates into a more powerful creature!", ch->name);
 else sprintf(buf,"%s have upgraded", ch->name);
  do_info(ch,buf);
  return;
}