Autor Tema: [RESUELTO] Html en java, insertar imagen  (Leído 123 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado DeadEnd

  • Moderador L2j
  • *
  • Topic Author
  • Mensajes: 735
  • ar
  • Agradecimientos: 44
  • https://www.l2fairplay.net
    • Fair Play
  • Cronica: : Interlude
  • Revision: Custom
  • S.O: Windows Server 2012
  • Serverpack : L2jForzen
[RESUELTO] Html en java, insertar imagen
« en: Octubre 22, 2018, 06:52:54 am »
gracias
Este post tiene 0 agradecimientos
  • Añade a tus favoritos
  • Buenas gente! estoy queriendo agregarle unas lineas divisorias a la ventana de shift + click para ver el npc , escribi de varias formas pero la linea no me aparece , me podria alguno decir como deberia colocarse?


    Código: [Seleccionar]
    		else if (Config.ALT_GAME_VIEWNPC)
    {
    // Set the target of the L2PcInstance player
    player.setTarget(this);

    // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
    // The player.getLevel() - getLevel() permit to display the correct color in the select window
    MyTargetSelected my = new MyTargetSelected(getObjectId(), player.getLevel() - getLevel());
    player.sendPacket(my);
    my = null;

    // Check if the player is attackable (without a forced attack)
    if (isAutoAttackable(player))
    {
    // Send a Server->Client packet StatusUpdate of the L2NpcInstance to the L2PcInstance to update its HP bar
    StatusUpdate su = new StatusUpdate(getObjectId());
    su.addAttribute(StatusUpdate.CUR_HP, (int) getCurrentHp());
    su.addAttribute(StatusUpdate.MAX_HP, getMaxHp());
    player.sendPacket(su);
    su = null;
    }

    NpcHtmlMessage html = new NpcHtmlMessage(0);
    TextBuilder html1 = new TextBuilder("<html><body>");
    html1.append("<table border=0 width=\"100%\">");
    html1.append("<br><center><font color=\"LEVEL\">[Combat Stats]</font></center>");
    html1.append("<table border=0 width=\"100%\">");
    html1.append("<tr><td>Max.HP</td><td>" + (int) (getMaxHp() / getStat().calcStat(Stats.MAX_HP, 1, this, null)) + "*" + (int) getStat().calcStat(Stats.MAX_HP, 1, this, null) + "</td><td>Max.MP</td><td>" + getMaxMp() + "</td></tr>");
    html1.append("<tr><td>P.Atk.</td><td>" + getPAtk(null) + "</td><td>M.Atk.</td><td>" + getMAtk(null, null) + "</td></tr>");
    html1.append("<tr><td>P.Def.</td><td>" + getPDef(null) + "</td><td>M.Def.</td><td>" + getMDef(null, null) + "</td></tr>");
    html1.append("<tr><td>Accuracy</td><td>" + getAccuracy() + "</td><td>Evasion</td><td>" + getEvasionRate(null) + "</td></tr>");
    html1.append("<tr><td>Critical</td><td>" + getCriticalHit(null, null) + "</td><td>Speed</td><td>" + getRunSpeed() + "</td></tr>");
    html1.append("<tr><td>Atk.Speed</td><td>" + getPAtkSpd() + "</td><td>Cast.Speed</td><td>" + getMAtkSpd() + "</td></tr>");
    html1.append("<tr><td>Race</td><td>" + getTemplate().race + "</td><td></td><td></td></tr>");
    html1.append("</table>");

    html1.append("<br><center><font color=\"LEVEL\">[Drop Info]</font></center><br>");
    html1.append("<center>Rates legend: <font color=\"ff9900\">50% or +</font> | <font color=\"00ff00\">30% to 49% +</font> | <font color=\"00ffff\">29% or -</font> | </center>");
    html1.append("<table border=0 width=\"100%\">");

    for (final L2DropCategory cat : getTemplate().getDropData())
    {
    final FastList<L2DropData> drops = cat.getAllDrops();
    if (drops != null)
    for (final L2DropData drop : drops)
    {
    if (drop == null || ItemTable.getInstance().getTemplate(drop.getItemId()) == null)
    {
    continue;
    }

    final String name = ItemTable.getInstance().getTemplate(drop.getItemId()).getName();

    if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE >= 500000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    html1.append("<tr><td><font color=\"ff9900\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop()* Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop()* Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    else if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE >= 300000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=100% height=1>");
    html1.append("<tr><td><font color=\"00ff00\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    else if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE < 300000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=280 height=1>");
    html1.append("<tr><td><font color=\"00ffff\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    }
    }

    html1.append("</table>");
    html1.append("</body></html>");

    html.setHtml(html1.toString());
    player.sendPacket(html);

    html = null;
    html1 = null;
    }

    Ese es el codigo y los ejemplo de lineas que intente utilizar son:

                         html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
                         html1.append("<tr><td><font color=\"00ff00\">" + name + "</font></td></tr>
    ");
                         html1.append("<img src=\"L2UI.SquareWhite\" width=280 height=1>");

    pero ninguno de los 3 se imprime en pantalla, yo quiero hacer algo como lo que muestro en la imagen:

    Espero alguien pueda ayudarme

    Desde ya muchas gracias,

    Saludos

    DeadEnd


    « Última modificación: Octubre 22, 2018, 10:49:46 am por DeadEnd »

    Conectado Fissban

    • AdminSite
    • *
    • Mensajes: 5622
    • ar
    • Agradecimientos: 1650
      • Mis Proyectos
    • Cronica: : Scions of Destiny
    • Revision: Last
    • S.O: Windows 10
    • Serverpack : L2jAdmins
    A fedehansson le gusta este post.

    Re:Html en java, no muestra linea escrita
    « Respuesta #1 en: Octubre 22, 2018, 08:35:52 am »
    gracias
    Este post tiene 1 agradecimientos
  • Añade a tus favoritos
  • el tema es que estas creando una "tabla" para mostrar los elementos del html, y tu estas queriendo agregar una imagen sin agregarlo en una columna/fila.

    vamos q ponerlo asi y ya luego me cuentas.

    eso si, ten en cuenta que el tamaño del html se incrementara bastante asiq quizas tengas q bajar la cantidad de items mostrados por pagina.


    Código: [Seleccionar]
    		else if (Config.ALT_GAME_VIEWNPC)
    {
    // Set the target of the L2PcInstance player
    player.setTarget(this);

    // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
    // The player.getLevel() - getLevel() permit to display the correct color in the select window
    MyTargetSelected my = new MyTargetSelected(getObjectId(), player.getLevel() - getLevel());
    player.sendPacket(my);
    my = null;

    // Check if the player is attackable (without a forced attack)
    if (isAutoAttackable(player))
    {
    // Send a Server->Client packet StatusUpdate of the L2NpcInstance to the L2PcInstance to update its HP bar
    StatusUpdate su = new StatusUpdate(getObjectId());
    su.addAttribute(StatusUpdate.CUR_HP, (int) getCurrentHp());
    su.addAttribute(StatusUpdate.MAX_HP, getMaxHp());
    player.sendPacket(su);
    su = null;
    }

    NpcHtmlMessage html = new NpcHtmlMessage(0);
    TextBuilder html1 = new TextBuilder("<html><body>");
    html1.append("<table border=0 width=\"100%\">");
    html1.append("<br><center><font color=\"LEVEL\">[Combat Stats]</font></center>");
    html1.append("<table border=0 width=\"100%\">");
    html1.append("<tr><td>Max.HP</td><td>" + (int) (getMaxHp() / getStat().calcStat(Stats.MAX_HP, 1, this, null)) + "*" + (int) getStat().calcStat(Stats.MAX_HP, 1, this, null) + "</td><td>Max.MP</td><td>" + getMaxMp() + "</td></tr>");
    html1.append("<tr><td>P.Atk.</td><td>" + getPAtk(null) + "</td><td>M.Atk.</td><td>" + getMAtk(null, null) + "</td></tr>");
    html1.append("<tr><td>P.Def.</td><td>" + getPDef(null) + "</td><td>M.Def.</td><td>" + getMDef(null, null) + "</td></tr>");
    html1.append("<tr><td>Accuracy</td><td>" + getAccuracy() + "</td><td>Evasion</td><td>" + getEvasionRate(null) + "</td></tr>");
    html1.append("<tr><td>Critical</td><td>" + getCriticalHit(null, null) + "</td><td>Speed</td><td>" + getRunSpeed() + "</td></tr>");
    html1.append("<tr><td>Atk.Speed</td><td>" + getPAtkSpd() + "</td><td>Cast.Speed</td><td>" + getMAtkSpd() + "</td></tr>");
    html1.append("<tr><td>Race</td><td>" + getTemplate().race + "</td><td></td><td></td></tr>");
    html1.append("</table>");

    html1.append("<br><center><font color=\"LEVEL\">[Drop Info]</font></center><br>");
    html1.append("<center>Rates legend: <font color=\"ff9900\">50% or +</font> | <font color=\"00ff00\">30% to 49% +</font> | <font color=\"00ffff\">29% or -</font> | </center>");
    //html1.append("<table border=0 width=\"100%\">");

    for (final L2DropCategory cat : getTemplate().getDropData())
    {
    html1.append("<table border=0 width=\"100%\">");
    final FastList<L2DropData> drops = cat.getAllDrops();
    if (drops != null)
    for (final L2DropData drop : drops)
    {
    if (drop == null || ItemTable.getInstance().getTemplate(drop.getItemId()) == null)
    {
    continue;
    }

    final String name = ItemTable.getInstance().getTemplate(drop.getItemId()).getName();

    if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE >= 500000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    html1.append("<tr><td><font color=\"ff9900\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop()* Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop()* Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    else if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE >= 300000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=100% height=1>");
    html1.append("<tr><td><font color=\"00ff00\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    else if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE < 300000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=280 height=1>");
    html1.append("<tr><td><font color=\"00ffff\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    }

    html1.append("</table>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    }

    //html1.append("</table>");
    html1.append("</body></html>");

    html.setHtml(html1.toString());
    player.sendPacket(html);

    html = null;
    html1 = null;
    }


    Desconectado DeadEnd

    • Moderador L2j
    • *
    • Topic Author
    • Mensajes: 735
    • ar
    • Agradecimientos: 44
    • https://www.l2fairplay.net
      • Fair Play
    • Cronica: : Interlude
    • Revision: Custom
    • S.O: Windows Server 2012
    • Serverpack : L2jForzen
    Re:Html en java, no muestra linea escrita
    « Respuesta #2 en: Octubre 22, 2018, 10:35:21 am »
    gracias
    Este post tiene 0 agradecimientos
  • Añade a tus favoritos
  • el tema es que estas creando una "tabla" para mostrar los elementos del html, y tu estas queriendo agregar una imagen sin agregarlo en una columna/fila.

    vamos q ponerlo asi y ya luego me cuentas.

    eso si, ten en cuenta que el tamaño del html se incrementara bastante asiq quizas tengas q bajar la cantidad de items mostrados por pagina.


    Código: [Seleccionar]
    		else if (Config.ALT_GAME_VIEWNPC)
    {
    // Set the target of the L2PcInstance player
    player.setTarget(this);

    // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
    // The player.getLevel() - getLevel() permit to display the correct color in the select window
    MyTargetSelected my = new MyTargetSelected(getObjectId(), player.getLevel() - getLevel());
    player.sendPacket(my);
    my = null;

    // Check if the player is attackable (without a forced attack)
    if (isAutoAttackable(player))
    {
    // Send a Server->Client packet StatusUpdate of the L2NpcInstance to the L2PcInstance to update its HP bar
    StatusUpdate su = new StatusUpdate(getObjectId());
    su.addAttribute(StatusUpdate.CUR_HP, (int) getCurrentHp());
    su.addAttribute(StatusUpdate.MAX_HP, getMaxHp());
    player.sendPacket(su);
    su = null;
    }

    NpcHtmlMessage html = new NpcHtmlMessage(0);
    TextBuilder html1 = new TextBuilder("<html><body>");
    html1.append("<table border=0 width=\"100%\">");
    html1.append("<br><center><font color=\"LEVEL\">[Combat Stats]</font></center>");
    html1.append("<table border=0 width=\"100%\">");
    html1.append("<tr><td>Max.HP</td><td>" + (int) (getMaxHp() / getStat().calcStat(Stats.MAX_HP, 1, this, null)) + "*" + (int) getStat().calcStat(Stats.MAX_HP, 1, this, null) + "</td><td>Max.MP</td><td>" + getMaxMp() + "</td></tr>");
    html1.append("<tr><td>P.Atk.</td><td>" + getPAtk(null) + "</td><td>M.Atk.</td><td>" + getMAtk(null, null) + "</td></tr>");
    html1.append("<tr><td>P.Def.</td><td>" + getPDef(null) + "</td><td>M.Def.</td><td>" + getMDef(null, null) + "</td></tr>");
    html1.append("<tr><td>Accuracy</td><td>" + getAccuracy() + "</td><td>Evasion</td><td>" + getEvasionRate(null) + "</td></tr>");
    html1.append("<tr><td>Critical</td><td>" + getCriticalHit(null, null) + "</td><td>Speed</td><td>" + getRunSpeed() + "</td></tr>");
    html1.append("<tr><td>Atk.Speed</td><td>" + getPAtkSpd() + "</td><td>Cast.Speed</td><td>" + getMAtkSpd() + "</td></tr>");
    html1.append("<tr><td>Race</td><td>" + getTemplate().race + "</td><td></td><td></td></tr>");
    html1.append("</table>");

    html1.append("<br><center><font color=\"LEVEL\">[Drop Info]</font></center><br>");
    html1.append("<center>Rates legend: <font color=\"ff9900\">50% or +</font> | <font color=\"00ff00\">30% to 49% +</font> | <font color=\"00ffff\">29% or -</font> | </center>");
    //html1.append("<table border=0 width=\"100%\">");

    for (final L2DropCategory cat : getTemplate().getDropData())
    {
    html1.append("<table border=0 width=\"100%\">");
    final FastList<L2DropData> drops = cat.getAllDrops();
    if (drops != null)
    for (final L2DropData drop : drops)
    {
    if (drop == null || ItemTable.getInstance().getTemplate(drop.getItemId()) == null)
    {
    continue;
    }

    final String name = ItemTable.getInstance().getTemplate(drop.getItemId()).getName();

    if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE >= 500000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    html1.append("<tr><td><font color=\"ff9900\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop()* Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop()* Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    else if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE >= 300000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=100% height=1>");
    html1.append("<tr><td><font color=\"00ff00\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    else if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE < 300000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=280 height=1>");
    html1.append("<tr><td><font color=\"00ffff\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    }

    html1.append("</table>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    }

    //html1.append("</table>");
    html1.append("</body></html>");

    html.setHtml(html1.toString());
    player.sendPacket(html);

    html = null;
    html1 = null;
    }



    dejo adjunto el resultado, almenos aparecen las lineas, falta que aparezcan por cada item en separado xD tengo una base, lo analizo lo hago como quiero y publico el resutaldo, gracias fiss!

    Desconectado DeadEnd

    • Moderador L2j
    • *
    • Topic Author
    • Mensajes: 735
    • ar
    • Agradecimientos: 44
    • https://www.l2fairplay.net
      • Fair Play
    • Cronica: : Interlude
    • Revision: Custom
    • S.O: Windows Server 2012
    • Serverpack : L2jForzen
    A Kimeraweb le gusta este post.

    Re:Html en java, no muestra linea escrita
    « Respuesta #3 en: Octubre 22, 2018, 10:49:07 am »
    gracias
    Este post tiene 1 agradecimientos
  • Añade a tus favoritos
  • el tema es que estas creando una "tabla" para mostrar los elementos del html, y tu estas queriendo agregar una imagen sin agregarlo en una columna/fila.

    vamos q ponerlo asi y ya luego me cuentas.

    eso si, ten en cuenta que el tamaño del html se incrementara bastante asiq quizas tengas q bajar la cantidad de items mostrados por pagina.


    Código: [Seleccionar]
    		else if (Config.ALT_GAME_VIEWNPC)
    {
    // Set the target of the L2PcInstance player
    player.setTarget(this);

    // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
    // The player.getLevel() - getLevel() permit to display the correct color in the select window
    MyTargetSelected my = new MyTargetSelected(getObjectId(), player.getLevel() - getLevel());
    player.sendPacket(my);
    my = null;

    // Check if the player is attackable (without a forced attack)
    if (isAutoAttackable(player))
    {
    // Send a Server->Client packet StatusUpdate of the L2NpcInstance to the L2PcInstance to update its HP bar
    StatusUpdate su = new StatusUpdate(getObjectId());
    su.addAttribute(StatusUpdate.CUR_HP, (int) getCurrentHp());
    su.addAttribute(StatusUpdate.MAX_HP, getMaxHp());
    player.sendPacket(su);
    su = null;
    }

    NpcHtmlMessage html = new NpcHtmlMessage(0);
    TextBuilder html1 = new TextBuilder("<html><body>");
    html1.append("<table border=0 width=\"100%\">");
    html1.append("<br><center><font color=\"LEVEL\">[Combat Stats]</font></center>");
    html1.append("<table border=0 width=\"100%\">");
    html1.append("<tr><td>Max.HP</td><td>" + (int) (getMaxHp() / getStat().calcStat(Stats.MAX_HP, 1, this, null)) + "*" + (int) getStat().calcStat(Stats.MAX_HP, 1, this, null) + "</td><td>Max.MP</td><td>" + getMaxMp() + "</td></tr>");
    html1.append("<tr><td>P.Atk.</td><td>" + getPAtk(null) + "</td><td>M.Atk.</td><td>" + getMAtk(null, null) + "</td></tr>");
    html1.append("<tr><td>P.Def.</td><td>" + getPDef(null) + "</td><td>M.Def.</td><td>" + getMDef(null, null) + "</td></tr>");
    html1.append("<tr><td>Accuracy</td><td>" + getAccuracy() + "</td><td>Evasion</td><td>" + getEvasionRate(null) + "</td></tr>");
    html1.append("<tr><td>Critical</td><td>" + getCriticalHit(null, null) + "</td><td>Speed</td><td>" + getRunSpeed() + "</td></tr>");
    html1.append("<tr><td>Atk.Speed</td><td>" + getPAtkSpd() + "</td><td>Cast.Speed</td><td>" + getMAtkSpd() + "</td></tr>");
    html1.append("<tr><td>Race</td><td>" + getTemplate().race + "</td><td></td><td></td></tr>");
    html1.append("</table>");

    html1.append("<br><center><font color=\"LEVEL\">[Drop Info]</font></center><br>");
    html1.append("<center>Rates legend: <font color=\"ff9900\">50% or +</font> | <font color=\"00ff00\">30% to 49% +</font> | <font color=\"00ffff\">29% or -</font> | </center>");
    //html1.append("<table border=0 width=\"100%\">");

    for (final L2DropCategory cat : getTemplate().getDropData())
    {
    html1.append("<table border=0 width=\"100%\">");
    final FastList<L2DropData> drops = cat.getAllDrops();
    if (drops != null)
    for (final L2DropData drop : drops)
    {
    if (drop == null || ItemTable.getInstance().getTemplate(drop.getItemId()) == null)
    {
    continue;
    }

    final String name = ItemTable.getInstance().getTemplate(drop.getItemId()).getName();

    if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE >= 500000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    html1.append("<tr><td><font color=\"ff9900\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop()* Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop()* Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    else if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE >= 300000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=100% height=1>");
    html1.append("<tr><td><font color=\"00ff00\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    else if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE < 300000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=280 height=1>");
    html1.append("<tr><td><font color=\"00ffff\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    }

    html1.append("</table>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    }

    //html1.append("</table>");
    html1.append("</body></html>");

    html.setHtml(html1.toString());
    player.sendPacket(html);

    html = null;
    html1 = null;
    }



    dejo adjunto el resultado, almenos aparecen las lineas, falta que aparezcan por cada item en separado xD tengo una base, lo analizo lo hago como quiero y publico el resutaldo, gracias fiss!

    A decir verdad creo que me gusta asi como quedo, las lineas aparecian y esa era la razon del post, el problema como muestra fissban es que faltaban agregale una tabla que envuelva al for y ya luego anda yo le agregue otras lineas mas para que quede mas bonito y asi deje el codigo:

    Código: [Seleccionar]
    		else if (Config.ALT_GAME_VIEWNPC)
    {
    player.setTarget(this);
    MyTargetSelected my = new MyTargetSelected(getObjectId(), player.getLevel() - getLevel());
    player.sendPacket(my);
    my = null;

    if (isAutoAttackable(player))
    {
    // Send a Server->Client packet StatusUpdate of the L2NpcInstance to the L2PcInstance to update its HP bar
    StatusUpdate su = new StatusUpdate(getObjectId());
    su.addAttribute(StatusUpdate.CUR_HP, (int) getCurrentHp());
    su.addAttribute(StatusUpdate.MAX_HP, getMaxHp());
    player.sendPacket(su);
    su = null;
    }

    NpcHtmlMessage html = new NpcHtmlMessage(0);
    TextBuilder html1 = new TextBuilder("<html><body>");
    html1.append("<table border=0 width=\"100%\">");
    html1.append("<br><center><font color=\"LEVEL\">[Combat Stats]</font></center>");
    html1.append("<table border=0 width=\"100%\">");
    html1.append("<tr><td>Max.HP</td><td>" + (int) (getMaxHp() / getStat().calcStat(Stats.MAX_HP, 1, this, null)) + "*" + (int) getStat().calcStat(Stats.MAX_HP, 1, this, null) + "</td><td>Max.MP</td><td>" + getMaxMp() + "</td></tr>");
    html1.append("<tr><td>P.Atk.</td><td>" + getPAtk(null) + "</td><td>M.Atk.</td><td>" + getMAtk(null, null) + "</td></tr>");
    html1.append("<tr><td>P.Def.</td><td>" + getPDef(null) + "</td><td>M.Def.</td><td>" + getMDef(null, null) + "</td></tr>");
    html1.append("<tr><td>Accuracy</td><td>" + getAccuracy() + "</td><td>Evasion</td><td>" + getEvasionRate(null) + "</td></tr>");
    html1.append("<tr><td>Critical</td><td>" + getCriticalHit(null, null) + "</td><td>Speed</td><td>" + getRunSpeed() + "</td></tr>");
    html1.append("<tr><td>Atk.Speed</td><td>" + getPAtkSpd() + "</td><td>Cast.Speed</td><td>" + getMAtkSpd() + "</td></tr>");
    html1.append("<tr><td>Race</td><td>" + getTemplate().race + "</td><td></td><td></td></tr>");
    html1.append("</table>");

    html1.append("<br><center><font color=\"LEVEL\">[Drop Info]</font></center><br>");
    html1.append("<center>Rates legend: <font color=\"ff9900\">50% or +</font> | <font color=\"00ff00\">30% to 49% +</font> | <font color=\"00ffff\">29% or -</font> | </center>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    html1.append("<br>");

    for (final L2DropCategory cat : getTemplate().getDropData())
    {
    html1.append("<table border=0 width=\"100%\">");

    final FastList<L2DropData> drops = cat.getAllDrops();
    if (drops != null)
    for (final L2DropData drop : drops)
    {
    if (drop == null || ItemTable.getInstance().getTemplate(drop.getItemId()) == null)
    {
    continue;
    }

    final String name = ItemTable.getInstance().getTemplate(drop.getItemId()).getName();

    if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE >= 500000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    html1.append("<tr><td><font color=\"ff9900\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop()* Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop()* Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    else if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE >= 300000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    html1.append("<tr><td><font color=\"00ff00\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    else if (drop.getChance() * Config.RATE_DROP_ITEMS_CHANCE < 300000)
    {
    html1.append("<br>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    html1.append("<tr><td><font color=\"00ffff\">" + name + "</font></td></tr><br>");
    if (drop.getMaxDrop() == 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + "</td></tr><br>");
    }
    if (drop.getMaxDrop() > 1)
    {
    html1.append("<tr><td>" + (drop.isQuestDrop() ? "Quest Drop Quantity: " : cat.isSweep() ? "<font color=\"ffcc00\">Sweep Drop Quanity: </font>" : "Drop Quantity: ") + "" + drop.getMinDrop() * Config.RATE_DROP_ITEMS_MIN_QUANTITY + " - " + drop.getMaxDrop() * Config.RATE_DROP_ITEMS_MAX_QUANTITY + "</td></tr><br>");
    }
    }
    }
    html1.append("</table>");
    html1.append("<img src=\"L2UI.SquareWhite\" width=\"260\" height=\"1\">");
    html1.append("<br>");
    }

    html1.append("</body></html>");

    html.setHtml(html1.toString());
    player.sendPacket(html);

    html = null;
    html1 = null;
    }

    gracias!