71 lines
1.6 KiB
Plaintext
71 lines
1.6 KiB
Plaintext
#include "rd_misc"
|
|
#include "rd_treasure"
|
|
|
|
void main()
|
|
{
|
|
location lLoc;
|
|
object oPC;
|
|
int iRandom;
|
|
int iCount;
|
|
|
|
oPC = GetEnteringObject();
|
|
|
|
SitInChairs("ipo");
|
|
|
|
if (GetLocalInt(OBJECT_SELF,"DoOnce") == 0)
|
|
{
|
|
SetLocalInt(OBJECT_SELF,"DoOnce",1);
|
|
if (Random(100)<25)
|
|
{
|
|
SetLocalInt(OBJECT_SELF,"CustomMerchant",1);
|
|
lLoc = GetLocation(GetObjectByTag("en4_cm3"));
|
|
CreateObject(OBJECT_TYPE_CREATURE,"mer_cm3",lLoc);
|
|
}
|
|
}
|
|
|
|
if (GetIsPC(oPC))
|
|
{
|
|
if (GetLocalInt(oPC,"IP1") == 0)
|
|
{
|
|
SetLocalInt(oPC,"IP1",1);
|
|
if (GetLocalInt(OBJECT_SELF,"CustomMerchant") == 1)
|
|
{
|
|
object oStore = GetObjectByTag("en4_cm3_mer");
|
|
iRandom=Random(4)+1;
|
|
iCount = 0;
|
|
while (iCount <= iRandom)
|
|
{
|
|
GetMagicItem(oStore,TRUE,TRUE,5);
|
|
iCount++;
|
|
}
|
|
iRandom=Random(4)+1;
|
|
iCount = 0;
|
|
while (iCount <= iRandom)
|
|
{
|
|
GetMagicItem(oStore,TRUE,TRUE);
|
|
iCount++;
|
|
}
|
|
iRandom=Random(3)+1;
|
|
iCount = 0;
|
|
while (iCount <= iRandom)
|
|
{
|
|
CreateRandomItem(oStore);
|
|
iCount++;
|
|
}
|
|
iRandom=Random(2)+1;
|
|
iCount = 0;
|
|
while (iCount <= iRandom)
|
|
{
|
|
GetMiscMagic(oStore);
|
|
iCount++;
|
|
}
|
|
iRandom=Random(2);
|
|
if (iRandom == 1)
|
|
GetRareItem(oStore);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|