• SEARCH

    통합검색
  • GAMEZONE
    • 커뮤니티
      • 공지사항
      • 유저게시판
        • 등업게시판
        • 출석체크
        • 정회원 무료자료실
      • 스크린샷
      • 인증자료실
    • 리니지
      • 게임공략 & 팁
      • 홍보게시판
      • 유틸자료실
      • 소스자료실
      • 자유게시판
      • 노하우 게시판
    • 메이플스토리
      • 게임공략 & 팁
      • 홍보게시판
      • 유틸자료실
      • 소스자료실
      • 자유게시판
      • 노하우 게시판
    • 바람의나라
      • 자유게시판
      • 홍보게시판
      • 자료게시판
        • 유틸자료실
        • 소스자료실
        • 클라이언트
        • 팩 자료실
      • 연구게시판
        • 개발내역
        • 질문과답변
        • 기타
      • 강의게시판
        • DR
        • CR
        • 구버전
        • 클라이언트 개조
        • 노하우 게시판
        • 게임공략 & 팁
    • 다크에덴
      • 게임공략 & 팁
      • 홍보게시판
      • 유틸자료실
      • 소스자료실
      • 자유게시판
      • 노하우 게시판
    • 믹스마스터
      • 게임공략 & 팁
      • 홍보게시판
      • 유틸자료실
      • 소스자료실
      • 자유게시판
      • 노하우 게시판
    • 라그나로크
      • 게임공략 & 팁
      • 홍보게시판
      • 유틸자료실
      • 소스자료실
      • 자유게시판
      • 노하우 게시판
    • 기타게임
      • 게임공략 & 팁
      • 홍보게시판
      • 유틸자료실
      • 소스자료실
      • 자유게시판
      • 노하우 게시판
    • 게임강의
    • 비베&포토샵
      • 자유게시판
      • 자료실
        • 일반자료실
        • 포인트 자료실
      • 노하우게시판
      • 포토샵게시판
    • 모바일
      • 게임공략
      • 포인트 자료실
      • 유틸자료실
      • 자유게시판
  • 리니지 소스자료실
    • 리니지 소스자료실 ()
    • [일팩유저화이팅]하딘시스템

      • 준희미니
      • 2016.06.29 - 00:24 41

    자바생성 L1HardinQuest .java

    에바팩에는 되어있다고 들었습니다.

    일팩 유저화이팅


    /*
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program.  If not, see <
    http://www.gnu.org/licenses/>.
     */
    package l1j.server.model.etc; //이거 자바만드는위치로 변경하셔두됨

    import java.util.ArrayList;
    import java.util.Timer;
    import java.util.TimerTask;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import l1j.server.GeneralThreadPool;
    import l1j.server.datatables.DoorTable;
    import l1j.server.datatables.MobGroupTable;
    import l1j.server.datatables.NpcTable;
    import l1j.server.datatables.TrapTable;
    import l1j.server.model.instance.L1DoorInstance;
    import l1j.server.model.instance.L1EffectInstance;
    import l1j.server.model.instance.L1FieldObjectInstance;
    import l1j.server.model.instance.L1ItemInstance;
    import l1j.server.model.instance.L1MonsterInstance;
    import l1j.server.model.instance.L1NpcInstance;
    import l1j.server.model.instance.L1PcInstance;
    import l1j.server.model.instance.L1TrapInstance;
    import l1j.server.model.L1HardinQuest;
    import l1j.server.model.L1Location;
    import l1j.server.model.L1MobGroupSpawn;
    import l1j.server.model.L1Object;
    import l1j.server.model.L1Teleport;
    import l1j.server.model.L1World;
    import l1j.server.model.inventory.L1Inventory;
    import l1j.server.model.skill.L1SkillId;
    import l1j.server.model.skill.L1SkillUse;
    import l1j.server.model.trap.L1Trap;
    import l1j.server.model.trap.L1WorldTraps;
    import l1j.server.packets.server.S_GreenMessage;
    import l1j.server.packets.server.S_NpcChatPacket;
    import l1j.server.packets.server.S_NpcPack;
    import l1j.server.packets.server.S_NpcTalkReturn;
    import l1j.server.packets.server.S_ShockWave;
    import l1j.server.packets.server.S_SkillSound;
    import l1j.server.random.RandomGenerator;
    import l1j.server.random.RandomGeneratorFactory;
    import l1j.server.templates.L1DoorGfx;
    import l1j.server.types.Point;
    import l1j.server.utils.IdFactory;
    import l1j.server.utils.collections.Lists;

    public class L1HardinQuest {

     class assailantSpawn extends TimerTask {

      public void begin() {
       final Timer timer = new Timer();
       timer.scheduleAtFixedRate(this, 10 * 1000, 160 * 1000);
      }

      @Override
      public void run() {
       if (!isDeleteTransactionNow()) {
        if (getBoneLaidStatus() == -1 && _leader.getMapId() == getMapId()) {
         final RandomGenerator rd = RandomGeneratorFactory.getSharedRandom();
         final int i = rd.nextInt(3);
         final int mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(85 + i).getLeaderId();
         doSpawnGroup(_leader.getLocation(), mobGroupLeaderId, 85 + i);
         if (i == 1) {
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7596", 0));
         }
        } else {
         this.cancel();
        }
       } else {
        this.cancel();
       }
      }
     }

     

     class attackKerenis extends TimerTask {
      int randomtime = 20;

      public void begin() {
       final Timer timer = new Timer();
       timer.scheduleAtFixedRate(this, 30 * 1000, randomtime * 1000);
      }

      @Override
      public void run() {
       if (!isDeleteTransactionNow()) {
        if (!isAlreadyGuardManDeath()) {
         final RandomGenerator rd = RandomGeneratorFactory.getSharedRandom();
         randomtime = 20 + rd.nextInt(10);
         for (final L1Object obj : L1World.getInstance().getVisibleObjects(_Kerenis, 6)) {
          if (obj instanceof L1MonsterInstance) {
           if (!((L1MonsterInstance) obj).isDead()) {
            final L1SkillUse l1skilluse = new L1SkillUse();
            l1skilluse.handleCommands(_leader,
              L1SkillId.FROZEN_CLOUD, obj.getId(),
              obj.getX(), obj.getY(), null, 0,
              L1SkillUse.TYPE_GMBUFF, _Kerenis);
            break;
           }
          }
         }
        } else {
         this.cancel();
        }
       } else {
        this.cancel();
       }

      }
     }

     class HardinQuestMonitor extends TimerTask {
      public void begin() {
       final Timer timer = new Timer();
       timer.scheduleAtFixedRate(this, 30 * 1000, 300 * 1000);
      }

      @Override
      public void run() {
       if (!isDeleteTransactionNow()) { //대비

        for (final L1PcInstance pc : L1World.getInstance().getAllPlayers()) {
         if (getMapId() == pc.getMapId()) {
          return;
         }
        }
        if (!isDeleteTransactionNow())
         end();
        this.cancel();
       } else {
        this.cancel();
       }
      }
     }

     class HqThread extends Thread {
      @Override
      public void run() {
       try {
        sendCountDown();
        boolean hardMode = false;
        int pattern = 1;

        if (isHardMode()) {
         hardMode = true;
        }
        for (int round = 1; round <= 12; round++) {
         if (!isDeleteTransactionNow()) {

          setCurRound(round);
          sendRoundMessage(round);

          if (hardMode) {
           if (round > 1) {
            if (getBoneLaidStatus() == 2) {
             pattern = 3;

            } else {
             pattern = 2;

            }
           } else if (getBoneLaidStatus() == 2) {
            pattern = 3;
           }
          }
          if (round % 4 == 0) {

           Thread.sleep(5 * 1000);

          }
          final RandomGenerator random = RandomGeneratorFactory.getSharedRandom();
          if (99 < (random.nextInt(100) + 1)) {
           setBonusStage(true);
          }
          for (int subRound = 1; subRound <= 4; subRound++) {
           if (isDeleteTransactionNow())
            return;
           sendSubRoundMessage(subRound);
           selectSpawn(pattern, round);
           // Thread.sleep(9000);
          }
          if (round % 4 == 0) {
           Thread.sleep(109 * 1000);
          } else {
           Thread.sleep(75 * 1000);
          }
          int cnt = 0;
          for (final L1PcInstance pc : L1World.getInstance().getAllPlayers()) {
           if (pc.getMapId() == getMapId()) {
            cnt++;
           }
          }
       

    /// 5명시작

     

          if (searchCountMonster() > 6 || isBonusStage()) {
           if (!isBonusStage() && getCurRound() != 12) {
            sendMessage("$7653", 0);


           }
           Thread.sleep(25 * 1000);
           if (searchCountMonster() > 6 || isBonusStage()) {
            Thread.sleep(35 * 1000);
            sendMessage("$7811", 0);
            _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7811", 0));
                    boolean remain = true;
            for (int i = 0; ((i < 3) && remain)
              || isBonusStage(); i++) {
             if (isDeleteTransactionNow())
              return;
             Thread.sleep(30000);
             remain = searchCountMonster() > 6;
            }

            if (remain || isBonusStage()) {
             sendMessage("$7681", 0);
             _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7681", 0));
                      if (!isDeleteTransactionNow())
              outPushPlayer();
                       return;
            } else {
             if (getCurRound() != 12) {
              sendMessage("$8703", 0);
              _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8703", 0));
             }        
            }
           }
           setRoundStatus(round - 1, 2);

          } else {
           if (searchCountMonster() < 4) {
            setRoundStatus(round - 1, 1);

           } else {
            setRoundStatus(round - 1, 3);
           }
           if (getCurRound() != 12) {
            sendMessage("$7652", 0);
           }
          }
         } else {
          return;
         }
        }
       } catch (final Exception e) {
        _log.log(Level.SEVERE, e.getLocalizedMessage(), e);
       }
      }
     }

    //////////멘트...........

     class KerenisPart1 extends Thread {
      @Override
      public void run() {
       try {
        final L1Location loc = new L1Location(32742, 32930, getMapId());
        spawnOne(loc, 91320, 0);
        if (_leader.getMapId() == getMapId()) {
         _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep003"));
        }
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7616", 0));
        setActionKerenisDirect(0);
        Thread.sleep(3000);
        if (getActionKerenis() == 1) {
         _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7562", 0));
         } else {
         if (getActionKerenis() == 2) {
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7570", 0));
         } else {// 0
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7617", 0));
         }
        }

        Thread.sleep(102 * 1000);
        if (getSwitchStatus(0) == 0) {
         setSwitchStatus(0, -1);
        }
        if (isAlreadyFirstSwitch()) {
         _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7622", 0));
         return;
        } else {
         if (_leader.getMapId() == getMapId()) {
          _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep004"));
         }
         _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7618", 0));
         sendMessage("$7560 : $7618", 0);
         setActionKerenisDirect(0);//
         Thread.sleep(3000);
         if (isAlreadyFirstSwitch()) {
          setSwitchStatus(0, 2);
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7620", 0));
         }

         if (getActionKerenis() == 1) {
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7571", 0));
         } else {
          if (getActionKerenis() == 2) {
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7563", 0));
          } else {
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7619", 0));
          }

         }
        }
        Thread.sleep(15 * 1000);

        // System.out.print(getSwitchStatus(0));
        if (getSwitchStatus(0) == -1) {
         if (isAlreadyFirstSwitch()) {
          setSwitchStatus(0, 0);
         } else {
          if (!isDeleteTransactionNow())
           outPushPlayer();// end();
         }
        }

       } catch (final InterruptedException ignore) {
       }
      }
     }

     class KerenisPart2 extends Thread {
      @Override
      public void run() {
       try {
        Thread.sleep(310 * 1000);
        if (getSwitchStatus(1) == 0) {
         setSwitchStatus(1, -1);
        }
        if (isAlreadySecondSwitch()) {
         return;
        } else {
         if (_leader.getMapId() == getMapId()) {
          _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep004"));
         }
         _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7625", 0));
         sendMessage("$7560 : $7625", 0);
         setActionKerenisDirect(0);
         Thread.sleep(3000);
         if (isAlreadySecondSwitch()) {
          setSwitchStatus(1, 2);
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7627", 0));
         }
         if (getActionKerenis() == 1) {
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7571", 0));
         } else {
          if (getActionKerenis() == 2) {
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7563", 0));
          } else {
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7626", 0));
          }
         }
         setActionKerenisDirect(0);

        }
        Thread.sleep(15 * 1000);

        if (getSwitchStatus(1) == -1) {
         if (isAlreadySecondSwitch()) {
          setSwitchStatus(1, 0);
         } else {
          if (!isDeleteTransactionNow())
           outPushPlayer();// end();
         }
        }
       } catch (final InterruptedException ignore) {
       }
      }
     }

     class KerenisPart3 extends Thread {
      @Override
      public void run() {
       try {
        Thread.sleep(230 * 1000);
        if (getSwitchStatus(2) == 0) {
         setSwitchStatus(2, -1);
        }
        if (isAlreadyPortal()) {
         return;
        } else {
         if (_leader.getMapId() == getMapId()) {
          _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep004"));
         }
         _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7632", 0));
         sendMessage("$7560 : $7632", 0);
         setActionKerenisDirect(0);
         Thread.sleep(3000);
         if (isAlreadyPortal()) {
          setSwitchStatus(2, 2);
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7634", 0));
         }

         if (getActionKerenis() == 1) {
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7563", 0));
         } else {
          if (getActionKerenis() == 2) {
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7571", 0));
          } else {
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7633", 0));
          }
         }
         setActionKerenisDirect(0);
        }
        Thread.sleep(15 * 1000);

        if (getSwitchStatus(2) == -1) {
         if (isAlreadyPortal()) {
          setSwitchStatus(2, 0);
         } else {
          if (!isDeleteTransactionNow())
           outPushPlayer();// end();
         }
        }
       } catch (final InterruptedException ignore) {
       }
      }
     }

     class KerenisPart4 extends Thread {
      @Override
      public void run() {
       try {
        Thread.sleep(150 * 1000);
        if (getSwitchStatus(3) == 0) {
         setSwitchStatus(3, -1);
        }
        if (isAlreadyGuardManDeath()) {
         return;
        } else {
         if (_leader.getMapId() == getMapId()) {
          _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep004"));
         }
         sendMessage("$7560 : $7640", 0);

         setActionKerenisDirect(0);
         Thread.sleep(3000);
         if (isAlreadyGuardManDeath()) {
          setSwitchStatus(3, 2);
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7642", 0));
         }

         if (getActionKerenis() == 1) {
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7563", 0));
         } else {
          if (getActionKerenis() == 2) {
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7571", 0));
          }
         }
         Thread.sleep(3000);
         _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7641", 0));
         setActionKerenisDirect(0);
        }
        Thread.sleep(15 * 1000);

        if (getSwitchStatus(3) == -1) {
         if (isAlreadyGuardManDeath()) {
          setSwitchStatus(3, 0);
         } else {
          if (!isDeleteTransactionNow())
           outPushPlayer();// end();
         }
        }
       } catch (final InterruptedException ignore) {
       }
      }
     }

     class KerenisRandomMessage extends TimerTask {
      private final int MSGID = 7576;

      public void begin() {
       final Timer timer = new Timer();
       timer.scheduleAtFixedRate(this, 10 * 1000, 60 * 1000);
      }

     

    ////////////////번호멘트

      @Override
      public void run() {
       if (!isDeleteTransactionNow()) {
        if (!isAlreadyGuardManDeath()) {
         final RandomGenerator rd = RandomGeneratorFactory.getSharedRandom();
         final int i = rd.nextInt(12);
         _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$" + (MSGID + i), 0));
        } else {
         this.cancel();
        }
       } else {
        this.cancel();
       }
      }
     }

     class moveWall extends TimerTask {

      private final RandomGenerator _rnd = RandomGeneratorFactory.newRandom();

      private void waitForLocation(L1Location loc)
        throws InterruptedException {
       boolean find = true;
       while (find) {
        find = false;
        for (final L1Object obj : L1World.getInstance()
          .getVisiblePoint(loc, 0)) {
         if (!(obj instanceof L1ItemInstance)) {
          find = true;
          Thread.sleep(500);
          break;
         }
        }
       }
      }

      private L1Location findLocation(L1Location base) {
       L1Location newLoc = new L1Location(base);
       boolean find = true;
       while (find) {
        find = false;
        int moveX = 2 + _rnd.nextInt(3);

        int moveY = _rnd.nextInt(7);

        newLoc.set(newLoc.getX() + moveX, newLoc.getY() - moveY);
        for (final L1Object obj : L1World.getInstance()
          .getVisiblePoint(newLoc, 0)) {
         if (!(obj instanceof L1ItemInstance)) {
          find = true;
          break;
         }
        }
       }
       return newLoc;
      }

      public void begin() {
       final Timer timer = new Timer();
       timer.schedule(this, 6000);
      }

      @Override
      public void run() {
       try {
        int cnt = 3;
        for (L1DoorInstance wall : Lists.newArrayList(getAllDoors())) {
         if (cnt % 4 == 0) {
          sendShockWave();
         }
         if (wall.getGfxId() != WALL_GFXID) {
          continue;
         }
         L1Location newLoc = findLocation(wall.getLocation());
         removeDoor(wall);
         addDoor(newLoc);
         Thread.sleep(600);
         cnt++;
        }
        Thread.sleep(5000);
        int val;
        int startX1;// 32703,32702
        int startX2;
        if (_rnd.nextInt(2) == 0) {// 1
         val = 1;
         startX1 = 32703;
         startX2 = startX1;
        } else {
         val = -1;
         startX1 = 32711;
         startX2 = 32709;
        }
        cnt = 0;
        for (L1DoorInstance wall : Lists.newArrayList(getAllDoors())) {
         L1Location newLoc = new L1Location();
         if (cnt % 4 == 0) {
          sendShockWave();
         }
         if (cnt % 2 == 0) {
          newLoc.set(startX1, 32866, getMapId());
          startX1 += val;
         } else {
          newLoc.set(startX2, 32872, getMapId());
          startX2 += val;
         }
         waitForLocation(newLoc);
         removeDoor(wall);
         addDoor(newLoc);
         Thread.sleep(600);
         cnt++;
        }
        Thread.sleep(20000);
        sendMessage("$8718", 0);
       } catch (final InterruptedException e) {
        _log.log(Level.SEVERE, e.getLocalizedMessage(), e);
       }

      }

     }

     class orcVocabulary extends TimerTask {
      public void begin() {
       final Timer timer = new Timer();
       timer.schedule(this, 2 * 1000);
      }

      @Override
      public void run() {
       try {
        final L1Location loc = new L1Location();
        loc.set(32746, 32932, getMapId());
        final L1NpcInstance orc = spawnOne(loc, 91333, 7);

        loc.set(32748, 32931, getMapId());
        final L1NpcInstance orcFighter = spawnOne(loc, 91336, 7);
        loc.set(32745, 32935, getMapId());
        final L1NpcInstance orcArcher = spawnOne(loc, 91334, 7);

        loc.set(32747, 32934, getMapId());
        final L1NpcInstance barusim = spawnOne(loc, 91335, 7);
        Thread.sleep(2000);
        barusim.broadcastPacket(new S_NpcChatPacket(barusim, "$7842", 0));
        Thread.sleep(2000);
        orc.broadcastPacket(new S_NpcChatPacket(orc, "$7848", 0));
        Thread.sleep(2000);
        orcFighter.broadcastPacket(new S_NpcChatPacket(orcFighter, "$7854", 0));
        Thread.sleep(2000);
        orc.broadcastPacket(new S_NpcChatPacket(orc, "$7849", 0));
        Thread.sleep(2000);
        orcFighter.broadcastPacket(new S_NpcChatPacket(orcFighter, "$7855", 0));
          Thread.sleep(2000);
        barusim.broadcastPacket(new S_NpcChatPacket(barusim, "$7843", 0));
         Thread.sleep(2000);
        orcFighter.broadcastPacket(new S_NpcChatPacket(orcFighter, "$7856", 0));
        Thread.sleep(2000);
        barusim.broadcastPacket(new S_NpcChatPacket(barusim, "$7844", 0));
        Thread.sleep(2000);
        orcFighter.broadcastPacket(new S_NpcChatPacket(orcFighter, "$7857", 0));
        Thread.sleep(2000);
        orcArcher.broadcastPacket(new S_NpcChatPacket(orcArcher, "$7851", 0));
         Thread.sleep(2000);
        orcFighter.broadcastPacket(new S_NpcChatPacket(orcFighter, "$7858", 0));
        Thread.sleep(2000);
        orcArcher.broadcastPacket(new S_NpcChatPacket(orcArcher, "$7852", 0));
        Thread.sleep(2000);
        orcFighter.broadcastPacket(new S_NpcChatPacket(orcFighter, "$7859", 0));
        Thread.sleep(2000);
        while (orcFighter.moveDirection(32748, 32935) != -1) {
         if (orcFighter.getLocation().getLineDistance(
           new Point(32748, 32935)) != 0) {
          orcFighter.setDirectionMove(orcFighter.moveDirection(32748, 32935));
          Thread.sleep(orcFighter.getPassiSpeed());
         } else {
          break;
         }
        }
        Thread.sleep(2000);
        orcFighter.deleteMe();

        orcArcher.broadcastPacket(new S_NpcChatPacket(orcArcher, "$7853", 0));
        Thread.sleep(2000);
        while (orcArcher.moveDirection(32748, 32935) != -1) {
         if (orcArcher.getLocation().getLineDistance(
           new Point(32748, 32935)) != 0) {
          orcArcher.setDirectionMove(orcArcher.moveDirection(32748, 32935));
          Thread.sleep(orcArcher.getPassiSpeed());
         } else {
          break;
         }
        }
        Thread.sleep(2000);
        orcArcher.deleteMe();

        orc.broadcastPacket(new S_NpcChatPacket(orc, "$7850", 0));
        Thread.sleep(2000);
        while (orc.moveDirection(32748, 32935) != -1) {
         if (orc.getLocation().getLineDistance(
           new Point(32748, 32935)) != 0) {
          orc.setDirectionMove(orc.moveDirection(32748, 32935));
          Thread.sleep(orc.getPassiSpeed());
         } else {
          break;
         }
        }
        Thread.sleep(2000);
        orc.deleteMe();

        barusim.broadcastPacket(new S_NpcChatPacket(barusim, "$7845", 0));
        Thread.sleep(4000);
        barusim.broadcastPacket(new S_NpcChatPacket(barusim, "$7846", 0));
        Thread.sleep(4000);
        barusim.broadcastPacket(new S_NpcChatPacket(barusim, "$7847", 0));
        Thread.sleep(2000);
        while (barusim.moveDirection(32748, 32935) != -1) {
         if (barusim.getLocation().getLineDistance(
           new Point(32748, 32935)) != 0) {
          barusim.setDirectionMove(barusim.moveDirection(32748, 32935));
          Thread.sleep(barusim.getPassiSpeed());
         } else {
          break;
         }
        }
        Thread.sleep(2000);
        barusim.deleteMe();
       } catch (final InterruptedException e) {
        e.printStackTrace();
       }
      }
     }

     

    //시작 준비 래디 고

     

     class Preliminary extends Thread {
      @Override
      public void run() {
       try {
        Thread.sleep(2000);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7598", 0));
        Thread.sleep(4000);
        sendMessage(_Hardin.getName() + " : $8693", 0);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8693", 0));
        Thread.sleep(8000);
        setActionHardinDirect(0);
        sendMessage(_Hardin.getName() + " : $8694", 0);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8694", 0));
        Thread.sleep(8000);
        if (getActionHardin() != 1) {
         sendMessage(_Hardin.getName() + " : $8695", 0);
         _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8695", 0));
         Thread.sleep(8000);
         sendMessage(_Hardin.getName() + " : $8696", 0);
         _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8696", 0));
         Thread.sleep(8000);
         sendMessage(_Hardin.getName() + " : $8697", 0);
         _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8697", 0));
         Thread.sleep(8000);
         sendMessage(_Hardin.getName() + " : $8698", 0);
         _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8698", 0));
         Thread.sleep(8000);
         sendMessage(_Hardin.getName() + " : $8699", 0);
         _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8699", 0));
         Thread.sleep(8000);
         sendMessage(_Hardin.getName() + " : $8700", 0);
         _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8700", 0));
         Thread.sleep(8000);
         sendMessage(_Hardin.getName() + " : $8701", 0);
         _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8701", 0));
         Thread.sleep(8000);
        }
        setActionHardinDirect(0);
        sendMessage(_Hardin.getName() + " : $8702", 0);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$8702", 0));
        Thread.sleep(4000);
        if (getActionHardin() != 1) {
         if (_leader.getMapId() == getMapId()) {
          _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep002"));
         }
         Thread.sleep(10000);
        }

        setActionHardinDirect(0);
        if (_leader.getMapId() == getMapId()) {
         _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep001"));
        }
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7599", 0));
        Thread.sleep(8000);
        if (getActionHardin() != 1) {
         sendMessage(_Hardin.getName() + " : $7601", 0);
         _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7601", 0));
         setActionHardinDirect(0);
         Thread.sleep(10000);
         for (int i = 0; i < 5; i++) {
          if (getActionHardin() != 1) {
           setActionHardinDirect(0);
           sendMessage(_Hardin.getName() + " : $7602", 0);
           _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7602", 0));
           Thread.sleep(8000);
          } else {
           break;
          }
         }
        }
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7600", 0));
        Thread.sleep(8000);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7603", 0));
        Thread.sleep(2000);
        if (_leader.getMapId() == getMapId()) {
         L1Teleport.teleport(_leader, 32738, 32930, getMapId(), 5, true);
        }
        final L1Location loc = new L1Location();
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7604", 0));
        /* 1 */
        Thread.sleep(1000);
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7607", 0));
        /* 5 */
        Thread.sleep(4000);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7605", 0));
        /* 10 */
        Thread.sleep(2000);

        loc.set(32725, 32724, getMapId());
        setSwitch(loc, 65);
        spawnOne(loc, 91319, 0);
        /* 12 */
        Thread.sleep(5000);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7606", 0));
        Thread.sleep(4000);
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7608", 0));
        Thread.sleep(4000);
        _Hardin.teleport(32716, 32846, 6);
        loc.set(32716, 32846, getMapId());
        spawnOne(loc, 91319, 0);
        spawnOne(loc, 91317, 0);
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7609", 0));
        Thread.sleep(5000);
        setActionKerenisDirect(0);
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7610", 0));
        Thread.sleep(5000);
        sendMessage(_Hardin.getName() + " : $7611", 0);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7611", 0));
        Thread.sleep(2000);
        if (getActionKerenis() == 1) {
         _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7561", 0));
        } else {
         if (getActionKerenis() == 2) {
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7569", 0));
         } else {
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7612", 0));
         }
        }
        setActionKerenisDirect(0);
        Thread.sleep(6000);
        sendMessage(_Hardin.getName() + " : $7613", 0);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7613", 0));
        Thread.sleep(5000);
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7614", 0));
        sendMessage(_Hardin.getName() + " : $7615", 0);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7615", 0));
        sendShockWave();
        Thread.sleep(2000);
        if (!isDeleteTransactionNow()) {
         _kp1 = new KerenisPart1();
         GeneralThreadPool.getInstance().execute(_kp1);
         _krm = new KerenisRandomMessage();
         _krm.begin();
        }
       } catch (final InterruptedException e) {
        e.printStackTrace();
       }
      }
     }


     class spawnBoss extends TimerTask {
      public void begin() {
       final Timer timer = new Timer();
       timer.schedule(this, 0);
      }

      @Override
      public void run() {
       try {
        if (getCurRound() == 4) {
         spawnOneMob(getLocation(), 91291);
        } else if (getCurRound() == 8) {
         spawnOneMob(getLocation(), 91293);
        } else if (getCurRound() == 12) {
         int cnt = 0;
         for (int i = 0; i < _roundStatus.length; i++) {
          if (getRoundStatus(i) == 1) {
           cnt++;
          }
         }
         if (8 < cnt) {
          _lunker = spawnOneMob(getLocation(), 91294);
         } else {
          _lunker = spawnOneMob(getLocation(), 91290);
         }
         final L1Location loc = new L1Location(32711, 32845,
           getMapId());
         boolean kerenisSpawn = true;


         _lunker.broadcastPacket(new S_NpcChatPacket(_lunker, "$7656", 0));
         Thread.sleep(1500);
         _lunker.broadcastPacket(new S_NpcChatPacket(_lunker, "$7657", 0));
         if (!isKerenisAngry()) {
          _Kerenis = spawnOneMob(loc, 91296);
         } else {
          if (isHardMode()) {
           _Kerenis = spawnOneMob(loc, 91295);
          } else {
           kerenisSpawn = false;
          }
         }
         if (kerenisSpawn) {
          _Kerenis.tagertClear();
          _Kerenis.setTarget(_lunker);
          _lunker.tagertClear();
          _lunker.setTarget(_Kerenis);

    ///////////////////////////////////////

          if (_Kerenis.getNpcId() == 91296) {

           Thread.sleep(1500);
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7820", 0));
           Thread.sleep(1500);
           _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7821", 0));
           Thread.sleep(1500);
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7822", 0));
           Thread.sleep(1500);
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7823", 0));
           Thread.sleep(1500);
           _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7824", 0));

          } else {

           Thread.sleep(1500);
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7815", 0));
           Thread.sleep(1500);
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7816", 0));
           Thread.sleep(1500);
           _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7817", 0));
           Thread.sleep(1500);
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7818", 0));
           Thread.sleep(1500);
           _lunker.broadcastPacket(new S_NpcChatPacket(_lunker, "$7819", 0));
           Thread.sleep(1500);
          }
         }
        }
       } catch (final InterruptedException e) {

        e.printStackTrace();
       }
      }
     }


     private L1Location _location;

     private short _mapId;

     private L1PcInstance _leader;

     public void setLeader(L1PcInstance leader) {
      this._leader = leader;
     }

     private int[] _randomRuneEffect;

     private int[] _roundStatus;

     private int[] _switchStatus;

     private L1NpcInstance _Hardin;

     private L1NpcInstance _Kerenis;

     private boolean _active;

     private boolean _receiveAllAction;

     private boolean _kerenisAngry;

     private static final Logger _log = Logger.getLogger(L1HardinQuest.class.getName());

     private boolean _alreadyFirstSwitch;

     private boolean _alreadySecondSwitch;

     private boolean _alreadyPortal;

     //private boolean _hintAlready;

     private int _curRound;

     spawnBoss _sb;

     HqThread _hq;

     Preliminary _preliminary;

     HardinQuestMonitor _hqm;

     KerenisRandomMessage _krm;

     KerenisPart1 _kp1;

     KerenisPart2 _kp2;

     KerenisPart3 _kp3;

     KerenisPart4 _kp4;

     assailantSpawn _as;

     attackKerenis _ak;

     private boolean _BlackRuneTrodAlready;

     orcVocabulary _ov;

     private boolean _blackRune;

     private int _actionKerenis;

     private int _actionHardin;

     private int[] _onPlayerList;

     L1NpcInstance _lunker;

     private boolean _alreadyGuardManDeath;

     private boolean _deleteTransactionNow;

     private final ArrayList<L1TrapInstance> _trapList = new ArrayList<L1TrapInstance>();

     private ArrayList<L1DoorInstance> _doors;

     moveWall _mw;

    ///오비션

     public L1HardinQuest(short mapId) {
      setMapId(mapId);
      init();
     }

     private static final int WALL_GFXID = 7536;
     private final L1DoorGfx _wallGfx = L1DoorGfx.findByGfxId(WALL_GFXID);

     private void addDoor(L1Location loc) {
      L1DoorInstance door = DoorTable.getInstance().createDoor(0, _wallGfx, loc, 0, 1, false);
      getAllDoors().add(door);
     }

     

     private void addTrapList(L1TrapInstance trap) {
      _trapList.add(trap);
     }

     

     private void doSpawnGroup(L1Location loc, int npcId, int groupId) {
      final L1NpcInstance mob = new L1NpcInstance(NpcTable.getInstance().getTemplate(npcId));

      mob.setId(IdFactory.getInstance().nextId());
      mob.setHeading(5);
      mob.setX(loc.getX());
      mob.setHomeX(loc.getX());
      mob.setY(loc.getY());
      mob.setHomeY(loc.getY());
      mob.setMap((short) loc.getMapId());

      L1MobGroupSpawn.getInstance().doSpawn(mob, groupId, true, false);

      mob.deleteMe();
     }

     public void end() {
      // this.outPushPlayer();
      setDeleteTransactionNow(true);
      killTimer();
      reset();
      setDeleteTransactionNow(false);
      L1HardinQuest.getInstance().resetActiveMaps(getMapId());
     }

     private int getActionHardin() {
      return _actionHardin;
     }

     private int getActionKerenis() {
      return _actionKerenis;
     }

     private ArrayList<L1DoorInstance> getAllDoors() {
      return _doors;
     }

     private int getBoneLaidStatus() {
      return getSwitchStatus(_switchStatus.length - 1);
     }

     private int getCurRound() {
      return _curRound;
     }

     L1Location getLocation() {
      return _location;
     }

     public short getMapId() {
      return _mapId;
     }

     private int[] getOnPlayerList() {
      return _onPlayerList;
     }

     private int getRandomRuneEffect(int i) {
      return _randomRuneEffect[i];
     }

     private boolean getReceiveAllAction() {
      return _receiveAllAction;
     }

     private int getRoundStatus(int i) {
      return _roundStatus[i];
     }

     private int getSwitchStatus(int x) {
      return _switchStatus[x];
     }

     private ArrayList<L1TrapInstance> getTrapList() {
      return _trapList;
     }

     /**
      * @throws InterruptedException
      */
     public void guardmanDeath() throws InterruptedException {
      GuardmanDeath temp = new GuardmanDeath();
      temp.begin();
     }
     class GuardmanDeath extends TimerTask {
      public void begin() {
       final Timer timer = new Timer();
       timer.schedule(this, 0);
      }

      @Override
      public void run() {
       if (!isDeleteTransactionNow()) {
        try {
         if (getSwitchStatus(3) == 0) {
          setSwitchStatus(3, 1);
         }
         setAlreadyGuardManDeath(true);
         if (_leader.getMapId() == getMapId()) {
          _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep008"));
         }
         _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7643", 0));// 7643
         if (getReceiveAllAction()) {
          setActionKerenisDirect(0);
          Thread.sleep(8000);
          if (getActionKerenis() == 1) {
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7567", 0));
          } else {
           if (getActionKerenis() == 2) {
            _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7575", 0));
           } else {// 0
            _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7646", 0));
           }
          }
         } else {
          _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7644", 0));// 7644
          setActionKerenisDirect(0);
          Thread.sleep(3000);
          if (getActionKerenis() == 1) {
           setKerenisAngry(true);
           _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7568", 0));
          } else {

           if (getActionKerenis() == 0) {
            _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7645", 0));
           }
          }
         }
         Thread.sleep(2500);
         if(_leader != null){
          if(_leader.getMapId()==getMapId()){
           L1Teleport.teleport(_leader, 32718, 32849, getMapId(), 5, true);
          }
         }

         sendMessage("$7647", 0);
         Thread.sleep(4000);
         sendMessage("$7648", 0);
         Thread.sleep(4000);
         sendMessage("$7649", 0);
         sendShockWave();
         Thread.sleep(5000);
         if (!isDeleteTransactionNow()) {
          _hq = new HqThread();
          GeneralThreadPool.getInstance().execute(_hq);
         }
        } catch (InterruptedException e) {
         e.printStackTrace();
        }
       }
       this.cancel();
      }
     }
     
     GuestSpawn _gs;

     class GuestSpawn extends Thread {
      @Override
      public void run() {
       try {
        sendShockWave();
        final L1Location loc = new L1Location();
        loc.set(32707, 32858, getMapId());
        if (isHardMode()) {
         L1NpcInstance Mob = null;
         if (isKerenisAngry()) {
          Mob = spawnOne(loc, 91344, 0);
          Mob.broadcastPacket(new S_NpcChatPacket(Mob, "$7694", 0));
          Thread.sleep(1000);
          Mob.broadcastPacket(new S_NpcChatPacket(Mob, "$7695", 0));// 7695
          Thread.sleep(1000);
          Mob.broadcastPacket(new S_NpcChatPacket(Mob, "$7709", 0));// 7709
          Thread.sleep(1000);
          _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7677", 0));// 7677
         } else {
          Mob = spawnOne(loc, 91343, 0);
          Mob.broadcastPacket(new S_NpcChatPacket(Mob, "$7663", 0));// 7663
          Thread.sleep(1000);
          Mob.broadcastPacket(new S_NpcChatPacket(Mob, "$7664", 0));// 7664
          Thread.sleep(1000);
          Mob.broadcastPacket(new S_NpcChatPacket(Mob, "$7665", 0));// 7665
          Thread.sleep(1000);
          _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7837", 0));
         }

         Thread.sleep(1000);
         _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7838", 0));
         Thread.sleep(1000);
         _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7839", 0));
        }
       } catch (InterruptedException e) {
        e.printStackTrace();
       }
      }
     }


     private void init() {
      setActive(true);
      _location = new L1Location(32707, 32846, getMapId());
      _switchStatus = new int[4];
      _roundStatus = new int[12];
      _randomRuneEffect = new int[9];
      _doors = new ArrayList<L1DoorInstance>();
      final RandomGenerator rd = RandomGeneratorFactory.getSharedRandom();
      int value = 0;
      int[] tmp = new int[4];
      boolean find = false;
      setRandomRuneEffect(0, value);
      for (int i = 0; i < 4; i++) {
       while (!find) {
        value = rd.nextInt(4) + 1;
        find = searchRandomRuneEffect(value, tmp);
       }
       tmp[i] = value;
       find = false;
      }
      for (int i = 0; i < 4; i++) {
       if (rd.nextInt(2) == 1) {
        setRandomRuneEffect(i * 2 + 1, (tmp[i] - 1) * 2 + 1);
        setRandomRuneEffect(i * 2 + 2, (tmp[i] - 1) * 2 + 2);
       } else {
        setRandomRuneEffect(i * 2 + 1, (tmp[i] - 1) * 2 + 2);
        setRandomRuneEffect(i * 2 + 2, (tmp[i] - 1) * 2 + 1);
       }
      }
      final L1Location loc = new L1Location();
      loc.set(32742, 32930, getMapId());
    //////////////////////////////////////////////

      _Kerenis = spawnOne(loc, 91297, 6);
      loc.set(32733, 32724, getMapId());
      _Hardin = spawnOne(loc, 91330, 6);
      loc.set(32684, 32817, getMapId());
      spawnOne(loc, 81167, 0);
      loc.set(32732, 32789, getMapId());
      spawnOne(loc, 81167, 0);
      loc.set(32760, 32791, getMapId());
      spawnOne(loc, 81167, 0);
      loc.set(32667, 32874, getMapId());
      spawnOne(loc, 81167, 0);
      loc.set(32729, 32854, getMapId());
      spawnOne(loc, 81167, 0);

      loc.set(32666, 32817, getMapId());
      spawnOne(loc, 91326, 0);
      loc.set(32668, 32817, getMapId());
      spawnOne(loc, 91326, 0);
      loc.set(32668, 32819, getMapId());
      spawnOne(loc, 91326, 0);
      loc.set(32666, 32819, getMapId());
      spawnOne(loc, 91326, 0);

      loc.set(32809, 32837, getMapId());
      spawnOne(loc, 91326, 0);
      loc.set(32809, 32839, getMapId());
      spawnOne(loc, 91326, 0);
      loc.set(32807, 32837, getMapId());
      spawnOne(loc, 91326, 0);
      loc.set(32807, 32839, getMapId());
      spawnOne(loc, 91326, 0);
      //11111111111111111111111111111삼//
      loc.set(32806, 32863, getMapId());
      spawnOne(loc, 91339, 0);
      loc.set(32808, 32864, getMapId());
      spawnOne(loc, 91339, 0);
      loc.set(32800, 32864, getMapId());
      spawnOne(loc, 91339, 0);
      loc.set(32799, 32866, getMapId());
      spawnOne(loc, 91339, 0);
      loc.set(32807, 32870, getMapId());
      spawnOne(loc, 91339, 0);
      loc.set(32806, 32872, getMapId());
      spawnOne(loc, 91339, 0);
      loc.set(32798, 32872, getMapId());
      spawnOne(loc, 91339, 0);
      loc.set(32800, 32873, getMapId());
      spawnOne(loc, 91339, 0);

      //loc.set(32802, 32868, getMapId());
      //spawnOne(loc, 91338, 0);

    ////////////2///////////

      loc.set(32666, 32817, getMapId());
      setSwitch(loc, 54);
      loc.set(32668, 32817, getMapId());
      setSwitch(loc, 54);
      loc.set(32668, 32819, getMapId());
      setSwitch(loc, 54);
      loc.set(32666, 32819, getMapId());
      setSwitch(loc, 54);

      loc.set(32712, 32793, getMapId());
      setSwitch(loc, 55);
      loc.set(32703, 32791, getMapId());
      setSwitch(loc, 55);
      loc.set(32710, 32803, getMapId());
      setSwitch(loc, 55);
      loc.set(32703, 32800, getMapId());
      setSwitch(loc, 55);

      loc.set(32807, 32839, getMapId());
      setSwitch(loc, 56);
      loc.set(32809, 32837, getMapId());
      setSwitch(loc, 56);
      loc.set(32807, 32837, getMapId());
      setSwitch(loc, 56);
      loc.set(32809, 32839, getMapId());
      setSwitch(loc, 56);

      loc.set(32807, 32870, getMapId());
      setSwitch(loc, 57);
      loc.set(32806, 32872, getMapId());
      setSwitch(loc, 57);
      loc.set(32799, 32866, getMapId());
      setSwitch(loc, 57);
      loc.set(32800, 32864, getMapId());
      setSwitch(loc, 57);
      loc.set(32808, 32864, getMapId());
      setSwitch(loc, 57);
      loc.set(32806, 32863, getMapId());
      setSwitch(loc, 57);
      loc.set(32798, 32872, getMapId());
      setSwitch(loc, 57);
      loc.set(32800, 32873, getMapId());
      setSwitch(loc, 57);

      loc.set(32684, 32816, getMapId());
      setSwitch(loc, 60);
      loc.set(32732, 32789, getMapId());
      setSwitch(loc, 61);
      loc.set(32760, 32791, getMapId());
      setSwitch(loc, 62);
      loc.set(32729, 32854, getMapId());
      setSwitch(loc, 63);
      loc.set(32667, 32874, getMapId());
      setSwitch(loc, 64);

      final int mobGroupIdFirst = 78;
      int mobGroupLeaderId;
      int temp;

      loc.set(32785, 32871, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32725, 32789, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32745, 32813, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32686, 32790, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32664, 32813, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32669, 32850, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32683, 32813, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32715, 32810, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32745, 32789, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32784, 32795, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32805, 32797, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32792, 32828, getMapId());
      temp = rd.nextInt(7) + mobGroupIdFirst;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);
      loc.set(32775, 32846, getMapId());
      temp = 77;
      mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(temp).getLeaderId();
      doSpawnGroup(loc, mobGroupLeaderId, temp);

      final int diaryFirstId = 50008;
      final int[] x = { 32763, 32758, 32663, 32667, 32722 };
      final int[] y = { 32800, 32801, 32876, 32867, 32866 };

      for (int i = 0; i < x.length; i++) {
       if (rd.nextInt(100) <= 50) {
        loc.set(x[i], y[i], getMapId());
        L1World.getInstance().getInventory(loc).storeItem(
          diaryFirstId + rd.nextInt(10), 1);
       }
      }

      if (getMapId() != 9000) {

       for (L1DoorInstance door : DoorTable.getInstance().getDoorList()) {
        if (door.getMapId() == 2) {// TIC2Fのドア
         if (door.getX() == 32684 && door.getY() == 32850) {
          continue;
         }
         L1DoorGfx gfx = L1DoorGfx.findByGfxId(door.getGfxId());
         L1DoorInstance createDoor = DoorTable.getInstance().createDoor(0, gfx,
           new L1Location(door.getX(), door.getY(), getMapId()), 0, 0, false);
        }
       }

       for (L1Object obj : L1World.getInstance().getObject()) {
        if (obj.getMapId() == 2) {
         if (obj instanceof L1FieldObjectInstance) {
          if (((L1FieldObjectInstance) obj).getNpcId() == 91269) {
           continue;
          }
          spawnOne(new L1Location(obj.getX(), obj.getY(), getMapId()),
            ((L1FieldObjectInstance) obj).getNpcId(), 0);
         }
        }
       }
      }
      createWalls();

     }

     private void createWalls() {
      for (int i = 0; i < 10; i++) {

       addDoor(new L1Location(32702 + i, 32866, getMapId()));

       addDoor(new L1Location(32703 + i, 32872, getMapId()));
      }
     }

     

     public boolean isActive() {
      return _active;
     }

     public boolean isAlreadyFirstSwitch() {
      return _alreadyFirstSwitch;
     }

     private boolean isAlreadyGuardManDeath() {
      return _alreadyGuardManDeath;
     }

     public boolean isAlreadyPortal() {
      return _alreadyPortal;
     }

     public boolean isAlreadySecondSwitch() {
      return _alreadySecondSwitch;
     }

     private boolean isBlackRuneCreated() {

      return _blackRune;
     }

     private boolean isBlackRuneTrodAlready() {

      return _BlackRuneTrodAlready;
     }

     public boolean isDeleteTransactionNow() {
      return _deleteTransactionNow;
     }

     private boolean isHardMode() {
      boolean flag = true;
      for (int n = 0; n < _switchStatus.length - 1; n++) {
       if (getSwitchStatus(n) != 2) {
        flag = false;
        break;
       }
      }
      return flag;
     }

     private boolean isKerenisAngry() {
      return _kerenisAngry;
     }

     private void killTimer() {
      try {


       if (_krm != null) {
        _krm.cancel();
        _krm = null;
       }

       if (_ak != null) {
        _ak.cancel();
        _ak = null;
       }

       if (_as != null) {
        _as.cancel();
        _as = null;
       }

       if (_sb != null) {
        _sb.cancel();
        _sb = null;
       }

       if (_preliminary != null) {
        _preliminary.join();
        _preliminary = null;
       }

       if (_mw != null) {
        _mw.cancel();
        _mw = null;
       }

     

       if (_ov != null) {
        _ov.cancel();
        _ov = null;
       }


       if (_hq != null) {
        _hq.join();
        _hq = null;
       }


       if (_kp1 != null) {
        _kp1.join();
        _kp1 = null;
       }
       if (_kp2 != null) {
        _kp2.join();
        _kp2 = null;
       }
       if (_kp3 != null) {
        _kp3.join();
        _kp3 = null;
       }
       if (_kp4 != null) {
        _kp4.join();
        _kp4 = null;
       }

       if (_gs != null) {
        _gs.join();
        _gs = null;
       }
     
      } catch (final Exception ex) {
       ex.printStackTrace();
      }
     }

     

     public void lunkerDie(L1NpcInstance npc) throws InterruptedException {
      boolean kerenisSpawn = false;
      boolean guestSpawn = false;
      if (!isKerenisAngry()) {
       kerenisSpawn = true;
      } else {
       if (isHardMode()) {
        kerenisSpawn = true;
       }
      }
      if (isHardMode()) {
       guestSpawn = true;
      }

      if (kerenisSpawn) {
       if (npc.getNpcId() == 91295 || npc.getNpcId() == 91296) {
        boolean find = false;
        for (L1Object obj : L1World.getInstance().getVisiblePoint(
          getLocation(), 15)) {
         if (obj instanceof L1MonsterInstance) {
          if (((L1MonsterInstance) obj).getNpcId() == 91290
            || ((L1MonsterInstance) obj).getNpcId() == 91294) {
           if (!((L1MonsterInstance) obj).isDead()) {
            find = true;
           }
           break;
          }
         }
        }
        if (find) {
         BossEndTalks bet = new BossEndTalks(1, _Hardin, _Kerenis);
         bet.begin();
        } else {
         if (guestSpawn) {
          _gs = new GuestSpawn();
          GeneralThreadPool.getInstance().execute(_gs);
         }
         _mw = new moveWall();
         _mw.begin();
        }
       } else {
        boolean find = false;
        for (L1Object obj : L1World.getInstance().getVisiblePoint(
          getLocation(), 15)) {
         if (obj instanceof L1MonsterInstance) {
          if (((L1MonsterInstance) obj).getNpcId() == 91295
            || ((L1MonsterInstance) obj).getNpcId() == 91296) {
           if (!((L1MonsterInstance) obj).isDead()) {
            find = true;
           }
           break;
          }
         }
        }
        if (find) {
         BossEndTalks bet = new BossEndTalks(2, _Hardin, _Kerenis);
         bet.begin();
        } else {
         if (guestSpawn) {
          _gs = new GuestSpawn();
          GeneralThreadPool.getInstance().execute(_gs);
         }
         _mw = new moveWall();
         _mw.begin();
        }
       }
      } else {
       if (guestSpawn) {
        _gs = new GuestSpawn();
        GeneralThreadPool.getInstance().execute(_gs);
       }
       _mw = new moveWall();
       _mw.begin();
      }
     }
     
     private void setItemEffect(L1ItemInstance item, int type){
      if(type == 0){
       item.setIsHaste(true) ;
      }else if(type == 1){
       item.setMr(5) ;
      }else if(type == 2){
       item.setHitModifier(1) ;
      }else if(type == 3){
       item.setBowHitModifier(1) ;
      }else if(type == 4){
       item.setDmgModifier(1) ;
       item.setBowDmgModifier(1);
      }else if(type == 5){
       item.setSp(1) ;
      }else if(type == 6){
       item.setHpr(1) ;
      }else if(type == 7){
       item.setMpr(1) ; ;
      }
     }

     

     public void onBlackRune() throws InterruptedException {
     
      if (isBlackRuneTrodAlready()) {
       return;
      }
      sendShockWave();
      setBlackRuneTrodAlready(true);
      final int mapId = getMapId();
      int starItem = 0;
      int player_cnt = 0;
      for (int i = 0; i < getOnPlayerList().length; i++) {
       if (getOnPlayerList()[i] != 0) {
        player_cnt++;
       }
      }
     
      if (player_cnt != 0) {
       if(player_cnt <= 4){
        starItem = 21156;
       }else if(player_cnt == 5){
        starItem = 21157;
       }else if(player_cnt == 6){
        starItem = 21158;
       }else if(player_cnt >= 7){
        starItem = 21159;
       }
      }
     
      final L1Location loc = new L1Location(32802, 32868, mapId);
      for (final L1Object obj : L1World.getInstance().getVisiblePoint(loc, 0)) {
       if (obj instanceof L1PcInstance) {
        L1ItemInstance item = L1World.getInstance().getInventory(loc).storeItem(starItem,1);
        final RandomGenerator random = RandomGeneratorFactory.getSharedRandom();
        final int rnd = random.nextInt(8);
        setItemEffect(item, rnd);
       }
      }
     
      loc.set(32806, 32863, mapId);
      for (final L1Object obj : L1World.getInstance().getVisiblePoint(loc, 0)) {
       if (obj instanceof L1PcInstance) {
        for (int i = 0; i < getOnPlayerList().length; i++) {
         if (obj.getId() == getOnPlayerList()[i]) {
          L1ItemInstance item = L1World.getInstance().getInventory(loc).storeItem(starItem, 1);
          setItemEffect(item,getRandomRuneEffect(i + 1) - 1);
         }
        }
       }
      }

      loc.set(32808, 32864, mapId);
      for (final L1Object obj : L1World.getInstance().getVisiblePoint(loc, 0)) {
       if (obj instanceof L1PcInstance) {
        for (int i = 0; i < getOnPlayerList().length; i++) {
         if (obj.getId() == getOnPlayerList()[i]) {
          L1ItemInstance item =  L1World.getInstance().getInventory(loc).storeItem(starItem, 1);
          setItemEffect(item,getRandomRuneEffect(i + 1) - 1);
         }

        }
       }
      }

      loc.set(32800, 32864, mapId);
      for (final L1Object obj : L1World.getInstance().getVisiblePoint(loc, 0)) {
       if (obj instanceof L1PcInstance) {
        for (int i = 0; i < getOnPlayerList().length; i++) {
         if (obj.getId() == getOnPlayerList()[i]) {
          L1ItemInstance item =  L1World.getInstance().getInventory(loc).storeItem(starItem, 1);
          setItemEffect(item,getRandomRuneEffect(i + 1) - 1);
         }
        }
       }
      }

      loc.set(32799, 32866, mapId);
      for (final L1Object obj : L1World.getInstance().getVisiblePoint(loc, 0)) {
       if (obj instanceof L1PcInstance) {
        for (int i = 0; i < getOnPlayerList().length; i++) {
         if (obj.getId() == getOnPlayerList()[i]) {
          L1ItemInstance item =  L1World.getInstance().getInventory(loc).storeItem(starItem, 1);
          setItemEffect(item,getRandomRuneEffect(i + 1) - 1);
         }
        }
       }
      }

      loc.set(32807, 32870, mapId);
      for (final L1Object obj : L1World.getInstance().getVisiblePoint(loc, 0)) {
       if (obj instanceof L1PcInstance) {
        for (int i = 0; i < getOnPlayerList().length; i++) {
         if (obj.getId() == getOnPlayerList()[i]) {
          L1ItemInstance item =  L1World.getInstance().getInventory(loc).storeItem(starItem, 1);
          setItemEffect(item,getRandomRuneEffect(i + 1) - 1);
         }
        }
       }
      }

      loc.set(32806, 32872, mapId);
      for (final L1Object obj : L1World.getInstance().getVisiblePoint(loc, 0)) {
       if (obj instanceof L1PcInstance) {
        for (int i = 0; i < getOnPlayerList().length; i++) {
         if (obj.getId() == getOnPlayerList()[i]) {
          L1ItemInstance item =  L1World.getInstance().getInventory(loc).storeItem(starItem, 1);
          setItemEffect(item,getRandomRuneEffect(i + 1) - 1);
         }
        }
       }
      }

      loc.set(32798, 32872, mapId);
      for (final L1Object obj : L1World.getInstance().getVisiblePoint(loc, 0)) {
       if (obj instanceof L1PcInstance) {
        for (int i = 0; i < getOnPlayerList().length; i++) {
         if (obj.getId() == getOnPlayerList()[i]) {
          L1ItemInstance item =  L1World.getInstance().getInventory(loc).storeItem(starItem, 1);
          setItemEffect(item,getRandomRuneEffect(i + 1) - 1);
         }
        }
       }
      }

      loc.set(32800, 32873, mapId);
      for (final L1Object obj : L1World.getInstance().getVisiblePoint(loc, 0)) {
       if (obj instanceof L1PcInstance) {
        for (int i = 0; i < getOnPlayerList().length; i++) {
         if (obj.getId() == getOnPlayerList()[i]) {
          L1ItemInstance item =  L1World.getInstance().getInventory(loc).storeItem(starItem, 1);
          setItemEffect(item,getRandomRuneEffect(i + 1) - 1);
         }
        }
       }
      }


      sendMessage("$8719", 0);
      Thread.sleep(30 * 1000);
      if (!isDeleteTransactionNow())
       outPushPlayer();// end();
     }

     /**
      * @throws InterruptedException
      */
     public void onFirstSwitch() throws InterruptedException {
      if (!isDeleteTransactionNow()) {
       sendShockWave();
       _kp2 = new KerenisPart2();
       GeneralThreadPool.getInstance().execute(_kp2);
      }

      if (getSwitchStatus(0) == 0) {
       setSwitchStatus(0, 1);
      }
      setAlreadyFirstSwitch(true);

      final L1Location loc = new L1Location(32744, 32932, getMapId());
      spawnOne(loc, 91326, 0);
      loc.set(32667, 32818, getMapId());
      spawnOne(loc, 91318, 0);

      sendMessage(_Hardin.getName() + " : $7621", 0);
      _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7621", 0));// 7621

      _ov = new orcVocabulary();
      _ov.begin();


      if (_leader.getMapId() == getMapId()) {
       _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep005"));
      }
      _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7623", 0));// //7623

      Thread.sleep(8000);
      if (getActionKerenis() == 1) {
       _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7564", 0));// 7564

      } else {
       if (getActionKerenis() == 2) {
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7572", 0));

       } else {// 0
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7624", 0));

       }
      }


      final int mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(85).getLeaderId();
      doSpawnGroup(_leader.getLocation(), mobGroupLeaderId, 85);


      _as = new assailantSpawn();
      _as.begin();
      _ak = new attackKerenis();
      _ak.begin();

     }


     public void onSecondSwitch() throws InterruptedException {
      if (!isDeleteTransactionNow()) {
       sendShockWave();
       _kp3 = new KerenisPart3();
       GeneralThreadPool.getInstance().execute(_kp3);
      }
      if (getSwitchStatus(1) == 0) {
       setSwitchStatus(1, 1);
      }
      setAlreadySecondSwitch(true);
      final L1Location loc = new L1Location(32740, 32928, getMapId());
      spawnOne(loc, 91326, 0);
      loc.set(32712, 32793, getMapId());
      spawnOne(loc, 81167, 0);
      loc.set(32703, 32791, getMapId());
      spawnOne(loc, 81167, 0);
      loc.set(32710, 32803, getMapId());
      spawnOne(loc, 81167, 0);
      loc.set(32703, 32800, getMapId());
      spawnOne(loc, 81167, 0);

      _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7629", 0));// 7629

      sendMessage(_Hardin.getName() + " : $7628", 0);
      _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7628", 0));// 7628

      if (_leader.getMapId() == getMapId()) {
       _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep006"));
      }
      _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7630", 0));// 7630

      setActionKerenisDirect(0);
      Thread.sleep(8000);
      final int mobGroupLeaderId = MobGroupTable.getInstance().getTemplate(85).getLeaderId();
      doSpawnGroup(_leader.getLocation(), mobGroupLeaderId, 85);
      if (getActionKerenis() == 1) {
       _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7565", 0));// 7565


      } else {
       if (getActionKerenis() == 2) {
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7573", 0));

       } else {// 0
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7631", 0));

       }
      }
     }

     /**
      * @throws InterruptedException
      */
     public void onThirdSwitch() throws InterruptedException {
      if (!isDeleteTransactionNow()) {
       _kp4 = new KerenisPart4();
       GeneralThreadPool.getInstance().execute(_kp4);
      }

      if (getSwitchStatus(2) == 0) {
       setSwitchStatus(2, 1);
      }
      setAlreadyPortal(true);
      final L1Location loc = new L1Location(32743, 32929, getMapId());
      spawnOne(loc, 91326, 0);


      loc.set(32787, 32821, getMapId());
      spawnOne(loc, 91318, 0);

      loc.set(32808, 32838, getMapId());
      spawnOne(loc, 91319, 0);

      setSwitch(loc, 53);

      sendMessage(_Hardin.getName() + " : $7635", 0);
      _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7635", 0));// 7635

      _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7636", 0));// 7636


      if (_leader.getMapId() == getMapId()) {
       _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_ep007"));
      }
      _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7637", 0));// 7637


      Thread.sleep(8000);

      if (getActionKerenis() == 1) {
       _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7566", 0));// 7566

      } else {
       if (getActionKerenis() == 2) {
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7574", 0));

       } else {// 0
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7638", 0));

       }
      }

      _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7639", 0));// 7639

     }


     private void outPushPlayer() {
      for (final L1PcInstance pc : L1World.getInstance().getAllPlayers())
      {
       if (pc.getMapId() == getMapId()) {
        final RandomGenerator random = RandomGeneratorFactory.getSharedRandom();
        final int rndx = random.nextInt(4);
        final int rndy = random.nextInt(4);
        final int locx = 32587 + rndx;
        final int locy = 32941 + rndy;
        final short mapid = 0;
        L1Teleport.teleport(pc, locx, locy, mapid, 5, true);
       }
      }
     }

     /**
      * @param door
      */
     private void removeDoor(L1DoorInstance door) {
      getAllDoors().remove(door);
      DoorTable.getInstance().deleteDoorByLocation(door.getLocation());
     }

     private void reset() {
      try {

       for (final L1Object obj : L1World.getInstance().getObject()) {
        if (obj.getMapId() == getMapId()) {
         if (obj instanceof L1FieldObjectInstance) {
          L1World.getInstance().removeVisibleObject(obj);
          L1World.getInstance().removeObject(obj);
         } else if (obj instanceof L1EffectInstance) {
          L1World.getInstance().removeVisibleObject(obj);
          L1World.getInstance().removeObject(obj);
         } else if (obj instanceof L1ItemInstance) {
          final L1Inventory groundInventory = L1World.getInstance().getInventory(
            obj.getX(), obj.getY(), obj.getMapId());
          groundInventory.deleteItem((L1ItemInstance) obj);
          L1World.getInstance().removeVisibleObject(obj);
          L1World.getInstance().removeObject(obj);
         } else if (obj instanceof L1DoorInstance) {
          removeDoor((L1DoorInstance) obj);
         } else if (obj instanceof L1NpcInstance) {
          ((L1NpcInstance) obj).deleteMe();
         }
        }
       }
       for (final L1TrapInstance obj : this.getTrapList()) {
        if (obj.getMapId() == getMapId()) {
         L1WorldTraps.getInstance().removeTrap(obj);
        }
       }
      } catch (final Exception e) {
       e.printStackTrace();
      }
     }

     /**
      * @param pattern
      * @param curRound
      * @throws InterruptedException
      */

     private void selectSpawn(int pattern, int curRound) throws InterruptedException {
      final int npcid[] = { 91274, 91275, 91276, 91277, 91278, 91279, 91280,
        91281, 91282, 91283, 91284, 91285, 91286, 91287, 91288, 91289,
        91292 };
     
      final RandomGenerator random = RandomGeneratorFactory.getSharedRandom();
      int startPoint = 0;
      int endPoint = 16;
      int delay = 0;
      final int X[] = { 32706, 32695, 32702, 32717, 32706 };
      final int Y[] = { 32836, 32847, 32855, 32847, 32846 };
      final L1Location loc = new L1Location();
      if (pattern == 2) {
       // if(pattern==3){
       // startPoint=12;
       // }else{
       startPoint = 9;
       endPoint = 14;
       // }
      } else if (pattern == 3) {
       // if(pattern==3){
       // startPoint=12;
       // }else{
       startPoint = 12;
       endPoint = 14;
       // }
      } else {
       endPoint = 6;
      }
      for (int i = 0; i < curRound - 1; i++) {
       if (getRoundStatus(i) == 1) {
        if (endPoint < 16) {
         startPoint++;
         endPoint++;
        } else {
         break;
        }
       }else if (getRoundStatus(i) == 2) {//slow
        if (startPoint > 0) {
         startPoint--;
         endPoint--;
        } else {
         break;
        }
       }else{//stop case : 3

       }

      }
      if (isBonusStage()) {
       int s = random.nextInt(4);
       for (L1PcInstance pc  :  L1World.getInstance().getAllPlayers()) {
        if (pc.getMapId() == getMapId()) {
         pc.sendPackets(new S_SkillSound(pc.getId(), 2028 + s));
         pc.broadcastPacket(new S_SkillSound(pc.getId(), 2028 + s));
        }
       }
      }
      for (int i = 0; startPoint + i <= endPoint; i++) {
       final int n = random.nextInt(5);
       loc.set(X[n] - 3 + random.nextInt(6), Y[n] - 3 + random.nextInt(6), getMapId());
       if (isBonusStage()) {

        spawnOneMob(loc, 91337);

       } else {
        spawnOneMob(loc, npcid[startPoint + random.nextInt(endPoint + 1 - startPoint)]);
       }
       delay += 500;
       Thread.sleep(500);
      }
      Thread.sleep(9000 - delay);
     }

     private void setBonusStage(boolean flag) {
      _bonusStage = flag;
     }

     private boolean isBonusStage() {
      return _bonusStage;
     }

     private boolean _bonusStage;


     /**
      * @param curRound
      * @throws InterruptedException
      */
     private void sendBossRoundMessage(int curRound) throws InterruptedException {
      if (curRound / 4 > 1) {
       sendMessage("$8706", 0);// blue
       Thread.sleep(3000);
       sendMessage("$8707", 0);// blue
      } else {
       sendMessage("$8704", 0);// blue
       Thread.sleep(3000);
       sendMessage("$8705", 0);// blue
      }
      _sb = new spawnBoss();
      _sb.begin();

     }


     private void sendCountDown() throws InterruptedException {

      Thread.sleep(4000);
      sendMessage("$7650", 0);
      Thread.sleep(4000);
      sendMessage("$7651", 0);
      Thread.sleep(4000);
     }

     
     private void sendMessage(String s, int cases) {
      if(cases==0){
       for (final L1PcInstance pc  :  L1World.getInstance().getAllPlayers()) {
        if (pc.getMapId() == this.getMapId()) {
         pc.sendPackets(new S_GreenMessage(s));
        }
       }
      }else if(cases==1){
       if (_leader.getMapId() == this.getMapId()) {
        _leader.sendPackets(new S_GreenMessage(s));
       }
      }else if(cases==2){
       for (final L1PcInstance pc  :  L1World.getInstance().getAllPlayers()) {
        if (pc.getMapId() == this.getMapId() && _leader.getId() != pc.getId()) {
         pc.sendPackets(new S_GreenMessage(s));
        }
       }
      }

     }


     private void sendShockWave() {
      for (final L1PcInstance pc  :  L1World.getInstance().getAllPlayers()) {
       if (pc.getMapId() == this.getMapId()) {
        pc.sendPackets(new S_ShockWave());
       }
      }
     }

     
     private void sendRoundMessage(int curRound) throws InterruptedException {
      final int MSGID = 8708;
      if ((curRound % 4 == 0) && (curRound != 12)) {
       Thread.sleep(5000);
       sendBossRoundMessage(curRound);
      } else {
       if (curRound != 12) {
        Thread.sleep(7000);
        sendMessage("$" + (MSGID + curRound
          - (int) (1 + Math.floor(curRound / 4))), 0);
        Thread.sleep(2000);
       } else {
        sendMessage("$7654", 0);
        Thread.sleep(15000);
        sendMessage("$8717", 0);
        sendShockWave();
        Thread.sleep(2000);
        _sb = new spawnBoss();
        _sb.begin();
       }
      }
     

     }

     
     private void sendSubRoundMessage(int curSubRound) {
      final int MSGID = 8689;
      if (getCurRound() != 12) {
       sendMessage("$" + (MSGID + curSubRound - 1), 0);
      }
     }

     
     public void sendWisperWindow(int type) {

      sendMessage("$8720",0);
     
      if (getMapId() == _leader.getMapId()) {
       if (type == 0) {
        _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_int00"));
       } else {
        final String[] EffectBase = { "$8681", "$8682", "$8685",
          "$8686", "$8683", "$8684", "$8687", "$8688" };
         
        if (type == 1) {
         final String[] EffectType = { EffectBase[(getRandomRuneEffect(1) - 1)]};
         _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_int01", EffectType));
        } else if (type == 2) {
         final String[] EffectType = { EffectBase[(getRandomRuneEffect(3) - 1)]};
         _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_int02", EffectType));
        } else if (type == 3) {
         final String[] EffectType = { EffectBase[(getRandomRuneEffect(6) - 1)]};
         _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_int03", EffectType));
        } else if (type == 4) {
         final String[] EffectType = { EffectBase[(getRandomRuneEffect(7) - 1)]};
         _leader.sendPackets(new S_NpcTalkReturn(_leader.getId(), "j_int04", EffectType));
        }
       }
      }
     }

     

     private int searchCountMonster() {
      int mobCnt = 0;
      for (final L1Object obj : L1World.getInstance().getVisiblePoint(
        getLocation(), 13)) {
       if (obj instanceof L1MonsterInstance) {
        if (!((L1MonsterInstance) obj).isDead()) {
         mobCnt++;
        }
       }
      }
      return mobCnt;
     }

     
     private boolean searchRandomRuneEffect(int value, int[] tmp) {
      boolean result = true;
      for (int i = 0; i < tmp.length; i++) {
       if (value == tmp[i]) {
        result = false;
        break;
       }
      }
      return result;
     }

     
     public void setActionHardin(L1PcInstance pc, int actionCode) {
      if(pc.getId() == _leader.getId()){
       if (actionCode == 66) {// Alt+4
        actionCode = 2;
       } else {
        if (actionCode == 69) {// Alt+2
         actionCode = 1;
        } else {
         return;
        }
       }
       _actionHardin = actionCode;
      }
     }

     
     public void setActionKerenis(L1PcInstance pc,int actionCode) {
      if(pc.getId() == _leader.getId()){
       if (actionCode == 66) {// Alt+4
        actionCode = 2;
       } else {
        if (actionCode == 69) {// Alt+2
         actionCode = 1;
        } else {
         return;//    }
       }
       setReceiveAllAction(getReceiveAllAction() | true);

       _actionKerenis = actionCode;
      }

     }

     public void setActionHardinDirect(int actionCode) {
      _actionHardin = actionCode;
     }

     public void setActionKerenisDirect(int actionCode) {
      _actionKerenis = actionCode;
     }

     private void setActive(boolean active) {
      _active = active;
     }

     private void setAlreadyFirstSwitch(boolean firstSwitch) {
      _alreadyFirstSwitch = firstSwitch;
     }

     private void setAlreadyGuardManDeath(boolean guradManDeath) {
      _alreadyGuardManDeath = guradManDeath;
     }

     

     private void setAlreadyPortal(boolean flag) {
      _alreadyPortal = flag;
     }

     private void setAlreadySecondSwitch(boolean secondSwitch) {
      _alreadySecondSwitch = secondSwitch;
     }

     

      if (!isBlackRuneCreated()) {
       final L1Location loc = new L1Location();
       loc.set(32802, 32868, _mapId);
       spawnOne(loc, 91338, 0);
       setSwitch(loc, 59);
       _blackRune = true;
      }
     }

     private void setBlackRuneTrodAlready(boolean trod) {
      _BlackRuneTrodAlready = trod;
     }

    ////////라운드

     private void setCurRound(int curRound) {
      _curRound = curRound;
     }

     private void setDeleteTransactionNow(boolean transactionNow) {
      _deleteTransactionNow = transactionNow;

     }

    /////

    /////

     private void setKerenisAngry(boolean angry) {
      _kerenisAngry = angry;
     }

    ///////

    ///////

     private void setMapId(short mapId) {
      _mapId = mapId;
     }

    ////

    ////

     private void setOnPlayerList(int[] onPlayerList) {
      _onPlayerList = onPlayerList;
     }

     

    /////

    /////

     private void setRandomRuneEffect(int i, int value) {
      _randomRuneEffect[i] = value;
     }

    //////

     

    /////

     private void setReceiveAllAction(boolean action) {
      _receiveAllAction = action;
     }

    //////////

    //////////

     private void setRoundStatus(int round, int value) {
      _roundStatus[round] = value;
     }

    //////////

    //////////

     private void setSwitch(L1Location loc, int id) {
      final int trapId = id;
      final L1Trap trapTemp = TrapTable.getInstance().getTemplate(trapId);
      final Point rndPt = new Point();
      rndPt.setX(0);
      rndPt.setY(0);
      final int span = 0;
      final L1TrapInstance trap = new L1TrapInstance(IdFactory.getInstance().nextId(),
        trapTemp, loc, rndPt, span);
      L1World.getInstance().addVisibleObject(trap);

      L1WorldTraps.getInstance().addTrap(trap);

      this.addTrapList(trap);
     }

    ///////

    //속계/

    ////// private void setSwitchStatus(int x, int status) {
      _switchStatus[x] = status;
     }

    ///////////

    여기도

    ///////////

     private L1NpcInstance spawnOne(L1Location loc, int npcid, int heading) {
      final L1NpcInstance mob = new L1NpcInstance(NpcTable.getInstance().getTemplate(npcid));
      if (mob == null) {
       _log.warning("mob == null");
       return mob;
      }

      mob.setId(IdFactory.getInstance().nextId());
      mob.setHeading(heading);
      mob.setX(loc.getX());
      mob.setHomeX(loc.getX());
      mob.setY(loc.getY());
      mob.setHomeY(loc.getY());
      mob.setMap((short) loc.getMapId());

      L1World.getInstance().storeObject(mob);
      L1World.getInstance().addVisibleObject(mob);

      final S_NpcPack S_NpcPack = new S_NpcPack(mob);
      for (final L1PcInstance pc : L1World.getInstance().getRecognizePlayer(mob)) {
       pc.addKnownObject(mob);
       mob.addKnownObject(pc);
       pc.sendPackets(S_NpcPack);
      }


      mob.onNpcAI();
      mob.updateLight();
      mob.startChat(L1NpcInstance.CHAT_TIMING_APPEARANCE);

      return mob;
     }

    ////

    위치부분

    /////

     private L1MonsterInstance spawnOneMob(L1Location loc, int npcid) {
      final L1MonsterInstance mob = new L1MonsterInstance(NpcTable.getInstance().getTemplate(npcid));
      if (mob == null) {
       _log.warning("mob == null");
       return mob;
      }

      mob.setId(IdFactory.getInstance().nextId());
      mob.setHeading(5);
      mob.setX(loc.getX());
      mob.setHomeX(loc.getX());
      mob.setY(loc.getY());
      mob.setHomeY(loc.getY());
      mob.setMap((short) loc.getMapId());
      mob.setStoreDroped(false);
      mob.setUbSealCount(0);

      L1World.getInstance().storeObject(mob);
      L1World.getInstance().addVisibleObject(mob);

      final S_NpcPack S_NpcPack = new S_NpcPack(mob);
      for (final L1PcInstance pc : L1World.getInstance().getRecognizePlayer(mob)) {
       pc.addKnownObject(mob);
       mob.addKnownObject(pc);
       pc.sendPackets(S_NpcPack);
      }
      mob.onNpcAI();
      mob.updateLight();
      // mob.startChat(L1NpcInstance.CHAT_TIMING_APPEARANCE);

      return mob;
     }

    //////////////

    //////////

     public void tereportEntrance(L1PcInstance pc, L1Location loc, int heading) {
      L1Teleport.teleport(pc, loc, heading, true);
     }

    //////////

    /////////

     public void start() {

      _preliminary = new Preliminary();
      _hqm = new HardinQuestMonitor();
      GeneralThreadPool.getInstance().execute(_preliminary);
      _hqm.begin();
     }

     public void checkLeaveGame(L1PcInstance pc) {
      if (pc.getMapId() == getMapId()) {
       final RandomGenerator random = RandomGeneratorFactory.getSharedRandom();
       final int rndx = random.nextInt(4);
       final int rndy = random.nextInt(4);
       final int locx = 32587 + rndx;
       final int locy = 32941 + rndy;
       final short mapid = 0;
       L1Teleport.teleport(pc, locx, locy, mapid, 5, false);
      }
     }
    }

    class BossEndTalks extends TimerTask {

     int _type;
     L1NpcInstance _Hardin;
     L1NpcInstance _Kerenis;
     BossEndTalks(int type,L1NpcInstance Hardin,L1NpcInstance Kerenis){//
      _type=type;
      _Hardin=Hardin;
      _Kerenis=Kerenis;
     }
     public void begin() {
      final Timer timer = new Timer();
      timer.schedule(this,0);
     }

     

    ////////////////////////

     @Override
     public void run() {
      try {
       if(_type==1){

        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7833", 0));
        Thread.sleep(2000);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7834", 0));


       }else if(_type==2){
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7827", 0));
        Thread.sleep(1000);
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7828", 0));
        Thread.sleep(1800);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7829", 0));
        Thread.sleep(1800);
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7830", 0));
        Thread.sleep(1000);
        _Hardin.broadcastPacket(new S_NpcChatPacket(_Hardin, "$7831", 0));
        Thread.sleep(1500);
        _Kerenis.broadcastPacket(new S_NpcChatPacket(_Kerenis, "$7832", 0));
       }
      } catch (InterruptedException e) {
       e.printStackTrace();
      }
     }

    }

    [출처] [일팩유저화이팅]하딘시스템 (비공개 카페)

    이 게시물을..
    N
    0
    0
    • 리마스터팩 요정 소울 엠피 수정jstory
    • 0
      준희미니

    준희미니 님의 최근 글

    [에바] 나비켓 테이블 관련 설명 761 1 2016 07.29 에바소스인데 오픈대기 켜고 끄는 소스에요~ 81 2016 07.29 퍼플채팅 색(진보라채팅) 68 2016 07.29 선택상자 2탄입니다!! 접속유지증표를 활용한 아템선택 160 2016 07.29 새로운 아이템 인첸트 시에 마법방어 올라가도록 설정하는 112 2016 07.29

    준희미니 님의 최근 댓글

    rt 2021 05.25 ㄳ 2021 05.11 ㄳ 2021 05.11 rt 2021 05.09 rt 2021 04.25
    글쓴이의 서명작성글 감추기 
    댓글 쓰기 에디터 사용하기 닫기
    • view_headline 목록
    • 14px
    • 리마스터팩 요정 소울 엠피 수정
    • 목록
      view_headline
    × CLOSE
    기본 (1,058) 제목 날짜 수정 조회 댓글 추천 비추
    분류 정렬 검색
    • 링크 업로드 관련 공지
      6
      2026.03.25 - 21:56 843 6
    • 인증메일 공지
      2
      2026.03.15 - 16:42 934 2
    • 파일링크 및 인증메일 발송 관련 문의 안내
      5
      2026.03.14 - 22:03 1154 5
    • 포인트 게시판 안내
      2026.02.28 - 19:14 1802
    • 게임존 사이트 변경 사항 안내
      9
      2026.02.26 - 01:07 3329 9
    • 소스자료는 직접 올려주세요
      2017.06.06 - 16:14 609
    1058
    아머브레이크 데스티니 시전시 성공 확률 조정하는 소스가 있나요?
    안정환 2024.04.23 - 10:01 135
    1057
    List.spr(변신,몬스터 수정소스)개조방법
    유튜브고도리 2024.04.19 - 05:02 354
    1056
    NPC 외침 멘트 깔끔정리(by.유튜브고도리)
    유튜브고도리 2024.04.11 - 05:57 158
    1055
    디아블로 참 만들기
    유튜브고도리 2024.04.09 - 05:55 151
    1054
    리니지m 처럼 피통 늘리기,오류가 날때
    유튜브고도리 2024.04.09 - 05:18 112
    1053
    욕하면 채금 먹게 하기
    유튜브고도리 2024.04.09 - 04:59 97
    1052
    레벨에 따른 호칭 부여..?
    밤톨이11 2024.04.08 - 04:24 89
    1051
    초보자 보호 시스템
    밤톨이11 2024.04.08 - 04:21 77
    1050
    마법무기 데미지 증가
    밤톨이11 2024.04.08 - 04:19 97
    1049
    레벨 제한 맵
    밤톨이11 2024.04.08 - 04:14 84
    1048
    마법스크롤
    밤톨이11 2024.04.08 - 04:06 41
    1047
    리니지m 아지트 소유중에도 공성선포하기
    유튜브고도리 2024.04.07 - 21:37 63
    1046
    리니지m 마법인형이 마법을 쓰네?
    유튜브고도리 2024.04.07 - 21:36 92
    1045
    드래곤 슬레이어 각반(장비추가소스)
    유튜브고도리 2024.04.07 - 19:08 79
    1044
    린엠 게렝 변신 카드 만들기
    유튜브고도리 2024.04.06 - 06:06 125
    1043
    버프 물약 개별 소스 오래전 소스
    밤톨이11 2024.04.05 - 18:43 76
    1042
    일시 스텟 상승 물약
    밤톨이11 2024.04.05 - 18:42 36
    1041
    성 전환 물약
    밤톨이11 2024.04.05 - 18:37 41
    1040
    MP 물약 소스
    밤톨이11 2024.04.05 - 18:35 58
    1039
    리니지 옛날버젼..이라는데...구동가능여부 확인 부탁드립니다.
    도난차량 2024.03.24 - 04:56 414
    1038
    랭커
    foqwer 2024.03.14 - 10:43 156
    1037
    인첸별
    foqwer 2024.03.14 - 10:42 132
    1036
    몬스터 앞에 레벨 넣기
    프렌치좋아 2024.03.04 - 01:40 403
    1035
    3.63 글루딘 Single 용
    블루블랙3 2024.02.28 - 23:08 439
    1034
    Sprite file doesn`t exist 오류
    하앙비 2023.12.23 - 02:19 254
    1033
    전쟁세율 고정값 15%
    하남궁 2023.11.29 - 17:02 218
    1032
    인형합성사
    Rebecca 2023.10.09 - 22:54 359
    1031
    2.0 레벨업시 HP량 올리기
    Rebecca 2023.10.09 - 22:49 453
    1030
    전사버전 펫 만렙 변경
    Rebecca 2023.10.09 - 22:44 170
    1029
    맵 순간이동 가능 불가능지역 설정하기
    Rebecca 2023.10.09 - 22:39 252
    1028
    트레져박스 업로드입니다.
    린컴충성 2023.10.07 - 04:46 195
    1027
    리마스터 접속기 소스자료
    홍자놀기 2023.09.08 - 05:41 2365
    1026
    대미지 발동시 범위 질문드립니다
    나잇따나읻따 2023.05.21 - 22:26 313
    1025
    리니지 리마스터 몹 스폰수 어디서 줄일 수 있나요?
    001001 2023.04.25 - 16:06 756
    1024
    전사팩 로봇가능
    노력하자 2023.03.16 - 19:14 1132
    1023
    2.7 자동 물약 소스
    퍽퍽띠 2022.11.18 - 00:40 1251
    1022
    2.0 자동칼질소스 (클래스 파일에서 빼왔습니다)
    drumlinek 2022.11.06 - 05:20 961
    1021
    npc가 인겜에서 채팅으로 말하기
    하늘마음 2022.10.06 - 10:04 339
    1020
    유저 아이피보는 소스
    캐빈N.01 2020.12.15 - 21:34 655
    1019
    인공지능
    캐빈N.01 2020.12.15 - 21:27 1145
    1018
    아데나가 19억이 되면 자동으로 1억으로 금괴로 바꾸기
    강우리 2020.12.12 - 01:48 1014
    1017
    린올기반 휘장 각반 견갑 장비인식 안되는거 수정함
    신화서버 2020.11.17 - 01:48 306
    1016
    방어구 인챈트별 피 증가 소스
    LGTwins 2020.09.12 - 05:52 699
    1015
    장신구 옵션 변경
    LGTwins 2020.08.31 - 07:00 766
    1014
    자동물약
    legena 2020.07.05 - 02:30 2136
    1013
    리마스터팩 스냅퍼 개방 레벨설정 본섭화 수정(몽양님 요청)
    jstory 2020.06.13 - 07:22 777
    1012
    리마스터팩 룬마력제거 검사 적용안대는 부분 수정
    jstory 2020.06.10 - 04:05 296
    1011
    리마스터팩 쓸모없는 아이템 활용
    jstory 2020.06.10 - 04:01 746
    1010
    리마스터팩 요정 소울 엠피 수정
    jstory 2020.06.10 - 03:54 471
    1009
    리마스터팩 자동공지시간에 버프주기
    jstory 2020.06.10 - 03:15 412
    • 1 2 3 4 5 6 7 8 9 10 .. 22
    • / 22 GO
  • GAMEZONE
 GAMEZONE all rights reserved.
by OrangeDay