Page 1 of 1

Making all mobs drop gil

Posted: Tue Apr 08, 2014 11:01 am
by Zkenpachi11
Is it possible to add something to the end of a script in order to add gil to all party members when the monster is killed?
Is that done in a script or is that hardcoded?

Re: Making all mobs drop gil

Posted: Tue Apr 08, 2014 11:31 am
by Zkenpachi11
hmmm... I found the gil drop in the mobentity.cpp

Code: Select all

bool CMobEntity::CanDropGil()
{
    // smaller than 0 means drop no gil
    if(getMobMod(MOBMOD_GIL_MAX) < 0) return false;

    if(getMobMod(MOBMOD_GIL_MIN) > 0 || getMobMod(MOBMOD_GIL_MAX))
    {
        return true;
    }

    return m_EcoSystem == SYSTEM_BEASTMEN;
}
Would it just be possible for me make it so candropgil is always true? Then I would also probably need to change the function above it:

Code: Select all

uint32 CMobEntity::GetRandomGil()
{

    int16 min = getMobMod(MOBMOD_GIL_MIN);
    int16 max = getMobMod(MOBMOD_GIL_MAX);

    if(min && max)
    {
        // make sure divide won't crash server
        if(max <= min)
        {
            max = min+1;
        }

        if(max-min <= 2)
        {
            max = min+2;
            ShowWarning("CMobEntity::GetRandomGil Max value is set too low, defauting\n");
        }

        return rand()%(max-min)+min;
    }

    float gil = pow(GetMLevel(), 1.05f);

    if(gil < 1){
        gil = 1;
    }

    uint16 highGil = (float)(gil) / 3 + 4;

    if(max)
    {
        highGil = max;
    }

    if(highGil < 2){
        highGil = 2;
    }

    // randomize it
	gil += rand()%highGil;

    // NMs get more gil
    if((m_Type & MOBTYPE_NOTORIOUS) == MOBTYPE_NOTORIOUS){
        gil *= 10;
    }

    // thfs drop more gil
    if(GetMJob() == JOB_THF){
        gil = (float)gil * 1.5;
    }

    if(min && gil < min)
    {
        gil = min;
    }

    return gil;
}

Re: Making all mobs drop gil

Posted: Tue Apr 08, 2014 2:37 pm
by Zkenpachi11
made the candropgil function always return true,

added:
min += 50;
max += 100;

to the getrandomgil function, and tested it, everything drops 50-100 gold