Ejemplo n.º 1
0
  private void teleportTo(L2PcInstance activeChar, String Cords) {
    try {
      StringTokenizer st = new StringTokenizer(Cords);
      String x1 = st.nextToken();

      int x = Integer.parseInt(x1);

      String y1 = st.nextToken();

      int y = Integer.parseInt(y1);

      String z1 = st.nextToken();

      int z = Integer.parseInt(z1);

      activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
      activeChar.teleToLocation(x, y, z, false);

      SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
      sm.addString("You have been teleported to " + Cords);
      activeChar.sendPacket(sm);

      sm = null;
      x1 = null;
      y1 = null;
      z1 = null;
      st = null;
    } catch (NoSuchElementException nsee) {
      activeChar.sendMessage("Wrong or no Coordinates given.");
    }
  }
Ejemplo n.º 2
0
  /**
   * @param player
   * @param x
   * @param y
   * @param z
   */
  private void teleportCharacter(L2PcInstance player, int x, int y, int z) {
    if (player != null) {
      // Common character information
      player.sendMessage("Admin is teleporting you.");

      player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
      player.teleToLocation(x, y, z);
    }
  }
Ejemplo n.º 3
0
 @Override
 public String onAggroRangeEnter(L2NpcInstance npc, L2PcInstance player, boolean isPet) {
   int npcId = npc.getNpcId();
   if (npcId == ZAKEN) {
     if (_Zone.isInsideZone(npc)) {
       L2Character target = isPet ? player.getPet() : player;
       ((L2Attackable) npc).addDamageHate(target, 1, 200);
     }
     if (player.getZ() > (npc.getZ() - 100) && player.getZ() < (npc.getZ() + 100)) {
       if (_quest0 < 5 && Rnd.get(3) < 1) {
         if (_quest0 == 0) {
           c_quest0 = player;
         } else if (_quest0 == 1) {
           c_quest1 = player;
         } else if (_quest0 == 2) {
           c_quest2 = player;
         } else if (_quest0 == 3) {
           c_quest3 = player;
         } else if (_quest0 == 4) {
           c_quest4 = player;
         }
         _quest0++;
       }
       if (Rnd.get(15) < 1) {
         int i0 = Rnd.get((15 * 15));
         if (i0 < 1) {
           npc.setTarget(player);
           npc.doCast(SkillTable.getInstance().getInfo(4216, 1));
         } else if (i0 < 2) {
           npc.setTarget(player);
           npc.doCast(SkillTable.getInstance().getInfo(4217, 1));
         } else if (i0 < 4) {
           npc.setTarget(player);
           npc.doCast(SkillTable.getInstance().getInfo(4219, 1));
         } else if (i0 < 8) {
           npc.setTarget(player);
           npc.doCast(SkillTable.getInstance().getInfo(4218, 1));
         } else if (i0 < 15) {
           for (L2Character character : npc.getKnownList().getKnownCharactersInRadius(100)) {
             if (character != player) continue;
             if (player != ((L2Attackable) npc).getMostHated()) {
               npc.setTarget(player);
               npc.doCast(SkillTable.getInstance().getInfo(4221, 1));
             }
           }
         }
         if (Rnd.get(2) < 1) {
           if (player == ((L2Attackable) npc).getMostHated()) {
             npc.setTarget(player);
             npc.doCast(SkillTable.getInstance().getInfo(4220, 1));
           }
         }
       }
     }
   }
   return super.onAggroRangeEnter(npc, player, isPet);
 }
