The basic idea of this is to make remove a lot of the hardcoding from the server:

Add template objects - objects that don't appear by themselves, but instead modify the object they are applied to.

That is to say, you make up objects of type 'template'. The values and what not would work similar to how the artifacts file.

However, instead of hard coded chances of artifacts in the treasures.c, instead use these templates in treasurelists.

Thus, you could have a treasurelist like:

treasureone template_helms
   arch template_xebinon
     chance ..
   more
   arch template_blindness
      chance ..
   more
...

Then the helms themselves would have a 'randomitems template_helms'

The advantages of this:

randomitems helm
  list helm_special_abilities
     chance 5    # 5% of helms are special
  more
  list armor_material_change
     chance 25    # 25% of helms are not made of the normal material
  more
  arch cursed
     chance 3    # 3% of helms are cursed
   end
end

The biggest disadvantage of this is a bunch of new treasurelists would be needed. I have thought that the treasure list code could be extended also.

However, my thought on that are a bit more modest:

min_nrof 10
max_nrof 20

To say to generate 10-20 of those objects.

Likewise, min_magic could be used to say 'make this object at least min_magic'. Thus, treasurelists could be used to make the magic bonus of the weapons and whatnot.

    randomitem helm
        ...
        arch damned
            min_diff 30
            chance 5
            diff_factor 2

So at level 37, chance is not 19 (37 - 30) * 2 + 5 = 19%

The treasurelist stuff would actually be relatively easy to do - at least point #1 would not cause nay problems with existing treasure lists (just new fields really).

It may be desirable to disallow combinations, but not sure if extra logic should be added to the treasurelists for that - I'd almost be inclined to have multiple treasurelists - the treasure code really dictates what is generated, not what is not generated.