# User:Tjr/object generation spoiler
Legwork for an Object Creation Spoiler
This treats only those cases that aren't restricted to monster inventory items or certain useless items. It's mostly interesting for pacifists, as they don't get any death drops. Specifically, I wanted to know how likely a 12-conduct character is to find holy water, a scroll of scare monster, a magic whistle and so on.
A preliminary results table is available at [1]. Numerical instabilities mean you should trust at most the three leading digits.

Contents

1 Containers
2 In a normal rooms-and-corridor level at level creation time.

2.1 Random objects on the floor in each ordinary room.
2.2 make_niches()
2.3 shops
2.4 court room
2.5 graveyard boxes
2.6 barracks containers
2.7 cockatrice nest statues
2.8 ant hole

3 Special levels etc
4 Monsters
5 Conduct-breakers
6 Random Alchemy
7 Initial inventory
8 Saving and restoring

Containers
Contents of containers are complicated, not just rn2(..) things: Mkobj.c#mkbox_cnts
Unless stated otherwise, all items can be containers, which hold more items.

In a normal rooms-and-corridor level at level creation time.
Mklev.c#makelevel
You need the distribution of rooms per level, and room sizes. Rooms per level, from counting 10 games: 5(7/222), 6(28/222), 7(68/222), 8(83/222), 9(30/222), 10(4/222), 11(2/222).

Random objects on the floor in each ordinary room.
... chance of non-special room ...
1/3 chance of a monsters, which might be a snake/spider.
(1/10 chance fountain, independently 1/60 sink for a ring, 1/60 altar ..)
1/(80-2*depth) chance of one grave, which will hold rn2(5) cursed items
1/20 chance of a statue, which has (1-10/(10 + depth/2)) chance of one spellbook, provided the statue isn't very small.
1/(nroom * 5 / 2) chance of: 1/3 chest 2/3 large box
1/3 chance of objects at all, 4/5*(1/5)^n prob for n+1 objects, n&gt;=0. Containers are eligible.
make_niches()
1d(rooms/2 +1) proto-niches.
dlev 1-5: all, dlev 6-15: 5/6, dlev 16-24 25/36, dlev 25-end 5/6 are a non-trap niche.
8 retries to find a room with&nbsp;!=1 door (20% chance anyway), non-special, and hitting a place to put the niche (unlikely to fail).
3/4*6/7*1/3 of those get another random object, but they never have a secret door.
shops
1&lt;dlev&lt;medusalevel &amp;&amp; 45.3%chance &amp;&amp;	rn2(u_depth) &lt; 3)
mkroom(SHOPBASE)
Each square has (dlevel)% chance of a mimic, else make a fitting object. Shknam.c#mkshobj_at
(45.3% due to http://groups.google.com/group/rec.games.roguelike.nethack/msg/9071578a7d8cddaf)

court room
1 chest

4&lt;dlev&lt;castle &amp;&amp; no shop &amp;&amp; 1/6 chance
graveyard boxes
11&lt;dlev&lt;castle &amp;&amp; noshop &amp;&amp; 5/6*7/8*6/7*4/5*4/5*1/6
each square has 1/10 chance of 2/3 large box, 1/3 chest
barracks containers
14&lt;dlev&lt;castle &amp;&amp; noshop &amp;&amp; 5/6*7/8*6/7*4/5*4/5*5/6*7/8*1/4
each square has 1/20 chance of 2/3 large box, 1/3 chest
cockatrice nest statues
16&lt;dlev&lt;castle &amp;&amp; noshop &amp;&amp; 5/6*7/8*6/7*4/5*4/5*5/6*7/8*3/4*5/6*1/8
each square has 1/3 chance of statue with rn2(5) items
ant hole
1/3 chance of a food item per square
Special levels etc
special levels, a bizarre case, mines levels, quest filler, post-Medusa maze, rogue level: Mklev.c#line627 ff

Special level
Random-class objects
Fixed-class objects
Random traps

Oracle
6
--
3

Big room
15
--
6

Ludios
0
1chest, gems, gold, 70barracks
0

Rogue
??
fake bones
??

Medusa, central
8
75% reflection, 25% levitation, 50% +2 scimitar, 50% sack
5

Medusa, titan
6
25% reflection, 75% levitation, 50% +2 scimitar, 50% sack, one wand
4

Castle
maze
14 armor, 14 weapon, 14 food, 14 gem, 36barracks, 1 wishing
204maze

Mines filler
3
3 random objects, 1 tool, 3 gems
6

Fontier town
0
90%*9general, 90%*9tools, 90%*4food, 100%*6light
2

Town square
0
90%*9general, 90%*9tools, 90%*9food, 100%*9light
2

Alley town
0
100%*6general, 40%*6tools, 30%*4tools, 90%*4food, 30%*4wand, 100%*6light
2

College Town
0
90%*6general, 90%*6tools, 100%*6book, 90%*4food, 100%*6light
2

Grotto Town
0
100%*9general, 100%*9tools, 100%*4food, 100%*9light, 1 ring, 1 chest, 1 tool, 1 statue
0

Bustling Town
0
100%*6general, 100%*6tools, 100%*4food, 100%*6light, 2 trees
0

Bazaar Town
0
60%*4general, 30%*6tools, 50%*4tools, 50%*4food, 50%*4food, 100%*6light
2,sink

Mimic of the Mines
3
2 tools, 7 gems + fixed caches
6

Gnome King's Wine Cellar
3
2 tools, 14 gems + fixed caches, 2 potions + 6 booze + 1 object det
6

Catacombs
3
7 gems +fixed, luck, 5 scrolls, 4 books
7

Sokoban
0
4 food, 1 ring, 1 wand; 2 earth on lowest; treasure on uppermost
0

Wizard home
0
1 chest
6

Wizard filler
9
--
4

Wizard locate
15
--
1poly

Gehennom maze

Valley of the Dead

Asmodeus

Juiblex

Baalzebub

Orcus

Fakewiz

Rodney1

Rodney2

Rodney3

Sanctum

Vlad1

Vlad2

Vlad3

The mines shops can contain mimics. Trees can yield fruit once (1/6 chance of eucalyptus) when kicked repeatedly, then again (1/5 chance) when cut down. dokick.c, line 899,dig.c, line 341.
still to track maze objects: mkmaze.c#line633
level descriptions can contain objects: Sp_lev.c#line934, Sp_lev.c#line951

Monsters
Spiders and snakes get a random object in makelevel.
Quantum mechanic boxes are always empty. makemon.c:963
Player monsters (Astral Plane only) get 1d10 objects, possibly with contents. Mplayer.c#line266.
Conduct-breakers
Death drops mon.c#line1833
Wishing. Objnam.c#readobjnam.
Polypiling Zap.c#line1225
Writing scrolls/books write.c#line161
Random Alchemy
Potion.c#line1697

Initial inventory
U_init.c#line917

Saving and restoring
including bones files