• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling Most Damage Loot 0.3.6

rafaeru

Active Member
Joined
Mar 6, 2013
Messages
134
Solutions
10
Reaction score
29
Location
Poland
GitHub
rafaeru97
I try to do loot for most damage player. I found this but i dont know how damageMap work. Any hints ?

I work on TFS 0.3.6

C++:
DeathList Creature::getKillers()
{
    DeathList list;
    Creature* lhc = NULL;
    if(!(lhc = g_game.getCreatureByID(lastHitCreature)))
        list.push_back(DeathEntry(getCombatName(lastDamageSource), 0));
    else
        list.push_back(DeathEntry(lhc, 0));

    int32_t requiredTime = g_config.getNumber(ConfigManager::DEATHLIST_REQUIRED_TIME);
    int64_t now = OTSYS_TIME();

    CountBlock_t cb;
    for(CountMap::const_iterator it = damageMap.begin(); it != damageMap.end(); ++it)
    {
        cb = it->second;
        if((now - cb.ticks) > requiredTime)
            continue;

        Creature* mdc = g_game.getCreatureByID(it->first);
        if(!mdc || mdc == lhc || (lhc && (mdc->getMaster() == lhc || lhc->getMaster() == mdc)))
            continue;

        bool deny = false;
        for(DeathList::iterator fit = list.begin(); fit != list.end(); ++fit)
        {
            if(fit->isNameKill())
                continue;

            Creature* tmp = fit->getKillerCreature();
            if(!(mdc->getName() == tmp->getName() && mdc->getMaster() == tmp->getMaster()) &&
                (!mdc->getMaster() || (mdc->getMaster() != tmp && mdc->getMaster() != tmp->getMaster()))
                && (mdc->getSummonCount() <= 0 || tmp->getMaster() != mdc))
                continue;

            deny = true;
            break;
        }

        if(!deny)
            list.push_back(DeathEntry(mdc, cb.total));
    }

    if(list.size() > 1)
        std::sort(list.begin() + 1, list.end(), DeathLessThan());

    return list;
}
[code]
 
Back
Top