Jump to content
  • 0

Add pages to droplist.


Question

Posted

l2jfrozen 1004 interlude.

So I added this code:

 

But when drops are too many I get the usual error Html is too long try using DB for this action.

So I want to add pages for it but I dont have a clue what I am doing.

These are the codes Im trying to follow:
https://pastebin.com/pCEGRBLR

https://pastebin.com/6hdGbztm

 

I dont know if I even add the lines to the correct java .
This is what I have done in the RequestBypassToServer.java.

 

https://pastebin.com/23quwrAC

 

 

 

Recommended Posts

  • 0
Posted

try this maybe it will work:

else if (_command.startsWith("DropListNpc"))
            {              
                private static void showItemsPage(Player activeChar, int page)
                {
                final L2Object object = activeChar.getTarget();
               
                int MaxItemsPerPage = 10;
                int MaxPages = _itemssize / maxItemsPerPage;
                if (_itemssize > MaxItemsPerPage * MaxPages)
                    MaxPages++;
               
           
                if (page > MaxPages)
                    page = MaxPages;
               
                int ItemsStart = MaxItemsPerPage * page;
                int ItemsEnd = _itemssize();
                if (ItemsEnd - ItemsStart > MaxItemsPerPage)
                    ItemsEnd = ItemsStart + MaxItemsPerPage;
               
                if (object instanceof L2NpcInstance)
                {
                    NpcHtmlMessage html = new NpcHtmlMessage(0);
                    StringBuilder html1 = new StringBuilder("<html>");
                   
                    html1.append("<title>Npc Name: " + object.getName() + "</title>");
                    html1.append("<body>");
                    html1.append("<br>");
                    html1.append("<table cellspacing=2 cellpadding=1 width=\"280\">");
                   
                    if (((L2NpcInstance) object).getTemplate().getDropData() != null)
                    {
						int myPage = 1;
						int i = 0;
						int shown = 0;
						boolean hasMore = false;

                        for (L2DropCategory cat : ((L2NpcInstance) object).getTemplate().getDropData())
                        {
							if (shown == MaxItemsPerPage)
							{
							hasMore = true;
							break;
							}
                            for (L2DropData drop : cat.getAllDrops())
                            {
                                final L2Item item = ItemTable.getInstance().getTemplate(drop.getItemId());
                               
                                if (item == null)
                                    continue;
								
								if (myPage != page)
								{
								i++;
								if (i == MaxItemsPerPage)
								{
								myPage++;
								i = 0;
								}
								continue;
								}
					
								if (shown == MaxItemsPerPage)
								{
								hasMore = true;
								break;
								}
								
                                int mind = 0, maxd = 0;
                                String smind = null, smaxd = null;
                                String name = item.getName();
                                if (cat.isSweep())
                                {
                                    mind = (int) (Config.RATE_DROP_SPOIL * drop.getMinDrop());
                                    maxd = (int) (Config.RATE_DROP_SPOIL * drop.getMaxDrop());
                                }
                                else if (drop.getItemId() == 57)
                                {
                                    mind = 300 * drop.getMinDrop();
                                    maxd = 300 * drop.getMaxDrop();
                                }
                                else
                                {
                                    mind = (int) (Config.RATE_DROP_ITEMS * drop.getMinDrop());
                                    maxd = (int) (Config.RATE_DROP_ITEMS * drop.getMaxDrop());
                                }
                                if (mind > 999999)
                                {
                                    DecimalFormat df = new DecimalFormat("###.#");
                                    smind = df.format(((double) (mind)) / 1000000) + " KK";
                                    smaxd = df.format(((double) (maxd)) / 1000000) + " KK";
                                }
                                else if (mind > 999)
                                {
                                    smind = ((mind / 1000)) + " K";
                                    smaxd = ((maxd / 1000)) + " K";
                                }
                               
                                else
                                {
                                    smind = Integer.toString(mind);
                                    smaxd = Integer.toString(maxd);
                                }
                                if (name.startsWith("Common Item - "))
                                {
                                    name = "(CI)" + name.substring(14);
                                }
                                if (name.length() >= 34)
                                {
                                    name = name.substring(0, 30) + "...";
                                }
                                html1.append("<tr>");
                                html1.append("<td valign=top align=center height=38 width=40><img src=\"" + getIcon(item.getItemId()) + "\" height=32 width=32></td>");
                                html1.append("<td>");
                                html1.append("<table cellpadding=0 cellspacing=1 width=237>");
                                html1.append("<tr>");
                                html1.append("<td>" + (drop.getChance() >= 10000 ? (double) drop.getChance() / 10000 : drop.getChance() < 10000 ? (double) drop.getChance() / 10000 : "N/A") + "% is " + (drop.isQuestDrop() ? "<font color=\"00b3b3\">[Quest]</font>" : (cat.isSweep() ? "<font color=\"009900\">[Spoil]</font> " : "[Drop]")) + "</td>");
                                html1.append("</tr>");
                                html1.append("<tr>");
                                html1.append("<td>Name: <font color=fff600>" + name + "</font> " + (maxd == 1 ? "[1]" : "[" + smind + " - " + smaxd + "]") + "</td>");
                                html1.append("</tr>");
                                html1.append("</table>");
                                html1.append("</td>");
								shown++;
                            }
                        }
                    }
                    for (int x = 0; x < MaxPages; x++)
                    {
                        int pagenr = x + 1;
                        if (page == x)
                        {
                            pages += "<td>Page " + pagenr + "</td>";
                        }
                        else
                        {
                            pages += "<td>something " + something() + " " + x + "\">Page " + pagenr + "</a></td>";
                        }
                    }
                    }
                   
                    html1.append("</tr></table>");
                    html1.append("</body>");
                    html1.append("</html>");
                   
                    html.setHtml(html1.toString());
                    activeChar.sendPacket(html);
                   
                    html1 = null;
                    html = null;
                }
               
            }

 

  • 0
