Package com.l2jfrozen.gameserver.network.serverpackets

Examples of com.l2jfrozen.gameserver.network.serverpackets.SystemMessage


    if(this instanceof L2PcInstance)
    {
      if(((L2PcInstance) this).inObserverMode())
      {
        sendPacket(new SystemMessage(SystemMessageId.OBSERVERS_CANNOT_PARTICIPATE));
        sendPacket(ActionFailed.STATIC_PACKET);
        return;
      }

      if(target instanceof L2PcInstance)
      {
        if(((L2PcInstance) target).isCursedWeaponEquiped() && ((L2PcInstance) this).getLevel() <= Config.MAX_LEVEL_NEWBIE)
        {
          ((L2PcInstance) this).sendMessage("Can't attack a cursed player when under level 21.");
          sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }

        if(((L2PcInstance) this).isCursedWeaponEquiped() && ((L2PcInstance) target).getLevel() <= Config.MAX_LEVEL_NEWBIE)
        {
          ((L2PcInstance) this).sendMessage("Can't attack a newbie player using a cursed weapon.");
          sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
      }

      //thank l2dot
      if(getObjectId() == target.getObjectId())
      {
        //((L2PcInstance) this).sendMessage("Can't attack yourself! Suicide? :)");
        sendPacket(ActionFailed.STATIC_PACKET);
        return;
      }
     
      if (target instanceof L2NpcInstance && Config.DISABLE_ATTACK_NPC_TYPE)
      {
        String mobtype = ((L2NpcInstance) target).getTemplate().type;
        if (!Config.LIST_ALLOWED_NPC_TYPES.contains(mobtype))
        {
          SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
          sm.addString("Npc Type "+mobtype+" has Protection - No Attack Allowed!");
          ((L2PcInstance) this).sendPacket(sm);
          ((L2PcInstance) this).sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
      }
     
    }

    // Get the active weapon instance (always equiped in the right hand)
    L2ItemInstance weaponInst = getActiveWeaponInstance();

    // Get the active weapon item corresponding to the active weapon instance (always equiped in the right hand)
    L2Weapon weaponItem = getActiveWeaponItem();
   
    if(weaponItem != null && weaponItem.getItemType() == L2WeaponType.ROD)
    {
      //  You can't make an attack with a fishing pole.
      ((L2PcInstance) this).sendPacket(new SystemMessage(SystemMessageId.CANNOT_ATTACK_WITH_FISHING_POLE));
      getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);

      sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }
   
    // TEMPFIX: Check client Z coordinate instead of server z to avoid exploit
    // killing Zaken from others floor
    if ((target instanceof L2GrandBossInstance) && ((L2GrandBossInstance) target).getNpcId() == 29022)
    {
      if (Math.abs(this.getClientZ() - target.getZ()) > 200)
      {
        sendPacket(new SystemMessage(SystemMessageId.CANT_SEE_TARGET));
        getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
        sendPacket(ActionFailed.STATIC_PACKET);
        return;
      }
    }

    // GeoData Los Check here (or dz > 1000)
    if(!GeoData.getInstance().canSeeTarget(this, target))
    {
      sendPacket(new SystemMessage(SystemMessageId.CANT_SEE_TARGET));
      getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
      sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    // Check for a bow
    if(weaponItem != null && weaponItem.getItemType() == L2WeaponType.BOW)
    {
     
      // Equip arrows needed in left hand and send a Server->Client packet ItemList to the L2PcINstance then return True
      if(!checkAndEquipArrows())
      {
        // Cancel the action because the L2PcInstance have no arrow
        getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);

        sendPacket(ActionFailed.STATIC_PACKET);
        sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_ARROWS));
        return;
      }
     
      //Check for arrows and MP
      if(this instanceof L2PcInstance)
      {
        // Checking if target has moved to peace zone - only for player-bow attacks at the moment
        // Other melee is checked in movement code and for offensive spells a check is done every time
        if(target.isInsidePeaceZone((L2PcInstance) this))
        {
          getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
          sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }

        // Verify if the bow can be use
        if(_disableBowAttackEndTime <= GameTimeController.getGameTicks())
        {
          // Verify if L2PcInstance owns enough MP
          int saMpConsume = (int) getStat().calcStat(Stats.MP_CONSUME, 0, null, null);
          int mpConsume = saMpConsume == 0 ? weaponItem.getMpConsume() : saMpConsume;

          if(getCurrentMp() < mpConsume)
          {
            // If L2PcInstance doesn't have enough MP, stop the attack
            ThreadPoolManager.getInstance().scheduleAi(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), 1000);

            sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_MP));
            sendPacket(ActionFailed.STATIC_PACKET);
            return;
          }
          // If L2PcInstance have enough MP, the bow consummes it
          getStatus().reduceMp(mpConsume);

          // Set the period of bow non re-use
          _disableBowAttackEndTime = 5 * GameTimeController.TICKS_PER_SECOND + GameTimeController.getGameTicks();
        }
        else
        {
          // Cancel the action because the bow can't be re-use at this moment
          ThreadPoolManager.getInstance().scheduleAi(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), 1000);

          sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }

      }
      else if(this instanceof L2NpcInstance)
      {
        if(_disableBowAttackEndTime > GameTimeController.getGameTicks())
          return;
      }
    }

    // Add the L2PcInstance to _knownObjects and _knownPlayer of the target
    target.getKnownList().addKnownObject(this);

    // Reduce the current CP if TIREDNESS configuration is activated
    if(Config.ALT_GAME_TIREDNESS)
    {
      setCurrentCp(getCurrentCp() - 10);
    }

    // Recharge any active auto soulshot tasks for player (or player's summon if one exists).
    if(this instanceof L2PcInstance)
    {
      ((L2PcInstance) this).rechargeAutoSoulShot(true, false, false);
    }
    else if(this instanceof L2Summon)
    {
      ((L2Summon) this).getOwner().rechargeAutoSoulShot(true, false, true);
    }

    // Verify if soulshots are charged.
    boolean wasSSCharged;

    if(this instanceof L2Summon && !(this instanceof L2PetInstance))
    {
      wasSSCharged = ((L2Summon) this).getChargedSoulShot() != L2ItemInstance.CHARGED_NONE;
    }
    else
    {
      wasSSCharged = weaponInst != null && weaponInst.getChargedSoulshot() != L2ItemInstance.CHARGED_NONE;
    }

   
    // Get the Attack Speed of the L2Character (delay (in milliseconds) before next attack)
    int timeAtk = calculateTimeBetweenAttacks(target, weaponItem);
    // the hit is calculated to happen halfway to the animation - might need further tuning e.g. in bow case
    int timeToHit = timeAtk / 2;
    _attackEndTime = GameTimeController.getGameTicks();
    _attackEndTime += (timeAtk / GameTimeController.MILLIS_IN_TICK);
    _attackEndTime -= 1;

    int ssGrade = 0;

    if(weaponItem != null)
    {
      ssGrade = weaponItem.getCrystalType();
    }

    // Create a Server->Client packet Attack
    Attack attack = new Attack(this, wasSSCharged, ssGrade);

    boolean hitted;

    // Set the Attacking Body part to CHEST
    setAttackingBodypart();

    // Heading calculation on every attack
    this.setHeading(Util.calculateHeadingFrom(this.getX(), this.getY(), target.getX(), target.getY()));
   
    // Get the Attack Reuse Delay of the L2Weapon
    int reuse = calculateReuseTime(target, weaponItem);

    // Select the type of attack to start
    if(weaponItem == null)
    {
      hitted = doAttackHitSimple(attack, target, timeToHit);
    }
    else if(weaponItem.getItemType() == L2WeaponType.BOW)
    {
      hitted = doAttackHitByBow(attack, target, timeAtk, reuse);
    }
    else if(weaponItem.getItemType() == L2WeaponType.POLE)
    {
      hitted = doAttackHitByPole(attack, timeToHit);
    }
    else if(isUsingDualWeapon())
    {
      hitted = doAttackHitByDual(attack, target, timeToHit);
    }
    else
    {
      hitted = doAttackHitSimple(attack, target, timeToHit);
    }
   
    // Flag the attacker if it's a L2PcInstance outside a PvP area
    L2PcInstance player = null;

    if(this instanceof L2PcInstance)
    {
      player = (L2PcInstance) this;
    }
    else if(this instanceof L2Summon)
    {
      player = ((L2Summon) this).getOwner();
    }

    if(player != null)
    {
      player.updatePvPStatus(target);
    }

    // Check if hit isn't missed
    if(!hitted)
    {
      //MAJAX fix
      sendPacket(new SystemMessage(SystemMessageId.MISSED_TARGET));
      // Abort the attack of the L2Character and send Server->Client ActionFailed packet
      abortAttack();
    }
    else
    {
View Full Code Here


    // Check if the L2Character is a L2PcInstance
    if(this instanceof L2PcInstance)
    {
      // Send a system message
      sendPacket(new SystemMessage(SystemMessageId.GETTING_READY_TO_SHOOT_AN_ARROW));

      // Send a Server->Client packet SetupGauge
      SetupGauge sg = new SetupGauge(SetupGauge.RED, sAtk + reuse);
      sendPacket(sg);
      sg = null;
View Full Code Here

   
    if(isSkillDisabled(skill.getId()))
    {
      if(activeChar instanceof L2PcInstance && !(skill.getId() == 2166))
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.S1_PREPARED_FOR_REUSE);
        sm.addSkillName(skill.getId(), skill.getLevel());
        sendPacket(sm);
        sm = null;
      }
      // Cp potion message
      else if(activeChar instanceof L2PcInstance && (skill.getId() == 2166))
      {
        if (skill.getLevel() == 2)
        ((L2PcInstance) activeChar).sendMessage("Greater CP Potion is not available at this time: being prepared for reuse.");
        else if (skill.getLevel() == 1)
        ((L2PcInstance) activeChar).sendMessage("CP Potion is not available at this time: being prepared for reuse.")
      }
     
      return;
    }

    // Check if the skill is a magic spell and if the L2Character is not muted
    if(skill.isMagic() && isMuted() && !skill.isPotion())
    {
      getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
      return;
    }

    // Check if the skill is psychical and if the L2Character is not psychical_muted
    if(!skill.isMagic() && isPsychicalMuted() && !skill.isPotion())
    {
      getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
      return;
    }

    // Can't use Hero and resurrect skills during Olympiad
    if(activeChar instanceof L2PcInstance && ((L2PcInstance) activeChar).isInOlympiadMode() && (skill.isHeroSkill() || skill.getSkillType() == SkillType.RESURRECT))
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.THIS_SKILL_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
      sendPacket(sm);
      sm = null;
      return;
    }
   
    // Like L2OFF you can't use skills when you are attacking now
    if (activeChar instanceof L2PcInstance && !skill.isPotion())
    {
      L2ItemInstance rhand = ((L2PcInstance) this).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
      if ((rhand != null && rhand.getItemType() == L2WeaponType.BOW))
      {
        if (isAttackingNow())
          return;
      }
    }
   
    // prevent casting signets to peace zone
        if (skill.getSkillType() == SkillType.SIGNET || skill.getSkillType() == SkillType.SIGNET_CASTTIME)
    {
      /*for (L2Effect effect : getAllEffects())
      {
        if (effect.getEffectType() == L2Effect.EffectType.SIGNET_EFFECT
          || effect.getEffectType() == L2Effect.EffectType.SIGNET_GROUND)
        {
          SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
          sm.addSkillName(skill.getId());
          sendPacket(sm);
          return;
        }
      }*/
     
      L2WorldRegion region = getWorldRegion();
      if (region == null) return;
      boolean canCast = true;
      if (skill.getTargetType() == SkillTargetType.TARGET_GROUND && this instanceof L2PcInstance)
      {
        Point3D wp = ((L2PcInstance) this).getCurrentSkillWorldPosition();
        if (!region.checkEffectRangeInsidePeaceZone(skill, wp.getX(), wp.getY(), wp.getZ()))
          canCast = false;
      }
      else if (!region.checkEffectRangeInsidePeaceZone(skill, getX(), getY(), getZ()))
        canCast = false;
      if (!canCast)
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
        sm.addSkillName(skill.getId());
        sendPacket(sm);
        return;
      }
    }

    //Recharge AutoSoulShot
    if(skill.useSoulShot())
    {
      if(activeChar instanceof L2PcInstance)
      {
        ((L2PcInstance) activeChar).rechargeAutoSoulShot(true, false, false);
      }
      else if(this instanceof L2Summon)
      {
        ((L2Summon) activeChar).getOwner().rechargeAutoSoulShot(true, false, true);
      }
    }
    else if(skill.useSpiritShot())
    {
      if(activeChar instanceof L2PcInstance)
      {
        ((L2PcInstance) activeChar).rechargeAutoSoulShot(false, true, false);
      }
      else if(activeChar instanceof L2Summon)
      {
        ((L2Summon) activeChar).getOwner().rechargeAutoSoulShot(false, true, true);
      }
    }
    //else if (skill.useFishShot())
    //{
    //  if (this instanceof L2PcInstance)
    //    ((L2PcInstance)this).rechargeAutoSoulShot(true, false, false);
    //}

    // Get all possible targets of the skill in a table in function of the skill target type
    final L2Object[] targets = skill.getTargetList(activeChar);
    // Set the target of the skill in function of Skill Type and Target Type
    L2Character target = null;

    if(skill.getTargetType() == SkillTargetType.TARGET_AURA || skill.getTargetType() == SkillTargetType.TARGET_GROUND || skill.isPotion())
    {
      target = this;
    }
    else if(targets == null || targets.length == 0)
    {
      getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
      return;
    }
    else if((skill.getSkillType() == SkillType.BUFF || skill.getSkillType() == SkillType.HEAL || skill.getSkillType() == SkillType.COMBATPOINTHEAL || skill.getSkillType() == SkillType.COMBATPOINTPERCENTHEAL || skill.getSkillType() == SkillType.MANAHEAL || skill.getSkillType() == SkillType.REFLECT || skill.getSkillType() == SkillType.SEED || skill.getTargetType() == L2Skill.SkillTargetType.TARGET_SELF || skill.getTargetType() == L2Skill.SkillTargetType.TARGET_PET || skill.getTargetType() == L2Skill.SkillTargetType.TARGET_PARTY || skill.getTargetType() == L2Skill.SkillTargetType.TARGET_CLAN || skill.getTargetType() == L2Skill.SkillTargetType.TARGET_ALLY) && !skill.isPotion())
    {
      target = (L2Character) targets[0];

      /*if (this instanceof L2PcInstance && target instanceof L2PcInstance && target.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK)
      {
        if(skill.getSkillType() == SkillType.BUFF || skill.getSkillType() == SkillType.HOT || skill.getSkillType() == SkillType.HEAL || skill.getSkillType() == SkillType.HEAL_PERCENT || skill.getSkillType() == SkillType.MANAHEAL || skill.getSkillType() == SkillType.MANAHEAL_PERCENT || skill.getSkillType() == SkillType.BALANCE_LIFE)
          target.setLastBuffer(this);

        if (((L2PcInstance)this).isInParty() && skill.getTargetType() == L2Skill.SkillTargetType.TARGET_PARTY)
        {
          for (L2PcInstance member : ((L2PcInstance)this).getParty().getPartyMembers())
             member.setLastBuffer(this);
        }
      }*/
    }
    else
    {
      target = (L2Character) getTarget();
    }

    if(target == null)
    {
      getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
      return;
    }

    // Player can't heal rb config
    if(!Config.PLAYERS_CAN_HEAL_RB
        && activeChar instanceof L2PcInstance
        && !((L2PcInstance) activeChar).isGM()
        && (target instanceof L2RaidBossInstance || target instanceof L2GrandBossInstance)
        && (skill.getSkillType() == SkillType.HEAL || skill.getSkillType() == SkillType.HEAL_PERCENT))
    {
      this.sendPacket( ActionFailed.STATIC_PACKET );
      return;
     }
   
    if (activeChar instanceof L2PcInstance && target instanceof L2NpcInstance && Config.DISABLE_ATTACK_NPC_TYPE)
    {
      String mobtype = ((L2NpcInstance) target).getTemplate().type;
      if (!Config.LIST_ALLOWED_NPC_TYPES.contains(mobtype))
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
        sm.addString("Npc Type "+mobtype+" has Protection - No Attack Allowed!");
        ((L2PcInstance) activeChar).sendPacket(sm);
        ((L2PcInstance) activeChar).sendPacket(ActionFailed.STATIC_PACKET);
        return;
      }
    }
   
    if(skill.isPotion())
      setLastPotionCast(skill);
    else
      setLastSkillCast(skill);

    // Get the Identifier of the skill
    int magicId = skill.getId();

    // Get the Display Identifier for a skill that client can't display
    int displayId = skill.getDisplayId();

    // Get the level of the skill
    int level = skill.getLevel();

    if(level < 1)
    {
      level = 1;
    }

    // Get the casting time of the skill (base)
    int hitTime = skill.getHitTime();
    int coolTime = skill.getCoolTime();
    final boolean effectWhileCasting = skill.hasEffectWhileCasting();

    boolean forceBuff = skill.getSkillType() == SkillType.FORCE_BUFF && target instanceof L2PcInstance;

    // Calculate the casting time of the skill (base + modifier of MAtkSpd)
    // Don't modify the skill time for FORCE_BUFF skills. The skill time for those skills represent the buff time.
    if(!effectWhileCasting && !forceBuff && !skill.isStaticHitTime())
    {
      hitTime = Formulas.getInstance().calcMAtkSpd(activeChar, skill, hitTime);

      if(coolTime > 0)
      {
        coolTime = Formulas.getInstance().calcMAtkSpd(activeChar, skill, coolTime);
      }
    }

    // Calculate altered Cast Speed due to BSpS/SpS only for Magic skills
    if((checkBss() || checkSps()) && !skill.isStaticHitTime() && !skill.isPotion() && skill.isMagic()){
     
      //Only takes 70% of the time to cast a BSpS/SpS cast
      hitTime = (int) (0.70 * hitTime);
      coolTime = (int) (0.70 * coolTime);

      //Because the following are magic skills that do not actively 'eat' BSpS/SpS,
      //I must 'eat' them here so players don't take advantage of infinite speed increase
      /* MANAHEAL, MANARECHARGE, RESURRECT, RECALL*/
      if(skill.getSkillType() == SkillType.MANAHEAL || skill.getSkillType() == SkillType.MANARECHARGE || skill.getSkillType() == SkillType.RESURRECT || skill.getSkillType() == SkillType.RECALL)
      {
        if(checkBss())
          removeBss();
        else
          removeSps();
      }
    }
   
    /*
    // Calculate altered Cast Speed due to BSpS/SpS
    L2ItemInstance weaponInst = getActiveWeaponInstance();

    if(weaponInst != null && skill.isMagic() && !forceBuff && skill.getTargetType() != SkillTargetType.TARGET_SELF && !skill.isStaticHitTime() && !skill.isPotion())
    {
      if(weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT || weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_SPIRITSHOT)
      {
        //Only takes 70% of the time to cast a BSpS/SpS cast
        hitTime = (int) (0.70 * hitTime);
        coolTime = (int) (0.70 * coolTime);

        //Because the following are magic skills that do not actively 'eat' BSpS/SpS,
        //I must 'eat' them here so players don't take advantage of infinite speed increase
        if(skill.getSkillType() == SkillType.BUFF || skill.getSkillType() == SkillType.MANAHEAL || skill.getSkillType() == SkillType.RESURRECT || skill.getSkillType() == SkillType.RECALL || skill.getSkillType() == SkillType.DOT)
        {
          weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
        }
      }
    }

    weaponInst = null;
    */

    if(skill.isPotion()){
      // Set the _castEndTime and _castInterruptTim. +10 ticks for lag situations, will be reseted in onMagicFinalizer
      _castPotionEndTime = 10 + GameTimeController.getGameTicks() + (coolTime + hitTime) / GameTimeController.MILLIS_IN_TICK;
      _castPotionInterruptTime = -2 + GameTimeController.getGameTicks() + hitTime / GameTimeController.MILLIS_IN_TICK;
   
    }else{
      // Set the _castEndTime and _castInterruptTim. +10 ticks for lag situations, will be reseted in onMagicFinalizer
      _castEndTime = 10 + GameTimeController.getGameTicks() + (coolTime + hitTime) / GameTimeController.MILLIS_IN_TICK;
      _castInterruptTime = -2 + GameTimeController.getGameTicks() + hitTime / GameTimeController.MILLIS_IN_TICK;
   
    }
   
   
    // Init the reuse time of the skill
    //int reuseDelay = (int)(skill.getReuseDelay() * getStat().getMReuseRate(skill));
    //reuseDelay *= 333.0 / (skill.isMagic() ? getMAtkSpd() : getPAtkSpd());
    int reuseDelay = skill.getReuseDelay();

    if(activeChar instanceof L2PcInstance && Formulas.getInstance().calcSkillMastery(activeChar))
    {
      reuseDelay = 0;
    }
    else if(!skill.isStaticReuse() && !skill.isPotion())
    {
      if(skill.isMagic())
      {
        reuseDelay *= getStat().getMReuseRate(skill);
      }
      else
      {
        reuseDelay *= getStat().getPReuseRate(skill);
      }

      reuseDelay *= 333.0 / (skill.isMagic() ? getMAtkSpd() : getPAtkSpd());
    }
   
    // To turn local player in target direction
    setHeading(Util.calculateHeadingFrom(getX(), getY(), target.getX(), target.getY()));
     
    /*
    if(skill.isOffensive() && skill.getTargetType() != SkillTargetType.TARGET_AURA && target.isBehind(this))
    {
      moveToLocation(target.getX(), target.getY(), target.getZ(), 0);
      stopMove(null);
    }
    */
   
    // Start the effect as long as the player is casting.
    if(effectWhileCasting)
    {
      callSkill(skill, targets);
    }

    // Send a Server->Client packet MagicSkillUser with target, displayId, level, skillTime, reuseDelay
    // to the L2Character AND to all L2PcInstance in the _KnownPlayers of the L2Character
    broadcastPacket(new MagicSkillUser(this, target, displayId, level, hitTime, reuseDelay));

    // Send a system message USE_S1 to the L2Character
    if (activeChar instanceof L2PcInstance && magicId != 1312)
    {
      if (skill.isPotion())
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.USE_S1_);
        if (magicId == 2005)
          sm.addItemName(728);
        else if (magicId == 2003)
          sm.addItemName(726);
        // Message greater cp potions like retail
        else if (magicId == 2166 && skill.getLevel() == 2)
          sm.addItemName(5592);
        // Message cp potions like retail
        else if (magicId == 2166 && skill.getLevel() == 1)
          sm.addItemName(5591);
        else
          sm.addSkillName(magicId, skill.getLevel());
        sendPacket(sm);
        sm = null;
      }
      else
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.USE_S1);
        if (magicId == 2005)
          sm.addItemName(728);
        else if (magicId == 2003)
          sm.addItemName(726);
        // Message greater cp potions like retail
        else if (magicId == 2166 && skill.getLevel() == 2)
          sm.addItemName(5592);
        // Message cp potions like retail
        else if (magicId == 2166 && skill.getLevel() == 1)
          sm.addItemName(5591);
        else
          sm.addSkillName(magicId, skill.getLevel());
       
        // Skill 2046 is used only for animation on pets
        if (magicId != 2046)
          sendPacket(sm);
        sm = null;
