Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Various map>m .cpp/.h files: Translate Russian to English #4539

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 23 additions & 145 deletions src/map/merit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@
#include "packets/char_spells.h"
#include "utils/charutils.h"

/************************************************************************
* *
* Две версии значений - до abyssea и после *
* *
************************************************************************/

// массив больше на одно значение, заполняемое нулем

static uint8 upgrade[10][45] = {
{ 1, 2, 3, 4, 5, 5, 5, 5, 5, 7, 7, 7, 9, 9, 9 }, // HP-MP
{ 3, 6, 9, 9, 9, 12, 12, 12, 12, 15, 15, 15, 15, 18, 18 }, // Attributes
Expand All @@ -52,38 +44,26 @@ static uint8 upgrade[10][45] = {
51, 51 } // Max merits
};

#define MAX_LIMIT_POINTS 10000 // количество опыта для получения одного merit
#define MAX_LIMIT_POINTS 10000

// TODO: скорее всего придется все это перенести в базу

/************************************************************************
* *
* Ограничение количества усилений metir *
* *
************************************************************************/
// TODO: Transfer all this to the database

static uint8 cap[100] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0-9 0
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 10-19 1
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 20-29 2
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 30-39 3
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // 40-49 4
5, 5, 5, 5, 5, // 50-54 5
6, 6, 6, 6, 6, // 55-59 6
7, 7, 7, 7, 7, // 60-64 7
8, 8, 8, 8, 8, // 65-69 8
9, 9, 9, 9, 9, // 70-74 9
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00-09 0
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 10-19 1
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 20-29 2
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 30-39 3
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // 40-49 4
5, 5, 5, 5, 5, // 50-54 5
6, 6, 6, 6, 6, // 55-59 6
7, 7, 7, 7, 7, // 60-64 7
8, 8, 8, 8, 8, // 65-69 8
9, 9, 9, 9, 9, // 70-74 9
10, 10, 10, 10, 10, // 75-79 10
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, // 80-89 15
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, // 90-99 15
};

/************************************************************************
* *
* Количество элементов в каждой из категорий *
* *
************************************************************************/

struct MeritCategoryInfo_t
{
int8 MeritsInCat; // number of elements in a group
Expand Down Expand Up @@ -158,12 +138,6 @@ static const MeritCategoryInfo_t meritCatInfo[] = {
#define GetMeritCategory(merit) (((merit) >> 6) - 1) // get category from merit
#define GetMeritID(merit) (((merit)&0x3F) >> 1) // get the offset in the category from merit

/************************************************************************
* *
* *
* *
************************************************************************/

CMeritPoints::CMeritPoints(CCharEntity* PChar)
{
if (sizeof(merits) != sizeof(meritNameSpace::GMeritsTemplate))
Expand All @@ -181,12 +155,6 @@ CMeritPoints::CMeritPoints(CCharEntity* PChar)
m_MeritPoints = 0;
}

/************************************************************************
* *
* Load character merits *
* *
************************************************************************/

void CMeritPoints::LoadMeritPoints(uint32 charid)
{
uint8 catNumber = 0;
Expand Down Expand Up @@ -233,12 +201,6 @@ void CMeritPoints::LoadMeritPoints(uint32 charid)
}
}

/************************************************************************
* *
* Save character merits *
* *
************************************************************************/

void CMeritPoints::SaveMeritPoints(uint32 charid)
{
for (auto& merit : merits)
Expand All @@ -255,34 +217,16 @@ void CMeritPoints::SaveMeritPoints(uint32 charid)
}
}

/************************************************************************
* *
* Получаем текущие limit points *
* *
************************************************************************/

uint16 CMeritPoints::GetLimitPoints() const
{
return m_LimitPoints;
}

/************************************************************************
* *
* Получаем текущие merit points *
* *
************************************************************************/

uint8 CMeritPoints::GetMeritPoints() const
{
return m_MeritPoints;
}

/************************************************************************
* *
* Return the total merits in the same category as the given merit. *
* *
************************************************************************/

uint16 CMeritPoints::GetMeritCountInSameCategory(MERIT_TYPE merit)
{
if (!this->IsMeritExist(merit))
Expand All @@ -303,13 +247,7 @@ uint16 CMeritPoints::GetMeritCountInSameCategory(MERIT_TYPE merit)
return total;
}

/************************************************************************
* *
* Добавляем персонажу limit points *
* *
************************************************************************/

// true - если merit был добавлен
// true - If merit was added

bool CMeritPoints::AddLimitPoints(uint16 points)
{
Expand Down Expand Up @@ -337,32 +275,20 @@ bool CMeritPoints::AddLimitPoints(uint16 points)
return false;
}

/************************************************************************
* *
* set limit points *
* *
************************************************************************/

void CMeritPoints::SetLimitPoints(uint16 points)
{
m_LimitPoints = std::min<uint16>(points, MAX_LIMIT_POINTS - 1);
}

/************************************************************************
* *
* set merit points *
* *
************************************************************************/

