Package net.sf.l2j.gameserver.model.actor.instance

Examples of net.sf.l2j.gameserver.model.actor.instance.L2PcInstance


    }

    @Override
  protected void runImpl()
    {
        L2PcInstance activeChar = getClient().getActiveChar();

        if (activeChar == null)
            return;

        if (activeChar.getPrivateStoreType() == 0 &&
                activeChar.getActiveRequester() == null &&
                !activeChar.isDead())
        {
            if (Config.DEBUG)
                _log.fine("AutoSoulShot:" + _itemId);

            L2ItemInstance item = activeChar.getInventory().getItemByItemId(_itemId);

            if (item != null)
            {
                if (_type == 1)
                {
                  //Fishingshots are not automatic on retail
                  if (_itemId < 6535 || _itemId > 6540) {
                      // Attempt to charge first shot on activation
                      if (_itemId == 6645 || _itemId == 6646 || _itemId == 6647)
                      {
                          activeChar.addAutoSoulShot(_itemId);
                          ExAutoSoulShot atk = new ExAutoSoulShot(_itemId, _type);
                          activeChar.sendPacket(atk);

                          //start the auto soulshot use
                          SystemMessage sm = new SystemMessage(SystemMessageId.USE_OF_S1_WILL_BE_AUTO);
                          sm.addString(item.getItemName());
                          activeChar.sendPacket(sm);
                          sm = null;

                          activeChar.rechargeAutoSoulShot(true, true, true);
                      }
                      else {
                        if (activeChar.getActiveWeaponItem() != activeChar.getFistsWeaponItem()
                            && item.getItem().getCrystalType() == activeChar.getActiveWeaponItem().getCrystalType())
                        {
                          if (_itemId>=3947 && _itemId<=3952 && activeChar.isInOlympiadMode()){
                            SystemMessage sm = new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
                            sm.addString(item.getItemName());
                            activeChar.sendPacket(sm);
                            sm = null;
                          }else{
                            activeChar.addAutoSoulShot(_itemId);
                            ExAutoSoulShot atk = new ExAutoSoulShot(_itemId, _type);
                            activeChar.sendPacket(atk);

                            // start the auto soulshot use
                            SystemMessage sm = new SystemMessage(SystemMessageId.USE_OF_S1_WILL_BE_AUTO);
                            sm.addString(item.getItemName());
                            activeChar.sendPacket(sm);
                            sm = null;

                            activeChar.rechargeAutoSoulShot(true, true, false);
                          }
                        }
                        else {
                          if ((_itemId >= 2509 && _itemId <= 2514) || (_itemId >= 3947 && _itemId <= 3952) || _itemId == 5790)
                            activeChar.sendPacket(new SystemMessage(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH));
                          else
                            activeChar.sendPacket(new SystemMessage(SystemMessageId.SOULSHOTS_GRADE_MISMATCH));
                        }
                      }
                    }
                }
                else if (_type == 0)
                {
                    activeChar.removeAutoSoulShot(_itemId);
                    ExAutoSoulShot atk = new ExAutoSoulShot(_itemId, _type);
                    activeChar.sendPacket(atk);

                    //cancel the auto soulshot use
                    SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
                    sm.addString(item.getItemName());
                    activeChar.sendPacket(sm);
                    sm = null;
                }
            }
        }
    }
View Full Code Here


  }

  @Override
  protected void runImpl()
  {
    L2PcInstance player = getClient().getActiveChar();
    if (player == null)
        return;

    player.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
    player.broadcastUserInfo();
    player.standUp();
  }
