Guys please look at the following code and tell me whats wrong with it
1) making Enchanting possible near a choosen NPC - [glow=red,2,300]works[/glow]
2) making Enchanting near any other NPC not possible - [glow=red,2,300]works[/glow]
3) making enchanting in an empty area not possible - [glow=red,2,300]doesnt work![/glow]
code:
Collection<L2Character> knownNPC = activeChar.getKnownList().getKnownCharactersInRadius(80);
if(knownNPC == null)
{
activeChar.setActiveEnchantItem(null);
activeChar.sendMessage("You can only enchant items near the Brazier of Luck!");
return;
}
else
{
for(L2Character obj : knownNPC)
{
if(!(obj instanceof L2NpcInstance))
{
activeChar.setActiveEnchantItem(null);
activeChar.sendMessage("You can only enchant items near the Brazier of Luck!");
return;
}
else if(((L2NpcInstance) obj).getNpcId() != 32027)
{
activeChar.setActiveEnchantItem(null);
activeChar.sendMessage("You can only enchant items near the Brazier of Luck!");
return;
}
}
}