forked from metin2/server
1
0
Fork 0

Remove hackshield and unused function, game now compiles and runs

This commit is contained in:
Exynox 2022-03-06 00:01:03 +02:00
parent 90ef09c331
commit b99293c9d7
103 changed files with 217 additions and 5364 deletions

View File

@ -1,108 +0,0 @@
# Module for locating the Crypto++ encryption library.
#
# Customizable variables:
# CRYPTOPP_ROOT_DIR
# This variable points to the CryptoPP root directory. On Windows the
# library location typically will have to be provided explicitly using the
# -D command-line option. The directory should include the include/cryptopp,
# lib and/or bin sub-directories.
#
# Read-only variables:
# CRYPTOPP_FOUND
# Indicates whether the library has been found.
#
# CRYPTOPP_INCLUDE_DIRS
# Points to the CryptoPP include directory.
#
# CRYPTOPP_LIBRARIES
# Points to the CryptoPP libraries that should be passed to
# target_link_libararies.
#
#
# Copyright (c) 2012 Sergiu Dotenco
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
INCLUDE (FindPackageHandleStandardArgs)
FIND_PATH (CRYPTOPP_ROOT_DIR
NAMES cryptopp/cryptlib.h include/cryptopp/cryptlib.h
PATHS ENV CRYPTOPPROOT
DOC "CryptoPP root directory")
# Re-use the previous path:
FIND_PATH (CRYPTOPP_INCLUDE_DIR
NAMES cryptopp/cryptlib.h
HINTS ${CRYPTOPP_ROOT_DIR}
PATH_SUFFIXES include
DOC "CryptoPP include directory")
FIND_LIBRARY (CRYPTOPP_LIBRARY_DEBUG
NAMES cryptlibd cryptoppd
HINTS ${CRYPTOPP_ROOT_DIR}
PATH_SUFFIXES lib
DOC "CryptoPP debug library")
FIND_LIBRARY (CRYPTOPP_LIBRARY_RELEASE
NAMES cryptlib cryptopp
HINTS ${CRYPTOPP_ROOT_DIR}
PATH_SUFFIXES lib
DOC "CryptoPP release library")
IF (CRYPTOPP_LIBRARY_DEBUG AND CRYPTOPP_LIBRARY_RELEASE)
SET (CRYPTOPP_LIBRARY
optimized ${CRYPTOPP_LIBRARY_RELEASE}
debug ${CRYPTOPP_LIBRARY_DEBUG} CACHE DOC "CryptoPP library")
ELSEIF (CRYPTOPP_LIBRARY_RELEASE)
SET (CRYPTOPP_LIBRARY ${CRYPTOPP_LIBRARY_RELEASE} CACHE DOC
"CryptoPP library")
ENDIF (CRYPTOPP_LIBRARY_DEBUG AND CRYPTOPP_LIBRARY_RELEASE)
IF (CRYPTOPP_INCLUDE_DIR)
SET (_CRYPTOPP_VERSION_HEADER ${CRYPTOPP_INCLUDE_DIR}/cryptopp/config.h)
IF (EXISTS ${_CRYPTOPP_VERSION_HEADER})
FILE (STRINGS ${_CRYPTOPP_VERSION_HEADER} _CRYPTOPP_VERSION_TMP REGEX
"^#define CRYPTOPP_VERSION[ \t]+[0-9]+$")
STRING (REGEX REPLACE
"^#define CRYPTOPP_VERSION[ \t]+([0-9]+)" "\\1" _CRYPTOPP_VERSION_TMP
${_CRYPTOPP_VERSION_TMP})
STRING (REGEX REPLACE "([0-9]+)[0-9][0-9]" "\\1" CRYPTOPP_VERSION_MAJOR
${_CRYPTOPP_VERSION_TMP})
STRING (REGEX REPLACE "[0-9]([0-9])[0-9]" "\\1" CRYPTOPP_VERSION_MINOR
${_CRYPTOPP_VERSION_TMP})
STRING (REGEX REPLACE "[0-9][0-9]([0-9])" "\\1" CRYPTOPP_VERSION_PATCH
${_CRYPTOPP_VERSION_TMP})
SET (CRYPTOPP_VERSION_COUNT 3)
SET (CRYPTOPP_VERSION
${CRYPTOPP_VERSION_MAJOR}.${CRYPTOPP_VERSION_MINOR}.${CRYPTOPP_VERSION_PATCH})
ENDIF (EXISTS ${_CRYPTOPP_VERSION_HEADER})
ENDIF (CRYPTOPP_INCLUDE_DIR)
SET (CRYPTOPP_INCLUDE_DIRS ${CRYPTOPP_INCLUDE_DIR})
SET (CRYPTOPP_LIBRARIES ${CRYPTOPP_LIBRARY})
MARK_AS_ADVANCED (CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY CRYPTOPP_LIBRARY_DEBUG
CRYPTOPP_LIBRARY_RELEASE)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (CryptoPP REQUIRED_VARS CRYPTOPP_ROOT_DIR
CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY VERSION_VAR CRYPTOPP_VERSION)

View File

@ -3,7 +3,7 @@
#ifndef __INC_AUCTION_MANAGER_H__ #ifndef __INC_AUCTION_MANAGER_H__
#define __INC_AUCTION_MANAGER_H__ #define __INC_AUCTION_MANAGER_H__
#include <boost/unordered_map.hpp> #include <unordered_map>
#include "Cache.h" #include "Cache.h"
#include <common/auction_table.h> #include <common/auction_table.h>
@ -98,7 +98,7 @@ public:
return true; return true;
} }
private: private:
typedef boost::unordered_map <Key, ItemInfoCache *> TItemInfoCacheMap; typedef std::unordered_map <Key, ItemInfoCache *> TItemInfoCacheMap;
TItemInfoCacheMap item_cache_map; TItemInfoCacheMap item_cache_map;
}; };
@ -169,7 +169,7 @@ public:
} }
private: private:
typedef boost::unordered_map <Key, ItemInfoCache *> TItemInfoCacheMap; typedef std::unordered_map <Key, ItemInfoCache *> TItemInfoCacheMap;
TItemInfoCacheMap item_cache_map; TItemInfoCacheMap item_cache_map;
}; };
@ -239,7 +239,7 @@ public:
return true; return true;
} }
private: private:
typedef boost::unordered_map <Key, ItemInfoCache *> TItemInfoCacheMap; typedef std::unordered_map <Key, ItemInfoCache *> TItemInfoCacheMap;
TItemInfoCacheMap item_cache_map; TItemInfoCacheMap item_cache_map;
}; };
@ -260,7 +260,7 @@ public:
private: private:
typedef std::map <DWORD, int> TItemMap; typedef std::map <DWORD, int> TItemMap;
typedef boost::unordered_map <DWORD, TItemMap*> TMyBidBoard; typedef std::unordered_map <DWORD, TItemMap*> TMyBidBoard;
TMyBidBoard pc_map; TMyBidBoard pc_map;
}; };
@ -268,7 +268,7 @@ class AuctionManager : public singleton <AuctionManager>
{ {
private: private:
// auction에 등록된 아이템들. // auction에 등록된 아이템들.
typedef boost::unordered_map<DWORD, CItemCache *> TItemCacheMap; typedef std::unordered_map<DWORD, CItemCache *> TItemCacheMap;
TItemCacheMap auction_item_cache_map; TItemCacheMap auction_item_cache_map;
// auction에 등록된 정보 중 가격, 등등 아이템 테이블에 포함되지 않는 정보들을 관리하는 것들 // auction에 등록된 정보 중 가격, 등등 아이템 테이블에 포함되지 않는 정보들을 관리하는 것들

View File

@ -780,7 +780,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg)
pItemAward->dwVnum, pItemAward->dwCount, pItemAward->dwSocket0, pItemAward->dwSocket1, dwSocket2); pItemAward->dwVnum, pItemAward->dwCount, pItemAward->dwSocket0, pItemAward->dwSocket1, dwSocket2);
} }
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
SQLResult * pRes = pmsg->Get(); SQLResult * pRes = pmsg->Get();
sys_log(0, "SAFEBOX Query : [%s]", szQuery); sys_log(0, "SAFEBOX Query : [%s]", szQuery);
@ -1001,7 +1001,7 @@ void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpire
snprintf(szQuery, sizeof(szQuery), snprintf(szQuery, sizeof(szQuery),
"SELECT pid1, pid2, pid3, pid4 FROM player_index%s WHERE id=%u", GetTablePostfix(), p->dwAccountID); "SELECT pid1, pid2, pid3, pid4 FROM player_index%s WHERE id=%u", GetTablePostfix(), p->dwAccountID);
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
SQLResult * pRes = pmsg->Get(); SQLResult * pRes = pmsg->Get();
@ -1046,7 +1046,7 @@ void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpire
g_start_position[p->bEmpire][1], g_start_position[p->bEmpire][1],
pids[i]); pids[i]);
std::auto_ptr<SQLMsg> pmsg2(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg2(CDBManager::instance().DirectQuery(szQuery));
} }
} }
} }
@ -1985,7 +1985,7 @@ void CClientManager::CreateObject(TPacketGDCreateObject * p)
"INSERT INTO object%s (land_id, vnum, map_index, x, y, x_rot, y_rot, z_rot) VALUES(%u, %u, %d, %d, %d, %f, %f, %f)", "INSERT INTO object%s (land_id, vnum, map_index, x, y, x_rot, y_rot, z_rot) VALUES(%u, %u, %d, %d, %d, %f, %f, %f)",
GetTablePostfix(), p->dwLandID, p->dwVnum, p->lMapIndex, p->x, p->y, p->xRot, p->yRot, p->zRot); GetTablePostfix(), p->dwLandID, p->dwVnum, p->lMapIndex, p->x, p->y, p->xRot, p->yRot, p->zRot);
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
if (pmsg->Get()->uiInsertID == 0) if (pmsg->Get()->uiInsertID == 0)
{ {
@ -2019,7 +2019,7 @@ void CClientManager::DeleteObject(DWORD dwID)
snprintf(szQuery, sizeof(szQuery), "DELETE FROM object%s WHERE id=%u", GetTablePostfix(), dwID); snprintf(szQuery, sizeof(szQuery), "DELETE FROM object%s WHERE id=%u", GetTablePostfix(), dwID);
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1)
{ {
@ -2095,7 +2095,7 @@ void CClientManager::BlockChat(TPacketBlockChat* p)
snprintf(szQuery, sizeof(szQuery), "SELECT id FROM player%s WHERE name = '%s' collate sjis_japanese_ci", GetTablePostfix(), p->szName); snprintf(szQuery, sizeof(szQuery), "SELECT id FROM player%s WHERE name = '%s' collate sjis_japanese_ci", GetTablePostfix(), p->szName);
else else
snprintf(szQuery, sizeof(szQuery), "SELECT id FROM player%s WHERE name = '%s'", GetTablePostfix(), p->szName); snprintf(szQuery, sizeof(szQuery), "SELECT id FROM player%s WHERE name = '%s'", GetTablePostfix(), p->szName);
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
SQLResult * pRes = pmsg->Get(); SQLResult * pRes = pmsg->Get();
if (pRes->uiNumRows) if (pRes->uiNumRows)

View File

@ -2,8 +2,8 @@
#ifndef __INC_CLIENTMANAGER_H__ #ifndef __INC_CLIENTMANAGER_H__
#define __INC_CLIENTMANAGER_H__ #define __INC_CLIENTMANAGER_H__
#include <boost/unordered_map.hpp> #include <unordered_map>
#include <boost/unordered_set.hpp> #include <unordered_set>
#include <common/stl.h> #include <common/stl.h>
#include <common/building.h> #include <common/building.h>
@ -32,12 +32,12 @@ class CClientManager : public CNetBase, public singleton<CClientManager>
{ {
public: public:
typedef std::list<CPeer *> TPeerList; typedef std::list<CPeer *> TPeerList;
typedef boost::unordered_map<DWORD, CPlayerTableCache *> TPlayerTableCacheMap; typedef std::unordered_map<DWORD, CPlayerTableCache *> TPlayerTableCacheMap;
typedef boost::unordered_map<DWORD, CItemCache *> TItemCacheMap; typedef std::unordered_map<DWORD, CItemCache *> TItemCacheMap;
typedef boost::unordered_set<CItemCache *, boost::hash<CItemCache*> > TItemCacheSet; typedef std::unordered_set<CItemCache *, std::hash<CItemCache*> > TItemCacheSet;
typedef boost::unordered_map<DWORD, TItemCacheSet *> TItemCacheSetPtrMap; typedef std::unordered_map<DWORD, TItemCacheSet *> TItemCacheSetPtrMap;
typedef boost::unordered_map<DWORD, CItemPriceListTableCache*> TItemPriceListCacheMap; typedef std::unordered_map<DWORD, CItemPriceListTableCache*> TItemPriceListCacheMap;
typedef boost::unordered_map<short, BYTE> TChannelStatusMap; typedef std::unordered_map<short, BYTE> TChannelStatusMap;
// MYSHOP_PRICE_LIST // MYSHOP_PRICE_LIST
/// 아이템 가격정보 리스트 요청 정보 /// 아이템 가격정보 리스트 요청 정보
@ -392,19 +392,19 @@ class CClientManager : public CNetBase, public singleton<CClientManager>
CPeer * m_pkAuthPeer; CPeer * m_pkAuthPeer;
// LoginKey, LoginData pair // LoginKey, LoginData pair
typedef boost::unordered_map<DWORD, CLoginData *> TLoginDataByLoginKey; typedef std::unordered_map<DWORD, CLoginData *> TLoginDataByLoginKey;
TLoginDataByLoginKey m_map_pkLoginData; TLoginDataByLoginKey m_map_pkLoginData;
// Login LoginData pair // Login LoginData pair
typedef boost::unordered_map<std::string, CLoginData *> TLoginDataByLogin; typedef std::unordered_map<std::string, CLoginData *> TLoginDataByLogin;
TLoginDataByLogin m_map_pkLoginDataByLogin; TLoginDataByLogin m_map_pkLoginDataByLogin;
// AccountID LoginData pair // AccountID LoginData pair
typedef boost::unordered_map<DWORD, CLoginData *> TLoginDataByAID; typedef std::unordered_map<DWORD, CLoginData *> TLoginDataByAID;
TLoginDataByAID m_map_pkLoginDataByAID; TLoginDataByAID m_map_pkLoginDataByAID;
// Login LoginData pair (실제 로그인 되어있는 계정) // Login LoginData pair (실제 로그인 되어있는 계정)
typedef boost::unordered_map<std::string, CLoginData *> TLogonAccountMap; typedef std::unordered_map<std::string, CLoginData *> TLogonAccountMap;
TLogonAccountMap m_map_kLogonAccount; TLogonAccountMap m_map_kLogonAccount;
int m_iPlayerIDStart; int m_iPlayerIDStart;
@ -510,7 +510,7 @@ class CClientManager : public CNetBase, public singleton<CClientManager>
} }
}; };
typedef boost::unordered_map<DWORD, TLogoutPlayer*> TLogoutPlayerMap; typedef std::unordered_map<DWORD, TLogoutPlayer*> TLogoutPlayerMap;
TLogoutPlayerMap m_map_logout; TLogoutPlayerMap m_map_logout;
void InsertLogoutPlayer(DWORD pid); void InsertLogoutPlayer(DWORD pid);

View File

@ -109,7 +109,7 @@ bool CClientManager::InitializeRefineTable()
"SELECT id, cost, prob, vnum0, count0, vnum1, count1, vnum2, count2, vnum3, count3, vnum4, count4 FROM refine_proto%s", "SELECT id, cost, prob, vnum0, count0, vnum1, count1, vnum2, count2, vnum3, count3, vnum4, count4 FROM refine_proto%s",
GetTablePostfix()); GetTablePostfix());
std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query)); std::unique_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
SQLResult * pRes = pkMsg->Get(); SQLResult * pRes = pkMsg->Get();
if (!pRes->uiNumRows) if (!pRes->uiNumRows)
@ -445,7 +445,7 @@ bool CClientManager::InitializeShopTable()
"FROM shop LEFT JOIN shop_item " "FROM shop LEFT JOIN shop_item "
"ON shop.vnum = shop_item.shop_vnum ORDER BY shop.vnum, shop_item.item_vnum"; "ON shop.vnum = shop_item.shop_vnum ORDER BY shop.vnum, shop_item.item_vnum";
std::auto_ptr<SQLMsg> pkMsg2(CDBManager::instance().DirectQuery(s_szQuery)); std::unique_ptr<SQLMsg> pkMsg2(CDBManager::instance().DirectQuery(s_szQuery));
// shop의 vnum은 있는데 shop_item 이 없을경우... 실패로 처리되니 주의 요망. // shop의 vnum은 있는데 shop_item 이 없을경우... 실패로 처리되니 주의 요망.
// 고처야할부분 // 고처야할부분
@ -524,7 +524,7 @@ bool CClientManager::InitializeQuestItemTable()
char query[1024]; char query[1024];
snprintf(query, sizeof(query), s_szQuery, g_stLocaleNameColumn.c_str()); snprintf(query, sizeof(query), s_szQuery, g_stLocaleNameColumn.c_str());
std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query)); std::unique_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
SQLResult * pRes = pkMsg->Get(); SQLResult * pRes = pkMsg->Get();
if (!pRes->uiNumRows) if (!pRes->uiNumRows)
@ -860,7 +860,7 @@ bool CClientManager::InitializeSkillTable()
"FROM skill_proto%s ORDER BY dwVnum", "FROM skill_proto%s ORDER BY dwVnum",
GetTablePostfix()); GetTablePostfix());
std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query)); std::unique_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
SQLResult * pRes = pkMsg->Get(); SQLResult * pRes = pkMsg->Get();
if (!pRes->uiNumRows) if (!pRes->uiNumRows)
@ -941,7 +941,7 @@ bool CClientManager::InitializeBanwordTable()
{ {
m_vec_banwordTable.clear(); m_vec_banwordTable.clear();
std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery("SELECT word FROM banword")); std::unique_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery("SELECT word FROM banword"));
SQLResult * pRes = pkMsg->Get(); SQLResult * pRes = pkMsg->Get();
@ -972,7 +972,7 @@ bool CClientManager::InitializeItemAttrTable()
"SELECT apply, apply+0, prob, lv1, lv2, lv3, lv4, lv5, weapon, body, wrist, foots, neck, head, shield, ear FROM item_attr%s ORDER BY apply", "SELECT apply, apply+0, prob, lv1, lv2, lv3, lv4, lv5, weapon, body, wrist, foots, neck, head, shield, ear FROM item_attr%s ORDER BY apply",
GetTablePostfix()); GetTablePostfix());
std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query)); std::unique_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
SQLResult * pRes = pkMsg->Get(); SQLResult * pRes = pkMsg->Get();
if (!pRes->uiNumRows) if (!pRes->uiNumRows)
@ -1046,7 +1046,7 @@ bool CClientManager::InitializeItemRareTable()
"SELECT apply, apply+0, prob, lv1, lv2, lv3, lv4, lv5, weapon, body, wrist, foots, neck, head, shield, ear FROM item_attr_rare%s ORDER BY apply", "SELECT apply, apply+0, prob, lv1, lv2, lv3, lv4, lv5, weapon, body, wrist, foots, neck, head, shield, ear FROM item_attr_rare%s ORDER BY apply",
GetTablePostfix()); GetTablePostfix());
std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query)); std::unique_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
SQLResult * pRes = pkMsg->Get(); SQLResult * pRes = pkMsg->Get();
if (!pRes->uiNumRows) if (!pRes->uiNumRows)
@ -1124,7 +1124,7 @@ bool CClientManager::InitializeLandTable()
"FROM land%s WHERE enable='YES' ORDER BY id", "FROM land%s WHERE enable='YES' ORDER BY id",
GetTablePostfix()); GetTablePostfix());
std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query)); std::unique_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
SQLResult * pRes = pkMsg->Get(); SQLResult * pRes = pkMsg->Get();
if (!m_vec_kLandTable.empty()) if (!m_vec_kLandTable.empty())
@ -1227,7 +1227,7 @@ bool CClientManager::InitializeObjectProto()
"FROM object_proto%s ORDER BY vnum", "FROM object_proto%s ORDER BY vnum",
GetTablePostfix()); GetTablePostfix());
std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query)); std::unique_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
SQLResult * pRes = pkMsg->Get(); SQLResult * pRes = pkMsg->Get();
if (!m_vec_kObjectProto.empty()) if (!m_vec_kObjectProto.empty())
@ -1296,7 +1296,7 @@ bool CClientManager::InitializeObjectTable()
char query[4096]; char query[4096];
snprintf(query, sizeof(query), "SELECT id, land_id, vnum, map_index, x, y, x_rot, y_rot, z_rot, life FROM object%s ORDER BY id", GetTablePostfix()); snprintf(query, sizeof(query), "SELECT id, land_id, vnum, map_index, x, y, x_rot, y_rot, z_rot, life FROM object%s ORDER BY id", GetTablePostfix());
std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query)); std::unique_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
SQLResult * pRes = pkMsg->Get(); SQLResult * pRes = pkMsg->Get();
if (!m_map_pkObjectTable.empty()) if (!m_map_pkObjectTable.empty())

View File

