Jump to content

Question

Posted

    // Check if the autoLoot mode is active
                    if (Config.AUTO_LOOT)
                    {
                        //DropItem(player, item);
                        final L2Item item_templ = ItemTable.getInstance().getTemplate(item.getItemId());
                        
                        if (item_templ == null)
                        {
                            LOGGER.info("ERROR: Item id to autoloot " + item.getItemId() + " has not template into items/armor/weapon tables.. It cannot be dropped..");
                            // DropItem(player, item);
                        }
                        else
                        {
                            
                            if (!player.getInventory().validateCapacity(item_templ) || (!Config.AUTO_LOOT_BOSS && player.isInsideZone(ZONE_MULTIFUNCTION))|| (!Config.AUTO_LOOT_BOSS && this instanceof L2RaidBossInstance) || (!Config.AUTO_LOOT_BOSS && this instanceof L2GrandBossInstance))                                DropItem(player, item);
                          else
                            player.doAutoLoot(this, item);
                                
                        }
                        
                    }
                    else
                    {
                        DropItem(player, item); // drop the item on the ground
                    }

 

 

this is the autoloot method i want to see items dropping and then autogetting , what i can do about it? 

12 answers to this question

Recommended Posts

  • 0
Posted (edited)
1 hour ago, SweeTs said:

That may work. Drop and insta pickup (autoloot). I tho about this way as well.

But it may bug, small glitch, like it drop items on ground and inventory. Yet, you won't be able to pick them from ground, as they no longer exists.

Tried something similar yday and it bugged like that.

Well probably you did a mistake. its exactly 2 new lines and 2 booleans in doPickupItem superclass + pickupMe :D

 

@HowardStern

 