View Full Code Here

          statement.setInt(6, requestor.getObjectId());
          statement.setString(7, requestor.getName());
          statement.setInt(8, 1);
          statement.execute();
          statement.close();
          SystemMessage msg = new SystemMessage(SystemMessageId.YOU_HAVE_SUCCEEDED_INVITING_FRIEND);
          requestor.sendPacket(msg);
         
          // Player added to your friendlist
          msg = new SystemMessage(SystemMessageId.S1_ADDED_TO_FRIENDS);
          msg.addString(player.getName());
          requestor.sendPacket(msg);
          requestor.getFriendList().add(player.getName());
         
          // has joined as friend.
          msg = new SystemMessage(SystemMessageId.S1_JOINED_AS_FRIEND);
          msg.addString(requestor.getName());
          player.sendPacket(msg);
          player.getFriendList().add(requestor.getName());
         
          msg = null;
         
          // friend list rework ;)
          notifyFriends(player);
          notifyFriends(requestor);
          player.sendPacket(new FriendList(player));
          requestor.sendPacket(new FriendList(requestor));
        }
        catch (Exception e)
        {
          if (Config.ENABLE_ALL_EXCEPTIONS)
            e.printStackTrace();
         
          _log.warning("could not add friend objectid: " + e);
        }
        finally
        {
          CloseUtil.close(con);
          con = null;
        }
      }
      else
      {
        SystemMessage msg = new SystemMessage(SystemMessageId.FAILED_TO_INVITE_A_FRIEND);
        requestor.sendPacket(msg);
      }
     
      player.setActiveRequester(null);
      requestor.onTransactionResponse();
View Full Code Here

      {
        _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

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

    boolean countUnlearnable = true;
    int unLearnable = 0;
View Full Code Here

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

    L2Skill[] skills = player.getAllSkills();
View Full Code Here

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

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/charskills.htm");
View Full Code Here

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

    if(player.getName().equals(activeChar.getName()))
    {
      player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_ON_YOURSELF));
    }
    else
    {
      L2Skill[] skills = player.getAllSkills();
      adminSkills = activeChar.getAllSkills();
View Full Code Here

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

    if(adminSkills == null)
    {
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.network.serverpackets.SystemMessage

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.