Jump to content

Question

Posted (edited)

Hello MxC,

I have a question. How can I make any etcitem to be dropped like Adena? So if I'm in a party the amount will be shared with all party members like Adena.

 

Edit: Could anyone give me the idea where to search? Or is it really hard to do? I'm using L2jFrozen btw.

Edited by BloodRav3N

6 answers to this question

Recommended Posts

  • 0
Posted
On 4/2/2018 at 6:55 PM, BloodRav3N said:

Could anyone give me the idea where to search? Or is it really hard to do? I'm using L2jFrozen btw.

have a look how it works on l2party.java, then copy and add with the item id

  • 0
Posted

If anyone wants to do it here is what I did:

 

PcInventory.java

	public static final int ADENA_ID = 57;
	+public static final int COIN_ID = 9404;
	public static final int ANCIENT_ADENA_ID = 5575;
	
	private final L2PcInstance _owner;
	private L2ItemInstance _adena;
	+private L2ItemInstance _coin;
	private L2ItemInstance _ancientAdena;

--------------------------------------------

	public L2ItemInstance getAdenaInstance()
	{
		return _adena;
	}
	
	+public L2ItemInstance getCoinInstance()
	+{
	+	return _coin;
	+}
	
	@Override
	public int getAdena()
	{
		return _adena != null ? _adena.getCount() : 0;
	}
	
	+public int getCoin()
	+{
	+	return _coin != null ? _coin.getCount() : 0;
	+}

---------------------------------------------

	public void addAdena(final String process, final int count, final L2PcInstance actor, final L2Object reference)
	{
		if (count > 0)
		{
			addItem(process, ADENA_ID, count, actor, reference);
		}
	}
	
	+public void addCoin(final String process, final int count, final L2PcInstance actor, final L2Object reference)
	+{
	+	if (count > 0)
	+	{
	+		addItem(process, COIN_ID, count, actor, reference);
	+	}
	+}