Ejemplo n.º 4
0
  @Override
  protected final void writeImpl() {
    if (getClient().getActiveChar() == null) return;

    for (PartyMatchRoom room : PartyMatchRoomList.getInstance().getRooms()) {
      if (room.getMembersCount() < 1
          || room.getOwner() == null
          || room.getOwner().isOnline() == 0
          || room.getOwner().getPartyRoom() != room.getId()) {
        PartyMatchRoomList.getInstance().deleteRoom(room.getId());
        continue;
      }
      if (_loc > 0 && _loc != room.getLocation()) continue;
      if (_lim == 0
          && ((_cha.getLevel() < room.getMinLvl()) || (_cha.getLevel() > room.getMaxLvl())))
        continue;
      _rooms.add(room);
    }
    int count = 0;
    int size = _rooms.size();

    writeC(0x96);
    if (size > 0) writeD(1);
    else writeD(0);

    writeD(_rooms.size());
    while (size > count) {
      writeD(_rooms.get(count).getId());
      writeS(_rooms.get(count).getTitle());
      writeD(_rooms.get(count).getLocation());
      writeD(_rooms.get(count).getMinLvl());
      writeD(_rooms.get(count).getMaxLvl());
      writeD(_rooms.get(count).getMembersCount());
      writeD(_rooms.get(count).getMaxMembers());
      writeS(_rooms.get(count).getOwner().getName());
      count++;
    }
  }
Ejemplo n.º 5
0
  private void showTeleportCharWindow(L2PcInstance activeChar) {
    L2Object target = activeChar.getTarget();
    L2PcInstance player = null;

    if (target.isPlayer) {
      player = (L2PcInstance) target;
    } else {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      return;
    }

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

    TextBuilder replyMSG = new TextBuilder("<html><title>Teleport Character</title>");
    replyMSG.append("<body>");
    replyMSG.append("The character you will teleport is " + player.getName() + ".");
    replyMSG.append("<br>");
    replyMSG.append("Co-ordinate x");
    replyMSG.append("<edit var=\"char_cord_x\" width=110>");
    replyMSG.append("Co-ordinate y");
    replyMSG.append("<edit var=\"char_cord_y\" width=110>");
    replyMSG.append("Co-ordinate z");
    replyMSG.append("<edit var=\"char_cord_z\" width=110>");
    replyMSG.append(
        "<button value=\"Teleport\" action=\"bypass -h admin_teleport_character $char_cord_x $char_cord_y $char_cord_z\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
    replyMSG.append(
        "<button value=\"Teleport near you\" action=\"bypass -h admin_teleport_character "
            + activeChar.getX()
            + " "
            + activeChar.getY()
            + " "
            + activeChar.getZ()
            + "\" width=115 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
    replyMSG.append(
        "<center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>");
    replyMSG.append("</body></html>");

    adminReply.setHtml(replyMSG.toString());
    activeChar.sendPacket(adminReply);

    adminReply = null;
    replyMSG = null;
    player = null;
    target = null;
  }
Ejemplo n.º 6
0
  private void teleportCharacter(L2PcInstance activeChar, String Cords) {
    L2Object target = activeChar.getTarget();
    L2PcInstance player = null;

    if (target.isPlayer) {
      player = (L2PcInstance) target;
    } else {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      return;
    }

    if (player.getObjectId() == activeChar.getObjectId()) {
      player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_ON_YOURSELF));
    } else {
      try {
        StringTokenizer st = new StringTokenizer(Cords);
        String x1 = st.nextToken();

        int x = Integer.parseInt(x1);

        String y1 = st.nextToken();

        int y = Integer.parseInt(y1);

        String z1 = st.nextToken();

        int z = Integer.parseInt(z1);

        teleportCharacter(player, x, y, z);

        y1 = null;
        z1 = null;
        x1 = null;
        st = null;
      } catch (NoSuchElementException nsee) {
        // ignore
      }
    }

    player = null;
    target = null;
  }
