Hit chance

In combat, one's hit chance is the chance of successfully hitting a monster, given your accuracy, the equipment you are wearing, the defence level of your opponent and the style you are using.

$$hitchance = \frac{accuracy * equipment}{defence * weakness}$$

The accuracy function
There is a single formula that relates level to accuracy bonus for base levels, weapons and monsters. Given a as the level, the formula is: $$F(a) = 0.0008013081a^3 - 0.0002405376a^2 + 4.0082736040a + 39.9058659366$$

For simplicity this formula will be referred to as F, so for example F(99) would be 1211.9, which rounds to the true value of 1212 (the base accuracy of a player with level 99 Attack).

Your accuracy
Your accuracy is given by your base level accuracy added to your weapon's accuracy. The base accuracy is F(attacklevel) and the weapon accuracy is 2.5 * F(weaponlevel). Therefore a player with 99 Attack using Drygore weaponry would have F(99) + 2.5 * F(90) = 3670 accuracy.

Opponent defence
Your opponent has a defence bonus equal to F(defencelevel).

Weakness modifier

 * If using the class that your opponent is strong to, the weakness modifier will be 7.5
 * If using the class that your opponent is neutral to, the weakness modifier will be 5.5
 * If using the class that your opponent is weak to, the weakness modifier will be 4
 * If using the style that your opponent is extra-weak to, the weakness modifier will be some number less than 4

Equipment penalty
Wearing armour of the wrong class can negatively affect hit chance. Wearing any items in the shield, body or legs slot of the class you are strong to (if using melee, this is Ranged) will reduce your hit chance by 15%. Wearing any items in those slots of the class you are weak to will reduce your hit chance by 8%. This is intended to force players to use items of the same class while fighting.

Example
With 99 Attack, a drygore weapon and royal dragonhide body and chaps, your hit chance against a level 198 Magic creature will be:

$$\frac{(F(99) + 2.5 * F(90)) * 70%}{F(99) * 7.5} = 28.26%$$