Example #1
0
 @Override
 public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) {
   if (npc.isMonster()) {
     final L2MonsterInstance monster = (L2MonsterInstance) npc;
     if (!monster.isTeleporting()) {
       if (getRandom(1, 100) <= npc.getTemplate().getParameters().getInt("SummonPrivateRate", 0)) {
         for (MinionHolder is : npc.getTemplate().getParameters().getMinionList("Privates")) {
           addMinion((L2MonsterInstance) npc, is.getId());
         }
         broadcastNpcSay(
             npc, ChatType.NPC_GENERAL, ON_ATTACK_MSG[getRandom(ON_ATTACK_MSG.length)]);
       }
     }
   }
   return super.onAttack(npc, attacker, damage, isSummon);
 }
 private void spawnMinions(final L2Npc npc, final String spawnName) {
   for (MinionHolder is : npc.getTemplate().getParameters().getMinionList(spawnName)) {
     addMinion((L2MonsterInstance) npc, is.getId());
   }
 }