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

    • 📺 YouTube Boosting — for Streams, Videos & Channel Growth Reliable, fast, and with a huge variety. Perfect for bloggers, marketers, streamers, and content platforms!   We offer:  🔹 Views for videos (Worldwide, Social, Native Ads)  🔹 Livestream views (Reaction, Concurrent, Stable)  🔹 Shorts Views & Auto Views  🔹 Subscribers, Likes, Auto Likes, Comments  🔹 Shares by GEO (Worldwide, with referrer)  🔹 Comments & Comment Likes  🔹 Combo Packs: Likes + Views (60–90%)  🔹 SEO Boost (US Only, No refill) 📌 Ideal for promoting new videos, livestreams, Shorts, and building trust. 🎁 Get $1 bonus for your first test order:  Just submit a ticket with subject "Get Trial Bonus" on our website (Support)  ➡️ Open SMM Panel (clickable) or via Telegram bot support 🎁   How to order:  ➡️ SMM Panel: Click ✅  ➡️ SMM Panel inside our Telegram Bot: Click ✅ (Menu ➡️ SMM Panel)   Our digital goods store:  ➡️ Online Store: Click ✅  ➡️ Telegram Bot: Click ✅   Regular buyers get extra discounts and promo codes!   Support:  ➡️ Telegram: https://t.me/solomon_bog ✅  ➡️ Discord: https://discord.gg/y9AStFFsrh ✅  ➡️ WhatsApp: https://wa.me/79051904467 ✅  ➡️ ✉️ Email: solomonbog@socnet.store ✅   ➡️ Telegram Channel: https://t.me/accsforyou_shop ✅   You can also contact us to:  — Discuss wholesale purchases  — Propose partnerships (current partners: https://socnet.bgng.io/partners)  — Become a supplier 🧩 SocNet — Digital Goods & Premium Subscriptions Store ✅
    • Yes, but it also includes extra features like autofarm, autofarm interface button, dressme, many bug fixes from rusacis and premium geodata aswell.
    • discord mass dm service, discord bulk dm, discord dm service, discord mass messaging, discord dm bot, discord dm tool, discord mass dm bot, discord dm automation, discord bulk messaging, discord dm blast, discord mass dm tool, discord dm campaign, discord direct message service, discord dm software, discord mass dm advertising, discord dm marketing, discord bulk dm service, discord dm spammer, discord mass dm script, discord dm sender, discord automated dm, discord dm outreach, discord mass messaging service, discord dm promotion, discord bulk dm bot, discord dm advertising service, discord mass dm platform, discord dm marketing tool, discord bulk messaging bot, discord dm automation tool, discord mass dm sender, discord dm blast service, discord bulk dm tool, discord dm marketing service, discord mass dm system, discord dm advertising bot, discord bulk messaging service, discord dm promotion service, discord mass dm automation, discord dm outreach tool, discord bulk dm automation, discord dm marketing platform, discord mass dm software, discord dm advertising tool, discord bulk messaging platform, discord dm campaign service, discord mass dm marketing, discord dm blast tool, discord bulk dm marketing, discord dm automation service   discord mass dm service, discord bulk dm, discord dm service, discord mass messaging, discord dm bot, discord dm tool, discord mass dm bot, discord dm automation, discord bulk messaging, discord dm blast, discord mass dm tool, discord dm campaign, discord direct message service, discord dm software, discord mass dm advertising, discord dm marketing, discord bulk dm service, discord dm spammer, discord mass dm script, discord dm sender, discord automated dm, discord dm outreach, discord mass messaging service, discord dm promotion, discord bulk dm bot, discord dm advertising service, discord mass dm platform, discord dm marketing tool, discord bulk messaging bot, discord dm automation tool, discord mass dm sender, discord dm blast service, discord bulk dm tool, discord dm marketing service, discord mass dm system, discord dm advertising bot, discord bulk messaging service, discord dm promotion service, discord mass dm automation, discord dm outreach tool, discord bulk dm automation, discord dm marketing platform, discord mass dm software, discord dm advertising tool, discord bulk messaging platform, discord dm campaign service, discord mass dm marketing, discord dm blast tool, discord bulk dm marketing, discord dm automation service  
    • buy discord accounts, discord accounts for sale, buy discord accounts bulk, cheap discord accounts, aged discord accounts, discord account marketplace, buy aged discord accounts, discord accounts cheap, wholesale discord accounts, buy bulk discord accounts, discord account shop, verified discord accounts, discord pva accounts, discord accounts online, phone verified discord accounts, email verified discord accounts, discord account vendor, discord accounts wholesale, buy old discord accounts, discord account supplier, fresh discord accounts, discord account store, discord account service, buy discord account online, discord accounts bulk buy, discord account seller, discord accounts package, discord account bundle, premium discord accounts, discord account provider, discord accounts instant delivery, discord accounts fast delivery, discord account generator, discord account creator, multiple discord accounts, discord accounts ready, discord accounts quality, discord account dealer, buy discord tokens, discord early supporter accounts, discord nitro accounts for sale, discord 2015 accounts, discord 2016 accounts, discord accounts with badges, discord server accounts, buy discord accounts secure, discord accounts reliable, discord account trading, discord accounts inventory, discord account collection, discord accounts stock  
    • Buying & Selling WOW Gold
  • 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