Ejemplo n.º 7
0
  @Override
  protected void runImpl() {
    L2PcInstance player = getClient().getActiveChar();
    if (player == null) return;

    ItemContainer warehouse = player.getActiveWarehouse();
    if (warehouse == null) return;

    L2FolkInstance manager = player.getLastFolkNPC();
    if ((manager == null
            || !player.isInsideRadius(manager, L2NpcInstance.INTERACTION_DISTANCE, false, false))
        && !player.isGM()) return;

    if (warehouse instanceof ClanWarehouse && !player.getAccessLevel().allowTransaction()) {
      player.sendMessage("Unsufficient privileges.");
      player.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    if (!FloodProtector.getInstance()
        .tryPerformAction(player.getObjectId(), FloodProtector.PROTECTED_WEREHOUSE)) {
      _log.warn("Player " + player.getName() + " has performed a werehouse action too fast");
      return;
    }

    // Alt game - Karma punishment
    if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && player.getKarma() > 0) return;

    if (Config.ALT_MEMBERS_CAN_WITHDRAW_FROM_CLANWH) {
      if (warehouse instanceof ClanWarehouse
          && (player.getClanPrivileges() & L2Clan.CP_CL_VIEW_WAREHOUSE)
              != L2Clan.CP_CL_VIEW_WAREHOUSE) return;
    } else {
      if (warehouse instanceof ClanWarehouse && !player.isClanLeader()) {
        // this msg is for depositing but maybe good to send some msg?
        player.sendPacket(
            new SystemMessage(
                SystemMessageId.ONLY_CLAN_LEADER_CAN_RETRIEVE_ITEMS_FROM_CLAN_WAREHOUSE));
        return;
      }
    }

    int weight = 0;
    int slots = 0;

    for (int i = 0; i < _count; i++) {
      int objectId = _items[i * 2 + 0];
      int count = _items[i * 2 + 1];

      // Calculate needed slots
      L2ItemInstance item = warehouse.getItemByObjectId(objectId);
      if (item == null) {
        continue;
      }
      weight += count * item.getItem().getWeight();
      if (!item.isStackable()) {
        slots += count;
      } else if (player.getInventory().getItemByItemId(item.getItemId()) == null) {
        slots++;
      }
    }

    // Item Max Limit Check
    if (!player.getInventory().validateCapacity(slots)) {
      sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL));
      return;
    }

    if (player.getActiveEnchantItem() != null) {
      Util.handleIllegalPlayerAction(
          player,
          "Player " + player.getName() + " tried to use enchant exploit!",
          Config.DEFAULT_PUNISH);
      return;
    }

    // Weight limit Check
    if (!player.getInventory().validateWeight(weight)) {
      sendPacket(new SystemMessage(SystemMessageId.WEIGHT_LIMIT_EXCEEDED));
      return;
    }

    // Proceed to the transfer
    InventoryUpdate playerIU = Config.FORCE_INVENTORY_UPDATE ? null : new InventoryUpdate();
    for (int i = 0; i < _count; i++) {
      int objectId = _items[i * 2 + 0];
      int count = _items[i * 2 + 1];

      L2ItemInstance oldItem = warehouse.getItemByObjectId(objectId);
      if (oldItem == null || oldItem.getCount() < count) {
        player.sendMessage("Can't withdraw requested item" + (count > 1 ? "s" : ""));
      }
      L2ItemInstance newItem =
          warehouse.transferItem(
              "Warehouse", objectId, count, player.getInventory(), player, player.getLastFolkNPC());
      if (newItem == null) {
        _log.warn("Error withdrawing a warehouse object for char " + player.getName());
        continue;
      }

      if (playerIU != null) {
        if (newItem.getCount() > count) {
          playerIU.addModifiedItem(newItem);
        } else {
          playerIU.addNewItem(newItem);
        }
      }
    }

    // Send updated item list to the player
    if (playerIU != null) {
      player.sendPacket(playerIU);
    } else {
      player.sendPacket(new ItemList(player, false));
    }

    // Update current load status on player
    StatusUpdate su = new StatusUpdate(player.getObjectId());
    su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
    player.sendPacket(su);
  }
Ejemplo n.º 8
0
  @Override
  public boolean useAdminCommand(String command, L2PcInstance activeChar) {
    if (!super.useAdminCommand(command, activeChar)) {
      return false;
    }

    if (command.equals("admin_teleto")) {
      activeChar.setTeleMode(1);
    }

    if (command.equals("admin_teleto r")) {
      activeChar.setTeleMode(2);
    }

    if (command.equals("admin_teleto end")) {
      activeChar.setTeleMode(0);
    }

    if (command.equals("admin_show_moves")) {
      com.l2scoria.gameserver.handler.admin.impl.HelpPage.showHelpPage(activeChar, "teleports.htm");
    }

    if (command.equals("admin_show_moves_other")) {
      com.l2scoria.gameserver.handler.admin.impl.HelpPage.showHelpPage(
          activeChar, "tele/other.html");
    } else if (command.equals("admin_show_teleport")) {
      showTeleportCharWindow(activeChar);
    } else if (command.equals("admin_recall_npc")) {
      recallNPC(activeChar);
    } else if (command.equals("admin_teleport_to_character")) {
      teleportToCharacter(activeChar, activeChar.getTarget());
    } else if (command.startsWith("admin_walk")) {
      try {
        String val = command.substring(11);
        StringTokenizer st = new StringTokenizer(val);
        String x1 = st.nextToken();

        int x = Integer.parseInt(x1);

        String y1 = st.nextToken();

        int y = Integer.parseInt(y1);

        String z1 = st.nextToken();

        int z = Integer.parseInt(z1);

        L2CharPosition pos = new L2CharPosition(x, y, z, 0);
        activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, pos);

        pos = null;
        x1 = null;
        y1 = null;
        z1 = null;
        st = null;
      } catch (Exception e) {
        if (Config.DEBUG) {
          _log.info("admin_walk: " + e);
        }
      }
    } else if (command.startsWith("admin_move_to")) {
      try {
        String val = command.substring(14);
        teleportTo(activeChar, val);

        val = null;
      } catch (StringIndexOutOfBoundsException e) {
        // Case of empty or missing coordinates
        com.l2scoria.gameserver.handler.admin.impl.HelpPage.showHelpPage(
            activeChar, "teleports.htm");
      }
    } else if (command.startsWith("admin_teleport_character")) {
      try {
        String val = command.substring(25);

        if (activeChar.getAccessLevel().isGm()) {
          teleportCharacter(activeChar, val);
        }

        val = null;
      } catch (StringIndexOutOfBoundsException e) {
        // Case of empty coordinates
        activeChar.sendMessage("Wrong or no Coordinates given.");
        showTeleportCharWindow(activeChar); // back to character teleport
      }
    } else if (command.startsWith("admin_teleportto ")) {
      try {
        String targetName = command.substring(17);
        L2PcInstance player = L2World.getInstance().getPlayer(targetName);
        teleportToCharacter(activeChar, player);
        targetName = null;
        player = null;
      } catch (StringIndexOutOfBoundsException e) {
        // ignore
      }
    } else if (command.startsWith("admin_recall ")) {
      try {
        String targetName = command.substring(13);
        L2PcInstance player = L2World.getInstance().getPlayer(targetName);

        if (activeChar.getAccessLevel().isGm()) {
          teleportCharacter(player, activeChar.getX(), activeChar.getY(), activeChar.getZ());
        }

        player = null;
      } catch (StringIndexOutOfBoundsException e) {
        // ignore
      }
    } else if (command.startsWith("admin_sendhome ")) {
      try {
        String targetName = command.substring(15);
        L2PcInstance player = L2World.getInstance().getPlayer(targetName);
        player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
        targetName = null;
        player = null;
      } catch (StringIndexOutOfBoundsException e) {
        // ignore
      }
    } else if (command.equals("admin_tele")) {
      showTeleportWindow(activeChar);
    } else if (command.startsWith("admin_go")) {
      int intVal = 150;
      int x = activeChar.getX(), y = activeChar.getY(), z = activeChar.getZ();

      try {
        String val = command.substring(8);
        StringTokenizer st = new StringTokenizer(val);
        String dir = st.nextToken();

        if (st.hasMoreTokens()) {
          intVal = Integer.parseInt(st.nextToken());
        }

        if (dir.equals("east")) {
          x += intVal;
        } else if (dir.equals("west")) {
          x -= intVal;
        } else if (dir.equals("north")) {
          y -= intVal;
        } else if (dir.equals("south")) {
          y += intVal;
        } else if (dir.equals("up")) {
          z += intVal;
        } else if (dir.equals("down")) {
          z -= intVal;
        }

        activeChar.teleToLocation(x, y, z, false);
        showTeleportWindow(activeChar);

        dir = null;
        st = null;
        val = null;
      } catch (Exception e) {
        activeChar.sendMessage("Usage: //go<north|south|east|west|up|down> [offset] (default 150)");
      }
    }

    return true;
  }
Ejemplo n.º 9
0
  private void recallNPC(L2PcInstance activeChar) {
    L2Object obj = activeChar.getTarget();

    if (obj != null && obj.isNpc) {
      L2NpcInstance target = (L2NpcInstance) obj;

      int monsterTemplate = target.getTemplate().npcId;

      L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(monsterTemplate);

      if (template1 == null) {
        activeChar.sendMessage("Incorrect monster template.");
        _log.warn("ERROR: NPC " + target.getObjectId() + " has a 'null' template.");
        return;
      }

      L2Spawn spawn = target.getSpawn();

      if (spawn == null) {
        activeChar.sendMessage("Incorrect monster spawn.");
        _log.warn("ERROR: NPC " + target.getObjectId() + " has a 'null' spawn.");
        return;
      }

      int respawnTime = spawn.getRespawnDelay();

      target.deleteMe();
      spawn.stopRespawn();
      SpawnTable.getInstance().deleteSpawn(spawn, true);

      try {
        // L2MonsterInstance mob = new L2MonsterInstance(monsterTemplate, template1);

        spawn = new L2Spawn(template1);
        spawn.setLocx(activeChar.getX());
        spawn.setLocy(activeChar.getY());
        spawn.setLocz(activeChar.getZ());
        spawn.setAmount(1);
        spawn.setHeading(activeChar.getHeading());
        spawn.setRespawnDelay(respawnTime);
        SpawnTable.getInstance().addNewSpawn(spawn, true);
        spawn.init();

        SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
        sm.addString("Created " + template1.name + " on " + target.getObjectId() + ".");
        activeChar.sendPacket(sm);
        sm = null;

        if (Config.DEBUG) {
          _log.info(
              "Spawn at X=" + spawn.getLocx() + " Y=" + spawn.getLocy() + " Z=" + spawn.getLocz());
          _log.warn(
              "GM: "
                  + activeChar.getName()
                  + "("
                  + activeChar.getObjectId()
                  + ") moved NPC "
                  + target.getObjectId());
        }

        spawn = null;
        template1 = null;
        target = null;
      } catch (Exception e) {
        activeChar.sendMessage("Target is not in game.");
      }
    } else {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
    }

    obj = null;
  }
Ejemplo n.º 10
0
  private void teleportToCharacter(L2PcInstance activeChar, L2Object target) {
    L2PcInstance player = null;

    if (target != null && target.isPlayer) {
      player = (L2PcInstance) target;
    } else {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      return;
    }

    if (player.getObjectId() == activeChar.getObjectId()) {
      player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_ON_YOURSELF));
    } else {
      int x = player.getX();
      int y = player.getY();
      int z = player.getZ();

      if (player.getInstanceId() != activeChar.getInstanceId()) {
        activeChar.setInstanceId(player.getInstanceId());
        activeChar.sendMessage("Вход в инстанс " + player.getInstanceId() + ".");
      }

      activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
      activeChar.teleToLocation(x, y, z);
    }

    player = null;
  }
Ejemplo n.º 11
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.º 12
0
  @Override
  public String onSpellFinished(L2NpcInstance npc, L2PcInstance player, L2Skill skill) {
    if (npc.getNpcId() == ZAKEN) {
      int skillId = skill.getId();
      if (skillId == 4222) {
        // npc.teleToLocation(_ai1, _ai2, _ai3);
        npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
      } else if (skillId == 4216) {
        // int i1 = Rnd.get(15);
        // player.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
        // Zcoords[i1]);
        ((L2Attackable) npc).stopHating(player);
        L2Character nextTarget = ((L2Attackable) npc).getMostHated();
        if (nextTarget != null)
          npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);

      } else if (skillId == 4217) {
        int i0 = 0;
        // int i1 = Rnd.get(15);
        // player.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
        // Zcoords[i1]);
        ((L2Attackable) npc).stopHating(player);

        if (c_quest0 != null
            && _quest0 > 0
            && c_quest0 != player
            && c_quest0.getZ() > (player.getZ() - 100)
            && c_quest0.getZ() < (player.getZ() + 100)) {
          if ((((c_quest0.getX() - player.getX()) * (c_quest0.getX() - player.getX()))
                  + ((c_quest0.getY() - player.getY()) * (c_quest0.getY() - player.getY())))
              > (250 * 250)) {
            i0 = 1;
          } else {
            i0 = 0;
          }
          if (i0 == 0) {
            // i1 = Rnd.get(15);
            // c_quest0.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
            // Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest0);
          }
        }
        if (c_quest1 != null
            && _quest0 > 1
            && c_quest1 != player
            && c_quest1.getZ() > (player.getZ() - 100)
            && c_quest1.getZ() < (player.getZ() + 100)) {
          if ((((c_quest1.getX() - player.getX()) * (c_quest1.getX() - player.getX()))
                  + ((c_quest1.getY() - player.getY()) * (c_quest1.getY() - player.getY())))
              > (250 * 250)) {
            i0 = 1;
          } else {
            i0 = 0;
          }
          if (i0 == 0) {
            // i1 = Rnd.get(15);
            // c_quest1.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
            // Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest1);
          }
        }
        if (c_quest2 != null
            && _quest0 > 2
            && c_quest2 != player
            && c_quest2.getZ() > (player.getZ() - 100)
            && c_quest2.getZ() < (player.getZ() + 100)) {
          if ((((c_quest2.getX() - player.getX()) * (c_quest2.getX() - player.getX()))
                  + ((c_quest2.getY() - player.getY()) * (c_quest2.getY() - player.getY())))
              > (250 * 250)) {
            i0 = 1;
          } else {
            i0 = 0;
          }
          if (i0 == 0) {
            // i1 = Rnd.get(15);
            // c_quest2.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
            // Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest2);
          }
        }
        if (c_quest3 != null
            && _quest0 > 3
            && c_quest3 != player
            && c_quest3.getZ() > (player.getZ() - 100)
            && c_quest3.getZ() < (player.getZ() + 100)) {
          if ((((c_quest3.getX() - player.getX()) * (c_quest3.getX() - player.getX()))
                  + ((c_quest3.getY() - player.getY()) * (c_quest3.getY() - player.getY())))
              > (250 * 250)) {
            i0 = 1;
          } else {
            i0 = 0;
          }
          if (i0 == 0) {
            // i1 = Rnd.get(15);
            // c_quest3.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
            // Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest3);
          }
        }
        if (c_quest4 != null
            && _quest0 > 4
            && c_quest4 != player
            && c_quest4.getZ() > (player.getZ() - 100)
            && c_quest4.getZ() < (player.getZ() + 100)) {
          if ((((c_quest4.getX() - player.getX()) * (c_quest4.getX() - player.getX()))
                  + ((c_quest4.getY() - player.getY()) * (c_quest4.getY() - player.getY())))
              > (250 * 250)) {
            i0 = 1;
          } else {
            i0 = 0;
          }
          if (i0 == 0) {
            // i1 = Rnd.get(15);
            // c_quest4.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
            // Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest4);
          }
        }
        L2Character nextTarget = ((L2Attackable) npc).getMostHated();
        if (nextTarget != null)
          npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
      }
    }
    return super.onSpellFinished(npc, player, skill);
  }
