Jump to content

Question

Posted (edited)

Hello i found something that i didnt think of and i cant fix it that when i kill a mob the drop i have put on this if it is more than 1 it has to be shared to every one in the party but i dont know how but i doesnt getting shared here is what i mean i killed this mob 3 times and http://prntscr.com/ifoopd ..i've  tried changing by here but nothing.

 

	public void distributeItem(Player player, ItemInstance item)
	{
		if (item.getItemId() == 57 && item.getItemId() == 6577)
		{
			distributeAdena(player, item.getCount(), player);
			ItemTable.getInstance().destroyItem("Party", item, player, null);
			return;
		}
		
      and here
        
        public void distributeItem(Player player, IntIntHolder item, boolean spoil, Attackable target)
	{
		if (item == null)
			return;
		
		if (item.getId() == 57 && item.getId() == 6577)
		{
			distributeAdena(player, item.getValue(), target);
			return;
		}
		

 

Edited by ThelwHelpRePaidia

Recommended Posts

  • 0
Posted

[GR] edo les an to item einai adena kai to item einai scroll

na kanei ta parakato mipos thes na to pis kapos alios p.x.

an to item einai = 57 || to item einai = 6577 ?

opos leei kai o hater adis gia " && na balis || "

if (item.getItemId() == 57 && item.getItemId() == 6577)

{

             distributeAdena(player, item.getCount(), player);

            ItemTable.getInstance().destroyItem("Party", item, player, null);

            return;

}

  • 0
Posted (edited)

[GR] opou exei to " distributeAdena " kai apo pano to check item = 57 mporis na baleis ta item pou thes gia paradigma item.getItemId() == 57 || item.getItemId() == 5541

alios gia na min kaneis oli tin ora add sto source to pernas me config kai mirazi ta item sta 2 analoga posa party member exeis

Edited by tazerman2
  • 0
Posted (edited)

@tazerman2 άστο αγόρι μου δε σε θέλει με το && εκεί παραβιάζεις κάθε λογική

Edited by xxdem
  • 0
Posted (edited)

What you don't understand?

If you want the item to be split among party members change:

if (item.getItemId() == 57 && item.getItemId() == 6577)

to

if (item.getItemId() == 57 || item.getItemId() == 6577)

 

Edited by Evie Frye
  • 0
Posted (edited)

i had to change all this because i was getting an error in party.java when i added new distrubeditem..here is what  i did and got this message when i tried to loot from the monster the drops are working fine and thanks for the help but i dont know how to solve this message @melron

pcinventory.java

 
	public static final int COIN_ID = 6577;
	public static final int ADENA_ID = 57;
	public static final int ANCIENT_ADENA_ID = 5575;
	
	private final Player _owner;
	private ItemInstance _coin;
	private ItemInstance _adena;
    public int getCoin()
    {
        return _coin != null ? _coun.getCount() : 0;
    }

    public ItemInstance getCoinInstance()
    {
        return _count;
    }
    public void addCoin(String process, int count, Player actor, WorldObject reference)
	{
		if (count > 0)
			addItem(process, COIN_ID, count, actor, reference);
	}

public ItemInstance addItem(String process, ItemInstance item, Player actor, WorldObject reference)
	{
		item = super.addItem(process, item, actor, reference);
		if (item == null)
			return null;
		
		if (item.getItemId() == COIN_ID && !item.equals(_coin))
			_coin = item;
		
		if (item.getItemId() == ADENA_ID && !item.equals(_adena))
			_adena = item;
            
 public ItemInstance addItem(String process, int itemId, int count, Player actor, WorldObject reference)
	{
		ItemInstance item = super.addItem(process, itemId, count, actor, reference);
		if (item == null)
			return null;
		
          if (item.getItemId() == COIN_ID && !item.equals(_coin))
			_coin = item;
		
		if (item.getItemId() == ADENA_ID && !item.equals(_adena))
			_adena = item;

	public ItemInstance transferItem(String process, int objectId, int count, ItemContainer target, Player actor, WorldObject reference)
	{
		ItemInstance item = super.transferItem(process, objectId, count, target, actor, reference);
		
		if (_coin != null && (_coin.getCount() <= 0 || _coin.getOwnerId() != getOwnerId()))
			_coin = null;
		
		if (_adena != null && (_adena.getCount() <= 0 || _adena.getOwnerId() != getOwnerId()))
			_adena = null;
  
  public ItemInstance dropItem(String process, ItemInstance item, Player actor, WorldObject reference)
	{
		item = super.dropItem(process, item, actor, reference);
		
		if (_coin != null && (_coin.getCount() <= 0 || _coin.getOwnerId() != getOwnerId()))
			_coin = null;
            
            	public ItemInstance dropItem(String process, int objectId, int count, Player actor, WorldObject reference)
	{
ItemInstance item = super.dropItem(process, objectId, count, actor, reference);
		
		if (_coin != null && (_coin.getCount() <= 0 || _coin.getOwnerId() != getOwnerId()))
			_coin = null;
		
		if (_adena != null && (_adena.getCount() <= 0 || _adena.getOwnerId() != getOwnerId()))
			_adena = null;
            
         if (item.getItemId() == COIN_ID)
			_coin = null;
		if (item.getItemId() == ADENA_ID)
			_adena = null;
            
            	public void restore()
	{
		super.restore();
		_coin = getItemByItemId(COIN_ID);
		_adena = getItemByItemId(ADENA_ID);

systemmessageid.java


    public static final SystemMessageId EARNED_S1_COIN;

 

EARNED_S1_COIN = new SystemMessageId(2032);

player.java


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

public void addCoin(String process, int count, WorldObject reference, boolean sendMessage)
    {
        if (sendMessage)
            sendPacket(SystemMessage.getSystemMessage(SystemMessageId.EARNED_S1_COIN).addNumber(count));
        
        if (count > 0)
        {
            _inventory.addCoin(process, count, this, reference);
            
            InventoryUpdate iu = new InventoryUpdate();
            
            if (_inventory.getCoinInstance() != null)
                iu.addModifiedItem(_inventory.getCoinInstance());
            else
                iu.addItem(_inventory.getCoinInstance());
            
            sendPacket(iu);
        }
    }

    public void doAutoLoot(Attackable target, IntIntHolder item)
    {
        if (isInParty())
            getParty().distributeItem(this, item, false, target);
        else if (item.getId() == 57)
            addAdena("Loot", item.getValue(), target, true);
        else if (item.getId() == 6577)
            addCoin("Loot", item.getValue(), target, true);
        else
            addItem("Loot", item.getId(), item.getValue(), target, true);
    }

// Check if a Party is in progress
            if (isInParty())
                getParty().distributeItem(this, item);
            // Target is adena
            else if (item.getItemId() == 57 && getInventory().getAdenaInstance() != null)
            {
                addAdena("Pickup", item.getCount(), null, true);
                ItemTable.getInstance().destroyItem("Pickup", item, this, null);
            }
            else if (item.getItemId() == 6577 && getInventory().getCoinInstance() != null)
            {
                addCoin("Pickup", item.getCount(), null, true);
                ItemTable.getInstance().destroyItem("Pickup", item, this, null);
            }
            // Target is regular item

party.java


    public void distributeItem(Player player, IntIntHolder item, boolean spoil, Attackable target)
    {
        if (item == null)
            return;
        
        if (item.getId() == 57)
        {
            distributeAdena(player, item.getValue(), target);
            return;
        }
        if (item.getId() == 6577)
        {
            distributeCoin(player, item.getValue(), target);
            return;
        }

 

public void distributeCoin(Player player, int Coin, Creature target)
    {
        List<Player> toReward = new ArrayList<>(_members.size());
        for (Player member : _members)
        {
            if (!MathUtil.checkIfInRange(Config.PARTY_RANGE, target, member, true) || member.getCoin() == Integer.MAX_VALUE)
                continue;
            
            // Pass the check so will be rewarded.
            toReward.add(member);
        }
        
        // After all playes checked we got them in the list
        // Avoid divisions by 0.
        if (toReward.isEmpty())
            return;
        
        // Calculation for drop in example of 1kk adena's. 1kk / 4 = 250k
        final int count = Coin / toReward.size(); // 250k
        
        // Adding 250k for each player
        for (Player member : toReward)
            member.addCoin("Party", count, player, true);
    }

if (item.getItemId() == 6577)
        {
            distributeCoin(player, item.getCount(), player);
            ItemTable.getInstance().destroyItem("Party", item, player, null);
            return;
        }

 

Edited by ThelwHelpRePaidia
  • 0
Posted (edited)

ok i made it working with the message you have earned but it doesnt broadcast to the other members what the player 1 picked to player 2

Edited by ThelwHelpRePaidia
  • 0
Posted
5 hours ago, ThelwHelpRePaidia said:

ok i made it working with the message you have earned but it doesnt broadcast to the other members what the player 1 picked to player 2

// Send messages to other party members about reward
if (item.getCount() > 1)
	broadcastToPartyMembers(target, SystemMessage.getSystemMessage(SystemMessageId.S1_OBTAINED_S3_S2).addPcName(target).addItemName(item).addItemNumber(item.getCount()));
else if (item.getEnchantLevel() > 0)
	broadcastToPartyMembers(target, SystemMessage.getSystemMessage(SystemMessageId.S1_OBTAINED_S2_S3).addPcName(target).addNumber(item.getEnchantLevel()).addItemName(item));
else
	broadcastToPartyMembers(target, SystemMessage.getSystemMessage(SystemMessageId.S1_OBTAINED_S2).addPcName(target).addItemName(item));

 

Guest
This topic is now closed to further replies.


  • Posts

    • hey guyz.used Guytis 's pack...but i found the teleporter dose not show TeleportList,when i click Teleport,the html dosn't display any infos.didnot know why. i trited his v158 and v201 codes,all were not working.   https://imgur.com/a/Gzx2RTu
    • Hello Everyone  I hope you missed Old nostalgia BNB , is time to come back and be ready for the new journey  L2 BnB C3 Website: https://l2bnb.eu/ Discord: https://discord.gg/jaCJKYXgYZ Max Level 75 Max Grade (A) Safe:3 , Max:16 Anti-Botting. Auto learning skills , Auto Loot , Auto Create Account Subclass (NO) quest. Retail Buffs/DS Time ,Need Buffer Char (NO NPC Buffer) OfflineShop,OfflineCraft,ChangePass No GM Shop,No Global Gk,No Donate,Free Teleport only LVL 1 commands: .offline , .changepassword 99+% Retail 1+1 Window Per Pc BASIC FEATURES: Exp/SP: x 3 Adena: x3 Drop: х3 Spoil: x3 Support 24/7 GLOBAL COMMUNITY
    • 亲爱的朋友们,我们很高兴向您介绍我们的全新服务 —— KYC 实名认证,适用于任何平台!️ 我们为加密货币交易所、在线市场、社交网络、主机服务商、赌场及其他合法网站提供实名认证服务。认证可通过护照或驾驶证完成。不支持任何涉及非法活动的网站。 可用国家: 东欧:俄罗斯、乌克兰、白俄罗斯、乌兹别克斯坦、亚美尼亚、吉尔吉斯斯坦、哈萨克斯坦 — $30–33 欧盟(西欧,通常为拉脱维亚和爱沙尼亚) — $80–88 非洲:尼日利亚、肯尼亚 — $30–33 如果您需要注册并验证您的账户,总金额将额外收取 10% 手续费。 如需申请 KYC 认证或咨询其他问题,请通过以下方式联系我们: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ 邮箱: solomonbog@socnet.store SOCNET 商店有效链接: 数字商品商店(网站):进入 商店 Telegram 机器人:进入 – 通过 Telegram 消息应用便捷访问商店。 Telegram 星星购买机器人:进入 – 快速且优惠地购买 Telegram 星星。 SMM 面板:进入 – 推广您的社交媒体账户。 我们为您准备了最新的促销与特别优惠,用于购买我们的产品与服务: 1. 使用优惠码 OCTOBER2025(8% 折扣)即可在 9 月于我们的商店(网站或机器人)购物享受优惠!首次购买还可使用优惠码 SOCNET(15% 折扣)。 2. 获得 $1 商店余额或 10–20% 折扣 —— 只需在网站注册后按照以下格式留言:"SEND ME BONUS, MY USERNAME IS..." – 在我们的论坛帖中发布即可! 3. 首次试用 SMM 面板可获得 $1 奖励 —— 只需在网站(支持)提交标题为 “Get Trial Bonus” 的工单。 4. 每周在我们的 Telegram 频道及星星购买机器人中举行 Telegram 星星赠送活动! 新闻资讯: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh
  • 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