1
0
forked from metin2/server

Restructured gamefiles, locale data loading refactoring, docker build fixes

This commit is contained in:
2024-05-25 20:00:26 +03:00
parent 27108d629a
commit 48ee253534
1046 changed files with 84 additions and 12989 deletions

View File

@ -81,9 +81,10 @@ static std::set<DWORD> s_set_dwProcessCRC;
string g_stHostname = "";
string g_table_postfix = "";
string g_stQuestDir = "./quest";
//string g_stQuestObjectDir = "./quest/object";
string g_stDefaultQuestObjectDir = "./quest/object";
string g_stBasePath = "data";
string g_stMapPath = "data/map";
string g_stQuestDir = "data/quest";
string g_stDefaultQuestObjectDir = "data/quest/object";
std::set<string> g_setQuestObjectDir;
std::vector<std::string> g_stAdminPageIP;
@ -509,17 +510,15 @@ void config_init(const string& st_localeServiceName)
SPDLOG_INFO("CommonSQL connected");
// 로케일 정보를 가져오자
// <경고> 쿼리문에 절대 조건문(WHERE) 달지 마세요. (다른 지역에서 문제가 생길수 있습니다)
// Initialize locale settings
{
char szQuery[512];
snprintf(szQuery, sizeof(szQuery), "SELECT mKey, mValue FROM locale");
std::string szQuery = "SELECT mKey, mValue FROM locale WHERE mKey = 'LANGUAGE'";
std::unique_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery));
std::unique_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery.c_str()));
if (pMsg->Get()->uiNumRows == 0)
{
SPDLOG_CRITICAL("COMMON_SQL: DirectQuery failed: {}", szQuery);
SPDLOG_CRITICAL("COMMON_SQL: LANGUAGE setting was not found in database!");
exit(EXIT_FAILURE);
}
@ -528,7 +527,7 @@ void config_init(const string& st_localeServiceName)
while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
{
// 로케일 세팅
if (strcasecmp(row[0], "LOCALE") == 0)
if (strcasecmp(row[0], "LANGUAGE") == 0)
{
if (LocaleService_Init(row[1]) == false)
{

View File

@ -75,8 +75,9 @@ extern std::string g_stClientVersion;
extern bool g_bCheckClientVersion;
extern void CheckClientVersion();
extern std::string g_stBasePath;
extern std::string g_stMapPath;
extern std::string g_stQuestDir;
//extern std::string g_stQuestObjectDir;
extern std::set<std::string> g_setQuestObjectDir;

View File

@ -56,137 +56,7 @@ TBattleTypeStat BattleTypeStats[BATTLE_TYPE_MAX_NUM] =
{ -20, 20, -10, 0 }, // BATTLE_TYPE_SUPER_TANKER,
};
const DWORD * exp_table = NULL;
const DWORD exp_table_euckr[PLAYER_EXP_TABLE_MAX + 1] =
{
0, // 0
100,
150,
260,
380,
600,
1300,
3300,
5700,
8700,
12800, // 10
18000,
25000,
36000,
52000,
73000,
100000,
125000,
160000,
220000,
280000, // 20
370000,
540000,
670000,
880000,
1000000,
1237000,
1418000,
1624000,
1857000,
2122000, // 30
2421000,
2761000,
3145000,
3580000,
4073000,
4632000,
5194000,
5717000,
6264000,
6837000, // 40
7600000,
8274000,
8990000,
9753000,
10560000,
11410000,
12320000,
13270000,
14280000,
15340000, // 50
16870000,
18960000,
19980000,
21420000,
22930000,
24530000,
26200000,
27960000,
29800000,
32780000, // 60
36060000,
39670000,
43640000,
48000000,
52800000,
58080000,
63890000,
70280000,
77310000,
85040000, // 70
93540000,
102900000,
113200000,
124500000,
137000000,
150700000,
165700000,
236990000,
260650000,
286780000, // 80
315380000,
346970000,
381680000,
419770000,
461760000,
508040000,
558740000,
614640000,
676130000,
743730000, // 90
1041222000,
1145344200,
1259878620,
1385866482,
1524453130,
1676898443,
1844588288,
2029047116,
2100000000, // 99 99레벨일 때 필요경험치 (100레벨이 되기 위한)
2100000000, // 100
2100000000,
2100000000,
2100000000,
2100000000,
2100000000, // 105
2100000000,
2100000000,
2100000000,
2100000000,
2100000000, // 110
2100000000,
2100000000,
2100000000,
2100000000,
2100000000, // 115
2100000000,
2100000000,
2100000000,
2100000000,
2100000000, // 120
};
const DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1] =
const DWORD exp_table[PLAYER_EXP_TABLE_MAX + 1] =
{
0, // 0
300,
@ -311,137 +181,9 @@ const DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1] =
2500000000, // 120
};
const DWORD exp_table_newcibn[PLAYER_EXP_TABLE_MAX + 1 ] =
{
300, // 0
800, // 1
1500,
2500,
4300,
7200,
11400,
17000,
24000,
33000,
46000, // 10
62000,
83000,
111000,
149000,
200000,
268000,
360000,
482000,
647000,
868000, // 20
996000,
1143000,
1312000,
1506000,
1729000,
1984000,
2277000,
2614000,
3000000,
3443000, // 30
3952000,
4536000,
5206000,
5975000,
6858000,
7730000,
8504000,
9307000,
10140000,
11330000, // 40
12320000,
13370000,
14490000,
15670000,
16920000,
18240000,
19630000,
21090000,
22630000,
24670000, // 50
26890000,
29310000,
31950000,
34820000,
37960000,
41370000,
45100000,
49160000,
53580000,
58400000, // 60
63660000,
69390000,
75630000,
82440000,
89860000,
97950000,
106760000,
136370000,
151800000,
168300000, // 70
250000000,
340000000,
450000000,
570000000,
690000000,
810000000,
912600000,
1004000000,
1094000000,
1182000000, // 80
1269000000,
1354000000,
1438000000,
1521000000,
1603000000,
1684000000,
1764000000,
1844000000,
1922000000,
2000000000, // 90
2000000000,
2000000000,
2000000000,
2000000000,
2000000000,
2000000000,
2000000000,
2000000000,
2000000000, // 99 99레벨일 때 필요경험치 (100레벨이 되기 위한).. 현재 CIBN이 어떻게 운영하고 있는 지 모르니 신규 테이블을 쓰지 않고 기존값 계속 연장 유지
2000000000, // 100
2000000000,
2000000000,
2000000000,
2000000000,
2000000000, // 105
2000000000,
2000000000,
2000000000,
2000000000,
2000000000, // 110
2000000000,
2000000000,
2000000000,
2000000000,
2000000000, // 115
2000000000,
2000000000,
2000000000,
2000000000,
2000000000, // 120
};
const int * aiPercentByDeltaLev = NULL;
const int * aiPercentByDeltaLevForBoss = NULL;
// 적과 나와의 레벨차이에 의한 계산에 사용되는 테이블
// MIN(MAX_EXP_DELTA_OF_LEV - 1, (적렙 + 15) - 내렙))
const int aiPercentByDeltaLevForBoss_euckr[MAX_EXP_DELTA_OF_LEV] =
const int aiPercentByDeltaLevForBoss[MAX_EXP_DELTA_OF_LEV] =
{
1, // -15 0
3, // -14 1
@ -478,7 +220,7 @@ const int aiPercentByDeltaLevForBoss_euckr[MAX_EXP_DELTA_OF_LEV] =
const int aiPercentByDeltaLev_euckr[MAX_EXP_DELTA_OF_LEV] =
const int aiPercentByDeltaLev[MAX_EXP_DELTA_OF_LEV] =
{
1, // -15 0
5, // -14 1
@ -695,33 +437,8 @@ Coord aArroundCoords[ARROUND_COORD_MAX_NUM] =
{ -707, 707 },
};
const DWORD guild_exp_table[GUILD_MAX_LEVEL+1] =
{
0,
15000UL,
45000UL,
90000UL,
160000UL,
235000UL,
325000UL,
430000UL,
550000UL,
685000UL,
835000UL,
1000000UL,
1500000UL,
2100000UL,
2800000UL,
3600000UL,
4500000UL,
6500000UL,
8000000UL,
10000000UL,
42000000UL
};
// INTERNATIONAL_VERSION 길드경험치
const DWORD guild_exp_table2[GUILD_MAX_LEVEL+1] =
const DWORD guild_exp_table[GUILD_MAX_LEVEL+1] =
{
0,
6000UL,
@ -979,43 +696,14 @@ const int aiGrandMasterSkillBookMaxCount[10] =
};
// END_OF_ADD_GRANDMASTER_SKILL
const int CHN_aiPartyBonusExpPercentByMemberCount[9] =
// UPGRADE_PARTY_BONUS
const int aiPartyBonusExpPercentByMemberCount[9] =
{
0, 0, 12, 18, 26, 40, 53, 70, 100
};
// UPGRADE_PARTY_BONUS
const int KOR_aiPartyBonusExpPercentByMemberCount[9] =
{
0,
0,
30, // 66% * 2 - 100
60, // 53% * 3 - 100
75, // 44% * 4 - 100
90, // 38% * 5 - 100
105, // 34% * 6 - 100
110, // 30% * 7 - 100
140, // 30% * 8 - 100
};
const int KOR_aiUniqueItemPartyBonusExpPercentByMemberCount[9] =
{
0,
0,
15*2,
14*3,
13*4,
12*5,
11*6,
10*7,
10*8,
};
// END_OF_UPGRADE_PARTY_BONUS
const int * aiChainLightningCountBySkillLevel = NULL;
const int aiChainLightningCountBySkillLevel_euckr[SKILL_MAX_LEVEL+1] =
const int aiChainLightningCountBySkillLevel[SKILL_MAX_LEVEL+1] =
{
0, // 0
2, // 1

View File

@ -97,23 +97,16 @@ extern TBattleTypeStat BattleTypeStats[BATTLE_TYPE_MAX_NUM];
extern const DWORD party_exp_distribute_table[PLAYER_MAX_LEVEL_CONST + 1];
extern const DWORD exp_table_euckr[PLAYER_EXP_TABLE_MAX + 1];
extern const DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1];
extern const DWORD exp_table_newcibn[PLAYER_EXP_TABLE_MAX + 1];
extern const DWORD* exp_table;
extern const DWORD exp_table[PLAYER_EXP_TABLE_MAX + 1];
extern const DWORD guild_exp_table[GUILD_MAX_LEVEL + 1];
extern const DWORD guild_exp_table2[GUILD_MAX_LEVEL + 1];
#define MAX_EXP_DELTA_OF_LEV 31
#define PERCENT_LVDELTA(me, victim) aiPercentByDeltaLev[std::clamp<int>((victim + 15) - me, 0, MAX_EXP_DELTA_OF_LEV - 1)]
#define PERCENT_LVDELTA_BOSS(me, victim) aiPercentByDeltaLevForBoss[std::clamp<int>((victim + 15) - me, 0, MAX_EXP_DELTA_OF_LEV - 1)]
#define CALCULATE_VALUE_LVDELTA(me, victim, val) ((val * PERCENT_LVDELTA(me, victim)) / 100)
extern const int aiPercentByDeltaLev_euckr[MAX_EXP_DELTA_OF_LEV];
extern const int aiPercentByDeltaLevForBoss_euckr[MAX_EXP_DELTA_OF_LEV];
extern const int * aiPercentByDeltaLev;
extern const int * aiPercentByDeltaLevForBoss;
extern const int aiPercentByDeltaLev[MAX_EXP_DELTA_OF_LEV];
extern const int aiPercentByDeltaLevForBoss[MAX_EXP_DELTA_OF_LEV];
#define ARROUND_COORD_MAX_NUM 161
extern Coord aArroundCoords[ARROUND_COORD_MAX_NUM];
@ -144,7 +137,7 @@ extern const int aiSkillBookCountForLevelUp[10];
extern const int aiGrandMasterSkillBookCountForLevelUp[10];
extern const int aiGrandMasterSkillBookMinCount[10];
extern const int aiGrandMasterSkillBookMaxCount[10];
extern const int CHN_aiPartyBonusExpPercentByMemberCount[9];
extern const int aiPartyBonusExpPercentByMemberCount[9];
extern const int KOR_aiPartyBonusExpPercentByMemberCount[9];
extern const int KOR_aiUniqueItemPartyBonusExpPercentByMemberCount[9];
@ -152,8 +145,7 @@ typedef std::map<DWORD, TItemAttrTable> TItemAttrMap;
extern TItemAttrMap g_map_itemAttr;
extern TItemAttrMap g_map_itemRare;
extern const int * aiChainLightningCountBySkillLevel;
extern const int aiChainLightningCountBySkillLevel_euckr[SKILL_MAX_LEVEL + 1];
extern const int aiChainLightningCountBySkillLevel[SKILL_MAX_LEVEL + 1];
extern const char * c_apszEmpireNames[EMPIRE_MAX_NUM];
extern const char * c_apszPrivNames[MAX_PRIV_NUM];

View File

@ -1465,7 +1465,7 @@ void CGuild::UpdateSkill(BYTE skill_point, BYTE* skill_levels)
static DWORD __guild_levelup_exp(int level)
{
return guild_exp_table2[level];
return guild_exp_table[level];
}
void CGuild::GuildPointChange(BYTE type, int amount, bool save)

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
#ifndef __LOCALE_SERVCICE__
#define __LOCALE_SERVCICE__
#pragma once
bool LocaleService_Init(const std::string& c_rstServiceName);
extern std::string g_stLanguage;
bool LocaleService_Init(const std::string& language);
void LocaleService_LoadLocaleStringFile();
void LocaleService_LoadEmpireTextConvertTables();
void LocaleService_TransferDefaultSetting();
@ -9,66 +10,8 @@ const std::string& LocaleService_GetBasePath();
const std::string& LocaleService_GetMapPath();
const std::string& LocaleService_GetQuestPath();
enum eLocalization
struct LanguageSettings
{
LC_NOSET = 0,
LC_YMIR,
LC_JAPAN,
LC_ENGLISH,
LC_HONGKONG,
LC_NEWCIBN,
LC_GERMANY,
LC_KOREA,
LC_FRANCE,
LC_ITALY,
LC_SPAIN,
LC_UK,
LC_TURKEY,
LC_POLAND,
LC_PORTUGAL,
LC_CANADA,
LC_BRAZIL,
LC_GREEK,
LC_RUSSIA,
LC_DENMARK,
LC_BULGARIA,
LC_CROATIA,
LC_MEXICO,
LC_ARABIA,
LC_CZECH,
LC_ROMANIA,
LC_HUNGARY,
LC_NETHERLANDS,
LC_SINGAPORE,
LC_VIETNAM,
LC_THAILAND,
LC_USA,
LC_WE_KOREA, ///< World Edition version for korea
LC_TAIWAN,
LC_MAX_VALUE
std::string mysqlCharsetName;
bool useLocaleString = true;
};
eLocalization LC_GetLocalType();
bool LC_IsLocale( const eLocalization t );
bool LC_IsYMIR();
bool LC_IsJapan();
bool LC_IsEnglish();
bool LC_IsHongKong();
bool LC_IsNewCIBN();
bool LC_IsGermany();
bool LC_IsKorea();
bool LC_IsEurope();
bool LC_IsCanada();
bool LC_IsBrazil();
bool LC_IsSingapore();
bool LC_IsVietnam();
bool LC_IsThailand();
bool LC_IsWE_Korea();
bool LC_IsTaiwan();
bool LC_IsWorldEdition();
#endif

View File

@ -674,7 +674,7 @@ int start(int argc, char **argv)
}
else
{
SPDLOG_INFO("MasterAuth {}", (int) LC_GetLocalType());
SPDLOG_INFO("MasterAuth");
}
}
/* game server to spam server */

View File

@ -1684,7 +1684,7 @@ int CParty::ComputePartyBonusExpPercent()
iBonusPartyExpFromItem = 30;
}
return iBonusPartyExpFromItem + CHN_aiPartyBonusExpPercentByMemberCount[iMemberCount];
return iBonusPartyExpFromItem + aiPartyBonusExpPercentByMemberCount[iMemberCount];
// END_OF_UPGRADE_PARTY_BONUS
}

View File

@ -513,7 +513,7 @@ namespace quest
{
char translateFileName[256];
snprintf(translateFileName, sizeof(translateFileName), "%s/translate.lua", LocaleService_GetBasePath().c_str());
snprintf(translateFileName, sizeof(translateFileName), "%s/translate_%s.lua", LocaleService_GetBasePath().c_str(), g_stLanguage.c_str());
int translateLoadingResult = lua_dofile(L, translateFileName);
SPDLOG_DEBUG("LoadTranslate({}), returns {}", translateFileName, translateLoadingResult);