@ -10,7 +10,7 @@ void CClientManager::LoadEventFlag()
{ {
char szQuery[1024]; char szQuery[1024];
snprintf(szQuery, sizeof(szQuery), "SELECT szName, lValue FROM quest%s WHERE dwPID = 0", GetTablePostfix()); snprintf(szQuery, sizeof(szQuery), "SELECT szName, lValue FROM quest%s WHERE dwPID = 0", GetTablePostfix());
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
SQLResult* pRes = pmsg->Get(); SQLResult* pRes = pmsg->Get();
if (pRes->uiNumRows) if (pRes->uiNumRows)

View File

@ -33,12 +33,12 @@ void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p)
"INSERT INTO guild_member%s VALUES(%u, %u, %d, 0, 0)", "INSERT INTO guild_member%s VALUES(%u, %u, %d, 0, 0)",
GetTablePostfix(), p->dwPID, p->dwGuild, p->bGrade); GetTablePostfix(), p->dwPID, p->dwGuild, p->bGrade);
std::auto_ptr<SQLMsg> pmsg_insert(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg_insert(CDBManager::instance().DirectQuery(szQuery));
snprintf(szQuery, sizeof(szQuery), snprintf(szQuery, sizeof(szQuery),
"SELECT pid, grade, is_general, offer, level, job, name FROM guild_member%s, player%s WHERE guild_id = %u and pid = id and pid = %u", GetTablePostfix(), GetTablePostfix(), p->dwGuild, p->dwPID); "SELECT pid, grade, is_general, offer, level, job, name FROM guild_member%s, player%s WHERE guild_id = %u and pid = id and pid = %u", GetTablePostfix(), GetTablePostfix(), p->dwGuild, p->dwPID);
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
if (pmsg->Get()->uiNumRows == 0) if (pmsg->Get()->uiNumRows == 0)
{ {

View File

@ -8,7 +8,7 @@ void CClientManager::UpdateHorseName(TPacketUpdateHorseName* data, CPeer* peer)
snprintf(szQuery, sizeof(szQuery), "REPLACE INTO horse_name VALUES(%u, '%s')", data->dwPlayerID, data->szHorseName); snprintf(szQuery, sizeof(szQuery), "REPLACE INTO horse_name VALUES(%u, '%s')", data->dwPlayerID, data->szHorseName);
std::auto_ptr<SQLMsg> pmsg_insert(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg_insert(CDBManager::instance().DirectQuery(szQuery));
ForwardPacket(HEADER_DG_UPDATE_HORSE_NAME, data, sizeof(TPacketUpdateHorseName), 0, peer); ForwardPacket(HEADER_DG_UPDATE_HORSE_NAME, data, sizeof(TPacketUpdateHorseName), 0, peer);
} }
@ -19,7 +19,7 @@ void CClientManager::AckHorseName(DWORD dwPID, CPeer* peer)
snprintf(szQuery, sizeof(szQuery), "SELECT name FROM horse_name WHERE id = %u", dwPID); snprintf(szQuery, sizeof(szQuery), "SELECT name FROM horse_name WHERE id = %u", dwPID);
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
TPacketUpdateHorseName packet; TPacketUpdateHorseName packet;
packet.dwPlayerID = dwPID; packet.dwPlayerID = dwPID;

View File

@ -81,24 +81,6 @@ bool CClientManager::FindLogonAccount(const char * c_pszLogin)
void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketGDLoginByKey * p) void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketGDLoginByKey * p)
{ {
#ifdef ENABLE_LIMIT_TIME
static int s_updateCount = 0;
static int s_curTime = time(0);
if (s_updateCount > 100)
{
s_curTime = time(0);
s_updateCount = 0;
}
++s_updateCount;
if (s_curTime >= GLOBAL_LIMIT_TIME)
{
sys_err("Server life time expired.");
exit(0);
return;
}
#endif
CLoginData * pkLoginData = GetLoginData(p->dwLoginKey); CLoginData * pkLoginData = GetLoginData(p->dwLoginKey);
char szLogin[LOGIN_MAX_LEN + 1]; char szLogin[LOGIN_MAX_LEN + 1];
trim_and_lower(p->szLogin, szLogin, sizeof(szLogin)); trim_and_lower(p->szLogin, szLogin, sizeof(szLogin));
@ -180,7 +162,7 @@ void CClientManager::RESULT_LOGIN_BY_KEY(CPeer * peer, SQLMsg * msg)
DWORD account_id = info->pAccountTable->id; DWORD account_id = info->pAccountTable->id;
char szQuery[QUERY_MAX_LEN]; char szQuery[QUERY_MAX_LEN];
snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id); snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id);
std::auto_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER)); std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER));
sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id); sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id);
@ -506,7 +488,7 @@ void CClientManager::QUERY_CHANGE_NAME(CPeer * peer, DWORD dwHandle, TPacketGDCh
snprintf(queryStr, sizeof(queryStr), snprintf(queryStr, sizeof(queryStr),
"SELECT COUNT(*) as count FROM player%s WHERE name='%s' AND id <> %u", GetTablePostfix(), p->name, p->pid); "SELECT COUNT(*) as count FROM player%s WHERE name='%s' AND id <> %u", GetTablePostfix(), p->name, p->pid);
std::auto_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER)); std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER));
if (pMsg->Get()->uiNumRows) if (pMsg->Get()->uiNumRows)
{ {
@ -533,7 +515,7 @@ void CClientManager::QUERY_CHANGE_NAME(CPeer * peer, DWORD dwHandle, TPacketGDCh
snprintf(queryStr, sizeof(queryStr), snprintf(queryStr, sizeof(queryStr),
"UPDATE player%s SET name='%s',change_name=0 WHERE id=%u", GetTablePostfix(), p->name, p->pid); "UPDATE player%s SET name='%s',change_name=0 WHERE id=%u", GetTablePostfix(), p->name, p->pid);
std::auto_ptr<SQLMsg> pMsg0(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER)); std::unique_ptr<SQLMsg> pMsg0(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER));
TPacketDGChangeName pdg; TPacketDGChangeName pdg;
peer->EncodeHeader(HEADER_DG_CHANGE_NAME, dwHandle, sizeof(TPacketDGChangeName)); peer->EncodeHeader(HEADER_DG_CHANGE_NAME, dwHandle, sizeof(TPacketDGChangeName));

View File

@ -549,7 +549,7 @@ bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab)
void CClientManager::RESULT_COMPOSITE_PLAYER(CPeer * peer, SQLMsg * pMsg, DWORD dwQID) void CClientManager::RESULT_COMPOSITE_PLAYER(CPeer * peer, SQLMsg * pMsg, DWORD dwQID)
{ {
CQueryInfo * qi = (CQueryInfo *) pMsg->pvUserData; CQueryInfo * qi = (CQueryInfo *) pMsg->pvUserData;
std::auto_ptr<ClientHandleInfo> info((ClientHandleInfo *) qi->pvData); std::unique_ptr<ClientHandleInfo> info((ClientHandleInfo *) qi->pvData);
MYSQL_RES * pSQLResult = pMsg->Get()->pSQLResult; MYSQL_RES * pSQLResult = pMsg->Get()->pSQLResult;
if (!pSQLResult) if (!pSQLResult)
@ -813,7 +813,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC
queryLen = snprintf(queryStr, sizeof(queryStr), queryLen = snprintf(queryStr, sizeof(queryStr),
"SELECT pid%u FROM player_index%s WHERE id=%d", packet->account_index + 1, GetTablePostfix(), packet->account_id); "SELECT pid%u FROM player_index%s WHERE id=%d", packet->account_index + 1, GetTablePostfix(), packet->account_id);
std::auto_ptr<SQLMsg> pMsg0(CDBManager::instance().DirectQuery(queryStr)); std::unique_ptr<SQLMsg> pMsg0(CDBManager::instance().DirectQuery(queryStr));
if (pMsg0->Get()->uiNumRows != 0) if (pMsg0->Get()->uiNumRows != 0)
{ {
@ -847,7 +847,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC
snprintf(queryStr, sizeof(queryStr), snprintf(queryStr, sizeof(queryStr),
"SELECT COUNT(*) as count FROM player%s WHERE name='%s'", GetTablePostfix(), packet->player_table.name); "SELECT COUNT(*) as count FROM player%s WHERE name='%s'", GetTablePostfix(), packet->player_table.name);
std::auto_ptr<SQLMsg> pMsg1(CDBManager::instance().DirectQuery(queryStr)); std::unique_ptr<SQLMsg> pMsg1(CDBManager::instance().DirectQuery(queryStr));
if (pMsg1->Get()->uiNumRows) if (pMsg1->Get()->uiNumRows)
{ {
@ -905,7 +905,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC
CDBManager::instance().EscapeString(text, packet->player_table.quickslot, sizeof(packet->player_table.quickslot)); CDBManager::instance().EscapeString(text, packet->player_table.quickslot, sizeof(packet->player_table.quickslot));
queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s')", text); queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s')", text);
std::auto_ptr<SQLMsg> pMsg2(CDBManager::instance().DirectQuery(queryStr)); std::unique_ptr<SQLMsg> pMsg2(CDBManager::instance().DirectQuery(queryStr));
if (g_test_server) if (g_test_server)
sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text); sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text);
@ -920,7 +920,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC
snprintf(queryStr, sizeof(queryStr), "UPDATE player_index%s SET pid%d=%d WHERE id=%d", snprintf(queryStr, sizeof(queryStr), "UPDATE player_index%s SET pid%d=%d WHERE id=%d",
GetTablePostfix(), packet->account_index + 1, player_id, packet->account_id); GetTablePostfix(), packet->account_index + 1, player_id, packet->account_id);
std::auto_ptr<SQLMsg> pMsg3(CDBManager::instance().DirectQuery(queryStr)); std::unique_ptr<SQLMsg> pMsg3(CDBManager::instance().DirectQuery(queryStr));
if (pMsg3->Get()->uiAffectedRows <= 0) if (pMsg3->Get()->uiAffectedRows <= 0)
{ {
@ -1067,7 +1067,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg)
snprintf(queryStr, sizeof(queryStr), "INSERT INTO player%s_deleted SELECT * FROM player%s WHERE id=%d", snprintf(queryStr, sizeof(queryStr), "INSERT INTO player%s_deleted SELECT * FROM player%s WHERE id=%d",
GetTablePostfix(), GetTablePostfix(), pi->player_id); GetTablePostfix(), GetTablePostfix(), pi->player_id);
std::auto_ptr<SQLMsg> pIns(CDBManager::instance().DirectQuery(queryStr)); std::unique_ptr<SQLMsg> pIns(CDBManager::instance().DirectQuery(queryStr));
if (pIns->Get()->uiAffectedRows == 0 || pIns->Get()->uiAffectedRows == (uint32_t)-1) if (pIns->Get()->uiAffectedRows == 0 || pIns->Get()->uiAffectedRows == (uint32_t)-1)
{ {
@ -1119,7 +1119,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg)
pi->account_index + 1, pi->account_index + 1,
pi->player_id); pi->player_id);
std::auto_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(queryStr)); std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(queryStr));
if (pMsg->Get()->uiAffectedRows == 0 || pMsg->Get()->uiAffectedRows == (uint32_t)-1) if (pMsg->Get()->uiAffectedRows == 0 || pMsg->Get()->uiAffectedRows == (uint32_t)-1)
{ {

View File

@ -159,7 +159,7 @@ void CGuildManager::Initialize()
{ {
char szQuery[1024]; char szQuery[1024];
snprintf(szQuery, sizeof(szQuery), "SELECT id, name, ladder_point, win, draw, loss, gold, level FROM guild%s", GetTablePostfix()); snprintf(szQuery, sizeof(szQuery), "SELECT id, name, ladder_point, win, draw, loss, gold, level FROM guild%s", GetTablePostfix());
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
if (pmsg->Get()->uiNumRows) if (pmsg->Get()->uiNumRows)
ParseResult(pmsg->Get()); ParseResult(pmsg->Get());
@ -190,7 +190,7 @@ void CGuildManager::Load(DWORD dwGuildID)
char szQuery[1024]; char szQuery[1024];
snprintf(szQuery, sizeof(szQuery), "SELECT id, name, ladder_point, win, draw, loss, gold, level FROM guild%s WHERE id=%u", GetTablePostfix(), dwGuildID); snprintf(szQuery, sizeof(szQuery), "SELECT id, name, ladder_point, win, draw, loss, gold, level FROM guild%s WHERE id=%u", GetTablePostfix(), dwGuildID);
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
if (pmsg->Get()->uiNumRows) if (pmsg->Get()->uiNumRows)
ParseResult(pmsg->Get()); ParseResult(pmsg->Get());
@ -901,7 +901,7 @@ void CGuildManager::BootReserveWar()
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{ {
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(c_apszQuery[i])); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(c_apszQuery[i]));
if (pmsg->Get()->uiNumRows == 0) if (pmsg->Get()->uiNumRows == 0)
continue; continue;
@ -962,7 +962,7 @@ int GetAverageGuildMemberLevel(DWORD dwGID)
"SELECT AVG(level) FROM guild_member%s, player%s AS p WHERE guild_id=%u AND guild_member%s.pid=p.id", "SELECT AVG(level) FROM guild_member%s, player%s AS p WHERE guild_id=%u AND guild_member%s.pid=p.id",
GetTablePostfix(), GetTablePostfix(), dwGID, GetTablePostfix()); GetTablePostfix(), GetTablePostfix(), dwGID, GetTablePostfix());
std::auto_ptr<SQLMsg> msg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> msg(CDBManager::instance().DirectQuery(szQuery));
MYSQL_ROW row; MYSQL_ROW row;
row = mysql_fetch_row(msg->Get()->pSQLResult); row = mysql_fetch_row(msg->Get()->pSQLResult);
@ -977,7 +977,7 @@ int GetGuildMemberCount(DWORD dwGID)
snprintf(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM guild_member%s WHERE guild_id=%u", GetTablePostfix(), dwGID); snprintf(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM guild_member%s WHERE guild_id=%u", GetTablePostfix(), dwGID);
std::auto_ptr<SQLMsg> msg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> msg(CDBManager::instance().DirectQuery(szQuery));
MYSQL_ROW row; MYSQL_ROW row;
row = mysql_fetch_row(msg->Get()->pSQLResult); row = mysql_fetch_row(msg->Get()->pSQLResult);
@ -1065,7 +1065,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p)
"VALUES(%u, %u, DATE_ADD(NOW(), INTERVAL 180 SECOND), %u, %ld, %ld, %ld, %ld, %ld)", "VALUES(%u, %u, DATE_ADD(NOW(), INTERVAL 180 SECOND), %u, %ld, %ld, %ld, %ld, %ld)",
GID1, GID2, p->bType, p->lWarPrice, p->lInitialScore, t.lPowerFrom, t.lPowerTo, t.lHandicap); GID1, GID2, p->bType, p->lWarPrice, p->lInitialScore, t.lPowerFrom, t.lPowerTo, t.lHandicap);
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiInsertID == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiInsertID == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1)
{ {
@ -1214,7 +1214,7 @@ void CGuildWarReserve::Initialize()
char szQuery[256]; char szQuery[256];
snprintf(szQuery, sizeof(szQuery), "SELECT login, guild, gold FROM guild_war_bet WHERE war_id=%u", m_data.dwID); snprintf(szQuery, sizeof(szQuery), "SELECT login, guild, gold FROM guild_war_bet WHERE war_id=%u", m_data.dwID);
std::auto_ptr<SQLMsg> msgbet(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> msgbet(CDBManager::instance().DirectQuery(szQuery));
if (msgbet->Get()->uiNumRows) if (msgbet->Get()->uiNumRows)
{ {
@ -1291,7 +1291,7 @@ bool CGuildWarReserve::Bet(const char * pszLogin, DWORD dwGold, DWORD dwGuild)
"INSERT INTO guild_war_bet (war_id, login, gold, guild) VALUES(%u, '%s', %u, %u)", "INSERT INTO guild_war_bet (war_id, login, gold, guild) VALUES(%u, '%s', %u, %u)",
m_data.dwID, pszLogin, dwGold, dwGuild); m_data.dwID, pszLogin, dwGold, dwGuild);
std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1)
{ {

View File

@ -19,7 +19,7 @@ bool PlayerHB::Initialize()
char szQuery[128]; char szQuery[128];
snprintf(szQuery, sizeof(szQuery), "SHOW CREATE TABLE player%s", GetTablePostfix()); snprintf(szQuery, sizeof(szQuery), "SHOW CREATE TABLE player%s", GetTablePostfix());
std::auto_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery));
if (pMsg->Get()->uiNumRows == 0) if (pMsg->Get()->uiNumRows == 0)
return false; return false;
@ -75,7 +75,7 @@ bool PlayerHB::Query(DWORD id)
snprintf(szQuery, sizeof(szQuery), "CREATE TABLE IF NOT EXISTS %s%s", szTableName, m_stCreateTableQuery.c_str() + strlen(szFind)); snprintf(szQuery, sizeof(szQuery), "CREATE TABLE IF NOT EXISTS %s%s", szTableName, m_stCreateTableQuery.c_str() + strlen(szFind));
// sys_log(0, "%s", szQuery); // sys_log(0, "%s", szQuery);
std::auto_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_HOTBACKUP)); std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_HOTBACKUP));
m_stTableName = szTableName; m_stTableName = szTableName;
} }

View File

@ -40,8 +40,8 @@ namespace marriage
"SELECT pid1, pid2, love_point, time, is_married, p1.name, p2.name FROM marriage, player%s as p1, player%s as p2 WHERE p1.id = pid1 AND p2.id = pid2", "SELECT pid1, pid2, love_point, time, is_married, p1.name, p2.name FROM marriage, player%s as p1, player%s as p2 WHERE p1.id = pid1 AND p2.id = pid2",
GetTablePostfix(), GetTablePostfix()); GetTablePostfix(), GetTablePostfix());
auto_ptr<SQLMsg> pmsg_delete(CDBManager::instance().DirectQuery("DELETE FROM marriage WHERE is_married = 0")); unique_ptr<SQLMsg> pmsg_delete(CDBManager::instance().DirectQuery("DELETE FROM marriage WHERE is_married = 0"));
auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
SQLResult * pRes = pmsg->Get(); SQLResult * pRes = pmsg->Get();
sys_log(0, "MarriageList(size=%lu)", pRes->uiNumRows); sys_log(0, "MarriageList(size=%lu)", pRes->uiNumRows);
@ -101,7 +101,7 @@ namespace marriage
char szQuery[512]; char szQuery[512];
snprintf(szQuery, sizeof(szQuery), "INSERT INTO marriage(pid1, pid2, love_point, time) VALUES (%u, %u, 0, %u)", dwPID1, dwPID2, now); snprintf(szQuery, sizeof(szQuery), "INSERT INTO marriage(pid1, pid2, love_point, time) VALUES (%u, %u, 0, %u)", dwPID1, dwPID2, now);
auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
SQLResult* res = pmsg->Get(); SQLResult* res = pmsg->Get();
if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1)
@ -141,7 +141,7 @@ namespace marriage
snprintf(szQuery, sizeof(szQuery), "UPDATE marriage SET love_point = %d, is_married = %d WHERE pid1 = %u AND pid2 = %u", snprintf(szQuery, sizeof(szQuery), "UPDATE marriage SET love_point = %d, is_married = %d WHERE pid1 = %u AND pid2 = %u",
iLovePoint, byMarried, pMarriage->pid1, pMarriage->pid2); iLovePoint, byMarried, pMarriage->pid1, pMarriage->pid2);
auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
SQLResult* res = pmsg->Get(); SQLResult* res = pmsg->Get();
if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1)
@ -187,7 +187,7 @@ namespace marriage
char szQuery[512]; char szQuery[512];
snprintf(szQuery, sizeof(szQuery), "DELETE FROM marriage WHERE pid1 = %u AND pid2 = %u", dwPID1, dwPID2); snprintf(szQuery, sizeof(szQuery), "DELETE FROM marriage WHERE pid1 = %u AND pid2 = %u", dwPID1, dwPID2);
auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
SQLResult* res = pmsg->Get(); SQLResult* res = pmsg->Get();
if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1)
@ -231,7 +231,7 @@ namespace marriage
snprintf(szQuery, sizeof(szQuery), "UPDATE marriage SET is_married = 1 WHERE pid1 = %u AND pid2 = %u", snprintf(szQuery, sizeof(szQuery), "UPDATE marriage SET is_married = 1 WHERE pid1 = %u AND pid2 = %u",
pMarriage->pid1, pMarriage->pid2); pMarriage->pid1, pMarriage->pid2);
auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery)); unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
SQLResult* res = pmsg->Get(); SQLResult* res = pmsg->Get();
if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1)

View File

@ -17,4 +17,7 @@
#include <common/stl.h> #include <common/stl.h>
#include <common/service.h> #include <common/service.h>
#include <memory>
#include <algorithm>
#endif #endif

View File

