Jump to content
  • 0

Add pages to droplist.


sotid
 Share

Question

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

 

 

 

Link to comment
Share on other sites

Recommended Posts

  • 0

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;
                }
               
            }

 

Link to comment
Share on other sites

  • 0
34 minutes ago, wongerlt said:

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

{

     private static void showItemsPage(Player activeChar, int page)

     {

:dat:

Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0
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
Link to comment
Share on other sites

  • 0
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
Link to comment
Share on other sites

  • 0

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.

 

Link to comment
Share on other sites

  • 0
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?

Link to comment
Share on other sites

  • 0
18 minutes ago, sotid said:

_command

this code is propably a command based I am no programmer I understand very basic things maybe @SweeTs can give you an example here.

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0
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
Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

@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

Link to comment
Share on other sites

  • 0

@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`
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



  • Posts

    • A ability known as "lost target" is one that causes your opponent to shift their focus away from you. If he does not retarget, the effect will be permanent. Naturally, ncSoft didn't think things through very well, thus in interlude you can auto-target, which pretty much nullifies the impact they were going for. Nerdle is not just a math puzzle game, but also a challenge for your brain. Find hidden calculations within 6 tries. You can find both numerical and alphabetical characters.  
    • Welcome new members to this World's Hardest Game forum. So excited.
    • I also have a character on this server. Hope to connect with everyone. Please contact me via nick: Sonic exe.
    • Does that mean we won't be able to find anything here?we become what we behold
    • Mrs Poindexter CBD Gummies Reviews : Truth or Blind-Faith Introducing the CBD gummies from Mrs. Poindexter, which are more than simply tasty treats. They are a type of health supplement that contains hemp to help you unwind both physically and mentally. More than 20,000 clinical investigations have shown them to be effective at reducing anxiety, depression, and inflammation. <<OFFICIAL WEBSITE-” CLICK HERE ORDER NOW>> VISITING OFFICIAL WEBSITE MRS POINDEXTER CBD GUMMIES [TAP TO ORDER] Other Article Link Below: https://groups.google.com/g/exposed-mrs-poindexter-cbd-gummies/c/56rSTvtN9U4 https://groups.google.com/g/exposed-mrs-poindexter-cbd-gummies/c/z9sqlhQTpWc https://sites.google.com/view/new-update-mrs-poindexter-cbdg/home https://forum.ppr.pl/index.php?/topic/20021-green-spectra-cbd-gummies-reviews/ https://forum.playragnarokonlinebr.com/index.php?/topic/104798-mrs-poindexter-cbd-gummies-reviews/ https://forum.techtudo.globo.com/perguntas/582713/mrs-poindexter-cbd-gummies-reviews-is-it-effective-in-reducing-weight-quickly https://xtibia.com/forum/topic/258176-green-spectra-cbd-gummies-reviews/ https://sites.google.com/view/new-update-mrs-poindexter-cbdg/home https://sites.google.com/view/mrs-poindexter-cbd-buy-now/home https://forum.ppr.pl/index.php?/topic/20114-mrs-poindexter-cbd-gummies-why-should-we-buy/ https://sites.google.com/view/usa-mrs-poindexter-cbd-gummy-r/home https://www.dibiz.com/liam-2 https://www.carforums.com/forums/topic/212223-mrs-poindexter-cbd-gummies-reviews/ https://liam143.cgsociety.org/bz0o/mrs-poindexter-cbd-g https://www.toyorigin.com/community/index.php?threads/mrs-poindexter-cbd-gummies-reviews-true-or-fake.32119/ https://community.backtrader.com/topic/61652/mrs-poindexter-cbd-gummies-reviews-scam-or-true https://community.backtrader.com/topic/61666/mrs-poindexter-cbd-gummies-reviews-scam-or-true https://dribbble.com/shots/20563651-Mrs-Poindexter-CBD-Gummies-Reviews-made-in-USA?added_first_shot=true https://www.deviantart.com/nadal2343/art/Pelican-CBD-Gummies-cover-948038876 https://socialsocial.social/pin/mrs-poindexter-cbd-gummies-reviews-scam-or-true/ https://socialsocial.social/pin/mrs-poindexter-cbd-gummies-reviews-side-effects-or-scam/ https://www.scoop.it/topic/mrs-poindexter-cbd-gummies-reviews-side-effects-or-scam?&kind=crawled&fId=1807291 https://discuss.selfmade.ninja/d/10531-mrs-poindexter-cbd-gummies-reviews-good-or-bad-for-health https://www.scoop.it/topic/terry-bradshaw-cbd-gummies-by-terrybradshaw   https://sites.google.com/view/terry-bradshaw-cbd-gummies-t/home https://sites.google.com/view/terry-bradshaw-cbd-gummi/home https://groups.google.com/g/terrybradshawcbdgummiies/c/dZZOWAIKNxs https://sites.google.com/view/lois-griffin-cbd-gummies-/home https://sites.google.com/view/lois-griffin-cbd-gummies-cbd/home https://groups.google.com/g/loisgriffincb/c/dB5ZxOAoaDA https://www.dibiz.com/loisgriffincbdgummies-1 https://www.dibiz.com/loisgriffin https://www.dibiz.com/terrybradshaw45 https://www.dibiz.com/terrybradshawcbdgummies https://www.toyorigin.com/community/index.php?threads/terry-bradshaw-cbd-gummies-ingredients-of-live-well-cbd-gummy-bars.31855/ https://www.toyorigin.com/community/index.php?threads/terry-bradshaw-cbd-gummies-does-this-powerful-chronic-pain-relief-gummies-really-work.31856/ https://www.toyorigin.com/community/index.php?threads/lois-griffin-cbd-chewy-goodies-understanding.31859/ https://www.toyorigin.com/community/index.php?threads/lois-griffin-cbd-gummies-side-effects-results-order.31863/ https://www.sympla.com.br/produtor/terrybradshawcbdgummi https://www.sympla.com.br/produtor/terrybradshawcbd https://www.sympla.com.br/produtor/loisgriffincbdgummies https://www.sympla.com.br/produtor/loisgriffincbdgummiespowerful https://community.backtrader.com/topic/61456/terry-bradshaw-cbd-gummies-cbd-gummies-are-made-with-natural-components https://community.backtrader.com/topic/61460/lois-griffin-cbd-gummies-these-are-assembled-with-superior-co2-extraction-and-triple-filtration-era https://community.thermaltake.com/index.php?/topic/312708-terry-bradshaw-cbd-gummies-are-made-with-natural-components/ https://terrybradshaw01.hashnode.dev/terry-bradshaw-cbd-gummies-relieve-pain-aches-as-theyve-ache-relieving-houses https://loisgriffincbdgummies4.hashnode.dev/lois-griffin-cbd-gummies-you-have-more-potent-immunity-metabolism-and-digestion-as-a-result https://terrybradshaw01.hashnode.dev/terry-bradshaw-cbd-gummies-does-this-powerful-chronic-pain-relief-gummies-really-work https://loisgriffincbdgummies4.hashnode.dev/lois-griffin-cbd-gummies-superior-co2-extraction-and-triple-filtration-era https://www.facebook.com/people/Terry-Bradshaw-CBD-Gummies/100089775202720/ https://www.facebook.com/people/Lois-Griffin-CBD-Gummies/100089676325598/ https://infogram.com/terry-bradshaw-cbd-gummies-1h7g6k0gp3vx02o https://infogram.com/lois-griffin-cbd-gummies-1ho16vokle88x4n https://infogram.com/terry-bradshaw-cbd-gummies-1h7g6k0gp3vx02o https://infogram.com/lois-griffin-cbd-gummies-1ho16vokle88x4n https://www.scoop.it/topic/terry-bradshaw-cbd-gummies-by-terrybradshaw     
  • 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