Guest User

Untitled

a guest
Jan 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.61 KB | None | 0 0
  1. package ai;
  2.  
  3. import l2p.gameserver.ai.CtrlEvent;
  4. import l2p.gameserver.ai.Fighter;
  5. import l2p.gameserver.model.L2Character;
  6. import l2p.gameserver.model.L2Player;
  7. import l2p.gameserver.model.L2World;
  8. import l2p.gameserver.model.instances.L2NpcInstance;
  9. import l2p.gameserver.serverpackets.Attack;
  10. import l2p.gameserver.tables.SkillTable;
  11.  
  12. import l2p.extensions.scripts.Functions;
  13. import l2p.util.Rnd;
  14.  
  15. public class PaganCustomRaid extends Fighter
  16. {
  17.     private static final int USENER = 40032;
  18.     private static final int ANDGAR = 40029;
  19.     private static final int GARANTIN = 40030;
  20.     private static final int BALUR = 40031;
  21.  
  22.     private long _wait_timeout = 0;
  23.     private long _wait_callhelp = 0;
  24.  
  25.  
  26.     public PaganCustomRaid(L2Character actor)
  27.     {
  28.         super(actor);
  29.     }
  30.  
  31.     @Override
  32.     public boolean isGlobalAI()
  33.     {
  34.         return true;
  35.     }
  36.  
  37.     @Override
  38.     protected boolean thinkActive()
  39.     {
  40.         if(System.currentTimeMillis() > _wait_timeout)
  41.         {
  42.             _wait_timeout = System.currentTimeMillis() + 15000;
  43.             searchNpc();
  44.         }
  45.         return true;
  46.     }
  47.  
  48.     private boolean searchNpc()
  49.     {
  50.         L2NpcInstance actor = getActor();
  51.         if(actor == null)
  52.             return false;
  53.  
  54.             for(L2NpcInstance npc : L2World.getAroundNpc(actor, 25000, 15000))
  55.             {
  56.                 int npcId = npc.getNpcId();
  57.  
  58.  
  59.                 if(npcId == BALUR /* || npcId == USENER || npcId == ANDGAR || npcId == GARANTIN && actor.getNpcId() != npc.getNpcId()*/)
  60.                 {
  61.                     SkillTable.getInstance().getInfo(1204, 2).getEffects(npc, npc, false, false);
  62.                     npc.setCurrentHp(npc.getMaxHp(), false);
  63.                     return true;
  64.                 }
  65.             }
  66.         return false;
  67.     }
  68.  
  69.     @Override
  70.     protected void onEvtAttacked(final L2Character attacker, int damage)
  71.     {
  72.         final L2NpcInstance actor = getActor();
  73.         if(actor == null)
  74.             return;
  75.  
  76.         int npcId = actor.getNpcId();
  77.         if (npcId == GARANTIN)
  78.         {
  79.             if(System.currentTimeMillis() > _wait_callhelp)
  80.             {
  81.                 _wait_callhelp = System.currentTimeMillis() + 150000;
  82.                 Functions.npcSay(actor, "Brother help me!!!");
  83.                 for(L2NpcInstance npc : L2World.getAroundNpc(actor, 5000, 5000))
  84.                     if(npc.getNpcId() == npcId && npc.getObjectId() != actor.getObjectId())
  85.                     {
  86.                         npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, new Object[] { attacker, Rnd.get(1, 100) });
  87.                         Functions.npcSay(npc, attacker.getName()+" You gona die!!!");
  88.                     }
  89.             }
  90.         }
  91.         super.onEvtAttacked(attacker, damage);
  92.     }
  93. }
Add Comment
Please, Sign In to add comment