empire.c

demise/src/empire.c · 145.7 KB

From the archive dodbackup-final.tar.gz

Download the archive   « Back to the archive contents

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


#define MAX_SPHERE 	9
void load_clans args ((void));

char *
nameclean (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  char *pName;
  int iSyl;
  int length;

  struct name_clean
  {
    char *old;
    char *new;
  };

  static const struct name_clean clean_table[] = {
    {" ", " "},
    {"a", "a"}, {"b", "b"}, {"c", "c"}, {"d", "d"},
    {"e", "e"}, {"f", "f"}, {"g", "g"}, {"h", "h"},
    {"i", "i"}, {"j", "j"}, {"k", "k"}, {"l", "l"},
    {"m", "m"}, {"n", "n"}, {"o", "o"}, {"p", "p"},
    {"q", "q"}, {"r", "r"}, {"s", "s"}, {"t", "t"},
    {"u", "u"}, {"v", "v"}, {"w", "w"}, {"x", "x"},
    {"y", "y"}, {"z", "z"}, {",", ""}, {".", ""},
    {";", ""}, {":", ""}, {"(", ""}, {")", ""},
    {")", ""}, {"-", ""}, {"!", ""}, {"?", ""},
    {"1", ""}, {"2", ""}, {"3", ""}, {"4", ""},
    {"5", ""}, {"6", ""}, {"7", ""}, {"8", ""},
    {"9", ""}, {"0", ""}, {"%", ""}, {"=", ""},
    {"+", ""}, {"{", ""}, {"}", ""}, {"[", ""},
    {"]", ""}, {"<", ""}, {"@", ""}, {"#", "#"},
    {"$", ""}, {"^", ""}, {"&", ""}, {"*", ""},
    {"~", ""}, {"`", ""}, {">", ""}, {"", ""}
  };

  buf[0] = '\0';

  if (argument[0] == '\0')
    return argument;
  for (pName = str_dup (argument); *pName != '\0'; pName += length)
    {
      for (iSyl = 0; (length = strlen (clean_table[iSyl].old)) != 0; iSyl++)
	{
	  if (!str_prefix (clean_table[iSyl].old, pName))
	    {
	      strcat (buf, clean_table[iSyl].new);
	      break;
	    }
	}

      if (length == 0)
	length = 1;
    }

  argument[0] = '\0';
  strcpy (argument, buf);
  argument[0] = UPPER (argument[0]);
  return argument;
}

char *
get_tech2 (int tech)
{
  static char buf[100];
  buf[0] = '\0';

  if (!IS_SET (tech, RES_RESEARCH))
    {
      sprintf (buf, "Not Researching anything");
    }
  else
    {
      if (IS_SET (tech, RES_WEAPON))
	{
	  if (IS_SET (tech, RES_STATS))
	    strcat (buf, "#yStat Enhancements#n");
	  else if (IS_SET (tech, RES_BODY))
	    strcat (buf, "#yBody Enhancements#n");
	  else if (IS_SET (tech, RES_PROWESS))
	    strcat (buf, "#yProwess Enhancements#n");
	  else if (IS_SET (tech, RES_POWER))
	    strcat (buf, "#yPower Enhancements#n");
	  else if (IS_SET (tech, RES_COMBAT))
	    strcat (buf, "#yCombat Enhancements#n");
	  else if (IS_SET (tech, RES_COST))
	    strcat (buf, "#yCost Reduction#n");
	  else if (IS_SET (tech, RES_RELIC))
	    strcat (buf, "#yIndestructible Advancement#n");
	  else if (IS_SET (tech, RES_SILVER))
	    strcat (buf, "#yCrafted From Silver Advancement#n");
	  else if (IS_SET (tech, RES_FABLED))
	    strcat (buf, "#yFabled Advancement#n");
	  else if (IS_SET (tech, RES_MYTHICAL))
	    strcat (buf, "#yCan Become Mythical Advancement#n");
	  else if (IS_SET (tech, RES_LEGEND))
	    strcat (buf, "#yCan Become Legendary Advancement#n");
	  else if (IS_SET (tech, RES_SPELLS))
	    strcat (buf, "#yCan Be Imbued With Magic Advancement#n");
	  else if (IS_SET (tech, RES_CLASS))
	    strcat (buf, "#yCan Hold Class Improvements Advancement#n");
	  else if (IS_SET (tech, RES_CUSTOM))
	    strcat (buf, "#yCan Be Customized Advancement#n");
	}
      else if (IS_SET (tech, RES_ARMOR))
	{
	  if (IS_SET (tech, RES_STATS))
	    strcat (buf, "#yStat Enhancements#n");
	  else if (IS_SET (tech, RES_BODY))
	    strcat (buf, "#yBody Enhancements#n");
	  else if (IS_SET (tech, RES_PROWESS))
	    strcat (buf, "#yProwess Enhancements#n");
	  else if (IS_SET (tech, RES_POWER))
	    strcat (buf, "#yPower Enhancements#n");
	  else if (IS_SET (tech, RES_COMBAT))
	    strcat (buf, "#yCombat Enhancements#n");
	  else if (IS_SET (tech, RES_COST))
	    strcat (buf, "#yCost Reduction#n");
	  else if (IS_SET (tech, RES_RELIC))
	    strcat (buf, "#yIndestructible Advancement#n");
	  else if (IS_SET (tech, RES_SILVER))
	    strcat (buf, "#yCrafted From Silver Advancement#n");
	  else if (IS_SET (tech, RES_FABLED))
	    strcat (buf, "#yFabled Advancement#n");
	  else if (IS_SET (tech, RES_MYTHICAL))
	    strcat (buf, "#yCan Become Mythical Advancement#n");
	  else if (IS_SET (tech, RES_LEGEND))
	    strcat (buf, "#yCan Become Legendary Advancement#n");
	  else if (IS_SET (tech, RES_SPELLS))
	    strcat (buf, "#yCan Be Imbued With Magic Advancement#n");
	  else if (IS_SET (tech, RES_CLASS))
	    strcat (buf, "#yCan Hold Class Improvements Advancement#n");
	  else if (IS_SET (tech, RES_CUSTOM))
	    strcat (buf, "#yCan Be Customized Advancement#n");
	}
      else if (IS_SET (tech, RES_WONDER))
	{
	  sprintf (buf, "#yA Wonder#n");
	}
      else if (IS_SET (tech, RES_GUARDIAN))
	{
	  sprintf (buf, "#yImproved Empire Guardian#n");
	}
      else if (IS_SET (tech, RES_HEALER))
	{
	  sprintf (buf, "#yImproved Empire Healer#n");
	}
      else
	{
	  sprintf (buf, "#yNot Researching Anything#n");
	}
    }
  return buf;
}

char *
get_tech (int tech)
{
  static char buf[100];
  buf[0] = '\0';

  if (!IS_SET (tech, RES_RESEARCH))
    {
      sprintf (buf, "Not Researching Anything");
    }
  else
    {
      if (IS_SET (tech, RES_WEAPON))
	{
	  sprintf (buf, "#yResearching The Weapon Technology#o:#n ");
	  if (IS_SET (tech, RES_STATS))
	    strcat (buf, "#yStat Enhancements#n");
	  else if (IS_SET (tech, RES_BODY))
	    strcat (buf, "#yBody Enhancements#n");
	  else if (IS_SET (tech, RES_PROWESS))
	    strcat (buf, "#yProwess Enhancements#n");
	  else if (IS_SET (tech, RES_POWER))
	    strcat (buf, "#yPower Enhancements#n");
	  else if (IS_SET (tech, RES_COMBAT))
	    strcat (buf, "#yCombat Enhancements#n");
	  else if (IS_SET (tech, RES_COST))
	    strcat (buf, "#yCost Reduction#n");
	  else if (IS_SET (tech, RES_RELIC))
	    strcat (buf, "#yThe Indestructible Advancement#n");
	  else if (IS_SET (tech, RES_SILVER))
	    strcat (buf, "#yThe Crafted From Silver Advancement#n");
	  else if (IS_SET (tech, RES_FABLED))
	    strcat (buf, "#yThe Fabled Advancement#n");
	  else if (IS_SET (tech, RES_MYTHICAL))
	    strcat (buf, "#yThe Can Become Mythical Advancement#n");
	  else if (IS_SET (tech, RES_LEGEND))
	    strcat (buf, "#yThe Can Become Legendary Advancement#n");
	  else if (IS_SET (tech, RES_SPELLS))
	    strcat (buf, "#yThe Can Be Imbued With Magic Advancement#n");
	  else if (IS_SET (tech, RES_CLASS))
	    strcat (buf, "#yThe Can Hold Class Improvements Advancement#n");
	  else if (IS_SET (tech, RES_CUSTOM))
	    strcat (buf, "#yThe Can Be Customized Advancement#n");
	}
      else if (IS_SET (tech, RES_ARMOR))
	{
	  sprintf (buf, "#yResearching The Armor Technology#o:#n ");
	  if (IS_SET (tech, RES_STATS))
	    strcat (buf, "#yStat Enhancements#n");
	  else if (IS_SET (tech, RES_BODY))
	    strcat (buf, "#yBody Enhancements#n");
	  else if (IS_SET (tech, RES_PROWESS))
	    strcat (buf, "#yProwess Enhancements#n");
	  else if (IS_SET (tech, RES_POWER))
	    strcat (buf, "#yPower Enhancements#n");
	  else if (IS_SET (tech, RES_COMBAT))
	    strcat (buf, "#yCombat Enhancements#n");
	  else if (IS_SET (tech, RES_COST))
	    strcat (buf, "#yCost Reduction#n");
	  else if (IS_SET (tech, RES_RELIC))
	    strcat (buf, "#yThe Indestructible Advancement#n");
	  else if (IS_SET (tech, RES_SILVER))
	    strcat (buf, "#yThe Crafted From Silver Advancement#n");
	  else if (IS_SET (tech, RES_FABLED))
	    strcat (buf, "#yThe Fabled Advancement#n");
	  else if (IS_SET (tech, RES_MYTHICAL))
	    strcat (buf, "#yThe Can Become Mythical Advancement#n");
	  else if (IS_SET (tech, RES_LEGEND))
	    strcat (buf, "#yThe Can Become Legendary Advancement#n");
	  else if (IS_SET (tech, RES_SPELLS))
	    strcat (buf, "#yThe Can Be Imbued With Magic Advancement#n");
	  else if (IS_SET (tech, RES_CLASS))
	    strcat (buf, "#yThe Can Hold Class Improvements Advancement#n");
	  else if (IS_SET (tech, RES_CUSTOM))
	    strcat (buf, "#yThe Can Be Customized Advancement#n");
	}
      else if (IS_SET (tech, RES_WONDER))
	{
	  sprintf (buf, "#yResearching A Wonder#n");
	}
      else if (IS_SET (tech, RES_GUARDIAN))
	{
	  sprintf (buf, "#yResearching An Improved Empire Guardian#n");
	}
      else if (IS_SET (tech, RES_HEALER))
	{
	  sprintf (buf, "#yResearching An Improved Empire Healer#n");
	}
      else
	{
	  sprintf (buf, "#yNot Researching Anything#n");
	}
    }
  strcat (buf, "#o.#n");
  return buf;
}

int
get_techcost (int tech)
{
  int cost = 0;

  if (!IS_SET (tech, RES_RESEARCH))
    {
      return cost;
    }
  else
    {

      if (IS_SET (tech, RES_WEAPON) || IS_SET (tech, RES_ARMOR))
	{
	  if (IS_SET (tech, RES_STATS))
	    cost = 20000;
	  else if (IS_SET (tech, RES_BODY))
	    cost = 10000;
	  else if (IS_SET (tech, RES_PROWESS))
	    cost = 25000;
	  else if (IS_SET (tech, RES_POWER))
	    cost = 25000;
	  else if (IS_SET (tech, RES_COMBAT))
	    cost = 10000;
	  else if (IS_SET (tech, RES_COST))
	    cost = 7500;
	  else if (IS_SET (tech, RES_RELIC))
	    cost = 250000;
	  else if (IS_SET (tech, RES_SILVER))
	    cost = 25000;
	  else if (IS_SET (tech, RES_FABLED))
	    cost = 500000;
	  else if (IS_SET (tech, RES_MYTHICAL))
	    cost = 250000;
	  else if (IS_SET (tech, RES_LEGEND))
	    cost = 125000;
	  else if (IS_SET (tech, RES_SPELLS))
	    cost = 50000;
	  else if (IS_SET (tech, RES_CLASS))
	    cost = 250000;
	  else if (IS_SET (tech, RES_CUSTOM))
	    cost = 25000;

	  if (IS_SET (tech, RES_WEAPON))
	    cost *= 2;
	}
      else if (IS_SET (tech, RES_WONDER))
	{
	  cost = 500000;
	}
      else if (IS_SET (tech, RES_GUARDIAN))
	{
	  cost = 100000;
	}
      else if (IS_SET (tech, RES_HEALER))
	{
	  cost = 25000;
	}
      else
	{
	  cost = 0;
	  return cost;
	}
    }
  return cost;
}

