Ejemplo n.º 1
0
/*
 * Cheat -- describe a created object for the user
 */
static void object_mention(object_type *o_ptr)
{
	char o_name[80];

	/* Describe */
	object_desc_store(o_name, o_ptr, FALSE, 0);

	/* Artifact */
	if (artifact_p(o_ptr))
	{
		/* Silly message */
		msg_format("Artifact (%s)", o_name);
	}

	/* Random Artifact */
	else if (o_ptr->art_name)
	{
		msg_print("Random artifact");
	}

	/* Ego-item */
	else if (ego_item_p(o_ptr))
	{
		/* Silly message */
		msg_format("Ego-item (%s)", o_name);
	}

	/* Normal item */
	else
	{
		/* Silly message */
		msg_format("Object (%s)", o_name);
	}
}
Ejemplo n.º 2
0
/*
 * Wrapper around object_desc_store() for the '%v'
 * format option.  This allows object_desc() to be
 * called in a format string.
 *
 * The parameters are object_type (o_ptr), pref (int), mode(int).
 */
void object_store_fmt(char *buf, uint max, cptr fmt, va_list *vp)
{
	const object_type *o_ptr;
	int pref;
	int mode;
	
	/* Unused parameter */
	(void)fmt;
	
	/* Get the object */
	o_ptr = va_arg(*vp, const object_type*);
	
	/* Get the pref */
	pref = va_arg(*vp, int);
	
	/* Get the mode */
	mode = va_arg(*vp, int);
	
	object_desc_store(buf, o_ptr, pref, mode, max);
}
Ejemplo n.º 3
0
/*
 * Just display an item's properties (debug-info)
 * Originally by David Reeve Sward <*****@*****.**>
 * Verbose item flags by -Bernd-
 */
static void wiz_display_item(const object_type *o_ptr)
{
	int i, j = 13;
	u32b f1, f2, f3, f4, f5, f6;
	char buf[256];

	/* Extract the flags */
	object_flags(o_ptr, &f1, &f2, &f3, &f4, &f5, &f6);

	/* Clear the screen */
	for (i = 1; i <= 23; i++) prt("", i, j - 2);

	/* Describe fully */
	object_desc_store(buf, o_ptr, TRUE, 3);

	prt(buf, 2, j);

	prt(format("kind = %-5d  level = %-4d  tval = %-5d  sval = %-5d",
	           o_ptr->k_idx, get_object_level(o_ptr),
	           o_ptr->tval, o_ptr->sval), 4, j);

	prt(format("number = %-3d  wgt = %-6d  ac = %-5d    damage = %dd%d",
	           o_ptr->number, o_ptr->weight,
	           o_ptr->ac, o_ptr->dd, o_ptr->ds), 5, j);

	prt(format("pval = %-5d  toac = %-5d  tohit = %-4d  todam = %-4d",
	           o_ptr->pval, o_ptr->to_a, o_ptr->to_h, o_ptr->to_d), 6, j);

	prt(format("activate = %-4d  cost = %ld",
	           o_ptr->activate, (long)object_value_real(o_ptr)), 7, j);

	prt(format("ident = %04x  timeout = %-d",
	           o_ptr->ident, o_ptr->timeout), 8, j);

	prt("+------------FLAGS1------------+", 10, j);
	prt("AFFECT........SLAY........BRAND.", 11, j);
	prt("              cvae      xsqpaefc", 12, j);
	prt("siwdcc  ssidsahanvudotgddhuoclio", 13, j);
	prt("tnieoh  trnipttmiinmrrnrrraiierl", 14, j);
	prt("rtsxna..lcfgdkcpmldncltggpksdced", 15, j);
	prt_binary(f1, 16, j);

	prt("+------------FLAGS2------------+", 17, j);
	prt("SUST...IMMUN..RESIST............", 18, j);
	prt("        aefctrpsaefcpfldbc sn   ", 19, j);
	prt("siwdcc  clioheatcliooeialoshtncd", 20, j);
	prt("tnieoh  ierlrfraierliatrnnnrhehi", 21, j);
	prt("rtsxna..dcedwlatdcedsrekdfddrxss", 22, j);
	prt_binary(f2, 23, j);

	prt("+------------FLAGS3------------+", 10, j+32);
	prt("fe      ehsi  st    iiiiadta  hp", 11, j+32);
	prt("il   n taihnf ee    ggggcregb vr", 12, j+32);
	prt("re  no ysdose eld   nnnntalrl ym", 13, j+32);
	prt("ec  om cyewta ieirmsrrrriieaeccc", 14, j+32);
	prt("aa  ta uktmatlnpgeihaefcvnpvsuuu", 15, j+32);
	prt("uu  eg rnyoahivaeggoclioaeoasrrr", 16, j+32);
	prt("rr  li sopdretitsehtierltxrtesss", 17, j+32);
	prt("aa  ec ewestreshtntsdcedeptedeee", 18, j+32);
	prt_binary(f3, 19, j+32);
}
Ejemplo n.º 4
0
/*
 * Display an item's properties
 */
