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

    • https://www.l2jbrasil.com/topic/149147-daily-reward-tested-on-l2jsunrise/  to h5 sunrise
    • https://www.l2jbrasil.com/topic/149147-daily-reward-tested-on-l2jsunrise/   
    • A lot of people say L2 is dead, and ACIS is still in development. But seriously, you’ve got the skills and knowledge why not make your own game with a clean brand new client from scratch? The only thing missing is client devs, and you can find plenty here or on freelance sites. Stop treating it like a hobby and turn it into something that can actually make money and people happy, you have the name just move forward, even AI can help you script quests, me first I would totally play any game you made similar to l2 anyway 🍪 have one i know you like them
    • Would it be possible to update the guide? The images are offline! 😞
    • In the fast-paced world of digital marketing, having the right tools makes all the difference. If you're searching for a reliable SMM panel Nigeria, GoUpSocial is here to take your online presence to the next level. Built for influencers, marketers, startups, and content creators, our platform is the ultimate solution for smart and scalable social media growth. With GoUpSocial, you get more than just numbers—you get engagement that drives real impact. As a trusted Nigerian SMM panel, we help you gain visibility across top platforms like Instagram, TikTok, YouTube, Facebook, and Twitter—all at the most competitive prices in the market. Experience the Power of the Best SMM Panel in Nigeria We understand that quality matters just as much as affordability. That’s why GoUpSocial has become the go-to platform for users seeking the best SMM panel in Nigeria. Here’s what makes us the preferred choice: 🚀 Real-Time Delivery: Get your orders processed and completed in minutes, not hours. 💼 All-in-One Dashboard: Manage all your campaigns with ease from a clean, simple interface. 💡 Effective Strategies: Our tools are tailored for organic-looking growth and high user engagement. 🧾 Transparent Pricing: No hidden fees—just straightforward, affordable packages. 👩‍💻 Expert Support: Our team is available 24/7 to guide you through every step of the process. Whether you need more followers, likes, views, or overall engagement, our SMM panel Nigeria services deliver measurable and meaningful results. Why We’re the Nigeria Fastest and Cheapest SMM Panel GoUpSocial isn’t just another provider—it’s the Nigeria fastest and cheapest SMM panel built with performance and value in mind. We combine automation, intelligent targeting, and local market understanding to help you scale effortlessly. Need to boost a campaign today? Our platform supports instant order processing, real-time tracking, and localized engagement strategies—making it ideal for any influencer or business operating in Nigeria. Plus, as the cheapest SMM panel in Nigeria, we make sure that even clients with limited budgets can access top-quality services without compromise. A Nigerian SMM Panel Built for 2025 and Beyond As social media algorithms evolve, traditional methods of gaining reach and engagement no longer work. That’s why we’ve built the SMM panel Nigeria 2025—a next-gen platform optimized for today’s challenges. From smart delivery settings to niche-specific targeting, GoUpSocial provides you with every advantage in a competitive digital world. Our system adapts to the latest platform changes, helping you stay relevant, visible, and in control. Looking for a localized service? Our SMM panel for Nigerian followers helps you connect directly with your audience—boosting both credibility and conversions. All-in-One Online Panel in Nigeria for Every Social Goal No matter your objective—brand awareness, follower growth, or engagement improvement—GoUpSocial is the online panel in Nigeria that offers it all. With flexible services, dynamic campaigns, and secure systems, we give you the tools to succeed in a crowded online space. And because we’re committed to your growth, our platform is continually updated to reflect the best practices of modern digital marketing. Take the Leap with the Best Nigerian SMM Panel Ready to grow smarter? With GoUpSocial, you don’t just gain social proof—you build real influence. As the cheapest Nigeria SMM panel, we combine speed, quality, and affordability in one seamless platform. Whether you're an aspiring influencer, a marketing agency, or a brand aiming for greater reach, GoUpSocial is the ultimate Nigerian SMM panel to help you reach your full potential. 👉 Sign up today and unlock the next level of social media growth with GoUpSocial.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock