Package lineage2.gameserver.model

Examples of lineage2.gameserver.model.GameObject


   */
  @Override
  public boolean useAdminCommand(Enum<?> comm, String[] wordList, String fullString, Player player)
  {
    final Commands c = (Commands) comm;
    GameObject target = player.getTarget();
    switch (c)
    {
      case admin_setskill:
        if (wordList.length != 3)
        {
          return false;
        }
        if (!player.getPlayerAccess().CanEditChar)
        {
          return false;
        }
        if ((target == null) || !target.isPlayer())
        {
          return false;
        }
        try
        {
          final Skill skill = SkillTable.getInstance().getInfo(Integer.parseInt(wordList[1]), Integer.parseInt(wordList[2]));
          target.getPlayer().addSkill(skill, true);
          target.getPlayer().sendPacket(new SystemMessage2(SystemMsg.YOU_HAVE_EARNED_S1_SKILL).addSkillName(skill.getId(), skill.getLevel()));
        }
        catch (NumberFormatException e)
        {
          _log.info("AdminClientSupport:useAdminCommand(Enum,String[],String,L2Player): " + e, e);
          return false;
        }
        break;
      case admin_summon:
        if (wordList.length != 3)
        {
          return false;
        }
        if (!player.getPlayerAccess().CanEditChar)
        {
          return false;
        }
        try
        {
          final int id = Integer.parseInt(wordList[1]);
          final long count = Long.parseLong(wordList[2]);
          if (id >= 1000000)
          {
            if (target == null)
            {
              target = player;
            }
            final NpcTemplate template = NpcHolder.getInstance().getTemplate(id - 1000000);
            for (int i = 0; i < count; i++)
            {
              NpcInstance npc = template.getNewInstance();
              npc.setSpawnedLoc(target.getLoc());
              npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp(), true);
              npc.spawnMe(npc.getSpawnedLoc());
            }
          }
          else
          {
            if (target == null)
            {
              target = player;
            }
            if (!target.isPlayer())
            {
              return false;
            }
            final ItemTemplate template = ItemHolder.getInstance().getTemplate(id);
            if (template == null)
            {
              return false;
            }
            if (template.isStackable())
            {
              final ItemInstance item = ItemFunctions.createItem(id);
              item.setCount(count);
              target.getPlayer().getInventory().addItem(item);
              target.getPlayer().sendPacket(SystemMessage2.obtainItems(item));
            }
            else
            {
              for (int i = 0; i < count; i++)
              {
                ItemInstance item = ItemFunctions.createItem(id);
                target.getPlayer().getInventory().addItem(item);
                target.getPlayer().sendPacket(SystemMessage2.obtainItems(item));
              }
            }
          }
        }
        catch (NumberFormatException e)
View Full Code Here


        {
          team = t;
        }
      }
    }
    final GameObject object = activeChar.getTarget();
    if ((object == null) || !object.isCreature())
    {
      activeChar.sendPacket(SystemMsg.INVALID_TARGET);
      return false;
    }
    ((Creature) object).setTeam(team);
View Full Code Here

  {
    final Commands c = (Commands) comm;
    switch (c)
    {
      case admin_list_events:
        final GameObject object = activeChar.getTarget();
        if (object == null)
        {
          activeChar.sendPacket(SystemMsg.INVALID_TARGET);
        }
        else
        {
          for (GlobalEvent e : object.getEvents())
          {
            activeChar.sendMessage("- " + e.toString());
          }
        }
        break;
View Full Code Here

          }
        });
        AdminCommandHandler.getInstance().useAdminCommandHandler(activeChar, "admin_residence " + r.getId());
        break;
      case admin_backup_unit_info:
        final GameObject target = activeChar.getTarget();
        if (!(target instanceof PowerControlUnitInstance) && !(target instanceof BackupPowerUnitInstance))
        {
          return false;
        }
        final List<String> t = new ArrayList<>(3);
View Full Code Here

    if(actor == null)
    {
      return;
    }

    final GameObject obj = actor.getVisibleObject(_targetObjectId);

    if(obj == null)
    {
      return;
    }

    if(_actorPosition.isNull())
    {
      return;
    }

    if(obj.isTargetable(actor))
    {
      if(isAttackRequest())
      {
        if(actor.getPlayerAccess().CanAttack)
        {
          obj.onForcedAttack(actor, _forced);
        }
      }
      else
      {
        obj.onActionSelect(actor, _forced);
      }
      actor.setActive();
    }
    actor.sendActionFailed();
  }