static void wiz_display_item(const object_type *o_ptr)
{
	int j = 0;

	u32b f1, f2, f3;

	char buf[256];


	/* Extract the flags */
	object_flags(o_ptr, &f1, &f2, &f3);

	/* Clear screen */
	Term_clear();

	/* Describe fully */
	object_desc_store(buf, o_ptr, TRUE, 3);
	prt(buf, 2, j);

	prt(format("kind = %-5d  level = %-4d  tval = %-5d  sval = %-5d",
	           o_ptr->k_idx, k_info[o_ptr->k_idx].level,
	           o_ptr->tval, o_ptr->sval), 4, j);

	prt(format("number = %-3d  wgt = %-6d  ac = %-5d    damage = %dd%d",
	           o_ptr->number, o_ptr->weight,
	           o_ptr->ac, o_ptr->dd, o_ptr->ds), 5, j);

	prt(format("pval = %-5d  toac = %-5d  tohit = %-4d  todam = %-4d",
	           o_ptr->pval, o_ptr->to_a, o_ptr->to_h, o_ptr->to_d), 6, j);

	prt(format("name1 = %-4d  name2 = %-4d  cost = %ld",
	           o_ptr->name1, o_ptr->name2, (long)object_value(o_ptr)), 7, j);

	prt(format("ident = %04x  timeout = %-d",
	           o_ptr->ident, o_ptr->timeout), 8, j);

	prt("+------------FLAGS1------------+", 10, j);
	prt("AFFECT..........SLAY.......BRAND", 11, j);
	prt("                ae      x  paefc", 12, j);
	prt("siwdcc  ssidsasmnvudotgdd  oclio", 13, j);
	prt("tnieoh  trnipthgiinmrrnrr  iierl", 14, j);
	prt("rtsxna..lcfgdkttmldncltgg..sdced", 15, j);
	prt_binary(f1, 16, j);

	prt("+------------FLAGS2------------+", 17, j);
	prt("SUST........IMM.RESIST.........", 18, j);
	prt("            afecaefcpfldbc s n  ", 19, j);
	prt("siwdcc      cilocliooeialoshnecd", 20, j);
	prt("tnieoh      irelierliatrnnnrethi", 21, j);
	prt("rtsxna......decddcedsrekdfddxhss", 22, j);
	prt_binary(f2, 23, j);

	prt("+------------FLAGS3------------+", 10, j+32);
	prt("s   ts h     tadiiii   aiehs  hp", 11, j+32);
	prt("lf  eefo     egrgggg  bcnaih  vr", 12, j+32);
	prt("we  lerl    ilgannnn  ltssdo  ym", 13, j+32);
	prt("da reied    merirrrr  eityew ccc", 14, j+32);
	prt("itlepnel    ppanaefc  svaktm uuu", 15, j+32);
	prt("ghigavai    aoveclio  saanyo rrr", 16, j+32);
	prt("seteticf    craxierl  etropd sss", 17, j+32);
	prt("trenhste    tttpdced  detwes eee", 18, j+32);
	prt_binary(f3, 19, j+32);
}
Ejemplo n.º 5
0
/*
 * Create a spoiler file for artifacts
 */
