200 lines
6.2 KiB
C++
200 lines
6.2 KiB
C++
#pragma once
|
|
|
|
//#include <string>
|
|
#include <toolkit/khash.h>
|
|
#include <map>
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
/// String message DB
|
|
class SStringDB
|
|
{
|
|
public:
|
|
|
|
/// sonador 1.12.1 임시 스트링 검색 최적화
|
|
struct STRING_MAP
|
|
{
|
|
STRING_MAP( int realID, const char* tempString ) : nStringID( realID ), szTempString( tempString ) {}
|
|
int nStringID;
|
|
const char* szTempString;
|
|
};
|
|
|
|
~SStringDB();
|
|
|
|
const char * GetString( const char *szString );
|
|
const char * GetString( int nID );
|
|
const char * GetQuestString( int nID ) { return GetString( nID ); }
|
|
const char * GetScriptString( int nID ) { return GetString( nID ); }
|
|
// const char * GetString( const char* szKeyName );
|
|
struct _STRING_TABLE_INFO * GetStringData( int nID );
|
|
|
|
int GetGroupID( int nID );
|
|
|
|
bool SetLocale( const char *szLocale );
|
|
|
|
static std::string ParseString( int nID, const char *szFrom1 = 0, const char *szTo1 = 0, const char *szFrom2 = 0, const char *szTo2 = 0, const char *szFrom3 = 0, const char *szTo3 = 0, const char *szFrom4 = 0, const char *szTo4 = 0 );
|
|
static std::string ParseString( const char *szString, const char *szFrom1 = 0, const char *szTo1 = 0, const char *szFrom2 = 0, const char *szTo2 = 0, const char *szFrom3 = 0, const char *szTo3 = 0, const char *szFrom4 = 0, const char *szTo4 = 0 );
|
|
static std::string ToString( int nValue );
|
|
static std::string ToString( __int64 nValue );
|
|
/// sonador 10.4.1 스킬 툴팁 리뉴얼
|
|
static std::string ToString( float fValue );
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
static const char * GetCobFileName( int nRace, int nSex );
|
|
|
|
friend SStringDB& GetStringDB();
|
|
|
|
static std::string GetTaggedHttpLink( const std::string& strText );
|
|
static int GetTaggedStringID( const std::string& strText );
|
|
|
|
protected:
|
|
|
|
// SStringDB();
|
|
void Init();
|
|
void Destroy();
|
|
void LoadStringDB();
|
|
/// 2011.03.15 나중에 또 쓸것 같아서 남겨 놓음 - prodongi
|
|
void addTestString(int id, char const* desc);
|
|
|
|
KHash< _STRING_TABLE_INFO*, hashPr_mod_int> m_hashString;
|
|
KHash< int, hashPr_string > m_hashTable;
|
|
|
|
private:
|
|
|
|
std::string m_strLocale;
|
|
std::string m_strErrorCode;
|
|
|
|
public:
|
|
SStringDB();
|
|
static SStringDB* m_pThis;
|
|
};
|
|
|
|
SStringDB & GetStringDB();
|
|
|
|
inline const char* S( int nID )
|
|
{
|
|
return GetStringDB().GetString( nID );
|
|
}
|
|
inline std::string SR( int nID, const char *szFrom1, const char *szTo1, const char *szFrom2 = 0, const char *szTo2 = 0, const char *szFrom3 = 0, const char *szTo3 = 0, const char *szFrom4 = 0, const char *szTo4 = 0 )
|
|
{
|
|
return SStringDB::ParseString( nID, szFrom1, szTo1, szFrom2, szTo2, szFrom3, szTo3, szFrom4, szTo4 ).c_str();
|
|
}
|
|
template< typename T >
|
|
inline std::string SR( int nID, const char *szFrom1, T nTo1 )
|
|
{
|
|
return SStringDB::ParseString( nID, szFrom1, SStringDB::ToString( nTo1 ).c_str(), 0, 0, 0, 0, 0, 0 ).c_str();
|
|
}
|
|
template< typename T >
|
|
inline std::string SR( int nID, const char *szFrom1, T nTo1, const char *szFrom2, T nTo2, const char *szFrom3, T nTo3 )
|
|
{
|
|
return SStringDB::ParseString( nID, szFrom1, SStringDB::ToString( nTo1 ).c_str(), szFrom2, SStringDB::ToString( nTo2 ).c_str(), szFrom3, SStringDB::ToString( nTo3 ).c_str(), 0, 0 ).c_str();
|
|
}
|
|
template< typename T >
|
|
inline std::string SR( int nID, const char *szFrom1, T nTo1, const char *szFrom2, T nTo2 )
|
|
{
|
|
return SStringDB::ParseString( nID, szFrom1, SStringDB::ToString( nTo1 ).c_str(), szFrom2, SStringDB::ToString( nTo2 ).c_str(), 0, 0, 0, 0 ).c_str();
|
|
}
|
|
template< typename T >
|
|
inline std::string SR( int nID, const char *szFrom1, const char *szTo1, const char *szFrom2, T nTo2 )
|
|
{
|
|
return SStringDB::ParseString( nID, szFrom1, szTo1, szFrom2, SStringDB::ToString( nTo2 ).c_str(), 0, 0, 0, 0 ).c_str();
|
|
}
|
|
template< typename T >
|
|
inline std::string SR( int nID, const char *szFrom1 = 0, const std::string & strTo1 = "" )
|
|
{
|
|
return SStringDB::ParseString( nID, szFrom1, strTo1.c_str(), 0, 0, 0, 0, 0, 0 ).c_str();
|
|
}
|
|
template< typename T >
|
|
inline std::string SR( int nID, const char *szFrom1, const char *szTo1, const char *szFrom2, T nTo2, const char *szFrom3, T nTo3 )
|
|
{
|
|
return SStringDB::ParseString( nID, szFrom1, szTo1, szFrom2, SStringDB::ToString( nTo2 ).c_str(), szFrom3, SStringDB::ToString(nTo3).c_str() );
|
|
}
|
|
template< typename T >
|
|
inline std::string SR( int nID, const char *szFrom1, const char *szTo1, const char *szFrom2, const char *szTo2, const char *szFrom3, T nTo3 )
|
|
{
|
|
return SStringDB::ParseString( nID, szFrom1, szTo1, szFrom2, szTo2, szFrom3, SStringDB::ToString(nTo3).c_str() );
|
|
}
|
|
template< typename T >
|
|
inline std::string SR( int nID, const char *szFrom1, const char *szTo1, const char *szFrom2, const char *szTo2, const char *szFrom3, T nTo3, const char *szFrom4, T nTo4 )
|
|
{
|
|
return SStringDB::ParseString( nID, szFrom1, szTo1, szFrom2, szTo2, szFrom3, SStringDB::ToString(nTo3).c_str(), szFrom4, SStringDB::ToString(nTo4).c_str() );
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
/// 욕설 DB
|
|
class SAbuseDB
|
|
{
|
|
public:
|
|
SAbuseDB();
|
|
~SAbuseDB();
|
|
|
|
protected:
|
|
void Init();
|
|
void Destroy();
|
|
void Load();
|
|
};
|
|
|
|
SAbuseDB & GetAbuseDB();
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
/// SendTown DB
|
|
class SSendTownDB
|
|
{
|
|
public:
|
|
SSendTownDB();
|
|
~SSendTownDB();
|
|
|
|
bool GetSendTownPosition( int nIndex, std::string & strX, std::string & strY );
|
|
|
|
protected:
|
|
void Init();
|
|
void Destroy();
|
|
void Load();
|
|
|
|
struct _SEND_TOWN_INFO_
|
|
{
|
|
int nID;
|
|
std::string strName;
|
|
std::string strXpos;
|
|
std::string strYpos;
|
|
};
|
|
|
|
std::vector<_SEND_TOWN_INFO_> m_vSendTownList;
|
|
};
|
|
|
|
SSendTownDB & GetSendTownDB();
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// ColorTable for Skin DB
|
|
//Current number of races: 3
|
|
class SSkinColorTable
|
|
{
|
|
public:
|
|
SSkinColorTable();
|
|
~SSkinColorTable();
|
|
|
|
void GetColorTable( int nRaceIndex, std::vector<unsigned long>& color_list );
|
|
void GetAllColorTable( std::vector<unsigned long>& color_list );
|
|
|
|
unsigned long GetColorValue( int nRaceIndex, int nColorIndex );
|
|
|
|
|
|
protected:
|
|
|
|
void Init();
|
|
void Destroy();
|
|
void Load();
|
|
|
|
struct _SKIN_COLOR_
|
|
{
|
|
unsigned long color_value;
|
|
unsigned long color_view;
|
|
};
|
|
|
|
std::vector<_SKIN_COLOR_> m_vColorTable[3];
|
|
};
|
|
|
|
SSkinColorTable& GetSkinColorTable(); |