For fuck sake.
Literally gave you the formula the game uses that has qlvl and ilvl on it, what a bunch of text to say "I still know nothing".
Well your qlvl formula works for you.
Gambling defines the item and not necessarily qlvl... Light Plated boots can become War Boots or War Travelers from gambling, just as long as you are high enough level.
Killing monsters in specific ares and difficulty determines the ilvl of the item, or in the formulas sense, it has a quality level.
How does one know when using Larzuks Socket quest to get 4 sockets only on a Crystal Sword, ensuring that it is not 3, 5 or 6 ... how does your formula tell you the difficulty and best area to where that item can be found? Act 1 Nightmare?, Act 5? It is definitely not Norm Cows, max is 3 sockets. Off hand I forgot, but a rough estimate is like Act2 NM Tombs and A3... been a while.
I don't use formulas, I play the game... well Calculators I use.
I say, you're both wrong.
Go ahead and prove me wrong. I'll pay you to.