@ -6,7 +6,7 @@ file(GLOB_RECURSE sources
src/*.cpp src/*.h src/*.cpp src/*.h
) )
include_directories(${PROJECT_BINARY_DIR}/src/system/) include_directories(${PROJECT_BINARY_DIR}/src/)
include_directories(src/) include_directories(src/)
@ -15,18 +15,21 @@ find_package(libmysql REQUIRED)
find_package(Boost COMPONENTS system REQUIRED) find_package(Boost COMPONENTS system REQUIRED)
find_package(DevIL REQUIRED) find_package(DevIL REQUIRED)
find_package(LZO REQUIRED) find_package(LZO REQUIRED)
find_package(cryptopp CONFIG REQUIRED)
find_package(GTest REQUIRED)
add_executable(${PROJECT_NAME} ${sources}) add_executable(${PROJECT_NAME} ${sources})
# Link dependencies if found # Link dependencies if found
if (libmysql_FOUND)
target_link_libraries (${PROJECT_NAME} ${MYSQL_LIBRARIES}) target_link_libraries (${PROJECT_NAME} ${MYSQL_LIBRARIES})
endif (libmysql_FOUND)
if (Boost_FOUND) # Crypto++
include_directories(${Boost_INCLUDE_DIRS}) target_link_libraries (${PROJECT_NAME} cryptopp-static)
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES} ${Boost_SYSTEM_LIBRARY})
endif (Boost_FOUND) # Boost
include_directories(${Boost_INCLUDE_DIR})
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES})
if (IL_FOUND) if (IL_FOUND)
include_directories(${IL_INCLUDE_DIR}) include_directories(${IL_INCLUDE_DIR})
@ -39,14 +42,12 @@ if (LZO_FOUND)
endif (LZO_FOUND) endif (LZO_FOUND)
target_link_libraries(${PROJECT_NAME} md)
# Pthreads # Pthreads
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package (Threads REQUIRED) find_package (Threads REQUIRED)
target_link_libraries (${PROJECT_NAME} Threads::Threads) target_link_libraries (${PROJECT_NAME} Threads::Threads)
find_package(GTest REQUIRED) # Google test
if (GTEST_FOUND) if (GTEST_FOUND)
include_directories(${GTEST_INCLUDE_DIRS}) include_directories(${GTEST_INCLUDE_DIRS})
target_link_libraries (${PROJECT_NAME} ${GTEST_BOTH_LIBRARIES}) target_link_libraries (${PROJECT_NAME} ${GTEST_BOTH_LIBRARIES})

View File

@ -2,10 +2,6 @@
#include "ClientPackageCryptInfo.h" #include "ClientPackageCryptInfo.h"
#include <common/stl.h> #include <common/stl.h>
#ifndef __FreeBSD__
#include "../../libthecore/include/xdirent.h"
#endif
CClientPackageCryptInfo::CClientPackageCryptInfo() : m_pSerializedCryptKeyStream(NULL), m_nCryptKeyPackageCnt(0) CClientPackageCryptInfo::CClientPackageCryptInfo() : m_pSerializedCryptKeyStream(NULL), m_nCryptKeyPackageCnt(0)
{ {
} }

View File

@ -1,7 +1,7 @@
#ifndef __INC_CLIENTPACKAGE_CRYPTINFO_H #ifndef __INC_CLIENTPACKAGE_CRYPTINFO_H
#define __INC_CLIENTPACKAGE_CRYPTINFO_H #define __INC_CLIENTPACKAGE_CRYPTINFO_H
#include <boost/unordered_map.hpp> #include <unordered_map>
#pragma pack(1) #pragma pack(1)
@ -103,7 +103,7 @@ private:
} TPerFileSDBInfo; } TPerFileSDBInfo;
typedef boost::unordered_map<std::string, TPerFileSDBInfo > TPackageSDBMap; //key: related map name typedef std::unordered_map<std::string, TPerFileSDBInfo > TPackageSDBMap; //key: related map name
TPackageSDBMap m_mapPackageSDB; TPackageSDBMap m_mapPackageSDB;

View File

@ -222,7 +222,7 @@ void CDragonLairManager::OnDragonDead(LPCHARACTER pDragon, DWORD KillerGuildID)
if (false == pDragon->IsMonster()) if (false == pDragon->IsMonster())
return; return;
boost::unordered_map<DWORD, CDragonLair*>::iterator iter = LairMap_.find( KillerGuildID ); std::unordered_map<DWORD, CDragonLair*>::iterator iter = LairMap_.find( KillerGuildID );
if (LairMap_.end() == iter) if (LairMap_.end() == iter)
{ {

View File

@ -1,5 +1,5 @@
#include <boost/unordered_map.hpp> #include <unordered_map>
#include <common/stl.h> #include <common/stl.h>
@ -32,6 +32,6 @@ class CDragonLairManager : public singleton<CDragonLairManager>
size_t GetLairCount () const { return LairMap_.size(); } size_t GetLairCount () const { return LairMap_.size(); }
private: private:
boost::unordered_map<DWORD, CDragonLair*> LairMap_; std::unordered_map<DWORD, CDragonLair*> LairMap_;
}; };

View File

@ -1,136 +0,0 @@
#include "stdafx.h"
#include "FileMonitor_FreeBSD.h"
#include "../../libthecore/include/log.h"
#define INVALID_KERNEL_EVENT -1
FileMonitorFreeBSD::FileMonitorFreeBSD()
{
m_KernelEventQueue = INVALID_KERNEL_EVENT;
}
FileMonitorFreeBSD::~FileMonitorFreeBSD()
{
if( m_KernelEventQueue != INVALID_KERNEL_EVENT )
{
close ( m_KernelEventQueue );
m_KernelEventQueue = INVALID_KERNEL_EVENT;
}
TMonitorFileHashMap::iterator it;
for( it = m_FileLists.begin(); it != m_FileLists.end(); ++it )
{
close(it->second.fhMonitor);
}
m_FileLists.clear();
m_MonitoredEventLists.clear();
m_TriggeredEventLists.clear();
}
void FileMonitorFreeBSD::Update(DWORD dwPulses)
{
if( m_KernelEventQueue == INVALID_KERNEL_EVENT || m_FileLists.size() == 0 )
return;
int nEvent = kevent(m_KernelEventQueue, &m_TriggeredEventLists[0], (int)m_TriggeredEventLists.size(), &m_MonitoredEventLists[0], (int)m_MonitoredEventLists.size(), NULL );
if( nEvent == INVALID_KERNEL_EVENT )
{
return;
}
else if( nEvent > 0 )
{
for( int i = 0; i < nEvent; ++i )
{
int nEventFlags = m_MonitoredEventLists[i].flags;
eFileUpdatedOptions eUpdateOption = e_FileUpdate_None;
if (nEventFlags & EV_ERROR)
eUpdateOption = e_FileUpdate_Error;
else if (nEventFlags & NOTE_DELETE)
eUpdateOption = e_FileUpdate_Deleted;
else if (nEventFlags & NOTE_EXTEND || nEventFlags & NOTE_WRITE)
eUpdateOption = e_FileUpdate_Modified;
else if (nEventFlags & NOTE_ATTRIB)
eUpdateOption = e_FileUpdate_AttrModified;
else if (nEventFlags & NOTE_LINK)
eUpdateOption = e_FileUpdate_Linked;
else if (nEventFlags & NOTE_RENAME)
eUpdateOption = e_FileUpdate_Renamed;
else if (nEventFlags & NOTE_REVOKE)
eUpdateOption = e_FileUpdate_Revoked;
if( eUpdateOption != e_FileUpdate_None )
{
TMonitorFileHashMap::iterator it;
for( it = m_FileLists.begin(); it != m_FileLists.end(); ++it )
{
FileIOContext_FreeBSD& context = it->second;
if( context.idxToEventList == i )
{
std::string strModifedFileName = it->first;
context.pListenFunc( strModifedFileName, eUpdateOption );
break;
}
}
}
}
}
}
void FileMonitorFreeBSD::AddWatch(const std::string& strFileName, PFN_FileChangeListener pListenerFunc)
{
int iFileHandle = -1;
if( (iFileHandle = open(strFileName.c_str(), O_RDONLY)) == -1)
{
sys_err("FileMonitorFreeBSD:AddWatch : can`t open file(%s).\n", strFileName.c_str());
return;
}
//create kqueue if not exists
if( m_KernelEventQueue == INVALID_KERNEL_EVENT )
m_KernelEventQueue = kqueue();
if( m_KernelEventQueue == INVALID_KERNEL_EVENT )
{
sys_err("FileMonitorFreeBSD:AddWatch : failed to create kqueue.\n");
return;
}
TMonitorFileHashMap::iterator it = m_FileLists.find( strFileName );
if( it != m_FileLists.end() )
{
sys_log(0, "FileMonitorFreeBSD:AddWatch : trying to add duplicated watch on file(%s).\n", strFileName.c_str() );
return;
}
//set file context
FileIOContext_FreeBSD context;
{
context.fhMonitor = iFileHandle;
context.idxToEventList = (int)m_MonitoredEventLists.size();
context.pListenFunc = pListenerFunc;
}
m_FileLists[strFileName] = context;
//set events
struct kevent kTriggerEvent, kMonitorEvent;
EV_SET(&kTriggerEvent, iFileHandle, EVFILT_VNODE,
EV_ADD | EV_ENABLE | EV_ONESHOT,
NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_LINK | NOTE_RENAME | NOTE_REVOKE,
0, 0);
m_TriggeredEventLists.push_back( kTriggerEvent );
m_MonitoredEventLists.push_back( kMonitorEvent );
}

View File

@ -1,47 +0,0 @@
#ifndef FILEMONITOR_FREEBSD_INCLUDED
#define FILEMONITOR_FREEBSD_INCLUDED
#include "IFileMonitor.h"
#include <unistd.h>
#include <sys/event.h>
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/time.h>
struct FileIOContext_FreeBSD
{
int fhMonitor;
int idxToEventList; // evtTrigger & evtMonitor index should be same
PFN_FileChangeListener pListenFunc;
};
class FileMonitorFreeBSD : public IFileMonitor
{
private:
FileMonitorFreeBSD(); //hidden
public:
virtual ~FileMonitorFreeBSD();
void AddWatch (const std::string& strFileName, PFN_FileChangeListener pListenerFunc);
void Update (DWORD dwPulses);
static FileMonitorFreeBSD& Instance()
{
static FileMonitorFreeBSD theMonitor;
return theMonitor;
}
private:
typedef boost::unordered_map<std::string, FileIOContext_FreeBSD> TMonitorFileHashMap;
typedef std::vector<struct kevent> TEventList;
TMonitorFileHashMap m_FileLists;
TEventList m_MonitoredEventLists;
TEventList m_TriggeredEventLists;
int m_KernelEventQueue;
};
#endif //FILEMONITOR_FREEBSD_INCLUDED

View File

@ -1,54 +0,0 @@
#include "stdafx.h"
#include "HackShield.h"
#include "HackShield_Impl.h"
#include "config.h"
bool CHackShieldManager::Initialize()
{
impl_ = M2_NEW CHackShieldImpl;
if (NULL == impl_)
{
return false;
}
return impl_->Initialize();
}
void CHackShieldManager::Release()
{
if (NULL != impl_)
{
impl_->Release();
M2_DELETE(impl_);
impl_ = NULL;
}
}
bool CHackShieldManager::CreateClientHandle(DWORD dwPlayerID)
{
return impl_->CreateClientHandle(dwPlayerID);
}
void CHackShieldManager::DeleteClientHandle(DWORD dwPlayerID)
{
impl_->DeleteClientHandle(dwPlayerID);
}
bool CHackShieldManager::SendCheckPacket(LPCHARACTER ch)
{
return impl_->SendCheckPacket(ch);
}
bool CHackShieldManager::VerifyAck(LPCHARACTER ch, const void* buf)
{
TPacketGCHSCheck* p = reinterpret_cast<TPacketGCHSCheck*>(const_cast<void*>(buf));
return impl_->VerifyAck(ch, p);
}

View File

@ -1,24 +0,0 @@
#ifndef HACK_SHIELD_MANAGER_H_
#define HACK_SHIELD_MANAGER_H_
class CHackShieldImpl;
class CHackShieldManager : public singleton<CHackShieldManager>
{
public:
bool Initialize ();
void Release ();
bool CreateClientHandle (DWORD dwPlayerID);
void DeleteClientHandle (DWORD dwPlayerID);
bool SendCheckPacket (LPCHARACTER ch);
bool VerifyAck (LPCHARACTER ch, const void* buf);
private:
CHackShieldImpl* impl_;
};
#endif /* HACK_SHIELD_MANAGER_H_ */

View File

@ -1,202 +0,0 @@
#include "stdafx.h"
#include "HackShield_Impl.h"
#ifdef __FreeBSD__
#include "char.h"
#include "packet.h"
#include "desc.h"
#include "log.h"
bool CHackShieldImpl::Initialize()
{
handle_ = _AhnHS_CreateServerObject("metin2client.bin.hsb");
if (ANTICPX_INVALID_HANDLE_VALUE == handle_)
{
return false;
}
sys_log(0, "HShield: Success to CreateServerObject");
return true;
}
void CHackShieldImpl::Release()
{
_AhnHS_CloseServerHandle(handle_);
sys_log(0, "HShield: Server Handle Closed");
}
bool CHackShieldImpl::CreateClientHandle(DWORD dwPlayerID)
{
ClientHandleContainer::const_iterator iter = CliehtHandleMap_.find( dwPlayerID );
if (iter != CliehtHandleMap_.end())
{
sys_log(0, "HShield: Client Handle is already created for Player(%u)", dwPlayerID);
return false;
}
AHNHS_CLIENT_HANDLE handle = _AhnHS_CreateClientObject(handle_);
if (ANTICPX_INVALID_HANDLE_VALUE == handle)
{
sys_log(0, "HShield: Failed to create client handle for Player(%u)", dwPlayerID);
return false;
}
CliehtHandleMap_.insert( std::make_pair(dwPlayerID, handle) );
sys_log(0, "HShield: Success to create client handle for Player(%u)", dwPlayerID);
return true;
}
void CHackShieldImpl::DeleteClientHandle(DWORD dwPlayerID)
{
ClientHandleContainer::iterator iter = CliehtHandleMap_.find( dwPlayerID );
if (iter == CliehtHandleMap_.end())
{
sys_log(0, "HShield: there is no client handle for Player(%u)", dwPlayerID);
return;
}
_AhnHS_CloseClientHandle(iter->second);
CliehtHandleMap_.erase(iter);
sys_log(0, "HShield: client handle deleted for Player(%u)", dwPlayerID);
}
bool CHackShieldImpl::SendCheckPacket(LPCHARACTER ch)
{
if (NULL == ch)
{
return false;
}
ClientHandleContainer::const_iterator iter = CliehtHandleMap_.find( ch->GetPlayerID() );
if (iter == CliehtHandleMap_.end())
{
sys_log(0, "HShield: Client Handle not create for Player(%u)", ch->GetPlayerID());
return false;
}
TPacketGCHSCheck pack;
pack.bHeader = HEADER_GC_HS_REQUEST;
memset( &pack.Req, 0, sizeof(pack.Req));
unsigned long ret = _AhnHS_MakeRequest( iter->second, &(pack.Req) );
if (0 != ret)
{
sys_log(0, "HShield: _AhnHS_MakeRequest return error(%u) for Player(%u)", ret, ch->GetPlayerID());
return false;
}
else
{
sys_log(0, "HShield: _AhnHS_MakeRequest success ret(%d)", ret);
}
if (NULL != ch->GetDesc())
{
ch->GetDesc()->Packet( &pack, sizeof(pack) );
sys_log(0, "HShield: Send Check Request for Player(%u)", ch->GetPlayerID());
return true;
}
sys_log(0, "HShield: Failed to get DESC for Player(%u)", ch->GetPlayerID());
return false;
}
bool CHackShieldImpl::VerifyAck(LPCHARACTER ch, TPacketGCHSCheck* buf)
{
if (NULL == ch)
{
return false;
}
bool NeedDisconnect = false;
ClientHandleContainer::const_iterator iter = CliehtHandleMap_.find( ch->GetPlayerID() );
if (iter == CliehtHandleMap_.end())
{
sys_log(0, "HShield: Cannot Find ClientHandle For Verify");
NeedDisconnect = true;
}
unsigned long dwError = 0;
unsigned long ret = _AhnHS_VerifyResponseEx( iter->second, buf->Req.byBuffer, buf->Req.nLength, &dwError );
if (ANTICPX_RECOMMAND_CLOSE_SESSION == ret)
{
sys_log(0, "HShield: not a valid ack ret(%u) error(%u) from Player(%u)", ret, dwError, ch->GetPlayerID());
NeedDisconnect = true;
ch->StopHackShieldCheckCycle();
}
if (NULL != ch->GetDesc())
{
if (true == NeedDisconnect)
{
ch->GetDesc()->SetPhase(PHASE_CLOSE);
LogManager::instance().HackShieldLog(dwError, ch);
return false;
}
else
{
ch->SetHackShieldCheckMode(false);
}
}
sys_log(0, "HShield: Valid Ack from Player(%u)", ch->GetPlayerID());
return true;
}
#else
bool CHackShieldImpl::Initialize()
{
return true;
}
void CHackShieldImpl::Release()
{
}
bool CHackShieldImpl::CreateClientHandle(DWORD dwPlayerID)
{
return true;
}
void CHackShieldImpl::DeleteClientHandle(DWORD dwPlayerID)
{
}
bool CHackShieldImpl::SendCheckPacket(LPCHARACTER ch)
{
return true;
}
bool CHackShieldImpl::VerifyAck(LPCHARACTER ch, TPacketGCHSCheck* buf)
{
return true;
}
#endif

View File

@ -1,51 +0,0 @@
#ifndef HACK_SHIELD_IMPL_H_
#define HACK_SHIELD_IMPL_H_
#include <boost/unordered_map.hpp>
#ifdef __FreeBSD__
// Live build only
#define UNIX
#include <AntiCpXSvr.h>
#undef UNIX
#endif
#pragma pack(1)
typedef struct SPacketGCHSCheck
{
BYTE bHeader;
#ifdef __FreeBSD__
AHNHS_TRANS_BUFFER Req;
#endif
} TPacketGCHSCheck;
#pragma pack()
class CHackShieldImpl
{
public:
bool Initialize ();
void Release ();
bool CreateClientHandle (DWORD dwPlayerID);
void DeleteClientHandle (DWORD dwPlayerID);
bool SendCheckPacket (LPCHARACTER ch);
bool VerifyAck (LPCHARACTER ch, TPacketGCHSCheck* buf);
private:
#ifdef __FreeBSD__
AHNHS_SERVER_HANDLE handle_;
typedef boost::unordered_map<DWORD, AHNHS_CLIENT_HANDLE> ClientHandleContainer;
ClientHandleContainer CliehtHandleMap_;
typedef boost::unordered_map<DWORD, bool> ClientCheckContainer;
ClientCheckContainer ClientCheckMap_;
#endif
};
#endif /* HACK_SHIELD_IMPL_H_ */

View File

@ -2,7 +2,7 @@
#define IFILEMONITOR_INCLUDED #define IFILEMONITOR_INCLUDED
//#include <boost/function.hpp> //#include <boost/function.hpp>
#include <boost/unordered_map.hpp> #include <unordered_map>
enum eFileUpdatedOptions enum eFileUpdatedOptions
{ {

View File

@ -2,7 +2,7 @@
#define __INC_METIN_II_MARKIMAGE_H__ #define __INC_METIN_II_MARKIMAGE_H__
#include <IL/il.h> #include <IL/il.h>
#include "minilzo.h" #include <lzo/lzo1x.h>
typedef unsigned long Pixel; typedef unsigned long Pixel;

View File

@ -95,7 +95,7 @@ private:
class CPetSystem class CPetSystem
{ {
public: public:
typedef boost::unordered_map<DWORD, CPetActor*> TPetActorMap; /// <VNUM, PetActor> map. (한 캐릭터가 같은 vnum의 펫을 여러개 가질 일이 있을까..??) typedef std::unordered_map<DWORD, CPetActor*> TPetActorMap; /// <VNUM, PetActor> map. (한 캐릭터가 같은 vnum의 펫을 여러개 가질 일이 있을까..??)
public: public:
CPetSystem(LPCHARACTER owner); CPetSystem(LPCHARACTER owner);

View File

@ -1,329 +0,0 @@
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#if defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64)
#include <io.h>
#include <windows.h>
#include <tchar.h>
#else
#include <dlfcn.h>
#include <unistd.h>
#endif
#include <XTrap_S_Interface.h>
#include "char.h"
#include "config.h"
#include "event.h"
#include "log.h"
#include "desc.h"
#include "packet.h"
#include "XTrapManager.h"
#define CSFILE_NUM 2
#define XTRAP_CS1_CHECK_CYCLE PASSES_PER_SEC(20) // per 20sec
unsigned char g_XTrap_ClientMap[CSFILE_NUM][XTRAP_CS4_BUFSIZE_MAP];
struct CXTrapManager::sXTrapContext
{
//API function pointers
PFN_XTrap_S_Start XTrap_S_Start;
PFN_XTrap_S_SessionInit XTrap_S_SessionInit;
PFN_XTrap_CS_Step1 XTrap_CS_Step1;
PFN_XTrap_CS_Step3 XTrap_CS_Step3;
PFN_XTrap_S_SetActiveCode XTrap_S_SetActiveCode;
PFN_XTrap_S_SetOption XTrap_S_SetOption;
PFN_XTrap_S_SetAllowDelay XTrap_S_SetAllowDelay;
PFN_XTrap_S_SendGamePacket XTrap_S_SendGamePacket;
PFN_XTrap_S_RecvGamePacket XTrap_S_RecvGamePacket;
//handle
void* hXTrap4Server;
};
CXTrapManager::CXTrapManager()
{
m_pImpl = M2_NEW sXTrapContext;
memset( m_pImpl, 0x00, sizeof(sXTrapContext) );
}
CXTrapManager::~CXTrapManager()
{
#ifdef __FreeBSD__
if (m_pImpl->hXTrap4Server)
{
dlclose(m_pImpl->hXTrap4Server);
}
#endif
M2_DELETE(m_pImpl);
}
#ifdef __FreeBSD__
void CXTrapManager::MapReloadSignalHandler( int signal )
{
for(int i=0; i<CSFILE_NUM; ++i )
{
if( Instance().LoadClientMapFile(i) )
sys_log(0, "client map file(map%d).CS3 is reloaded", i+1 );
}
}
void CXTrapManager::NotifyMapFileChanged( const std::string& fileName, eFileUpdatedOptions eUpdateOption )
{
MapReloadSignalHandler(1);
}
#endif
bool CXTrapManager::LoadXTrapModule()
{
#ifdef __FreeBSD__
//first load client mapfile
bool bClientMapFileLoaded = false;
for(int i=0; i<CSFILE_NUM; ++i )
{
if( LoadClientMapFile(i) )
{
bClientMapFileLoaded = true;
}
}
if( !bClientMapFileLoaded )
{
sys_err("XTrap-failed to load at least one client map file. map file name should be map1.CS3 or map2.CS3");
return false;
}
//load shared objects
char sDllBinFile[] ="./libXTrap4Server.so";
m_pImpl->hXTrap4Server = dlopen(sDllBinFile, RTLD_LAZY);
if (m_pImpl->hXTrap4Server == 0)
{
sys_err("XTrap-failed to load so reason:%s", dlerror()) ;
return false;
}
void* hXTrapHandle = m_pImpl->hXTrap4Server;
m_pImpl->XTrap_S_Start = (PFN_XTrap_S_Start) dlsym(hXTrapHandle, "XTrap_S_Start");
m_pImpl->XTrap_S_SessionInit = (PFN_XTrap_S_SessionInit) dlsym(hXTrapHandle, "XTrap_S_SessionInit");
m_pImpl->XTrap_CS_Step1 = (PFN_XTrap_CS_Step1) dlsym(hXTrapHandle, "XTrap_CS_Step1");
m_pImpl->XTrap_CS_Step3 = (PFN_XTrap_CS_Step3) dlsym(hXTrapHandle, "XTrap_CS_Step3");
m_pImpl->XTrap_S_SetActiveCode = (PFN_XTrap_S_SetActiveCode) dlsym(hXTrapHandle, "XTrap_S_SetActiveCode");
m_pImpl->XTrap_S_SetOption = (PFN_XTrap_S_SetOption) dlsym(hXTrapHandle, "XTrap_S_SetOption");
m_pImpl->XTrap_S_SetAllowDelay = (PFN_XTrap_S_SetAllowDelay) dlsym(hXTrapHandle, "XTrap_S_SetAllowDelay");
m_pImpl->XTrap_S_SendGamePacket = (PFN_XTrap_S_SendGamePacket) dlsym(hXTrapHandle, "XTrap_S_SendGamePacket");
m_pImpl->XTrap_S_RecvGamePacket = (PFN_XTrap_S_RecvGamePacket) dlsym(hXTrapHandle, "XTrap_S_RecvGamePacket");
if (m_pImpl->XTrap_S_Start == NULL ||
m_pImpl->XTrap_S_SessionInit == NULL ||
m_pImpl->XTrap_CS_Step1 == NULL ||
m_pImpl->XTrap_CS_Step3 == NULL ||
m_pImpl->XTrap_S_SetOption == NULL ||
m_pImpl->XTrap_S_SetAllowDelay == NULL ||
m_pImpl->XTrap_S_SendGamePacket == NULL ||
m_pImpl->XTrap_S_RecvGamePacket == NULL)
{
sys_err("XTrap-failed to load function ptrs");
return false;
}
//start server module
m_pImpl->XTrap_S_Start( 600, CSFILE_NUM, g_XTrap_ClientMap, NULL );
//NOTE : 일단 XProtect모듈에 버그가 있어서 코드영역 체크를 끈다.
m_pImpl->XTrap_S_SetActiveCode( XTRAP_ACTIVE_CODE_THEMIDA );
//setup signal
signal(SIGUSR2, CXTrapManager::MapReloadSignalHandler);
#endif
return true;
}
bool CXTrapManager::LoadClientMapFile( unsigned int iMapIndex )
{
#ifdef __FreeBSD__
//index check
if( iMapIndex >= CSFILE_NUM )
{
return false;
}
char szFileName[1024] = {0,};
snprintf(szFileName, sizeof(szFileName), "map%d.CS3", iMapIndex+1);
FILE* fi = 0;
fi = fopen(szFileName, "rb");
if (fi == NULL)
{
return false;
}
fread(g_XTrap_ClientMap[iMapIndex], XTRAP_CS4_BUFSIZE_MAP, 1, fi);
fclose(fi);
#endif
return true;
}
EVENTINFO(xtrap_cs1_check_info)
{
DynamicCharacterPtr ptrPC;
};
EVENTFUNC(xtrap_cs1_check_event)
{
xtrap_cs1_check_info* info = dynamic_cast<xtrap_cs1_check_info*>( event->info );
if ( info == NULL )
{
sys_err( "<xtrap_event> info null pointer" );
return 0;
}
TPacketXTrapCSVerify pack;
pack.bHeader = HEADER_GC_XTRAP_CS1_REQUEST;
bool bSuccess = CXTrapManager::instance().Verify_CSStep1( info->ptrPC, pack.bPacketData );
LPDESC lpClientDesc = info->ptrPC.Get()->GetDesc();
if( !lpClientDesc )
{
sys_err( "<xtrap_event> client session is invalid" );
return 0;
}
lpClientDesc->Packet( &pack, sizeof(pack) );
if( bSuccess )
{
return XTRAP_CS1_CHECK_CYCLE;
}
sys_err( "XTrap: hack is detected %s", lpClientDesc->GetHostName() );
info->ptrPC.Get()->Disconnect("XTrapCheckInvalid");
lpClientDesc->SetPhase(PHASE_CLOSE);
return 0;
}
bool CXTrapManager::CreateClientSession( LPCHARACTER lpCharSession )
{
if( !bXTrapEnabled )
return true;
if( !lpCharSession )
return false;
DWORD dwSessionID = lpCharSession->GetPlayerID();
ClientSessionMap::iterator it = m_mapClientSessions.find( dwSessionID );
if( it != m_mapClientSessions.end() )
{
sys_err("XTrap: client session is alreay registered");
return false;
}
//init session info
sSessionInfo infoData;
//xtrap session init
DWORD dwReturn = m_pImpl->XTrap_S_SessionInit( 600, CSFILE_NUM, g_XTrap_ClientMap, infoData.szSessionBuf );
if( dwReturn != 0 )
{
sys_err("XTrap: client session init failed");
}
xtrap_cs1_check_info* event_info = AllocEventInfo<xtrap_cs1_check_info>();
event_info->ptrPC = lpCharSession;
infoData.m_pCheckEvent = event_create(xtrap_cs1_check_event, event_info, XTRAP_CS1_CHECK_CYCLE);
m_mapClientSessions[dwSessionID] = infoData;
return true;
}
void CXTrapManager::DestroyClientSession( LPCHARACTER lpCharSession )
{
if( !bXTrapEnabled )
return;
if( !lpCharSession )
return;
DWORD dwSessionID = lpCharSession->GetPlayerID();
ClientSessionMap::iterator it = m_mapClientSessions.find( dwSessionID );
if( it == m_mapClientSessions.end() )
{
sys_err("XTrap: client session is already destroyed");
return;
}
event_cancel(&(it->second.m_pCheckEvent) );
m_mapClientSessions.erase(it);
}
bool CXTrapManager::Verify_CSStep1( LPCHARACTER lpCharSession, BYTE* pBufData )
{
if( !bXTrapEnabled )
return false;
if( !lpCharSession )
return false;
DWORD dwSessionID = lpCharSession->GetPlayerID();
ClientSessionMap::iterator it = m_mapClientSessions.find( dwSessionID );
if( it == m_mapClientSessions.end() )
{
sys_err("XTrap: client session is already destroyed");
return false;
}
int nReturn = m_pImpl->XTrap_CS_Step1( it->second.szSessionBuf, it->second.szPackBuf );
memcpy( pBufData, it->second.szPackBuf, VERIFY_PACK_LEN );
return (nReturn == 0) ? true : false;
}
void CXTrapManager::Verify_CSStep3( LPCHARACTER lpCharSession, BYTE* pBufData )
{
if( !bXTrapEnabled )
return;
if( !lpCharSession )
return;
DWORD dwSessionID = lpCharSession->GetPlayerID();
ClientSessionMap::iterator it = m_mapClientSessions.find( dwSessionID );
if( it == m_mapClientSessions.end() )
{
sys_log(0, "XTrap: client session is alreay destroyed");
return;
}
memcpy( it->second.szPackBuf, pBufData, VERIFY_PACK_LEN );
m_pImpl->XTrap_CS_Step3( it->second.szSessionBuf, it->second.szPackBuf );
//if( XTRAP_API_RETURN_DETECTHACK == m_pImpl->XTrap_CS_Step3( it->second.szSessionBuf, pBufData ) )
//{
// sys_error(0, "XTrap: client session is alreay destroyed");
//}
}

View File

@ -1,67 +0,0 @@
#ifndef _XTRAP_MANAGER_H_
#define _XTRAP_MANAGER_H_
#include "IFileMonitor.h"
#define SESSION_BUF_LEN 320
#define VERIFY_PACK_LEN 128
#define SESSION_CSSTEP1_LEN 256
#pragma pack(1)
typedef struct PacketXTrapVerify
{
BYTE bHeader;
BYTE bPacketData[VERIFY_PACK_LEN];
} TPacketXTrapCSVerify;
#pragma pack()
class CXTrapManager : public singleton<CXTrapManager>
{
public:
CXTrapManager();
virtual ~CXTrapManager();
bool LoadXTrapModule();
bool LoadClientMapFile( unsigned int iMapIndex );
bool CreateClientSession( LPCHARACTER lpCharSession );
void DestroyClientSession( LPCHARACTER lpCharSession );
bool Verify_CSStep1( LPCHARACTER lpCharSession, BYTE* pOutBufData );
void Verify_CSStep3( LPCHARACTER lpCharSession, BYTE* pBufData );
#ifdef __FreeBSD__
static void MapReloadSignalHandler( int signal );
static void NotifyMapFileChanged( const std::string& fileName, eFileUpdatedOptions eUpdateOption );
#endif
private:
//pimpl`s idiom
struct sXTrapContext;
sXTrapContext* m_pImpl;
struct sSessionInfo
{
sSessionInfo()
{
m_pCheckEvent = NULL;
memset(szSessionBuf, 0x00, sizeof(szSessionBuf) );
memset(szPackBuf, 0x00, sizeof(szPackBuf) );
}
BYTE szSessionBuf[SESSION_BUF_LEN];
BYTE szPackBuf[VERIFY_PACK_LEN];
LPEVENT m_pCheckEvent;
};
typedef boost::unordered_map<DWORD, sSessionInfo> ClientSessionMap;
ClientSessionMap m_mapClientSessions;
};
#endif /* _XTRAP_MANAGER_H_ */

View File

@ -3,7 +3,7 @@
#include <libsql/include/AsyncSQL.h> #include <libsql/include/AsyncSQL.h>
#include <common/auction_table.h> #include <common/auction_table.h>
#include <boost/unordered_map.hpp> #include <unordered_map>
#include <algorithm> #include <algorithm>
#define GRADE_LOW 30 #define GRADE_LOW 30
@ -55,11 +55,11 @@ public:
private: private:
typedef boost::unordered_map <DWORD, TAuctionItemInfo*> TItemInfoMap; typedef std::unordered_map <DWORD, TAuctionItemInfo*> TItemInfoMap;
TItemInfoMap item_map; TItemInfoMap item_map;
typedef std::map <DWORD, TAuctionItemInfo*> TItemMap; typedef std::map <DWORD, TAuctionItemInfo*> TItemMap;
typedef boost::unordered_map <DWORD, TItemMap*> TPCMap; typedef std::unordered_map <DWORD, TItemMap*> TPCMap;
TPCMap offer_map; TPCMap offer_map;
@ -83,11 +83,11 @@ public:
class SaleBoard class SaleBoard
{ {
private: private:
typedef boost::unordered_map <DWORD, TSaleItemInfo*> TItemInfoMap; typedef std::unordered_map <DWORD, TSaleItemInfo*> TItemInfoMap;
TItemInfoMap item_map; TItemInfoMap item_map;
typedef std::map <DWORD, TSaleItemInfo*> TItemMap; typedef std::map <DWORD, TSaleItemInfo*> TItemMap;
typedef boost::unordered_map <DWORD, TItemMap*> TPCMap; typedef std::unordered_map <DWORD, TItemMap*> TPCMap;
TPCMap wisher_map; TPCMap wisher_map;
TPCMap seller_map; TPCMap seller_map;
@ -111,7 +111,7 @@ class WishBoard
{ {
private: private:
typedef std::map <DWORD, TWishItemInfo*> TItemMap; typedef std::map <DWORD, TWishItemInfo*> TItemMap;
typedef boost::unordered_map <DWORD, TItemMap*> TPCMap; typedef std::unordered_map <DWORD, TItemMap*> TPCMap;
TPCMap wisher_map; TPCMap wisher_map;
public: public:
@ -130,7 +130,7 @@ class MyBidBoard
private: private:
typedef std::pair <int, bool> BidInfo; typedef std::pair <int, bool> BidInfo;
typedef std::map <DWORD, BidInfo > TItemMap; typedef std::map <DWORD, BidInfo > TItemMap;
typedef boost::unordered_map <DWORD, TItemMap*> TMyBidBoard; typedef std::unordered_map <DWORD, TItemMap*> TMyBidBoard;
// bidder_id가 key // bidder_id가 key
TMyBidBoard pc_map; TMyBidBoard pc_map;
@ -153,7 +153,7 @@ public:
class AuctionManager : public singleton <AuctionManager> class AuctionManager : public singleton <AuctionManager>
{ {
private : private :
typedef boost::unordered_map<DWORD, LPITEM> TItemMap; typedef std::unordered_map<DWORD, LPITEM> TItemMap;
TItemMap auction_item_map; TItemMap auction_item_map;
// auction에 등록된 정보 중 가격, 등등 아이템 테이블에 포함되지 않는 정보들을 관리하는 것들 // auction에 등록된 정보 중 가격, 등등 아이템 테이블에 포함되지 않는 정보들을 관리하는 것들

View File

@ -2,7 +2,7 @@
#ifndef BANWORD_MANAGER_H_ #ifndef BANWORD_MANAGER_H_
#define BANWORD_MANAGER_H_ #define BANWORD_MANAGER_H_
#include <boost/unordered_map.hpp> #include <unordered_map>
class CBanwordManager : public singleton<CBanwordManager> class CBanwordManager : public singleton<CBanwordManager>
{ {
@ -16,7 +16,7 @@ class CBanwordManager : public singleton<CBanwordManager>
void ConvertString(char * c_pszString, size_t _len); void ConvertString(char * c_pszString, size_t _len);
protected: protected:
typedef boost::unordered_map<std::string, bool> TBanwordHashmap; typedef std::unordered_map<std::string, bool> TBanwordHashmap;
TBanwordHashmap m_hashmap_words; TBanwordHashmap m_hashmap_words;
}; };

View File

@ -53,9 +53,7 @@
#include "gm.h" #include "gm.h"
#include "map_location.h" #include "map_location.h"
#include "BlueDragon_Binder.h" #include "BlueDragon_Binder.h"
#include "HackShield.h"
#include "skill_power.h" #include "skill_power.h"
#include "XTrapManager.h"
#include "buff_on_attributes.h" #include "buff_on_attributes.h"
#ifdef __PET_SYSTEM__ #ifdef __PET_SYSTEM__
@ -358,9 +356,6 @@ void CHARACTER::Initialize()
m_dwLastGoldDropTime = 0; m_dwLastGoldDropTime = 0;
m_HackShieldCheckEvent = NULL;
m_HackShieldCheckMode = false;
m_bIsLoadedAffect = false; m_bIsLoadedAffect = false;
cannot_dead = false; cannot_dead = false;
@ -428,14 +423,6 @@ void CHARACTER::Destroy()
if (GetRider()) if (GetRider())
GetRider()->ClearHorseInfo(); GetRider()->ClearHorseInfo();
if( IsPC() )
{
if (isHackShieldEnable)
{
CHackShieldManager::instance().DeleteClientHandle(GetPlayerID());
}
}
if (GetDesc()) if (GetDesc())
{ {
GetDesc()->BindCharacter(NULL); GetDesc()->BindCharacter(NULL);
@ -528,8 +515,6 @@ void CHARACTER::Destroy()
event_cancel(&m_pkMiningEvent); event_cancel(&m_pkMiningEvent);
// END_OF_MINING // END_OF_MINING
StopHackShieldCheckCycle();
for (itertype(m_mapMobSkillEvent) it = m_mapMobSkillEvent.begin(); it != m_mapMobSkillEvent.end(); ++it) for (itertype(m_mapMobSkillEvent) it = m_mapMobSkillEvent.begin(); it != m_mapMobSkillEvent.end(); ++it)
{ {
LPEVENT pkEvent = it->second; LPEVENT pkEvent = it->second;
@ -1407,8 +1392,6 @@ void CHARACTER::Disconnect(const char * c_pszReason)
// BindDesc(NULL); // BindDesc(NULL);
} }
CXTrapManager::instance().DestroyClientSession(this);
M2_DESTROY_CHARACTER(this); M2_DESTROY_CHARACTER(this);
} }
@ -3692,7 +3675,7 @@ void CHARACTER::ApplyPoint(BYTE bApplyType, int iVal)
if (0 == iAdd) if (0 == iAdd)
iChange = -iChange; iChange = -iChange;
boost::unordered_map<BYTE, int>::iterator iter = m_SkillDamageBonus.find(bSkillVnum); std::unordered_map<BYTE, int>::iterator iter = m_SkillDamageBonus.find(bSkillVnum);
if (iter == m_SkillDamageBonus.end()) if (iter == m_SkillDamageBonus.end())
m_SkillDamageBonus.insert(std::make_pair(bSkillVnum, iChange)); m_SkillDamageBonus.insert(std::make_pair(bSkillVnum, iChange));

View File

@ -1,7 +1,7 @@
#ifndef __INC_METIN_II_CHAR_H__ #ifndef __INC_METIN_II_CHAR_H__
#define __INC_METIN_II_CHAR_H__ #define __INC_METIN_II_CHAR_H__
#include <boost/unordered_map.hpp> #include <unordered_map>
#include <common/stl.h> #include <common/stl.h>
#include "entity.h" #include "entity.h"
@ -455,7 +455,7 @@ struct TSkillUseInfo
DWORD dwVID; DWORD dwVID;
bool isGrandMaster; bool isGrandMaster;
boost::unordered_map<VID, size_t> TargetVIDMap; std::map<VID, size_t> TargetVIDMap;
TSkillUseInfo() TSkillUseInfo()
: iHitCount(0), iMaxHitCount(0), iSplashCount(0), dwNextSkillUsableTime(0), iRange(0), bUsed(false), : iHitCount(0), iMaxHitCount(0), iSplashCount(0), dwNextSkillUsableTime(0), iRange(0), bUsed(false),
@ -1449,7 +1449,7 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
// //
protected: protected:
TPlayerSkill* m_pSkillLevels; TPlayerSkill* m_pSkillLevels;
boost::unordered_map<BYTE, int> m_SkillDamageBonus; std::unordered_map<BYTE, int> m_SkillDamageBonus;
std::map<int, TSkillUseInfo> m_SkillUseInfo; std::map<int, TSkillUseInfo> m_SkillUseInfo;
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
@ -1939,18 +1939,6 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
private: private:
DWORD m_dwLastGoldDropTime; DWORD m_dwLastGoldDropTime;
public:
void StartHackShieldCheckCycle(int seconds);
void StopHackShieldCheckCycle();
bool GetHackShieldCheckMode() const { return m_HackShieldCheckMode; }
void SetHackShieldCheckMode(bool m) { m_HackShieldCheckMode = m; }
LPEVENT m_HackShieldCheckEvent;
private:
bool m_HackShieldCheckMode;
public: public:
void AutoRecoveryItemProcess (const EAffectTypes); void AutoRecoveryItemProcess (const EAffectTypes);

View File

@ -32,7 +32,7 @@ int CHARACTER::ChangeEmpire(BYTE empire)
"SELECT id, pid1, pid2, pid3, pid4 FROM player_index%s WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u", "SELECT id, pid1, pid2, pid3, pid4 FROM player_index%s WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u",
get_table_postfix(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire()); get_table_postfix(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());
std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery));
if (msg->Get()->uiNumRows == 0) if (msg->Get()->uiNumRows == 0)
{ {
@ -105,7 +105,7 @@ int CHARACTER::ChangeEmpire(BYTE empire)
snprintf(szQuery, sizeof(szQuery), "UPDATE player_index%s SET empire=%u WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u", snprintf(szQuery, sizeof(szQuery), "UPDATE player_index%s SET empire=%u WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u",
get_table_postfix(), empire, GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire()); get_table_postfix(), empire, GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());
std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery));
if (msg->Get()->uiAffectedRows > 0) if (msg->Get()->uiAffectedRows > 0)
{ {
@ -173,7 +173,7 @@ void CHARACTER::SetChangeEmpireCount()
snprintf(szQuery, sizeof(szQuery), "UPDATE change_empire SET change_count=%d WHERE account_id=%u", count, dwAID); snprintf(szQuery, sizeof(szQuery), "UPDATE change_empire SET change_count=%d WHERE account_id=%u", count, dwAID);
} }
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
} }
DWORD CHARACTER::GetAID() const DWORD CHARACTER::GetAID() const

View File

@ -1,93 +0,0 @@
#include "stdafx.h"
#include "char.h"
#include "config.h"
#include "event.h"
#include "HackShield.h"
#include "log.h"
#include "desc.h"
#include "packet.h"
EVENTINFO(hackshield_event_info)
{
DynamicCharacterPtr CharPtr;
};
EVENTFUNC(hackshield_event)
{
hackshield_event_info* info = dynamic_cast<hackshield_event_info*>( event->info );
if ( info == NULL )
{
sys_err( "hackshield_event> <Factor> Null pointer" );
return 0;
}
LPCHARACTER ch = info->CharPtr;
if (NULL == ch)
{
sys_err("HShield: character pointer is null");
return 0;
}
if (NULL == ch->GetDesc())
{
sys_err("HShield: character has no descriptor");
return 0;
}
if (false == ch->GetHackShieldCheckMode())
{
if (false == CHackShieldManager::instance().SendCheckPacket(ch))
{
return 0;
}
else
{
ch->SetHackShieldCheckMode(true);
return HackShield_CheckCycleTime;
}
}
sys_log(0, "HShield: no response from Player(%u)", ch->GetPlayerID());
LogManager::instance().HackShieldLog(0, ch);
ch->m_HackShieldCheckEvent = NULL;
ch->GetDesc()->SetPhase(PHASE_CLOSE);
return 0;
}
void CHARACTER::StartHackShieldCheckCycle(int seconds)
{
StopHackShieldCheckCycle();
if (false == isHackShieldEnable)
return;
hackshield_event_info* info = AllocEventInfo<hackshield_event_info>();
info->CharPtr = this;
m_HackShieldCheckEvent = event_create(hackshield_event, info, seconds);
sys_log(0, "HShield: StartHackShieldCheckCycle %d", seconds);
}
void CHARACTER::StopHackShieldCheckCycle()
{
if (NULL != m_HackShieldCheckEvent)
{
event_cancel(&m_HackShieldCheckEvent);
m_HackShieldCheckEvent = NULL;
sys_log(0, "HShield: StopHackShieldCheckCycle");
}
}

View File

@ -15,7 +15,6 @@
#include "questmanager.h" #include "questmanager.h"
#include "questlua.h" #include "questlua.h"
#include "locale_service.h" #include "locale_service.h"
#include "XTrapManager.h"
#ifndef __GNUC__ #ifndef __GNUC__
#include <boost/bind.hpp> #include <boost/bind.hpp>
@ -713,15 +712,6 @@ void CHARACTER_MANAGER::Update(int iPulse)
for (itertype(m_map_dwMobKillCount) it = m_map_dwMobKillCount.begin(); it != m_map_dwMobKillCount.end(); ++it) for (itertype(m_map_dwMobKillCount) it = m_map_dwMobKillCount.begin(); it != m_map_dwMobKillCount.end(); ++it)
DBManager::instance().SendMoneyLog(MONEY_LOG_MONSTER_KILL, it->first, it->second); DBManager::instance().SendMoneyLog(MONEY_LOG_MONSTER_KILL, it->first, it->second);
#ifdef _USE_SERVER_KEY_
extern bool Metin2Server_IsInvalid();
extern bool g_bShutdown;
if (Metin2Server_IsInvalid())
{
g_bShutdown = true;
}
#endif
m_map_dwMobKillCount.clear(); m_map_dwMobKillCount.clear();
} }

View File

@ -17,7 +17,7 @@ class CharacterVectorInteractor;
class CHARACTER_MANAGER : public singleton<CHARACTER_MANAGER> class CHARACTER_MANAGER : public singleton<CHARACTER_MANAGER>
{ {
public: public:
typedef TR1_NS::unordered_map<std::string, LPCHARACTER> NAME_MAP; typedef std::unordered_map<std::string, LPCHARACTER> NAME_MAP;
CHARACTER_MANAGER(); CHARACTER_MANAGER();
virtual ~CHARACTER_MANAGER(); virtual ~CHARACTER_MANAGER();
@ -119,8 +119,8 @@ class CHARACTER_MANAGER : public singleton<CHARACTER_MANAGER>
int m_iUserDamageRatePremium; int m_iUserDamageRatePremium;
int m_iVIDCount; int m_iVIDCount;
TR1_NS::unordered_map<DWORD, LPCHARACTER> m_map_pkChrByVID; std::unordered_map<DWORD, LPCHARACTER> m_map_pkChrByVID;
TR1_NS::unordered_map<DWORD, LPCHARACTER> m_map_pkChrByPID; std::unordered_map<DWORD, LPCHARACTER> m_map_pkChrByPID;
NAME_MAP m_map_pkPCChr; NAME_MAP m_map_pkPCChr;
char dummy1[1024]; // memory barrier char dummy1[1024]; // memory barrier
@ -146,7 +146,7 @@ class CHARACTER_MANAGER : public singleton<CHARACTER_MANAGER>
template<class Func> template<class Func>
Func CHARACTER_MANAGER::for_each_pc(Func f) Func CHARACTER_MANAGER::for_each_pc(Func f)
{ {
TR1_NS::unordered_map<DWORD, LPCHARACTER>::iterator it; std::unordered_map<DWORD, LPCHARACTER>::iterator it;
for (it = m_map_pkChrByPID.begin(); it != m_map_pkChrByPID.end(); ++it) for (it = m_map_pkChrByPID.begin(); it != m_map_pkChrByPID.end(); ++it)
f(it->second); f(it->second);

View File

@ -3556,7 +3556,7 @@ bool CHARACTER::CheckSkillHitCount(const BYTE SkillID, const VID TargetVID)
return false; return false;
} }
boost::unordered_map<VID, size_t>::iterator iterTargetMap = rSkillUseInfo.TargetVIDMap.find(TargetVID); auto iterTargetMap = rSkillUseInfo.TargetVIDMap.find(TargetVID);
if (rSkillUseInfo.TargetVIDMap.end() != iterTargetMap) if (rSkillUseInfo.TargetVIDMap.end() != iterTargetMap)
{ {

View File

@ -1,4 +0,0 @@
#include "check_server.h"
std::vector<std::string> CheckServer::keys_;
bool CheckServer::fail_ = true;

View File

@ -1,48 +0,0 @@
#ifndef _M2_CHECK_SERVER_KEY_H_
#define _M2_CHECK_SERVER_KEY_H_
#include <string>
#include <vector>
#include "CheckServerKey.h"
class CheckServer
{
public:
static FORCEINLINE void AddServerKey(const char* serverKey)
{
keys_.push_back(serverKey);
}
static FORCEINLINE bool CheckIp(const char* ip)
{
// 디파인 안걸리면 체크 안함
#ifndef _USE_SERVER_KEY_
fail_ = false;
return true;
#endif
for (int i = 0; i < keys_.size(); i++)
{
// 하나라도 맞는 서버키가 있으면 ok
std::string errorString;
if (CheckServerKey(keys_[i].c_str(), ip, "", errorString))
{
fail_ = false;
break;
}
}
return !IsFail();
}
static FORCEINLINE bool IsFail()
{
return fail_;
}
private:
static std::vector<std::string> keys_;
static bool fail_;
};
#endif // #ifndef _M2_CHECK_SERVER_KEY_H_

View File

@ -29,7 +29,6 @@
#include <cryptopp/shacal2.h> #include <cryptopp/shacal2.h>
#include <cryptopp/skipjack.h> #include <cryptopp/skipjack.h>
#include <cryptopp/tea.h> #include <cryptopp/tea.h>
#include <cryptopp/cryptoppLibLink.h>
using namespace CryptoPP; using namespace CryptoPP;
@ -192,8 +191,8 @@ bool Cipher::SetUp(bool polarity) {
BlockCipherAlgorithm* detail_1 = BlockCipherAlgorithm::Pick(hint_1); BlockCipherAlgorithm* detail_1 = BlockCipherAlgorithm::Pick(hint_1);
assert(detail_0 != NULL); assert(detail_0 != NULL);
assert(detail_1 != NULL); assert(detail_1 != NULL);
std::auto_ptr<BlockCipherAlgorithm> algorithm_0(detail_0); std::unique_ptr<BlockCipherAlgorithm> algorithm_0(detail_0);
std::auto_ptr<BlockCipherAlgorithm> algorithm_1(detail_1); std::unique_ptr<BlockCipherAlgorithm> algorithm_1(detail_1);
const size_t key_length_0 = algorithm_0->GetDefaultKeyLength(); const size_t key_length_0 = algorithm_0->GetDefaultKeyLength();
const size_t iv_length_0 = algorithm_0->GetBlockSize(); const size_t iv_length_0 = algorithm_0->GetBlockSize();

View File

@ -28,7 +28,7 @@ class Cipher {
if (!activated_) { if (!activated_) {
return; return;
} }
encoder_->ProcessData((byte*)buffer, (const byte*)buffer, length); encoder_->ProcessData((CryptoPP::byte*)buffer, (const CryptoPP::byte*)buffer, length);
} }
// Decrypts the given block of data. (no padding required) // Decrypts the given block of data. (no padding required)
void Decrypt(void* buffer, size_t length) { void Decrypt(void* buffer, size_t length) {
@ -36,7 +36,7 @@ class Cipher {
if (!activated_) { if (!activated_) {
return; return;
} }
decoder_->ProcessData((byte*)buffer, (const byte*)buffer, length); decoder_->ProcessData((CryptoPP::byte*)buffer, (const CryptoPP::byte*)buffer, length);
} }
bool activated() const { return activated_; } bool activated() const { return activated_; }

View File

@ -974,17 +974,17 @@ ACMD(do_state)
snprintf(buf, sizeof(buf), "%s's State: ", tch->GetName()); snprintf(buf, sizeof(buf), "%s's State: ", tch->GetName());
if (tch->IsPosition(POS_FIGHTING)) if (tch->IsPosition(POS_FIGHTING))
strlcat(buf, "Battle", sizeof(buf)); strncat(buf, "Battle", sizeof(buf));
else if (tch->IsPosition(POS_DEAD)) else if (tch->IsPosition(POS_DEAD))
strlcat(buf, "Dead", sizeof(buf)); strncat(buf, "Dead", sizeof(buf));
else else
strlcat(buf, "Standing", sizeof(buf)); strncat(buf, "Standing", sizeof(buf));
if (ch->GetShop()) if (ch->GetShop())
strlcat(buf, ", Shop", sizeof(buf)); strncat(buf, ", Shop", sizeof(buf));
if (ch->GetExchange()) if (ch->GetExchange())
strlcat(buf, ", Exchange", sizeof(buf)); strncat(buf, ", Exchange", sizeof(buf));
ch->ChatPacket(CHAT_TYPE_INFO, "%s", buf); ch->ChatPacket(CHAT_TYPE_INFO, "%s", buf);

View File

@ -19,7 +19,6 @@
#include "dev_log.h" #include "dev_log.h"
#include "db.h" #include "db.h"
#include "skill_power.h" #include "skill_power.h"
#include "check_server.h"
using std::string; using std::string;
@ -121,12 +120,6 @@ bool LoadClientVersion();
bool g_protectNormalPlayer = false; // 범법자가 "평화모드" 인 일반유저를 공격하지 못함 bool g_protectNormalPlayer = false; // 범법자가 "평화모드" 인 일반유저를 공격하지 못함
bool g_noticeBattleZone = false; // 중립지대에 입장하면 안내메세지를 알려줌 bool g_noticeBattleZone = false; // 중립지대에 입장하면 안내메세지를 알려줌
bool isHackShieldEnable = false;
int HackShield_FirstCheckWaitTime = passes_per_sec * 30;
int HackShield_CheckCycleTime = passes_per_sec * 180;
bool bXTrapEnabled = false;
int gPlayerMaxLevel = 99; int gPlayerMaxLevel = 99;
bool g_BlockCharCreation = false; bool g_BlockCharCreation = false;
@ -560,7 +553,7 @@ void config_init(const string& st_localeServiceName)
char szQuery[512]; char szQuery[512];
snprintf(szQuery, sizeof(szQuery), "SELECT mKey, mValue FROM locale"); snprintf(szQuery, sizeof(szQuery), "SELECT mKey, mValue FROM locale");
std::auto_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery));
if (pMsg->Get()->uiNumRows == 0) if (pMsg->Get()->uiNumRows == 0)
{ {
@ -625,7 +618,7 @@ void config_init(const string& st_localeServiceName)
{ {
char szQuery[256]; char szQuery[256];
snprintf(szQuery, sizeof(szQuery), "SELECT mValue FROM locale WHERE mKey='SKILL_POWER_BY_LEVEL'"); snprintf(szQuery, sizeof(szQuery), "SELECT mValue FROM locale WHERE mKey='SKILL_POWER_BY_LEVEL'");
std::auto_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery));
if (pMsg->Get()->uiNumRows == 0) if (pMsg->Get()->uiNumRows == 0)
{ {
@ -666,7 +659,7 @@ void config_init(const string& st_localeServiceName)
for (int job = 0; job < JOB_MAX_NUM * 2; ++job) for (int job = 0; job < JOB_MAX_NUM * 2; ++job)
{ {
snprintf(szQuery, sizeof(szQuery), "SELECT mValue from locale where mKey='SKILL_POWER_BY_LEVEL_TYPE%d' ORDER BY CAST(mValue AS unsigned)", job); snprintf(szQuery, sizeof(szQuery), "SELECT mValue from locale where mKey='SKILL_POWER_BY_LEVEL_TYPE%d' ORDER BY CAST(mValue AS unsigned)", job);
std::auto_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery));
// 세팅이 안되어있으면 기본테이블을 사용한다. // 세팅이 안되어있으면 기본테이블을 사용한다.
if (pMsg->Get()->uiNumRows == 0) if (pMsg->Get()->uiNumRows == 0)
@ -1052,46 +1045,6 @@ void config_init(const string& st_localeServiceName)
str_to_number(g_noticeBattleZone, value_string); str_to_number(g_noticeBattleZone, value_string);
} }
TOKEN("hackshield_enable")
{
int flag = 0;
str_to_number(flag, value_string);
//if (1 == flag && LC_IsEurope() )
if (1 == flag)
{
isHackShieldEnable = true;
}
}
TOKEN("hackshield_first_check_time")
{
int secs = 30;
str_to_number(secs, value_string);
HackShield_FirstCheckWaitTime = passes_per_sec * secs;
}
TOKEN("hackshield_check_cycle_time")
{
int secs = 180;
str_to_number(secs, value_string);
HackShield_CheckCycleTime = passes_per_sec * secs;
}
TOKEN("xtrap_enable")
{
int flag = 0;
str_to_number(flag, value_string);
if (1 == flag )
{
bXTrapEnabled = true;
}
}
TOKEN("pk_protect_level") TOKEN("pk_protect_level")
{ {
str_to_number(PK_PROTECT_LEVEL, value_string); str_to_number(PK_PROTECT_LEVEL, value_string);
@ -1120,12 +1073,6 @@ void config_init(const string& st_localeServiceName)
continue; continue;
} }
TOKEN("server_key")
{
CheckServer::AddServerKey(value_string);
continue;
}
} }
if (g_setQuestObjectDir.empty()) if (g_setQuestObjectDir.empty())

View File

@ -107,11 +107,6 @@ extern bool g_noticeBattleZone; //
extern DWORD g_GoldDropTimeLimitValue; extern DWORD g_GoldDropTimeLimitValue;
extern bool isHackShieldEnable;
extern int HackShield_FirstCheckWaitTime;
extern int HackShield_CheckCycleTime;
extern bool bXTrapEnabled;
extern int gPlayerMaxLevel; extern int gPlayerMaxLevel;
extern bool g_BlockCharCreation; extern bool g_BlockCharCreation;

View File

@ -78,8 +78,8 @@ struct SItemNameAndLevel
// 자료구조나 이런거 병신인건 이해좀... 누구땜에 영혼이 없는 상태에서 만들었씀 // 자료구조나 이런거 병신인건 이해좀... 누구땜에 영혼이 없는 상태에서 만들었씀
typedef std::vector<SCubeMaterialInfo> TCubeResultList; typedef std::vector<SCubeMaterialInfo> TCubeResultList;
typedef boost::unordered_map<DWORD, TCubeResultList> TCubeMapByNPC; // 각각의 NPC별로 어떤 걸 만들 수 있고 재료가 뭔지... typedef std::unordered_map<DWORD, TCubeResultList> TCubeMapByNPC; // 각각의 NPC별로 어떤 걸 만들 수 있고 재료가 뭔지...
typedef boost::unordered_map<DWORD, std::string> TCubeResultInfoTextByNPC; // 각각의 NPC별로 만들 수 있는 목록을 정해진 포맷으로 정리한 정보 typedef std::unordered_map<DWORD, std::string> TCubeResultInfoTextByNPC; // 각각의 NPC별로 만들 수 있는 목록을 정해진 포맷으로 정리한 정보
TCubeMapByNPC cube_info_map; TCubeMapByNPC cube_info_map;
TCubeResultInfoTextByNPC cube_result_info_map_by_npc; // 네이밍 존나 병신같다 ㅋㅋㅋ TCubeResultInfoTextByNPC cube_result_info_map_by_npc; // 네이밍 존나 병신같다 ㅋㅋㅋ

View File

@ -872,7 +872,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
char szQuery[1024]; char szQuery[1024];
snprintf(szQuery, sizeof(szQuery), "UPDATE account SET last_play=NOW() WHERE id=%u", dwID); snprintf(szQuery, sizeof(szQuery), "UPDATE account SET last_play=NOW() WHERE id=%u", dwID);
std::auto_ptr<SQLMsg> msg( DBManager::instance().DirectQuery(szQuery) ); std::unique_ptr<SQLMsg> msg( DBManager::instance().DirectQuery(szQuery) );
} }
TAccountTable & r = d->GetAccountTable(); TAccountTable & r = d->GetAccountTable();
@ -1104,7 +1104,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
char szQuery[1024]; char szQuery[1024];
snprintf(szQuery, sizeof(szQuery), "UPDATE account SET last_play=NOW() WHERE id=%u", dwID); snprintf(szQuery, sizeof(szQuery), "UPDATE account SET last_play=NOW() WHERE id=%u", dwID);
std::auto_ptr<SQLMsg> msg( DBManager::instance().DirectQuery(szQuery) ); std::unique_ptr<SQLMsg> msg( DBManager::instance().DirectQuery(szQuery) );
} }
TAccountTable & r = d->GetAccountTable(); TAccountTable & r = d->GetAccountTable();

View File

@ -12,13 +12,8 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#ifdef __GNUC__ #include <unordered_map>
#include <tr1/unordered_map> #define std std
#define TR1_NS std::tr1
#else
#include <boost/unordered_map.hpp>
#define TR1_NS boost
#endif
#define DBGALLOC_LOG_FILENAME "dbgalloc.log" #define DBGALLOC_LOG_FILENAME "dbgalloc.log"
#define DBGALLOC_REPORT_FILENAME "dbgalloc_report.log" #define DBGALLOC_REPORT_FILENAME "dbgalloc_report.log"
@ -308,7 +303,7 @@ private:
} }
#endif #endif
typedef TR1_NS::unordered_map<void*, AllocTag> AllocMapType; typedef std::unordered_map<void*, AllocTag> AllocMapType;
Detail detail_; Detail detail_;
AllocMapType alloc_map_; AllocMapType alloc_map_;

View File

@ -16,7 +16,6 @@
#include "guild_manager.h" #include "guild_manager.h"
#include "TrafficProfiler.h" #include "TrafficProfiler.h"
#include "locale_service.h" #include "locale_service.h"
#include "HackShield.h"
#include "log.h" #include "log.h"
extern int max_bytes_written; extern int max_bytes_written;
@ -94,7 +93,6 @@ void DESC::Initialize()
m_bCRCMagicCubeIdx = 0; m_bCRCMagicCubeIdx = 0;
m_dwProcCRC = 0; m_dwProcCRC = 0;
m_dwFileCRC = 0; m_dwFileCRC = 0;
m_bHackCRCQuery = 0;
m_dwBillingExpireSecond = 0; m_dwBillingExpireSecond = 0;
@ -199,16 +197,6 @@ EVENTFUNC(ping_event)
desc->SetPong(false); desc->SetPong(false);
} }
#ifdef ENABLE_LIMIT_TIME
if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME)
{
extern void ClearAdminPages();
ClearAdminPages();
extern g_bShutdown;
g_bShutdown = true;
}
#endif
desc->SendHandshake(get_dword_time(), 0); desc->SendHandshake(get_dword_time(), 0);
return (ping_event_second_cycle); return (ping_event_second_cycle);

