http://villavu.com/forum/showthread.php?t=46481Simple, yet effective.
XpGained is either you count what you do, you mined one copper ore, you add the xp amount to a sum variable or you look at the xp at the beginning, store that, than you extract that from the current xp amount.