Categorized reward calculation for specific item ids

This is not a Support area! Discuss about the Server here. Non-Server related discussion goes in Off-Topic Discussion.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
ibedoya
Posts: 14
Joined: Thu Jun 21, 2012 5:37 pm

Categorized reward calculation for specific item ids

Post by ibedoya »

Well the thing is I think there is a mistake calculating categorized rewards when one of the item in the category is in RateDropItemsById config and deep blue rules are activated.

I found the problem killing a mob who has only 1 item category, like jewelry of raid bosses, being 9 levels higher than the boss and this item in the RateDropItemsById config and 1x rate instead of 7x (my default rate drop config)
(For example Baium ring and being lvl 85 (rate lowered to 27%))

Well with this config the item rate should be lowered, but no, its 100%.

I tried to learn from L2Attackable.java file, and edit the calculateCategorizedRewardItem method.

Perhaps we can change the calculate way of categoryDropChance, for each item in the category sum default rate but if one of the items is in RateDropItemsById then sum this rate and finally divide by number of items.
For example, we have item, A, B and C in the same category, and item C has 2x rate, the default rate is x10 so, categoryDropChance should be: (10 + 10 + 2) / 3 = 7.33 instead of 10.

Another way to do that is, "number of items" by "default rate"(multiplication) minus difference between default rate and RateDropItemsById only for each items in RateDropItemsById and finally divide by number of items.
So, ((3*10) - 7) / 3 = 7.33 instead of 10.

I don't know if this last way is more efficient, but I did the first one:

Code: Select all

// Applies Drop ratesint categoryDropSpecificId = 0;for(L2DropData drop : categoryDrops.getAllDrops()){  if (Config.RATE_DROP_ITEMS_ID.get(drop.getItemId()) != 0)  {    categoryDropSpecificId += Config.RATE_DROP_ITEMS_ID.get(drop.getItemId());  }  else  {    categoryDropSpecificId += isRaid() && !isRaidMinion() ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;  }} categoryDropSpecificId /= categoryDrops.getAllDrops().size(); // Avoid dividing by 0if (categoryDropSpecificId == 0){  categoryDropSpecificId = 1;} categoryDropChance *= categoryDropSpecificId;
instead of

Code: Select all

// Applies Drop ratescategoryDropChance *= isRaid() && !isRaidMinion() ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;
I think this code don't fix the main problem, maybe DeepBlue drop rules should be calculated for the item which will be dropped? I mean after call L2DropCategory dropOne() method.

What do you think? Can this problem be solved in another way?

I'm not English native speaker, so, sorry if something is wrong.

Regards.
Post Reply