View File

@ -247,7 +247,6 @@ class DESC
BYTE m_bCRCMagicCubeIdx; BYTE m_bCRCMagicCubeIdx;
DWORD m_dwProcCRC; DWORD m_dwProcCRC;
DWORD m_dwFileCRC; DWORD m_dwFileCRC;
bool m_bHackCRCQuery;
DWORD m_dwBillingExpireSecond; DWORD m_dwBillingExpireSecond;
std::string m_stClientVersion; std::string m_stClientVersion;

View File

@ -1,7 +1,7 @@
#ifndef __INC_METIN_II_GAME_DESC_MANAGER_H__ #ifndef __INC_METIN_II_GAME_DESC_MANAGER_H__
#define __INC_METIN_II_GAME_DESC_MANAGER_H__ #define __INC_METIN_II_GAME_DESC_MANAGER_H__
#include <boost/unordered_map.hpp> #include <unordered_map>
#include <common/stl.h> #include <common/stl.h>
#include <common/length.h> #include <common/length.h>
@ -13,12 +13,12 @@ class CClientPackageCryptInfo;
class DESC_MANAGER : public singleton<DESC_MANAGER> class DESC_MANAGER : public singleton<DESC_MANAGER>
{ {
public: public:
typedef TR1_NS::unordered_set<LPDESC> DESC_SET; typedef std::unordered_set<LPDESC> DESC_SET;
typedef TR1_NS::unordered_set<LPCLIENT_DESC> CLIENT_DESC_SET; typedef std::unordered_set<LPCLIENT_DESC> CLIENT_DESC_SET;
typedef std::map<int, LPDESC> DESC_HANDLE_MAP; typedef std::map<int, LPDESC> DESC_HANDLE_MAP;
typedef std::map<DWORD, LPDESC> DESC_HANDSHAKE_MAP; typedef std::map<DWORD, LPDESC> DESC_HANDSHAKE_MAP;
typedef std::map<DWORD, LPDESC> DESC_ACCOUNTID_MAP; typedef std::map<DWORD, LPDESC> DESC_ACCOUNTID_MAP;
typedef boost::unordered_map<std::string, LPDESC> DESC_LOGINNAME_MAP; typedef std::unordered_map<std::string, LPDESC> DESC_LOGINNAME_MAP;
typedef std::map<DWORD, DWORD> DESC_HANDLE_RANDOM_KEY_MAP; typedef std::map<DWORD, DWORD> DESC_HANDLE_RANDOM_KEY_MAP;
public: public:

View File

@ -7,7 +7,7 @@ class CParty;
class CDungeon class CDungeon
{ {
typedef TR1_NS::unordered_map<LPPARTY, int> TPartyMap; typedef std::unordered_map<LPPARTY, int> TPartyMap;
typedef std::map<std::string, LPCHARACTER> TUniqueMobMap; typedef std::map<std::string, LPCHARACTER> TUniqueMobMap;
public: public:

View File

@ -6,7 +6,7 @@ class SECTREE;
class CEntity class CEntity
{ {
public: public:
typedef TR1_NS::unordered_map<LPENTITY, int> ENTITY_MAP; typedef std::unordered_map<LPENTITY, int> ENTITY_MAP;
public: public:
CEntity(); CEntity();

View File

@ -5,10 +5,10 @@
#ifdef __GNUC__ #ifdef __GNUC__
#include <tr1/unordered_map> #include <tr1/unordered_map>
#define TR1_NS std::tr1 #define std std::tr1
#else #else
#include <boost/unordered_map.hpp> #include <unordered_map>
#define TR1_NS boost #define std boost
#endif #endif
// Allocator implementation detail with simple FIFO grow-only pool. // Allocator implementation detail with simple FIFO grow-only pool.
@ -70,8 +70,8 @@ private:
} }
typedef std::deque<void*> PoolType; typedef std::deque<void*> PoolType;
typedef TR1_NS::unordered_map<size_t, PoolType> PoolMapType; typedef std::unordered_map<size_t, PoolType> PoolMapType;
typedef TR1_NS::unordered_map<void*, size_t> AllocMapType; typedef std::unordered_map<void*, size_t> AllocMapType;
static const size_t kWatermark = 4; // FIFO enforcement level static const size_t kWatermark = 4; // FIFO enforcement level

View File

@ -72,7 +72,7 @@ CGuild::CGuild(TGuildCreateParameter & cp)
m_data.grade_array[i].auth_flag = 0; m_data.grade_array[i].auth_flag = 0;
} }
std::auto_ptr<SQLMsg> pmsg (DBManager::instance().DirectQuery( std::unique_ptr<SQLMsg> pmsg (DBManager::instance().DirectQuery(
"INSERT INTO guild%s(name, master, sp, level, exp, skill_point, skill) " "INSERT INTO guild%s(name, master, sp, level, exp, skill_point, skill) "
"VALUES('%s', %u, 1000, 1, 0, 0, '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0')", "VALUES('%s', %u, 1000, 1, 0, 0, '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0')",
get_table_postfix(), m_data.name, m_data.master_pid)); get_table_postfix(), m_data.name, m_data.master_pid));
@ -1052,7 +1052,7 @@ void CGuild::RefreshCommentForce(DWORD player_id)
return; return;
} }
std::auto_ptr<SQLMsg> pmsg (DBManager::instance().DirectQuery("SELECT id, name, content FROM guild_comment%s WHERE guild_id = %u ORDER BY notice DESC, id DESC LIMIT %d", get_table_postfix(), m_data.guild_id, GUILD_COMMENT_MAX_COUNT)); std::unique_ptr<SQLMsg> pmsg (DBManager::instance().DirectQuery("SELECT id, name, content FROM guild_comment%s WHERE guild_id = %u ORDER BY notice DESC, id DESC LIMIT %d", get_table_postfix(), m_data.guild_id, GUILD_COMMENT_MAX_COUNT));
TPacketGCGuild pack; TPacketGCGuild pack;
pack.header = HEADER_GC_GUILD; pack.header = HEADER_GC_GUILD;
@ -2090,7 +2090,7 @@ CGuild::GuildJoinErrCode CGuild::VerifyGuildJoinableCondition( const LPCHARACTER
} }
else if ( LC_IsBrazil() == true ) else if ( LC_IsBrazil() == true )
{ {
std::auto_ptr<SQLMsg> pMsg( DBManager::instance().DirectQuery("SELECT value FROM guild_invite_limit WHERE id=%d", GetID()) ); std::unique_ptr<SQLMsg> pMsg( DBManager::instance().DirectQuery("SELECT value FROM guild_invite_limit WHERE id=%d", GetID()) );
if ( pMsg->Get()->uiNumRows > 0 ) if ( pMsg->Get()->uiNumRows > 0 )
{ {

View File

@ -81,7 +81,7 @@ DWORD CGuildManager::CreateGuild(TGuildCreateParameter& gcp)
return 0; return 0;
} }
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM guild%s WHERE name = '%s'", std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM guild%s WHERE name = '%s'",
get_table_postfix(), gcp.name)); get_table_postfix(), gcp.name));
if (pmsg->Get()->uiNumRows > 0) if (pmsg->Get()->uiNumRows > 0)
@ -205,7 +205,7 @@ void CGuildManager::Initialize()
return; return;
} }
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT id FROM guild%s", get_table_postfix())); std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT id FROM guild%s", get_table_postfix()));
std::vector<DWORD> vecGuildID; std::vector<DWORD> vecGuildID;
vecGuildID.reserve(pmsg->Get()->uiNumRows); vecGuildID.reserve(pmsg->Get()->uiNumRows);