void CMeritPoints::SetMeritPoints(uint16 points)
{
m_MeritPoints = std::min<uint8>((uint8)points, settings::get<uint8>("map.MAX_MERIT_POINTS") + GetMeritValue(MERIT_MAX_MERIT, m_PChar));
}

/************************************************************************
* *
* Проверяем наличие merit. Необходимо использовать лишь в случае *
* получения meritid от персонажа *
* Check the availability of merit. Should only be used if receiving *
* meritid from a character *
* *
************************************************************************/

Expand All @@ -385,23 +311,11 @@ bool CMeritPoints::IsMeritExist(MERIT_TYPE merit)
return true;
}

/************************************************************************
* *
* Получаем указатель на искомый const merit *
* *
************************************************************************/

const Merit_t* CMeritPoints::GetMerit(MERIT_TYPE merit)
{
return GetMeritPointer(merit);
}

/************************************************************************
* *
* Получаем указатель на искомый const merit по индексу *
* *
************************************************************************/

const Merit_t* CMeritPoints::GetMeritByIndex(uint16 index)
{
if (index >= MERITS_COUNT)
Expand All @@ -413,12 +327,6 @@ const Merit_t* CMeritPoints::GetMeritByIndex(uint16 index)
return &merits[index];
}

/************************************************************************
* *
* Получаем указатель на искомый merit *
* *
************************************************************************/

Merit_t* CMeritPoints::GetMeritPointer(MERIT_TYPE merit)
{
if (IsMeritExist(merit))
Expand All @@ -428,12 +336,6 @@ Merit_t* CMeritPoints::GetMeritPointer(MERIT_TYPE merit)
return nullptr;
}

/************************************************************************
* *
* Add upgrade, also removes merit point *
* *
************************************************************************/

void CMeritPoints::RaiseMerit(MERIT_TYPE merit)
{
Merit_t* PMerit = GetMeritPointer(merit);
Expand Down Expand Up @@ -467,12 +369,6 @@ void CMeritPoints::RaiseMerit(MERIT_TYPE merit)
}
}

/************************************************************************
* *
* Remove upgrade *
* *
************************************************************************/

void CMeritPoints::LowerMerit(MERIT_TYPE merit)
{
Merit_t* PMerit = GetMeritPointer(merit);
Expand Down Expand Up @@ -503,12 +399,6 @@ void CMeritPoints::LowerMerit(MERIT_TYPE merit)
}
}

/************************************************************************
* *
* Получаем текущее значение указанного merit *
* *
************************************************************************/

int32 CMeritPoints::GetMeritValue(MERIT_TYPE merit, CCharEntity* PChar)
{
Merit_t* PMerit = GetMeritPointer(merit);
Expand All @@ -532,22 +422,10 @@ int32 CMeritPoints::GetMeritValue(MERIT_TYPE merit, CCharEntity* PChar)
return meritValue;
}

/************************************************************************
* *
* Реализация namespase для работы с Linkshells *
* *
************************************************************************/

namespace meritNameSpace
{
Merit_t GMeritsTemplate[MERITS_COUNT] = {}; // global list of merits and their properties
int16 groupOffset[MCATEGORY_COUNT / 64 - 1] = { 0 }; // the first merit offset of each catagory

/************************************************************************
* *
* Загружаем шаблон массива merits / Load pattern array merits *
* *
************************************************************************/
int16 groupOffset[MCATEGORY_COUNT / 64 - 1] = { 0 }; // the first merit offset of each category

void LoadMeritsList()
{
Expand All @@ -560,9 +438,9 @@ namespace meritNameSpace
// issue with unknown catagories causing massive confusion

uint16 index = 0; // global merit template count (to 255)
uint8 catIndex = 0; // global merit catagory count (to 51)
int8 previousCatIndex = 0; // will be set on every loop, used for detecting a catagory change
int8 catMeritIndex = 0; // counts number of merits in a catagory
uint8 catIndex = 0; // global merit category count (to 51)
int8 previousCatIndex = 0; // will be set on every loop, used for detecting a category change
int8 catMeritIndex = 0; // counts number of merits in a category

while (sql->NextRow() == SQL_SUCCESS)
{
Expand All @@ -582,19 +460,19 @@ namespace meritNameSpace

previousCatIndex = Merit.catid; // previousCatIndex is set on everyloop to detect a catogory change.

if (previousCatIndex != catIndex) // check for catagory change.
if (previousCatIndex != catIndex) // check for category change.
{
groupOffset[catIndex] = index - catMeritIndex; // set index offset, first merit of each group.
catIndex++; // now on next catagory.
catMeritIndex = 0; // reset the merit catagory count to 0.
catIndex++; // now on next category.
catMeritIndex = 0; // reset the merit category count to 0.

if (previousCatIndex != catIndex)
{ // this deals with the problem with unknown catagories.
catIndex = previousCatIndex;
}
}

catMeritIndex++; // next index within catagory.
catMeritIndex++; // next index within category.
index++; // next global template index.
}

Expand Down
Loading