Package lineage2.gameserver.model

Examples of lineage2.gameserver.model.GameObject


    if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && (activeChar.getKarma() < 0) && !activeChar.isGM())
    {
      activeChar.sendActionFailed();
      return;
    }
    GameObject target = activeChar.getTarget();
    ManorManagerInstance manor = (target != null) && (target instanceof ManorManagerInstance) ? (ManorManagerInstance) target : null;
    if (!activeChar.isGM() && ((manor == null) || !activeChar.isInRange(manor, Creature.INTERACTION_DISTANCE)))
    {
      activeChar.sendActionFailed();
      return;
View Full Code Here


   * @param activeChar Player
   * @param targetName String
   */
  private void handleCancel(Player activeChar, String targetName)
  {
    GameObject obj = activeChar.getTarget();
    if (targetName != null)
    {
      Player plyr = World.getPlayer(targetName);
      if (plyr != null)
      {
        obj = plyr;
      }
      else
      {
        try
        {
          int radius = Math.max(Integer.parseInt(targetName), 100);
          for (Creature character : activeChar.getAroundCharacters(radius, 200))
          {
            character.getEffectList().stopAllEffects();
          }
          activeChar.sendMessage("Apply Cancel within " + radius + " unit radius.");
          return;
        }
        catch (NumberFormatException e)
        {
          activeChar.sendMessage("Enter valid player name or radius");
          return;
        }
      }
    }
    if (obj == null)
    {
      obj = activeChar;
    }
    if (obj.isCreature())
    {
      ((Creature) obj).getEffectList().stopAllEffects();
    }
    else
    {
View Full Code Here

      return false;
    }
    int val;
    AbnormalEffect ae = AbnormalEffect.NULL;
    String Skill = new String();
    GameObject target = activeChar.getTarget();
    switch (command)
    {
      case admin_invis:
      case admin_vis:
        if (activeChar.isInvisible())
        {
          activeChar.setInvisibleType(InvisibleType.NONE);
          activeChar.broadcastCharInfo();
          for (Summon summon : activeChar.getSummonList())
          {
            summon.broadcastCharInfo();
          }
        }
        else
        {
          activeChar.setInvisibleType(InvisibleType.NORMAL);
          activeChar.sendUserInfo();
          World.removeObjectFromPlayers(activeChar);
        }
        break;
      case admin_gmspeed:
        if (wordList.length < 2)
        {
          val = 0;
        }
        else
        {
          try
          {
            val = Integer.parseInt(wordList[1]);
          }
          catch (Exception e)
          {
            activeChar.sendMessage("USAGE: //gmspeed value=[0..4]");
            return false;
          }
        }
        List<Effect> superhaste = activeChar.getEffectList().getEffectsBySkillId(7029);
        int sh_level = superhaste == null ? 0 : superhaste.isEmpty() ? 0 : superhaste.get(0).getSkill().getLevel();
        if (val == 0)
        {
          if (sh_level != 0)
          {
            activeChar.doCast(SkillTable.getInstance().getInfo(7029, sh_level), activeChar, true);
          }
          activeChar.unsetVar("gm_gmspeed");
        }
        else if ((val >= 1) && (val <= 4))
        {
          if (Config.SAVE_GM_EFFECTS)
          {
            activeChar.setVar("gm_gmspeed", String.valueOf(val), -1);
          }
          if (val != sh_level)
          {
            if (sh_level != 0)
            {
              activeChar.doCast(SkillTable.getInstance().getInfo(7029, sh_level), activeChar, true);
            }
            activeChar.doCast(SkillTable.getInstance().getInfo(7029, val), activeChar, true);
          }
        }
        else
        {
          activeChar.sendMessage("USAGE: //gmspeed value=[0..4]");
        }
        break;
      case admin_invul:
        handleInvul(activeChar, activeChar);
        if (activeChar.isInvul())
        {
          if (Config.SAVE_GM_EFFECTS)
          {
            activeChar.setVar("gm_invul", "true", -1);
          }
        }
        else
        {
          activeChar.unsetVar("gm_invul");
        }
        break;
      default:
        break;
    }
    if (!activeChar.isGM())
    {
      return false;
    }
    switch (command)
    {
      case admin_offline_vis:
        for (Player player : GameObjectsStorage.getAllPlayers())
        {
          if ((player != null) && player.isInOfflineMode())
          {
            player.setInvisibleType(InvisibleType.NONE);
            player.decayMe();
            player.spawnMe();
          }
        }
        break;
      case admin_offline_invis:
        for (Player player : GameObjectsStorage.getAllPlayers())
        {
          if ((player != null) && player.isInOfflineMode())
          {
            player.setInvisibleType(InvisibleType.NORMAL);
            player.decayMe();
          }
        }
        break;
      case admin_earthquake:
        try
        {
          int intensity = Integer.parseInt(wordList[1]);
          int duration = Integer.parseInt(wordList[2]);
          activeChar.broadcastPacket(new Earthquake(activeChar.getLoc(), intensity, duration));
        }
        catch (Exception e)
        {
          activeChar.sendMessage("USAGE: //earthquake intensity duration");
          return false;
        }
        break;
      case admin_block:
        if ((target == null) || !target.isCreature())
        {
          activeChar.sendPacket(Msg.INVALID_TARGET);
          return false;
        }
        if (((Creature) target).isBlocked())
        {
          return false;
        }
        ((Creature) target).abortAttack(true, false);
        ((Creature) target).abortCast(true, false);
        ((Creature) target).block();
        activeChar.sendMessage("Target blocked.");
        break;
      case admin_unblock:
        if ((target == null) || !target.isCreature())
        {
          activeChar.sendPacket(Msg.INVALID_TARGET);
          return false;
        }
        if (!((Creature) target).isBlocked())
        {
          return false;
        }
        ((Creature) target).unblock();
        activeChar.sendMessage("Target unblocked.");
        break;
      case admin_changename:
        if (wordList.length < 2)
        {
          activeChar.sendMessage("USAGE: //changename newName");
          return false;
        }
        if (target == null)
        {
          target = activeChar;
        }
        if (!target.isCreature())
        {
          activeChar.sendPacket(Msg.INVALID_TARGET);
          return false;
        }
        String oldName = ((Creature) target).getName();
        String newName = Util.joinStrings(" ", wordList, 1);
        ((Creature) target).setName(newName);
        ((Creature) target).broadcastCharInfo();
        activeChar.sendMessage("Changed name from " + oldName + " to " + newName + ".");
        break;
      case admin_setinvul:
        if ((target == null) || !target.isPlayer())
        {
          activeChar.sendPacket(Msg.INVALID_TARGET);
          return false;
        }
        handleInvul(activeChar, (Player) target);
        break;
      case admin_getinvul:
        if ((target != null) && target.isCreature())
        {
          activeChar.sendMessage("Target " + target.getName() + "(object ID: " + target.getObjectId() + ") is " + (!((Creature) target).isInvul() ? "NOT " : "") + "invul");
        }
        break;
      case admin_social:
        if (wordList.length < 2)
        {
          val = Rnd.get(1, 7);
        }
        else
        {
          try
          {
            val = Integer.parseInt(wordList[1]);
          }
          catch (NumberFormatException nfe)
          {
            activeChar.sendMessage("USAGE: //social value");
            return false;
          }
        }
        if ((target == null) || (target == activeChar))
        {
          activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), val));
        }
        else if (target.isCreature())
        {
          ((Creature) target).broadcastPacket(new SocialAction(target.getObjectId(), val));
        }
        break;
      case admin_abnormal:
        try
        {
View Full Code Here

      {
        activeChar.sendMessage("Can't find player: " + wordList[wordListIndex]);
      }
      return player;
    }
    GameObject my_target = activeChar.getTarget();
    if ((my_target != null) && my_target.isPlayer())
    {
      return (Player) my_target;
    }
    return activeChar;
  }
