Package com.l2jfrozen.gameserver.model.actor.instance

Examples of com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance


  }

  private void adminAddSkill(L2PcInstance activeChar, String val)
  {
    L2Object target = activeChar.getTarget();
    L2PcInstance player = null;

    if(target instanceof L2PcInstance)
    {
      if(target==activeChar || (target!=activeChar && activeChar.getAccessLevel().getLevel()<3))
        player = (L2PcInstance) target;
      else{
        showMainPage(activeChar);
        activeChar.sendPacket(SystemMessage.sendString("You have not right to add skills to other players"));
        return;
      }
    }
    else
    {
      showMainPage(activeChar);
      activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      return;
    }

    StringTokenizer st = new StringTokenizer(val);

    if(st.countTokens() != 2)
    {
      showMainPage(activeChar);
    }
    else
    {
      L2Skill skill = null;

      try
      {
        String id = st.nextToken();
        String level = st.nextToken();

        int idval = Integer.parseInt(id);
        int levelval = Integer.parseInt(level);

        skill = SkillTable.getInstance().getInfo(idval, levelval);

        level = null;
        id = null;
      }
      catch(Exception e)
      {
        if(Config.ENABLE_ALL_EXCEPTIONS)
          e.printStackTrace();
      }

      if(skill != null)
      {
        String name = skill.getName();
        player.sendMessage("Admin gave you the skill " + name + ".");
        player.addSkill(skill, true);
        //Admin information
        activeChar.sendMessage("You gave the skill " + name + " to " + player.getName() + ".");

        if(Config.DEBUG)
        {
          _log.fine("[GM]" + activeChar.getName() + " gave skill " + name + " to " + player.getName() + ".");
        }

        activeChar.sendSkillList();

        name = null;
View Full Code Here


  }

  private void adminRemoveSkill(L2PcInstance activeChar, int idval)
  {
    L2Object target = activeChar.getTarget();
    L2PcInstance player = null;

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

    L2Skill skill = SkillTable.getInstance().getInfo(idval, player.getSkillLevel(idval));

    if(skill != null)
    {
      String skillname = skill.getName();
      player.sendMessage("Admin removed the skill " + skillname + " from your skills list.");
      player.removeSkill(skill);
      //Admin information 
      activeChar.sendMessage("You removed the skill " + skillname + " from " + player.getName() + ".");

      if(Config.DEBUG)
      {
        _log.fine("[GM]" + activeChar.getName() + " removed skill " + skillname + " from " + player.getName() + ".");
      }

      activeChar.sendSkillList();
    }
    else
View Full Code Here

  }

  private void adminAddClanSkill(L2PcInstance activeChar, int id, int level)
  {
    L2Object target = activeChar.getTarget();
    L2PcInstance player = null;

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

      return;
    }

    target = null;

    if(!player.isClanLeader())
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.S1_IS_NOT_A_CLAN_LEADER).addString(player.getName()));
      showMainPage(activeChar);

      return;
    }

    if(id < 370 || id > 391 || level < 1 || level > 3)
    {
      activeChar.sendMessage("Usage: //add_clan_skill <skill_id> <level>");
      showMainPage(activeChar);

      return;
    }
   
    L2Skill skill = SkillTable.getInstance().getInfo(id, level);
    if(skill != null)
    {
      String skillname = skill.getName();
      SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_SKILL_S1_ADDED);
      sm.addSkillName(id);
      player.sendPacket(sm);
      player.getClan().broadcastToOnlineMembers(sm);
      player.getClan().addNewSkill(skill);
      activeChar.sendMessage("You gave the Clan Skill: " + skillname + " to the clan " + player.getClan().getName() + ".");

      activeChar.getClan().broadcastToOnlineMembers(new PledgeSkillList(activeChar.getClan()));

      for(L2PcInstance member : activeChar.getClan().getOnlineMembers(""))
      {
View Full Code Here

    }

    @Override
  protected void runImpl()
    {
      final L2PcInstance _activeChar = getClient().getActiveChar();
    if (_activeChar == null)
      return;
   
    // Send PartyRoom invite request (with activeChar) name to the target
    final L2PcInstance _target = L2World.getInstance().getPlayer(_name);
    if (_target != null)
    {
      if (!_target.isProcessingRequest())
      {
        _activeChar.onTransactionRequest(_target);
        _target.sendPacket(new ExAskJoinPartyRoom(_activeChar.getName()));
      }
      else
        _activeChar.sendPacket(new SystemMessage(SystemMessageId.S1_IS_BUSY_TRY_LATER).addString(_target.getName()));
    }
    else
      _activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME));
    }
View Full Code Here

    if (!(target instanceof L2PcInstance))
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      return;
    }
    L2PcInstance player = (L2PcInstance) target;
    player.addSnooper(activeChar);
    activeChar.addSnooped(player);
   
    target = null;
    player = null;
  }
