rig_shop.c
rig_shop.c · 5.5 KB
From the archive random_item_generator.zip
Download the archive « Back to the archive contents
#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"
/*
* rig_makeshop()
*
* Creates shop items for the shops...
*/
void rig_makeshop(CHAR_DATA * ch)
{
OBJ_DATA * obj;
int i = 0;
int x, maxx;
/* Make sure they have a shop */
if (ch->pIndexData->pShop != NULL)
{
/* Weapons first */
for (i = 0; i != 5; i++)
{
if (ch->pIndexData->pShop->buy_type[i] == ITEM_WEAPON)
{
maxx = number_range(5, 12);
for (x = 0; x <= maxx; x++)
{
obj = create_object (get_obj_index (30), 0);
obj = create_weapon(obj, RIG_RANDOM, RIG_RANDOM, 1, TRUE);
obj_to_char(obj, ch);
SET_BIT(obj->extra_flags, ITEM_INVENTORY);
}
break;
}
}
/* Armor Second */
for (i = 0; i != 5; i++)
{
if (ch->pIndexData->pShop->buy_type[i] == ITEM_ARMOR)
{
maxx = number_range(4, 7);
for (x = 0; x <= maxx; x++)
{
obj = create_object (get_obj_index (30), 0);
obj = create_armor(obj, RIG_RANDOM, RIG_RANDOM, 1, TRUE);
obj_to_char(obj, ch);
SET_BIT(obj->extra_flags, ITEM_INVENTORY);
}
break;
}
}
/* Scrolls.. */
for (i = 0; i != 5; i++)
{
if (ch->pIndexData->pShop->buy_type[i] == ITEM_SCROLL)
{
maxx = number_range(7, 13);
for (x = 0; x <= maxx; x++)
{
obj = create_object (get_obj_index (30), 0);
obj = create_wizscroll(obj, RIG_RANDOM);
SET_BIT(obj->extra_flags, ITEM_INVENTORY);
obj_to_char(obj, ch);
}
break;
}
}
for (i = 0; i != 5; i++)
{
if (ch->pIndexData->pShop->buy_type[i] == ITEM_SCROLL)
{
maxx = number_range(7, 13);
for (x = 0; x <= maxx; x++)
{
obj = create_object (get_obj_index (30), 0);
obj = create_priscroll(obj, RIG_RANDOM);
SET_BIT(obj->extra_flags, ITEM_INVENTORY);
obj_to_char(obj, ch);
}
break;
}
}
for (i = 0; i != 5; i++)
{
if (ch->pIndexData->pShop->buy_type[i] == ITEM_SCROLL)
{
maxx = number_range(7, 13);
for (x = 0; x <= maxx; x++)
{
obj = create_object (get_obj_index (30), 0);
obj = create_fgtscroll(obj, RIG_RANDOM);
SET_BIT(obj->extra_flags, ITEM_INVENTORY);
obj_to_char(obj, ch);
}
break;
}
}
for (i = 0; i != 5; i++)
{
if (ch->pIndexData->pShop->buy_type[i] == ITEM_SCROLL)
{
maxx = number_range(7, 13);
for (x = 0; x <= maxx; x++)
{
obj = create_object (get_obj_index (30), 0);
obj = create_thiscroll(obj, RIG_RANDOM);
SET_BIT(obj->extra_flags, ITEM_INVENTORY);
obj_to_char(obj, ch);
}
break;
}
}
/* Potions!111!!! OMGZOORSS!!!! */
for (i = 0; i != 5; i++)
{
if (ch->pIndexData->pShop->buy_type[i] == ITEM_POTION)
{
maxx = number_range(5, 10);
for (x = 0; x <= maxx; x++)
{
obj = create_object (get_obj_index (30), 0);
obj = create_potion(obj, RIG_RANDOM);
SET_BIT(obj->extra_flags, ITEM_INVENTORY);
obj_to_char(obj, ch);
}
maxx = (rig_potion_heal_max() - 1);
for (x = 0; x <= maxx; x++)
{
obj = create_object (get_obj_index (30), 0);
obj = create_potion_heal(obj, x);
SET_BIT(obj->extra_flags, ITEM_INVENTORY);
obj_to_char(obj, ch);
}
break;
}
}
/* BEER!!!!! */
for (i = 0; i != 5; i++)
{
if (ch->pIndexData->pShop->buy_type[i] == ITEM_DRINK_CON)
{
maxx = number_range(10, 12);
for (x = 0; x <= maxx; x++)
{
obj = create_object (get_obj_index (30), 0);
obj = create_beer(obj, RIG_RANDOM);
obj_to_char(obj, ch);
SET_BIT(obj->extra_flags, ITEM_INVENTORY);
}
obj = create_object (get_obj_index (30), 0);
obj = create_beer(obj, rig_beer_lookup("Jack Daniels"));
obj_to_char(obj, ch);
SET_BIT(obj->extra_flags, ITEM_INVENTORY);
break;
}
}
}
return;
}