Issue information

Issue ID
#6544
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Aug 23, 2012 11:33
Last Post
Hercules Elf Bot
Sep 26, 2012 22:21
Confirmation
N/A

Hercules Elf Bot - Aug 23, 2012 11:33

Originally posted by [b]akrus[/b]
Hi,

in mob.c, function mob_dead, old lines were:
[code] for(j=0;j<3;j++)
{
i = rand() % 3;[/code]

New lines are:
[code] for(i = 0; i < MAX_MVP_DROP; i++)
{[/code]

Someone has implemented MAX_MVP_DROP, but forgot about the case like:
High-rate servers may have 100% percent drops for the first item. In this case you will always get the item which is first in the list and never the others. The simplest approach is to return rand() back (rnd() currently in rAthena) so it will look like:
[code]int j;
for(j = 0; j < MAX_MVP_DROP; j++)
{
i = rand() % 3;[/code]

Hercules Elf Bot - Aug 23, 2012 14:45

Originally posted by [b]Ind[/b]
indeed but what'd be the best behavior? the previous one wasnt correct either (it'd loop by 3 then randomly pick one of the 3 which could cause the same item be picked more than once)

Hercules Elf Bot - Aug 23, 2012 15:02

Originally posted by [b]Vali[/b]
Summatory of all the possibilities for all the items on the MVP drop, then a random in the range to pickup one of them?

I mean if there are 2 items with 100% and 1 with 30%, then do a rand between 1 and 30000 and the number is between 1~10000 is the first drop, 10001~20000 is the seccond drop and 20001~30000 to the third drop. If there is selected the first drop, give it only if the number is between 20001 and 23000, if not, there is no drop.

Vali~

Hercules Elf Bot - Sep 26, 2012 11:38

Originally posted by [b]akrus[/b]
Bump?

Hercules Elf Bot - Sep 26, 2012 22:21

Originally posted by [b]Ind[/b]
Fixed in [rev=16804]