Ejemplo n.º 1
0
 /** Notify started */
 @Override
 public void onStart() {
   for (L2Effect e : getEffector().getAllEffects())
     if (e.getEffectType() == EffectType.IMMOBILE && e != this) {
       e.exit();
     }
   getEffector().setIsImobilised(true);
 }
Ejemplo n.º 2
0
 @Override
 public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet) {
   int npcId = npc.getNpcId();
   if (npcId == ZAKEN) {
     if (attacker.getMountType() == 1) {
       int sk_4258 = 0;
       L2Effect[] effects = attacker.getAllEffects();
       if (effects != null && effects.length != 0) {
         for (L2Effect e : effects) {
           if (e.getSkill().getId() == 4258) {
             sk_4258 = 1;
           }
         }
       }
       if (sk_4258 == 0) {
         npc.setTarget(attacker);
         npc.doCast(SkillTable.getInstance().getInfo(4258, 1));
       }
     }
     L2Character originalAttacker = isPet ? attacker.getPet() : attacker;
     int hate = (int) (((damage / npc.getMaxHp()) / 0.05) * 20000);
     ((L2Attackable) npc).addDamageHate(originalAttacker, 0, hate);
     if (Rnd.get(10) < 1) {
       int i0 = Rnd.get((15 * 15));
       if (i0 < 1) {
         npc.setTarget(attacker);
         npc.doCast(SkillTable.getInstance().getInfo(4216, 1));
       } else if (i0 < 2) {
         npc.setTarget(attacker);
         npc.doCast(SkillTable.getInstance().getInfo(4217, 1));
       } else if (i0 < 4) {
         npc.setTarget(attacker);
         npc.doCast(SkillTable.getInstance().getInfo(4219, 1));
       } else if (i0 < 8) {
         npc.setTarget(attacker);
         npc.doCast(SkillTable.getInstance().getInfo(4218, 1));
       } else if (i0 < 15) {
         for (L2Character character : npc.getKnownList().getKnownCharactersInRadius(100)) {
           if (character != attacker) continue;
           if (attacker != ((L2Attackable) npc).getMostHated()) {
             npc.setTarget(attacker);
             npc.doCast(SkillTable.getInstance().getInfo(4221, 1));
           }
         }
       }
       if (Rnd.get(2) < 1) {
         if (attacker == ((L2Attackable) npc).getMostHated()) {
           npc.setTarget(attacker);
           npc.doCast(SkillTable.getInstance().getInfo(4220, 1));
         }
       }
     }
     if (getTimeHour() < 5) {
     } else if (npc.getCurrentHp() < ((npc.getMaxHp() * _quest2) / 4.0)) {
       _quest2 = (_quest2 - 1);
       int i2 = Rnd.get(15);
       _ai1 = Xcoords[i2] + Rnd.get(650);
       _ai2 = Ycoords[i2] + Rnd.get(650);
       _ai3 = Zcoords[i2];
       npc.setTarget(npc);
       npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
     }
   }
   return super.onAttack(npc, attacker, damage, isPet);
 }