View Full Code Here

      {
      }
    }
    else if (fullString.equals("admin_kill_menu"))
    {
      GameObject obj = activeChar.getTarget();
      StringTokenizer st = new StringTokenizer(fullString);
      if (st.countTokens() > 1)
      {
        st.nextToken();
        String player = st.nextToken();
        Player plyr = World.getPlayer(player);
        if (plyr == null)
        {
          activeChar.sendMessage("Player " + player + " not found in game.");
        }
        obj = plyr;
      }
      if ((obj != null) && obj.isCreature())
      {
        Creature target = (Creature) obj;
        target.reduceCurrentHp(target.getMaxHp() + 1, 0, activeChar, null, true, true, true, false, false, false, true);
      }
      else
View Full Code Here

   * @param ench int
   * @param armorType int
   */
  private void setEnchant(Player activeChar, int ench, int armorType)
  {
    GameObject target = activeChar.getTarget();
    if (target == null)
    {
      target = activeChar;
    }
    if (!target.isPlayer())
    {
      activeChar.sendMessage("Wrong target type.");
      return;
    }
    Player player = (Player) target;
View Full Code Here

   * Method showMainPage.
   * @param activeChar Player
   */
  public void showMainPage(Player activeChar)
  {
    GameObject target = activeChar.getTarget();
    if (target == null)
    {
      target = activeChar;
    }
    Player player = activeChar;
    if (target.isPlayer())
    {
      player = (Player) target;
    }
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    StringBuilder replyMSG = new StringBuilder("<html><body>");
View Full Code Here

   * @param activeChar Player
   * @param player String
   */
  private void handleRes(Player activeChar, String player)
  {
    GameObject obj = activeChar.getTarget();
    if (player != null)
    {
      Player plyr = World.getPlayer(player);
      if (plyr != null)
      {
View Full Code Here

        catch (StringIndexOutOfBoundsException e)
        {
        }
        break;
      case admin_check_actor:
        GameObject obj = activeChar.getTarget();
        if (obj == null)
        {
          activeChar.sendMessage("target == null");
          return false;
        }
        if (!obj.isCreature())
        {
          activeChar.sendMessage("target is not a character");
          return false;
        }
        Creature target = (Creature) obj;
View Full Code Here

   * @param respawnTime int
   * @param mobCount int
   */
  private void spawnMonster(Player activeChar, String monsterId, int respawnTime, int mobCount)
  {
    GameObject target = activeChar.getTarget();
    if (target == null)
    {
      target = activeChar;
    }
    Pattern pattern = Pattern.compile("[0-9]*");
    Matcher regexp = pattern.matcher(monsterId);
    NpcTemplate template;
    if (regexp.matches())
    {
      int monsterTemplate = Integer.parseInt(monsterId);
      template = NpcHolder.getInstance().getTemplate(monsterTemplate);
    }
    else
    {
      monsterId = monsterId.replace('_', ' ');
      template = NpcHolder.getInstance().getTemplateByName(monsterId);
    }
    if (template == null)
    {
      activeChar.sendMessage("Incorrect monster template.");
      return;
    }
    try
    {
      SimpleSpawner spawn = new SimpleSpawner(template);
      spawn.setLoc(target.getLoc());
      spawn.setAmount(mobCount);
      spawn.setHeading(activeChar.getHeading());
      spawn.setRespawnDelay(respawnTime);
      spawn.setReflection(activeChar.getReflection());
      spawn.init();
      if (respawnTime == 0)
      {
        spawn.stopRespawn();
      }
      activeChar.sendMessage("Created " + template.name + " on " + target.getObjectId() + ".");
    }
    catch (Exception e)
    {
      activeChar.sendMessage("Target is not ingame.");
    }
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.