View File

@ -17,11 +17,6 @@
#include "priv_manager.h" #include "priv_manager.h"
#include "castle.h" #include "castle.h"
#include "dev_log.h" #include "dev_log.h"
#include "HackShield_Impl.h"
#ifndef __WIN32__
#include "limit_time.h"
#endif
extern time_t get_global_time(); extern time_t get_global_time();
extern bool g_bNoPasspod; extern bool g_bNoPasspod;
@ -180,17 +175,6 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes,
void CInputProcessor::Pong(LPDESC d) void CInputProcessor::Pong(LPDESC d)
{ {
d->SetPong(true); d->SetPong(true);
extern bool Metin2Server_IsInvalid();
#ifdef ENABLE_LIMIT_TIME
if (Metin2Server_IsInvalid())
{
extern bool g_bShutdown;
g_bShutdown = true;
ClearAdminPages();
}
#endif
} }
void CInputProcessor::Handshake(LPDESC d, const char * c_pData) void CInputProcessor::Handshake(LPDESC d, const char * c_pData)

View File

@ -152,7 +152,6 @@ class CInputMain : public CInputProcessor
void Fishing(LPCHARACTER ch, const char* c_pData); void Fishing(LPCHARACTER ch, const char* c_pData);
void ItemGive(LPCHARACTER ch, const char* c_pData); void ItemGive(LPCHARACTER ch, const char* c_pData);
void Hack(LPCHARACTER ch, const char * c_pData);
int MyShop(LPCHARACTER ch, const char * c_pData, size_t uiBytes); int MyShop(LPCHARACTER ch, const char * c_pData, size_t uiBytes);
void Refine(LPCHARACTER ch, const char* c_pData); void Refine(LPCHARACTER ch, const char* c_pData);