Ejemplo n.º 3
0
  @Override
  public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player) {
    Integer status = GrandBossManager.getInstance().getBossStatus(ZAKEN);

    if (status == DEAD && !event.equalsIgnoreCase("zaken_unlock"))
      return super.onAdvEvent(event, npc, player);

    if (event.equalsIgnoreCase("1001")) {
      if (_1001 == 1) {
        _1001 = 0;
        cancelQuestTimer("1001", npc, null);
      }
      int sk_4223 = 0;
      int sk_4227 = 0;
      L2Effect[] effects = npc.getAllEffects();
      if (effects != null && effects.length != 0) {
        for (L2Effect e : effects) {
          if (e.getSkill().getId() == 4227) {
            sk_4227 = 1;
          }
          if (e.getSkill().getId() == 4223) {
            sk_4223 = 1;
          }
        }
      }
      if (getTimeHour() < 5) {
        if (sk_4223 == 1) // use night face if zaken have day face
        {
          npc.setTarget(npc);
          npc.doCast(SkillTable.getInstance().getInfo(4224, 1));
          _ai1 = npc.getX();
          _ai2 = npc.getY();
          _ai3 = npc.getZ();
        }
        if (sk_4227 == 0) // use zaken regeneration
        {
          npc.setTarget(npc);
          npc.doCast(SkillTable.getInstance().getInfo(4227, 1));
        }
        if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK && _ai0 == 0) {
          int i0 = 0;
          int i1 = 1;
          if (((L2Attackable) npc).getMostHated() != null) {
            if ((((((L2Attackable) npc).getMostHated().getX() - _ai1)
                        * (((L2Attackable) npc).getMostHated().getX() - _ai1))
                    + ((((L2Attackable) npc).getMostHated().getY() - _ai2)
                        * (((L2Attackable) npc).getMostHated().getY() - _ai2)))
                > (1500 * 1500)) i0 = 1;
            else i0 = 0;
            if (i0 == 0) i1 = 0;
            if (_quest0 > 0) {
              if (c_quest0 == null) i0 = 0;
              else if ((((c_quest0.getX() - _ai1) * (c_quest0.getX() - _ai1))
                      + ((c_quest0.getY() - _ai2) * (c_quest0.getY() - _ai2)))
                  > (1500 * 1500)) i0 = 1;
              else i0 = 0;
              if (i0 == 0) i1 = 0;
            }
            if (_quest0 > 1) {
              if (c_quest1 == null) i0 = 0;
              else if ((((c_quest1.getX() - _ai1) * (c_quest1.getX() - _ai1))
                      + ((c_quest1.getY() - _ai2) * (c_quest1.getY() - _ai2)))
                  > (1500 * 1500)) i0 = 1;
              else i0 = 0;
              if (i0 == 0) i1 = 0;
            }
            if (_quest0 > 2) {
              if (c_quest2 == null) i0 = 0;
              else if ((((c_quest2.getX() - _ai1) * (c_quest2.getX() - _ai1))
                      + ((c_quest2.getY() - _ai2) * (c_quest2.getY() - _ai2)))
                  > (1500 * 1500)) i0 = 1;
              else i0 = 0;
              if (i0 == 0) i1 = 0;
            }
            if (_quest0 > 3) {
              if (c_quest3 == null) i0 = 0;
              else if ((((c_quest3.getX() - _ai1) * (c_quest3.getX() - _ai1))
                      + ((c_quest3.getY() - _ai2) * (c_quest3.getY() - _ai2)))
                  > (1500 * 1500)) i0 = 1;
              else i0 = 0;
              if (i0 == 0) i1 = 0;
            }
            if (_quest0 > 4) {
              if (c_quest4 == null) i0 = 0;
              else if ((((c_quest4.getX() - _ai1) * (c_quest4.getX() - _ai1))
                      + ((c_quest4.getY() - _ai2) * (c_quest4.getY() - _ai2)))
                  > (1500 * 1500)) i0 = 1;
              else i0 = 0;
              if (i0 == 0) i1 = 0;
            }
            if (i1 == 1) {
              _quest0 = 0;
              int i2 = Rnd.get(15);
              _ai1 = Xcoords[i2] + Rnd.get(650);
              _ai2 = Ycoords[i2] + Rnd.get(650);
              _ai3 = Zcoords[i2];
              npc.setTarget(npc);
              npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
            }
          }
        }
        if (Rnd.get(20) < 1 && _ai0 == 0) {
          _ai1 = npc.getX();
          _ai2 = npc.getY();
          _ai3 = npc.getZ();
        }
        L2Character c_ai0 = null;
        if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK && _quest1 == 0) {
          if (((L2Attackable) npc).getMostHated() != null) {
            c_ai0 = ((L2Attackable) npc).getMostHated();
            _quest1 = 1;
          }
        } else if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK
            && _quest1 != 0) {
          if (((L2Attackable) npc).getMostHated() != null) {
            if (c_ai0 == ((L2Attackable) npc).getMostHated()) {
              _quest1 = (_quest1 + 1);
            } else {
              _quest1 = 1;
              c_ai0 = ((L2Attackable) npc).getMostHated();
            }
          }
        }
        if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE) {
          _quest1 = 0;
        }
        if (_quest1 > 5) {
          ((L2Attackable) npc).stopHating(c_ai0);
          L2Character nextTarget = ((L2Attackable) npc).getMostHated();
          if (nextTarget != null)
            npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
          _quest1 = 0;
        }
      } else if (sk_4223 == 0) // use day face if not night time
      {
        npc.setTarget(npc);
        npc.doCast(SkillTable.getInstance().getInfo(4223, 1));
        _quest2 = 3;
      }
      if (sk_4227 == 1) // when switching to day time, cancel zaken night regen
      {
        npc.setTarget(npc);
        npc.doCast(SkillTable.getInstance().getInfo(4242, 1));
      }
      if (Rnd.get(40) < 1) {
        int i2 = Rnd.get(15);
        _ai1 = Xcoords[i2] + Rnd.get(650);
        _ai2 = Ycoords[i2] + Rnd.get(650);
        _ai3 = Zcoords[i2];
        npc.setTarget(npc);
        npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
      }
      startQuestTimer("1001", 30000, npc, null);
    }
    if (event.equalsIgnoreCase("1002")) {
      _quest0 = 0;
      npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
      _ai0 = 0;
    }
    if (event.equalsIgnoreCase("1003")) {
      if (_ai4 == 1) {
        int rr = Rnd.get(15);
        addSpawn(
            pirates_zombie_captain_b,
            Xcoords[rr] + Rnd.get(650),
            Ycoords[rr] + Rnd.get(650),
            Zcoords[rr],
            Rnd.get(65536),
            false,
            0);
        _ai4 = 2;
        startQuestTimer("1003", 1700, null, null);
      } else if (_ai4 == 2) {
        int rr = Rnd.get(15);
        addSpawn(
            doll_blader_b,
            Xcoords[rr] + Rnd.get(650),
            Ycoords[rr] + Rnd.get(650),
            Zcoords[rr],
            Rnd.get(65536),
            false,
            0);
        _ai4 = 3;
        startQuestTimer("1003", 1700, null, null);
      } else if (_ai4 == 3) {
        addSpawn(
            vale_master_b,
            Xcoords[Rnd.get(15)] + Rnd.get(650),
            Ycoords[Rnd.get(15)] + Rnd.get(650),
            Zcoords[Rnd.get(15)],
            Rnd.get(65536),
            false,
            0);
        addSpawn(
            vale_master_b,
            Xcoords[Rnd.get(15)] + Rnd.get(650),
            Ycoords[Rnd.get(15)] + Rnd.get(650),
            Zcoords[Rnd.get(15)],
            Rnd.get(65536),
            false,
            0);
        _ai4 = 4;
        startQuestTimer("1003", 1700, null, null);
      } else if (_ai4 == 4) {
        addSpawn(
            pirates_zombie_b,
            Xcoords[Rnd.get(15)] + Rnd.get(650),
            Ycoords[Rnd.get(15)] + Rnd.get(650),
            Zcoords[Rnd.get(15)],
            Rnd.get(65536),
            false,
            0);
        addSpawn(
            pirates_zombie_b,
            Xcoords[Rnd.get(15)] + Rnd.get(650),
            Ycoords[Rnd.get(15)] + Rnd.get(650),
            Zcoords[Rnd.get(15)],
            Rnd.get(65536),
            false,
            0);
        addSpawn(
            pirates_zombie_b,
            Xcoords[Rnd.get(15)] + Rnd.get(650),
            Ycoords[Rnd.get(15)] + Rnd.get(650),
            Zcoords[Rnd.get(15)],
            Rnd.get(65536),
            false,
            0);
        addSpawn(
            pirates_zombie_b,
            Xcoords[Rnd.get(15)] + Rnd.get(650),
            Ycoords[Rnd.get(15)] + Rnd.get(650),
            Zcoords[Rnd.get(15)],
            Rnd.get(65536),
            false,
            0);
        addSpawn(
            pirates_zombie_b,
            Xcoords[Rnd.get(15)] + Rnd.get(650),
            Ycoords[Rnd.get(15)] + Rnd.get(650),
            Zcoords[Rnd.get(15)],
            Rnd.get(65536),
            false,
            0);
        _ai4 = 5;
        startQuestTimer("1003", 1700, null, null);
      } else if (_ai4 == 5) {
        addSpawn(doll_blader_b, 52675, 219371, -3290, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 52687, 219596, -3368, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 52672, 219740, -3418, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 52857, 219992, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 52959, 219997, -3488, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 53381, 220151, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 54236, 220948, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 54885, 220144, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55264, 219860, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 55399, 220263, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55679, 220129, -3488, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 56276, 220783, -3488, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 57173, 220234, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 56267, 218826, -3488, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 56294, 219482, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 56094, 219113, -3488, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 56364, 218967, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 57113, 218079, -3488, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 56186, 217153, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55440, 218081, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 55202, 217940, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55225, 218236, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 54973, 218075, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 53412, 218077, -3488, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 54226, 218797, -3488, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 54394, 219067, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 54139, 219253, -3488, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 54262, 219480, -3488, Rnd.get(65536), false, 0);
        _ai4 = 6;
        startQuestTimer("1003", 1700, null, null);
      } else if (_ai4 == 6) {
        addSpawn(pirates_zombie_b, 53412, 218077, -3488, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 54413, 217132, -3488, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 54841, 217132, -3488, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 55372, 217128, -3343, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 55893, 217122, -3488, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 56282, 217237, -3216, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 56963, 218080, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 56267, 218826, -3216, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 56294, 219482, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 56094, 219113, -3216, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 56364, 218967, -3216, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 56276, 220783, -3216, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 57173, 220234, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 54885, 220144, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55264, 219860, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 55399, 220263, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55679, 220129, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 54236, 220948, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 54464, 219095, -3216, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 54226, 218797, -3216, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 54394, 219067, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 54139, 219253, -3216, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 54262, 219480, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 53412, 218077, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55440, 218081, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 55202, 217940, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55225, 218236, -3216, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 54973, 218075, -3216, Rnd.get(65536), false, 0);
        _ai4 = 7;
        startQuestTimer("1003", 1700, null, null);
      } else if (_ai4 == 7) {
        addSpawn(pirates_zombie_b, 54228, 217504, -3216, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 54181, 217168, -3216, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 54714, 217123, -3168, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 55298, 217127, -3073, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 55787, 217130, -2993, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 56284, 217216, -2944, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 56963, 218080, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 56267, 218826, -2944, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 56294, 219482, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 56094, 219113, -2944, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 56364, 218967, -2944, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 56276, 220783, -2944, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 57173, 220234, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 54885, 220144, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55264, 219860, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 55399, 220263, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55679, 220129, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 54236, 220948, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 54464, 219095, -2944, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 54226, 218797, -2944, Rnd.get(65536), false, 0);
        addSpawn(vale_master_b, 54394, 219067, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 54139, 219253, -2944, Rnd.get(65536), false, 0);
        addSpawn(doll_blader_b, 54262, 219480, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 53412, 218077, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 54280, 217200, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55440, 218081, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_captain_b, 55202, 217940, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 55225, 218236, -2944, Rnd.get(65536), false, 0);
        addSpawn(pirates_zombie_b, 54973, 218075, -2944, Rnd.get(65536), false, 0);
        _ai4 = 8;
        cancelQuestTimer("1003", null, null);
      }
    } else if (event.equalsIgnoreCase("zaken_unlock")) {
      L2GrandBossInstance zaken =
          (L2GrandBossInstance) addSpawn(ZAKEN, 55312, 219168, -3223, 0, false, 0);
      GrandBossManager.getInstance().setBossStatus(ZAKEN, ALIVE);
      spawnBoss(zaken);
    } else if (event.equalsIgnoreCase("CreateOnePrivateEx")) {
      addSpawn(npc.getNpcId(), npc.getX(), npc.getY(), npc.getZ(), 0, false, 0);
    }
    return super.onAdvEvent(event, npc, player);
  }