summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/HPMDataCheck.h42
-rw-r--r--src/common/HPMSymbols.inc.h14
-rw-r--r--src/common/cbasetypes.h6
-rw-r--r--src/common/console.c2
-rw-r--r--src/common/mmo.h51
-rw-r--r--src/common/strlib.h21
6 files changed, 127 insertions, 9 deletions
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h
index 7f96954bc..d2b4d2fd9 100644
--- a/src/common/HPMDataCheck.h
+++ b/src/common/HPMDataCheck.h
@@ -57,6 +57,11 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
#else
#define CHAR_INTER_H
#endif // CHAR_INTER_H
+ #ifdef CHAR_INT_ACHIEVEMENT_H
+ { "inter_achievement_interface", sizeof(struct inter_achievement_interface), SERVER_TYPE_CHAR },
+ #else
+ #define CHAR_INT_ACHIEVEMENT_H
+ #endif // CHAR_INT_ACHIEVEMENT_H
#ifdef CHAR_INT_AUCTION_H
{ "inter_auction_interface", sizeof(struct inter_auction_interface), SERVER_TYPE_CHAR },
#else
@@ -199,7 +204,9 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
#define COMMON_MEMMGR_H
#endif // COMMON_MEMMGR_H
#ifdef COMMON_MMO_H
+ { "achievement", sizeof(struct achievement), SERVER_TYPE_ALL },
{ "auction_data", sizeof(struct auction_data), SERVER_TYPE_ALL },
+ { "char_achievements", sizeof(struct char_achievements), SERVER_TYPE_ALL },
{ "clan", sizeof(struct clan), SERVER_TYPE_ALL },
{ "clan_buff", sizeof(struct clan_buff), SERVER_TYPE_ALL },
{ "clan_member", sizeof(struct clan_member), SERVER_TYPE_ALL },
@@ -371,6 +378,15 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
#else
#define LOGIN_LOGIN_H
#endif // LOGIN_LOGIN_H
+ #ifdef MAP_ACHIEVEMENT_H
+ { "achievement_data", sizeof(struct achievement_data), SERVER_TYPE_MAP },
+ { "achievement_interface", sizeof(struct achievement_interface), SERVER_TYPE_MAP },
+ { "achievement_objective", sizeof(struct achievement_objective), SERVER_TYPE_MAP },
+ { "achievement_reward_item", sizeof(struct achievement_reward_item), SERVER_TYPE_MAP },
+ { "achievement_rewards", sizeof(struct achievement_rewards), SERVER_TYPE_MAP },
+ #else
+ #define MAP_ACHIEVEMENT_H
+ #endif // MAP_ACHIEVEMENT_H
#ifdef MAP_ATCOMMAND_H
{ "AliasInfo", sizeof(struct AliasInfo), SERVER_TYPE_MAP },
{ "AtCommandInfo", sizeof(struct AtCommandInfo), SERVER_TYPE_MAP },
@@ -590,6 +606,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "NORMALITEM_INFO", sizeof(struct NORMALITEM_INFO), SERVER_TYPE_MAP },
{ "PACKET_CZ_ADD_ITEM_TO_MAIL", sizeof(struct PACKET_CZ_ADD_ITEM_TO_MAIL), SERVER_TYPE_MAP },
{ "PACKET_CZ_CHECKNAME", sizeof(struct PACKET_CZ_CHECKNAME), SERVER_TYPE_MAP },
+ { "PACKET_CZ_MEMORIALDUNGEON_COMMAND", sizeof(struct PACKET_CZ_MEMORIALDUNGEON_COMMAND), SERVER_TYPE_MAP },
{ "PACKET_CZ_OPEN_UI", sizeof(struct PACKET_CZ_OPEN_UI), SERVER_TYPE_MAP },
{ "PACKET_CZ_PC_BUY_CASH_POINT_ITEM", sizeof(struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM), SERVER_TYPE_MAP },
{ "PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub", sizeof(struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub), SERVER_TYPE_MAP },
@@ -610,6 +627,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "PACKET_CZ_REQ_REFRESH_MAIL_LIST", sizeof(struct PACKET_CZ_REQ_REFRESH_MAIL_LIST), SERVER_TYPE_MAP },
{ "PACKET_CZ_REQ_REMOVE_ITEM_MAIL", sizeof(struct PACKET_CZ_REQ_REMOVE_ITEM_MAIL), SERVER_TYPE_MAP },
{ "PACKET_CZ_REQ_STYLE_CHANGE", sizeof(struct PACKET_CZ_REQ_STYLE_CHANGE), SERVER_TYPE_MAP },
+ { "PACKET_CZ_REQ_STYLE_CHANGE2", sizeof(struct PACKET_CZ_REQ_STYLE_CHANGE2), SERVER_TYPE_MAP },
{ "PACKET_CZ_REQ_TRADE_BUYING_STORE", sizeof(struct PACKET_CZ_REQ_TRADE_BUYING_STORE), SERVER_TYPE_MAP },
{ "PACKET_CZ_REQ_TRADE_BUYING_STORE_sub", sizeof(struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub), SERVER_TYPE_MAP },
{ "PACKET_CZ_REQ_ZENY_FROM_MAIL", sizeof(struct PACKET_CZ_REQ_ZENY_FROM_MAIL), SERVER_TYPE_MAP },
@@ -618,11 +636,16 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "PACKET_CZ_SEARCH_STORE_INFO_item", sizeof(struct PACKET_CZ_SEARCH_STORE_INFO_item), SERVER_TYPE_MAP },
{ "PACKET_CZ_SEND_MAIL", sizeof(struct PACKET_CZ_SEND_MAIL), SERVER_TYPE_MAP },
{ "PACKET_CZ_SSILIST_ITEM_CLICK", sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK), SERVER_TYPE_MAP },
+ { "PACKET_ZC_ACK_BAN_GUILD1", sizeof(struct PACKET_ZC_ACK_BAN_GUILD1), SERVER_TYPE_MAP },
+ { "PACKET_ZC_ACK_BAN_GUILD2", sizeof(struct PACKET_ZC_ACK_BAN_GUILD2), SERVER_TYPE_MAP },
+ { "PACKET_ZC_ACK_BAN_GUILD3", sizeof(struct PACKET_ZC_ACK_BAN_GUILD3), SERVER_TYPE_MAP },
{ "PACKET_ZC_ACK_CLAN_LEAVE", sizeof(struct PACKET_ZC_ACK_CLAN_LEAVE), SERVER_TYPE_MAP },
{ "PACKET_ZC_ACK_DELETE_MAIL", sizeof(struct PACKET_ZC_ACK_DELETE_MAIL), SERVER_TYPE_MAP },
{ "PACKET_ZC_ACK_ITEM_FROM_MAIL", sizeof(struct PACKET_ZC_ACK_ITEM_FROM_MAIL), SERVER_TYPE_MAP },
{ "PACKET_ZC_ACK_ITEMLIST_BUYING_STORE", sizeof(struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE), SERVER_TYPE_MAP },
{ "PACKET_ZC_ACK_ITEMLIST_BUYING_STORE_sub", sizeof(struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE_sub), SERVER_TYPE_MAP },
+ { "PACKET_ZC_ACK_LEAVE_GUILD1", sizeof(struct PACKET_ZC_ACK_LEAVE_GUILD1), SERVER_TYPE_MAP },
+ { "PACKET_ZC_ACK_LEAVE_GUILD2", sizeof(struct PACKET_ZC_ACK_LEAVE_GUILD2), SERVER_TYPE_MAP },
{ "PACKET_ZC_ACK_OPEN_WRITE_MAIL", sizeof(struct PACKET_ZC_ACK_OPEN_WRITE_MAIL), SERVER_TYPE_MAP },
{ "PACKET_ZC_ACK_REMOVE_ITEM_MAIL", sizeof(struct PACKET_ZC_ACK_REMOVE_ITEM_MAIL), SERVER_TYPE_MAP },
{ "PACKET_ZC_ACK_REQMAKINGITEM", sizeof(struct PACKET_ZC_ACK_REQMAKINGITEM), SERVER_TYPE_MAP },
@@ -644,8 +667,12 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "PACKET_ZC_FEED_MER", sizeof(struct PACKET_ZC_FEED_MER), SERVER_TYPE_MAP },
{ "PACKET_ZC_FEED_PET", sizeof(struct PACKET_ZC_FEED_PET), SERVER_TYPE_MAP },
{ "PACKET_ZC_FORMATSTRING_MSG", sizeof(struct PACKET_ZC_FORMATSTRING_MSG), SERVER_TYPE_MAP },
+ { "PACKET_ZC_FORMATSTRING_MSG_COLOR", sizeof(struct PACKET_ZC_FORMATSTRING_MSG_COLOR), SERVER_TYPE_MAP },
+ { "PACKET_ZC_GROUP_ISALIVE", sizeof(struct PACKET_ZC_GROUP_ISALIVE), SERVER_TYPE_MAP },
{ "PACKET_ZC_GROUP_LIST", sizeof(struct PACKET_ZC_GROUP_LIST), SERVER_TYPE_MAP },
{ "PACKET_ZC_GROUP_LIST_SUB", sizeof(struct PACKET_ZC_GROUP_LIST_SUB), SERVER_TYPE_MAP },
+ { "PACKET_ZC_GUILD_POSITION", sizeof(struct PACKET_ZC_GUILD_POSITION), SERVER_TYPE_MAP },
+ { "PACKET_ZC_INVENTORY_MOVE_FAILED", sizeof(struct PACKET_ZC_INVENTORY_MOVE_FAILED), SERVER_TYPE_MAP },
{ "PACKET_ZC_ITEM_ENTRY", sizeof(struct PACKET_ZC_ITEM_ENTRY), SERVER_TYPE_MAP },
{ "PACKET_ZC_ITEM_PICKUP_PARTY", sizeof(struct PACKET_ZC_ITEM_PICKUP_PARTY), SERVER_TYPE_MAP },
{ "PACKET_ZC_MAIL_LIST", sizeof(struct PACKET_ZC_MAIL_LIST), SERVER_TYPE_MAP },
@@ -667,6 +694,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "PACKET_ZC_NOTIFY_WEAPONITEMLIST", sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST), SERVER_TYPE_MAP },
{ "PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub", sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub), SERVER_TYPE_MAP },
{ "PACKET_ZC_OPEN_UI", sizeof(struct PACKET_ZC_OPEN_UI), SERVER_TYPE_MAP },
+ { "PACKET_ZC_OVERWEIGHT_PERCENT", sizeof(struct PACKET_ZC_OVERWEIGHT_PERCENT), SERVER_TYPE_MAP },
{ "PACKET_ZC_PC_CASH_POINT_ITEMLIST", sizeof(struct PACKET_ZC_PC_CASH_POINT_ITEMLIST), SERVER_TYPE_MAP },
{ "PACKET_ZC_PC_CASH_POINT_ITEMLIST_sub", sizeof(struct PACKET_ZC_PC_CASH_POINT_ITEMLIST_sub), SERVER_TYPE_MAP },
{ "PACKET_ZC_PC_PURCHASE_ITEMLIST", sizeof(struct PACKET_ZC_PC_PURCHASE_ITEMLIST), SERVER_TYPE_MAP },
@@ -688,11 +716,21 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "PACKET_ZC_UI_ACTION", sizeof(struct PACKET_ZC_UI_ACTION), SERVER_TYPE_MAP },
{ "PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE", sizeof(struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE), SERVER_TYPE_MAP },
{ "PACKET_ZC_USE_ITEM_ACK", sizeof(struct PACKET_ZC_USE_ITEM_ACK), SERVER_TYPE_MAP },
+ { "PACKET_ZC_WARPLIST", sizeof(struct PACKET_ZC_WARPLIST), SERVER_TYPE_MAP },
+ { "PACKET_ZC_WARPLIST_sub", sizeof(struct PACKET_ZC_WARPLIST_sub), SERVER_TYPE_MAP },
{ "PACKET_ZC_WRITE_MAIL_RESULT", sizeof(struct PACKET_ZC_WRITE_MAIL_RESULT), SERVER_TYPE_MAP },
+ { "ZC_INVENTORY_END", sizeof(struct ZC_INVENTORY_END), SERVER_TYPE_MAP },
+ { "ZC_INVENTORY_START", sizeof(struct ZC_INVENTORY_START), SERVER_TYPE_MAP },
{ "ZC_PROGRESS_ACTOR", sizeof(struct ZC_PROGRESS_ACTOR), SERVER_TYPE_MAP },
+ { "ZC_STORE_ITEMLIST_EQUIP", sizeof(struct ZC_STORE_ITEMLIST_EQUIP), SERVER_TYPE_MAP },
+ { "ZC_STORE_ITEMLIST_NORMAL", sizeof(struct ZC_STORE_ITEMLIST_NORMAL), SERVER_TYPE_MAP },
+ { "ach_list_info", sizeof(struct ach_list_info), SERVER_TYPE_MAP },
{ "mail_item", sizeof(struct mail_item), SERVER_TYPE_MAP },
{ "maillistinfo", sizeof(struct maillistinfo), SERVER_TYPE_MAP },
{ "packet_ZC_REFUSE_LOGIN", sizeof(struct packet_ZC_REFUSE_LOGIN), SERVER_TYPE_MAP },
+ { "packet_achievement_list", sizeof(struct packet_achievement_list), SERVER_TYPE_MAP },
+ { "packet_achievement_reward_ack", sizeof(struct packet_achievement_reward_ack), SERVER_TYPE_MAP },
+ { "packet_achievement_update", sizeof(struct packet_achievement_update), SERVER_TYPE_MAP },
{ "packet_additem", sizeof(struct packet_additem), SERVER_TYPE_MAP },
{ "packet_authok", sizeof(struct packet_authok), SERVER_TYPE_MAP },
{ "packet_banking_check", sizeof(struct packet_banking_check), SERVER_TYPE_MAP },
@@ -740,6 +778,8 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "packet_quest_list_info", sizeof(struct packet_quest_list_info), SERVER_TYPE_MAP },
{ "packet_quest_update_header", sizeof(struct packet_quest_update_header), SERVER_TYPE_MAP },
{ "packet_quest_update_hunt", sizeof(struct packet_quest_update_hunt), SERVER_TYPE_MAP },
+ { "packet_reqname_ack", sizeof(struct packet_reqname_ack), SERVER_TYPE_MAP },
+ { "packet_reqnameall_ack", sizeof(struct packet_reqnameall_ack), SERVER_TYPE_MAP },
{ "packet_roulette_close_ack", sizeof(struct packet_roulette_close_ack), SERVER_TYPE_MAP },
{ "packet_roulette_generate_ack", sizeof(struct packet_roulette_generate_ack), SERVER_TYPE_MAP },
{ "packet_roulette_info_ack", sizeof(struct packet_roulette_info_ack), SERVER_TYPE_MAP },
@@ -754,8 +794,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "packet_status_change", sizeof(struct packet_status_change), SERVER_TYPE_MAP },
{ "packet_status_change2", sizeof(struct packet_status_change2), SERVER_TYPE_MAP },
{ "packet_status_change_end", sizeof(struct packet_status_change_end), SERVER_TYPE_MAP },
- { "packet_storelist_equip", sizeof(struct packet_storelist_equip), SERVER_TYPE_MAP },
- { "packet_storelist_normal", sizeof(struct packet_storelist_normal), SERVER_TYPE_MAP },
{ "packet_unequipitem_ack", sizeof(struct packet_unequipitem_ack), SERVER_TYPE_MAP },
{ "packet_unit_walking", sizeof(struct packet_unit_walking), SERVER_TYPE_MAP },
{ "packet_viewequip_ack", sizeof(struct packet_viewequip_ack), SERVER_TYPE_MAP },
diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h
index 70de5cdef..15acb1b06 100644
--- a/src/common/HPMSymbols.inc.h
+++ b/src/common/HPMSymbols.inc.h
@@ -32,6 +32,9 @@ struct HCache_interface *HCache;
#ifdef LOGIN_ACCOUNT_H /* account */
struct account_interface *account;
#endif // LOGIN_ACCOUNT_H
+#ifdef MAP_ACHIEVEMENT_H /* achievement */
+struct achievement_interface *achievement;
+#endif // MAP_ACHIEVEMENT_H
#ifdef MAP_ATCOMMAND_H /* atcommand */
struct atcommand_interface *atcommand;
#endif // MAP_ATCOMMAND_H
@@ -101,6 +104,9 @@ struct homunculus_interface *homun;
#ifdef MAP_INSTANCE_H /* instance */
struct instance_interface *instance;
#endif // MAP_INSTANCE_H
+#ifdef CHAR_INT_ACHIEVEMENT_H /* inter_achievement */
+struct inter_achievement_interface *inter_achievement;
+#endif // CHAR_INT_ACHIEVEMENT_H
#ifdef CHAR_INT_AUCTION_H /* inter_auction */
struct inter_auction_interface *inter_auction;
#endif // CHAR_INT_AUCTION_H
@@ -305,6 +311,10 @@ HPExport const char *HPM_shared_symbols(int server_type)
if ((server_type&(SERVER_TYPE_LOGIN)) != 0 && !HPM_SYMBOL("account", account))
return "account";
#endif // LOGIN_ACCOUNT_H
+#ifdef MAP_ACHIEVEMENT_H /* achievement */
+ if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("achievement", achievement))
+ return "achievement";
+#endif // MAP_ACHIEVEMENT_H
#ifdef MAP_ATCOMMAND_H /* atcommand */
if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("atcommand", atcommand))
return "atcommand";
@@ -397,6 +407,10 @@ HPExport const char *HPM_shared_symbols(int server_type)
if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("instance", instance))
return "instance";
#endif // MAP_INSTANCE_H
+#ifdef CHAR_INT_ACHIEVEMENT_H /* inter_achievement */
+ if ((server_type&(SERVER_TYPE_CHAR)) != 0 && !HPM_SYMBOL("inter_achievement", inter_achievement))
+ return "inter_achievement";
+#endif // CHAR_INT_ACHIEVEMENT_H
#ifdef CHAR_INT_AUCTION_H /* inter_auction */
if ((server_type&(SERVER_TYPE_CHAR)) != 0 && !HPM_SYMBOL("inter_auction", inter_auction))
return "inter_auction";
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index 3fc41bb23..89f7f8588 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -460,12 +460,6 @@ typedef char bool;
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
// C11 version
#define STATIC_ASSERT(ex, msg) _Static_assert(ex, msg)
-#elif __has_feature(c_static_assert)
-// Clang support (as per http://clang.llvm.org/docs/LanguageExtensions.html)
-#define STATIC_ASSERT(ex, msg) _Static_assert(ex, msg)
-#elif defined(__GNUC__) && GCC_VERSION >= 40700
-// GCC >= 4.7 is known to support it
-#define STATIC_ASSERT(ex, msg) _Static_assert(ex, msg)
#elif defined(_MSC_VER)
// MSVC doesn't support it, but it accepts the C++ style version
#define STATIC_ASSERT(ex, msg) static_assert(ex, msg)
diff --git a/src/common/console.c b/src/common/console.c
index 55a9815f5..5923775b7 100644
--- a/src/common/console.c
+++ b/src/common/console.c
@@ -25,6 +25,7 @@
#include "common/cbasetypes.h"
#include "common/core.h"
+#include "common/mmo.h"
#include "common/nullpo.h"
#include "common/showmsg.h"
#include "common/sysinfo.h"
@@ -93,6 +94,7 @@ static void display_title(void)
ShowInfo("Compiled with %s\n", sysinfo->compiler());
ShowInfo("Compile Flags: %s\n", sysinfo->cflags());
ShowInfo("Timer Function Type: %s\n", sysinfo->time());
+ ShowInfo("Packet version: %d " PACKETTYPE "\n", PACKETVER);
}
/**
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 1b9562e9d..d6946cecc 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -81,21 +81,50 @@
#undef ENABLE_PACKETVER_ZERO
#endif // DISABLE_PACKETVER_ZERO
-#if !defined(PACKETVER_RE) && !defined(PACKETVER_ZERO)
+//Uncomment the following line if your client is sakexe
+//#define ENABLE_PACKETVER_SAK
+#ifdef ENABLE_PACKETVER_SAK
+ #define PACKETVER_SAK
+ #undef ENABLE_PACKETVER_SAK
+#endif // DISABLE_PACKETVER_SAK
+
+//Uncomment the following line if your client is ragexeAD
+//#define ENABLE_PACKETVER_AD
+#ifdef ENABLE_PACKETVER_AD
+ #define PACKETVER_AD
+ #undef ENABLE_PACKETVER_AD
+#endif // DISABLE_PACKETVER_AD
+
+#if !defined(PACKETVER_RE) && !defined(PACKETVER_ZERO) && !defined(PACKETVER_SAK) && !defined(PACKETVER_AD)
#define PACKETVER_MAIN_NUM PACKETVER
+ #define PACKETTYPE "main"
#else
#define PACKETVER_MAIN_NUM 0
#endif
#ifdef PACKETVER_RE
#define PACKETVER_RE_NUM PACKETVER
+ #define PACKETTYPE "RE"
#else
#define PACKETVER_RE_NUM 0
#endif
#ifdef PACKETVER_ZERO
#define PACKETVER_ZERO_NUM PACKETVER
+ #define PACKETTYPE "zero"
#else
#define PACKETVER_ZERO_NUM 0
#endif
+#ifdef PACKETVER_SAK
+ #define PACKETVER_SAK_NUM PACKETVER
+ #define PACKETTYPE "sak"
+#else
+ #define PACKETVER_SAK_NUM 0
+#endif
+#ifdef PACKETVER_AD
+ #define PACKETVER_AD_NUM PACKETVER
+ #define PACKETTYPE "ad"
+#else
+ #define PACKETVER_AD_NUM 0
+#endif
// Client support for experimental RagexeRE UI present in 2012-04-10 and 2012-04-18
#if defined(PACKETVER_RE) && ( PACKETVER == 20120410 || PACKETVER == 20120418 )
@@ -218,6 +247,16 @@
#define MAX_QUEST_OBJECTIVES 3 // Max quest objectives for a quest
#endif
+// Achievements [Smokexyz/Hercules]
+#ifndef MAX_ACHIEVEMENT_DB
+#define MAX_ACHIEVEMENT_DB 360 // Maximum number of achievements
+#define MAX_ACHIEVEMENT_OBJECTIVES 10 // Maximum number of achievement objectives
+STATIC_ASSERT(MAX_ACHIEVEMENT_OBJECTIVES <= 10, "This value is limited by the client and database layout and should only be increased if you know the consequences.");
+#define MAX_ACHIEVEMENT_RANKS 20 // Achievement Ranks
+STATIC_ASSERT(MAX_ACHIEVEMENT_RANKS <= 255, "This value is limited by the client and database layout and should only be increased if you know the consequences.");
+#define MAX_ACHIEVEMENT_ITEM_REWARDS 10 // Achievement Rewards
+#endif
+
// for produce
#define MIN_ATTRIBUTE 0
#define MAX_ATTRIBUTE 4
@@ -616,6 +655,14 @@ struct hotkey {
#endif
};
+struct achievement { // Achievements [Smokexyz/Hercules]
+ int id;
+ int objective[MAX_ACHIEVEMENT_OBJECTIVES];
+ time_t completed_at, rewarded_at;
+};
+
+VECTOR_STRUCT_DECL(char_achievements, struct achievement);
+
struct mmo_charstatus {
int char_id;
int account_id;
@@ -687,6 +734,8 @@ struct mmo_charstatus {
short attendance_count;
unsigned char hotkey_rowshift;
+
+ int32 title_id; // Achievement Title[Dastgir/Hercules]
};
typedef enum mail_status {
diff --git a/src/common/strlib.h b/src/common/strlib.h
index 5ea4f4763..006bbd14b 100644
--- a/src/common/strlib.h
+++ b/src/common/strlib.h
@@ -49,6 +49,27 @@
#define safesnprintf(buf,sz,fmt,...) (strlib->safesnprintf_((buf),(sz),(fmt),##__VA_ARGS__))
#define strline(str,pos) (strlib->strline_((str),(pos)))
#define bin2hex(output,input,count) (strlib->bin2hex_((output),(input),(count)))
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
+#if defined(__GNUC__) && !defined(__clang__) && GCC_VERSION < 40900
+// _Generic is only supported starting with GCC 4.9
+#else
+#ifdef strchr
+#undef strchr
+#endif // strchr
+#define strchr(src, chr) _Generic((src), \
+ const char * : ((const char *)(strchr)((src), (chr))), \
+ char * : ((strchr)((src), (chr))) \
+ )
+#define strrchr(src, chr) _Generic((src), \
+ const char * : ((const char *)(strrchr)((src), (chr))), \
+ char * : ((strrchr)((src), (chr))) \
+ )
+#define strstr(haystack, needle) _Generic((haystack), \
+ const char * : ((const char *)(strstr)((haystack), (needle))), \
+ char * : ((strstr)((haystack), (needle))) \
+ )
+#endif
+#endif
/// Bitfield determining the behavior of sv_parse and sv_split.
typedef enum e_svopt {