void main()
{
    object oAlt1 = GetObjectByTag("ALTAR_SEA");
    object oAlt2 = GetObjectByTag("ALTAR_EARTH");
    object oAlt3 = GetObjectByTag("ALTAR_HEAVEN");
    object oAlt4 = GetObjectByTag("ALTAR_DAY");
    object oAlt5 = GetObjectByTag("ALTAR_NIGHT");

    object oChest = GetObjectByTag("CHEST_SEASONS");

    object oItem1 = GetItemPossessedBy(oChest,"GEM_F_PEARL");
    object oItem2 = GetItemPossessedBy(oChest,"GEM_F_EMERALD");
    object oItem3 = GetItemPossessedBy(oChest,"GEM_F_SKYD");
    object oItem4 = GetItemPossessedBy(oChest,"GEM_F_FAG");
    object oItem5 = GetItemPossessedBy(oChest,"GEM_F_MB");

    SetLocalInt(OBJECT_SELF, "duration", DURATION_TYPE_TEMPORARY);
    int duration = GetLocalInt(OBJECT_SELF, "duration");
    SetLocalInt(OBJECT_SELF, "vfx", VFX_IMP_RESTORATION);
    int vfx = GetLocalInt(OBJECT_SELF, "vfx");
    effect eEffect = EffectVisualEffect(vfx);

    {
        if(GetIsObjectValid(oItem1))
        {
        CreateItemOnObject("gem_water", GetObjectByTag("ALTAR_SEA"), 1);
        ApplyEffectToObject(duration, eEffect, oChest, 4.0);
        DestroyObject(oItem1);
        }
        if(GetIsObjectValid(oItem2))
        {
        CreateItemOnObject("gem_diam", GetObjectByTag("ALTAR_EARTH"), 1);
        ApplyEffectToObject(duration, eEffect, oChest, 4.0);
        DestroyObject(oItem2);

        }
        if(GetIsObjectValid(oItem3))
        {
        CreateItemOnObject("gem_star", GetObjectByTag("ALTAR_HEAVEN"), 1);
        ApplyEffectToObject(duration, eEffect, oChest, 4.0);
        DestroyObject(oItem3);

        }
        if(GetIsObjectValid(oItem4))
        {
        CreateItemOnObject("gem_sun", GetObjectByTag("ALTAR_DAY"), 1);
        ApplyEffectToObject(duration, eEffect, oChest, 4.0);
        DestroyObject(oItem4);

        }
        if(GetIsObjectValid(oItem5))
        {
        CreateItemOnObject("gem_moon", GetObjectByTag("ALTAR_NIGHT"), 1);
        ApplyEffectToObject(duration, eEffect, oChest, 4.0);
        DestroyObject(oItem5);

        }
}
}
