16 Commits

15 changed files with 881 additions and 95 deletions

View File

@ -1097,8 +1097,3 @@ bool CArena::RegisterObserverPtr(LPCHARACTER pChar)
return true;
}
bool CArenaManager::IsLimitedItem( int lMapIndex, DWORD dwVnum )
{
return false;
}

View File

@ -131,8 +131,6 @@ class CArenaManager : public singleton<CArenaManager>
bool IsArenaMap(DWORD dwMapIndex);
MEMBER_IDENTITY IsMember(DWORD dwMapIndex, DWORD PID);
bool IsLimitedItem( int lMapIndex, DWORD dwVnum );
};
#endif /*__CLASS_ARENA_MANAGER__*/

View File

@ -205,15 +205,15 @@ int CalcMagicDamage(LPCHARACTER pkAttacker, LPCHARACTER pkVictim)
float CalcAttackRating(LPCHARACTER pkAttacker, LPCHARACTER pkVictim, bool bIgnoreTargetRating)
{
int iARSrc = std::min(90, (attacker_dx * 4 + attacker_lv * 2) / 6);
int iERSrc = std::min(90, (victim_dx * 4 + victim_lv * 2) / 6);
int attacker_dx = pkAttacker->GetPolymorphPoint(POINT_DX);
int attacker_lv = pkAttacker->GetLevel();
int victim_dx = pkVictim->GetPolymorphPoint(POINT_DX);
int victim_lv = pkAttacker->GetLevel();
int iARSrc = std::min(90, (attacker_dx * 4 + attacker_lv * 2) / 6);
int iERSrc = std::min(90, (victim_dx * 4 + victim_lv * 2) / 6);
float fAR = ((float) iARSrc + 210.0f) / 300.0f; // fAR = 0.7 ~ 1.0
if (bIgnoreTargetRating)

View File

@ -862,39 +862,19 @@ void CHARACTER::EncodeInsertPacket(LPENTITY entity)
addPacket.dwLevel = GetLevel();
}
//TODO: what is this doing here?
if (false)
{
LPCHARACTER ch = (LPCHARACTER) entity;
strlcpy(addPacket.name, GetName(), sizeof(addPacket.name));
if (GetEmpire() == ch->GetEmpire() || ch->GetGMLevel() > GM_PLAYER || m_bCharType == CHAR_TYPE_NPC)
{
goto show_all_info;
}
else
{
memset(addPacket.name, 0, CHARACTER_NAME_MAX_LEN);
addPacket.dwGuildID = 0;
addPacket.sAlignment = 0;
}
if (GetGuild() != NULL)
{
addPacket.dwGuildID = GetGuild()->GetID();
}
else
{
show_all_info:
strlcpy(addPacket.name, GetName(), sizeof(addPacket.name));
if (GetGuild() != NULL)
{
addPacket.dwGuildID = GetGuild()->GetID();
}
else
{
addPacket.dwGuildID = 0;
}
addPacket.sAlignment = m_iAlignment / 10;
addPacket.dwGuildID = 0;
}
addPacket.sAlignment = m_iAlignment / 10;
d->Packet(&addPacket, sizeof(TPacketGCCharacterAdditionalInfo));
}

View File

@ -2040,16 +2040,7 @@ bool CHARACTER::Damage(LPCHARACTER pAttacker, int dam, EDamageType type) // retu
// 다른 제국 사람인 경우 데미지 10% 감소
if (iEmpire && iMapEmpire && iEmpire != iMapEmpire)
{
int percent = 10;
if (184 <= lMapIndex && lMapIndex <= 189)
{
percent = 9;
}
else
{
percent = 9;
}
const int percent = 9;
dam = dam * percent / 10;
}

View File

