It's not something you just copy and paste. It's dependant on a large number of things. You would need context of:
The Base Damage Table
The Ability, Damage Mod, and Damage Range Attribute for every skill in the game in a table you can reference from code
The Height delta between the caster and it's target
and then you need simpler data like str, fin, int, pyro, etc. For weapon skills you also need the weapon skill associated with what they are using in their main hand. Also crit, certain talents.
Now, assuming you have all of this, the moment someone installs a mod that changes how the game scales, everything you have breaks because if the game scales differently, the base damage table is different.
There is also no way to intercept damage before it's applied so you can't go that approach either.
You also have the problem of applying the damage. When you apply damage, it has to belong to a specific element, so you either run the risk of double dipping resists, or bypassing armor via piercing.
tl;dr: Even with the hackiest of hacks, this isn't something you should try to do because it is not possible to do in any manner that will work as expected.