Jump to content
  • 0

Hallo Guys Someone Can Help Me!


Question

Posted (edited)

Ok so, the problem is this, am creating a l2jfrozen project and i want to add a Special RB Manager, i find one with code for the core i put it but when i open the server then go to the manager i get this http://prntscr.com/anj5q5 & in GS Console i get this message: "Html is too long! this will crash the client!"

I Can't understand why is this, i check the code 40 times but i cant understand, hope you can help me guys  :S :/

If someone help me i will be to much happy!

Thanks in advance!

This is the code:

 

package com.l2jfrozen.gameserver.model.actor.instance;

import com.l2jfrozen.util.database.L2DatabaseFactory;
import com.l2jfrozen.gameserver.ai.CtrlIntention;
import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
import java.util.HashMap;
import java.sql.*;

public class L2RBStatsInstance extends L2NpcInstance {

        public L2RBStatsInstance(int objectId, L2NpcTemplate template) {
            super(objectId, template);
            // TODO Auto-generated constructor stub
        }
        
        public void onAction(L2PcInstance player) {
            if (this != player.getTarget())
            {
                player.setTarget(this);
                player.sendPacket(new MyTargetSelected(getObjectId(), 0));
                player.sendPacket(new ValidateLocation(this));
            }
            else
            {
                player.sendPacket(new MyTargetSelected(getObjectId(), 0));
                player.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, this);
                
                if (!isInsideRadius(player, 150, false, false))
                    player.sendPacket(ActionFailed.STATIC_PACKET);
                else
                    showHtmlWindow(player);
            }
        }
        
        private void showHtmlWindow(L2PcInstance activeChar)
        {
            showChatWindow(activeChar);

            activeChar.sendPacket(ActionFailed.STATIC_PACKET);
        }
        

    public void showChatWindow(L2PcInstance player) {
            NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
            StringBuilder tb = new StringBuilder();
            PreparedStatement statement = null;
            ResultSet rset = null;
            HashMap<Integer,String> raidboss = new  HashMap<Integer,String>();
            
            raidboss.put(100885,"Beleth 50lv");
            raidboss.put(100020,"Istina 80lv");
            
            tb.append("<html><title>Raid Boss Status</title><body><center><br>");
            
            try (Connection con = L2DatabaseFactory.getInstance().getConnection())
            {
                statement = con.prepareStatement("SELECT boss_id, respawn_time FROM grandboss_data UNION SELECT boss_id, respawn_time FROM raidboss_spawnlist");

                rset = statement.executeQuery();
                tb.append("<table width=\"150\">");
                tb.append("<tr><td>Name</td>");
                tb.append("<td>Status</td></tr>");
                
                while (rset.next())
                 {
                    
                    tb.append("<tr><td>" + raidboss.get(rset.getInt("boss_id")) + "</td>");
                    if (rset.getLong("respawn_time") > 0)
                    tb.append("<td><font color=\"b09979\">"  + "Dead" + "</font></td></tr>");
                    else
                    tb.append("<td>" + "<font color=\"b09979\">Alive</font>" + "</td></tr>");
                    
                }
                tb.append("</table>");
                
                rset.close();
                statement.close();
            }
            catch (SQLException e)
            {
                e.printStackTrace();
            }
              
              tb.append("</center></body></html>");
              
              msg.setHtml(tb.toString());
              msg.replace("%objectId%", String.valueOf(this.getObjectId()));
              player.sendPacket(msg);
        }
    }    
      

Edited by antoskasas123

1 answer to this question

Recommended Posts

  • 0
Posted

The html this code produces is too long, that is why it shows you the error. If the html is too long, the client will crash. You can implement an results pagination to show the results.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...