generated from Jaysyn/ModuleTemplate
54 lines
1.9 KiB
Plaintext
54 lines
1.9 KiB
Plaintext
// June 2003
|
|
// B W-Husey
|
|
// Changes store contents daily - standard weapons and armour.
|
|
// Every fifth day adds +1 weapon and armour.
|
|
// Every eighth day adds +2 weapons and armour
|
|
#include "CU_TREASURE"
|
|
#include "CU_MAGIC"
|
|
|
|
void main()
|
|
{
|
|
int nDay = GetCalendarDay(); //Store today
|
|
int nPlus1 = FALSE; //Set variables
|
|
int nPlus2 = FALSE;
|
|
|
|
// get days when additional content is to be added.
|
|
if (nDay == 2 || nDay == 7 || nDay == 12 || nDay == 17) {
|
|
nPlus1 = TRUE;}
|
|
if (nDay == 22 || nDay == 27) {
|
|
nPlus1 = TRUE;}
|
|
if (nDay == 8 || nDay == 16 || nDay == 24) {
|
|
nPlus2 = TRUE;}
|
|
|
|
// If not done this routine today, do it now
|
|
if (!GetLocalInt(OBJECT_SELF,"StoreDay") == nDay)
|
|
{
|
|
object oNumber =GetFirstItemInInventory(OBJECT_SELF);
|
|
int nNumber = 1;
|
|
while (GetIsObjectValid(oNumber) == TRUE) //Count the items in store
|
|
{
|
|
oNumber =GetNextItemInInventory(OBJECT_SELF);
|
|
nNumber += 1;
|
|
}
|
|
object oItem;
|
|
int nDestroy = Random(nNumber)+1; //destroy a random numbered item
|
|
int nCounter = 0;
|
|
while (nCounter<nDestroy) // find the item
|
|
{
|
|
oItem =GetNextItemInInventory(OBJECT_SELF);
|
|
nCounter += 1;
|
|
}
|
|
DestroyObject(oItem); // destroy it
|
|
if (nNumber<50){
|
|
GetTreasure("Weapon", OBJECT_SELF,100,0,0);} //add a weapon
|
|
GetTreasure("Armour", OBJECT_SELF,33,0,0); //add armour (1 in 3 chance)
|
|
if (nPlus1 == TRUE) GetMagic("Weapon1", OBJECT_SELF,100,0); //When correct day add magic stuff.
|
|
if (nPlus1 == TRUE) GetMagic("Armour1", OBJECT_SELF,90,0);
|
|
if (nPlus2 == TRUE) GetMagic("Weapon2", OBJECT_SELF,100,0);
|
|
if (nPlus2 == TRUE) GetMagic("Armour2", OBJECT_SELF,80,0);
|
|
// if (nPlus1 == TRUE) GetMagic("Magic2",OBJECT_SELF,70,0); //custom magic
|
|
// if (nPlus2 == TRUE) GetMagic("Magic2",OBJECT_SELF,100,10);
|
|
}
|
|
SetLocalInt( OBJECT_SELF,"StoreDay",nDay);
|
|
}
|