void
update_tech (int i, int tech)
{
  int improve = 1;
  bool weap = FALSE;

  if (!IS_SET (tech, RES_RESEARCH))
    {
      return;
    }
  else
    {
      if (IS_SET (tech, RES_WEAPON) || IS_SET (tech, RES_ARMOR))
	{
	  if (IS_SET (tech, RES_WEAPON))
	    {
	      improve *= 1000;
	      weap = TRUE;
	    }

	  if (IS_SET (tech, RES_STATS))
	    clantable[i].strgroup += improve;
	  else if (IS_SET (tech, RES_BODY))
	    clantable[i].lifegroup += improve;
	  else if (IS_SET (tech, RES_PROWESS))
	    clantable[i].hitgroup += improve;
	  else if (IS_SET (tech, RES_POWER))
	    clantable[i].acdcgroup += improve;
	  else if (IS_SET (tech, RES_COMBAT))
	    clantable[i].protgroup += improve;
	  else if (IS_SET (tech, RES_COST))
	    clantable[i].cost += improve;
	  else if (IS_SET (tech, RES_RELIC))
	    {
	      if (weap)
                SET_BIT (clantable[i].improves, IMP_RELIC);
	      else
                SET_BIT (clantable[i].improves, IMP_A_RELIC);
	    }
	  else if (IS_SET (tech, RES_SILVER))
	    {
	      if (weap)
	        SET_BIT (clantable[i].improves, IMP_SILVER);
	      else
	        SET_BIT (clantable[i].improves, IMP_A_SILVER);	  
	    }
	  else if (IS_SET (tech, RES_FABLED))
	    {
	      if (weap)
	      	SET_BIT (clantable[i].improves, IMP_FABLED);
	      else
	      	SET_BIT (clantable[i].improves, IMP_A_FABLED);
	    }
	  else if (IS_SET (tech, RES_MYTHICAL))
	    {
	      if (weap)
	      	SET_BIT (clantable[i].improves, IMP_MYTHICAL);
	      else
	      	SET_BIT (clantable[i].improves, IMP_A_MYTHICAL);
	    }
	  else if (IS_SET (tech, RES_LEGEND))
	    {
	      if (weap)
	      	SET_BIT (clantable[i].improves, IMP_LEGEND);
	      else
	      	SET_BIT (clantable[i].improves, IMP_A_LEGEND);
	    }
	  else if (IS_SET (tech, RES_SPELLS))
	    {
	      if (weap)
	      	SET_BIT (clantable[i].improves, IMP_SPELLS);
	      else
	      	SET_BIT (clantable[i].improves, IMP_A_SPELLS);
	    }
	  else if (IS_SET (tech, RES_CLASS))
	    {
	      if (weap)
	      	SET_BIT (clantable[i].improves, IMP_CLASS);
	      else
	      	SET_BIT (clantable[i].improves, IMP_A_CLASS);
	    }
	  else if (IS_SET (tech, RES_CUSTOM))
	    {
	      if (weap)
	      	SET_BIT (clantable[i].improves, IMP_CUSTOM);
	      else
	      	SET_BIT (clantable[i].improves, IMP_A_CUSTOM);
	    }
	}
/*      else if (IS_SET (tech, RES_WONDER))
    	{
	  cost = 500000;
    	}*/
      else if (IS_SET (tech, RES_GUARDIAN))
	{
	  clantable[i].guardlvl += improve;
	}
      else if (IS_SET (tech, RES_HEALER))
	{
	  clantable[i].healerlvl += improve;
	}
      else
	{
	  return;
	}
    }
  return;
}


char *
get_emprank (CHAR_DATA * ch)
{
  static char buf[100];
  buf[0] = '\0';

  if (ch->pcdata->empire2[EMP2_PROBTIME])
    {
      sprintf (buf, "Serf");
    }
  else
    {
      switch (ch->pcdata->empire[EMP_RANK])
	{
	default:
	  sprintf (buf, "Squire");
	  break;

	case RNK_KNIGHT:
	  {
	    if (ch->sex == 2)
	      {
		sprintf (buf, "Lady");
	      }
	    else
	      {
		sprintf (buf, "Knight");
	      }
	    break;
	  }

	case RNK_DUKE:
	  {
	    if (ch->sex == 2)
	      {
		sprintf (buf, "Duchess");
	      }
	    else
	      {
		sprintf (buf, "Duke");
	      }
	    break;
	  }

	case RNK_HEIR:
	  {
	    if (ch->sex == 2)
	      {
		sprintf (buf, "Heiress");
	      }
	    else
	      {
		sprintf (buf, "Heir");
	      }
	    break;
	  }

	case RNK_EMPEROR:
	  {
	    if (ch->sex == 2)
	      {
		sprintf (buf, "Empress");
	      }
	    else
	      {
		sprintf (buf, "Emperor");
	      }
	    break;
	  }

	}
    }
  return buf;
}

int
countcol (char *txt)
{
  char *s;
  int i = 0;
  s = txt;
  while (*s != '\0')
    {
      if (*s == '#' && *(s + 1) != '#')
	i++;
      s++;
    }

  return i;
}

char *
leader (int value)
{
  static char buf[100];

  if (value > MAX_CLANS)
    return;

  sprintf (buf, "%s", clantable[value].leader);

  if (!str_cmp (buf, "(null)"))
    sprintf (buf, "????");

  return buf;
}

char *
empire (int value)
{
  static char buf[100];

  if (value > MAX_CLANS)
    return;

  sprintf (buf, "%s", clantable[value].name);

  if (!str_cmp (buf, "(null)"))
    sprintf (buf, "???");

  return buf;
}

char *
align_text (char *txt, int width)
{
  static char buf[400];
  int col;

  buf[0] = '\0';

  col = countcol (txt) * 2;
  col += width;

  sprintf (buf, "%-*.*s", col, col, txt);
  return buf;

}

char *
align_leader (char *txt, int width)
{
  static char buf[400];
  int col;

  buf[0] = '\0';

  col = countcol (txt) * 2;
  col += width;

  sprintf (buf, "%-*.*s", col, col, txt);
  return buf;

}

int
emphome (int num)
{
  int empire;

  switch (num)
    {
    default:
      empire = 3001;
      break;

    case 1:
      empire = ROOM_VNUM_EMPIRE1;
      break;

    case 2:
      empire = ROOM_VNUM_EMPIRE2;
      break;

    case 3:
      empire = ROOM_VNUM_EMPIRE3;
      break;

    case 4:
      empire = ROOM_VNUM_EMPIRE4;
      break;

    case 5:
      empire = ROOM_VNUM_EMPIRE5;
      break;

    case 6:
      empire = ROOM_VNUM_EMPIRE6;
      break;

    case 7:
      empire = ROOM_VNUM_EMPIRE7;
      break;

    case 8:
      empire = ROOM_VNUM_EMPIRE8;
      break;

    case 9:
      empire = ROOM_VNUM_EMPIRE9;
      break;

    case 10:
      empire = ROOM_VNUM_EMPIRE10;
      break;
    }

  return empire;
}

void
do_clantable (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (argument[0] == '\0')
    {
      clan_table (ch);
      return;
    }
  do_clantable (ch, "");
  return;
}

void
clan_table (CHAR_DATA * ch)
{
  char buf[MSL];
  char cla[MSL];
  char clan[MSL];
  char tmp[MSL];
  bool found = FALSE;
  int i;

  if (IS_NPC (ch))
    return;

  send_to_char
    ("\n\r                       #R-=*{ #0Dreams of Demise Empires #R}*=-                      #n \n\r\n\r",
     ch);
  for (i = 1; i < MAX_CLANS; i++)
    {
      if (clantable[i].empbits == EMPIRE_OPEN)
	{
	  sprintf (buf, "#7%5d#n %35s - %17s\n\r", i,
		   align_who (clantable[i].name, 12),
		   align_leader (leader (i), 12));
	  send_to_char (buf, ch);
	  found = TRUE;
	}
    }
  if (!found)
    {
      cent_to_char ("There are no existing Empires.", ch);
      stc ("\n\r", ch);
    }

  return;
}

void
init_empires ()
{
  int i;

  for (i = 1; i < MAX_CLANS; i++)
    {
      clantable[i].name = str_dup ("");
      clantable[i].pks = 0;
      clantable[i].pds = 0;
      clantable[i].members = 0;
      clantable[i].qps = 0;
      clantable[i].leader = str_dup ("");
      clantable[i].heir = str_dup ("");
      clantable[i].retaliation = str_dup ("");
      clantable[i].retclan = str_dup ("");
      clantable[i].warclan = str_dup ("");
      clantable[i].allclan = str_dup ("");
      clantable[i].hpreq = 0;
      clantable[i].manareq = 0;
      clantable[i].movereq = 0;
      clantable[i].wonder = 0;
      clantable[i].wbuild = 0;
      clantable[i].empbits = 0;
      clantable[i].warbits = 0;
      clantable[i].allbits = 0;
      clantable[i].armtech = 0;
      clantable[i].weaptech = 0;
      clantable[i].armres = 0;
      clantable[i].weapres = 0;
      clantable[i].prince = 0;
      clantable[i].knight = 0;
      clantable[i].bits = 0;
      clantable[i].probtime = 0;
      clantable[i].strgroup = 0;
      clantable[i].lifegroup = 0;
      clantable[i].hitgroup = 0;
      clantable[i].acdcgroup = 0;
      clantable[i].protgroup = 0;
      clantable[i].cost = 0;
      clantable[i].recallroom = 0;
      clantable[i].restime = 0;
      clantable[i].guardlvl = 0;
      clantable[i].guardres = 0;
      clantable[i].healerlvl = 0;
      clantable[i].healerres = 0;
      clantable[i].improves = 0;
    }
  load_clans ();
}

void
load_clans ()
{
  FILE *fp;
  char clanname[MIL];
  int i;

  if ((fp = fopen ("../txt/empire.txt", "r")) == NULL)
    {
      log_string ("Error: empire.txt not found!");
      return;
    }
  for (i = 1; i < MAX_CLANS; i++)
    {
      clantable[i].name = fread_string (fp);
      clantable[i].pks = fread_number (fp);
      clantable[i].pds = fread_number (fp);
      clantable[i].members = fread_number (fp);
      clantable[i].qps = fread_number (fp);
      clantable[i].leader = fread_string (fp);
      if (!str_cmp (clantable[i].leader, "(null)")
	  || strlen (clantable[i].leader) < 4)
	clantable[i].leader = str_dup ("????");
      clantable[i].heir = fread_string (fp);
      if (!str_cmp (clantable[i].heir, "(null)")
	  || strlen (clantable[i].heir) < 4)
	clantable[i].heir = str_dup ("????");
      clantable[i].retaliation = fread_string (fp);
      if (!str_cmp (clantable[i].retaliation, "(null)")
	  || strlen (clantable[i].retaliation) < 4)
	clantable[i].retaliation = str_dup ("None");
      clantable[i].retclan = fread_string (fp);
      if (!str_cmp (clantable[i].retclan, "(null)")
	  || strlen (clantable[i].retclan) < 4)
	clantable[i].retclan = str_dup ("None");
      clantable[i].warclan = fread_string (fp);
      if (!str_cmp (clantable[i].warclan, "(null)")
	  || strlen (clantable[i].warclan) < 4)
	clantable[i].warclan = str_dup ("No Clan");
      clantable[i].allclan = fread_string (fp);
      if (!str_cmp (clantable[i].allclan, "(null)")
	  || strlen (clantable[i].allclan) < 4)
	clantable[i].allclan = str_dup ("No Clan");
      clantable[i].hpreq = fread_number (fp);
      clantable[i].manareq = fread_number (fp);
      clantable[i].movereq = fread_number (fp);
      clantable[i].wonder = fread_number (fp);
      clantable[i].wbuild = fread_number (fp);
      clantable[i].empbits = fread_number (fp);
      clantable[i].warbits = fread_number (fp);
      clantable[i].allbits = fread_number (fp);
      clantable[i].armtech = fread_number (fp);
      clantable[i].weaptech = fread_number (fp);
      clantable[i].armres = fread_number (fp);
      clantable[i].weapres = fread_number (fp);
      clantable[i].prince = fread_number (fp);
      clantable[i].knight = fread_number (fp);
      clantable[i].bits = fread_number (fp);
      clantable[i].probtime = fread_number (fp);
      clantable[i].strgroup = fread_number (fp);
      clantable[i].lifegroup = fread_number (fp);
      clantable[i].hitgroup = fread_number (fp);
      clantable[i].acdcgroup = fread_number (fp);
      clantable[i].protgroup = fread_number (fp);
      clantable[i].cost = fread_number (fp);
      clantable[i].recallroom = fread_number (fp);
      clantable[i].restime = fread_number (fp);
      clantable[i].guardlvl = fread_number (fp);
      clantable[i].guardres = fread_number (fp);
      clantable[i].healerlvl = fread_number (fp);
      clantable[i].healerres = fread_number (fp);
      clantable[i].improves = fread_number (fp);
      if ((!str_cmp (clantable[i].name, "(null)")
	   || strlen (clantable[i].name) < 7)
	  && !IS_SET (clantable[i].bits, EMPIRE_NAMED))
	{
	  sprintf (clanname, "Empire%d", i);
	  clantable[i].name = str_dup (clanname);
	}
    }
  fclose (fp);
  return;
}