@ -1632,12 +1632,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
SPDLOG_TRACE("USE_ITEM {}, Inven {}, Cell {}, ItemType {}, SubType {}", item->GetName(), bDestInven, wDestCell, item->GetType(), item->GetSubType());
if ( CArenaManager::instance().IsLimitedItem( GetMapIndex(), item->GetVnum() ) == true )
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot use this item in a duel."));
return false;
}
// 아이템 최초 사용 이후부터는 사용하지 않아도 시간이 차감되는 방식 처리.
if (-1 != iLimitRealtimeStartFirstUseFlagIndex)
{
@ -2455,7 +2449,7 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
DWORD count;
int prob;
DWORD vnum;
} b1[MAX_BAG_INFO] =
} bi[MAX_BAG_INFO] =
{
{ 1000, 302, 1 },
{ 10, 150, 27002 },
@ -2485,8 +2479,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
{ 1, 1, 11882 },
};
LuckyBagInfo * bi = b1;
int pct = Random::get(1, 1000);
int i;
@ -5273,8 +5265,8 @@ bool CHARACTER::DropGold(int gold)
if (gold > 1000) // 천원 이상만 기록한다.
LogManager::instance().CharLog(this, gold, "DROP_GOLD", "");
item->StartDestroyEvent(60);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("The dropped item will vanish in %d minutes."), 1);
item->StartDestroyEvent(150);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("The dropped item will vanish in %d minutes."), 150/60);
}
Save();

View File

@ -378,12 +378,6 @@ bool CHARACTER::LearnGrandMasterSkill(DWORD dwSkillVnum)
}
// END_OF_ADD_GRANDMASTER_SKILL
static bool FN_should_check_exp(LPCHARACTER ch)
{
return true;
}
bool CHARACTER::LearnSkillByBook(DWORD dwSkillVnum, BYTE bProb)
{
const CSkillProto* pkSk = CSkillManager::instance().Get(dwSkillVnum);
@ -397,17 +391,12 @@ bool CHARACTER::LearnSkillByBook(DWORD dwSkillVnum, BYTE bProb)
return false;
}
DWORD need_exp = 0;
DWORD need_exp = 20000;
if (FN_should_check_exp(this))
if ( GetExp() < need_exp )
{
need_exp = 20000;
if ( GetExp() < need_exp )
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot read this due to your lack of experience."));
return false;
}
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot read this due to your lack of experience."));
return false;
}
// bType이 0이면 처음부터 책으로 수련 가능

View File

@ -387,6 +387,11 @@ int DetermineFish(LPCHARACTER ch)
int * p = std::lower_bound(g_prob_accumulate[prob_idx], g_prob_accumulate[prob_idx] + MAX_FISH, rv);
int fish_idx = p - g_prob_accumulate[prob_idx];
DWORD vnum = fish_info[fish_idx].vnum;
if (vnum == 50008 || vnum == 50009 || vnum == 80008)
return 0;
return (fish_idx);
}

View File

@ -430,6 +430,9 @@ void CInputLogin::CharacterCreate(LPDESC d, const char * data)
// 사용할 수 없는 이름이거나, 잘못된 평상복이면 생설 실패
if (!check_name(pinfo->name) || pinfo->shape > 1)
{
d->Packet(&packFailure, sizeof(packFailure));
return;
}
const TAccountTable & c_rAccountTable = d->GetAccountTable();
@ -442,7 +445,6 @@ void CInputLogin::CharacterCreate(LPDESC d, const char * data)
d->Packet(&pack, sizeof(pack));
return;
}
}
memset(&player_create_packet, 0, sizeof(TPlayerCreatePacket));
@ -453,8 +455,6 @@ void CInputLogin::CharacterCreate(LPDESC d, const char * data)
return;
}
const TAccountTable & c_rAccountTable = d->GetAccountTable();
trim_and_lower(c_rAccountTable.login, player_create_packet.login, sizeof(player_create_packet.login));
strlcpy(player_create_packet.passwd, c_rAccountTable.passwd, sizeof(player_create_packet.passwd));
@ -633,6 +633,10 @@ void CInputLogin::Entergame(LPDESC d, const char * data)
}
}
}
else
{
SPDLOG_WARN("VERSION : NO CHECK");
}
if (ch->IsGM() == true)
ch->ChatPacket(CHAT_TYPE_COMMAND, "ConsoleEnable");

View File

@ -6,6 +6,8 @@ typedef std::map< std::string, std::string > LocaleStringMapType;
LocaleStringMapType localeString;
int g_iUseLocale = 0;
void locale_add(const char **strings)
{
LocaleStringMapType::const_iterator iter = localeString.find( strings[0] );
@ -18,6 +20,11 @@ void locale_add(const char **strings)
const char * locale_find(const char *string)
{
if (0 == g_iUseLocale)
{
return (string);
}
LocaleStringMapType::const_iterator iter = localeString.find( string );
if( iter == localeString.end() )
@ -26,7 +33,7 @@ const char * locale_find(const char *string)
strlcpy(s_line + 5, string, sizeof(s_line) - 5);
SPDLOG_ERROR("LOCALE_ERROR: \"{}\";", string);
return string;
return s_line;
}
return iter->second.c_str();

View File

@ -6,6 +6,8 @@ extern "C"
void locale_init(const char *filename);
const char *locale_find(const char *string);
extern int g_iUseLocale;
#define LC_TEXT(str) locale_find(str)
};

View File

@ -390,16 +390,22 @@ void LocaleService_LoadEmpireTextConvertTables()
}
}
static void __LocaleService_Init_DEFAULT()
static void __LocaleService_Init_JAPAN()
{
g_stLocaleFilename = "";
g_stLocale = "sjis";
g_stServiceBasePath = "locale/japan";
g_stQuestDir = "locale/japan/quest";
g_stServiceMapPath = "locale/japan/map";
g_stServiceBasePath = "locale/" + g_stServiceName;
g_stServiceMapPath = g_stServiceBasePath + "/map";
g_stQuestDir = g_stServiceBasePath + "/quest";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/japan/quest/object");
g_stLocaleFilename = "locale/japan/sjis_string.txt";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert(g_stQuestDir + "/object");
g_iUseLocale = true;
check_name = check_name_sjis;
is_twobyte = is_twobyte_sjis;
exp_table = exp_table_euckr;
}
static void __LocaleService_Init_English()
@ -416,6 +422,554 @@ static void __LocaleService_Init_English()
check_name = check_name_alphabet;
}
static void __LocaleService_Init_HongKong()
{
g_stLocale = "big5";
g_stServiceBasePath = "locale/hongkong";
g_stQuestDir = "locale/hongkong/quest";
g_stServiceMapPath = "locale/hongkong/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/hongkong/quest/object");
g_stLocaleFilename = "locale/hongkong/big5_string.txt";
g_iUseLocale = true;
check_name = check_name_big5;
is_twobyte = is_twobyte_big5;
}
static void __LocaleService_Init_NewCIBN()
{
g_stLocale = "gb2312";
g_stServiceBasePath = "locale/newcibn";
g_stQuestDir = "locale/newcibn/quest";
g_stServiceMapPath = "locale/newcibn/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/newcibn/quest/object");
g_stLocaleFilename = "locale/newcibn/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_gb2312;
is_twobyte = is_twobyte_gb2312;
//exp_table = exp_table_newcibn;
}
static void __LocaleService_Init_Germany()
{
g_stLocale="latin1";
g_stServiceBasePath = "locale/germany";
g_stQuestDir = "locale/germany/quest";
g_stServiceMapPath = "locale/germany/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/germany/quest/object");
g_stLocaleFilename = "locale/germany/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Korea()
{
g_stLocale="euckr";
g_stServiceBasePath = "locale/korea";
g_stQuestDir = "locale/korea/quest";
g_stServiceMapPath = "locale/korea/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/korea/quest/object");
g_iUseLocale = true;
exp_table = exp_table_euckr;
}
static void __LocaleService_Init_France()
{
g_stLocale="latin1";
g_stServiceBasePath = "locale/france";
g_stQuestDir = "locale/france/quest";
g_stServiceMapPath = "locale/france/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/france/quest/object");
g_stLocaleFilename = "locale/france/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Italy()
{
g_stLocale="latin1";
g_stServiceBasePath = "locale/italy";
g_stQuestDir = "locale/italy/quest";
g_stServiceMapPath = "locale/italy/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/italy/quest/object");
g_stLocaleFilename = "locale/italy/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_spain()
{
g_stLocale="latin1";
g_stServiceBasePath = "locale/spain";
g_stQuestDir = "locale/spain/quest";
g_stServiceMapPath = "locale/spain/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/spain/quest/object");
g_stLocaleFilename = "locale/spain/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_greek()
{
g_stLocale="greek";
g_stServiceBasePath = "locale/greek";
g_stQuestDir = "locale/greek/quest";
g_stServiceMapPath = "locale/greek/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/greek/quest/object");
g_stLocaleFilename = "locale/greek/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_UK()
{
g_stLocale="latin1";
g_stServiceBasePath = "locale/uk";
g_stQuestDir = "locale/uk/quest";
g_stServiceMapPath = "locale/uk/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/uk/quest/object");
g_stLocaleFilename = "locale/uk/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Turkey()
{
g_stLocale="latin5";
g_stServiceBasePath = "locale/turkey";
g_stQuestDir = "locale/turkey/quest";
g_stServiceMapPath = "locale/turkey/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/turkey/quest/object");
g_stLocaleFilename = "locale/turkey/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Poland()
{
g_stLocale="latin2";
g_stServiceBasePath = "locale/poland";
g_stQuestDir = "locale/poland/quest";
g_stServiceMapPath = "locale/poland/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/poland/quest/object");
g_stLocaleFilename = "locale/poland/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Portugal()
{
g_stLocale="latin1";
g_stServiceBasePath = "locale/portugal";
g_stQuestDir = "locale/portugal/quest";
g_stServiceMapPath = "locale/portugal/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/portugal/quest/object");
g_stLocaleFilename = "locale/portugal/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Canada()
{
g_stLocale = "latin1";
g_stServiceBasePath = "locale/canada";
g_stQuestDir = "locale/canada/quest";
g_stServiceMapPath = "locale/canada/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/canada/quest/object");
g_stLocaleFilename = "locale/canada/locale_string.txt";
check_name = check_name_alphabet;
g_iUseLocale = true;
}
static void __LocaleService_Init_Brazil()
{
g_stLocale = "latin1";
g_stServiceBasePath = "locale/brazil";
g_stQuestDir = "locale/brazil/quest";
g_stServiceMapPath = "locale/brazil/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/brazil/quest/object");
g_stLocaleFilename = "locale/brazil/locale_string.txt";
check_name = check_name_alphabet;
g_iUseLocale = true;
}
static void __LocaleService_Init_YMIR()
{
g_stLocaleFilename = "";
g_stServiceBasePath = "locale/" + g_stServiceName;
g_stServiceMapPath = g_stServiceBasePath + "/map";
g_stQuestDir = g_stServiceBasePath + "/quest";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert(g_stQuestDir + "/object");
PK_PROTECT_LEVEL = 30;
exp_table = exp_table_euckr;
}
static void __LocaleService_Init_Russia()
{
g_stLocale="cp1251";
g_stServiceBasePath = "locale/russia";
g_stQuestDir = "locale/russia/quest";
g_stServiceMapPath = "locale/russia/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/russia/quest/object");
g_stLocaleFilename = "locale/russia/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Denmark()
{
g_stLocale="latin1";
g_stServiceBasePath = "locale/denmark";
g_stQuestDir = "locale/denmark/quest";
g_stServiceMapPath = "locale/denmark/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/denmark/quest/object");
g_stLocaleFilename = "locale/denmark/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Bulgaria()
{
g_stLocale="cp1251";
g_stServiceBasePath = "locale/bulgaria";
g_stQuestDir = "locale/bulgaria/quest";
g_stServiceMapPath = "locale/bulgaria/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/bulgaria/quest/object");
g_stLocaleFilename = "locale/bulgaria/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Croatia()
{
g_stLocale="cp1251";
g_stServiceBasePath = "locale/croatia";
g_stQuestDir = "locale/croatia/quest";
g_stServiceMapPath = "locale/croatia/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/croatia/quest/object");
g_stLocaleFilename = "locale/croatia/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Mexico()
{
g_stLocale="latin1";
g_stServiceBasePath = "locale/mexico";
g_stQuestDir = "locale/mexico/quest";
g_stServiceMapPath = "locale/mexico/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/mexico/quest/object");
g_stLocaleFilename = "locale/mexico/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Arabia()
{
g_stLocale="cp1256";
g_stServiceBasePath = "locale/arabia";
g_stQuestDir = "locale/arabia/quest";
g_stServiceMapPath = "locale/arabia/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/arabia/quest/object");
g_stLocaleFilename = "locale/arabia/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Czech()
{
g_stLocale="latin2";
g_stServiceBasePath = "locale/czech";
g_stQuestDir = "locale/czech/quest";
g_stServiceMapPath = "locale/czech/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/czech/quest/object");
g_stLocaleFilename = "locale/czech/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Hungary()
{
g_stLocale="latin2";
g_stServiceBasePath = "locale/hungary";
g_stQuestDir = "locale/hungary/quest";
g_stServiceMapPath = "locale/hungary/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/hungary/quest/object");
g_stLocaleFilename = "locale/hungary/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Romania()
{
g_stLocale="latin2";
g_stServiceBasePath = "locale/romania";
g_stQuestDir = "locale/romania/quest";
g_stServiceMapPath = "locale/romania/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/romania/quest/object");
g_stLocaleFilename = "locale/romania/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Netherlands()
{
g_stLocale="latin1";
g_stServiceBasePath = "locale/netherlands";
g_stQuestDir = "locale/netherlands/quest";
g_stServiceMapPath = "locale/netherlands/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/netherlands/quest/object");
g_stLocaleFilename = "locale/netherlands/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Singapore()
{
g_stLocale = "latin1";
g_stServiceBasePath = "locale/singapore";
g_stQuestDir = "locale/singapore/quest";
g_stServiceMapPath = "locale/singapore/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/singapore/quest/object");
g_stLocaleFilename = "locale/singapore/locale_string.txt";
check_name = check_name_alphabet;
g_iUseLocale = true;
//exp_table = exp_table_newcibn; 2013 09 11 CYH europe 과 동일하게 간다.
}
static void __LocaleService_Init_Vietnam()
{
g_stLocale = "latin1";
g_stServiceBasePath = "locale/vietnam";
g_stQuestDir = "locale/vietnam/quest";
g_stServiceMapPath = "locale/vietnam/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/vietnam/quest/object");
g_stLocaleFilename = "locale/vietnam/locale_string.txt";
check_name = check_name_alphabet;
g_iUseLocale = true;
exp_table = exp_table_newcibn;
}
static void __LocaleService_Init_Thailand()
{
g_stLocale = "latin1";
g_stServiceBasePath = "locale/thailand";
g_stQuestDir = "locale/thailand/quest";
g_stServiceMapPath = "locale/thailand/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/thailand/quest/object");
g_stLocaleFilename = "locale/thailand/locale_string.txt";
check_name = check_name_alphabet;
g_iUseLocale = true;
}
static void __LocaleService_Init_USA()
{
g_stLocale = "latin1";
g_stServiceBasePath = "locale/usa";
g_stQuestDir = "locale/usa/quest";
g_stServiceMapPath = "locale/usa/map";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert("locale/usa/quest/object");
g_stLocaleFilename = "locale/usa/locale_string.txt";
g_iUseLocale = true;
check_name = check_name_alphabet;
}
// World Edition version for korea
static void __LocaleService_Init_WE_Korea()
{
g_stLocale = "euckr";
// g_stLocaleFilename = "locale/we_korea/locale_string.txt";
g_stServiceBasePath = "locale/" + g_stServiceName;
g_stServiceMapPath = g_stServiceBasePath + "/map";
g_stQuestDir = g_stServiceBasePath + "/quest";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert(g_stQuestDir + "/object");
g_iUseLocale = true;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_Taiwan()
{
g_stLocale = "big5";
g_stServiceBasePath = "locale/" + g_stServiceName;
g_stServiceMapPath = g_stServiceBasePath + "/map";
g_stQuestDir = g_stServiceBasePath + "/quest";
g_setQuestObjectDir.clear();
g_setQuestObjectDir.insert(g_stQuestDir + "/object");
g_stLocaleFilename = "locale/taiwan/locale_string.txt";
check_name = check_name_big5;
is_twobyte = is_twobyte_big5;
g_iUseLocale = true;
PK_PROTECT_LEVEL = 15;
}
static void __LocaleService_Init_DEFAULT()
{
__LocaleService_Init_English();
}
static void __CheckPlayerSlot(const std::string& service_name)
{
if (PLAYER_PER_ACCOUNT != 4)
@ -432,8 +986,145 @@ bool LocaleService_Init(const std::string& c_rstServiceName)
SPDLOG_ERROR("ALREADY exist service");
return false;
}
g_stServiceName = c_rstServiceName;
if ( "japan" == g_stServiceName)
{
__LocaleService_Init_JAPAN();
}
else if ( "english" == g_stServiceName)
{
__LocaleService_Init_English();
}
else if ( "hongkong" == g_stServiceName)
{
__LocaleService_Init_HongKong();
}
else if ( "newcibn" == g_stServiceName)
{
__LocaleService_Init_NewCIBN();
}
else if ( "germany" == g_stServiceName)
{
__LocaleService_Init_Germany();
}
else if ( "korea" == g_stServiceName)
{
__LocaleService_Init_Korea();
}
else if ( "france" == g_stServiceName)
{
__LocaleService_Init_France();
}
else if ( "italy" == g_stServiceName)
{
__LocaleService_Init_Italy();
}
else if ( "spain" == g_stServiceName)
{
__LocaleService_Init_spain();
}
else if ( "greek" == g_stServiceName)
{
__LocaleService_Init_greek();
}
else if ( "uk" == g_stServiceName)
{
__LocaleService_Init_UK();
}
else if ( "turkey" == g_stServiceName)
{
__LocaleService_Init_Turkey();
}
else if ( "poland" == g_stServiceName)
{
__LocaleService_Init_Poland();
}
else if ( "portugal" == g_stServiceName)
{
__LocaleService_Init_Portugal();
}
else if ( "canada" == g_stServiceName)
{
__LocaleService_Init_Canada();
}
else if ( "brazil" == g_stServiceName)
{
__LocaleService_Init_Brazil();
}
else if ( "ymir" == g_stServiceName)
{
__LocaleService_Init_YMIR();
}
else if ( "russia" == g_stServiceName)
{
__LocaleService_Init_Russia();
}
else if ( "denmark" == g_stServiceName)
{
__LocaleService_Init_Denmark();
}
else if ( "bulgaria" == g_stServiceName)
{
__LocaleService_Init_Bulgaria();
}
else if ( "croatia" == g_stServiceName)
{
__LocaleService_Init_Croatia();
}
else if ( "mexico" == g_stServiceName)
{
__LocaleService_Init_Mexico();
}
else if ( "arabia" == g_stServiceName)
{
__LocaleService_Init_Arabia();
}
else if ( "czech" == g_stServiceName)
{
__LocaleService_Init_Czech();
}
else if ( "romania" == g_stServiceName)
{
__LocaleService_Init_Romania();
}
else if ( "hungary" == g_stServiceName)
{
__LocaleService_Init_Hungary();
}
else if ( "netherlands" == g_stServiceName)
{
__LocaleService_Init_Netherlands();
}
else if ( "singapore" == g_stServiceName)
{
__LocaleService_Init_Singapore();
}
else if ( "vietnam" == g_stServiceName)
{
__LocaleService_Init_Vietnam();
}
else if ( "thailand" == g_stServiceName)
{
__LocaleService_Init_Thailand();
}
else if ("usa" == g_stServiceName)
{
__LocaleService_Init_USA();
}
else if ("we_korea" == g_stServiceName)
{
__LocaleService_Init_WE_Korea(); // ver.World Edition for korea
}
else if ("taiwan" == g_stServiceName)
{
__LocaleService_Init_Taiwan();
}
else
{
__LocaleService_Init_DEFAULT();
}
SPDLOG_INFO("Setting Locale \"{}\" (Path: {})", g_stServiceName.c_str(), g_stServiceBasePath.c_str());
@ -487,8 +1178,76 @@ const std::string& LocaleService_GetQuestPath()
bool LC_InitLocalization( const std::string& szLocal )
{
g_stLocal = szLocal;
g_eLocalType = LC_ENGLISH;
if ( !g_stLocal.compare("ymir") )
g_eLocalType = LC_YMIR;
else if ( !g_stLocal.compare("japan") )
g_eLocalType = LC_JAPAN;
else if ( !g_stLocal.compare("english") )
g_eLocalType = LC_ENGLISH;
else if ( !g_stLocal.compare("hongkong") )
g_eLocalType = LC_HONGKONG;
else if (!g_stLocal.compare("newcibn") )
g_eLocalType = LC_NEWCIBN;
else if ( !g_stLocal.compare("germany") )
g_eLocalType = LC_GERMANY;
else if ( !g_stLocal.compare("korea") )
g_eLocalType = LC_KOREA;
else if ( !g_stLocal.compare("france") )
g_eLocalType = LC_FRANCE;
else if ( !g_stLocal.compare("italy") )
g_eLocalType = LC_ITALY;
else if ( !g_stLocal.compare("spain") )
g_eLocalType = LC_SPAIN;
else if ( !g_stLocal.compare("greek") )
g_eLocalType = LC_GREEK;
else if ( !g_stLocal.compare("uk") )
g_eLocalType = LC_UK;
else if ( !g_stLocal.compare("turkey") )
g_eLocalType = LC_TURKEY;
else if ( !g_stLocal.compare("poland") )
g_eLocalType = LC_POLAND;
else if ( !g_stLocal.compare("portugal") )
g_eLocalType = LC_PORTUGAL;
else if ( !g_stLocal.compare("canada") )
g_eLocalType = LC_CANADA;
else if ( !g_stLocal.compare("brazil") )
g_eLocalType = LC_BRAZIL;
else if ( !g_stLocal.compare("russia") )
g_eLocalType = LC_RUSSIA;
else if ( !g_stLocal.compare("denmark") )
g_eLocalType = LC_DENMARK;
else if ( !g_stLocal.compare("bulgaria") )
g_eLocalType = LC_BULGARIA;
else if ( !g_stLocal.compare("croatia") )
g_eLocalType = LC_CROATIA;
else if ( !g_stLocal.compare("mexico") )
g_eLocalType = LC_MEXICO;
else if ( !g_stLocal.compare("arabia") )
g_eLocalType = LC_ARABIA;
else if ( !g_stLocal.compare("czech") )
g_eLocalType = LC_CZECH;
else if ( !g_stLocal.compare("romania") )
g_eLocalType = LC_ROMANIA;
else if ( !g_stLocal.compare("hungary") )
g_eLocalType = LC_HUNGARY;
else if ( !g_stLocal.compare("netherlands") )
g_eLocalType = LC_NETHERLANDS;
else if ( !g_stLocal.compare("singapore") )
g_eLocalType = LC_SINGAPORE;
else if ( !g_stLocal.compare("vietnam") )
g_eLocalType = LC_VIETNAM;
else if ( !g_stLocal.compare("thailand") )
g_eLocalType = LC_THAILAND;
else if ( !g_stLocal.compare("usa") )
g_eLocalType = LC_USA;
else if ( !g_stLocal.compare("we_korea") ) // ver.WorldEdition for korea
g_eLocalType = LC_WE_KOREA;
else if ( !g_stLocal.compare("taiwan") )
g_eLocalType = LC_TAIWAN;
else
return false;
return true;
}
@ -496,9 +1255,3 @@ eLocalization LC_GetLocalType()
{
return g_eLocalType;
}
bool LC_IsLocale( const eLocalization t )
{
return LC_GetLocalType() == t ? true : false;
}

View File

@ -676,6 +676,19 @@ int start(int argc, char **argv)
{
SPDLOG_INFO("MasterAuth {}", (int) LC_GetLocalType());
}
}
/* game server to spam server */
else
{
extern unsigned int g_uiSpamBlockDuration;
extern unsigned int g_uiSpamBlockScore;
extern unsigned int g_uiSpamReloadCycle;
SPDLOG_INFO("SPAM_CONFIG: duration {} score {} reload cycle {}",
g_uiSpamBlockDuration, g_uiSpamBlockScore, g_uiSpamReloadCycle);
extern void LoadSpamDB();
LoadSpamDB();
}
signal_timer_enable(30);

