Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.34 KB | None | 0 0
  1. java/net/sf/l2j/gameserver/model/zone/type/RaidLimitZone.java   (revision 0)
  2.  
  3. package net.sf.l2j.gameserver.model.zone.type;
  4.  
  5. import net.sf.l2j.gameserver.model.actor.Creature;
  6. import net.sf.l2j.gameserver.model.actor.ai.CtrlIntention;
  7. import net.sf.l2j.gameserver.model.actor.instance.RaidBoss;
  8. import net.sf.l2j.gameserver.model.zone.SpawnZoneType;
  9. import net.sf.l2j.gameserver.model.zone.ZoneId;
  10.  
  11. public class RaidLimitZone extends SpawnZoneType
  12. {
  13.    private int _bossId;
  14.  
  15.    public RaidLimitZone(int id)
  16.    {
  17.        super(id);
  18.    }
  19.  
  20.    @Override
  21.    public void setParameter(String name, String value)
  22.    {
  23.        if (name.equals("bossId"))
  24.            _bossId = Integer.parseInt(value);
  25.    }
  26.  
  27.    @Override
  28.    protected void onEnter(Creature character)
  29.    {
  30.       character.setInsideZone(ZoneId.RAID_LIMIT, true);
  31.    }
  32.  
  33.    @Override
  34.    protected void onExit(Creature character)
  35.    {
  36.        character.setInsideZone(ZoneId.RAID_LIMIT, false);
  37.        if (character instanceof RaidBoss)
  38.        {
  39.            final RaidBoss raidboss = ((RaidBoss) character);
  40.            if (raidboss.getNpcId() == _bossId)
  41.           {
  42.                raidboss.teleportTo(raidboss.getSpawn().getLoc(), 0);
  43.                raidboss.setTarget(null);
  44.                raidboss.getAI().setIntention(CtrlIntention.IDLE);
  45.            }
  46.        }
  47.    }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement