Package lineage2.gameserver.model

Examples of lineage2.gameserver.model.GameObject


  {
    if (id != COMMAND_IDS[0])
    {
      return false;
    }
    GameObject objectTarget = Config.OLYMPIAD_OLDSTYLE_STAT ? activeChar : activeChar.getTarget();
    if ((objectTarget == null) || !objectTarget.isPlayer() || !objectTarget.getPlayer().isNoble())
    {
      activeChar.sendPacket(SystemMsg.THIS_COMMAND_CAN_ONLY_BE_USED_BY_A_NOBLESSE);
      return true;
    }
    Player playerTarget = objectTarget.getPlayer();
    SystemMessage2 sm = new SystemMessage2(SystemMsg.FOR_THE_CURRENT_GRAND_OLYMPIAD_YOU_HAVE_PARTICIPATED_IN_S1_MATCHES_S2_WINS_S3_DEFEATS_YOU_CURRENTLY_HAVE_S4_OLYMPIAD_POINTS);
    sm.addInteger(Olympiad.getCompetitionDone(playerTarget.getObjectId()));
    sm.addInteger(Olympiad.getCompetitionWin(playerTarget.getObjectId()));
    sm.addInteger(Olympiad.getCompetitionLoose(playerTarget.getObjectId()));
    sm.addInteger(Olympiad.getNoblePoints(playerTarget.getObjectId()));
View Full Code Here


    }
    if ((activeChar == null) || !activeChar.isPlayer())
    {
      return false;
    }
    GameObject flagPole = activeChar.getTarget();
    if (!(flagPole instanceof StaticObjectInstance) || (((StaticObjectInstance) flagPole).getType() != 3))
    {
      activeChar.sendPacket(SystemMsg.THE_TARGET_IS_NOT_A_FLAGPOLE_SO_A_FLAG_CANNOT_BE_DISPLAYED);
      return false;
    }
View Full Code Here

   * @param targets List<Creature>
   */
  @Override
  public void useSkill(Creature activeChar, List<Creature> targets)
  {
    GameObject flagPole = activeChar.getTarget();
    if (!(flagPole instanceof StaticObjectInstance) || (((StaticObjectInstance) flagPole).getType() != 3))
    {
      return;
    }
    Player player = (Player) activeChar;
View Full Code Here

   * @see lineage2.gameserver.model.entity.events.EventAction#call(GlobalEvent)
   */
  @Override
  public void call(GlobalEvent event)
  {
    GameObject object = event.getCenterObject();
    PlaySound packet = null;
    if (object != null)
    {
      packet = new PlaySound(_type, _sound, 1, object.getObjectId(), object.getLoc());
    }
    else
    {
      packet = new PlaySound(_type, _sound, 0, 0, 0, 0, 0);
    }
View Full Code Here

      return;
    }
    try
    {
      NpcInstance npc = activeChar.getLastNpc();
      GameObject target = activeChar.getTarget();
      if ((npc == null) && (target != null) && target.isNpc())
      {
        npc = (NpcInstance) target;
      }
      if (bp.bypass.startsWith("admin_"))
      {
        AdminCommandHandler.getInstance().useAdminCommandHandler(activeChar, bp.bypass);
      }
      else if (bp.bypass.equals("come_here") && activeChar.isGM())
      {
        comeHere(getClient());
      }
      else if (bp.bypass.startsWith("player_help "))
      {
        playerHelp(activeChar, bp.bypass.substring(12));
      }
      else if (bp.bypass.startsWith("scripts_"))
      {
        String command = bp.bypass.substring(8).trim();
        String[] word = command.split("\\s+");
        String[] args = command.substring(word[0].length()).trim().split("\\s+");
        String[] path = word[0].split(":");
        if (path.length != 2)
        {
          _log.warn("Bad Script bypass!");
          return;
        }
        Map<String, Object> variables = null;
        if (npc != null)
        {
          variables = new HashMap<>(1);
          variables.put("npc", npc.getRef());
        }
        if (word.length == 1)
        {
          Scripts.getInstance().callScripts(activeChar, path[0], path[1], variables);
        }
        else
        {
          Scripts.getInstance().callScripts(activeChar, path[0], path[1], new Object[]
          {
            args
          }, variables);
        }
      }
      else if (bp.bypass.startsWith("user_"))
      {
        String command = bp.bypass.substring(5).trim();
        String word = command.split("\\s+")[0];
        String args = command.substring(word.length()).trim();
        IVoicedCommandHandler vch = VoicedCommandHandler.getInstance().getVoicedCommandHandler(word);
        if (vch != null)
        {
          vch.useVoicedCommand(word, activeChar, args);
        }
        else
        {
          _log.warn("Unknow voiced command '" + word + "'");
        }
      }
      else if (bp.bypass.startsWith("npc_"))
      {
        int endOfId = bp.bypass.indexOf('_', 5);
        String id;
        if (endOfId > 0)
        {
          id = bp.bypass.substring(4, endOfId);
        }
        else
        {
          id = bp.bypass.substring(4);
        }
        GameObject object = activeChar.getVisibleObject(Integer.parseInt(id));
        if ((object != null) && object.isNpc() && (endOfId > 0) && activeChar.isInRange(object.getLoc(), Creature.INTERACTION_DISTANCE))
        {
          activeChar.setLastNpc((NpcInstance) object);
          ((NpcInstance) object).onBypassFeedback(activeChar, bp.bypass.substring(endOfId + 1));
        }
      }
      else if (bp.bypass.startsWith("_olympiad?"))
      {
        String[] ar = bp.bypass.replace("_olympiad?", "").split("&");
        String firstVal = ar[0].split("=")[1];
        String secondVal = ar[1].split("=")[1];
        if (firstVal.equalsIgnoreCase("move_op_field"))
        {
          if (!Config.ENABLE_OLYMPIAD_SPECTATING)
          {
            return;
          }
          if (((activeChar.getLastNpc() instanceof OlympiadManagerInstance) && activeChar.getLastNpc().isInRange(activeChar, Creature.INTERACTION_DISTANCE)) || (activeChar.getOlympiadObserveGame() != null))
          {
            Olympiad.addSpectator(Integer.parseInt(secondVal) - 1, activeChar);
          }
        }
      }
      else if (bp.bypass.startsWith("_diary"))
      {
        String params = bp.bypass.substring(bp.bypass.indexOf("?") + 1);
        StringTokenizer st = new StringTokenizer(params, "&");
        int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
        int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
        int heroid = Hero.getInstance().getHeroByClass(heroclass);
        if (heroid > 0)
        {
          Hero.getInstance().showHeroDiary(activeChar, heroclass, heroid, heropage);
        }
      }
      else if (bp.bypass.startsWith("_match"))
      {
        String params = bp.bypass.substring(bp.bypass.indexOf("?") + 1);
        StringTokenizer st = new StringTokenizer(params, "&");
        int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
        int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
        OlympiadHistoryManager.getInstance().showHistory(activeChar, heroclass, heropage);
      }
      else if (bp.bypass.startsWith("manor_menu_select?"))
      {
        GameObject object = activeChar.getTarget();
        if ((object != null) && object.isNpc())
        {
          ((NpcInstance) object).onBypassFeedback(activeChar, bp.bypass);
        }
      }
      else if (bp.bypass.startsWith("multisell "))
      {
        MultiSellHolder.getInstance().SeparateAndSend(Integer.parseInt(bp.bypass.substring(10)), activeChar, 0);
      }
      else if (bp.bypass.startsWith("menu_select?"))
      {
        String params = bp.bypass.substring(bp.bypass.indexOf("?") + 1);
        StringTokenizer st = new StringTokenizer(params, "&");
        int ask = Integer.parseInt(st.nextToken().split("=")[1]);
        int reply = Integer.parseInt(st.nextToken().split("=")[1]);
        if (npc != null)
        {
          npc.onMenuSelect(activeChar, ask, reply);
        }
      }
      else if (bp.bypass.startsWith("Quest "))
      {
        String p = bp.bypass.substring(6).trim();
        int idx = p.indexOf(' ');
        if (idx < 0)
        {
          activeChar.processQuestEvent(p, "", npc);
        }
        else
        {
          activeChar.processQuestEvent(p.substring(0, idx), p.substring(idx).trim(), npc);
        }
      }
      else if (bp.bypass.startsWith("Campaign "))
      {
        String p = bp.bypass.substring(9).trim();
        int idx = p.indexOf(' ');
        if (idx > 0) {
          String campaignName = p.substring(0, idx);
          DynamicQuestController.getInstance().processDialogEvent(campaignName, p.substring(idx).trim(), activeChar);
        }
      }
      else if (bp.handler != null)
      {
        if (!Config.COMMUNITYBOARD_ENABLED)
        {
          activeChar.sendPacket(new SystemMessage(SystemMessage.THE_COMMUNITY_SERVER_IS_CURRENTLY_OFFLINE));
        }
        else
        {
          bp.handler.onBypassCommand(activeChar, bp.bypass);
        }
      }
    }
    catch (Exception e)
    {
      String st = "Bad RequestBypassToServer: " + bp.bypass;
      GameObject target = activeChar.getTarget();
      if ((target != null) && target.isNpc())
      {
        st = st + " via NPC #" + ((NpcInstance) target).getNpcId();
      }
      _log.error(st, e);
    }
View Full Code Here

   * Method comeHere.
   * @param client GameClient
   */
  private static void comeHere(GameClient client)
  {
    GameObject obj = client.getActiveChar().getTarget();
    if ((obj != null) && obj.isNpc())
    {
      NpcInstance temp = (NpcInstance) obj;
      Player activeChar = client.getActiveChar();
      temp.setTarget(activeChar);
      temp.moveToLocation(activeChar.getLoc(), 0, true);
View Full Code Here

      ItemInstance item = ItemsDAO.getInstance().load(entry.getKey());
      if (item != null)
      {
        if (item.getOwnerId() > 0)
        {
          GameObject object = GameObjectsStorage.findObject(item.getOwnerId());
          if ((object != null) && object.isPlayable())
          {
            ((Playable) object).getInventory().destroyItem(item);
            object.getPlayer().sendPacket(SystemMessage2.removeItems(item));
          }
        }
        item.delete();
      }
      else
View Full Code Here

  {
    if (player == null)
    {
      return;
    }
    GameObject target = player.getTarget();
    NpcHtmlMessage npcReply = showQuestInfo ? new ExNpcQuestHtmlMessage(target == null ? 5 : target.getObjectId(), getQuestIntId()) : new NpcHtmlMessage(target == null ? 5 : target.getObjectId());
    npcReply.setFile("quests/" + getClass().getSimpleName() + "/" + fileName);
    if ((arg.length % 2) == 0)
    {
      for (int i = 0; i < arg.length; i += 2)
      {
View Full Code Here

    clearActions();
    updatePlayers(false, false);
    for (DuelSnapshotObject d : this)
    {
      d.getPlayer().sendPacket(new ExDuelEnd(this));
      GameObject target = d.getPlayer().getTarget();
      if (target != null)
      {
        d.getPlayer().getAI().notifyEvent(CtrlEvent.EVT_FORGET_OBJECT, target);
      }
    }
View Full Code Here

    updatePlayers(false, false);
   
    for (DuelSnapshotObject d : this)
    {
      d.getPlayer().sendPacket(new ExDuelEnd(this));
      GameObject target = d.getPlayer().getTarget();
      if (target != null)
      {
        d.getPlayer().getAI().notifyEvent(CtrlEvent.EVT_FORGET_OBJECT, target);
      }
    }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.GameObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.