View File

@ -11,10 +11,6 @@
#include "auth_brazil.h" #include "auth_brazil.h"
#include "db.h" #include "db.h"
#ifndef __WIN32__
#include "limit_time.h"
#endif
extern time_t get_global_time(); extern time_t get_global_time();
extern int openid_server; extern int openid_server;
@ -109,17 +105,6 @@ CInputAuth::CInputAuth()
void CInputAuth::Login(LPDESC d, const char * c_pData) void CInputAuth::Login(LPDESC d, const char * c_pData)
{ {
extern bool Metin2Server_IsInvalid();
#ifdef ENABLE_LIMIT_TIME
if (Metin2Server_IsInvalid())
{
extern void ClearAdminPages();
ClearAdminPages();
exit(1);
return;
}
#endif
TPacketCGLogin3 * pinfo = (TPacketCGLogin3 *) c_pData; TPacketCGLogin3 * pinfo = (TPacketCGLogin3 *) c_pData;
if (!g_bAuthServer) if (!g_bAuthServer)
@ -240,17 +225,6 @@ void CInputAuth::Login(LPDESC d, const char * c_pData)
void CInputAuth::LoginOpenID(LPDESC d, const char * c_pData) void CInputAuth::LoginOpenID(LPDESC d, const char * c_pData)
{ {
extern bool Metin2Server_IsInvalid();
#ifdef ENABLE_LIMIT_TIME
if (Metin2Server_IsInvalid())
{
extern void ClearAdminPages();
ClearAdminPages();
exit(1);
return;
}
#endif
//OpenID test code. //OpenID test code.
TPacketCGLogin5 *tempInfo1 = (TPacketCGLogin5 *)c_pData; TPacketCGLogin5 *tempInfo1 = (TPacketCGLogin5 *)c_pData;

View File

@ -44,8 +44,6 @@
#include "gm.h" #include "gm.h"
#include "panama.h" #include "panama.h"
#include "map_location.h" #include "map_location.h"
#include "HackShield.h"
#include "XTrapManager.h"
#include "DragonSoul.h" #include "DragonSoul.h"
@ -477,20 +475,6 @@ void CInputDB::PlayerLoad(LPDESC d, const char * data)
ch->GetGMLevel()); ch->GetGMLevel());
ch->QuerySafeboxSize(); ch->QuerySafeboxSize();
if (isHackShieldEnable)
{
if (! CHackShieldManager::instance().CreateClientHandle(ch->GetPlayerID()))
{
d->SetPhase(PHASE_CLOSE);
}
else
{
ch->StartHackShieldCheckCycle( HackShield_CheckCycleTime );
}
}
CXTrapManager::instance().CreateClientSession( ch );
} }
void CInputDB::Boot(const char* data) void CInputDB::Boot(const char* data)
@ -1995,7 +1979,7 @@ void CInputDB::VCard(const char * c_pData)
sys_log(0, "VCARD: %u %s %s %s %s", p->dwID, p->szSellCharacter, p->szSellAccount, p->szBuyCharacter, p->szBuyAccount); sys_log(0, "VCARD: %u %s %s %s %s", p->dwID, p->szSellCharacter, p->szSellAccount, p->szBuyCharacter, p->szBuyAccount);
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT sell_account, buy_account, time FROM vcard WHERE id=%u", p->dwID)); std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT sell_account, buy_account, time FROM vcard WHERE id=%u", p->dwID));
if (pmsg->Get()->uiNumRows != 1) if (pmsg->Get()->uiNumRows != 1)
{ {
sys_log(0, "VCARD_FAIL: no data"); sys_log(0, "VCARD_FAIL: no data");
@ -2025,7 +2009,7 @@ void CInputDB::VCard(const char * c_pData)
return; return;
} }
std::auto_ptr<SQLMsg> pmsg1(DBManager::instance().DirectQuery("UPDATE GameTime SET LimitTime=LimitTime+%d WHERE UserID='%s'", time, p->szBuyAccount)); std::unique_ptr<SQLMsg> pmsg1(DBManager::instance().DirectQuery("UPDATE GameTime SET LimitTime=LimitTime+%d WHERE UserID='%s'", time, p->szBuyAccount));
if (pmsg1->Get()->uiAffectedRows == 0 || pmsg1->Get()->uiAffectedRows == (uint32_t)-1) if (pmsg1->Get()->uiAffectedRows == 0 || pmsg1->Get()->uiAffectedRows == (uint32_t)-1)
{ {
@ -2033,7 +2017,7 @@ void CInputDB::VCard(const char * c_pData)
return; return;
} }
std::auto_ptr<SQLMsg> pmsg2(DBManager::instance().DirectQuery("UPDATE vcard,GameTime SET sell_pid='%s', buy_pid='%s', buy_account='%s', sell_time=NOW(), new_time=GameTime.LimitTime WHERE vcard.id=%u AND GameTime.UserID='%s'", p->szSellCharacter, p->szBuyCharacter, p->szBuyAccount, p->dwID, p->szBuyAccount)); std::unique_ptr<SQLMsg> pmsg2(DBManager::instance().DirectQuery("UPDATE vcard,GameTime SET sell_pid='%s', buy_pid='%s', buy_account='%s', sell_time=NOW(), new_time=GameTime.LimitTime WHERE vcard.id=%u AND GameTime.UserID='%s'", p->szSellCharacter, p->szBuyCharacter, p->szBuyAccount, p->dwID, p->szBuyAccount));
if (pmsg2->Get()->uiAffectedRows == 0 || pmsg2->Get()->uiAffectedRows == (uint32_t)-1) if (pmsg2->Get()->uiAffectedRows == 0 || pmsg2->Get()->uiAffectedRows == (uint32_t)-1)
{ {
@ -2671,11 +2655,6 @@ void CInputDB::DetailLog(const TPacketNeedLoginLogInfo* info)
if (NULL != pChar) if (NULL != pChar)
{ {
LogManager::instance().DetailLoginLog(true, pChar); LogManager::instance().DetailLoginLog(true, pChar);
if (isHackShieldEnable)
{
pChar->StartHackShieldCheckCycle( HackShield_FirstCheckWaitTime );
}
} }
} }
} }

View File