void
save_clans (void)
{
  FILE *fp;
  int i;

  if ((fp = fopen ("../txt/empire.txt", "w")) == NULL)
    {
      log_string ("Error writing to empire.txt");
    }
  for (i = 1; i < MAX_CLANS; i++)
    {
      if (IS_SET (clantable[i].wonder, WONDER_REPOPED))
	REMOVE_BIT (clantable[i].wonder, WONDER_REPOPED);
      fprintf (fp,
	       "%s~\n%d\n%d\n%d\n%d\n%s~\n%s~\n%s~\n%s~\n%s~\n%s~\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n",
	       clantable[i].name, clantable[i].pks, clantable[i].pds,
	       clantable[i].members, clantable[i].qps, clantable[i].leader,
	       clantable[i].heir, clantable[i].retaliation,
	       clantable[i].retclan, clantable[i].warclan,
	       clantable[i].allclan, clantable[i].hpreq, clantable[i].manareq,
	       clantable[i].movereq, clantable[i].wonder, clantable[i].wbuild,
	       clantable[i].empbits, clantable[i].warbits,
	       clantable[i].allbits, clantable[i].armtech,
	       clantable[i].weaptech, clantable[i].armres,
	       clantable[i].weapres, clantable[i].prince, clantable[i].knight,
	       clantable[i].bits, clantable[i].probtime,
	       clantable[i].strgroup, clantable[i].lifegroup,
	       clantable[i].hitgroup, clantable[i].acdcgroup,
	       clantable[i].protgroup, clantable[i].cost,
	       clantable[i].recallroom, clantable[i].restime,
	       clantable[i].guardlvl, clantable[i].guardres,
	       clantable[i].healerlvl, clantable[i].healerres,
	       clantable[i].improves);
    }
  fclose (fp);
  return;
}

int
clannum (CHAR_DATA * ch)
{
  int i;

  if (IS_NPC (ch))
    return;

  if (ch->pcdata->empire[0] > 0)
    i = ch->pcdata->empire[0];
  else
    i = 0;

  return i;
}

bool
clan_exists (char *argument)
{
  int i;

  if (argument[0] == '\0')
    return FALSE;

  for (i = 1; i < MAX_CLANS; i++)
    {
      if (clantable[i].empbits != EMPIRE_OPEN)
	continue;

      if (!str_cmp (argument, clantable[i].name))
	return TRUE;
    }
  return FALSE;
}

bool
clan_exists2 (int i)
{
  if (i >= MAX_CLANS)
    return FALSE;

  if (clantable[i].empbits != EMPIRE_OPEN)
    return FALSE;

  return TRUE;
}


void
do_promote (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char buf[MSL];
  char arg1[MIL];
  char arg2[MIL];
  bool prince = FALSE;
  bool great = FALSE;
  bool heir = FALSE;
  bool demote = FALSE;
  char empire[MSL];
  char rankb[MSL];
  char ranka[MSL];
  int i;
  int rank, rank2;


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

  if (IS_NPC (ch))
    return;

  if (!has_clan (ch))
    {
      do_huh (ch, "");
      return;
    }

  if (IS_EMPEROR (ch))
    {
      prince = TRUE;
      great = TRUE;
      heir = TRUE;
    }
  else if (IS_HEIR (ch))
    {
      prince = TRUE;
      great = TRUE;
    }
  else if (IS_DUKE (ch))
    {
      great = TRUE;
    }
  else
    {
      do_huh (ch, "");
      return;
    }

  if (arg1[0] == '\0')
    {
      stc ("Promote whom ?\n\r", ch);
      return;
    }

  if ((victim = find_pc_mud (ch, arg1)) == NULL)
    {
      stc ("Theres no player on fitting that description.\n\r", ch);
      return;
    }

  if (ch == victim)
    {
      stc ("Not on yourself.\n\r", ch);
      return;
    }

  if (!has_clan (victim))
    {
      act ("$N is not in your empire.", ch, NULL, victim, TO_CHAR);
      return;
    }

  if (!same_clan (ch, victim))
    {
      act ("$N is not in your empire.", ch, NULL, victim, TO_CHAR);
      return;
    }

  if (IS_EMPEROR (victim))
    {
      act ("$N is the Emperor, how can you promote $M.", ch, NULL, victim,
	   TO_CHAR);
      act ("$n just tried to promote you... how cute.", ch, NULL, victim,
	   TO_VICT);
      return;
    }

  if (!IS_EMPEROR (ch)
      && IS_SET (victim->pcdata->empire[EMP_BITS], BITS_PROBATION))
    {
      act ("You can't promote $N since $E is still on probation.", ch, NULL,
	   victim, TO_CHAR);
      return;
    }
  if (!IS_EMPEROR (ch)
      && ch->pcdata->empire[EMP_RANK] >= victim->pcdata->empire[EMP_RANK])
    {
      act ("You lack the authority to do anything to $N.", ch, NULL, victim,
	   TO_CHAR);
      return;
    }

  if (arg2[0] == '\0')
    {
      act ("Promote $N to what rank ?", ch, NULL, victim, TO_CHAR);
      if (heir)
	stc ("Heir, ", ch);
      if (prince)
	stc ("Duke or ", ch);
      if (great)
	stc ("Knight", ch);
      stc (".\n\r", ch);
      return;
    }

  sprintf (empire, "%s", ch->clan);
  i = ch->pcdata->empire[0];
  rank2 = victim->pcdata->empire[1];

  if (!str_cmp (arg2, "heir") && heir)
    {
      if (str_cmp (clantable[i].heir, "????") && victim->pcdata->empire[1] != RNK_HEIR)
	{
	  stc ("You already have an Heir.\n\r", ch);
	  return;
	}

      sprintf (rankb, "%s", get_emprank (victim));

      rank = RNK_HEIR;

      if (victim->pcdata->empire[1] == rank)
	{
	  demote = TRUE;
	  free_string (clantable[i].heir);
	  clantable[i].heir = str_dup ("????");
	  rank = RNK_MEMBER;
	}
      else
	{
	  free_string (clantable[i].heir);
	  clantable[i].heir = str_dup (victim->name);
	  if (rank2 == RNK_DUKE)
	    {
	      clantable[i].prince--;
	    }
	  else if (rank2 == RNK_KNIGHT)
	    {
	      clantable[i].knight--;
	    }
	}
    }
  else if (!str_cmp (arg2, "duke") && prince)
    {
      if (clantable[i].prince >= 2)
	{
	  stc ("You already have two Dukes.", ch);
	}
      sprintf (rankb, "%s", get_emprank (victim));
      rank = RNK_DUKE;
      if (victim->pcdata->empire[1] == rank)
	{
	  demote = TRUE;
	  clantable[i].prince--;
	  rank = RNK_MEMBER;
	}
      else
	{
	  clantable[i].prince++;
	  if (rank2 == RNK_HEIR)
	    {
	      demote = TRUE;
	      free_string (clantable[i].heir);
	      clantable[i].heir = str_dup ("????");
	    }
	  else if (rank2 == RNK_KNIGHT)
	    {
	      clantable[i].knight--;
	    }
	}
    }
  else if (!str_cmp (arg2, "knight") && great)
    {
      if (clantable[i].knight >= 4)
	{
	  stc ("You already have four knights.", ch);
	}
      sprintf (rankb, "%s", get_emprank (victim));
      rank = RNK_KNIGHT;
      if (victim->pcdata->empire[1] == rank)
	{
	  demote = TRUE;
	  clantable[i].knight--;
	  rank = RNK_MEMBER;
	}
      else
	{
	  clantable[i].knight++;
	  if (rank2 == RNK_HEIR)
	    {
	      demote = TRUE;
	      free_string (clantable[i].heir);
	      clantable[i].heir = str_dup ("????");
	    }
	  else if (rank2 == RNK_DUKE)
	    {
	      demote = TRUE;
	      clantable[i].prince--;
	    }
	}
    }
  else
    {
      do_promote (ch, arg1);
      return;
    }
  if (IS_SET (victim->pcdata->empire[EMP_BITS], BITS_PROBATION))
    {
      victim->pcdata->empire2[EMP2_PROBTIME] = 0;
      REMOVE_BIT (victim->pcdata->empire[EMP_BITS], BITS_PROBATION);
    }
  victim->pcdata->empire[1] = rank;
  if (victim->pcdata->empire2[0] > 0)
    victim->pcdata->empire2[0] = 0;
  sprintf (ranka, "%s", get_emprank (victim));
  sprintf (buf, "You %s %s from the rank of %s to the rank of %s.\n\r",
	   demote ? "demote" : "promote", victim->name, rankb, ranka);
  stc (buf, ch);
  sprintf (buf, "%s %s you from the rank of %s to the rank of %s.\n\r",
	   ch->name, demote ? "demotes" : "promotes", rankb, ranka);
  stc (buf, victim);
  sprintf (buf,
	   "#c%s#C %s#c %s#C from the rank of #c%s#C to the rank of#c %s#C.\n\r",
	   ch->name, demote ? "demotes" : "promotes", victim->name, rankb,
	   ranka);
  empireinfo (i, buf);
  save_clans ();
  return;
}

bool
has_clan (CHAR_DATA * ch)
{
  int i = 0;
  char buf[MSL];
  if (IS_NPC (ch))
    return FALSE;
  if ((i = ch->pcdata->empire[0]) < 1)
    {
      return FALSE;
    }
  if (i > MAX_CLANS)
    {
      return FALSE;
    }
  if (strlen (ch->clan) < 5)
    {
      stc ("check 3\n\r", ch);
      return FALSE;
    }
  if (!clan_exists (ch->clan))
    {
      stc ("check 4\n\r", ch);
      sprintf (buf, "%s", ch->clan);
      if (IS_LINKSYS (ch))
	stc (buf, ch);
      return FALSE;
    }

  return TRUE;
}

char *
clan_lookup (int i)
{
  static char buf[100];
  buf[0] = '\0';

  strcat (buf, clantable[i].name);

  return buf;
}

