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

    • We can help your Telegram group or channel grow fast with real, targeted Telegram members, safely and efficiently.   Our Telegram Member Add service lets you add members to Telegram group or channel from real, active communities — not bots or fakes.   With this Telegram group growth service, you’ll see results within hours, backed by clear reporting and safe automation.   ✅ What We Offer   • Done-for-you Telegram Member Add campaigns (Groups · Channels) • Targeted Telegram members from real, active users • Fast growth — up to 10K members in 24 hours • English-speaking or regional audiences (US · UK · EU) • Fully managed Telegram channel growth service with reports & analytics   💡 Why Choose Us   We don’t use spam or fake accounts. Our process safely adds members to your Telegram group or channel through verified multi-account setups, proxy rotation, and opt-out compliance. This ensures lasting growth and minimizes churn. Every campaign is managed by experts using tested Telegram infrastructure and growth systems. We also recommend combining Member Add with Telegram Mass DM for better engagement and retention after join.   🧩 Works Best For   • Businesses or communities launching new Telegram channels • Crypto, SaaS, and marketing projects needing visibility • Influencers and agencies growing multiple Telegram groups • Anyone seeking a reliable Telegram group growth service with real members 📩 To Get More Information   Telegram : @TeleLoopPulse   Website : https://telegramgrowthstudio.com/telegram-member-add.html
    • well,its SharedCreatureData.h problem.   /* 0398 */ //WCHAR m_sResurrectSpellerName[25];   this variable will cause L2server.exe crash...  
    • Custom High Five server L2insolence will open 2025-10-17 21:00 GMT+2 ! ! ! Web site: http://www.l2insolence.eu All info updates on Discord: https://discord.gg/duMjnj3y9A Last wipe was more then 1 year ago. We have custom skill, farm zones, materials for items to buy. Custom wepons, armor, jewels and more. All items in game have own stats. With custom looks. Glowing etc. Rates XP, SP: 25x Spoil and Drop: 10x Adena: 20x Server Hard Farm Enchantment Safe enchant Weapon: +20099 Safe enchant Armor: +20099 Max enchant Weapon: +20099 Max enchant Armor: +20099 Normal scrolls: 100% Blessed scrolls: 100% You can use scrolls or item enchant NPC to make +++ abd life beter. NPC Buffer There's an NPC buffer in all of our main towns: Aden, Giran and Goddard. It supplies Prophet Buffs, Songs and Dances for a small fee. Include all buff. We have custom self buffs learned with npc with custom stats. Global Gatekeeper GM Shop with normal items and custom ones, vote NPC, Event NPC, item upgrader NPC. Raid Bosses, every zone have its own boss and drops for rare mats. Olympiad The olympiad is ongoing every two weeks. Meaning if you become a hero you will have your hero status for two weeks. And hero have own custom stats on items.
  • 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