@ -30,8 +30,6 @@
#include "log.h" #include "log.h"
#include "horsename_manager.h" #include "horsename_manager.h"
#include "MarkManager.h" #include "MarkManager.h"
#include "HackShield.h"
#include "XTrapManager.h"
static void _send_bonus_info(LPCHARACTER ch) static void _send_bonus_info(LPCHARACTER ch)
{ {
@ -1083,9 +1081,6 @@ int CInputLogin::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
break; break;
///////////////////////////////////// /////////////////////////////////////
case HEADER_CG_HACK:
break;
case HEADER_CG_CHANGE_NAME: case HEADER_CG_CHANGE_NAME:
ChangeName(d, c_pData); ChangeName(d, c_pData);
break; break;
@ -1098,20 +1093,6 @@ int CInputLogin::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
Version(d->GetCharacter(), c_pData); Version(d->GetCharacter(), c_pData);
break; break;
case HEADER_CG_HS_ACK:
if (isHackShieldEnable)
{
CHackShieldManager::instance().VerifyAck(d->GetCharacter(), c_pData);
}
break;
case HEADER_CG_XTRAP_ACK:
{
TPacketXTrapCSVerify* p = reinterpret_cast<TPacketXTrapCSVerify*>((void*)c_pData);
CXTrapManager::instance().Verify_CSStep3(d->GetCharacter(), p->bPacketData);
}
break;
default: default:
sys_err("login phase does not handle this packet! header %d", bHeader); sys_err("login phase does not handle this packet! header %d", bHeader);
//d->SetPhase(PHASE_CLOSE); //d->SetPhase(PHASE_CLOSE);

View File

@ -38,8 +38,6 @@
#include "motion.h" #include "motion.h"
#include "OXEvent.h" #include "OXEvent.h"
#include "locale_service.h" #include "locale_service.h"
#include "HackShield.h"
#include "XTrapManager.h"
#include "DragonSoul.h" #include "DragonSoul.h"
extern void SendShout(const char * szText, BYTE bEmpire); extern void SendShout(const char * szText, BYTE bEmpire);
@ -88,7 +86,7 @@ EVENTINFO(spam_event_info)
} }
}; };
typedef boost::unordered_map<std::string, std::pair<unsigned int, LPEVENT> > spam_score_of_ip_t; typedef std::unordered_map<std::string, std::pair<unsigned int, LPEVENT> > spam_score_of_ip_t;
spam_score_of_ip_t spam_score_of_ip; spam_score_of_ip_t spam_score_of_ip;
EVENTFUNC(block_chat_by_ip_event) EVENTFUNC(block_chat_by_ip_event)
@ -567,12 +565,9 @@ struct FEmpireChatPacket
else else
{ {
// 사람마다 스킬레벨이 다르니 매번 해야합니다 // 사람마다 스킬레벨이 다르니 매번 해야합니다
size_t len = strncpy(converted_msg, orig_msg, sizeof(converted_msg)); strncpy(converted_msg, orig_msg, sizeof(converted_msg));
if (len >= sizeof(converted_msg)) ConvertEmpireText(bEmpire, converted_msg + namelen, sizeof(converted_msg) - namelen, 10 + 2 * d->GetCharacter()->GetSkillPower(SKILL_LANGUAGE1 + bEmpire - 1));
len = sizeof(converted_msg) - 1;
ConvertEmpireText(bEmpire, converted_msg + namelen, len - namelen, 10 + 2 * d->GetCharacter()->GetSkillPower(SKILL_LANGUAGE1 + bEmpire - 1));
d->Packet(converted_msg, orig_len); d->Packet(converted_msg, orig_len);
} }
} }
@ -2913,19 +2908,6 @@ void CInputMain::ItemGive(LPCHARACTER ch, const char* c_pData)
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템을 건네줄 수 없습니다.")); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템을 건네줄 수 없습니다."));
} }
void CInputMain::Hack(LPCHARACTER ch, const char * c_pData)
{
TPacketCGHack * p = (TPacketCGHack *) c_pData;
char buf[sizeof(p->szBuf)];
strncpy(buf, p->szBuf, sizeof(buf));
sys_err("HACK_DETECT: %s %s", ch->GetName(), buf);
// 현재 클라이언트에서 이 패킷을 보내는 경우가 없으므로 무조건 끊도록 한다
ch->GetDesc()->SetPhase(PHASE_CLOSE);
}
int CInputMain::MyShop(LPCHARACTER ch, const char * c_pData, size_t uiBytes) int CInputMain::MyShop(LPCHARACTER ch, const char * c_pData, size_t uiBytes)
{ {
TPacketCGMyShop * p = (TPacketCGMyShop *) c_pData; TPacketCGMyShop * p = (TPacketCGMyShop *) c_pData;
@ -3276,10 +3258,6 @@ int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
Fishing(ch, c_pData); Fishing(ch, c_pData);
break; break;
case HEADER_CG_HACK:
Hack(ch, c_pData);
break;
case HEADER_CG_MYSHOP: case HEADER_CG_MYSHOP:
if ((iExtraLen = MyShop(ch, c_pData, m_iBufferLeft)) < 0) if ((iExtraLen = MyShop(ch, c_pData, m_iBufferLeft)) < 0)
return -1; return -1;
@ -3293,19 +3271,6 @@ int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
Version(ch, c_pData); Version(ch, c_pData);
break; break;
case HEADER_CG_HS_ACK:
if (isHackShieldEnable)
{
CHackShieldManager::instance().VerifyAck(d->GetCharacter(), c_pData);
}
break;
case HEADER_CG_XTRAP_ACK:
{
TPacketXTrapCSVerify* p = reinterpret_cast<TPacketXTrapCSVerify*>((void*)c_pData);
CXTrapManager::instance().Verify_CSStep3(d->GetCharacter(), p->bPacketData);
}
break;
case HEADER_CG_DRAGON_SOUL_REFINE: case HEADER_CG_DRAGON_SOUL_REFINE:
{ {
TPacketCGDragonSoulRefine* p = reinterpret_cast <TPacketCGDragonSoulRefine*>((void*)c_pData); TPacketCGDragonSoulRefine* p = reinterpret_cast <TPacketCGDragonSoulRefine*>((void*)c_pData);
@ -3371,10 +3336,6 @@ int CInputDead::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
break; break;
case HEADER_CG_HACK:
Hack(ch, c_pData);
break;
default: default:
return (0); return (0);
} }

View File

@ -49,7 +49,7 @@ void ITEM_MANAGER::Destroy()
void ITEM_MANAGER::GracefulShutdown() void ITEM_MANAGER::GracefulShutdown()
{ {
TR1_NS::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.begin(); std::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.begin();
while (it != m_set_pkItemForDelayedSave.end()) while (it != m_set_pkItemForDelayedSave.end())
SaveSingleItem(*(it++)); SaveSingleItem(*(it++));
@ -424,7 +424,7 @@ void ITEM_MANAGER::DelayedSave(LPITEM item)
void ITEM_MANAGER::FlushDelayedSave(LPITEM item) void ITEM_MANAGER::FlushDelayedSave(LPITEM item)
{ {
TR1_NS::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.find(item); std::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.find(item);
if (it == m_set_pkItemForDelayedSave.end()) if (it == m_set_pkItemForDelayedSave.end())
{ {
@ -469,8 +469,8 @@ void ITEM_MANAGER::SaveSingleItem(LPITEM item)
void ITEM_MANAGER::Update() void ITEM_MANAGER::Update()
{ {
TR1_NS::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.begin(); std::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.begin();
TR1_NS::unordered_set<LPITEM>::iterator this_it; std::unordered_set<LPITEM>::iterator this_it;
while (it != m_set_pkItemForDelayedSave.end()) while (it != m_set_pkItemForDelayedSave.end())
{ {
@ -540,7 +540,7 @@ void ITEM_MANAGER::DestroyItem(LPITEM item, const char* file, size_t line)
} }
} }
TR1_NS::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.find(item); std::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.find(item);
if (it != m_set_pkItemForDelayedSave.end()) if (it != m_set_pkItemForDelayedSave.end())
m_set_pkItemForDelayedSave.erase(it); m_set_pkItemForDelayedSave.erase(it);

View File

@ -427,7 +427,7 @@ class ITEM_MANAGER : public singleton<ITEM_MANAGER>
TItemIDRangeTable m_ItemIDRange; TItemIDRangeTable m_ItemIDRange;
TItemIDRangeTable m_ItemIDSpareRange; TItemIDRangeTable m_ItemIDSpareRange;
TR1_NS::unordered_set<LPITEM> m_set_pkItemForDelayedSave; std::unordered_set<LPITEM> m_set_pkItemForDelayedSave;
std::map<DWORD, LPITEM> m_map_pkItemByID; std::map<DWORD, LPITEM> m_map_pkItemByID;
std::map<DWORD, DWORD> m_map_dwEtcItemDropProb; std::map<DWORD, DWORD> m_map_dwEtcItemDropProb;
std::map<DWORD, CDropItemGroup*> m_map_pkDropItemGroup; std::map<DWORD, CDropItemGroup*> m_map_pkDropItemGroup;

View File

@ -1,8 +0,0 @@
#ifndef __LIMIT_TIME__
#define __LIMIT_TIME__
#define ENABLE_LIMIT_TIME
#define GLOBAL_LIMIT_TIME 1409996783UL // Sat Sep 6 18:46:23 2014
#define TIME_OVER_PONG_DOWN_RATE 50000
#define TIME_OVER_LOGIN_DOWN_RATE 10000
#endif

View File

@ -1,7 +1,7 @@
#ifndef __INC_LOG_MANAGER_H__ #ifndef __INC_LOG_MANAGER_H__
#define __INC_LOG_MANAGER_H__ #define __INC_LOG_MANAGER_H__
#include <libsql/include/AsyncSQL.h> #include <libsql/include/CAsyncSQL.h>
#include "any_function.h" #include "any_function.h"
enum GOLDBAR_HOW enum GOLDBAR_HOW

View File

@ -1,7 +1,7 @@
#ifndef __INC_LZO_MANAGER_H #ifndef __INC_LZO_MANAGER_H
#define __INC_LZO_MANAGER_H #define __INC_LZO_MANAGER_H
#include "minilzo.h" #include <lzo/lzo1x.h>
class LZOManager : public singleton<LZOManager> class LZOManager : public singleton<LZOManager>
{ {

View File

@ -2,7 +2,6 @@
#include "constants.h" #include "constants.h"
#include "config.h" #include "config.h"
#include "event.h" #include "event.h"
#include "minilzo.h"
#include "packet.h" #include "packet.h"
#include "desc_manager.h" #include "desc_manager.h"
#include "item_manager.h" #include "item_manager.h"
@ -58,21 +57,10 @@
#include "threeway_war.h" #include "threeway_war.h"
#include "auth_brazil.h" #include "auth_brazil.h"
#include "DragonLair.h" #include "DragonLair.h"
#include "HackShield.h"
#include "skill_power.h" #include "skill_power.h"
#include "SpeedServer.h" #include "SpeedServer.h"
#include "XTrapManager.h"
#include "DragonSoul.h" #include "DragonSoul.h"
#include <boost/bind.hpp> #include <boost/bind.hpp>
#ifndef __WIN32__
#include "limit_time.h"
#endif
//#define __FILEMONITOR__
#if defined (__FreeBSD__) && defined(__FILEMONITOR__)
#include "FileMonitor_FreeBSD.h"
#endif
#ifdef __AUCTION__ #ifdef __AUCTION__
#include "auction_manager.h" #include "auction_manager.h"
@ -86,12 +74,6 @@
#include <execinfo.h> #include <execinfo.h>
#endif #endif
// 윈도우에서 테스트할 때는 항상 서버키 체크
#ifdef _WIN32
//#define _USE_SERVER_KEY_
#endif
#include "check_server.h"
extern void WriteVersion(); extern void WriteVersion();
//extern const char * _malloc_options; //extern const char * _malloc_options;
#if defined(__FreeBSD__) && defined(DEBUG_ALLOC) #if defined(__FreeBSD__) && defined(DEBUG_ALLOC)
@ -250,13 +232,6 @@ void heartbeat(LPHEART ht, int pulse)
// 1Ãʸ´Ù // 1Ãʸ´Ù
if (!(pulse % ht->passes_per_sec)) if (!(pulse % ht->passes_per_sec))
{ {
#ifdef ENABLE_LIMIT_TIME
if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME)
{
g_bShutdown = true;
}
#endif
if (g_bAuthServer && LC_IsBrazil() && !test_server) if (g_bAuthServer && LC_IsBrazil() && !test_server)
auth_brazil_log(); auth_brazil_log();
@ -316,14 +291,6 @@ void heartbeat(LPHEART ht, int pulse)
if (!(pulse % (passes_per_sec + 4))) if (!(pulse % (passes_per_sec + 4)))
CHARACTER_MANAGER::instance().ProcessDelayedSave(); CHARACTER_MANAGER::instance().ProcessDelayedSave();
//4초 마다
#if defined (__FreeBSD__) && defined(__FILEMONITOR__)
if (!(pulse % (passes_per_sec * 5)))
{
FileMonitorFreeBSD::Instance().Update(pulse);
}
#endif
// ¾à 5.08Ãʸ¶´Ù // ¾à 5.08Ãʸ¶´Ù
if (!(pulse % (passes_per_sec * 5 + 2))) if (!(pulse % (passes_per_sec * 5 + 2)))
{ {
@ -357,87 +324,6 @@ void heartbeat(LPHEART ht, int pulse)
} }
} }
static bool g_isInvalidServer = false;
bool Metin2Server_IsInvalid()
{
return g_isInvalidServer;
}
void Metin2Server_Check()
{
#ifdef _SERVER_CHECK_
#ifdef _USE_SERVER_KEY_
if (false == CheckServer::CheckIp(g_szPublicIP))
{
#ifdef _WIN32
fprintf(stderr, "check ip failed\n");
#endif
g_isInvalidServer = true;
}
return;
#endif
if (LC_IsEurope() || test_server)
return;
// 브라질 ip
if (strncmp (g_szPublicIP, "189.112.1", 9) == 0)
{
return;
}
// 캐나다 ip
if (strncmp (g_szPublicIP, "74.200.6", 8) == 0)
{
return;
}
return;
static const size_t CheckServerListSize = 1;
static const char* CheckServerList[] = { "202.31.178.251"};
static const int CheckServerPort = 7120;
socket_t sockConnector = INVALID_SOCKET;
for (size_t i = 0 ; i < CheckServerListSize ; i++)
{
sockConnector = socket_connect( CheckServerList[i], CheckServerPort );
if (0 < sockConnector)
break;
}
if (0 > sockConnector)
{
if (true != LC_IsEurope()) // 유럽은 접속을 하지 못하면 인증된 것으로 간주
g_isInvalidServer = true;
return;
}
char buf[256] = { 0, };
socket_read(sockConnector, buf, sizeof(buf) - 1);
sys_log(0, "recv[%s]", buf);
if (strncmp(buf, "OK", 2) == 0)
g_isInvalidServer = false;
else if (strncmp(buf, "CK", 2) == 0)
g_isInvalidServer = true;
socket_close(sockConnector);
#else
g_isInvalidServer = false;
return;
#endif
}
static void CleanUpForEarlyExit() { static void CleanUpForEarlyExit() {
CancelReloadSpamEvent(); CancelReloadSpamEvent();
} }
@ -511,9 +397,6 @@ int main(int argc, char **argv)
CThreeWayWar threeway_war; CThreeWayWar threeway_war;
CDragonLairManager dl_manager; CDragonLairManager dl_manager;
CHackShieldManager HSManager;
CXTrapManager XTManager;
CSpeedServerManager SSManager; CSpeedServerManager SSManager;
DSManager dsManager; DSManager dsManager;
@ -545,53 +428,9 @@ int main(int argc, char **argv)
ani_init(); ani_init();
PanamaLoad(); PanamaLoad();
Metin2Server_Check();
#if defined(_WIN32) && defined(_USE_SERVER_KEY_)
if (CheckServer::IsFail())
{
return 1;
}
#endif
if ( g_bTrafficProfileOn ) if ( g_bTrafficProfileOn )
TrafficProfiler::instance().Initialize( TRAFFIC_PROFILE_FLUSH_CYCLE, "ProfileLog" ); TrafficProfiler::instance().Initialize( TRAFFIC_PROFILE_FLUSH_CYCLE, "ProfileLog" );
//if game server
if (!g_bAuthServer)
{
//hackshield
if (isHackShieldEnable)
{
if (!HSManager.Initialize())
{
fprintf(stderr, "Failed To Initialize HS");
CleanUpForEarlyExit();
return 0;
}
}
//xtrap
if(bXTrapEnabled)
{
if (!XTManager.LoadXTrapModule())
{
CleanUpForEarlyExit();
return 0;
}
#if defined (__FreeBSD__) && defined(__FILEMONITOR__)
//PFN_FileChangeListener pNotifyFunc = boost::bind( &CXTrapManager::NotifyMapFileChanged, CXTrapManager::instance(), _1 );
PFN_FileChangeListener pNotifyFunc = &(CXTrapManager::NotifyMapFileChanged);
const std::string strMap1Name = "map1.CS3";
const std::string strMap2Name = "map2.CS3";
FileMonitorFreeBSD::Instance().AddWatch( strMap1Name, pNotifyFunc );
FileMonitorFreeBSD::Instance().AddWatch( strMap2Name, pNotifyFunc );
#endif
}
}
// Client PackageCrypt // Client PackageCrypt
//TODO : make it config //TODO : make it config
@ -601,11 +440,6 @@ int main(int argc, char **argv)
sys_err("Failed to Load ClientPackageCryptInfo File(%s)", strPackageCryptInfoDir.c_str()); sys_err("Failed to Load ClientPackageCryptInfo File(%s)", strPackageCryptInfoDir.c_str());
} }
#if defined (__FreeBSD__) && defined(__FILEMONITOR__)
PFN_FileChangeListener pPackageNotifyFunc = &(DESC_MANAGER::NotifyClientPackageFileChanged);
//FileMonitorFreeBSD::Instance().AddWatch( strPackageCryptInfoName, pPackageNotifyFunc );
#endif
while (idle()); while (idle());
sys_log(0, "<shutdown> Starting..."); sys_log(0, "<shutdown> Starting...");
@ -666,15 +500,6 @@ int main(int argc, char **argv)
sys_log(0, "<shutdown> Destroying building::CManager..."); sys_log(0, "<shutdown> Destroying building::CManager...");
building_manager.Destroy(); building_manager.Destroy();
if (!g_bAuthServer)
{
if (isHackShieldEnable)
{
sys_log(0, "<shutdown> Releasing HackShield manager...");
HSManager.Release();
}
}
sys_log(0, "<shutdown> Flushing TrafficProfiler..."); sys_log(0, "<shutdown> Flushing TrafficProfiler...");
trafficProfiler.Flush(); trafficProfiler.Flush();
@ -708,12 +533,6 @@ int start(int argc, char **argv)
#if defined(__FreeBSD__) && defined(DEBUG_ALLOC) #if defined(__FreeBSD__) && defined(DEBUG_ALLOC)
_malloc_message = WriteMallocMessage; _malloc_message = WriteMallocMessage;
#endif #endif
#ifdef ENABLE_LIMIT_TIME
if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME)
{
return 0;
}
#endif
while ((ch = getopt(argc, argv, "npverltI")) != -1) while ((ch = getopt(argc, argv, "npverltI")) != -1)
{ {
@ -726,8 +545,7 @@ int start(int argc, char **argv)
printf("IP %s\n", g_szPublicIP); printf("IP %s\n", g_szPublicIP);
optind++; optind = 0;
optreset = 1;
break; break;
case 'p': // port case 'p': // port
@ -741,8 +559,7 @@ int start(int argc, char **argv)
printf("port %d\n", mother_port); printf("port %d\n", mother_port);
optind++; optind = 0;
optreset = 1;
break; break;
case 'l': case 'l':
@ -751,8 +568,7 @@ int start(int argc, char **argv)
log_set_level(l); log_set_level(l);
optind++; optind = 0;
optreset = 1;
} }
break; break;
@ -761,8 +577,9 @@ int start(int argc, char **argv)
{ {
if (optind < argc) if (optind < argc)
{ {
st_localeServiceName = argv[optind++]; st_localeServiceName = argv[optind];
optreset = 1;
optind = 0;
} }
} }
break; break;
@ -976,12 +793,6 @@ int idle()
memset(&thecore_profiler[0], 0, sizeof(thecore_profiler)); memset(&thecore_profiler[0], 0, sizeof(thecore_profiler));
memset(&s_dwProfiler[0], 0, sizeof(s_dwProfiler)); memset(&s_dwProfiler[0], 0, sizeof(s_dwProfiler));
} }
#ifdef _USE_SERVER_KEY_
if (Metin2Server_IsInvalid() && 0 == (thecore_random() % 7146))
{
return 0; // shutdown
}
#endif
#ifdef __WIN32__ #ifdef __WIN32__
if (_kbhit()) { if (_kbhit()) {

View File

@ -129,7 +129,7 @@ namespace marriage
Func for_each_wedding(Func f); Func for_each_wedding(Func f);
private: private:
TR1_NS::unordered_set<TMarriage*> m_Marriages; std::unordered_set<TMarriage*> m_Marriages;
std::map<DWORD, TMarriage *> m_MarriageByPID; std::map<DWORD, TMarriage *> m_MarriageByPID;
std::set<std::pair<DWORD, DWORD> > m_setWedding; std::set<std::pair<DWORD, DWORD> > m_setWedding;
}; };

View File

@ -42,7 +42,7 @@ bool EncodeMatrix(const char* szsrc, const char* szpwd, char* lpdes, const unsig
char dc = sc ^ pc; char dc = sc ^ pc;
char szhex[3]; char szhex[3];
snprintf(szhex, sizeof(szhex), "%02X", dc); snprintf(szhex, sizeof(szhex), "%02X", dc);
strlcat(lpdes, szhex, usize); strncat(lpdes, szhex, usize);
} }
return (i == nlen) ? true : false; return (i == nlen) ? true : false;
@ -148,7 +148,7 @@ void GetRightAnswer(const unsigned long rows, const unsigned long cols, const ch
{ {
char sztemp[3] = { 0, 0, 0 }; char sztemp[3] = { 0, 0, 0 };
memcpy(sztemp, (char*)(pmatrix + (ROW(rows, i) * MAX_COLS + COL(cols, i))), 2); memcpy(sztemp, (char*)(pmatrix + (ROW(rows, i) * MAX_COLS + COL(cols, i))), 2);
strlcat(answer, sztemp, nsize); strncat(answer, sztemp, nsize);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,100 +0,0 @@
/* minilzo.h -- mini subset of the LZO real-time data compression library
This file is part of the LZO real-time data compression library.
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
The LZO library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the LZO library; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/opensource/lzo/
*/
/*
* NOTE:
* the full LZO package can be found at
* http://www.oberhumer.com/opensource/lzo/
*/
#ifndef __MINILZO_H
#define __MINILZO_H
#define MINILZO_VERSION 0x1080
#ifdef __LZOCONF_H
# error "you cannot use both LZO and miniLZO"
#endif
#undef LZO_HAVE_CONFIG_H
#include "lzo/lzoconf.h"
#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION)
# error "version mismatch in header files"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************************
//
************************************************************************/
/* Memory required for the wrkmem parameter.
* When the required size is 0, you can also pass a NULL pointer.
*/
#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS
#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t))
#define LZO1X_MEM_DECOMPRESS (0)
/* compression */
LZO_EXTERN(int)
lzo1x_1_compress ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
/* decompression */
LZO_EXTERN(int)
lzo1x_decompress ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem /* NOT USED */ );
/* safe decompression with overrun testing */
LZO_EXTERN(int)
lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem /* NOT USED */ );
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* already included */

View File

@ -2,12 +2,12 @@
#ifndef OVER_9_REFINE_MANAGER_H_ #ifndef OVER_9_REFINE_MANAGER_H_
#define OVER_9_REFINE_MANAGER_H_ #define OVER_9_REFINE_MANAGER_H_
#include <boost/unordered_map.hpp> #include <unordered_map>
class COver9RefineManager : public singleton<COver9RefineManager> class COver9RefineManager : public singleton<COver9RefineManager>
{ {
private : private :
typedef boost::unordered_map<DWORD, DWORD> OVER9ITEM_MAP; typedef std::unordered_map<DWORD, DWORD> OVER9ITEM_MAP;
OVER9ITEM_MAP m_mapItem; OVER9ITEM_MAP m_mapItem;
public : public :

View File

@ -53,7 +53,7 @@ void P2P_MANAGER::Boot(LPDESC d)
void P2P_MANAGER::FlushOutput() void P2P_MANAGER::FlushOutput()
{ {
TR1_NS::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin(); std::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin();
while (it != m_set_pkPeers.end()) while (it != m_set_pkPeers.end())
{ {
@ -91,7 +91,7 @@ void P2P_MANAGER::RegisterConnector(LPDESC d)
void P2P_MANAGER::UnregisterConnector(LPDESC d) void P2P_MANAGER::UnregisterConnector(LPDESC d)
{ {
TR1_NS::unordered_set<LPDESC>::iterator it = m_set_pkPeers.find(d); std::unordered_set<LPDESC>::iterator it = m_set_pkPeers.find(d);
if (it != m_set_pkPeers.end()) if (it != m_set_pkPeers.end())
{ {
@ -117,7 +117,7 @@ void P2P_MANAGER::EraseUserByDesc(LPDESC d)
void P2P_MANAGER::Send(const void * c_pvData, int iSize, LPDESC except) void P2P_MANAGER::Send(const void * c_pvData, int iSize, LPDESC except)
{ {
TR1_NS::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin(); std::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin();
while (it != m_set_pkPeers.end()) while (it != m_set_pkPeers.end())
{ {
@ -271,7 +271,7 @@ int P2P_MANAGER::GetDescCount()
void P2P_MANAGER::GetP2PHostNames(std::string& hostNames) void P2P_MANAGER::GetP2PHostNames(std::string& hostNames)
{ {
TR1_NS::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin(); std::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin();
std::ostringstream oss(std::ostringstream::out); std::ostringstream oss(std::ostringstream::out);

View File

@ -2,7 +2,7 @@
#ifndef P2P_MANAGER_H_ #ifndef P2P_MANAGER_H_
#define P2P_MANAGER_H_ #define P2P_MANAGER_H_
#include <boost/unordered_map.hpp> #include <unordered_map>
#include "input.h" #include "input.h"
#include <common/stl.h> #include <common/stl.h>
@ -57,10 +57,10 @@ class P2P_MANAGER : public singleton<P2P_MANAGER>
CInputProcessor * m_pkInputProcessor; CInputProcessor * m_pkInputProcessor;
int m_iHandleCount; int m_iHandleCount;
typedef boost::unordered_map<std::string, CCI *, stringhash> TCCIMap; typedef std::unordered_map<std::string, CCI *, stringhash> TCCIMap;
typedef boost::unordered_map<DWORD, CCI*> TPIDCCIMap; typedef std::unordered_map<DWORD, CCI*> TPIDCCIMap;
TR1_NS::unordered_set<LPDESC> m_set_pkPeers; std::unordered_set<LPDESC> m_set_pkPeers;
TCCIMap m_map_pkCCI; TCCIMap m_map_pkCCI;
TPIDCCIMap m_map_dwPID_pkCCI; TPIDCCIMap m_map_dwPID_pkCCI;
int m_aiEmpireUserCount[EMPIRE_MAX_NUM]; int m_aiEmpireUserCount[EMPIRE_MAX_NUM];

View File

@ -79,7 +79,6 @@ enum
HEADER_CG_MARK_UPLOAD = 102, HEADER_CG_MARK_UPLOAD = 102,
HEADER_CG_MARK_IDXLIST = 104, HEADER_CG_MARK_IDXLIST = 104,
HEADER_CG_HACK = 105,
HEADER_CG_CHANGE_NAME = 106, HEADER_CG_CHANGE_NAME = 106,
HEADER_CG_LOGIN2 = 109, HEADER_CG_LOGIN2 = 109,
HEADER_CG_DUNGEON = 110, HEADER_CG_DUNGEON = 110,
@ -104,8 +103,6 @@ enum
//enum을 별도로 구별을 하던가. 아님 namepsace로 구별을 하던가.. //enum을 별도로 구별을 하던가. 아님 namepsace로 구별을 하던가..
//정말 packet generator까지는 바라지도 않는다. 이런 씨XX //정말 packet generator까지는 바라지도 않는다. 이런 씨XX
//이러다가 숫자 겹치면 누가 책임지는데??? //이러다가 숫자 겹치면 누가 책임지는데???
HEADER_CG_HS_ACK = 203,
HEADER_CG_XTRAP_ACK = 204,
HEADER_CG_DRAGON_SOUL_REFINE = 205, HEADER_CG_DRAGON_SOUL_REFINE = 205,
HEADER_CG_STATE_CHECKER = 206, HEADER_CG_STATE_CHECKER = 206,
@ -288,9 +285,6 @@ enum
HEADER_GC_REQUEST_PASSPOD = 202, HEADER_GC_REQUEST_PASSPOD = 202,
HEADER_GC_REQUEST_PASSPOD_FAILED = 203, HEADER_GC_REQUEST_PASSPOD_FAILED = 203,
HEADER_GC_HS_REQUEST = 204,
HEADER_GC_XTRAP_CS1_REQUEST = 205,
HEADER_GC_SPECIFIC_EFFECT = 208, HEADER_GC_SPECIFIC_EFFECT = 208,
HEADER_GC_DRAGON_SOUL_REFINE = 209, HEADER_GC_DRAGON_SOUL_REFINE = 209,
@ -1895,12 +1889,6 @@ typedef struct command_give_item
BYTE byItemCount; BYTE byItemCount;
} TPacketCGGiveItem; } TPacketCGGiveItem;
typedef struct SPacketCGHack
{
BYTE bHeader;
char szBuf[255 + 1];
} TPacketCGHack;
// SubHeader - Dungeon // SubHeader - Dungeon
enum enum
{ {

View File

@ -2,8 +2,6 @@
#include <common/stl.h> #include <common/stl.h>
#include "constants.h" #include "constants.h"
#include "packet_info.h" #include "packet_info.h"
#include "HackShield_Impl.h"
#include "XTrapManager.h"
CPacketInfo::CPacketInfo() CPacketInfo::CPacketInfo()
: m_pCurrentPacket(NULL), m_dwStartTime(0) : m_pCurrentPacket(NULL), m_dwStartTime(0)
@ -210,7 +208,6 @@ CPacketInfoCG::CPacketInfoCG()
Set(HEADER_CG_FISHING, sizeof(TPacketCGFishing), "Fishing", true); Set(HEADER_CG_FISHING, sizeof(TPacketCGFishing), "Fishing", true);
Set(HEADER_CG_ITEM_GIVE, sizeof(TPacketCGGiveItem), "ItemGive", true); Set(HEADER_CG_ITEM_GIVE, sizeof(TPacketCGGiveItem), "ItemGive", true);
Set(HEADER_CG_HACK, sizeof(TPacketCGHack), "Hack", true);
Set(HEADER_CG_MYSHOP, sizeof(TPacketCGMyShop), "MyShop", true); Set(HEADER_CG_MYSHOP, sizeof(TPacketCGMyShop), "MyShop", true);
Set(HEADER_CG_REFINE, sizeof(TPacketCGRefine), "Refine", true); Set(HEADER_CG_REFINE, sizeof(TPacketCGRefine), "Refine", true);
@ -224,8 +221,6 @@ CPacketInfoCG::CPacketInfoCG()
Set(HEADER_CG_SCRIPT_SELECT_ITEM, sizeof(TPacketCGScriptSelectItem), "ScriptSelectItem", true); Set(HEADER_CG_SCRIPT_SELECT_ITEM, sizeof(TPacketCGScriptSelectItem), "ScriptSelectItem", true);
Set(HEADER_CG_PASSPOD_ANSWER, sizeof(TPacketCGPasspod), "PasspodAnswer", true); Set(HEADER_CG_PASSPOD_ANSWER, sizeof(TPacketCGPasspod), "PasspodAnswer", true);
Set(HEADER_CG_HS_ACK, sizeof(TPacketGCHSCheck), "HackShieldResponse", false);
Set(HEADER_CG_XTRAP_ACK, sizeof(TPacketXTrapCSVerify), "XTrapResponse", false);
Set(HEADER_CG_DRAGON_SOUL_REFINE, sizeof(TPacketCGDragonSoulRefine), "DragonSoulRefine", false); Set(HEADER_CG_DRAGON_SOUL_REFINE, sizeof(TPacketCGDragonSoulRefine), "DragonSoulRefine", false);
Set(HEADER_CG_STATE_CHECKER, sizeof(BYTE), "ServerStateCheck", false); Set(HEADER_CG_STATE_CHECKER, sizeof(BYTE), "ServerStateCheck", false);

View File

@ -51,12 +51,12 @@ int CPasspod::ConfirmPasspod( const char * account, const char * passpod )
snprintf( szRequest, sizeof(szRequest), "username=%s&systemname=%s&passpod=%s&algname=%s", account, servername, passpod, algname ); snprintf( szRequest, sizeof(szRequest), "username=%s&systemname=%s&passpod=%s&algname=%s", account, servername, passpod, algname );
snprintf( szResult, sizeof(szResult), "POST %s%s HTTP/1.0\r\n", posspod_server, auth ); snprintf( szResult, sizeof(szResult), "POST %s%s HTTP/1.0\r\n", posspod_server, auth );
snprintf( szTmp, sizeof(szTmp), "Host: %s\r\n", "218.99.6.103" ); snprintf( szTmp, sizeof(szTmp), "Host: %s\r\n", "218.99.6.103" );
strlcat( szResult, szTmp, sizeof(szResult) ); strncat( szResult, szTmp, sizeof(szResult) );
strlcat( szResult, "Content-type: application/x-www-form-urlencoded\r\n", sizeof(szResult) ); strncat( szResult, "Content-type: application/x-www-form-urlencoded\r\n", sizeof(szResult) );
snprintf( szTmp, sizeof(szTmp), "Content-length: %d\r\n", strlen(szRequest)); snprintf( szTmp, sizeof(szTmp), "Content-length: %d\r\n", strlen(szRequest));
strlcat( szResult, szTmp, sizeof(szResult) ); strncat( szResult, szTmp, sizeof(szResult) );
strlcat( szResult, "Connection: Close\r\n\r\n", sizeof(szResult) ); strncat( szResult, "Connection: Close\r\n\r\n", sizeof(szResult) );
strlcat( szResult, szRequest, sizeof(szResult) ); strncat( szResult, szRequest, sizeof(szResult) );
if ( !Connect( NULL ) ) if ( !Connect( NULL ) )
{ {

View File

@ -13,7 +13,7 @@ CPolymorphUtils::CPolymorphUtils()
POLYMORPH_BONUS_TYPE CPolymorphUtils::GetBonusType(DWORD dwVnum) POLYMORPH_BONUS_TYPE CPolymorphUtils::GetBonusType(DWORD dwVnum)
{ {
boost::unordered_map<DWORD, DWORD>::iterator iter; std::unordered_map<DWORD, DWORD>::iterator iter;
iter = m_mapSPDType.find(dwVnum); iter = m_mapSPDType.find(dwVnum);

View File

@ -2,7 +2,7 @@
#ifndef __POLYMORPH_UTILS__ #ifndef __POLYMORPH_UTILS__
#define __POLYMORPH_UTILS__ #define __POLYMORPH_UTILS__
#include <boost/unordered_map.hpp> #include <unordered_map>
#define POLYMORPH_SKILL_ID 129 #define POLYMORPH_SKILL_ID 129
#define POLYMORPH_BOOK_ID 50322 #define POLYMORPH_BOOK_ID 50322
@ -18,9 +18,9 @@ enum POLYMORPH_BONUS_TYPE
class CPolymorphUtils : public singleton<CPolymorphUtils> class CPolymorphUtils : public singleton<CPolymorphUtils>
{ {
private : private :
boost::unordered_map<DWORD, DWORD> m_mapSPDType; std::unordered_map<DWORD, DWORD> m_mapSPDType;
boost::unordered_map<DWORD, DWORD> m_mapATKType; std::unordered_map<DWORD, DWORD> m_mapATKType;
boost::unordered_map<DWORD, DWORD> m_mapDEFType; std::unordered_map<DWORD, DWORD> m_mapDEFType;
public : public :
CPolymorphUtils(); CPolymorphUtils();

View File

@ -232,7 +232,7 @@ public:
pool->Release(p); pool->Release(p);
} }
private: private:
typedef TR1_NS::unordered_map<size_t, Pool*> PoolMapType; typedef std::unordered_map<size_t, Pool*> PoolMapType;
PoolMapType pools_; PoolMapType pools_;
}; };

View File

@ -1,7 +1,7 @@
#ifndef __INC_METIN_II_GAME_PROFILER_H__ #ifndef __INC_METIN_II_GAME_PROFILER_H__
#define __INC_METIN_II_GAME_PROFILER_H__ #define __INC_METIN_II_GAME_PROFILER_H__
#include <boost/unordered_map.hpp> #include <unordered_map>
class CProfiler : public singleton<CProfiler> class CProfiler : public singleton<CProfiler>
{ {
@ -50,7 +50,7 @@ class CProfiler : public singleton<CProfiler>
} }
}; };
typedef boost::unordered_map<std::string, TProfileAccumData> TProfileAccumDataMap; typedef std::unordered_map<std::string, TProfileAccumData> TProfileAccumDataMap;
public: public:
CProfiler() CProfiler()

View File

@ -239,7 +239,7 @@ void CPVPManager::ConnectEx(LPCHARACTER pkChr, bool bDisconnect)
DWORD dwVID = bDisconnect ? 0 : pkChr->GetVID(); DWORD dwVID = bDisconnect ? 0 : pkChr->GetVID();
TR1_NS::unordered_set<CPVP*>::iterator it2 = it->second.begin(); std::unordered_set<CPVP*>::iterator it2 = it->second.begin();
while (it2 != it->second.end()) while (it2 != it->second.end())
{ {
@ -266,7 +266,7 @@ void CPVPManager::GiveUp(LPCHARACTER pkChr, DWORD dwKillerPID) // This method is
return; return;
sys_log(1, "PVPManager::Dead %d", pkChr->GetPlayerID()); sys_log(1, "PVPManager::Dead %d", pkChr->GetPlayerID());
TR1_NS::unordered_set<CPVP*>::iterator it2 = it->second.begin(); std::unordered_set<CPVP*>::iterator it2 = it->second.begin();
while (it2 != it->second.end()) while (it2 != it->second.end())
{ {
@ -311,7 +311,7 @@ bool CPVPManager::Dead(LPCHARACTER pkChr, DWORD dwKillerPID)
bool found = false; bool found = false;
sys_log(1, "PVPManager::Dead %d", pkChr->GetPlayerID()); sys_log(1, "PVPManager::Dead %d", pkChr->GetPlayerID());
TR1_NS::unordered_set<CPVP*>::iterator it2 = it->second.begin(); std::unordered_set<CPVP*>::iterator it2 = it->second.begin();
while (it2 != it->second.end()) while (it2 != it->second.end())
{ {

View File

@ -49,7 +49,7 @@ class CPVP
class CPVPManager : public singleton<CPVPManager> class CPVPManager : public singleton<CPVPManager>
{ {
typedef std::map<DWORD, TR1_NS::unordered_set<CPVP*> > CPVPSetMap; typedef std::map<DWORD, std::unordered_set<CPVP*> > CPVPSetMap;
public: public:
CPVPManager(); CPVPManager();

View File

@ -97,7 +97,7 @@ namespace quest
lua_pushboolean(L, false); lua_pushboolean(L, false);
*/ */
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM land%s WHERE guild_id = %d", get_table_postfix(), (DWORD)lua_tonumber(L,1))); std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM land%s WHERE guild_id = %d", get_table_postfix(), (DWORD)lua_tonumber(L,1)));
if ( pmsg->Get()->uiNumRows > 0 ) if ( pmsg->Get()->uiNumRows > 0 )
{ {

View File

@ -2100,7 +2100,7 @@ teleport_area:
char szQuery[1024]; char szQuery[1024];
snprintf(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM player%s WHERE name='%s'", get_table_postfix(), szName); snprintf(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM player%s WHERE name='%s'", get_table_postfix(), szName);
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery)); std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
if ( pmsg->Get()->uiNumRows > 0 ) if ( pmsg->Get()->uiNumRows > 0 )
{ {

View File

@ -1,7 +1,7 @@
#ifndef __METIN2_SERVER_QUEST_MANAGER__ #ifndef __METIN2_SERVER_QUEST_MANAGER__
#define __METIN2_SERVER_QUEST_MANAGER__ #define __METIN2_SERVER_QUEST_MANAGER__
#include <boost/unordered_map.hpp> #include <unordered_map>
#include "questnpc.h" #include "questnpc.h"
@ -234,8 +234,8 @@ namespace quest
} }
}; };
typedef boost::unordered_map<string, int, stringhash> THashMapQuestName; typedef std::unordered_map<string, int, stringhash> THashMapQuestName;
typedef boost::unordered_map<unsigned int, vector<char> > THashMapQuestStartScript; typedef std::unordered_map<unsigned int, vector<char> > THashMapQuestStartScript;
THashMapQuestName m_hmQuestName; THashMapQuestName m_hmQuestName;
THashMapQuestStartScript m_hmQuestStartScript; THashMapQuestStartScript m_hmQuestStartScript;

View File

@ -465,8 +465,8 @@ bool SECTREE_MANAGER::LoadAttribute(LPSECTREE_MAP pkMapSectree, const char * c_p
int maxMemSize = LZOManager::instance().GetMaxCompressedSize(sizeof(DWORD) * (SECTREE_SIZE / CELL_SIZE) * (SECTREE_SIZE / CELL_SIZE)); int maxMemSize = LZOManager::instance().GetMaxCompressedSize(sizeof(DWORD) * (SECTREE_SIZE / CELL_SIZE) * (SECTREE_SIZE / CELL_SIZE));
unsigned int uiSize; size_t uiSize;
unsigned int uiDestSize; lzo_uint uiDestSize;
#ifndef _MSC_VER #ifndef _MSC_VER
BYTE abComp[maxMemSize]; BYTE abComp[maxMemSize];

View File

@ -225,7 +225,7 @@ class SECTREE_MANAGER : public singleton<SECTREE_MANAGER>
std::map<DWORD, std::vector<npc_info> > m_mapNPCPosition; std::map<DWORD, std::vector<npc_info> > m_mapNPCPosition;
// <Factor> Circular private map indexing // <Factor> Circular private map indexing
typedef TR1_NS::unordered_map<long, int> PrivateIndexMapType; typedef std::unordered_map<long, int> PrivateIndexMapType;
PrivateIndexMapType next_private_index_map_; PrivateIndexMapType next_private_index_map_;
}; };

View File

@ -68,7 +68,7 @@ class CShop
CGrid * m_pGrid; CGrid * m_pGrid;
typedef TR1_NS::unordered_map<LPCHARACTER, bool> GuestMapType; typedef std::unordered_map<LPCHARACTER, bool> GuestMapType;
GuestMapType m_map_guest; GuestMapType m_map_guest;
std::vector<SHOP_ITEM> m_itemVector; // 이 상점에서 취급하는 물건들 std::vector<SHOP_ITEM> m_itemVector; // 이 상점에서 취급하는 물건들

View File

@ -1,7 +1,7 @@
#ifndef __INC_METIN_II_GAME_CSkillManager_H__ #ifndef __INC_METIN_II_GAME_CSkillManager_H__
#define __INC_METIN_II_GAME_CSkillManager_H__ #define __INC_METIN_II_GAME_CSkillManager_H__
#include "../../libpoly/Poly.h" #include <libpoly/include/Poly.h>
enum ESkillFlags enum ESkillFlags
{ {

View File

@ -20,19 +20,11 @@
#include <queue> #include <queue>
#include <string> #include <string>
#include <vector> #include <vector>
#include <memory>
#ifdef __GNUC__
#include <float.h> #include <float.h>
#include <tr1/unordered_map> #include <unordered_map>
#include <tr1/unordered_set> #include <unordered_set>
#define TR1_NS std::tr1
#else
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#define TR1_NS boost
#define isdigit iswdigit
#define isspace iswspace
#endif
#include "typedef.h" #include "typedef.h"
#include "locale.hpp" #include "locale.hpp"

View File

@ -245,7 +245,7 @@ void CThreeWayWar::RandomEventMapSet()
bool CThreeWayWar::IsRegisteredUser(DWORD PlayerID) const bool CThreeWayWar::IsRegisteredUser(DWORD PlayerID) const
{ {
boost::unordered_map<DWORD, DWORD>::const_iterator iter = RegisterUserMap_.find(PlayerID); std::unordered_map<DWORD, DWORD>::const_iterator iter = RegisterUserMap_.find(PlayerID);
if (iter == RegisterUserMap_.end()) if (iter == RegisterUserMap_.end())
{ {

View File

@ -2,7 +2,7 @@
#ifndef THREE_WAY_WAR_EVENT_ #ifndef THREE_WAY_WAR_EVENT_
#define THREE_WAY_WAR_EVENT_ #define THREE_WAY_WAR_EVENT_
#include <boost/unordered_map.hpp> #include <unordered_map>
#include <common/stl.h> #include <common/stl.h>
@ -63,8 +63,8 @@ class CThreeWayWar : public singleton<CThreeWayWar>
std::vector<ForkedPassMapInfo> PassInfoMap_; std::vector<ForkedPassMapInfo> PassInfoMap_;
std::vector<ForkedSungziMapInfo> SungZiInfoMap_; std::vector<ForkedSungziMapInfo> SungZiInfoMap_;
boost::unordered_map<DWORD, DWORD> RegisterUserMap_; std::unordered_map<DWORD, DWORD> RegisterUserMap_;
boost::unordered_map<DWORD, int> ReviveTokenMap_; std::unordered_map<DWORD, int> ReviveTokenMap_;
}; };
const char* GetSungziMapPath(); const char* GetSungziMapPath();

View File

@ -30,7 +30,7 @@ typedef CHARACTER* LPCHARACTER;
#endif #endif
typedef std::vector<LPCHARACTER> CHARACTER_VECTOR; typedef std::vector<LPCHARACTER> CHARACTER_VECTOR;
typedef std::list<LPCHARACTER> CHARACTER_LIST; typedef std::list<LPCHARACTER> CHARACTER_LIST;
typedef TR1_NS::unordered_set<LPCHARACTER> CHARACTER_SET; typedef std::unordered_set<LPCHARACTER> CHARACTER_SET;
class CItem; class CItem;
#ifdef USE_DEBUG_PTR #ifdef USE_DEBUG_PTR
@ -58,7 +58,7 @@ typedef DebugPtr<CEntity> LPENTITY;
typedef CEntity* LPENTITY; typedef CEntity* LPENTITY;
#endif #endif
typedef std::vector<LPENTITY> ENTITY_VECTOR; typedef std::vector<LPENTITY> ENTITY_VECTOR;
typedef TR1_NS::unordered_set<LPENTITY> ENTITY_SET; typedef std::unordered_set<LPENTITY> ENTITY_SET;
class SECTREE; class SECTREE;
#ifdef USE_DEBUG_PTR #ifdef USE_DEBUG_PTR

View File

@ -1,16 +0,0 @@
#!/usr/local/bin/python
import time
desc = """#ifndef __LIMIT_TIME__
#define __LIMIT_TIME__
#define ENABLE_LIMIT_TIME
#define GLOBAL_LIMIT_TIME %dUL // %s
#define TIME_OVER_PONG_DOWN_RATE 50000
#define TIME_OVER_LOGIN_DOWN_RATE 10000
#endif
"""
limitTime = time.mktime(time.localtime()) + 3600 * 24 * 180 * 2
open("limit_time.h", "w").write(desc % (limitTime, time.asctime(time.localtime(limitTime))))

View File

@ -7,7 +7,7 @@ void WriteVersion()
if (fp) if (fp)
{ {
fprintf(fp, "emulated game server revision: %s\n", __SVN_VERSION__); fprintf(fp, "emulated game server\n");
//fprintf(fp, "%s@%s:%s\n", __USER__, __HOSTNAME__, __PWD__); //fprintf(fp, "%s@%s:%s\n", __USER__, __HOSTNAME__, __PWD__);
fclose(fp); fclose(fp);
} }

View File

@ -46,7 +46,7 @@ struct timespec
#define PATH_MAX _MAX_PATH #define PATH_MAX _MAX_PATH
// C runtime library adjustments // C runtime library adjustments
#define strlcat(dst, src, size) strcat_s(dst, size, src) #define strncat(dst, src, size) strcat_s(dst, size, src)
#define strncpy(dst, src, size) strncpy_s(dst, size, src, _TRUNCATE) #define strncpy(dst, src, size) strncpy_s(dst, size, src, _TRUNCATE)
#define strtoull(str, endptr, base) _strtoui64(str, endptr, base) #define strtoull(str, endptr, base) _strtoui64(str, endptr, base)
#define strtof(str, endptr) (float)strtod(str, endptr) #define strtof(str, endptr) (float)strtod(str, endptr)

View File

@ -1,50 +0,0 @@
#ifndef DIRENT_INCLUDED
#define DIRENT_INCLUDED
/*
Declaration of POSIX directory browsing functions and types for Win32.
Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
History: Created March 1997. Updated June 2003.
Rights: See end of file.
*/
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct DIR DIR;
struct dirent
{
char *d_name;
};
DIR *opendir(const char *);
int closedir(DIR *);
struct dirent *readdir(DIR *);
void rewinddir(DIR *);
/*
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose is hereby granted without fee, provided
that this copyright and permissions notice appear in all copies and
derivatives.
This software is supplied "as is" without express or implied warranty.
But that said, if there are any problems please get in touch.
*/
#ifdef __cplusplus
}
#endif
#endif

Some files were not shown because too many files have changed in this diff Show More