void
do_checkclan (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  int i;

  if (IS_NPC (ch))
    return;


  if (!is_number (argument) || argument[0] == '\0')
    {
      send_to_char ("Syntax: checkempire <empire number>.\n\r", ch);
      return;
    }

  if (is_number (argument))
    {
      i = atoi (argument);
      if (i < 1 || i > 10)
	{
	  stc ("Please enter a value between 1 and 10.\n\r", ch);
	  return;
	}
    }


  if (!clan_exists2 (i))
    {
      send_to_char ("That empire does not exist!\n\r", ch);
      return;
    }

  send_to_char
    ("#C-------------------------------------------------------------------------------#n\n\r",
     ch);
  sprintf (buf, "#CSpecified info about the#n %s#C Empire.", clan_lookup (i));
  cent_to_char (buf, ch);
  send_to_char
    ("#C--------------------------------------------------------------------------------#n\n\r",
     ch);
  sprintf (buf, "#CCurrent leader:#c %s\n\r", clantable[i].leader);
  send_to_char (buf, ch);
  sprintf (buf, "#CCurrent amount of members:#c %d\n\r",
	   clantable[i].members);
  send_to_char (buf, ch);
  sprintf (buf, "#CCurrent amount of credits in vault:#c %d\n\r",
	   clantable[i].qps);
  send_to_char (buf, ch);
  sprintf (buf, "#CPlayer kills:#c %d#C   Player deaths:#c %d#n\n\r",
	   clantable[i].pks, clantable[i].pds);
  send_to_char (buf, ch);
  sprintf (buf,
	   "#CRequirements for joining:#c %d #CLE#c %d #CMP#c %d#C Vital#n\n\r",
	   clantable[i].hpreq, clantable[i].manareq, clantable[i].movereq);
  send_to_char (buf, ch);
  send_to_char
    ("#C--------------------------------------------------------------------------------#n\n\r",
     ch);
  return;
}

void
do_declarewar (CHAR_DATA * ch, char *argument)
{
  int i;
  char buf[MSL];

  if (IS_NPC (ch))
    return;

  if (has_clan (ch))
    {
      send_to_char ("But you are not in any Empire!\n\r", ch);
      return;
    }

  if (!IS_EMPEROR (ch) && !IS_HEIR (ch))
    {
      send_to_char ("You do not have the authority to do that!\n\r", ch);
      return;
    }

  if (!clan_exists (argument))
    {
      send_to_char ("That Empire does not exist!\n\r", ch);
      return;
    }

  i = clannum (ch);

  if (strlen (clantable[i].warclan) > 2)
    {
      send_to_char ("Your Empire is already at war!\n\r", ch);
      return;
    }

  free_string (clantable[i].warclan);
  clantable[i].warclan = str_dup (clan_lookup (i));
  sprintf (buf, "You are now in a war with the %s empire.\n\r",
	   clan_lookup (i));
  send_to_char (buf, ch);
  sprintf (buf,
	   "#7<-#CWar#7-> #cThe %s#c empire has declared war against the members of the %s#c empire! #7<-#CWar#7->#n",
	   ch->clan, clan_lookup (i));
  do_echo (ch, buf);
  save_clans ();
  return;
}

void
add_pks (CHAR_DATA * ch)
{
  int i;
  if (IS_NPC (ch))
    return;
  if (!has_clan)
    return;

  i = clannum (ch);
  clantable[i].pks++;
  save_clans ();
  return;
}

void
add_pds (CHAR_DATA * ch)
{
  int i;
  if (IS_NPC (ch))
    return;
  if (!has_clan)
    return;

  i = clannum (ch);
  clantable[i].pds++;
  save_clans ();
  return;
}

