Jump to content
  • 0

Multisell Community Board For Acis


Question

Posted (edited)

Hello guys, I have allmost finished my community board for acis, and later I can share it with you.. I cannot fix only one thing, When I use multisell for CB the window opens but when I try to buy the items, its not possible.. If I do the same through NPC it works. I am not so familiar with java, I started 2 weeks ago to build my CB, the code inside java community board is:

 

   else if (command.startsWith("_bbsmultisell;"))
        {
            if(activeChar.isDead() || activeChar.isAlikeDead() || activeChar.isInSiege() || activeChar.isCastingNow() || activeChar.isInCombat() || activeChar.isAttackingNow() || activeChar.isInOlympiadMode() || activeChar.isInJail() || activeChar.isFlying() || activeChar.getKarma() > 0 || activeChar.isInDuel()){
                activeChar.sendMessage("U cant use shop");
                return;
            }
            StringTokenizer st = new StringTokenizer(command, ";");
                                st.nextToken();           
                                int multisell = Integer.parseInt(st.nextToken());
                                MultisellData.getInstance().separateAndSend(Integer.parseInt(st.nextToken()), activeChar, false, 0);
                            }

 

I found a similar code on internet and I adapt it like that.. I dont know what should I change or add or maybe import something else.. I appriciate any help, suggestion, code! ( my thought is that the error is in the last line of the code) Thanks

Edited by stormv

10 answers to this question

Recommended Posts

  • 0
Posted (edited)

Remove 

 int multisell = Integer.parseInt(st.nextToken());

as it already processes the multisell id just after, meaning you would need 2 parameters on your command to make it currently work.

 

-----

 

StringTokenizer st = new StringTokenizer(command, ";"); => cut command using ; as delimiter
st.nextToken(); => bypass first part of command, which is _bbsmultisell
int multisell = Integer.parseInt(st.nextToken()); => next token is the id, save it on multisell integer
MultisellData.getInstance().separateAndSend(Integer.parseInt(st.nextToken()), activeChar, false, 0); => can't process because the id is already stored into multisell integer. Or would work for command;id;id the second parameter being useless as not used.

 

To finish with, latest aCis is using String not int.

Edited by Tryskell
  • 0
Posted (edited)

Tryskell thanks a lot for your help! I removed the line you suggest, and when I open the window still I cannot buy, or sometimes times I have fatal error and exit from the game.. This is the link for my error (image): https://postimg.org/image/kvds79i6t/

 

 StringTokenizer st = new StringTokenizer(command, ";");
                                st.nextToken();          
                                MultisellData.getInstance().separateAndSend(Integer.parseInt(st.nextToken()), activeChar, false, 0);

 

so the code should be like that? or should I change something else? because I think with your yellow comments you explain me the commands.

 

Also I have added the network.serverpackets...etc.. into the communityboard java file. Should I put the xmf file somewhere else instead of the default multisell file?

 

Update: Also when I use npc for multisell I get the same error in the console but I purchase the items (if that helps)

Edited by stormv
  • 0
Posted (edited)

I'm not sure how should be your bypass ; _bbsmultisell;id ? Also put logs here and there, notably to show how exactly your command is cutted (if even cutted ; maybe you simply forgot to register the bbs on CommunityBoard.java).

 

Which error in console ?

Edited by Tryskell
  • 0
Posted (edited)

I think the bypass is registered because the shop window opens through the CB but I cannot purchase any item.. On the other hand when I use multisell with npc it works.. All those errors in the image that I uploaded. There are the same errors when I use the CB or Npc but in case of npc I can make tha trade. Do I have to change something to MultiSellChoose java?. The code that I posted previous its the only code that I have added on communityboard.java, I havent done anything else for the multisell, I was wondering if its only 3 lines to be working, so ? If you need to uploade my whole code or some images let me know. Thanks

 

The code that I tried to adapt from internet is the next one:

I dont understand why they use topbbsmanager inside this code.

else if (command.startsWith("_bbsmultisell;"))
+				{
+					if(activeChar.isDead() || activeChar.isAlikeDead() || TvTEvent.isStarted() || activeChar.isInSiege() || activeChar.isCastingNow() || activeChar.isInCombat() || activeChar.isAttackingNow() || activeChar.isInOlympiadMode() || activeChar.isInJail() || activeChar.isFlying() || activeChar.getKarma() > 0 || activeChar.isInDuel()){
+		                activeChar.sendMessage("Â äàííûõ óñëîâèÿõ øîï çàïðåùåí");
+						return;
+		            } 
+					StringTokenizer st = new StringTokenizer(command, ";");
+		            st.nextToken();
+		            TopBBSManager.getInstance().parsecmd("_bbstop;" + st.nextToken(), activeChar);
+		            int multisell = Integer.parseInt(st.nextToken());
+		            MultiSell.getInstance().separateAndSend(multisell, activeChar, null, false);
Edited by stormv
  • 0
Posted

Tryskell thanks a lot for your help! I removed the line you suggest, and when I open the window still I cannot buy, or sometimes times I have fatal error and exit from the game.. This is the link for my error (image): https://postimg.org/image/kvds79i6t/

 

 StringTokenizer st = new StringTokenizer(command, ";");

                                st.nextToken();          

                                MultisellData.getInstance().separateAndSend(Integer.parseInt(st.nextToken()), activeChar, false, 0);

 

so the code should be like that? or should I change something else? because I think with your yellow comments you explain me the commands.

 

Also I have added the network.serverpackets...etc.. into the communityboard java file. Should I put the xmf file somewhere else instead of the default multisell file?

 

Update: Also when I use npc for multisell I get the same error in the console but I purchase the items (if that helps)

The code like this should work, that NPE you get is probably some error inside the XML, since you get it at both CB/NPC.

 

The fact that buy from multisell doesn't work, is probably because there would be some kind of NPC range check inside MultisellChoose.java (i'm not home i can't check the packet, but i'm 90% sure i'm right on this one).

  • 0
Posted (edited)

Versus you have right the code inside multisellchoose.java is:

L2Npc merchant = (player.getTarget() instanceof L2Npc) ? (L2Npc) player.getTarget() : null;
		if (merchant == null || !merchant.canInteract(player))
			return;
		
		ListContainer list = MultisellData.getInstance().getList(_listId);
		if (list == null)
			return;

I removed the line:

if (merchant == null || !merchant.canInteract(player))
			return;

Now I can buy through CB and multisell, but on the other hand IF I want to use any multisell shop through npc in the game I cant because obviously I delete those lines inside the code. So because I dont have so much knowledge from java I dont know how to rebuild this code and do it, to interact both though CB and npc. I dont think changing someting inside xmf files will help. Thanks

Edited by stormv
  • 0
Posted

Buying from NPC would work if you only removed these 2 lines, but there won't be any range check on any multisell on the server. A player could trigger multisell packet from npc, teleport and still buy items. If you don't like this behavior i'd suggest you to re-add the check, and make it being bypassed in case the multisell was triggered by CB command.

  • 0
Posted

I am not really sure If I understood what you said. Yea I can buy from any shop, I meant I am not able to buy from multisell shop through npc. What do you mean bypassed?

  • 0
Posted

If you only removed the 2 lines you showed us, you should be able to buy from NPC multisell too.

 

What i meant with bypass the check:
If multisell is triggered through NPC -> check for range/null merchant.

If multisell is triggered through CB -> don't check for range/null merchant.

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...