static void spoil_artifact(cptr fname)
{
	int i, j;

	object_type *i_ptr;
	object_type object_type_body;

	char buf[1024];

	/* We use either ascii or system-specific encoding */
	int encoding = (xchars_to_file) ? SYSTEM_SPECIFIC : ASCII;

	/* Build the filename */
	(void)path_build(buf, sizeof(buf), ANGBAND_DIR_INFO, fname);

	/* File type is "TEXT" */
	FILE_TYPE(FILE_TYPE_TEXT);

	/* Open the file */
	fff = my_fopen(buf, "w");

	/* Oops */
	if (!fff)
	{
		msg_print("Cannot create spoiler file.");
		return;
	}

	/* Dump to the spoiler file */
	text_out_hook = text_out_to_file;
	text_out_file = fff;

	/* Dump the header */
	print_header("Artifact");

	/* List the artifacts by tval */
	for (i = 0; group_artifact[i].tval; i++)
	{
		/* Write out the group title */
		if (group_artifact[i].name)
		{
			spoiler_blanklines(2);
			spoiler_underline(group_artifact[i].name);
			spoiler_blanklines(1);
		}

		/* Now search through all of the artifacts */
		for (j = 0; j < z_info->a_max; ++j)
		{
			artifact_type *a_ptr = &a_info[j];

			/* We only want objects in the current group */
			if (a_ptr->tval != group_artifact[i].tval) continue;

			/* Get local object */
			i_ptr = &object_type_body;

			/* Attempt to create the artifact */
			if (!make_fake_artifact(i_ptr, j)) continue;

			/* Get this artifact */
			a_ptr = &a_info[i_ptr->artifact_index];

			/* Write a description of the artifact */
			object_desc_store(buf, sizeof(buf), i_ptr, TRUE, 1);
			x_fprintf(fff, encoding, buf);
			fprintf(fff, "\n");

			/* Write pval, flag, and activation information */
			dump_obj_attrib(fff, i_ptr, 2);

			/* Write level, rarity, and weight */
			if (use_metric) fprintf(fff, "     Level %u, Rarity %u, %d.%d kgs, "
				"%ld Gold", a_ptr->level, a_ptr->rarity,
				make_metric(a_ptr->weight) / 10, make_metric(a_ptr->weight) % 10,
				a_ptr->cost);

			else fprintf(fff, "     Level %u, Rarity %u, %d.%d lbs, "
				"%ld Gold", a_ptr->level, a_ptr->rarity,
				a_ptr->weight / 10, a_ptr->weight % 10, (long)a_ptr->cost);

			/* Insert a spacer line */
			fprintf(fff, "\n\n");
		}
	}

	/* Check for errors */
	if (ferror(fff) || my_fclose(fff))
	{
		msg_print("Cannot close spoiler file.");
		return;
	}

	/* Message */
	msg_print("Successfully created a spoiler file.");
}
Ejemplo n.º 6
0
/*
 * Describe the kind
 */
static void kind_info(char *buf, char *dam, char *wgt, int *lev, s32b *val, int k)
{
	object_kind *k_ptr;

	object_type *i_ptr;
	object_type object_type_body;


	/* Get local object */
	i_ptr = &object_type_body;

	/* Prepare a fake item */
	object_prep(i_ptr, k);

	/* Obtain the "kind" info */
	k_ptr = &k_info[i_ptr->k_idx];

	/* It is known */
	i_ptr->ident |= (IDENT_KNOWN);

	/* Cancel bonuses */
	i_ptr->pval = 0;
	i_ptr->to_a = 0;
	i_ptr->to_h = 0;
	i_ptr->to_d = 0;


	/* Level */
	(*lev) = k_ptr->level;

	/* Value - use only base value with no modifications */
	(*val) = k_ptr->cost;


	/* Hack */
	if (!buf || !dam || !wgt) return;


	/* Description (too brief) */
	object_desc_store(buf, sizeof(buf), i_ptr, FALSE, 0);


	/* Misc info */
	strcpy(dam, "");

	/* Damage */
	switch (i_ptr->tval)
	{
		/* Bows */
		case TV_SLING:
		case TV_BOW:
		case TV_CROSSBOW:
		{
			break;
		}

		/* Ammo */
		case TV_SHOT:
		case TV_BOLT:
		case TV_ARROW:
		{
			(void)strnfmt(dam, 32, "%dd%d", i_ptr->dd, i_ptr->ds);
			break;
		}

		/* Weapons */
		case TV_HAFTED:
		case TV_POLEARM:
		case TV_SWORD:
		case TV_DIGGING:
		{
			(void)strnfmt(dam, 32, "%dd%d", i_ptr->dd, i_ptr->ds);
			break;
		}

		/* Armor */
		case TV_BOOTS:
		case TV_GLOVES:
		case TV_CLOAK:
		case TV_CROWN:
		case TV_HELM:
		case TV_SHIELD:
		case TV_SOFT_ARMOR:
		case TV_HARD_ARMOR:
		case TV_DRAG_ARMOR:
		{
			(void)strnfmt(dam, 32, "%d", i_ptr->ac);
			break;
		}
	}


	/* Weight */
	if (use_metric)
	{
		(void)strnfmt(wgt, 32, "%3d.%d", make_metric(i_ptr->weight) / 10,
			make_metric(i_ptr->weight) % 10);
	}
	else
	{
		(void)strnfmt(wgt, 32, "%3d.%d", i_ptr->weight / 10, i_ptr->weight % 10);
	}

}