View Full Code Here

        else if (command.startsWith("admin_teleportto "))
        {
            try
            {
                String targetName = command.substring(17);
                L2PcInstance player = L2World.getInstance().getPlayer(targetName);
                teleportToCharacter(activeChar, player);
            }
            catch (StringIndexOutOfBoundsException e)
            { }
        }
        else if (command.startsWith("admin_recall "))
        {
            try
            {
                String targetName = command.substring(13);
                L2PcInstance player = L2World.getInstance().getPlayer(targetName);
                if (activeChar.getAccessLevel()>=REQUIRED_LEVEL2)
                  teleportCharacter(player, activeChar.getX(), activeChar.getY(), activeChar.getZ());
            }
            catch (StringIndexOutOfBoundsException e)
            { }
View Full Code Here


    private void showTeleportCharWindow(L2PcInstance activeChar)
    {
        L2Object target = activeChar.getTarget();
        L2PcInstance player = null;
        if (target instanceof L2PcInstance)
        {
            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");
View Full Code Here

    }

    private void teleportCharacter(L2PcInstance activeChar , String Cords)
    {
        L2Object target = activeChar.getTarget();
        L2PcInstance player = null;
        if (target instanceof L2PcInstance)
        {
            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
            {
View Full Code Here

        }
    }

    private void teleportToCharacter(L2PcInstance activeChar, L2Object target)
    {
        L2PcInstance player = null;
        if (target != null && target instanceof L2PcInstance)
        {
            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();

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

            activeChar.sendMessage("You have teleported to character " + player.getName() + ".");
        }
    }
View Full Code Here

  public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
    {

      if (activeChar == null || !(activeChar instanceof L2PcInstance)) return;

        L2PcInstance player = (L2PcInstance)activeChar;

        if (!activeChar.isRiding()) return;
        if (!(player.getTarget() instanceof L2DoorInstance)) return;

        Castle castle = CastleManager.getInstance().getCastle(player);
        if (castle == null || !checkIfOkToUseStriderSiegeAssault(player, castle, true)) return;

        try
        {
            L2ItemInstance itemToTake = player.getInventory().getItemByItemId(skill.getItemConsumeId());
            if(!player.destroyItem("Consume", itemToTake.getObjectId(), skill.getItemConsume(), null, true))
              return;

            // damage calculation
            int damage = 0;

            for(int index = 0;index < targets.length;index++)
            {
                L2Character target = (L2Character)targets[index];
                L2ItemInstance weapon = activeChar.getActiveWeaponInstance();
                if (activeChar instanceof L2PcInstance && target instanceof L2PcInstance &&
                    target.isAlikeDead() && target.isFakeDeath())
                {
                  target.stopFakeDeath(null);
                }
                else if (target.isAlikeDead())
                    continue;

                boolean dual  = activeChar.isUsingDualWeapon();
                boolean shld = Formulas.getInstance().calcShldUse(activeChar, target);
                boolean crit = Formulas.getInstance().calcCrit(activeChar.getCriticalHit(target, skill));
                boolean soul = (weapon!= null && weapon.getChargedSoulshot() == L2ItemInstance.CHARGED_SOULSHOT && weapon.getItemType() != L2WeaponType.DAGGER );

                if(!crit && (skill.getCondition() & L2Skill.COND_CRIT) != 0)
                  damage = 0;
                else
                  damage = (int)Formulas.getInstance().calcPhysDam(
                  activeChar, target, skill, shld, crit, dual, soul);

                if (damage > 0)
                {
                  target.reduceCurrentHp(damage, activeChar);
                  if (soul && weapon!= null)
                    weapon.setChargedSoulshot(L2ItemInstance.CHARGED_NONE);

                  activeChar.sendDamageMessage(target, damage, false, false, false);

                }
                else activeChar.sendPacket(SystemMessage.sendString(skill.getName() + " failed."));
            }
        }
        catch (Exception e)
        {
            player.sendMessage("Error using siege assault:" + e);
        }
    }
View Full Code Here

  }

  @Override
  protected void runImpl()
  {
    L2PcInstance player = getClient().getActiveChar();
    if (player == null) return;

        // Player shouldn't be able to set stores if he/she is alike dead (dead or fake death)
        if (player.isAlikeDead())
        {
            sendPacket(new ActionFailed());
            return;
        }

        if (player.isInOlympiadMode())
        {
            sendPacket(new ActionFailed());
            return;
        }
        if (player.getMountType() != 0)
        {
          return;
        }
        if (player.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL
            || player.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL + 1
            || player.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_PACKAGE_SELL)
          player.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);

        if (player.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_NONE)
        {
      if (player.isSitting()) player.standUp();
      player.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_SELL + 1);
      player.sendPacket(new PrivateStoreManageListSell(player));
        }
  }
View Full Code Here

    {
        if (activeChar == null || !(activeChar instanceof L2PcInstance))
            return false;

        SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
        L2PcInstance player = (L2PcInstance)activeChar;

        if (castle == null || castle.getCastleId() <= 0)
            sm.addString("You must be on castle ground to use strider siege assault");
        else if (!castle.getSiege().getIsInProgress())
            sm.addString("You can only use strider siege assault during a siege.");
        else if (!(player.getTarget() instanceof L2DoorInstance))
            sm.addString("You can only use strider siege assault on doors and walls.");
        else if (!activeChar.isRiding())
            sm.addString("You can only use strider siege assault when on strider.");
        else
            return true;

        if (!isCheckOnly) {player.sendPacket(sm);}
        return false;
    }
View Full Code Here

   */

  @Override
  protected void runImpl()
  {
    L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null)
      return;
    if (activeChar.inObserverMode()) activeChar.leaveOlympiadObserverMode();
  }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.actor.instance.L2PcInstance

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.