#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "tables.h"
#include "rig_tables.h"
#include "rig.h"
/*
* gen_scroll_wiz()
*
* Generates a scroll for wizard spells
*/
OBJ_DATA * create_wizscroll (OBJ_DATA* obj, int type)
{
char name_set[MSL];
char shor_set[MSL];
char long_set[MSL];
char buf[MSL];
int spell_num = 0;
int spell_name = -1;
int total_obj_value = 0;
/* Gen random scroll */
if (type == RIG_RANDOM)
{
spell_name = number_range(0, rig_wizscroll_max() - 1);
}
else
spell_name = type;
if (spell_name == -1)
spell_name = 0;
free_string(obj->name);
free_string(obj->short_descr);
free_string(obj->description);
sprintf(buf, "%s", rig_wizscroll_table[spell_name].name);
spell_num = skill_lookup (buf);
sprintf(name_set, "%s scroll", rig_wizscroll_table[spell_name].name);
sprintf(shor_set, "a scroll of '%s'", rig_wizscroll_table[spell_name].name);
sprintf(long_set, "a scroll of '%s' is on the ground here.", rig_wizscroll_table[spell_name].name);
obj->name = str_dup (name_set);
obj->short_descr = str_dup (shor_set);
obj->description = str_dup (long_set);
obj->item_type = ITEM_WIZ_SCROLL;
obj->value[0] = number_range(1, 105);
obj->value[1] = spell_num;
obj->value[2] = -1;
obj->value[3] = -1;
obj->value[4] = -1;
obj->wear_flags = ITEM_TAKE;
obj->wear_flags += ITEM_HOLD;
total_obj_value = rig_wizscroll_table[spell_name].cost;
obj->cost = (total_obj_value * number_range(10, 19));
return (obj);
}
/*
* gen_scroll_wiz()
*
* Generates a scroll for wizard spells
*/
OBJ_DATA * create_priscroll (OBJ_DATA* obj, int type)
{
char name_set[MSL];
char shor_set[MSL];
char long_set[MSL];
char buf[MSL];
int spell_num = 0;
int spell_name = -1;
int total_obj_value = 0;
/* Gen random scroll */
if (type == RIG_RANDOM)
spell_name = number_range(0, 20);
else
spell_name = type;
if (spell_name == -1)
spell_name = 0;
free_string(obj->name);
free_string(obj->short_descr);
free_string(obj->description);
sprintf(buf, "%s", rig_priscroll_table[spell_name].name);
spell_num = skill_lookup (buf);
sprintf(name_set, "%s tome", rig_priscroll_table[spell_name].name);
sprintf(shor_set, "a tome of '%s'", rig_priscroll_table[spell_name].name);
sprintf(long_set, "a tome of '%s' is on the ground here.", rig_priscroll_table[spell_name].name);
obj->name = str_dup (name_set);
obj->short_descr = str_dup (shor_set);
obj->description = str_dup (long_set);
obj->item_type = ITEM_PRI_SCROLL;
obj->value[0] = number_range(1, 105);
obj->value[1] = spell_num;
obj->value[2] = -1;
obj->value[3] = -1;
obj->value[4] = -1;
obj->wear_flags = ITEM_TAKE;
obj->wear_flags += ITEM_HOLD;
total_obj_value = rig_priscroll_table[spell_name].cost;
obj->cost = (total_obj_value * number_range(15, 24));
return (obj);
}
/*
* gen_scroll_wiz()
*
* Generates a scroll for wizard spells
*/
OBJ_DATA * create_fgtscroll (OBJ_DATA* obj, int type)
{
char name_set[MSL];
char shor_set[MSL];
char long_set[MSL];
char buf[MSL];
int spell_num = 0;
int spell_name = -1;
int total_obj_value = 0;
/* Gen random scroll */
if (type == RIG_RANDOM)
{
spell_name = number_range(0, rig_fighter_tome_max() - 1);
}
else
spell_name = type;
if (spell_name == -1)
spell_name = 0;
free_string(obj->name);
free_string(obj->short_descr);
free_string(obj->description);
sprintf(buf, "%s", rig_fighter_tome_table[spell_name].name);
spell_num = skill_lookup (buf);
sprintf(name_set, "%s manual", rig_fighter_tome_table[spell_name].name);
sprintf(shor_set, "a manual of '%s'", rig_fighter_tome_table[spell_name].name);
sprintf(long_set, "a manual of '%s' is on the ground here.", rig_fighter_tome_table[spell_name].name);
obj->name = str_dup (name_set);
obj->short_descr = str_dup (shor_set);
obj->description = str_dup (long_set);
obj->item_type = ITEM_FGT_SCROLL;
obj->value[0] = number_range(1, 105);
obj->value[1] = spell_num;
obj->value[2] = -1;
obj->value[3] = -1;
obj->value[4] = -1;
obj->wear_flags = ITEM_TAKE;
obj->wear_flags += ITEM_HOLD;
total_obj_value = rig_fighter_tome_table[spell_name].cost;
obj->cost = (total_obj_value * number_range(10, 19));
return (obj);
}
/*
* gen_scroll_wiz()
*
* Generates a scroll for wizard spells
*/
OBJ_DATA * create_thiscroll (OBJ_DATA* obj, int type)
{
char name_set[MSL];
char shor_set[MSL];
char long_set[MSL];
char buf[MSL];
int spell_num = 0;
int spell_name = -1;
int total_obj_value = 0;
/* Gen random scroll */
if (type == RIG_RANDOM)
{
spell_name = number_range(0, rig_thief_tome_max() - 1);
}
else
spell_name = type;
if (spell_name == -1)
spell_name = 0;
free_string(obj->name);
free_string(obj->short_descr);
free_string(obj->description);
sprintf(buf, "%s", rig_thief_tome_table[spell_name].name);
spell_num = skill_lookup (buf);
sprintf(name_set, "%s script", rig_thief_tome_table[spell_name].name);
sprintf(shor_set, "a script of '%s'", rig_thief_tome_table[spell_name].name);
sprintf(long_set, "a script of '%s' is on the ground here.", rig_thief_tome_table[spell_name].name);
obj->name = str_dup (name_set);
obj->short_descr = str_dup (shor_set);
obj->description = str_dup (long_set);
obj->item_type = ITEM_THI_SCROLL;
obj->value[0] = number_range(1, 105);
obj->value[1] = spell_num;
obj->value[2] = -1;
obj->value[3] = -1;
obj->value[4] = -1;
obj->wear_flags = ITEM_TAKE;
obj->wear_flags += ITEM_HOLD;
total_obj_value = rig_thief_tome_table[spell_name].cost;
obj->cost = (total_obj_value * number_range(10, 19));
return (obj);
}
/*
* create_potion()
*
* Generates a 'spell' potion, ie non-healing
*/
OBJ_DATA * create_potion (OBJ_DATA* obj, int type)
{
char name_set[MSL];
char shor_set[MSL];
char long_set[MSL];
char buf[MSL];
int spell_num = 0;
int spell_name = -1;
int total_obj_value = 0;
/* Gen random scroll */
if (type == RIG_RANDOM)
spell_name = number_range(0, rig_potion_max() - 1);
else
spell_name = type;
if (spell_name == -1)
spell_name = 0;
free_string(obj->name);
free_string(obj->short_descr);
free_string(obj->description);
sprintf(buf, "%s", rig_potion_table[spell_name].name);
spell_num = skill_lookup (buf);
sprintf(name_set, "%s potion", rig_potion_table[spell_name].name);
sprintf(shor_set, "a potion of '%s'", rig_potion_table[spell_name].name);
sprintf(long_set, "a potion of '%s' is on the ground here.", rig_potion_table[spell_name].name);
obj->name = str_dup (name_set);
obj->short_descr = str_dup (shor_set);
obj->description = str_dup (long_set);
obj->item_type = ITEM_POTION;
obj->value[0] = number_range(20, 25);
obj->value[1] = spell_num;
obj->value[2] = -1;
obj->value[3] = -1;
obj->value[4] = -1;
obj->wear_flags = ITEM_TAKE;
obj->wear_flags += ITEM_HOLD;
total_obj_value = rig_potion_table[spell_name].cost;
obj->cost = (total_obj_value * number_range(15, 24));
return (obj);
}
/*
* create_potion_heal()
*
* Generates a 'spell' potion_heal, ie non-healing
*/
OBJ_DATA * create_potion_heal (OBJ_DATA* obj, int type)
{
char name_set[MSL];
char shor_set[MSL];
char long_set[MSL];
char buf[MSL];
int spell_num = 0;
int spell_name = -1;
int total_obj_value = 0;
/* Gen random scroll */
if (type == RIG_RANDOM)
spell_name = number_range(0, rig_potion_heal_max() - 1);
else
spell_name = type;
if (spell_name == -1)
spell_name = 0;
free_string(obj->name);
free_string(obj->short_descr);
free_string(obj->description);
sprintf(buf, "%s", rig_potion_heal_table[spell_name].name);
spell_num = skill_lookup (buf);
sprintf(name_set, "%s potion", rig_potion_heal_table[spell_name].name);
sprintf(shor_set, "a potion of '%s'", rig_potion_heal_table[spell_name].name);
sprintf(long_set, "a potion of '%s' is on the ground here.", rig_potion_heal_table[spell_name].name);
obj->name = str_dup (name_set);
obj->short_descr = str_dup (shor_set);
obj->description = str_dup (long_set);
obj->item_type = ITEM_POTION;
obj->value[0] = number_range(20, 25);
obj->value[1] = spell_num;
obj->value[2] = -1;
obj->value[3] = -1;
obj->value[4] = -1;
obj->wear_flags = ITEM_TAKE;
obj->wear_flags += ITEM_HOLD;
total_obj_value = rig_potion_heal_table[spell_name].cost;
obj->cost = (total_obj_value * number_range(15, 24));
return (obj);
}