View Full Code Here

  }
 
  @Override
  protected void runImpl()
  {
    L2PcInstance requestor = getClient().getActiveChar();
    L2PcInstance target = L2World.getInstance().getPlayer(_name);
   
    if (requestor == null)
      return;
   
    if (!getClient().getFloodProtectors().getPartyInvitation().tryPerformAction("PartyInvitation"))
    {
      requestor.sendMessage("You Cannot Invite into Party So Fast!");
      return;
    }
   
    if (target == null)
    {
      requestor.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
      return;
    }
   
    if ((requestor._inEventDM && (DM.is_teleport() || DM.is_started())) || (target._inEventDM && (DM.is_teleport() || DM.is_started())))
    {
      requestor.sendMessage("You can't invite that player in party!");
      return;
    }
   
    if ((requestor._inEventTvT && !target._inEventTvT && (TvT.is_started() || TvT.is_teleport())) || (!requestor._inEventTvT && target._inEventTvT && (TvT.is_started() || TvT.is_teleport())) || (requestor._inEventCTF && !target._inEventCTF && (CTF.is_started() || CTF.is_teleport())) || (!requestor._inEventCTF && target._inEventCTF && (CTF.is_started() || CTF.is_teleport())))
    {
      requestor.sendMessage("You can't invite that player in party: you or your target are in Event");
      return;
    }
   
    if (target.isInParty())
    {
      SystemMessage msg = new SystemMessage(SystemMessageId.S1_IS_ALREADY_IN_PARTY);
      msg.addString(target.getName());
      requestor.sendPacket(msg);
      return;
    }
   
    if (target == requestor)
    {
      requestor.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      return;
    }
   
    if (target.isCursedWeaponEquiped() || requestor.isCursedWeaponEquiped())
    {
      requestor.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      return;
    }
   
    if (target.isGM() && target.getAppearance().getInvisible())
    {
      requestor.sendMessage("You can't invite GM in invisible mode.");
      return;
    }
   
    if (target.isInJail() || requestor.isInJail())
    {
      SystemMessage sm = SystemMessage.sendString("Player is in Jail");
      requestor.sendPacket(sm);
      return;
    }
   
    if (target.getBlockList().isInBlockList(requestor.getName()))
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.S1_HAS_ADDED_YOU_TO_IGNORE_LIST);
      sm.addString(target.getName());
      requestor.sendPacket(sm);
      return;
    }
   
    if (target.isInOlympiadMode() || requestor.isInOlympiadMode())
      return;
   
    if (target.isInDuel() || requestor.isInDuel())
      return;
   
    if (!requestor.isInParty()) // Asker has no party
    {
      createNewParty(target, requestor);
View Full Code Here

   *
   * @param partyMemberName the party member name
   */
  private void addReputationPointsForPartyMemberClan(String partyMemberName)
  {
    L2PcInstance player = L2World.getInstance().getPlayer(partyMemberName);
    if(player != null)
    {
      if(player.getClan() != null)
      {
        player.getClan().setReputationScore(player.getClan().getReputationScore() + 100, true);
        player.getClan().broadcastToOnlineMembers(new PledgeShowInfoUpdate(player.getClan()));
        SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_MEMBER_S1_WAS_IN_HIGHEST_RANKED_PARTY_IN_FESTIVAL_OF_DARKNESS_AND_GAINED_S2_REPUTATION);
        sm.addString(partyMemberName);
        sm.addNumber(100);
        player.getClan().broadcastToOnlineMembers(sm);
        sm = null;
      }
    }
    else
    {
View Full Code Here

      }
    }
   
    // Right now only L2PcInstance has up-to-date zone status...
    //
    L2PcInstance src = null;
    L2PcInstance dst = null;
   
    if (attacker instanceof L2PlayableInstance && target instanceof L2PlayableInstance)
    { 
      if (attacker instanceof L2PcInstance)
      {
        src = (L2PcInstance) attacker;
      }
      else if (attacker instanceof L2Summon)
      {
        src = ((L2Summon) attacker).getOwner();
      }
     
      if (target instanceof L2PcInstance)
      {
        dst = (L2PcInstance) target;
      }
      else if (target instanceof L2Summon)
      {
        dst = ((L2Summon) target).getOwner();
      }     
    }
   
    if (src != null && src.getAccessLevel().allowPeaceAttack())
    {
      return false;
    }
   
    // checks on event status
    if (src != null && dst != null)
    {   
      // Attacker and target can fight in olympiad with peace zone
      if (src.isInOlympiadMode() && src.isOlympiadStart() && dst.isInOlympiadMode() && dst.isOlympiadStart())
        return false;
     
      if (dst.isInFunEvent() && src.isInFunEvent())
      {
       
        if (src.isInStartedTVTEvent() && dst.isInStartedTVTEvent())
          return false;
        else if (src.isInStartedDMEvent() && dst.isInStartedDMEvent())
          return false;
        else if (src.isInStartedCTFEvent() && dst.isInStartedCTFEvent())
          return false;
        else if (src.isInStartedVIPEvent() && dst.isInStartedVIPEvent())
          return false;
        else if (src.isInStartedVIPEvent() && dst.isInStartedVIPEvent())
          return false;
        // else
        // different events in same location --> already checked       
      }   
    }
