DragonNest/Server/ServerCommon/DNExtManager.h

384 lines
13 KiB
C
Raw Normal View History

2024-12-19 09:48:26 +08:00
#pragma once
#include "DNDataManagerBase.h"
#include "DNTableFile.h"
#if defined(_LOGINSERVER)
#define FLAG_NICK_EQUAL 0
#define FLAG_NICK_INCLUDE 1
#define PROHIBITWORDMAX 64
struct ProhibitWordInfo
{
unsigned int nFlag;
wchar_t szNick[PROHIBITWORDMAX];
};
#endif // _LOGINSERVER
enum GlobalWeightTableIndex // village, game<6D><65> DnTableDB.h<><68> <20>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> serverdef<65><66><EFBFBD>ٴ<EFBFBD> <20>̰<EFBFBD><CCB0><EFBFBD> <20>Űܳ<C5B0><DCB3><EFBFBD>
{
CharacterSlotMax = 34, // 34: ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CHARACTERNAME_MAXLENGTH = 1010, //GlobalWeightTable<6C><65> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2B6A7><EFBFBD><EFBFBD> <20>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD>
PVPCHANNEL_LIMITLEVEL = 1018, //GlobalWeightTable<6C><65> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2B6A7><EFBFBD><EFBFBD> <20>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD>
Login_Max_CreateCharCount = 1022, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (GlobalWeight 1022)
Login_Base_CreateCharCount = 1023, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E2BABB><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (GlobalWeight 1023)
BeginnerGuild_UserMax = 1026, // <20>ʺ<EFBFBD><CABA>ڱ<EFBFBD><DAB1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ο<EFBFBD> 1026
BeginnerGuild_GiftMailID = 1027, // <20>ʺ<EFBFBD><CABA>ڱ<EFBFBD><DAB1><EFBFBD> <20><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD> 1027
MasterSystem_MasterAndPupilAllowLevelGap = 1038 // 1038 <09><><EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><C3BD><EFBFBD>_<EFBFBD><5F><EFBFBD>°<EFBFBD><C2B0><EFBFBD><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
};
enum GlobalWeightIntTableIndex // village, game<6D><65> DnTableDB.h<><68> <20>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> serverdef<65><66><EFBFBD>ٴ<EFBFBD> <20>̰<EFBFBD><CCB0><EFBFBD> <20>Űܳ<C5B0><DCB3><EFBFBD>
{
ComebackTerm_Day = 10006,
ComebackEffectItemID_Login = 10009,
SpecialBoxKeepPeriod = 10010,
NewbieReConnectReward_Hour = 10011,
};
class CDNExtManager
#if defined(_LOGINSERVER) || defined(_MASTERSERVER)
: public CDNDataManagerBase
#endif // #if defined(_LOGINSERVER) || defined(_MASTERSERVER)
{
private:
typedef map<int, TMapInfo*> TMapInfoMap;
TMapInfoMap m_pMapInfo;
typedef map<int, TPCBangData*> TMapPCBangData;
TMapPCBangData m_pPCBangData;
typedef map<BYTE, TDefaultCreateData*> TMapDefaultCreate; // first: ClassID
TMapDefaultCreate m_pMapDefaultCreate;
typedef map<int, int> TNewCharCreate;
TNewCharCreate m_pMapNewCharCreate;
#if defined( PRE_ADD_DWC )
typedef map<BYTE, TDWCCreateData*> TMapDWCCreate; // first: JobCode
TMapDWCCreate m_pMapDWCCreate;
#endif // #if defined( PRE_ADD_DWC )
typedef map<int, TSkillData*> TMapSkillData; // <20><EFBFBD><E2BABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> unlock <20><> <20><>ų<EFBFBD><C5B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ų <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> 0<><30><EFBFBD><EFBFBD> <20>־<EFBFBD><D6BE><EFBFBD>.
TMapSkillData m_pMapSkillData;
map<int, vector<TSkillData*> > m_mapDefaultUnlockSkillsByClass;
typedef map<BYTE, TCoinCountData*> TMapCoinCount; // first: Level
TMapCoinCount m_pMapCoinCount;
typedef map<int, TLevelData*> TMapLevelData;
TMapLevelData m_pLevelData;
#if defined(_LOGINSERVER)
typedef std::map <unsigned int, std::wstring> TProhibitWord;
#if defined(PRE_ADD_MULTILANGUAGE)
std::map <int, TProhibitWord> m_ProhibitWordList;
#else //#if defined(PRE_ADD_MULTILANGUAGE)
TProhibitWord m_ProhibitWordList;
#endif //#if defined(PRE_ADD_MULTILANGUAGE)
#endif // #if defined(_LOGINSERVER)
typedef map<int, TWeaponData*> TMapWeaponData;
TMapWeaponData m_pWeaponData;
typedef map<int, TPartData*> TMapPartData;
TMapPartData m_pPartData;
typedef map<UINT, TPvPGameStartConditionTable*> TPvPGameStartConditionData;
TPvPGameStartConditionData m_PvPGameStartConditionTable;
typedef map<UINT, TSchedule> TScheduleData;
TScheduleData m_ScheduleTable;
typedef map<UINT, TPvPGameModeTable> TPvPGameModeTableData;
TPvPGameModeTableData m_PvPGameModeTable;
std::map<LadderSystem::MatchType::eCode,std::vector<int>> m_MatchTypePvPGameModeID;
typedef map<UINT, TPvPMapTable*> TPvPMapTableData;
TPvPMapTableData m_PvPMapTable;
typedef map<char, TGuildWarMapInfo> TGuildWarMapInfoData;
TGuildWarMapInfoData m_GuildWarMapInfo;
typedef map<int, TMailTableData> TMapMailTableData;
TMapMailTableData m_MailTableData;
std::vector<TGuildWarRewardData *> m_pGuildWarRewardData;
typedef map<int, TJobTableData> TMapJobTableData;
TMapJobTableData m_JobTableData;
typedef map<int, TCashCommodityData*> TMapCashCommodity; // first: ItemSN
TMapCashCommodity m_pMapCashCommodity;
typedef map<int, TCashPackageData*> TMapCashPackage; // first: ItemSN
TMapCashPackage m_pMapCashPackage;
typedef map<int, TCashLimitData*> TMapCashLimit; // first: ItemSN
TMapCashLimit m_pMapCashLimit;
typedef map<int, TVehicleData> TMapVehicleData; // first: ItemID
TMapVehicleData m_MapVehicle;
typedef map<int, TVehiclePartsData> TMapVehicleParts; // first: ItemID
TMapVehicleParts m_MapVehicleParts;
typedef map<int, TItemData*> TMapItemData;
TMapItemData m_pItemData;
typedef map<int, TGlobalWeightData*> TMapGlobalWeight; // first: ID
TMapGlobalWeight m_pMapGlobalWeight;
typedef map<int, TGlobalWeightIntData*> TMapGlobalWeightInt; // first: ID
TMapGlobalWeightInt m_pMapGlobalWeightInt;
CSyncLock m_Sync; //m_pMapCashCommodity<74><79> m_pMapCashPackage<67><65>ȣ
bool LoadCashCommodity(bool bReload = false);
bool LoadCashPackage(bool bReload = false);
bool LoadCashLimit();
bool LoadItemData();
bool LoadPlayerLevel();
bool LoadGlobalWeight();
bool LoadGlobalWeightInt();
// VehicleTable
bool LoadVehicleData();
// VehiclePartsTable
bool LoadVehiclePartsData();
bool LoadPvPGameStartConditionTable();
bool LoadScheduleTable();
bool LoadPvPGameModeTable();
bool LoadGuildWarMapInfoTable();
bool LoadPvPMapTable();
bool LoadMailTableData();
bool LoadGuildWarRewardData();
bool LoadJobTableData();
unsigned int MemoryToRSHashKey(const wchar_t* pszData, long nSize);
void FindExtFileList( const char *szFileName, std::vector<std::string> &szVecList );
DNTableFileFormat* LoadExtTable( const char *szFileName );
public:
struct PlayerLevelTableIndex{
enum ePlayerLevelTableIndex {
Strength,
Agility,
Intelligence,
Stamina,
Experience,
SuperAmmor,
SkillPoint,
Fatigue,
DeadDurabilityRatio,
KillScore,
AssistScore,
AssistDecision,
AggroPer,
WeekFatigue,
SPDecreaseRatio,
Amount,
};
};
protected:
struct LevelValue {
union {
int nValue[PlayerLevelTableIndex::Amount];
float fValue[PlayerLevelTableIndex::Amount];
};
};
std::map<int, LevelValue *> m_nMapTable;
public:
CDNExtManager(void);
~CDNExtManager(void);
bool AllLoad();
int GetValue( int nClassID, int nLevel, PlayerLevelTableIndex::ePlayerLevelTableIndex Index );
float GetValueFloat( int nClassID, int nLevel, PlayerLevelTableIndex::ePlayerLevelTableIndex Index );
TPvPGameStartConditionTable* GetPvPGameStartConditionTable( const UINT uiMaxUser );
TSchedule* GetSchedule( int nSchedule );
const TPvPGameModeTable* GetPvPGameModeTableByMatchType( LadderSystem::MatchType::eCode MatchType );
UINT GetGuildWarMapInfoID(char cMonth);
const TPvPMapTable* GetPvPMapTable( const int nItemID );
const TPvPGameModeTable* GetPvPGameModeTable( const int nItemID );
bool LoadMapInfo();
//MapInfo
int GetMapIndexByGateNo(int nMapIndex, int nGateNo, int nSelect=0);
int GetGateNoByGateNo( int nMapIndex, int nGateNo, int nSelect=0);
GlobalEnum::eMapTypeEnum GetMapType( int nMapIndex );
const char * GetMapName(int nMapIdx);
#if defined(_LOGINSERVER) || defined(_MASTERSERVER)
void SetOnOffServerInfo(char cWorldSetID, bool bOnline);
int GetWorldID();
WCHAR* GetWorldName(int nWorldID);
bool GetLocalIp(OUT std::vector<std::string>& Out);
#endif // #if defined(_LOGINSERVER) || defined(_MASTERSERVER)
#if defined(_LOGINSERVER)
void GetChannelListByMapIndex(char cWorldID, int nMapIndex, int nLastMapIndex, sChannelInfo *ChannelArray, BYTE &cCount, TMapChannel *ChannelList);
void GetServerList(TServerListData *ServerList, BYTE &cCount, bool DenyWorld=false);
// DefaultCreateData
bool LoadDefaultCreateData();
bool LoadSkillData();
TDefaultCreateData* GetDefaultCreateData(BYTE cClassID);
TDefaultCreateData* GetDefaultCreateData_2(BYTE cClassID);
// TDefaultCreateData* GetDefaultCreateData(BYTE cClassID,bool bIsDarkClass);
int GetCreateDefaultItem(BYTE cClassID, TCreateCharacterItem *CreateItemArray);
bool IsDefaultParts(BYTE cClassID, char cEquipType, int nPartID);
bool IsDefaultHairColor(BYTE cClassID, DWORD dwColor);
bool IsDefaultSkinColor(BYTE cClassID, DWORD dwColor);
bool IsDefaultEyeColor(BYTE cClassID, DWORD dwColor);
bool GetCreateDefaultPosition(BYTE cClassID, int &nPosX, int &nPosY);
bool GetCreateDefaultMapInfo(BYTE cClassID, int &nMapIndex, int &nTutorialMapIndex, char &cTutorialGateNo);
bool GetCreateDefaultSkill(BYTE cClassID, int *CreateSkillArray);
bool GetCreateDefaultQuickSlot(BYTE cClassID, TQuickSlot *QuickSlotArray);
bool GetCreateDefaultGesture(BYTE cClassID, int * CreateGestureArr);
bool GetCreateDefaultUnlockSkill(BYTE cClassID, int *CreateUnlockSkillArray);
//rlkt_dark
bool GetCreateDarkSecondClassID(BYTE cClassID, int &ClassID);
// DefaultCreateData
#if defined( PRE_ADD_DWC )
bool LoadDWCCreateData();
TDWCCreateData* GetDWCCreateData(BYTE cJobCode);
int GetCreateDWCItem(BYTE cJobCode, TCreateCharacterItem *CreateItemArray);
bool GetCreateDWCPosition(BYTE cJobCode, int &nPosX, int &nPosY);
bool GetCreateDWCEquip(BYTE cJobCode, int * CreateEquipArray);
bool GetCreateDWCSkill(BYTE cJobCode, int *CreateSkillArray);
bool GetCreateDWCQuickSlot(BYTE cJobCode, TQuickSlot *QuickSlotArray);
bool GetCreateDWCGesture(BYTE cJobCode, int * CreateGestureArr);
#endif // #if defined( PRE_ADD_DWC )
// CoinCountByLevel
bool LoadCoinCount();
int GetRebirthCoin(BYTE cLevel, char cWorldID);
int GetCashRebirthCoin(BYTE cLevel, char cWorldID);
bool LoadLevelData();
int GetFatigue(char cClass, char cLevel);
// <20><>Ģ<EFBFBD><C4A2>
#if defined(PRE_ADD_MULTILANGUAGE)
bool LoadProhibitWord(int nLanguage, const char * pszFilePath);
TProhibitWord * GetLanguageSlangFilter(int nLanguage);
bool CheckProhibitWord(int nLanguage, const wchar_t *pwszWord);
#else //#if defined(PRE_ADD_MULTILANGUAGE)
bool LoadProhibitWord();
bool CheckProhibitWord(const wchar_t *pwszWord);
#endif //#if defined(PRE_ADD_MULTILANGUAGE)
bool CheckSpecialCharacter(const wchar_t *pwszWord);
bool LoadWeaponData();
TWeaponData* GetWeaponData(int nWeaponIndex);
bool LoadPartData();
TPartData* GetPartData(int nPartIndex);
int GetItemDurability( int nItemID );
#endif
// PCBang
bool LoadPCBangData();
int GetPCBangDataCount();
TPCBangData *GetPCBangData(int nPCBangType);
int GetPCBangParam1(int nPCBangType, int nPCBangGrade); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<>ٸ<EFBFBD> <20>ִ°<D6B4><C2B0><EFBFBD> (PCBang::Type::)Exp, Appellation, Fatigue, RebirthCoin, Mission
int GetPCBangParam2(int nPCBangType, int nPCBangGrade); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<>ٸ<EFBFBD> <20>ִ°<D6B4><C2B0><EFBFBD> (PCBang::Type::)Exp, Appellation, Fatigue, RebirthCoin, Mission
int GetPCBangNestClearCount(int nPCBangGrade, int nMapID);
bool GetPCBangClearBoxFlag(int nPCBangGrade);
// Cash<73><68>
bool ReLoadCashCommodity();
bool ReLoadCashPackage();
bool GetCashCommodityData(int nSN, TCashCommodityData &Data);
int GetCashCommodityPrice(int nSN);
bool IsReserveCommodity(int nSN); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
bool IsPresentCommodity(int nSN); // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
bool IsOnSaleCommodity(int nSN); // <20>Ǹ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
bool IsLimitCommodity(int nSN); // <20><><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD><EFBFBD><EFBFBD>
int GetCashCommodityPeriod(int nSN);
int GetCashCommodityCount(int nSN);
int GetCashCommodityReserve(int nSN); // <20><><EFBFBD>Խ<EFBFBD> <20>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#if defined( PRE_ADD_NEW_MONEY_SEED )
int GetCashCommoditySeed(int nSN); // <20><><EFBFBD>Խ<EFBFBD> <20>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD> <20>õ<EFBFBD>
#endif
bool GetCashCommodityName(int nSN, std::string &outStr);
bool GetCashCommodityNameW(int nSN, std::wstring &outStr);
#if defined(_JP)
bool GetCashCommodityJPSN(int nSN, std::string &outStr);
#endif // #if defined(_JP)
int GetCashCommodityItem0(int nSN);
int GetCashCommodityVIPPoint(int nSN); // vippoint<6E><74><EFBFBD><EFBFBD>
bool GetCashCommodityPay(int nSN);
int GetCashCommodityPaySale(int nSN);
int GetCashCommodityVIPAutomaticPaySalePrice(int nSN); // VIP<49>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ΰ<EFBFBD><CEB0><EFBFBD>
std::vector<int> m_VecProhibitSaleList;
void SetProhibitSaleList();
#if defined(PRE_ADD_CASH_REFUND)
bool GetCashCommodityNoRefund(int nID, int nSN); // ij<><C4B3> ȯ<><C8AF> <20>Ұ<EFBFBD><D2B0><EFBFBD>
#endif
#if defined(PRE_ADD_SALE_COUPON)
bool GetCashCommodityUseCoupon(int nSN);
#endif
bool GetCashPackageData(int nSN, TCashPackageData &Data);
TCashLimitData *GetCashLimitData(int nSN);
int GetCashBuyAbleCount(int nSN);
#if defined(PRE_ADD_LIMITED_CASHITEM) && defined(_CASHSERVER)
int GetCashLimitedItemCount(int nSN);
#endif //#if defined(PRE_ADD_LIMITED_CASHITEM) && defined(_CASHSERVER)
TItemData* GetItemData(int nItemID);
int GetItemMainType(int nItemID); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ÿ<><C5B8><EFBFBD>߿<EFBFBD> eItemTypeEnum <20><><EFBFBD><EFBFBD>
int GetItemOverlapCount(int nItemID);
bool IsCashItem(int nItemID);
// GlobalWeight
TGlobalWeightData *GetGlobalWeightData(int nID);
float GetGlobalWeightValueFloat(int nID);
int GetGlobalWeightValue(int nID);
TGlobalWeightIntData *GetGlobalWeightIntData(int nID);
float GetGlobalWeightIntValueFloat(int nID);
int GetGlobalWeightIntValue(int nID);
// VehicleTable
TVehicleData *GetVehicleData(int nItemID);
int GetVehicleClassID(int nItemID);
// VehiclePartsTable
TVehiclePartsData *GetVehiclePartsData(int nItemID);
int GetVehiclePartsType(int nItemID);
TMailTableData* GetMailTableData( int iItemID );
TGuildWarRewardData* GetGuildWarRewardData(char cType, char cClass);
TJobTableData* GetJobTableData( int nJobTableID );
time_t GetTimeForTextDate(std::string& strDate); // "00/00/00" Text<78><74><EFBFBD><EFBFBD> time_t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool IsOnSaleDate(int nSN);
void GetXMLAccountDBID(UINT nAccountDBID, std::wstring &wstrOut);
void GetXMLAccountName(WCHAR *pAccountName, std::wstring &wstrOut);
void GetXMLCharacterDBID(INT64 biCharacterDBID, std::wstring &wstrOut);
void GetXMLCharacterName(WCHAR *pCharacterName, std::wstring &wstrOut);
void GetXMLItems(int nItemTotalCount, TSpecialBoxItemInfo *Items, std::wstring &wstrOut);
///
bool LoadNewCharCreate();
};
extern CDNExtManager *g_pExtManager;