Package net.sf.l2j.gameserver.serverpackets

Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage


    L2PcInstance activeChar = getClient().getActiveChar();

    if (activeChar == null)
      return;

    SystemMessage sm;
    java.sql.Connection con = null;

    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      PreparedStatement statement = con.prepareStatement("SELECT friend_id, friend_name FROM character_friends WHERE char_id=?");
      statement.setInt(1, activeChar.getObjectId());

      ResultSet rset = statement.executeQuery();

      //======<Friend List>======
      activeChar.sendPacket(new SystemMessage(SystemMessageId.FRIEND_LIST_HEAD));

            L2PcInstance friend = null;
      while (rset.next())
      {
        // int friendId = rset.getInt("friend_id");
        String friendName = rset.getString("friend_name");
        friend = L2World.getInstance().getPlayer(friendName);

        if (friend == null)
        {
            //  (Currently: Offline)
            sm = new SystemMessage(SystemMessageId.S1_OFFLINE);
            sm.addString(friendName);
        }
        else
        {
            //(Currently: Online)
            sm = new SystemMessage(SystemMessageId.S1_ONLINE);
            sm.addString(friendName);
        }

        activeChar.sendPacket(sm);
      }

      //=========================
      activeChar.sendPacket(new SystemMessage(SystemMessageId.FRIEND_LIST_FOOT));
      sm = null;
      rset.close();
      statement.close();
    }
    catch (Exception e) {
View Full Code Here


        L2PcInstance activeChar = (L2PcInstance)playable;
        int itemId = item.getItemId();

        if (!FloodProtector.getInstance().tryPerformAction(activeChar.getObjectId(), FloodProtector.PROTECTED_FIREWORK))
        {
          SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
          sm.addItemName(itemId);
          activeChar.sendPacket(sm);
          return;
        }

        /*
 
View Full Code Here

    {
        int minlevel = SkillTreeTable.getInstance().getMinLevelForNewSkill(player, classId);

        if (minlevel > 0)
        {
            SystemMessage sm = new SystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN);
            sm.addNumber(minlevel);
            player.sendPacket(sm);
        }
        else
        {
            SystemMessage sm = new SystemMessage(SystemMessageId.NO_MORE_SKILLS_TO_LEARN);
            player.sendPacket(sm);
        }
    }
    else
    {
View Full Code Here

            counts++;
            esl.addSkill(s.getId(), s.getLevel(), s.getSpCost(), s.getExp());
        }
        if (counts == 0)
        {
            player.sendPacket(new SystemMessage(SystemMessageId.THERE_IS_NO_SKILL_THAT_ENABLES_ENCHANT));
            NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
            int level = player.getLevel();

            if (level < 74)
            {
                SystemMessage sm = new SystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN);
                sm.addNumber(level);
                player.sendPacket(sm);
            }
            else
            {
                TextBuilder sb = new TextBuilder();
View Full Code Here

            return;
            }

            if (activeChar.isSitting())
            {
              activeChar.sendPacket(new SystemMessage(SystemMessageId.CANT_MOVE_SITTING));
              return;
            }

            _skill = getChargeSkill(activeChar);
            if (_skill == null)
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
              sm.addItemName(5589);
              activeChar.sendPacket(sm);
              return;
            }

            _effect = activeChar.getChargeEffect();

            if (_effect == null)
            {
                L2Skill dummy = SkillTable.getInstance().getInfo(_skill.getId(),_skill.getLevel());
                if (dummy != null)
                {
                  dummy.getEffects(null, activeChar);
                  activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false);
                  return;
                }
                return;
            }

            if (_effect.getLevel() < 2)
            {
                MagicSkillUser MSU = new MagicSkillUser(playable, activeChar, _skill.getId(), 1, 1, 0);
                activeChar.sendPacket(MSU);
                activeChar.broadcastPacket(MSU);
                _effect.addNumCharges(1);
                activeChar.sendPacket(new EtcStatusUpdate(activeChar));
                activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
            }
            else if (_effect.getLevel() == 2)
            {
                activeChar.sendPacket(new SystemMessage(SystemMessageId.FORCE_MAXLEVEL_REACHED));
            }
            SystemMessage sm = new SystemMessage(SystemMessageId.FORCE_INCREASED_TO_S1);
            sm.addNumber(_effect.getLevel());
            activeChar.sendPacket(sm);
        }
        else
        {
             SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
             sm.addItemName(5589);
             activeChar.sendPacket(sm);
        }
    }
View Full Code Here

    (grade == L2Item.CRYSTAL_B && FishshotId != 6538) ||
    (grade == L2Item.CRYSTAL_A && FishshotId != 6539) ||
    (grade == L2Item.CRYSTAL_S && FishshotId != 6540))
    {
      //1479 - This fishing shot is not fit for the fishing pole crystal.
      activeChar.sendPacket(new SystemMessage(SystemMessageId.WRONG_FISHINGSHOT_GRADE));
      return;
    }

    if (count < 1)
    {
View Full Code Here

    public void run()
        {
            if (Config.DEBUG) _log.info("Lottery: Stopping ticket sell for lottery #" + getId() + ".");
            _isSellingTickets = false;

            Announcements.getInstance().announceToAll(new SystemMessage(SystemMessageId.LOTTERY_TICKET_SALES_TEMP_SUSPENDED));
        }
View Full Code Here

        L2PcInstance activeOwner = null;
        if (playable instanceof L2Summon)
        {
            activeOwner = ((L2Summon)playable).getOwner();
            activeOwner.sendPacket(new SystemMessage(SystemMessageId.PET_CANNOT_USE_ITEM));
            return;
        } else if (playable instanceof L2PcInstance)
        {
          activeOwner = (L2PcInstance)playable;
        }

        if (activeOwner == null)
          return;
        L2Summon activePet = activeOwner.getPet();

        if (activePet == null)
        {
            activeOwner.sendPacket(new SystemMessage(SystemMessageId.PETS_ARE_NOT_AVAILABLE_AT_THIS_TIME));
            return;
        }

        if (activePet.isDead())
        {
            activeOwner.sendPacket(new SystemMessage(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET));
            return;
        }

        int itemId = 6645;
        int shotConsumption = 1;
        L2ItemInstance weaponInst = null;
        L2Weapon weaponItem = null;

        if ((activePet instanceof L2PetInstance) && !(activePet instanceof L2BabyPetInstance))
        {
            weaponInst = ((L2PetInstance)activePet).getActiveWeaponInstance();
            weaponItem = ((L2PetInstance)activePet).getActiveWeaponItem();

            if (weaponInst == null)
            {
                activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SOULSHOTS));
                return;
            }

            if (weaponInst.getChargedSoulshot() != L2ItemInstance.CHARGED_NONE)
            {
                // SoulShots are already active.
                return;
            }

            int shotCount = item.getCount();
            shotConsumption = weaponItem.getSoulShotCount();

            if (shotConsumption == 0)
            {
                activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SOULSHOTS));
                return;
            }

            if (!(shotCount > shotConsumption))
            {
                // Not enough Soulshots to use.
                activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SOULSHOTS_FOR_PET));
                return;
            }

            weaponInst.setChargedSoulshot(L2ItemInstance.CHARGED_SOULSHOT);
        }
        else
        {
            if (activePet.getChargedSoulShot() != L2ItemInstance.CHARGED_NONE)
                return;

            activePet.setChargedSoulShot(L2ItemInstance.CHARGED_SOULSHOT);
        }

        // If the player doesn't have enough beast soulshot remaining, remove any auto soulshot task.
        if (!activeOwner.destroyItemWithoutTrace("Consume", item.getObjectId(), shotConsumption, null, false))
        {
            if (activeOwner.getAutoSoulShot().containsKey(itemId))
            {
                activeOwner.removeAutoSoulShot(itemId);
                activeOwner.sendPacket(new ExAutoSoulShot(itemId, 0));

                SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
                sm.addString(item.getItem().getName());
                activeOwner.sendPacket(sm);
                return;
            }

            activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SOULSHOTS));
            return;
        }

        // Pet uses the power of spirit.
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.PET_USE_THE_POWER_OF_SPIRIT));

        Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUser(activePet, activePet, 2033, 1, 0, 0), 360000/*600*/);
    }