try this one:

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/actor/Attackable.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/Attackable.java	(revision 3)
+++ java/net/sf/l2j/gameserver/model/actor/Attackable.java	(working copy)
@@ -1084,7 +1084,11 @@
 				{
 					// Check if the autoLoot mode is active
 					if ((isRaid() && Config.AUTO_LOOT_RAID) || (!isRaid() && Config.AUTO_LOOT))
-						player.doAutoLoot(this, item); // Give this or these Item(s) to the Player that has killed the L2Attackable
+					{
+						ItemInstance itemInfo = dropItem(player, item);
+						ThreadPool.schedule(() -> player.doPickupItem(itemInfo, true), 350);
+					}
+					
 					else
 						dropItem(player, item); // drop the item on the ground
 						
### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java	(revision 3)
+++ java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java	(working copy)
@@ -972,10 +972,12 @@
 	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T REMOVE the object from _objects of World.</B></FONT><BR>
 	 * <BR>
 	 * @param player Player that pick up the item
+	 * @param ignorePackets TODO
 	 */
-	public final void pickupMe(Creature player)
+	public final void pickupMe(Creature player, boolean ignorePackets)
 	{
-		player.broadcastPacket(new GetItem(this, player.getObjectId()));
+		if (!ignorePackets)
+			player.broadcastPacket(new GetItem(this, player.getObjectId()));
 		
 		// Unregister dropped ticket from castle, if that item is on a castle area and is a valid ticket.
 		final Castle castle = CastleManager.getInstance().getCastle(player);

 

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/actor/instance/Player.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/Player.java	(revision 5)
+++ java/net/sf/l2j/gameserver/model/actor/instance/Player.java	(working copy)

@@ -3212,7 +3210,7 @@
 	 * @param object The ItemInstance to pick up
 	 */
 	@Override
-	public void doPickupItem(WorldObject object)
+	public void doPickupItem(WorldObject object, boolean ignorePackets)
 	{
 		if (isAlikeDead() || isFakeDeath())
 			return;
@@ -3231,9 +3229,11 @@
 		ItemInstance item = (ItemInstance) object;
 		
 		// Send ActionFailed to this Player
-		sendPacket(ActionFailed.STATIC_PACKET);
-		sendPacket(new StopMove(this));
-		
+		if (!ignorePackets)
+		{
+			sendPacket(ActionFailed.STATIC_PACKET);
+			sendPacket(new StopMove(this));
+		}
 		synchronized (item)
 		{
 			if (!item.isVisible())
@@ -3276,7 +3276,7 @@
 				item.removeDropProtection();
 			
 			// Remove the ItemInstance from the world and send GetItem packets
-			item.pickupMe(this);
+			item.pickupMe(this,ignorePackets);
 			
 			// item must be removed from ItemsOnGroundManager if is active
 			ItemsOnGroundTaskManager.getInstance().remove(item);
@@ -3323,10 +3323,12 @@
 			else
 				addItem("Pickup", item, null, true);
 		}
-		
-		// Schedule a paralyzed task to wait for the animation to finish
-		ThreadPool.schedule(() -> setIsParalyzed(false), (int) (700 / getStat().getMovementSpeedMultiplier()));
-		setIsParalyzed(true);
+		if (!ignorePackets)
+		{
+			// Schedule a paralyzed task to wait for the animation to finish
+			ThreadPool.schedule(() -> setIsParalyzed(false), (int) (700 / getStat().getMovementSpeedMultiplier()));
+			setIsParalyzed(true);
+		}
 	}
 	
 	@Override

 

You will have some errors because you need to change some things

Do the next things:

 

  • go at Player.java and find this line. Just click it in it's name until the background color will become grey
@Override
	public void doPickupItem(WorldObject object)
  • then at eclipse tools click at Refactor -> Change Method Signature (a message will pop up that this method overrides bla bla ... ignore it and continue)
  • then click at Add button
  • in Type box add boolean
  • in Name box add for example ignorePackets
  • and as Default Value add false
  • now go inside of this method (doPickUpMe scroll down until you find item.pickupMe and do exactly the same thing i said above with the refactor by clicking on pickUpMe word..

 

8265aaa68d56d0938d02f773e78a4686.gif

Edited by melron
  • 0
Posted
17 minutes ago, HowardStern said:

this is the autoloot method i want to see items dropping and then autogetting , what i can do about it? 

Can you explain better what exactly you want to do?

  • 0
Posted
13 minutes ago, L2J NexuS said:

Can you explain better what exactly you want to do?

like on l2off servers , autopickup works like l2j but when u kill mob u see animation of items dropping and then u get them automatically

  • 0
Posted

You can add to drop adena on ground before the

player.doAutoLoot(this, item);

So this mean you will see the animation + it will immidiately pick the item. 

  • 0
Posted
7 minutes ago, Evie Frye said:

You can add to drop adena on ground before the


player.doAutoLoot(this, item);

So this mean you will see the animation + it will immidiately pick the item. 

i did this , the autoloot method has it already , so i get them animations and also the items stay on ground too so i get all x2...

  • 0
Posted (edited)

I don't know what delay l2off have about that, but you have to autoloot the same item instance that dropped before...

example:

ItemInstance item = dropItem(itemInfo);
autLoot(item);

by your way you dropping an item and then creating new one with the same id,count for the autoloot. thas why is X2

p.s i will test in the evening

Edited by melron
  • 0
Posted
2 hours ago, melron said:

I don't know what delay l2off have about that, but you have to autoloot the same item instance that dropped before...

example:


ItemInstance item = dropItem(itemInfo);
autLoot(item);

by your way you dropping an item and then creating new one with the same id,count for the autoloot. thas why is X2

p.s i will test in the evening

i would be thankfull having the solution thanks mate

  • 0
Posted
9 hours ago, melron said:

 


ItemInstance item = dropItem(itemInfo);
autLoot(item);

 

That may work. Drop and insta pickup (autoloot). I tho about this way as well.

But it may bug, small glitch, like it drop items on ground and inventory. Yet, you won't be able to pick them from ground, as they no longer exists.

Tried something similar yday and it bugged like that.

  • 0
Posted
46 minutes ago, SweeTs said:

That may work. Drop and insta pickup (autoloot). I tho about this way as well.

But it may bug, small glitch, like it drop items on ground and inventory. Yet, you won't be able to pick them from ground, as they no longer exists.

Tried something similar yday and it bugged like that.

only solution is to completely remove the doAutoloot and insteado f that to put something that makes character pick up but  i dont know how i can call the method

  • 0
Posted

Obviously I did something wrong :D

Nice one, with small edition, addition you achieved that :)

 

Ppl will claim its off server now :lol:

Guest
This topic is now closed to further replies.


  • Posts

    • It's a 5 days ago project. I initially started with the idea from C4, 4 months ago, you can see my stuff in the first posts of this thread. I experimented with scene loads while learning Odin and experimenting with graphics programming. Elfo got inspired by the idea and thought of implementing the full client, smth I didn't wanna do. I personally didn't look for inspiration on anything, just having fun with a new language. And elfo did the rest on his own. How about you act like an adult and acknowledge something good that's in front of you and respect the grind that Elfo pushed out since mot of vibe coders quit after a month or run out of money to invest into it. All the vibe wow slop and this recent one will get abandoned in a bit, you'll see. Also @Northy you sound like such a childish text book narcissist. Go touch some grass outside, you're not winning anything here. Have a good life 
    • ⭐ Fast support & replacement warranty guaranteed. All fresh links in stock with automated delivery!
    • Will open: 23 September 2026 | 20:00 GMT+2 Are you ready for a unique, hard-farm High Five journey? Join L2DragonLand where you can learn every skill in the game and build the ultimate character! Progress through custom farming zones and endless progression possibilities.   Server Features: XP Rate: 500x SP Rate: 2x   Drop / Spoil: 20x   Hard Farm Gameplay Safe Enchant: +600   Max Enchant: +600   Max Attribute: Level 7 Multiskill System: Learn every single skill in the game.   Custom Content: Zone Progression: Farm and progress through custom zones Item Upgrade System: Upgrade your gear step-by-step Custom Weapons & Armor: Packed with massive % P.Atk, M.Atk, P/M.Def, HP/CP stats Unique Visuals: Every item has unique custom stats and visual effects Additional Features Custom Buffer in Main Towns Custom Buff Learn NPC Global Gatekeeper Automated In-Game Events Lottery System Fast Boss Respawns: Crucial raid bosses respawn every 10 seconds Olympiad Every Two Weeks   Website: http://l2dragonland.eu/   Discord: https://discord.gg/geVGy8Xcpv   L2DragonLands
    • you can lie as much as you want. idea from git.   Open source h5 game engine on rust : https://github.com/nascimentolh/CanastraEngine
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..