Posted
34 minutes ago, wongerlt said:

else if (_command.startsWith("DropListNpc"))

{

     private static void showItemsPage(Player activeChar, int page)

     {

:dat:

  • 0
Posted (edited)

You are doing it wrong guys.

 

First of all you have to create an interface in the MMOCore and implement it's functions in the drop list system. In short: when an NPC happen to have bad drop, the MMOCore should stop the packet communication for all players.

 

Additionally you can include System.exit(-1); to grand boss drops.

Edited by lord_rex
  • Haha 1
  • 0
Posted
30 minutes ago, lord_rex said:

You are doing it wrong guys.

 

First of all you have to create an interface in the MMOCore and implement it's functions in the drop list system. In short: when an NPC happen to have bad drop, the MMOCore should stop the packet communication for all players.

 

Additionally you can include System.exit(-1); to grand boss drops.

 

wnv7r.jpg

  • Haha 1
  • Upvote 2
  • 0
Posted (edited)
On 2/10/2019 at 7:34 PM, wongerlt said:

try this maybe it will work:

 

What did you change?

On 2/10/2019 at 8:08 PM, SweeTs said:

:dat:

 

On 2/10/2019 at 11:32 PM, melron said:

https://pastebin.com/XahC0b9d

 

Take a look there. im using acis bookmarks code as a base to generate pages

 

I can see my mistake in the first line , I guess I have to add them like this:

 


			private static void showItemsPage(Player activeChar, int page)
			{				
				if (_command.startsWith("DropListNpc"))
				{

 

On 2/10/2019 at 11:54 PM, lord_rex said:

You are doing it wrong guys.

 

First of all you have to create an interface in the MMOCore and implement it's functions in the drop list system. In short: when an NPC happen to have bad drop, the MMOCore should stop the packet communication for all players.

 

Additionally you can include System.exit(-1); to grand boss drops.

I dont understand you.

 

 

I really need some help here, can someone help me via  anydesk/tv?

Edited by sotid
  • 0
Posted

if it was to guess this

  1. else if (_command.startsWith("DropListNpc"))
  2.             {

is to go in the command handler and the rest of the method to be called inside.

 

  • 0
Posted
17 hours ago, DenArt Designs said:

if it was to guess this

  1. else if (_command.startsWith("DropListNpc"))
  2.             {

is to go in the command handler and the rest of the method to be called inside.

 

the code added doesnt seem to have any changes to any handler.

where exactly do you mean?

  • 0
Posted

Bcs all is already said. Admin bookmark has code rdy code. All you have to change is the htm display.. Which you already have from original code. So.. Put puzzles together.

  • 0
Posted (edited)
5 hours ago, SweeTs said:

Bcs all is already said. Admin bookmark has code rdy code. All you have to change is the htm display.. Which you already have from original code. So.. Put puzzles together.

So am I adding the code to the right place? lets start from that..

 

If yes then one more Question .

This:

if (_command.startsWith("DropListNpc"))


I think is inside this:

 

 

protected void runImpl()
    {
        L2PcInstance activeChar = getClient().getActiveChar();

        if(activeChar == null)
            return;

        if (!getClient().getFloodProtectors().getServerBypass().tryPerformAction(_command))
            return;
        

        try
        {
          			
                    .
                    .
                    .
               if (_command.startsWith("DropListNpc"))

 

To start something like this :

private static void showItemsPage(Player activeChar, int page)

or

public boolean useAdminCommand(String command, Player activeChar)

I have to start in a new line outside the {} of the code?
Also what admincommands have anything to do with it , this code will be for players.

Edited by sotid
  • 0
Posted

What the heck man...

 

RequestBypassToServer.java

 


        else if (_command.startsWith("dropinfo"))
        {
            final StringTokenizer st = new StringTokenizer(_command, " ");
            st.nextToken();
            
            try
            {
                int npcId = Integer.parseInt(st.nextToken());
                int page = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 1;
                
                showNpcDropList(player, npcId, page);
            }
            catch (Exception e)
            {
                LOGGER.warn("Failed on dropinfo: {}", e);
            }
        }

 

I let you code the showNpcDropList. Hint, it's c/p of original method from admin command to show drop.. Once again, the code for pages you can find HERE. If you have latest aCis, use it as it's slighty modified.

 

Once again, you have ready solution. If you still fail additing it. Then well.. I would suggest to try harder or simply skip it and get back to it later. With clean head. Sometimes you need time to understand things.

  • 0
Posted

@baksteen are you serious? I just gave him a ready code.. Admin show drop view is all he ask for ++ icons. All he have to do now, is to edit the drop display? The text / htm display? Which is shared in initial topic he took the code?

 

Bcs I prefer to force him to learn a thing? You really think when I first time created my own code with pages, I asked for ready code? Hell no. I opened admin bookmark and simply copy the code. I am still doing it when I need pages... It's called logic.

 

He's about to open a server and he can't copy a ready code from other file. Ok, he don't have to, as I don't have to give him fully working code, why should I.

 

Can't find a solution? Ask to a friend to help you (@Kara`).

Don't have a friend to ask for help?

Well, pay someone for rdy code. I don't feel like to provide ready codes, I already gave him 90%.

 

No offense.

 

2 hours ago, baksteen said:

God damn, people nowadays monkaEyes

EXACTLY, you expect ready things, for free. When someone give you hints, give you almost ready code, you whine "OMG noob, give me full code".

 

Sounds legit.

 

lol_meme_postcard-ra61a3bd39cca4033872ab

  • 0
Posted (edited)

@baksteen Because the community is tragic, they don't want to learn either take help. 

They want to grab and open server and if they can use you, they will. You can't imagine how many times i've got tricked by idiots who spend 5 hours of my life telling that they wanted services and close a deal for tomorrow and in the end of conversation they just say they want help setup e.t.c and after the next day they don't respond.

 

Maxcheaters is not a forum that provide free codes, even stackoverflow don't do that. Maxcheaters offer either paid content or help. Now giving help does not mean give them full code cause 1.full code won't help 2. they will keep asking for more and its never ending 3.they just want to use you and no learn just take as i said. 

They don't even respect you at all. From my side just by today i have 2 people who added me, gave their codes and asked for fix - or ask for setup server and when i said i don't do anything free they obviously responded but why should i pay? 

So conslusion? majority are spoiled useless idiots behind a cheap PC who want to open frozen server and make money. Why should we help those? Whoever want to learn he just ask for advice or suggestion, no ask for full code.

 

SweeT's is right and in my opinion he shouldn't even respond, he should drop the topic. This is HELP section no REQUEST full code until i make my server for free

 

Edited by Kara`
Guest
This topic is now closed to further replies.


  • Posts

    • Would it be possible to update the guide? The images are offline! 😞
    • In the fast-paced world of digital marketing, having the right tools makes all the difference. If you're searching for a reliable SMM panel Nigeria, GoUpSocial is here to take your online presence to the next level. Built for influencers, marketers, startups, and content creators, our platform is the ultimate solution for smart and scalable social media growth. With GoUpSocial, you get more than just numbers—you get engagement that drives real impact. As a trusted Nigerian SMM panel, we help you gain visibility across top platforms like Instagram, TikTok, YouTube, Facebook, and Twitter—all at the most competitive prices in the market. Experience the Power of the Best SMM Panel in Nigeria We understand that quality matters just as much as affordability. That’s why GoUpSocial has become the go-to platform for users seeking the best SMM panel in Nigeria. Here’s what makes us the preferred choice: 🚀 Real-Time Delivery: Get your orders processed and completed in minutes, not hours. 💼 All-in-One Dashboard: Manage all your campaigns with ease from a clean, simple interface. 💡 Effective Strategies: Our tools are tailored for organic-looking growth and high user engagement. 🧾 Transparent Pricing: No hidden fees—just straightforward, affordable packages. 👩‍💻 Expert Support: Our team is available 24/7 to guide you through every step of the process. Whether you need more followers, likes, views, or overall engagement, our SMM panel Nigeria services deliver measurable and meaningful results. Why We’re the Nigeria Fastest and Cheapest SMM Panel GoUpSocial isn’t just another provider—it’s the Nigeria fastest and cheapest SMM panel built with performance and value in mind. We combine automation, intelligent targeting, and local market understanding to help you scale effortlessly. Need to boost a campaign today? Our platform supports instant order processing, real-time tracking, and localized engagement strategies—making it ideal for any influencer or business operating in Nigeria. Plus, as the cheapest SMM panel in Nigeria, we make sure that even clients with limited budgets can access top-quality services without compromise. A Nigerian SMM Panel Built for 2025 and Beyond As social media algorithms evolve, traditional methods of gaining reach and engagement no longer work. That’s why we’ve built the SMM panel Nigeria 2025—a next-gen platform optimized for today’s challenges. From smart delivery settings to niche-specific targeting, GoUpSocial provides you with every advantage in a competitive digital world. Our system adapts to the latest platform changes, helping you stay relevant, visible, and in control. Looking for a localized service? Our SMM panel for Nigerian followers helps you connect directly with your audience—boosting both credibility and conversions. All-in-One Online Panel in Nigeria for Every Social Goal No matter your objective—brand awareness, follower growth, or engagement improvement—GoUpSocial is the online panel in Nigeria that offers it all. With flexible services, dynamic campaigns, and secure systems, we give you the tools to succeed in a crowded online space. And because we’re committed to your growth, our platform is continually updated to reflect the best practices of modern digital marketing. Take the Leap with the Best Nigerian SMM Panel Ready to grow smarter? With GoUpSocial, you don’t just gain social proof—you build real influence. As the cheapest Nigeria SMM panel, we combine speed, quality, and affordability in one seamless platform. Whether you're an aspiring influencer, a marketing agency, or a brand aiming for greater reach, GoUpSocial is the ultimate Nigerian SMM panel to help you reach your full potential. 👉 Sign up today and unlock the next level of social media growth with GoUpSocial.
    • Lineage2 : Website Download now our System Patch. Registration from 12:00 UTC Time.
    • Daily reward system operational. 28 rewards. Option to buy days (Donate). Automatically resets on the first day of each month. External configuration file. You can submit daily rewards by account or IP. Minimum claim level. Claiming on the 28th locks the reward until the next month. Contact Discord: lykoz#0331
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock