forked from metin2/server
1
0
Fork 0

remove unnecessary leftover closures

This commit is contained in:
Tr0n 2024-04-07 22:11:12 +02:00
parent dbcabd7fa9
commit 0a907f41d2
No known key found for this signature in database
8 changed files with 95 additions and 120 deletions

View File

@ -215,9 +215,7 @@ EVENTFUNC(oxevent_timer)
SendNoticeMap(LC_TEXT("No (X)"), OXEVENT_MAP_INDEX, true);
}
{
SendNoticeMap(LC_TEXT("In 5 sec. everyone who gave an incorrect answer will be removed."), OXEVENT_MAP_INDEX, true);
}
SendNoticeMap(LC_TEXT("In 5 sec. everyone who gave an incorrect answer will be removed."), OXEVENT_MAP_INDEX, true);
flag++;
return PASSES_PER_SEC(5);

View File

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

View File

@ -2112,10 +2112,8 @@ void CHARACTER::ComputeBattlePoints()
iArmor += GetPoint(POINT_PARTY_DEFENDER_BONUS);
// INTERNATIONAL_VERSION
{
PointChange(POINT_DEF_GRADE, iDef + iArmor);
PointChange(POINT_CLIENT_DEF_GRADE, (iShowDef + iArmor) - GetPoint(POINT_DEF_GRADE));
}
PointChange(POINT_DEF_GRADE, iDef + iArmor);
PointChange(POINT_CLIENT_DEF_GRADE, (iShowDef + iArmor) - GetPoint(POINT_DEF_GRADE));
// END_OF_INTERNATIONAL_VERSION
PointChange(POINT_MAGIC_ATT_GRADE, GetLevel() * 2 + GetPoint(POINT_IQ) * 2 + GetPoint(POINT_MAGIC_ATT_GRADE_BONUS));
@ -5124,11 +5122,9 @@ bool CHARACTER::WarpSet(int x, int y, int lPrivateMapIndex)
GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
{
char buf[256];
snprintf(buf, sizeof(buf), "%s MapIdx %d DestMapIdx%d DestX%d DestY%d Empire%d", GetName(), GetMapIndex(), lPrivateMapIndex, x, y, GetEmpire());
LogManager::instance().CharLog(this, 0, "WARP", buf);
}
char buf[256];
snprintf(buf, sizeof(buf), "%s MapIdx %d DestMapIdx%d DestX%d DestY%d Empire%d", GetName(), GetMapIndex(), lPrivateMapIndex, x, y, GetEmpire());
LogManager::instance().CharLog(this, 0, "WARP", buf);
return true;
}

View File

@ -473,70 +473,68 @@ bool CHARACTER::LearnSkillByBook(DWORD dwSkillVnum, BYTE bProb)
SPDLOG_DEBUG("LearnSkillByBook {} table idx {} value {}", GetName(), idx, aiSkillBookCountForLevelUp[idx]);
int need_bookcount = GetSkillLevel(dwSkillVnum) - 20;
PointChange(POINT_EXP, -need_exp);
quest::CQuestManager& q = quest::CQuestManager::instance();
quest::PC* pPC = q.GetPC(GetPlayerID());
if (pPC)
{
int need_bookcount = GetSkillLevel(dwSkillVnum) - 20;
char flag[128+1];
memset(flag, 0, sizeof(flag));
snprintf(flag, sizeof(flag), "traning_master_skill.%u.read_count", dwSkillVnum);
PointChange(POINT_EXP, -need_exp);
int read_count = pPC->GetFlag(flag);
int percent = 65;
quest::CQuestManager& q = quest::CQuestManager::instance();
quest::PC* pPC = q.GetPC(GetPlayerID());
if (pPC)
if (FindAffect(AFFECT_SKILL_BOOK_BONUS))
{
char flag[128+1];
memset(flag, 0, sizeof(flag));
snprintf(flag, sizeof(flag), "traning_master_skill.%u.read_count", dwSkillVnum);
percent = 0;
RemoveAffect(AFFECT_SKILL_BOOK_BONUS);
}
int read_count = pPC->GetFlag(flag);
int percent = 65;
if (FindAffect(AFFECT_SKILL_BOOK_BONUS))
if (Random::get(1, 100) > percent)
{
// 책읽기에 성공
if (read_count >= need_bookcount)
{
percent = 0;
RemoveAffect(AFFECT_SKILL_BOOK_BONUS);
SkillLevelUp(dwSkillVnum, SKILL_UP_BY_BOOK);
pPC->SetFlag(flag, 0);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You have successfully finished your training with the Book."));
LogManager::instance().CharLog(this, dwSkillVnum, "READ_SUCCESS", "");
return true;
}
if (Random::get(1, 100) > percent)
else
{
// 책읽기에 성공
if (read_count >= need_bookcount)
pPC->SetFlag(flag, read_count + 1);
switch (Random::get(1, 3))
{
SkillLevelUp(dwSkillVnum, SKILL_UP_BY_BOOK);
pPC->SetFlag(flag, 0);
case 1:
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("I'm making progress, but I still haven't understood everything."));
break;
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You have successfully finished your training with the Book."));
LogManager::instance().CharLog(this, dwSkillVnum, "READ_SUCCESS", "");
return true;
case 2:
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("These instructions are difficult to understand. I have to carry on studying."));
break;
case 3:
default:
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("I understand this chapter. But I've got to carry on working hard."));
break;
}
else
{
pPC->SetFlag(flag, read_count + 1);
switch (Random::get(1, 3))
{
case 1:
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("I'm making progress, but I still haven't understood everything."));
break;
case 2:
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("These instructions are difficult to understand. I have to carry on studying."));
break;
case 3:
default:
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("I understand this chapter. But I've got to carry on working hard."));
break;
}
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You have to read %d more skill books to improve this skill."), need_bookcount - read_count);
return true;
}
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You have to read %d more skill books to improve this skill."), need_bookcount - read_count);
return true;
}
}
else
{
// 사용자의 퀘스트 정보 로드 실패
}
}
else
{
// 사용자의 퀘스트 정보 로드 실패
}
}

View File

@ -271,22 +271,20 @@ EVENTFUNC(timed_event)
{
ch->m_pkTimedEvent = NULL;
switch (info->subcmd)
{
switch (info->subcmd)
{
case SCMD_LOGOUT:
case SCMD_QUIT:
case SCMD_PHASE_SELECT:
{
TPacketNeedLoginLogInfo acc_info;
acc_info.dwPlayerID = ch->GetDesc()->GetAccountTable().id;
case SCMD_LOGOUT:
case SCMD_QUIT:
case SCMD_PHASE_SELECT:
{
TPacketNeedLoginLogInfo acc_info;
acc_info.dwPlayerID = ch->GetDesc()->GetAccountTable().id;
db_clientdesc->DBPacket( HEADER_GD_VALID_LOGOUT, 0, &acc_info, sizeof(acc_info) );
db_clientdesc->DBPacket( HEADER_GD_VALID_LOGOUT, 0, &acc_info, sizeof(acc_info) );
LogManager::instance().DetailLoginLog( false, ch );
}
break;
}
LogManager::instance().DetailLoginLog( false, ch );
}
break;
}
switch (info->subcmd)
@ -2233,17 +2231,15 @@ ACMD(do_cube)
ACMD(do_in_game_mall)
{
{
char country_code[3];
country_code[0] = 'd'; country_code[1] = 'e'; country_code[2] = '\0';
char country_code[3];
country_code[0] = 'd'; country_code[1] = 'e'; country_code[2] = '\0';
char buf[512+1];
char buf[512+1];
snprintf(buf, sizeof(buf), "mall http://%s/ishop?pid=%u&c=%s&sid=%d",
g_strWebMallURL.c_str(), ch->GetPlayerID(), country_code, g_server_id);
snprintf(buf, sizeof(buf), "mall http://%s/ishop?pid=%u&c=%s&sid=%d",
g_strWebMallURL.c_str(), ch->GetPlayerID(), country_code, g_server_id);
ch->ChatPacket(CHAT_TYPE_COMMAND, buf);
}
ch->ChatPacket(CHAT_TYPE_COMMAND, buf);
}
// 주사위

View File

@ -355,26 +355,24 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
char szCreateDate[256] = "00000000";
{
str_to_number(aiPremiumTimes[PREMIUM_EXP], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_ITEM], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_SAFEBOX], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_AUTOLOOT], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_FISH_MIND], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_MARRIAGE_FAST], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_GOLD], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_EXP], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_ITEM], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_SAFEBOX], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_AUTOLOOT], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_FISH_MIND], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_MARRIAGE_FAST], row[col++]);
str_to_number(aiPremiumTimes[PREMIUM_GOLD], row[col++]);
int retValue = 0;
str_to_number(retValue, row[col]);
int retValue = 0;
str_to_number(retValue, row[col]);
time_t create_time = retValue;
struct tm * tm1;
tm1 = localtime(&create_time);
strftime(szCreateDate, 255, "%Y%m%d", tm1);
time_t create_time = retValue;
struct tm * tm1;
tm1 = localtime(&create_time);
strftime(szCreateDate, 255, "%Y%m%d", tm1);
SPDLOG_DEBUG("Create_Time {} {}", retValue, szCreateDate);
SPDLOG_DEBUG("Block Time {} ", strncmp(szCreateDate, g_stBlockDate.c_str(), 8));
}
SPDLOG_DEBUG("Create_Time {} {}", retValue, szCreateDate);
SPDLOG_DEBUG("Block Time {} ", strncmp(szCreateDate, g_stBlockDate.c_str(), 8));
int nPasswordDiff = strcmp(szEncrytPassword, szPassword);

View File

@ -1085,10 +1085,8 @@ void CItem::SetOwnership(LPCHARACTER ch, int iSec)
if (m_pkOwnershipEvent)
return;
{
if (iSec <= 10)
iSec = 30;
}
if (iSec <= 10)
iSec = 30;
m_dwOwnershipPID = ch->GetPlayerID();

View File

@ -228,11 +228,7 @@ CCI * P2P_MANAGER::FindByPID(DWORD pid)
CCI * P2P_MANAGER::Find(const char * c_pszName)
{
TCCIMap::const_iterator it;
{
it = m_map_pkCCI.find(c_pszName);
}
TCCIMap::const_iterator it = m_map_pkCCI.find(c_pszName);
if (it == m_map_pkCCI.end())
return NULL;