View File

@ -1356,7 +1356,7 @@ void CParty::Update()
bool bLongTimeExpBonusChanged = false;
// 파티 결성 후 충분한 시간이 지나면 경험치 보너스를 받는다.
if (!m_iLongTimeExpBonus && (get_dword_time() - m_dwPartyStartTime > PARTY_ENOUGH_MINUTE_FOR_EXP_BONUS * 60 * 1000 / 1))
if (!m_iLongTimeExpBonus && (get_dword_time() - m_dwPartyStartTime > PARTY_ENOUGH_MINUTE_FOR_EXP_BONUS * 60 * 1000))
{
bLongTimeExpBonusChanged = true;
m_iLongTimeExpBonus = 5;

View File

@ -2063,7 +2063,64 @@ teleport_area:
// 3: 이미 같은 이름이 사용중
// 4: 성공
// 5: 해당 기능 지원하지 않음
lua_pushnumber(L, 5);
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
if ( ch->GetNewName().size() != 0 )
{
lua_pushnumber(L, 0);
return 1;
}
if ( lua_isstring(L, 1) != true )
{
lua_pushnumber(L, 1);
return 1;
}
const char * szName = lua_tostring(L, 1);
if ( check_name(szName) == false )
{
lua_pushnumber(L, 2);
return 1;
}
char szQuery[1024];
snprintf(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM player%s WHERE name='%s'", get_table_postfix(), szName);
std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
if ( pmsg->Get()->uiNumRows > 0 )
{
MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
int count = 0;
str_to_number(count, row[0]);
// 이미 해당 이름을 가진 캐릭터가 있음
if ( count != 0 )
{
lua_pushnumber(L, 3);
return 1;
}
}
DWORD pid = ch->GetPlayerID();
db_clientdesc->DBPacketHeader(HEADER_GD_FLUSH_CACHE, 0, sizeof(DWORD));
db_clientdesc->Packet(&pid, sizeof(DWORD));
/* delete messenger list */
MessengerManager::instance().RemoveAllList(ch->GetName());
/* change_name_log */
LogManager::instance().ChangeNameLog(pid, ch->GetName(), szName, ch->GetDesc()->GetHostName());
snprintf(szQuery, sizeof(szQuery), "UPDATE player%s SET name='%s' WHERE id=%u", get_table_postfix(), szName, pid);
SQLMsg * msg = DBManager::instance().DirectQuery(szQuery);
M2_DELETE(msg);
ch->SetNewName(szName);
lua_pushnumber(L, 4);
return 1;
}