public GuardiansSpawner(NpcInstance npc, QuestState st, int _count) { NpcTemplate template = NpcHolder.getInstance().getTemplate(Soul_of_Tree_Guardian); if (template == null) return; try { _spawn = new SimpleSpawner(template); } catch (Exception e) { e.printStackTrace(); } for (int i = 0; i < _count; i++) { _spawn.setLoc(Location.findPointToStay(npc, 50, 200)); _spawn.setHeading(Rnd.get(0, 0xFFFF)); _spawn.setAmount(1); _spawn.doSpawn(true); agressor = st.getPlayer().getName(); if (st.getPlayer().getSummonList().getPet() != null) agressors_pet = st.getPlayer().getSummonList().getPet().getName(); if (st.getPlayer().getParty() != null) { agressors_party = new ArrayList<String>(); for (Player _member : st.getPlayer().getParty().getPartyMembers()) if (!_member.equals(st.getPlayer())) agressors_party.add(_member.getName()); } } _spawn.stopRespawn(); updateAgression(); }
@Override protected void onEvtAttacked(Creature attacker, int damage) { NpcInstance actor = getActor(); if (!_attacked) { for (int i = 0; i < 4; i++) { try { SimpleSpawner sp = new SimpleSpawner(NpcHolder.getInstance().getTemplate(18493)); sp.setLoc(Location.findPointToStay(actor, 150, 250)); sp.setReflection(actor.getReflection()); sp.doSpawn(true); sp.stopRespawn(); } catch (Exception e) { e.printStackTrace(); } } _attacked = true; } }