Esempio n. 1
0
void HonorMaintenancer::DistributeRankPoints(Team team)
{
    HonorStandingList& standingList = GetStandingListByTeam(team);
    if (standingList.empty())
        return;

    HonorScores scores = GenerateScores(standingList);

    uint32 position = 1;

    for (auto& standing : standingList)
    {
        auto itrWS = m_weeklyScores.find(standing.guid);
        if (itrWS == m_weeklyScores.end())
            continue;

        auto& weeklyScore = itrWS->second;
        
        // Calculate rank points earning
        weeklyScore.earning = CalculateRpEarning(weeklyScore.cp, scores);
        
        // Calculate rank points with decay
        weeklyScore.newRp = CalculateRpDecay(weeklyScore.earning, weeklyScore.oldRp);
        
        // Level restrictions
        weeklyScore.newRp = std::min(MaximumRpAtLevel(weeklyScore.level), weeklyScore.newRp);

        // Set standing to score
        weeklyScore.standing = position;

        ++position;
    }
}
Esempio n. 2
0
void TargetReport::Generate() {
    if (reports == 0) { GenerateParticleReport(); }
    if (scores == 0) { GenerateScores(); }
}
Esempio n. 3
0
void HonorMaintenancer::CreateCalculationReport()
{
    std::string timestamp = Log::GetTimestampStr();
    std::string filename = "HCR_" + timestamp + ".txt";

    std::ofstream ofs;
    ofs.open(filename.c_str());
    if (!ofs.is_open())
    {
        sLog.outError("Can't create HCR file!");
        return;
    }

    if (!m_allianceStandingList.empty())
    {
        HonorScores scores = GenerateScores(m_allianceStandingList);

        ofs << "Alliance Honor Scores" << std::endl << std::endl;
        ofs << "Standing size: " << m_allianceStandingList.size() << std::endl << std::endl;

        ofs << std::flush;

        for (auto i = 0; i < 14; ++i)
            ofs << "BRK[" << i << "] = " << scores.BRK[i] << std::endl;

        ofs << std::endl;
        ofs << std::flush;

        for (auto i = 0; i < 15; ++i)
            ofs << "FX[" << i << "] = " << scores.FX[i] << std::endl;

        ofs << std::endl;
        ofs << std::flush;

        for (auto i = 0; i < 15; ++i)
            ofs << "FY[" << i << "] = " << scores.FY[i] << std::endl;
        
        ofs << std::endl;
        ofs << std::flush;
        
        for (auto& st : m_allianceStandingList)
        {
            auto itrWS = m_weeklyScores.find(st.guid);
            if (itrWS == m_weeklyScores.end())
                continue;

            auto ws = itrWS->second;

            ofs << "Guid: " << st.guid
                << ", HK: " << ws.hk
                << ", DK: " << ws.dk
                << ", CP: " << ws.cp
                << ", oldRp: " << ws.oldRp
                << ", earning: " << ws.earning
                << ", newRp: " << ws.newRp
                << ", capRp: " << MaximumRpAtLevel(ws.level)
                << ", standing: " << ws.standing << std::endl << std::flush;
        }
    }
    
    ofs << "--------------------------------------------------" << std::endl << std::endl << std::flush;
    
    if (!m_hordeStandingList.empty())
    {
        HonorScores scores = GenerateScores(m_hordeStandingList);

        ofs << "Horde Honor Scores" << std::endl << std::endl;
        ofs << "Standing size: " << m_hordeStandingList.size() << std::endl << std::endl;

        ofs << std::flush;

        for (auto i = 0; i < 14; ++i)
            ofs << "BRK[" << i << "] = " << scores.BRK[i] << std::endl;

        ofs << std::endl;
        ofs << std::flush;

        for (auto i = 0; i < 15; ++i)
            ofs << "FX[" << i << "] = " << scores.FX[i] << std::endl;

        ofs << std::endl;
        ofs << std::flush;

        for (auto i = 0; i < 15; ++i)
            ofs << "FY[" << i << "] = " << scores.FY[i] << std::endl;
        
        ofs << std::endl;
        ofs << std::flush;
        
        for (auto& st : m_hordeStandingList)
        {
            auto itrWS = m_weeklyScores.find(st.guid);
            if (itrWS == m_weeklyScores.end())
                continue;

            auto ws = itrWS->second;

            ofs << "Guid: " << st.guid
                << ", HK: " << ws.hk
                << ", DK: " << ws.dk
                << ", CP: " << ws.cp
                << ", oldRp: " << ws.oldRp
                << ", earning: " << ws.earning
                << ", newRp: " << ws.newRp
                << ", capRp: " << MaximumRpAtLevel(ws.level)
                << ", standing: " << ws.standing << std::endl << std::flush;
        }
    }
    
    ofs << "--------------------------------------------------" << std::endl << std::endl << std::flush;
    
    if (!m_inactiveStandingList.empty())
    {
        ofs << "Inactive players decay" << std::endl << std::endl;
        ofs << "Count: " << m_inactiveStandingList.size() << std::endl << std::endl;
        ofs << std::flush;

        for (auto& st : m_inactiveStandingList)
        {
            auto itrWS = m_weeklyScores.find(st.guid);
            if (itrWS == m_weeklyScores.end())
                continue;

            auto ws = itrWS->second;

            ofs << "Guid: " << st.guid
                << ", HK: " << ws.hk
                << ", DK: " << ws.dk
                << ", CP: " << ws.cp
                << ", oldRp: " << ws.oldRp
                << ", newRp: " << ws.newRp
                << ", capRp: " << MaximumRpAtLevel(ws.level)
                << ", standing: " << ws.standing << std::endl << std::flush;
        }
    }

    ofs.close();
}