View Full Code Here

        // Like L2OFF while use a skill and next interntion == null the char stop auto attack
        if (getAI().getNextIntention() == null && (skill.getSkillType() == SkillType.PDAM && skill.getCastRange() < 400) || skill.getSkillType() == SkillType.BLOW || skill.getSkillType() == SkillType.DRAIN_SOUL || skill.getSkillType() == SkillType.SOW || skill.getSkillType() == SkillType.SPOIL)
        {
          if (this instanceof L2PcInstance)
          {
            L2PcInstance currPlayer = (L2PcInstance) this;
            SkillDat skilldat = currPlayer.getCurrentSkill();
            // Like L2OFF if the skill is BLOW the player doesn't auto attack
            // If on XML skill nextActionAttack = true the char auto attack
            // If CTRL is pressed the autoattack is aborted (like L2OFF)
            if (skilldat != null && !skilldat.isCtrlPressed() && skill.nextActionIsAttack() && getTarget() != null && getTarget() instanceof L2Character)
            {
              getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
            }
          }
          else
          // case NPC
          {
            if (skill.nextActionIsAttack() && getTarget() != null && getTarget() instanceof L2Character)
            {
              getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
            }
            else if ((skill.isOffensive()) && !(skill.getSkillType() == SkillType.UNLOCK) && !(skill.getSkillType() == SkillType.BLOW) && !(skill.getSkillType() == SkillType.DELUXE_KEY_UNLOCK) && skill.getId() != 345 && skill.getId() != 346)
            {
              getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
              getAI().clientStartAutoAttack();
            }
          }
        }
        if (this instanceof L2PcInstance)
        {
          L2PcInstance currPlayer = (L2PcInstance) this;
          SkillDat skilldat = currPlayer.getCurrentSkill();
          if (skilldat != null && !skilldat.isCtrlPressed() && (skill.isOffensive()) && !(skill.getSkillType() == SkillType.UNLOCK) && !(skill.getSkillType() == SkillType.BLOW) && !(skill.getSkillType() == SkillType.DELUXE_KEY_UNLOCK) && skill.getId() != 345 && skill.getId() != 346)
          {
            if(!skill.isMagic() && skill.nextActionIsAttack())
              getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
           
            getAI().clientStartAutoAttack();
          }
        }
        else
        // case npc
        {
          if ((skill.isOffensive()) && !(skill.getSkillType() == SkillType.UNLOCK) && !(skill.getSkillType() == SkillType.BLOW) && !(skill.getSkillType() == SkillType.DELUXE_KEY_UNLOCK) && skill.getId() != 345 && skill.getId() != 346)
          {
            if(!skill.isMagic())
              getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
           
            getAI().clientStartAutoAttack();
          }
        }
      }
      else
      {
        getAI().clientStopAutoAttack();
      }
     
      // Notify the AI of the L2Character with EVT_FINISH_CASTING
      getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
     
      notifyQuestEventSkillFinished(skill, getTarget());
     
      /*
       * If character is a player, then wipe their current cast state and check if a skill is queued. If there is a queued skill, launch it and wipe the queue.
       */
      if (this instanceof L2PcInstance)
      {
        L2PcInstance currPlayer = (L2PcInstance) this;
        SkillDat queuedSkill = currPlayer.getQueuedSkill();
       
        currPlayer.setCurrentSkill(null, false, false);
       
        if (queuedSkill != null)
        {
          currPlayer.setQueuedSkill(null, false, false);
         
          // DON'T USE : Recursive call to useMagic() method
          // currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed());
          ThreadPoolManager.getInstance().executeTask(new QueuedMagicUseTask(currPlayer, queuedSkill.getSkill(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()));
        }
View Full Code Here

  {
    if(this instanceof L2NpcInstance
      && (target instanceof L2PcInstance || target instanceof L2Summon))
    {
     
      L2PcInstance player = target instanceof L2PcInstance ? (L2PcInstance) target : ((L2Summon) target).getOwner();
     
      for(Quest quest : ((L2NpcTemplate) getTemplate()).getEventQuests(Quest.QuestEventType.ON_SPELL_FINISHED))
      {
        quest.notifySpellFinished(((L2NpcInstance) this), player, skill);
      }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.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.