Files

1.3 KiB
Raw Permalink Blame History

MercanRey6.js — main() (satır 343)

← MercanRey6.js · ← Master

function main(c)
{
    var player = requirePlayer(c);

    if (player == null)
    {
        return;
    }

    var db = getKnowledgeDb();
    var target = getTarget(c, player);
    var estimates = [];

    if (target != null && db.people[String(target.getUniqueId())] != null)
    {
        estimates.push(estimateProfile(c, db.people[String(target.getUniqueId())], db));
    }
    else
    {
        for (var uuid in db.people)
        {
            if (Object.prototype.hasOwnProperty.call(db.people, uuid))
            {
                estimates.push(estimateProfile(c, db.people[uuid], db));
            }
        }

        estimates.sort(function (a, b)
        {
            return b.confidence - a.confidence;
        });
    }

    if (estimates.length === 0)
    {
        player.send("El sigue siendo el Juez: hesaplayacak bilgi yok. Once Ladron de Informacion ile profil topla.");
        return;
    }

    mappet.set(LAST_KEY_PREFIX + player.getUniqueId(), estimates);
    player.send("El sigue siendo el Juez incluso fuera del trono:");

    var limit = Math.min(5, estimates.length);

    for (var i = 0; i < limit; i++)
    {
        sendEstimate(player, estimates[i]);
    }
}