-----------------------------------------------------

	public L2ItemInstance addItem(final String process, L2ItemInstance item, final L2PcInstance actor, final L2Object reference)
	{
		item = super.addItem(process, item, actor, reference);
		
		if (item != null && item.getItemId() == ADENA_ID && !item.equals(_adena))
		{
			_adena = item;
		}
		
		+if (item != null && item.getItemId() == COIN_ID && !item.equals(_coin))
		+{
		+	_coin = item;
		+}

--------------------------------------------------------

	public L2ItemInstance transferItem(final String process, final int objectId, final int count, final ItemContainer target, final L2PcInstance actor, final L2Object reference)
	{
		final L2ItemInstance item = super.transferItem(process, objectId, count, target, actor, reference);
		
		if (_adena != null && (_adena.getCount() <= 0 || _adena.getOwnerId() != getOwnerId()))
		{
			_adena = null;
		}
		
		+if (_coin != null && (_coin.getCount() <= 0 || _coin.getOwnerId() != getOwnerId()))
		+{
		+	_coin = null;
		+}

------------------------------------------------------

	public L2ItemInstance dropItem(final String process, L2ItemInstance item, final L2PcInstance actor, final L2Object reference)
	{
		item = super.dropItem(process, item, actor, reference);
		
		if (_adena != null && (_adena.getCount() <= 0 || _adena.getOwnerId() != getOwnerId()))
		{
			_adena = null;
		}
		
		+if (_coin != null && (_coin.getCount() <= 0 || _coin.getOwnerId() != getOwnerId()))
		+{
		+	_coin = null;
		+}

----------------------------------------------------

	public L2ItemInstance dropItem(final String process, final int objectId, final int count, final L2PcInstance actor, final L2Object reference)
	{
		final L2ItemInstance item = super.dropItem(process, objectId, count, actor, reference);
		
		if (_adena != null && (_adena.getCount() <= 0 || _adena.getOwnerId() != getOwnerId()))
		{
			_adena = null;
		}

		+if (_coin != null && (_coin.getCount() <= 0 || _coin.getOwnerId() != getOwnerId()))
		+{
		+	_coin = null;
		+}

--------------------------------------------------------------

	protected void removeItem(final L2ItemInstance item)
	{
		// Removes any reference to the item from Shortcut bar
		getOwner().removeItemFromShortCut(item.getObjectId());
		
		// Removes active Enchant Scroll
		if (item.equals(getOwner().getActiveEnchantItem()))
		{
			getOwner().setActiveEnchantItem(null);
		}
		
		if (item.getItemId() == ADENA_ID)
		{
			_adena = null;
		}
		+else if (item.getItemId() == COIN_ID)
		+{
		+	_coin = null;
		+}

----------------------------------------------------------

	public void restore()
	{
		super.restore();
		_adena = getItemByItemId(ADENA_ID);
	+	_coin = getItemByItemId(COIN_ID);
		_ancientAdena = getItemByItemId(ANCIENT_ADENA_ID);
	}

----------------------------------------------------------

 

L2PcInstance.java

	public int getAdena()
	{
		return _inventory.getAdena();
	}
	+public int getCoin()
	+{
	+	return _inventory.getCoin();
	+}

--------------------------------------------------------
  
  	+public void addCoin(final String process, int count, final L2Object reference, final boolean sendMessage)
	+{
	+	if (count > 0)
	+	{
	+		if (_inventory.getCoin() == Integer.MAX_VALUE)
	+		{
	+			return;
	+		}
	+		else if (_inventory.getCoin() >= Integer.MAX_VALUE - count)
	+		{
	+			count = Integer.MAX_VALUE - _inventory.getCoin();
	+			_inventory.addCoin(process, count, this, reference);
	+		}
	+		else if (_inventory.getCoin() < Integer.MAX_VALUE - count)
	+		{
	+			_inventory.addCoin(process, count, this, reference);
	+		}
	+		if (sendMessage)
	+		{
	+			SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
	+			sm.addItemName(PcInventory.COIN_ID);
	+			sm.addNumber(count);
	+			sendPacket(sm);
	+			sm = null;
	+		}
	+		
	+		// Send update packet
	+		if (!Config.FORCE_INVENTORY_UPDATE)
	+		{
	+			InventoryUpdate iu = new InventoryUpdate();
	+			iu.addItem(_inventory.getAdenaInstance());
	+			sendPacket(iu);
	+			iu = null;
	+		}
	+		else
	+		{
	+			sendPacket(new ItemList(this, false));
	+		}
	+	}
	+}

----------------------------------------------------------------------------
  
  		else if (item.getItemId() == 57)
		{
			addAdena("AutoLoot", item.getCount(), target, true);
		}
		+else if (item.getItemId() == 9404)
		+{
		+	addCoin("AutoLoot", item.getCount(), target, true);
		+}

----------------------------------------------------------------------------
  
  			else if (target.getItemId() == 57 && getInventory().getAdenaInstance() != null)
			{
				addAdena("Pickup", target.getCount(), null, true);
				ItemTable.getInstance().destroyItem("Pickup", target, this, null);
			}
		+	else if (target.getItemId() == 9404 && getInventory().getCoinInstance() != null)
		+	{
		+		addCoin("Pickup", target.getCount(), null, true);
		+		ItemTable.getInstance().destroyItem("Pickup", target, this, null);
		+	}


  

 

L2Party.java

	public void distributeItem(final L2PcInstance player, final L2ItemInstance item)
	{
		if (item.getItemId() == 57)
		{
			distributeAdena(player, item.getCount(), player);
			ItemTable.getInstance().destroyItem("Party", item, player, null);
			return;
		}
		+if (item.getItemId() == 9404)
		+{
		+	distributeCoin(player, item.getCount(), player);
		+	ItemTable.getInstance().destroyItem("Party", item, player, null);
		+	return;
		+}

-------------------------------------------------------------------

	public void distributeItem(final L2PcInstance player, final L2Attackable.RewardItem item, final boolean spoil, final L2Attackable target)
	{
		if (item == null)
			return;
		
		if (item.getItemId() == 57)
		{
			distributeAdena(player, item.getCount(), target);
			return;
		}
		
		+if (item.getItemId() == 9404)
		+{
		+	distributeCoin(player, item.getCount(), target);
		+	return;
		+}

------------------------------------------------------------------------
  Search for public void distributeAdena and paste this under:

+	public void distributeCoin(final L2PcInstance player, final int coin, final L2Character target)
+	{
+		// Get all the party members
+		final List<L2PcInstance> membersList = getPartyMembers();
+		
+		// Check the number of party members that must be rewarded
+		// (The party member must be in range to receive its reward)
+		final List<L2PcInstance> ToReward = FastList.newInstance();
+		
+		for (final L2PcInstance member : membersList)
+		{
+			if (!Util.checkIfInRange(Config.ALT_PARTY_RANGE2, target, member, true))
+			{
+				continue;
+			}
+			ToReward.add(member);
+		}
+		
+		// Avoid null exceptions, if any
+		if (ToReward.isEmpty())
+			return;
+		
+		// Now we can actually distribute the adena reward
+		// (Total adena split by the number of party members that are in range and must be rewarded)
+		final int count = coin / ToReward.size();
+		
+		for (final L2PcInstance member : ToReward)
+		{
+			member.addCoin("Party", count, player, true);
+		}
+		FastList.recycle((FastList<?>) ToReward);
+	}

Thanks again for the replies (even if it took 1 months for a reply :P ) you can lock this topic :)

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.

  • Posts

    • never met a programmer that doesnt know english xD and as he said his knowledge and skills are beyond our imagination xD
    • nice work, welcome back to world of lineage development @melron 😄
    • He's likely baiting you to download his source full of backdoors indeed
    • Yeah inside router i had to enable udnp services 
    • Hello cheaters, As a team of avid developers and enthusiasts of Lineage 2, we are excited to present the L2 Control Hub, a groundbreaking plugin designed by myself and my collaborator, StinkyMadness. This innovative tool equips server administrators with powerful automation capabilities directly within the game's community board. L2 Control Hub simplifies the creation and management of automations, enabling you to customize your server operations without the need to modify the source code.   Key Features of L2 Control Hub: Robust Automation Triggers: Select from a plethora of triggers currently available, with continuous additions in the works to enhance your control options. Dynamic Conditions and Actions: Tailor your server operations with an extensive range of conditions and actions, ensuring flexible and precise control over game events and player interactions. Customizable Variables: Easily integrate server-specific variables from your database to further personalize and streamline your automations. Utilize these variables across various automation scenarios to cater to your specific server requirements. JavaScript Integration: Execute custom JavaScript codes that interact seamlessly with Java classes, bringing advanced functionalities to your server's ecosystem.   Explore L2 Control Hub in Action: We've prepared a series of video tutorials to demonstrate the capabilities of L2 Control Hub: Control Hub - Create a Simple Flow with 1 Condition and 1 Action: Get started with basic automations. Control Hub - Multiple Conditions with Multiple Actions: Explore more complex automations for detailed server management. Control Hub - Using Variables: Discover how to implement and use custom variables for tailored automations. Control Hub - Using JavaScript: Experience the power of custom scripts in enhancing your server functionality.   L2 Control Hub is currently about 70% complete, and we are actively developing and refining features. We invite you to join our ➡️ Discord community ⬅️ to engage with the development process, provide feedback, and be the first to test new features. Additionally, any updates or changes to the plugin are seamlessly delivered to all customers directly from our web server, ensuring your system is always up-to-date without the need for manual downloads.   Your game, your rules, automated. Join us in redefining server management in Lineage 2 and elevate your gaming community with unmatched automation capabilities. For more details, contact us directly to get started with L2 Control Hub.   Currently, the plugin is developed using aCis sources. We will continue with these sources until we finalize all the necessary details before proceeding to integrate with the more prominent sources available.       The L2 Control Hub is designed to extend beyond mere functional additions to your server. We are in the process of implementing a suite of advanced mechanisms, such as a vote manager capable of interfacing with any Lineage 2 voting site without requiring configuration, live statistics to provide admins with real-time insights, and an event engine that can generate any desired event within seconds. All these features will be seamlessly integrated into the module, enhancing your server management experience significantly.     Please note that L2 Control Hub will be a premium tool, reflecting the extensive features and benefits it offers. While we are finalizing the pricing structure, rest assured that we aim to deliver great value for your investment. We will announce the cost details soon on our platforms to ensure everyone is well-informed and can plan accordingly. Join us to take your server management to the next level with L2 Control Hub.     
  • Topics

×
×
  • Create New...