View Full Code Here

   * @param activeChar Player
   * @param player String
   */
  private void handleKill(Player activeChar, String player)
  {
    GameObject obj = activeChar.getTarget();
    if (player != null)
    {
      Player plyr = World.getPlayer(player);
      if (plyr != null)
      {
        obj = plyr;
      }
      else
      {
        int radius = Math.max(Integer.parseInt(player), 100);
        for (Creature character : activeChar.getAroundCharacters(radius, 200))
        {
          if (!character.isDoor())
          {
            character.doDie(activeChar);
          }
        }
        activeChar.sendMessage("Killed within " + radius + " unit radius.");
        return;
      }
    }
    if ((obj != null) && obj.isCreature())
    {
      Creature target = (Creature) obj;
      target.doDie(activeChar);
    }
    else
View Full Code Here

   * @param activeChar Player
   * @param damage int
   */
  private void handleDamage(Player activeChar, int damage)
  {
    GameObject obj = activeChar.getTarget();
    if (obj == null)
    {
      activeChar.sendPacket(Msg.SELECT_TARGET);
      return;
    }
    if (!obj.isCreature())
    {
      activeChar.sendPacket(Msg.INVALID_TARGET);
      return;
    }
    Creature cha = (Creature) obj;
View Full Code Here

        {
          activeChar.sendMessage("This cursed weapon is already active.");
        }
        else
        {
          GameObject target = activeChar.getTarget();
          if ((target != null) && target.isPlayer() && !((Player) target).isInOlympiadMode())
          {
            Player player = (Player) target;
            ItemInstance item = ItemFunctions.createItem(cw.getItemId());
            cwm.activate(player, player.getInventory().addItem(item));
            cwm.showUsageTime(player, cw);
          }
        }
        break;
      case admin_cw_drop:
        if (cw == null)
        {
          return false;
        }
        if (cw.isActive())
        {
          activeChar.sendMessage("This cursed weapon is already active.");
        }
        else
        {
          GameObject target = activeChar.getTarget();
          if ((target != null) && target.isPlayer() && !((Player) target).isInOlympiadMode())
          {
            Player player = (Player) target;
            cw.create(null, player);
          }
        }
View Full Code Here

      return false;
    }
    switch (command)
    {
      case admin_delete:
        GameObject obj = wordList.length == 1 ? activeChar.getTarget() : GameObjectsStorage.getNpc(NumberUtils.toInt(wordList[1]));
        if ((obj != null) && obj.isNpc())
        {
          NpcInstance target = (NpcInstance) obj;
          target.deleteMe();
          Spawner spawn = target.getSpawn();
          if (spawn != null)
View Full Code Here

        {
          activeChar.sendMessage("USAGE: //toobject objectId");
          return false;
        }
        Integer target = Integer.parseInt(wordList[1]);
        GameObject obj;
        if ((obj = GameObjectsStorage.findObject(target)) != null)
        {
          teleportToCharacter(activeChar, obj);
          return true;
        }
        activeChar.sendMessage("Object " + target + " not found");
        break;
      default:
        break;
    }
    if (!activeChar.getPlayerAccess().CanEditChar)
    {
      return false;
    }
    switch (command)
    {
      case admin_teleport_character:
        if (wordList.length < 2)
        {
          activeChar.sendMessage("USAGE: //teleport_character x y z");
          return false;
        }
        teleportCharacter(activeChar, Util.joinStrings(" ", wordList, 1));
        showTeleportCharWindow(activeChar);
        break;
      case admin_recall:
        if (wordList.length < 2)
        {
          activeChar.sendMessage("USAGE: //recall charName");
          return false;
        }
        String targetName = Util.joinStrings(" ", wordList, 1);
        Player recall_player = GameObjectsStorage.getPlayer(targetName);
        if (recall_player != null)
        {
          teleportTo(activeChar, recall_player, activeChar.getLoc(), activeChar.getReflectionId());
          return true;
        }
        int obj_id = CharacterDAO.getInstance().getObjectIdByName(targetName);
        if (obj_id > 0)
        {
          teleportCharacter_offline(obj_id, activeChar.getLoc());
          activeChar.sendMessage(targetName + " is offline. Offline teleport used...");
        }
        else
        {
          activeChar.sendMessage("->" + targetName + "<- is incorrect.");
        }
        break;
      case admin_setref:
      {
        if (wordList.length < 2)
        {
          activeChar.sendMessage("Usage: //setref <reflection>");
          return false;
        }
        int ref_id = Integer.parseInt(wordList[1]);
        if ((ref_id != 0) && (ReflectionManager.getInstance().get(ref_id) == null))
        {
          activeChar.sendMessage("Reflection <" + ref_id + "> not found.");
          return false;
        }
        GameObject target = activeChar;
        GameObject obj = activeChar.getTarget();
        if (obj != null)
        {
          target = obj;
        }
        target.setReflection(ref_id);
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.