Ejemplo n.º 13
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);
  }
Ejemplo n.º 14
0
  @Override
  protected void runImpl() {
    if (getClient().getActiveChar() == null) return;

    L2PcInstance _activeChar = getClient().getActiveChar();

    PartyMatchRoom _room = PartyMatchRoomList.getInstance().getRoom(_roomid);
    if (_room == null) return;

    if ((_activeChar.getLevel() >= _room.getMinLvl())
        && (_activeChar.getLevel() <= _room.getMaxLvl())) {
      // Remove from waiting list
      PartyMatchWaitingList.getInstance().removePlayer(_activeChar);

      _activeChar.setPartyRoom(_roomid);

      _activeChar.sendPacket(new PartyMatchDetail(_activeChar, _room));
      _activeChar.sendPacket(new ExPartyRoomMember(_activeChar, _room, 0));

      for (L2PcInstance _member : _room.getPartyMembers()) {
        if (_member == null) continue;

        _member.sendPacket(new ExManagePartyRoomMember(_activeChar, _room, 0));

        SystemMessage sm = new SystemMessage(SystemMessageId.S1_ENTERED_PARTY_ROOM);
        sm.addString(_activeChar.getName());
        _member.sendPacket(sm);
      }
      _room.addMember(_activeChar);

      // Info Broadcast
      _activeChar.broadcastUserInfo();
    } else {
      _activeChar.sendPacket(new SystemMessage(SystemMessageId.CANT_ENTER_PARTY_ROOM));
    }
  }
Ejemplo n.º 15
0
  @Override
  protected void runImpl() {
    L2PcInstance player = getClient().getActiveChar();
    if (player == null || !(player.getPet().isPet)) return;

    // Alt game - Karma punishment
    if (!Config.ALT_GAME_KARMA_PLAYER_CAN_TRADE && player.getKarma() > 0) return;

    if (player.getPrivateStoreType() != 0) {
      player.sendMessage("Cannot exchange items while trading");
      return;
    }

    if (player.isCastingNow()) {
      return;
    }

    if (player.getActiveEnchantItem() != null) {
      Util.handleIllegalPlayerAction(
          player,
          "Player " + player.getName() + " Tried To Use Enchant Exploit! Ban This Player",
          Config.DEFAULT_PUNISH);
      return;
    }

    if (player.InventoryMoreLimit()) {
      return;
    }

    // Exploit Fix for Hero weapons Uses pet Inventory to buy New One.
    // [L2Scoria]
    L2ItemInstance item = player.getInventory().getItemByObjectId(_objectId);

    if (item == null) return;

    if (item.isAugmented()) return;

    if (!item.isDropable() || !item.isDestroyable() || !item.isTradeable()) {
      sendPacket(new SystemMessage(SystemMessageId.ITEM_NOT_FOR_PETS));
      return;
    }

    if (item.isTimeLimitedItem()) {
      sendPacket(new SystemMessage(SystemMessageId.ITEM_NOT_FOR_PETS));
      return;
    }

    L2PetInstance pet = (L2PetInstance) player.getPet();

    if (pet.isDead()) {
      sendPacket(new SystemMessage(SystemMessageId.CANNOT_GIVE_ITEMS_TO_DEAD_PET));
      return;
    }

    if (_amount < 0) return;

    if (player.transferItem("Transfer", _objectId, _amount, pet.getInventory(), pet) == null) {
      _log.warn(
          "Invalid item transfer request: " + pet.getName() + "(pet) --> " + player.getName());
    }
  }