void
do_setreqs (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  char arg2[MIL];
  char buf[MSL];
  int i, value;

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

  if (IS_NPC (ch))
    return;

  if (!has_clan (ch))
    {
      do_huh (ch, "");
      return;
    }

  if (!IS_EMPEROR (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Syntax: setreqs (le/mp/vital) (amount)\n\r", ch);
      return;
    }

  if (!is_number (arg2))
    {
      send_to_char ("Use digits to set requirements please.\n\r", ch);
      return;
    }

  value = atoi (arg2);
  i = clannum (ch);

  if (!str_cmp (arg, "le"))
    {
      clantable[i].hpreq = value;
      sprintf (buf,
	       "Your life essence requirements for joining the clan has been set to %d.\n\r",
	       clantable[i].hpreq);
      save_clans ();
      send_to_char (buf, ch);
      return;
    }

  if (!str_cmp (arg, "mp"))
    {
      clantable[i].manareq = value;
      sprintf (buf,
	       "Your mystical power requirements for joining the clan has been set to %d.\n\r",
	       clantable[i].manareq);
      save_clans ();
      send_to_char (buf, ch);
      return;
    }

  if (!str_cmp (arg, "vital") || !str_cmp (arg, "vitality"))
    {
      clantable[i].movereq = value;
      sprintf (buf,
	       "Your vitality requirements for joining the clan has been set to %d.\n\r",
	       clantable[i].movereq);
      save_clans ();
      send_to_char (buf, ch);
      return;
    }

  do_setreqs (ch, "");
  return;
}

void
do_induct (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  char arg1[MIL];
  char buf[MSL];
  char clan[MSL];
  char *strtime;
  int i, prob;

  argument = one_argument (argument, arg1);

  if (IS_NPC (ch))
    return;


  if (!has_clan (ch))
    {
      do_huh (ch, "");
      return;
    }

  if (!IS_EMPEROR (ch) && !IS_HEIR (ch) && !IS_DUKE (ch) && !IS_KNIGHT (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }

  if (arg1[0] == '\0')
    {
      send_to_char ("Sponsor whom?\n\r", ch);
      return;
    }

  victim = find_pc_mud (ch, arg1);

  if (victim == NULL)
    {
      send_to_char ("Nobody by that name.\n\r", ch);
      return;
    }

  if (IS_NPC (victim))
    {
      send_to_char ("Not on NPC.\n\r", ch);
      return;
    }

  if (has_clan (victim))
    {
      act ("$N is already serving in an Empire.", ch, NULL, victim, TO_CHAR);
      return;
    }

  if (!IS_SET (victim->immune, IMM_VAMPIRE))
    {
      act ("$N is not ready to serve your Empire.", ch, NULL, victim,
	   TO_CHAR);
      return;
    }

  i = ch->pcdata->empire[0];

  if (victim->max_hit < clantable[i].hpreq)
    {
      send_to_char ("They do not have the required life essence!\n\r", ch);
      return;
    }
  if (victim->max_hit < clantable[i].manareq)
    {
      send_to_char ("They do not have the required mystical power!\n\r", ch);
      return;
    }

  if (victim->max_hit < clantable[i].movereq)
    {
      send_to_char ("They do not have the required vitality!\n\r", ch);
      return;
    }
  sprintf (clan, "%s", clantable[i].name);

  sprintf (buf, "You sponsor %s for service in the %s Empire.\n\r",
	   victim->name, clan);
  send_to_char (buf, ch);
  sprintf (buf, "%s sponsors you for service in the %s Empire.\n\r", ch->name,
	   clan);
  send_to_char (buf, victim);
  free_string (victim->clan);
  victim->clan = str_dup (clan);
  victim->pcdata->empire[0] = i;
  victim->pcdata->empire[EMP_RANK] = RNK_MEMBER;
  do_autosave (victim, "");
  clantable[i].members++;
  free_string (victim->lord);
  victim->lord = str_dup (clantable[i].leader);
  free_string (victim->sponsor);
  victim->sponsor = str_dup (ch->name);
  sprintf (buf, "%d", clantable[i].probtime);
  ch->emphome = clantable[i].recallroom;
  if (!is_number (buf))
    {
      prob = 1;
    }
  else
    {
      prob = atoi (buf);
    }

  strtime = ctime (&current_time);
  strtime[strlen (strtime) - 1] = '\0';

  sprintf (buf, "You have a probation time of %d days.\n\r", prob);
  stc (buf, victim);

  prob += date_to_int (strtime);
  victim->pcdata->empire2[EMP2_PROBTIME] = prob;
  SET_BIT (victim->pcdata->empire[EMP_BITS], BITS_PROBATION);
  sprintf (buf, "%s has been sponsored by %s for service in the Empire.\n\r",
	   victim->name, ch->name);
  empireinfo (i, buf);
  save_clans ();
  return;
}

void
do_outcast (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *victim;
  int i;
  char arg1[MIL];
  char buf[MSL];
  char clan[MSL];

  argument = one_argument (argument, arg1);

  if (IS_NPC (ch))
    return;

  if (!IS_IMMORTAL (ch))
    {
      if (!has_clan (ch))
	{
	  do_huh (ch, "");
	  return;
	}
    }

  if (arg1[0] == '\0')
    {
      send_to_char ("Exile whom?\n\r", ch);
      return;
    }

  victim = find_pc_mud (ch, arg1);

  if (victim == NULL)
    {
      send_to_char ("Nobody by that name.\n\r", ch);
      return;
    }

  if (victim == ch)
    {
      send_to_char ("No not today.\n\r", ch);
      return;
    }

  if (IS_NPC (victim))
    {
      send_to_char ("Not on NPC.\n\r", ch);
      return;
    }

  if (!has_clan (victim))
    {
      act ("$N does not serve any Empire.", ch, NULL, victim, TO_CHAR);
    }

  if (!same_clan (ch, victim))
    {
      act ("$N does not serve your Empire.", ch, NULL, victim, TO_CHAR);
      return;
    }

  if (IS_EMPEROR (victim))
    {
      stc ("Haha, yeah.. right.\n\r", ch);
      act ("$n just tried to Exile you.", ch, NULL, victim, TO_VICT);
      return;
    }

  if (!IS_SET (victim->pcdata->empire[2], BITS_PROBATION))
    {
      if (!IS_DUKE (ch) && !IS_HEIR (ch) && !IS_EMPEROR (ch))
	{
	  act ("You lack the authority to Exile anyone not on probation.", ch,
	       NULL, victim, TO_CHAR);
	  return;
	}
    }
  if (ch->pcdata->empire[EMP_RANK] >= victim->pcdata->empire[EMP_RANK])
    {
      act ("You lack the authority to Exile $N.", ch, NULL, victim, TO_CHAR);
      return;
    }

  sprintf (clan, "%s", ch->clan);
  sprintf (buf, "You Exile %s from your Empire.\n\r", victim->name);
  send_to_char (buf, ch);
  sprintf (buf, "You have been Exiled from the %s Empire.\n\r", clan);
  send_to_char (buf, victim);
  i = clannum (victim);

  if (IS_HEIR (victim))
    {
      free_string (clantable[i].heir);
      clantable[i].heir = str_dup ("????");
    }
  else if (IS_DUKE (victim))
    clantable[i].prince--;
  else if (IS_KNIGHT (victim))
    clantable[i].knight--;

  clantable[i].members--;
  victim->pcdata->empire[0] = 0;
  victim->pcdata->empire[1] = 0;
  victim->pcdata->empire[2] = 0;
  victim->pcdata->empire2[0] = 0;
  victim->pcdata->empire2[1] = 0;
  victim->pcdata->empire2[2] = 0;
  victim->pcdata->empire2[3] = 0;
  victim->pcdata->empire2[4] = 0;
  victim->emphome = 0;
  free_string (victim->clan);
  victim->clan = str_dup ("");
  do_autosave (victim, "");
  free_string (victim->lord);
  victim->lord = str_dup ("");
  free_string (victim->sponsor);
  victim->sponsor = str_dup ("");
  sprintf (buf, "%s has been Exiled by %s from the Empire.\n\r", victim->name,
	   ch->name);
  empireinfo (i, buf);
  save_clans ();
  return;
}

void
do_leaveclan (CHAR_DATA * ch, char *argument)
{
  int i;
  char arg[MIL];
  char buf[MSL];
  char clan[MSL];
  char *pArg;

  if (IS_NPC (ch))
    return;

  if (!has_clan (ch))
    {
      stc ("You have no clan.\n\r", ch);
      return;
    }

  if (IS_EMPEROR (ch))
    {
      return
	stc ("You can't forsake the Empire, who would lead if you did?\n\r",
	     ch);
    }


  {
    pArg = arg;
    while (*argument == ' ')
      argument++;
    while (*argument != '\0')
      {
	if (*argument == ' ')
	  {
	    argument++;
	    break;
	  }
	*pArg++ = *argument++;
      }
    *pArg = '\0';

  }

  if (arg[0] == '\0')
    {
      send_to_char ("Syntax: Forsake [password]\n\r", ch);
      return;
    }

  if (strcmp (crypt (arg, ch->pcdata->pwd), ch->pcdata->pwd))
    {
      send_to_char ("Wrong Password, wait 10 seconds.\n\r", ch);
      waiting (ch, 40);
      return;
    }

  sprintf (clan, "%s", ch->clan);
  sprintf (buf, "You Forsake your Empire.\n\r");
  send_to_char (buf, ch);
  i = clannum (ch);
  if (IS_HEIR (ch))
    {
      free_string (clantable[i].heir);
      clantable[i].heir = str_dup ("????");
    }
  else if (IS_DUKE (ch))
    clantable[i].prince--;
  else if (IS_KNIGHT (ch))
    clantable[i].knight--;

  free_string (ch->clan);
  ch->clan = str_dup ("");
  clantable[i].members--;
  free_string (ch->lord);
  ch->lord = str_dup ("");
  free_string (ch->sponsor);
  ch->sponsor = str_dup ("");
  ch->pcdata->empire[0] = 0;
  ch->pcdata->empire[1] = 0;
  ch->pcdata->empire[2] = 0;
  ch->pcdata->empire2[0] = 0;
  ch->pcdata->empire2[1] = 0;
  ch->pcdata->empire2[2] = 0;
  ch->pcdata->empire2[3] = 0;
  ch->pcdata->empire2[4] = 0;
  ch->emphome = 0;
  sprintf (buf, "%s has Forsaken the Empire.\n\r", ch->name);
  empireinfo (i, buf);
  do_autosave (ch, "");
  save_clans ();
  return;
}

void
do_deposit (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  int value, i;

  if (IS_NPC (ch))
    return;



  if (IS_DRAGON (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }

  if (!has_clan (ch))
    {
      do_huh (ch, "");
      return;
    }

  if (argument[0] == '\0')
    {
      send_to_char ("Deposit how many credits into the vault?\n\r", ch);
      return;
    }

  if (!is_number (argument))
    {
      send_to_char ("That was NOT funny...\n\r", ch);
      return;
    }

  value = atoi (argument);

  if (ch->pcdata->quest < value)
    {
      send_to_char ("You can't afford that much credits!\n\r", ch);
      return;
    }

  i = clannum (ch);
  clantable[i].qps += value;
  ch->pcdata->quest -= value;
  sprintf (buf, "You deposit %d credits into the %s Empire Vault.\n\r", value,
	   ch->clan);
  send_to_char (buf, ch);
  save_clans ();
  return;
}

void
do_withdraw (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  int value, i;

  if (IS_NPC (ch))
    return;


  if (IS_DRAGON (ch))
    {
      send_to_char ("Huh?", ch);
      return;
    }

  if (!has_clan (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }


  if (!IS_EMPEROR (ch) && !IS_HEIR (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }

  if (argument[0] == '\0')
    {
      send_to_char ("Withdraw how many credits from the vault?\n\r", ch);
      return;
    }

  if (!is_number (argument))
    {
      send_to_char ("That was NOT funny...\n\r", ch);
      return;
    }

  value = atoi (argument);
  i = clannum (ch);

  if (clantable[i].qps < value)
    {
      send_to_char ("But the vault doesn't have that much credits!\n\r", ch);
      return;
    }

  clantable[i].qps -= value;
  ch->pcdata->quest += value;
  sprintf (buf, "You withdraw %d credits from the %s Empire Vault.\n\r",
	   value, ch->clan);
  send_to_char (buf, ch);
  save_clans ();
  return;
}

bool
same_clan (CHAR_DATA * ch, CHAR_DATA * victim)
{
  if (IS_NPC (ch) || IS_NPC (victim))
    return FALSE;

  if (ch->pcdata->empire[0] == victim->pcdata->empire[0])
    return TRUE;

  return FALSE;
}

void
empireinfo (int i, char *argument)
{
  DESCRIPTOR_DATA *d;
  char buf[MSL];
  char nm[MSL];

  if (argument[0] == '\0')
    return;

  sprintf (nm, "%s", clantable[i].name);

  for (d = descriptor_list; d != NULL; d = d->next)
    {
      if (d->connected == CON_PLAYING)
	{
	  if (get_trust (d->character) <= LEVEL_BUILDER
	      && d->character->pcdata->empire[0] != i)
	    continue;

	  sprintf (buf, "#L(#n%s #n#0I#7nf#0o#L)#n #7 %s.\n\r", nm, argument);
	  send_to_char (buf, d->character);
	}
    }
  return;
}

void
do_claninfo (CHAR_DATA * ch, char *argument)
{
  DESCRIPTOR_DATA *d;
  int i;
  char buf[MSL];
  char bb[MSL];
  char ab[MSL];

  if (IS_NPC (ch))
    return;

  if (!has_clan (ch))
    {
      do_huh (ch, "");
      return;
    }

  if (argument[0] == '\0')
    return;

  if (!IS_IMMORTAL (ch))
    {
      char verb[MIL];

      sprintf (verb, "empiretalk");

      if (IS_HEAD (ch, LOST_TONGUE))
	{
	  sprintf (buf, "You can't %s without a tongue!\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (IS_EXTRA (ch, GAGGED))
	{
	  sprintf (buf, "You can't %s with a gag on!\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (!IS_NPC (ch) && IS_SET (ch->act, PLR_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (ch->in_room != NULL
	  && IS_SET (ch->in_room->added_flags, ROOM2_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (ch->in_room != NULL
	  && IS_SET (ch->in_room->room_flags, ROOM_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
    }

  if (IS_EMPEROR (ch))
    {
      sprintf (bb, "#y-#ox#y<");
      sprintf (ab, "#y>#ox#y-#n");
    }
  else if (IS_HEIR (ch))
    {
      sprintf (bb, "#y-<#n");
      sprintf (ab, "#y>-#n");
    }
  else if (IS_DUKE (ch))
    {
      sprintf (bb, "#y-*#n");
      sprintf (ab, "#y*-#n");
    }
  else if (IS_KNIGHT (ch))
    {
      sprintf (bb, "#y-+#n");
      sprintf (ab, "#y+-");
    }
  else
    {
      sprintf (bb, "#y--#n");
      sprintf (ab, "#y--#n");
    }


  sprintf (buf, "%s#L(#n%s#L)#n %s#n%s#7 %s.\n\r", bb, ch->name, ch->clan, ab,
	   argument);
  send_to_char (buf, ch);

  for (d = descriptor_list; d != NULL; d = d->next)
    {
      CHAR_DATA *och;
      CHAR_DATA *vch;

      och = d->original ? d->original : d->character;
      vch = d->character;

      if (d->connected == CON_PLAYING && vch != ch)
	{

	  if (get_trust (d->character) <= LEVEL_BUILDER
	      && !same_clan (ch, och))
	    continue;

	  sprintf (buf, "%s#L(#n%s#L)#n %s#n%s#7 %s.\n\r", bb, ch->name,
		   ch->clan, ab, argument);
	  send_to_char (buf, och);
	}
    }
  return;
}

void
update_research (void)
{
  char buf[MSL];
  int i, tech;

  for (i = 1; i < MAX_CLANS; i++)
    {
      if (clantable[i].empbits != EMPIRE_OPEN)
	continue;

      if (clantable[i].weapres > 0)
	{
	  clantable[i].weapres -= 500;
	  if (--clantable[i].weapres < 1)
	    {
	      tech = clantable[i].weaptech;

	      sprintf (buf,
		       "#yThe %s#y Project Is Finally Fully Researched.#n\n\r",
		       get_tech2 (tech));
	      empireinfo (i, buf);
	      update_tech (i, tech);
	      clantable[i].weaptech = 0;
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	    }
	}
    }
  return;
}

void
update_clanleaders (CHAR_DATA * ch)
{
  int i;
  if (IS_NPC (ch))
    return;
  if (!has_clan (ch))
    return;
  if (IS_IMMORTAL (ch))
    return;
  if (!str_cmp (ch->name, "Corim"))
    return;
  if (!str_cmp (ch->name, "Ixia"))
    return;
  if (!str_cmp (ch->name, "Nymph"))
    return;
  if (!str_cmp (ch->name, "Linksys"))
    return;
  if (!str_cmp (ch->name, "Viktoria"))
    return;
  if (!str_cmp (ch->name, "Scaleb"))
    return;
  if (!str_cmp (ch->name, "Kyler"))
    return;
  if (!str_cmp (ch->name, "Carion"))
    return;
  if (!str_cmp (ch->name, "Lucas"))
    return;
  if (!str_cmp (ch->name, "Shyvan"))
    return;
  if (!str_cmp (ch->name, "Aleister"))
    return;
  if (!str_cmp (ch->name, "Beelz"))
    return;
  if (!str_cmp (ch->name, "Shandi"))
    return;
  if (!str_cmp (ch->name, "Xanthes"))
    return;
  i = clannum (ch);
  if (str_cmp (ch->name, clantable[i].leader))
    {
      if (IS_SET (ch->pcdata->empire[EMP_RANK], RNK_EMPEROR))
	{
	  clantable[i].leader = str_dup (ch->name);
	}
      else
	{
	  return;
	}
    }
  else if (!str_cmp (ch->name, clantable[i].leader))
    {
      if (!IS_SET (ch->pcdata->empire[EMP_RANK], RNK_EMPEROR))
	{
	  clantable[i].leader = str_dup ("???");
	}
      else
	{
	  return;
	}
    }
  else
    {
      return;
    }
  save_clans ();
  return;
}

void
do_clinfo (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  DESCRIPTOR_DATA *d;
  int i;


  if (IS_NPC (ch))
    return;

  if (!has_clan (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  i = clannum (ch);
  send_to_char
    ("#L--------------------(#yEmpire Members Online#L)---------------------#n\n\r",
     ch);
  send_to_char
    ("#R[#C    Name    #R][#C Life Essence#R ][#CMystical Power#R][#C   Vitality   #R][#C  Credits   #R]#n\n\r",
     ch);
  for (d = descriptor_list; d != NULL; d = d->next)
    {
      if (d->connected == CON_PLAYING && !IS_NPC (d->character)
	  && same_clan (ch, d->character))
	{
	  sprintf (buf,
		   "#R[#C%-12s#R][#C%-14d#R][#C%-14d#R][#C%-14d#R][#C%-12d#R]#n\n\r",
		   d->character->name, d->character->max_hit,
		   d->character->max_mana, d->character->max_move,
		   d->character->pcdata->quest);
	  send_to_char (buf, ch);
	}
    }
  send_to_char
    ("#L----------------------------------------------------------------#n\n\r",
     ch);
  sprintf (buf, "#yCredits stored in the Empire Vault: %d.\n\r",
	   clantable[i].qps);
  send_to_char (buf, ch);
  sprintf (buf, "#yPlayer who last attacked the Empire: %s.\n\r",
	   clantable[i].retaliation);
  send_to_char (buf, ch);
  sprintf (buf, "#yThey belonged to the following Empire: %s.\n\r",
	   clantable[i].retclan);
  send_to_char (buf, ch);
  send_to_char
    ("#L----------------------------------------------------------------#n\n\r",
     ch);
  return;
}

void
update_retaliation (CHAR_DATA * victim, CHAR_DATA * ch)
{
  int i;
  char buf[MSL];
  if (IS_NPC (ch))
    return;
  if (IS_NPC (victim))
    return;
  if (!has_clan (victim))
    return;
  if (has_clan (ch))
    sprintf (buf, "#7No clan.#n");
  else
    sprintf (buf, "%s", victim->clan);
  i = clannum (ch);
  clantable[i].retaliation = str_dup (victim->name);
  clantable[i].retclan = str_dup (buf);
  save_clans ();
  return;
}

void
do_clanrecall (CHAR_DATA * ch, char *argument)
{
  int recall = 0;
  CHAR_DATA *victim;
  CHAR_DATA *mount;
  char buf[MSL];
  ROOM_INDEX_DATA *location;
  bool msg = FALSE;

  if (IS_NPC (ch))
    return;

  if (!has_clan (ch))
    {
      do_huh (ch, "");
      return;
    }

  if (is_inarena (ch))
    return;

  recall = ch->emphome;

  if (recall == 0)
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }

  act ("A look of concentration crosses $n's face.", ch, NULL, NULL, TO_ROOM);

  if ((location = get_room_index (recall)) == NULL)
    {
      send_to_char ("You are completely lost.\n\r", ch);
      return;
    }

  if (ch->in_room == location)
    return;

  if (IS_SET (ch->in_room->room_flags, ROOM_NO_RECALL)
      || IS_AFFECTED (ch, AFF_CURSE))
    {
      send_to_char ("You are unable to recall to your haven.\n\r", ch);
      return;
    }

  if (has_fighttimer (ch))
    return;

  waiting (ch, 4);

  if ((victim = ch->fighting) != NULL)
    {
      if (number_bits (1) == 0)
	{
	  sprintf (buf, "You failed!\n\r");
	  send_to_char (buf, ch);
	  return;
	}

      if (!IS_NPC (victim))
	{
	  if (!IS_NYM (ch, NYM_TOKENHOLDER))
	    {
	      stc
		("You can't recall from a player fight, since you have not even bought a single escape token, HELP ESCAPE, HELP RECALL.\n\r",
		 ch);
	      return;
	    }

	  if (ch->pcdata->escape < 1)
	    {
	      stc
		("You can't recall from a player fight, since you are out of Escape Tokens.\n\r",
		 ch);
	      return;
	    }
	  act
	    ("Your Token Clip hums for a second, then suddenly a burst of energy shots through your body and you wink out of existence.",
	     ch, NULL, victim, TO_CHAR);
	  act
	    ("$n's wrist seems to hum for a second, then suddenly $e is not there anymore.",
	     ch, NULL, victim, TO_VICT);
	  act
	    ("$n's wrist seems to hum for a second, then suddenly $e is not there anymore.",
	     ch, NULL, victim, TO_NOTVICT);
	  stc
	    ("You burn an Escape Token to recall from a fight with a player.\n\r",
	     ch);
	  msg = TRUE;
	  ch->pcdata->escape--;
	}



      sprintf (buf, "You recall from combat!\n\r");
      send_to_char (buf, ch);
      stop_fighting (ch, TRUE);
    }

  if (!msg)
    {
      act ("$n disappears.", ch, NULL, NULL, TO_ROOM);
    }
  char_from_room (ch);
  char_to_room (ch, location);
  act ("$n appears in the room.", ch, NULL, NULL, TO_ROOM);
  do_look (ch, "auto");
  if ((mount = ch->mount) == NULL)
    return;
  char_from_room (mount);
  char_to_room (mount, ch->in_room);
  return;
}

void
do_empire (CHAR_DATA * ch, char *argument)
{
  bool owner = FALSE;
  bool found = FALSE;
  char buf[MSL];
  char arg[MIL];
  char arg2[MIL];
  int cost = 1500000;
  int i, probtime;

  smash_tilde (argument);
  argument = one_argument (argument, arg);
  strcpy (arg2, argument);


  if (IS_NPC (ch))
    return;

  if (ch->pcdata->empire[0] > 0)
    {
      if (!IS_EMPEROR (ch))
	{
	  do_huh (ch, "");
	  return;
	}
      else if (IS_EMPEROR (ch))
	{
	  owner = TRUE;
	}
      else
	{
	  do_huh (ch, "");
	  return;
	}
    }

  if (owner)
    {
      i = ch->pcdata->empire[0];

      if (i == 0)
	{
	  stc
	    ("Bug, you are an Empire owner but you own no Empire? Inform Corim as soon as possible.\n\r",
	     ch);
	  return;
	}

      if (arg[0] == '\0')
	{
	  if (!IS_SET (ch->pcdata->empire[EMP_BITS], BITS_NAMED))
	    {
	      stc ("You must name your Empire.\n\r", ch);
	      stc ("Syntax: empire name <name> (with color code).\n\r", ch);
	    }
	  if (!IS_SET (ch->pcdata->empire[EMP_BITS], BITS_PROB))
	    {
	      stc ("You must set a probation time for your Empire.\n\r", ch);
	      stc ("Syntax: empire prob <number of days>.\n\r", ch);
	    }
	  else if (IS_SET (ch->pcdata->empire[EMP_BITS], BITS_PROB))
	    {
	      stc ("You can set a new probation time for your Empire.\n\r",
		   ch);
	      stc ("Syntax: empire prob <number of days>.\n\r", ch);
	    }

	  if (!IS_SET (ch->pcdata->empire[EMP_BITS], BITS_OPENED))
	    {
	      stc ("You must open your Empire.\n\r", ch);
	      stc ("Syntax: empire open.\n\r", ch);
	    }
	  else
	    {
	      stc ("Your Empire is fully created.\n\r", ch);
	    }
	  return;
	}
      else if (!str_cmp (arg, "wondertest"))
        {
clantable[i].wonder = 0;
  return;
          }         

      else if (!str_cmp (arg, "name"))
	{
	  if (IS_SET (ch->pcdata->empire[EMP_BITS], BITS_OPENED))
	    {
	      stc ("Your empire is already open.\n\r", ch);
	      return;
	    }

	  if (strlen (arg2) < 5 || strlen (arg2) > 30)
	    {
	      send_to_char
		("Name should be between 5 & 30 characters long.\n\r", ch);
	      return;
	    }

	  free_string (clantable[i].name);
	  clantable[i].name = str_dup (arg2);
	  SET_BIT (ch->pcdata->empire[EMP_BITS], BITS_NAMED);
	  act ("You name your empire $T.", ch, NULL, arg2, TO_CHAR);
	  save_clans ();
	  return;
	}
      else if (!str_cmp (arg, "prob"))
	{
	  if (!is_number (arg2) || (probtime = atoi (arg2)) < 1)
	    {
	      send_to_char ("Please enter a valid number of days.\n\r", ch);
	      return;
	    }
	  sprintf (buf,
		   "The probation time for any newly sponsored subjects in your Empire is set to %d days.\n\r",
		   probtime);
	  stc (buf, ch);
	  SET_BIT (ch->pcdata->empire[EMP_BITS], BITS_PROB);
	  clantable[i].probtime = probtime;
	  save_clans ();
	  return;
	}
      else if (!str_cmp (arg, "open"))
	{
	  if (IS_SET (ch->pcdata->empire[EMP_BITS], BITS_OPENED))
	    {
	      stc ("Your empire is already open.\n\r", ch);
	      return;
	    }
	  if (!IS_SET (ch->pcdata->empire[EMP_BITS], BITS_NAMED)
	      || !IS_SET (ch->pcdata->empire[EMP_BITS], BITS_PROB))
	    {
	      do_empire (ch, "");
	      return;
	    }
	  free_string (ch->clan);
	  ch->clan = str_dup (clantable[i].name);
	  stc ("Your Empire is fully created.\n\r", ch);
	  SET_BIT (ch->pcdata->empire[EMP_BITS], BITS_OPENED);
	  clantable[i].empbits = EMPIRE_OPEN;
	  save_clans ();
	  return;
	}
      else
	{
	  do_empire (ch, "");
	  return;
	}
      return;
    }

  if (mudconfig->maxemp >= MAX_EMPIRE)
    {
      do_huh (ch, "");
      return;
    }

  if (ch->pcdata->empire[EMP_EMPIRE] != 0)
    {
      stc ("You are already part of an Empire.\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      stc ("If you wish to create an Empire, type: empire create.\n\r", ch);
      stc ("Be aware that creating an Empire costs 1.500.000 Credits.\n\r",
	   ch);
      return;
    }
  else if (!str_cmp (arg, "create"))
    {
      if (ch->pcdata->quest < cost)
	{
	  sprintf (buf, "You need %d more credits to create an empire.\n\r",
		   (cost - ch->pcdata->quest));
	  stc (buf, ch);
	  return;
	}

      for (i = 1; i < MAX_CLANS; i++)
	{
	  if (clantable[i].empbits == EMPIRE_CLOSED)
	    {
	      found = TRUE;
	      break;
	    }
	}

      if (!found)
	{
	  stc ("Bug, Please inform Corim as soon as possible.\n\r", ch);
	  return;
	}

      sprintf (buf, "You now own the %s empire.\n\r", clantable[i].name);
      stc (buf, ch);
      clantable[i].leader = str_dup (ch->name);
      clantable[i].empbits = EMPIRE_OWNED;
      clantable[i].recallroom = emphome (i);
      ch->emphome = emphome (i);
      ch->pcdata->empire[EMP_EMPIRE] = i;
      ch->clan = str_dup (clantable[i].name);
      ch->pcdata->empire[EMP_RANK] = RNK_EMPEROR;
      ch->pcdata->quest -= cost;
      if (ch->sex == 2)
	SET_BIT (clantable[i].bits, EMPIRE_FEMALE);
      else if (ch->sex == 1)
	SET_BIT (clantable[i].bits, EMPIRE_MALE);

      mudconfig->maxemp++;
      save_clans ();
      return;
    }
  else
    {
      do_empire (ch, "");
      return;
    }
  return;
}



void
do_technology (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  char line[MSL];
  char arg1[MIL];
  char arg2[MIL];
  char arg3[MIL];
  char techno[MSL];
  int cost = 0;
  int i = 0;
  int v1, v2, v3, v4, v5, v6;
  int wg1, wg2, wg3, wg4, wg5, wg6;
  int ag1, ag2, ag3, ag4, ag5, ag6;
  int glvl, hlvl, imps, res, tech;
  int paid, level = 1, pros = 0;
  int apply = 0;

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

  if (IS_NPC (ch))
    return;

  if (ch->pcdata->empire[0] < 1 || ch->pcdata->empire[0] > MAX_CLANS)
    {
      do_huh (ch, "");
      return;
    }
  i = ch->pcdata->empire[0];

  v1 = clantable[i].strgroup;
  v2 = clantable[i].lifegroup;
  v3 = clantable[i].hitgroup;
  v4 = clantable[i].acdcgroup;
  v5 = clantable[i].protgroup;
  v6 = clantable[i].cost;
  glvl = clantable[i].guardlvl;
  hlvl = clantable[i].healerlvl;
  imps = clantable[i].improves;
  tech = clantable[i].weaptech;
  res = clantable[i].weapres;
  paid = clantable[i].armres;

  /*Weapon Tech */
  wg1 = v1;
  if (wg1 < 1000)
    wg1 = 0;
  else
    wg1 /= 1000;

  wg2 = v2;
  if (wg2 < 1000)
    wg2 = 0;
  else
    wg2 /= 1000;

  wg3 = v3;
  if (wg3 < 1000)
    wg3 = 0;
  else
    wg3 /= 1000;

  wg4 = v4;
  if (wg4 < 1000)
    wg4 = 0;
  else
    wg4 /= 1000;

  wg5 = v5;
  if (wg5 < 1000)
    wg5 = 0;
  else
    wg5 /= 1000;

  wg6 = v6;
  if (wg6 < 1000)
    wg6 = 0;
  else
    wg6 /= 1000;


  /*Armor Tech */
  ag1 = v1;
  if (ag1 >= 1000)
    ag1 -= ((v1 / 1000) * 1000);
  if (ag1 < 1)
    ag1 = 0;

  ag2 = v2;
  if (ag2 >= 1000)
    ag2 -= ((v2 / 1000) * 1000);
  if (ag2 < 1)
    ag2 = 0;

  ag3 = v3;
  if (ag3 >= 1000)
    ag3 -= ((v3 / 1000) * 1000);
  if (ag3 < 1)
    ag3 = 0;

  ag4 = v4;
  if (ag4 >= 1000)
    ag4 -= ((v4 / 1000) * 1000);
  if (ag4 < 1)
    ag4 = 0;

  ag5 = v5;
  if (ag5 >= 1000)
    ag5 -= ((v5 / 1000) * 1000);
  if (ag5 < 1)
    ag5 = 0;

  ag6 = v6;
  if (ag6 >= 1000)
    ag6 -= ((v6 / 1000) * 1000);
  if (ag6 < 1)
    ag6 = 0;

  if (IS_SET (tech, RES_RESEARCH))
    {
      sprintf (techno, "%s", get_tech (tech));
      cost = get_techcost (tech);
      if (IS_SET (tech, RES_STATS))
	{
	  if (IS_SET (tech, RES_WEAPON))
	    level += wg1;
	  else
	    level += ag1;
	}
      else if (IS_SET (tech, RES_BODY))
	{
	  if (IS_SET (tech, RES_WEAPON))
	    level += wg2;
	  else
	    level += ag2;
	}
      else if (IS_SET (tech, RES_PROWESS))
	{
	  if (IS_SET (tech, RES_WEAPON))
	    level += wg3;
	  else
	    level += ag3;
	}
      else if (IS_SET (tech, RES_POWER))
	{
	  if (IS_SET (tech, RES_WEAPON))
	    level += wg4;
	  else
	    level += ag4;
	}
      else if (IS_SET (tech, RES_COMBAT))
	{
	  if (IS_SET (tech, RES_WEAPON))
	    level += wg5;
	  else
	    level += ag5;
	}
      else if (IS_SET (tech, RES_COST))
	{
	  if (IS_SET (tech, RES_WEAPON))
	    level += wg6;
	  else
	    level += ag6;
	}
      else if (IS_SET (tech, RES_HEALER))
	{
	  level += hlvl;
	}
      else if (IS_SET (tech, RES_GUARDIAN))
	{
	  level += glvl;
	}

      cost *= level;

      pros = percentage (paid, cost);
    }




  sprintf (line,
	   "#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#o*#y-#n\n\r",
	   ch);

  if (arg1[0] == '\0')
    {
      stc (line, ch);
      stc ("\n\r", ch);
      sprintf (buf, "#o-*< #yEmpire   Technology#o >*-#n");
      cent_to_char (buf, ch);
      stc ("\n\r", ch);
      stc (line, ch);
      stc ("\n\r", ch);
      sprintf (buf, "#y#uWeapon Technology#n");
      cent_to_char (buf, ch);
      stc ("\n\r", ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Stat Enhancements.\n\r",
	       wg1 > 0 ? "*" : " ", wg1 > 1 ? "*" : " ", wg1 > 2 ? "*" : " ",
	       wg1 > 3 ? "*" : " ", wg1 > 4 ? "*" : " ", wg1 > 5 ? "*" : " ",
	       wg1 > 6 ? "*" : " ", wg1 > 7 ? "*" : " ", wg1 > 8 ? "*" : " ",
	       wg1 > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Body Enhancements.\n\r",
	       wg2 > 0 ? "*" : " ", wg2 > 1 ? "*" : " ", wg2 > 2 ? "*" : " ",
	       wg2 > 3 ? "*" : " ", wg2 > 4 ? "*" : " ", wg2 > 5 ? "*" : " ",
	       wg2 > 6 ? "*" : " ", wg2 > 7 ? "*" : " ", wg2 > 8 ? "*" : " ",
	       wg2 > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Prowess Enhancements.\n\r",
	       wg3 > 0 ? "*" : " ", wg3 > 1 ? "*" : " ", wg3 > 2 ? "*" : " ",
	       wg3 > 3 ? "*" : " ", wg3 > 4 ? "*" : " ", wg3 > 5 ? "*" : " ",
	       wg3 > 6 ? "*" : " ", wg3 > 7 ? "*" : " ", wg3 > 8 ? "*" : " ",
	       wg3 > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Power Enhancements.\n\r",
	       wg4 > 0 ? "*" : " ", wg4 > 1 ? "*" : " ", wg4 > 2 ? "*" : " ",
	       wg4 > 3 ? "*" : " ", wg4 > 4 ? "*" : " ", wg4 > 5 ? "*" : " ",
	       wg4 > 6 ? "*" : " ", wg4 > 7 ? "*" : " ", wg4 > 8 ? "*" : " ",
	       wg4 > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Combat Enhancements.\n\r",
	       wg5 > 0 ? "*" : " ", wg5 > 1 ? "*" : " ", wg5 > 2 ? "*" : " ",
	       wg5 > 3 ? "*" : " ", wg5 > 4 ? "*" : " ", wg5 > 5 ? "*" : " ",
	       wg5 > 6 ? "*" : " ", wg5 > 7 ? "*" : " ", wg5 > 8 ? "*" : " ",
	       wg5 > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Cost Reductions\n\r",
	       wg6 > 0 ? "*" : " ", wg6 > 1 ? "*" : " ", wg6 > 2 ? "*" : " ",
	       wg6 > 3 ? "*" : " ", wg6 > 4 ? "*" : " ", wg6 > 5 ? "*" : " ",
	       wg6 > 6 ? "*" : " ", wg6 > 7 ? "*" : " ", wg6 > 8 ? "*" : " ",
	       wg6 > 9 ? "*" : " ");
      stc (buf, ch);
      stc ("\n\r", ch);
      sprintf (buf, "#y#uSpecial Advancements#n");
      cent_to_char (buf, ch);
      stc ("\n\r", ch);
      sprintf (buf,
	       "        #o[#r%s#o]#y Crafted From Silver.            #o[#r%s#o]#y Indestructible.\n\r",
	       IS_SET (imps, IMP_SILVER) ? "*" : " ", IS_SET (imps,
							      IMP_RELIC) ? "*"
	       : " ");
      stc (buf, ch);
      sprintf (buf,
	       "        #o[#r%s#o]#y Fabled.                         #o[#r%s#o]#y Can Become Mythical.\n\r",
	       IS_SET (imps, IMP_FABLED) ? "*" : " ", IS_SET (imps,
							      IMP_MYTHICAL) ?
	       "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "        #o[#r%s#o]#y Can Become Legendary.           #o[#r%s#o]#y Can Be Imbued With Magic.\n\r",
	       IS_SET (imps, IMP_LEGEND) ? "*" : " ", IS_SET (imps,
							      IMP_SPELLS) ?
	       "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "        #o[#r%s#o]#y Can Hold Class Improvements.    #o[#r%s#o]#y Can Be Customized.\n\r",
	       IS_SET (imps, IMP_CLASS) ? "*" : " ", IS_SET (imps,
							     IMP_CUSTOM) ? "*"
	       : " ");
      stc (buf, ch);
      stc ("\n\r", ch);
      stc (line, ch);
      stc ("\n\r", ch);
      sprintf (buf, "#y#uArmor Technology#n");
      cent_to_char (buf, ch);
      stc ("\n\r", ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Stat Enhancements.\n\r",
	       ag1 > 0 ? "*" : " ", ag1 > 1 ? "*" : " ", ag1 > 2 ? "*" : " ",
	       ag1 > 3 ? "*" : " ", ag1 > 4 ? "*" : " ", ag1 > 5 ? "*" : " ",
	       ag1 > 6 ? "*" : " ", ag1 > 7 ? "*" : " ", ag1 > 8 ? "*" : " ",
	       ag1 > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Body Enhancements.\n\r",
	       ag2 > 0 ? "*" : " ", ag2 > 1 ? "*" : " ", ag2 > 2 ? "*" : " ",
	       ag2 > 3 ? "*" : " ", ag2 > 4 ? "*" : " ", ag2 > 5 ? "*" : " ",
	       ag2 > 6 ? "*" : " ", ag2 > 7 ? "*" : " ", ag2 > 8 ? "*" : " ",
	       ag2 > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Prowess Enhancements.\n\r",
	       ag3 > 0 ? "*" : " ", ag3 > 1 ? "*" : " ", ag3 > 2 ? "*" : " ",
	       ag3 > 3 ? "*" : " ", ag3 > 4 ? "*" : " ", ag3 > 5 ? "*" : " ",
	       ag3 > 6 ? "*" : " ", ag3 > 7 ? "*" : " ", ag3 > 8 ? "*" : " ",
	       ag3 > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Power Enhancements.\n\r",
	       ag4 > 0 ? "*" : " ", ag4 > 1 ? "*" : " ", ag4 > 2 ? "*" : " ",
	       ag4 > 3 ? "*" : " ", ag4 > 4 ? "*" : " ", ag4 > 5 ? "*" : " ",
	       ag4 > 6 ? "*" : " ", ag4 > 7 ? "*" : " ", ag4 > 8 ? "*" : " ",
	       ag4 > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Combat Enhancements.\n\r",
	       ag5 > 0 ? "*" : " ", ag5 > 1 ? "*" : " ", ag5 > 2 ? "*" : " ",
	       ag5 > 3 ? "*" : " ", ag5 > 4 ? "*" : " ", ag5 > 5 ? "*" : " ",
	       ag5 > 6 ? "*" : " ", ag5 > 7 ? "*" : " ", ag5 > 8 ? "*" : " ",
	       ag5 > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Cost Reductions.\n\r",
	       ag6 > 0 ? "*" : " ", ag6 > 1 ? "*" : " ", ag6 > 2 ? "*" : " ",
	       ag6 > 3 ? "*" : " ", ag6 > 4 ? "*" : " ", ag6 > 5 ? "*" : " ",
	       ag6 > 6 ? "*" : " ", ag6 > 7 ? "*" : " ", ag6 > 8 ? "*" : " ",
	       ag6 > 9 ? "*" : " ");
      stc (buf, ch);
      stc ("\n\r", ch);
      sprintf (buf, "#y#uSpecial Advancements#n");
      cent_to_char (buf, ch);
      stc ("\n\r", ch);
      sprintf (buf,
	       "        #o[#r%s#o]#y Crafted From Silver.            #o[#r%s#o]#y Indestructible.\n\r",
	       IS_SET (imps, IMP_A_SILVER) ? "*" : " ", IS_SET (imps,
								IMP_A_RELIC) ?
	       "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "        #o[#r%s#o]#y Fabled.                         #o[#r%s#o]#y Can Become Mythical.\n\r",
	       IS_SET (imps, IMP_A_FABLED) ? "*" : " ", IS_SET (imps,
								IMP_A_MYTHICAL)
	       ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "        #o[#r%s#o]#y Can Become Legendary.           #o[#r%s#o]#y Can Be Imbued With Magic.\n\r",
	       IS_SET (imps, IMP_A_LEGEND) ? "*" : " ", IS_SET (imps,
								IMP_A_SPELLS)
	       ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "        #o[#r%s#o]#y Can Hold Class Improvements.    #o[#r%s#o]#y Can Be Customized.\n\r",
	       IS_SET (imps, IMP_A_CLASS) ? "*" : " ", IS_SET (imps,
							       IMP_A_CUSTOM) ?
	       "*" : " ");
      stc (buf, ch);
      stc ("\n\r", ch);
      stc (line, ch);
      stc ("\n\r", ch);
      sprintf (buf, "#y#uHall Improvements#n");
      cent_to_char (buf, ch);
      stc ("\n\r", ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Guardian Level.\n\r",
	       glvl > 0 ? "*" : " ", glvl > 1 ? "*" : " ",
	       glvl > 2 ? "*" : " ", glvl > 3 ? "*" : " ",
	       glvl > 4 ? "*" : " ", glvl > 5 ? "*" : " ",
	       glvl > 6 ? "*" : " ", glvl > 7 ? "*" : " ",
	       glvl > 8 ? "*" : " ", glvl > 9 ? "*" : " ");
      stc (buf, ch);
      sprintf (buf,
	       "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Healer Level.\n\r",
	       hlvl > 0 ? "*" : " ", hlvl > 1 ? "*" : " ",
	       hlvl > 2 ? "*" : " ", hlvl > 3 ? "*" : " ",
	       hlvl > 4 ? "*" : " ", hlvl > 5 ? "*" : " ",
	       hlvl > 6 ? "*" : " ", hlvl > 7 ? "*" : " ",
	       hlvl > 8 ? "*" : " ", hlvl > 9 ? "*" : " ");
      stc (buf, ch);
      stc ("\n\r", ch);
      stc (line, ch);
      if (IS_SET (tech, RES_RESEARCH))
	{
	  stc ("\n\r", ch);
	  sprintf (buf,
		   "#y#uCurrently Your Empire Is Researching This Technology.#n");
	  cent_to_char (buf, ch);
	  stc ("\n\r", ch);
	  cent_to_char (techno, ch);
	  stc ("\n\r", ch);
	  sprintf (buf,
		   "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100 #yResearch Progress.",
		   pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		   pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		   pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		   pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		   pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		   pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		   pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		   pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		   pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		   pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	  cent_to_char (buf, ch);
	  stc ("\n\r", ch);
	  stc (line, ch);
	}
      return;
    }
  else if (!str_cmp (arg1, "weapon") && !IS_SET (tech, RES_RESEARCH))
    {
      apply = RES_WEAPON + RES_RESEARCH;
      if (arg2[0] == '\0' || !IS_EMPEROR (ch))
	{
	  stc (line, ch);
	  stc ("\n\r", ch);
	  sprintf (buf, "#y#uWeapon Technology#n");
	  cent_to_char (buf, ch);
	  stc ("\n\r", ch);
	  sprintf (buf,
		   "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Stat Enhancements.\n\r",
		   wg1 > 0 ? "*" : " ", wg1 > 1 ? "*" : " ",
		   wg1 > 2 ? "*" : " ", wg1 > 3 ? "*" : " ",
		   wg1 > 4 ? "*" : " ", wg1 > 5 ? "*" : " ",
		   wg1 > 6 ? "*" : " ", wg1 > 7 ? "*" : " ",
		   wg1 > 8 ? "*" : " ", wg1 > 9 ? "*" : " ");
	  stc (buf, ch);
	  sprintf (buf,
		   "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Body Enhancements.\n\r",
		   wg2 > 0 ? "*" : " ", wg2 > 1 ? "*" : " ",
		   wg2 > 2 ? "*" : " ", wg2 > 3 ? "*" : " ",
		   wg2 > 4 ? "*" : " ", wg2 > 5 ? "*" : " ",
		   wg2 > 6 ? "*" : " ", wg2 > 7 ? "*" : " ",
		   wg2 > 8 ? "*" : " ", wg2 > 9 ? "*" : " ");
	  stc (buf, ch);
	  sprintf (buf,
		   "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Prowess Enhancements.\n\r",
		   wg3 > 0 ? "*" : " ", wg3 > 1 ? "*" : " ",
		   wg3 > 2 ? "*" : " ", wg3 > 3 ? "*" : " ",
		   wg3 > 4 ? "*" : " ", wg3 > 5 ? "*" : " ",
		   wg3 > 6 ? "*" : " ", wg3 > 7 ? "*" : " ",
		   wg3 > 8 ? "*" : " ", wg3 > 9 ? "*" : " ");
	  stc (buf, ch);
	  sprintf (buf,
		   "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Power Enhancements.\n\r",
		   wg4 > 0 ? "*" : " ", wg4 > 1 ? "*" : " ",
		   wg4 > 2 ? "*" : " ", wg4 > 3 ? "*" : " ",
		   wg4 > 4 ? "*" : " ", wg4 > 5 ? "*" : " ",
		   wg4 > 6 ? "*" : " ", wg4 > 7 ? "*" : " ",
		   wg4 > 8 ? "*" : " ", wg4 > 9 ? "*" : " ");
	  stc (buf, ch);
	  sprintf (buf,
		   "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Combat Enhancements.\n\r",
		   wg5 > 0 ? "*" : " ", wg5 > 1 ? "*" : " ",
		   wg5 > 2 ? "*" : " ", wg5 > 3 ? "*" : " ",
		   wg5 > 4 ? "*" : " ", wg5 > 5 ? "*" : " ",
		   wg5 > 6 ? "*" : " ", wg5 > 7 ? "*" : " ",
		   wg5 > 8 ? "*" : " ", wg5 > 9 ? "*" : " ");
	  stc (buf, ch);
	  sprintf (buf,
		   "                         #o[#r%s%s%s%s%s%s%s%s%s%s#o]#y Cost Reductions\n\r",
		   wg6 > 0 ? "*" : " ", wg6 > 1 ? "*" : " ",
		   wg6 > 2 ? "*" : " ", wg6 > 3 ? "*" : " ",
		   wg6 > 4 ? "*" : " ", wg6 > 5 ? "*" : " ",
		   wg6 > 6 ? "*" : " ", wg6 > 7 ? "*" : " ",
		   wg6 > 8 ? "*" : " ", wg6 > 9 ? "*" : " ");
	  stc (buf, ch);
	  stc ("\n\r", ch);
	  sprintf (buf, "#y#uSpecial Advancements#n");
	  cent_to_char (buf, ch);
	  stc ("\n\r", ch);
	  sprintf (buf,
		   "        #o[#r%s#o]#y Crafted From Silver.            #o[#r%s#o]#y Indestructible.\n\r",
		   IS_SET (imps, IMP_SILVER) ? "*" : " ", IS_SET (imps,
								  IMP_RELIC) ?
		   "*" : " ");
	  stc (buf, ch);
	  sprintf (buf,
		   "        #o[#r%s#o]#y Fabled.                         #o[#r%s#o]#y Can Become Mythical.\n\r",
		   IS_SET (imps, IMP_FABLED) ? "*" : " ", IS_SET (imps,
								  IMP_MYTHICAL)
		   ? "*" : " ");
	  stc (buf, ch);
	  sprintf (buf,
		   "        #o[#r%s#o]#y Can Become Legendary.           #o[#r%s#o]#y Can Be Imbued With Magic.\n\r",
		   IS_SET (imps, IMP_LEGEND) ? "*" : " ", IS_SET (imps,
								  IMP_SPELLS)
		   ? "*" : " ");
	  stc (buf, ch);
	  sprintf (buf,
		   "        #o[#r%s#o]#y Can Hold Class Improvements.    #o[#r%s#o]#y Can Be Customized.\n\r",
		   IS_SET (imps, IMP_CLASS) ? "*" : " ", IS_SET (imps,
								 IMP_CUSTOM) ?
		   "*" : " ");
	  stc (buf, ch);
	  stc ("\n\r", ch);
	  stc (line, ch);
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "silver") && !IS_SET (imps, IMP_SILVER))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_SILVER;
	  cost = get_techcost (apply);
	  if (arg3[0] == '\0')
	    {
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon silver research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be %s#n\n\r",
		       get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_SILVER);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "indestructible") && !IS_SET (imps, IMP_RELIC))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00%s #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o] #7100%s#y Research Progress.",
		       "%", pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ", "%");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_RELIC;
	  cost = get_techcost (apply);
	  if (arg3[0] == '\0')
	    {
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon indestructible research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be %s#n\n\r",
		       get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_RELIC);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "fabled") && !IS_SET (imps, IMP_FABLED))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_FABLED;
	  cost = get_techcost (apply);
	  if (arg3[0] == '\0')
	    {
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon fabled research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be %s#n\n\r",
		       get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_FABLED);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "mythical") && !IS_SET (imps, IMP_MYTHICAL))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o] #7100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_MYTHICAL;
	  cost = get_techcost (apply);
	  if (arg3[0] == '\0')
	    {
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon mythical research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be %s#n\n\r",
		       get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_MYTHICAL);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "legendary") && !IS_SET (imps, IMP_LEGEND))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_LEGEND;
	  cost = get_techcost (apply);
	  if (arg3[0] == '\0')
	    {
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon legendary research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be %s#n\n\r",
		       get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_LEGEND);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "magic") && !IS_SET (imps, IMP_SPELLS))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_SPELLS;
	  cost = get_techcost (apply);
	  if (arg3[0] == '\0')
	    {
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon magic research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be %s#n\n\r",
		       get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_SPELLS);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "class") && !IS_SET (imps, IMP_CLASS))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_CLASS;
	  cost = get_techcost (apply);
	  if (arg3[0] == '\0')
	    {
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon class research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be %s#n\n\r",
		       get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_CLASS);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "custom") || !str_cmp (arg2, "customize") && !IS_SET (imps, IMP_CUSTOM))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o] #7100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_CUSTOM;
	  cost = get_techcost (apply);
	  if (arg3[0] == '\0')
	    {
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon custom research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be %s#n\n\r",
		       get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_CUSTOM);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "stat") || !str_cmp (arg2, "stats"))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o] #7100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_STATS;
	  cost = get_techcost (apply);
	  level += wg1;
	  cost *= level;
	  if (arg3[0] == '\0')
	    {
	      if (level > 10)
		{
		  stc
		    ("#yYour Empire Has Advanced To The Highest Level Possible In This Technology.\n\r",
		     ch);
		  return;
		}
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon stat research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      if (level > 10)
		{
		  stc
		    ("#yYour Empire Has Already Advanced To The Highest Level Possible In This Technology.\n\r",
		     ch);
		  return;
		}
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be Level %d %s#n\n\r",
		       level, get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_STATS);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  else
	    {
	      sprintf (buf, "%s %s", arg1, arg2);
	      do_technology (ch, buf);
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "body"))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_BODY;
	  cost = get_techcost (apply);
	  level += wg2;
	  cost *= level;
	  if (arg3[0] == '\0')
	    {
	      if (level > 10)
		{
		  stc
		    ("#yYour Empire Has Advanced To The Highest Level Possible In This Technology.\n\r",
		     ch);
		  return;
		}
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon stat research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      if (level > 10)
		{
		  stc
		    ("#yYour Empire Has Already Advanced To The Highest Level Possible In This Technology.\n\r",
		     ch);
		  return;
		}
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be Level %d %s#n\n\r",
		       level, get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_BODY);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  else
	    {
	      sprintf (buf, "%s %s", arg1, arg2);
	      do_technology (ch, buf);
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "prow") || !str_cmp (arg2, "prowess"))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_PROWESS;
	  cost = get_techcost (apply);
	  level += wg3;
	  cost *= level;
	  if (arg3[0] == '\0')
	    {
	      if (level > 10)
		{
		  stc
		    ("#yYour Empire Has Advanced To The Highest Level Possible In This Technology.\n\r",
		     ch);
		  return;
		}
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon stat research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      if (level > 10)
		{
		  stc
		    ("#yYour Empire Has Already Advanced To The Highest Level Possible In This Technology.\n\r",
		     ch);
		  return;
		}
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be Level %d %s#n\n\r",
		       level, get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_PROWESS);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  else
	    {
	      sprintf (buf, "%s %s", arg1, arg2);
	      do_technology (ch, buf);
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "power"))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_POWER;
	  cost = get_techcost (apply);
	  level += wg4;
	  cost *= level;
	  if (arg3[0] == '\0')
	    {
	      if (level > 10)
		{
		  stc
		    ("#yYour Empire Has Advanced To The Highest Level Possible In This Technology.\n\r",
		     ch);
		  return;
		}
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon stat research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      if (level > 10)
		{
		  stc
		    ("#yYour Empire Has Already Advanced To The Highest Level Possible In This Technology.\n\r",
		     ch);
		  return;
		}
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be Level %d %s#n\n\r",
		       level, get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_POWER);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  else
	    {
	      sprintf (buf, "%s %s", arg1, arg2);
	      do_technology (ch, buf);
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "combat"))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#y#uCurrently Your Empire Is Busy Researching This Technology.#n");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      cent_to_char (techno, ch);
	      stc ("\n\r", ch);
	      sprintf (buf,
		       "#00 #o[#r%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s#o]#7 100#y Research Progress.",
		       pros >= 5 ? "*" : " ", pros >= 10 ? "*" : " ",
		       pros >= 15 ? "*" : " ", pros >= 20 ? "*" : " ",
		       pros >= 25 ? "*" : " ", pros >= 30 ? "*" : " ",
		       pros >= 35 ? "*" : " ", pros >= 40 ? "*" : " ",
		       pros >= 45 ? "*" : " ", pros >= 50 ? "*" : " ",
		       pros >= 55 ? "*" : " ", pros >= 60 ? "*" : " ",
		       pros >= 65 ? "*" : " ", pros >= 70 ? "*" : " ",
		       pros >= 75 ? "*" : " ", pros >= 80 ? "*" : " ",
		       pros >= 85 ? "*" : " ", pros >= 90 ? "*" : " ",
		       pros >= 95 ? "*" : " ", pros >= 100 ? "*" : " ");
	      cent_to_char (buf, ch);
	      stc ("\n\r", ch);
	      stc (line, ch);
	      return;
	    }
	  apply += RES_COMBAT;
	  cost = get_techcost (apply);
	  level += wg5;
	  cost *= level;
	  if (arg3[0] == '\0')
	    {
	      if (level > 10)
		{
		  stc
		    ("#yYour Empire Has Advanced To The Highest Level Possible In This Technology.\n\r",
		     ch);
		  return;
		}
	      sprintf (buf,
		       "#yThis Will Cost Your Empire #r%d#y Credits.\n\r",
		       cost);
	      stc (buf, ch);
	      sprintf (buf,
		       "#yTo Start Researching This Technology Type: technology weapon stat research#n\n\r");
	      stc (buf, ch);
	      return;
	    }
	  else if (!str_cmp (arg3, "research"))
	    {
	      if (level > 10)
		{
		  stc
		    ("#yYour Empire Has Already Advanced To The Highest Level Possible In This Technology.\n\r",
		     ch);
		  return;
		}
	      sprintf (buf,
		       "#yYou Declare That The Next Technology To Research Will Be Level %d %s#n\n\r",
		       level, get_tech2 (apply));
	      stc (buf, ch);
	      SET_BIT (clantable[i].weaptech, RES_RESEARCH);
	      SET_BIT (clantable[i].weaptech, RES_WEAPON);
	      SET_BIT (clantable[i].weaptech, RES_COMBAT);
	      clantable[i].weapres = 0;
	      clantable[i].armres = 0;
	      return;
	    }
	  else
	    {
	      sprintf (buf, "%s %s", arg1, arg2);
	      do_technology (ch, buf);
	      return;
	    }
	  return;
	}
      else if (!str_cmp (arg2, "cost"))
	{
	  if (IS_SET (tech, RES_RESEARCH))
	    {
	      stc ("\n\r", ch);
	      sprintf (buf,
		      

Showing the first 100 KB of 145.7 KB. Download the archive for the full file.

Site Stats

Snippets: 1791
Codebases: 571