Jump to content
  • 0

Drope Custom aCis


l2jkain

Question

 

Hello I'm creating a custom drop for Assis 374, I'm a customer but no one helped me there

 

Well this code works perfectly until going to level 81 the dropes are all tripled does anyone help me?

 


		// Herbs.
		if (getTemplate().getDropHerbGroup() > 0)
		{
			for (DropCategory cat : HerbDropData.getInstance().getHerbDroplist(getTemplate().getDropHerbGroup()))
			{
				final IntIntHolder item = calculateCategorizedHerbItem(cat, levelModifier);
				if (item != null)
				{
					if (Config.AUTO_LOOT_HERBS)
						player.addItem("Loot", item.getId(), 1, this, true);
					else
					{
						// If multiple similar herbs drop, split them and make a unique drop per item.
						final int count = item.getValue();
						if (count > 1)
						{
							item.setValue(1);
							for (int i = 0; i < count; i++)
								dropItem(player, item);
						}
						else
							dropItem(player, item);
					}
				}
			}
		}
+		
+		// Drop All Monsters
+		if ((Config.ALLOW_GLOBAL_DROP) && ((this instanceof Monster)))
+		{
+			int levelMobMin = 0;
+			for (int i = 1; i < 81; i++)
+			{
+				levelMobMin = player.getLevel() - 8;
+				if (i > 10)
+				{
+					if (player.getLevel() == i && getLevel() < levelMobMin)
+						return;
+				}
+			}
+			dropItem(player, Config.GLOBAL_DROP_ITEMS);
+		}	
	}
+                                                                           
+	private void dropItem(Player  player, Map<Integer, List<Integer>> droplist)
+	{
+		Integer key;
+		Integer chance;
+		Integer min;
+		Integer max;
+		Integer itemMin;
+		Integer itemMax;
+		Integer count;
+		Integer rnd;
+		for (Entry<Integer, List<Integer>> entry : droplist.entrySet())
+		{
+			key = entry.getKey();
+			List<Integer> valueList = entry.getValue();
+			
+			chance = valueList.get(0);
+			min = valueList.get(1);
+			max = valueList.get(2);
+			
+			if (getLevel() > 9)
+			{
+				itemMin = getLevel() * min / 5;
+				itemMax = getLevel() * max / 6;
+			}
+			else
+			{
+				itemMin = min;
+				itemMax = max;
+			}
+			count = Rnd.get(itemMin, itemMax);
+			
+			rnd = Rnd.get(100);
+			
+			if (rnd < chance)
+			{
+				IntIntHolder item = new IntIntHolder(key, count);
+				if (Config.AUTO_LOOT)
+					player.doAutoLoot(this, item);
+				else
+					dropItem(player, item);
+			}
+		}	
+	}
+	
	/**
	 * Drop reward item.
	 * @param mainDamageDealer The player who made highest damage.
	 * @param holder The ItemHolder.
	 * @return the dropped item instance.
	 */
	public ItemInstance dropItem(Player mainDamageDealer, IntIntHolder holder)
	{

fop9lIv.png

 

# Select o item for drop all monster 
# Example : Itemid,chance,min,max;Itemid,chance,min,max
DropSystemItems = 9210,80,2,4;9211,70,1,3;9212,60,2,5;9213,40,3,5;9214,30,1,3;9215,50,2,3;9216,20,2,4
 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I don't have any knowledge as far as it concerns java but maybe you should change this?
 

int levelMobMin = 0;
+			for (int i = 1; i < 81; i++)
Link to comment
Share on other sites

  • 0
2 hours ago, l2jkain said:

i < 81

As you said, until 81 it's all fine. So, the check is the problem, i <= 81. Btw, why do you have a loop there?!?! I wonder... Remove it for God's sake. There is no logic and it's so so pointless..

Instead of Integer use primitive int.

  • Thanks 1
Link to comment
Share on other sites

  • 0
14 minutes ago, SweeTs said:

Como você disse, até 81 está tudo bem. Então, o cheque é o problema, i <= 81. Btw, por que você tem um loop lá?!?! Eu me pergunto ... Remova isso pelo amor de Deus. Não há lógica e é tão inútil ..

Em vez de Integer, use primitivo int.

What can I do better?

 

private void dropItem(Player  player, Map<Integer, List<Integer>> droplist)
    {
        for (Entry<Integer, List<Integer>> entry : droplist.entrySet())
        {
            int key = entry.getKey();
            List<Integer> valueList = entry.getValue();
            
            int chance = valueList.get(0);
            int min = valueList.get(1);
            int max = valueList.get(2);
             
            int itemMin = min;
            int itemMax = max;
            
            int count = Rnd.get(itemMin, itemMax);
            
            int rnd = Rnd.get(100);
            
            if (rnd < chance)
            {
                IntIntHolder item = new IntIntHolder(key, count);
                if (Config.AUTO_LOOT)
                    player.doAutoLoot(this, item);
                else
                    dropItem(player, item);
            }
        }    
    }

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...