Really depends on your source, in my it's calculated within the packethandler for combat when hitting and in the actual monster file when killing.
I do something like this:
Code:
ulong exp = (ulong)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next((int)(damage / 2), (int)damage);
if (attacked.Level > (attacker.Level + 10))
exp *= 2;
else if (attacker.Level > (attacked.Level + 10))
exp = (ulong)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(1, (int)attackedmob.Level);
attackerclient.AddExp(exp);
And this when killing:
Code:
if (damage < 3)
damage = 3;
if (killer.Level > Level)
damage = 3;
if (Level > (killer.Level - 10))
(killer as GameClient).AddExp((ulong)(((damage * 2) / 3) + ExtraExperience));
Note: These are my calculations, not following the actual TQ calculations.