Took some time but i've got this!
Now to check and see if it's the same for all weapons at all levels.

ValueInMemory - WeaponDamage = x;
ValueInMemory - x = WeaponDamage;
WeaponDamage + x = ValueInMemory;

Adding Upgrades:

NewX = UpgradeTimes(11) + x;
NewVIM = UpgradeTimes(280) + ValueInMemory;
NewWD = NewVIM - NewX;