Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ai;
- import l2p.gameserver.ai.CtrlEvent;
- import l2p.gameserver.ai.Fighter;
- import l2p.gameserver.model.L2Character;
- import l2p.gameserver.model.L2Player;
- import l2p.gameserver.model.L2World;
- import l2p.gameserver.model.instances.L2NpcInstance;
- import l2p.gameserver.serverpackets.Attack;
- import l2p.gameserver.tables.SkillTable;
- import l2p.extensions.scripts.Functions;
- import l2p.util.Rnd;
- public class PaganCustomRaid extends Fighter
- {
- private static final int USENER = 40032;
- private static final int ANDGAR = 40029;
- private static final int GARANTIN = 40030;
- private static final int BALUR = 40031;
- private long _wait_timeout = 0;
- private long _wait_callhelp = 0;
- public PaganCustomRaid(L2Character actor)
- {
- super(actor);
- }
- @Override
- public boolean isGlobalAI()
- {
- return true;
- }
- @Override
- protected boolean thinkActive()
- {
- if(System.currentTimeMillis() > _wait_timeout)
- {
- _wait_timeout = System.currentTimeMillis() + 15000;
- searchNpc();
- }
- return true;
- }
- private boolean searchNpc()
- {
- L2NpcInstance actor = getActor();
- if(actor == null)
- return false;
- for(L2NpcInstance npc : L2World.getAroundNpc(actor, 25000, 15000))
- {
- int npcId = npc.getNpcId();
- if(npcId == BALUR /* || npcId == USENER || npcId == ANDGAR || npcId == GARANTIN && actor.getNpcId() != npc.getNpcId()*/)
- {
- SkillTable.getInstance().getInfo(1204, 2).getEffects(npc, npc, false, false);
- npc.setCurrentHp(npc.getMaxHp(), false);
- return true;
- }
- }
- return false;
- }
- @Override
- protected void onEvtAttacked(final L2Character attacker, int damage)
- {
- final L2NpcInstance actor = getActor();
- if(actor == null)
- return;
- int npcId = actor.getNpcId();
- if (npcId == GARANTIN)
- {
- if(System.currentTimeMillis() > _wait_callhelp)
- {
- _wait_callhelp = System.currentTimeMillis() + 150000;
- Functions.npcSay(actor, "Brother help me!!!");
- for(L2NpcInstance npc : L2World.getAroundNpc(actor, 5000, 5000))
- if(npc.getNpcId() == npcId && npc.getObjectId() != actor.getObjectId())
- {
- npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, new Object[] { attacker, Rnd.get(1, 100) });
- Functions.npcSay(npc, attacker.getName()+" You gona die!!!");
- }
- }
- }
- super.onEvtAttacked(attacker, damage);
- }
- }
Add Comment
Please, Sign In to add comment