la2betdrema Posted March 9, 2020 Posted March 9, 2020 I did it like this. else if (command.startsWith("_bbssell")) { player.sendPacket(new SellList(player)); } A sales window opens but doesn't sell stuff, and if you come up to any nps, L2Merchant sells. How to do not need a npc?
0 la2betdrema Posted March 9, 2020 Author Posted March 9, 2020 I guess I have to dig into RequestSellItem, but I can't figure out where...
0 gvb Posted March 9, 2020 Posted March 9, 2020 (edited) 2 hours ago, la2betdrema said: I guess I have to dig into RequestSellItem, but I can't figure out where... Quote final Npc merchant = (player.getTarget() instanceof Merchant || player.getTarget() instanceof MercenaryManagerNpc) ? (Npc) player.getTarget() : null; if (merchant == null || !merchant.canInteract(player)) return; If you remove this condition, the sale will work, but this is not the right decision. It is better to consider when we sell through NPCs, and when through CommunityBroad. Edited March 9, 2020 by gvb
0 Rootware Posted March 9, 2020 Posted March 9, 2020 You need add new variable into Player instance for emulate fake merchant for community and manage this variable before calling sell/buy list and by max allowed interaction time.
0 la2betdrema Posted March 9, 2020 Author Posted March 9, 2020 You can tell me how to make this condition so that it is determined when an NPC and when the CommunityBoard
0 la2betdrema Posted March 9, 2020 Author Posted March 9, 2020 final Npc merchant = (player.getTarget() instanceof Merchant || player.getTarget() instanceof MercenaryManagerNpc) ? (Npc) player.getTarget() : null; if (merchant == null || !merchant.canInteract(player)) return; I'm sorry, but this condition is not working. ((
0 la2betdrema Posted March 9, 2020 Author Posted March 9, 2020 (edited) I made a sale. CommynityBoard.java else if (command.startsWith("_bbssell")) { player.setIsBBSUse(true); player.sendPacket(new SellList(player)); } Player.java private boolean is_bbs_use = false; public void setIsBBSUse(boolean value) { is_bbs_use = value; } public boolean isBBSUse() { return is_bbs_use; } RequestSellItem.java Replace this. if (merchant == null || !merchant.canInteract(player)) return; using this if ( !player.isBBSUse() && ( merchant == null || !merchant.canInteract( player ) ) ) return; Just one more question. How to make this function player.setIsBBSUse(true) change to player.setIsBBSUse(false) Could be a problem, I guess. Edited March 9, 2020 by la2betdrema
0 la2betdrema Posted March 9, 2020 Author Posted March 9, 2020 It's all decided. You can close the topic.
Question
la2betdrema
I did it like this.
else if (command.startsWith("_bbssell")) { player.sendPacket(new SellList(player)); }
A sales window opens but doesn't sell stuff,
and if you come up to any nps, L2Merchant sells.
How to do not need a npc?
7 answers to this question
Recommended Posts