Hi Hik, your searching was useful to me, as you said every windows server file is affected by this bug.
I found the root cause.
File: utils.c in libthecore
DWORD thecore_random()
{
#ifdef __WIN32__
return rand();
#else
return random();
#endif
for Windows, it will use rand(). It has limitations for Windows, the maximum range is 32767. That's why the number extraction in Windows is so low.
You have to find another way to random with bigger numbers, or as a workaround you can multiply the rand() value to have a maximum of iRandRange.
You can find the multiplier value by dividing iRandRange / 32767.
It's working, but it's a really bad workaround if you tell me, because we are not get a random result from 1 to iRandRange.
If you want to try this workaround, find item_manager.cpp and change:
number(1,iRandRange)
To
(rand() % 32767) * iMultiplier)
Before
while (it != g_vec_pkCommonDropItem[bRank].end()) in CreateDropItem
add this:
int iMultiplier = iRandRange / 32767
Before
while sys_log(1, "CreateQuestDropItem victim(%s), killer(%s)", pkChr->GetName(), pkKiller->GetName() ); in CreateDropItem
add this:
int iMultiplier = iRandRange / 32767
My advise is to work in a good implementation of random for Windows.
Cheers