// Woodmans
// put any item >100 gold piece value in appropriate chest
// put any item >500 gold piece value in rich chest
void main()
{
    object oChestN=GetObjectByTag("woodmans_night");
    object oChestD=GetObjectByTag("woodmans_day");
    object oChestR=GetObjectByTag("woodmans_rich");
    object oChest=oChestD;
    object oItem;
    object oNew;
    int nC=0;
    object oStore=GetObjectByTag("woodmans",nC);
    while(GetObjectType(oStore)!=OBJECT_TYPE_STORE)
    {
      nC++;
      oStore=GetObjectByTag("woodmans",nC);
    }
    if (GetIsNight()==TRUE) oChest=oChestN;
    oItem=GetFirstItemInInventory(oStore);
    while(oItem!=OBJECT_INVALID)
    { // !OI
      if (GetGoldPieceValue(oItem)>100)
      { // store
        if (GetGoldPieceValue(oItem)>999)
        { // store in rich chest
          oNew=CreateItemOnObject(GetResRef(oItem),oChestR,GetItemStackSize(oItem));
          // Set stolen flag
        } // store in rich chest
        else
        { // store in regular chest
         if (d4()<3)
         {
           oNew=CreateItemOnObject(GetResRef(oItem),oChest,GetItemStackSize(oItem));
           // Set stolen flag
         }
         else
         { // convert to 25% value
           nC=GetGoldPieceValue(oItem);
           nC=nC/4;
           oNew=CreateItemOnObject("nw_it_gold001",oChest,nC);
         } // convert to 25% value
        } // store in regular chest
        DelayCommand(2.0,DestroyObject(oItem));
      } // store
      oItem=GetNextItemInInventory(oStore);
    } // !OI
}