well, a popular method is to use an array, to store the types of npcs that will range or mage then if they are false the others will melee, example
Code:
public int[] magingNpcs = {1,2,3,4,5};
they would make a boolean turning true / false if the npc matches / doesn't match the array so then in the n.appendAttack()
they could easily use their boolean to dictate what the npc is going to do. it is done in many servers this way, not saying its the best way as it will not handle all magic npc's as some are multi attacking in which case you would have to use an external type of setting it to mage. example i gave would practically be for zamorak mages or npc's that mage ONLY, though i suppose you could do it backwards if you really are stuck add my msn