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
  • Thanks 1
  • Upvote 1
  • 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:

  • Haha 1
Guest
This topic is now closed to further replies.
×
×
  • Create New...