View Full Code Here

      {
        String targetName = command.substring(24);
        L2PcInstance player = L2World.getInstance().getPlayer(targetName);
        if(player == null)
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
          return true;
        }
        if(!player.isInParty())
        {
          activeChar.sendMessage("Player is not in party.");
          teleportCharacter(player,x,y,z,activeChar, "Admin is teleporting you.");
          return true;
        }
        for(L2PcInstance pm : player.getParty().getPartyMembers())
          teleportCharacter(pm, x, y, z, activeChar, "Your party is being teleported by an Admin.");
      }
      catch (Exception e){}
    }
    else if (command.startsWith("admin_recall_clan_menu"))
    {
      int x=activeChar.getX(), y = activeChar.getY(), z=activeChar.getZ();
      try
      {
        String targetName = command.substring(23);
        L2PcInstance player = L2World.getInstance().getPlayer(targetName);
        if(player == null)
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
          return true;
        }
        L2Clan clan = player.getClan();
        if(clan==null)
        {
          activeChar.sendMessage("Player is not in a clan.");
          teleportCharacter(player,x,y,z,activeChar, "Admin is teleporting you.");
          return true;
        }
        L2PcInstance[] members = clan.getOnlineMembers("");
        for(int i = 0; i < members.length; i++)
          teleportCharacter(members[i], x, y, z, activeChar, "Your clan is being teleported by an Admin.");
      }
      catch (Exception e){}
    }
    else if (command.startsWith("admin_goto_char_menu"))
    {
      try
      {
        String targetName = command.substring(21);
        L2PcInstance player = L2World.getInstance().getPlayer(targetName);
        teleportToCharacter(activeChar, player);
      }
      catch (StringIndexOutOfBoundsException e){}
    }
    else if (command.equals("admin_kill_menu"))
    {
      handleKill(activeChar);
    }
    else if (command.startsWith("admin_kick_menu"))
    {
      StringTokenizer st = new StringTokenizer(command);
      if (st.countTokens() > 1)
      {
        st.nextToken();
        String player = st.nextToken();
        L2PcInstance plyr = L2World.getInstance().getPlayer(player);
        SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
        if (plyr != null)
        {
          plyr.logout();
          sm.addString("You kicked " + plyr.getName() + " from the game.");
        }
        else
          sm.addString("Player " + player + " was not found in the game.");
        activeChar.sendPacket(sm);
      }
      showMainPage(activeChar);
    }
    else if (command.startsWith("admin_ban_menu"))
View Full Code Here

            }

            int newprize = getPrize() - (prize1 + prize2 + prize3 + prize4);
            if (Config.DEBUG) _log.info("Lottery: Jackpot for next lottery is " + newprize + ".");

            SystemMessage sm;
            if (count1 > 0)
            {
                // There are winners.
                sm = new SystemMessage(SystemMessageId.AMOUNT_FOR_WINNER_S1_IS_S2_ADENA_WE_HAVE_S3_PRIZE_WINNER);
                sm.addNumber(getId());
                sm.addNumber(getPrize());
                sm.addNumber(count1);
                Announcements.getInstance().announceToAll(sm);
            }
            else
            {
                // There are no winners.
                sm = new SystemMessage(SystemMessageId.AMOUNT_FOR_LOTTERY_S1_IS_S2_ADENA_NO_WINNER);
                sm.addNumber(getId());
                sm.addNumber(getPrize());
                Announcements.getInstance().announceToAll(sm);
            }

            try
            {
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.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.