diff options
Diffstat (limited to 'src/common/mmo.h')
-rw-r--r-- | src/common/mmo.h | 294 |
1 files changed, 272 insertions, 22 deletions
diff --git a/src/common/mmo.h b/src/common/mmo.h index 9c29b8a0e..c29da580c 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team + * Copyright (C) 2012-2018 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -23,6 +23,7 @@ #include "config/core.h" #include "common/cbasetypes.h" +#include "common/db.h" // VECTORS // server->client protocol version // 0 - pre-? @@ -73,6 +74,58 @@ #undef ENABLE_PACKETVER_RE #endif // DISABLE_PACKETVER_RE +//Uncomment the following line if your client is zero ragexe instead of normal kro clients +//#define ENABLE_PACKETVER_ZERO +#ifdef ENABLE_PACKETVER_ZERO + #define PACKETVER_ZERO + #undef ENABLE_PACKETVER_ZERO +#endif // DISABLE_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 ) #define PARTY_RECRUIT @@ -112,9 +165,32 @@ #endif #define MAX_CARTS (MAX_BASE_CARTS + MAX_CARTDECORATION_CARTS) +#ifndef MAX_INVENTORY +#if PACKETVER_MAIN_NUM >= 20181219 || PACKETVER_RE_NUM >= 20181219 || PACKETVER_ZERO_NUM >= 20181212 +#define MAX_INVENTORY 200 +#else #define MAX_INVENTORY 100 +#endif // PACKETVER_MAIN_NUM >= 20181219 || PACKETVER_RE_NUM >= 20181219 || PACKETVER_ZERO_NUM >= 20181212 +#endif // MAX_INVENTORY + +#ifndef FIXED_INVENTORY_SIZE +#define FIXED_INVENTORY_SIZE 100 +#endif + +#if FIXED_INVENTORY_SIZE > MAX_INVENTORY +#error FIXED_INVENTORY_SIZE must be same or smaller than MAX_INVENTORY +#endif + //Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more characters as well. -#define MAX_CHARS 9 +#if PACKETVER >= 20100413 +#ifndef MAX_CHARS + #define MAX_CHARS 12 +#endif +#else +#ifndef MAX_CHARS + #define MAX_CHARS 9 +#endif +#endif //Number of slots carded equipment can have. Never set to less than 4 as they are also used to keep the data of forged items/equipment. [Skotlex] //Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size. #define MAX_SLOTS 4 @@ -130,8 +206,8 @@ #endif #define MAX_FAME 1000000000 #define MAX_CART 100 -#ifndef MAX_SKILL -#define MAX_SKILL 1510 +#ifndef MAX_SKILL_DB +#define MAX_SKILL_DB 1510 ///< Maximum number of skills in the skill DB (compacted array size) #endif #ifndef MAX_SKILL_ID #define MAX_SKILL_ID 10015 // [Ind/Hercules] max used skill ID @@ -186,6 +262,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 @@ -256,6 +342,23 @@ #define MAX_ELESKILLTREE 3 #endif +// Maximum item options [Smokexyz] +#ifndef MAX_ITEM_OPTIONS +#define MAX_ITEM_OPTIONS 5 +#endif +STATIC_ASSERT(MAX_ITEM_OPTIONS <= 5, "This value is limited by the client and database layout and should only be increased if you know the consequences."); + +// RoDEX +#define RODEX_TITLE_LENGTH (40 + 1) +#define RODEX_BODY_LENGTH (500 + 1) +#define RODEX_MAX_ITEM (5) +#define RODEX_EXPIRE (1 * 15 * 24 * 60 * 60) +#if PACKETVER >= 20170419 +#define RODEX_MAIL_PER_PAGE 32 +#else +#define RODEX_MAIL_PER_PAGE 7 +#endif + // The following system marks a different job ID system used by the map server, // which makes a lot more sense than the normal one. [Skotlex] // These marks the "level" of the job. @@ -271,6 +374,7 @@ #define INFINITE_DURATION (-1) // Infinite duration for status changes struct hplugin_data_store; +struct script_code; enum item_types { IT_HEALING = 0, @@ -313,19 +417,26 @@ enum attribute_flag { ATTR_BROKEN = 1, }; +struct item_option { + int16 index; + int16 value; + uint8 param; +}; + struct item { int id; - short nameid; + int nameid; short amount; unsigned int equip; // Location(s) where item is equipped (using enum equip_pos for bitmasking). char identify; char refine; char attribute; - short card[MAX_SLOTS]; + int card[MAX_SLOTS]; unsigned int expire_time; char favorite; unsigned char bound; uint64 unique_id; + struct item_option option[MAX_ITEM_OPTIONS]; }; //Equip position constants @@ -390,7 +501,7 @@ enum e_item_bound_type { #endif }; -enum { +enum e_option { OPTION_NOTHING = 0x00000000, OPTION_SIGHT = 0x00000001, OPTION_HIDE = 0x00000002, @@ -416,6 +527,7 @@ enum { OPTION_DRAGON5 = 0x04000000, OPTION_HANBOK = 0x08000000, OPTION_OKTOBERFEST = 0x10000000, + OPTION_SUMMER2 = 0x20000000, #ifndef NEW_CARTS OPTION_CART1 = 0x00000008, OPTION_CART2 = 0x00000080, @@ -427,7 +539,7 @@ enum { #endif // compound constants OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, - OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, + OPTION_COSTUME = OPTION_WEDDING | OPTION_XMAS | OPTION_SUMMER | OPTION_HANBOK | OPTION_OKTOBERFEST | OPTION_SUMMER2, }; struct s_skill { @@ -459,8 +571,10 @@ struct status_change_data { }; struct storage_data { - int storage_amount; - struct item items[MAX_STORAGE]; + bool save; ///< save flag. + bool received; ///< received flag. + int aggregate; ///< total item count. + VECTOR_DECL(struct item) item; ///< item vector. }; struct guild_storage { @@ -478,13 +592,14 @@ struct s_pet { int pet_id; short class_; short level; - short egg_id;//pet egg id - short equip;//pet equip name_id + int egg_id;//pet egg id + int equip;//pet equip name_id short intimate;//pet friendly short hungry;//pet hungry char name[NAME_LENGTH]; char rename_flag; char incubate; + int autofeed; }; struct s_homunculus { //[orn] @@ -517,6 +632,7 @@ struct s_homunculus { //[orn] int luk_value; int8 spiritball; //for homun S [lighta] + int autofeed; }; struct s_mercenary { @@ -554,6 +670,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; @@ -562,7 +686,7 @@ struct mmo_charstatus { int mother; int child; - unsigned int base_exp,job_exp; + uint64 base_exp, job_exp; int zeny; int bank_vault; @@ -572,8 +696,9 @@ struct mmo_charstatus { unsigned int option; short manner; // Defines how many minutes a char will be muted, each negative point is equivalent to a minute. unsigned char karma; - short hair,hair_color,clothes_color,body; - int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + short hair, hair_color, clothes_color; + int body; + int party_id,guild_id,clan_id,pet_id,hom_id,mer_id,ele_id; int fame; // Mercenary Guilds Rank @@ -581,10 +706,14 @@ struct mmo_charstatus { int spear_faith, spear_calls; int sword_faith, sword_calls; - short weapon; // enum weapon_type - short shield; // view-id - short head_top,head_mid,head_bottom; - short robe; + struct { + int weapon; ///< Weapon view sprite id. + int shield; ///< Shield view sprite id. + int head_top; ///< Top headgear view sprite id. + int head_mid; ///< Middle headgear view sprite id. + int head_bottom; ///< Bottom headgear view sprite id. + int robe; ///< Robe view sprite id. + } look; char name[NAME_LENGTH]; int base_level, job_level; @@ -594,10 +723,11 @@ struct mmo_charstatus { uint32 mapip; uint16 mapport; + int64 last_login; struct point last_point,save_point,memo_point[MAX_MEMOPOINTS]; + int inventorySize; struct item inventory[MAX_INVENTORY],cart[MAX_CART]; - struct storage_data storage; - struct s_skill skill[MAX_SKILL]; + struct s_skill skill[MAX_SKILL_DB]; struct s_friend friends[MAX_FRIENDS]; //New friend system [Skotlex] #ifdef HOTKEY_SAVING @@ -616,7 +746,12 @@ struct mmo_charstatus { uint32 uniqueitem_counter; + int64 attendance_timer; + short attendance_count; + unsigned char hotkey_rowshift; + + int32 title_id; // Achievement Title[Dastgir/Hercules] }; typedef enum mail_status { @@ -698,6 +833,7 @@ struct guild_member { char name[NAME_LENGTH]; struct map_session_data *sd; unsigned char modified; + uint32 last_login; }; struct guild_position { @@ -772,6 +908,59 @@ struct guild_castle { int temp_guardians_max; }; +/** + * Clan Member Struct + */ +struct clan_member { + int char_id; ///< Char Id of member + short online; ///< Flag to know if the player is online or not + int64 last_login; ///< Last login of this member, used to kick if inactive for long time + struct map_session_data *sd; ///< Player data of member +}; + +/** + * Clan Buff Struct + */ +struct clan_buff { + int icon; ///< Status Icon to be shown in client (Use one of the 'SI_' constants) + struct script_code *script; ///< The script to be executed as CLan Buff +}; + +/** + * Clan Relationship Struct + */ +struct clan_relationship { + char constant[NAME_LENGTH]; ///< Unique name of the related clan + int clan_id; ///< Id of the related clan +}; + +/** + * Clan Struct + */ +struct clan { + int clan_id; ///< CLan's Id + char constant[NAME_LENGTH]; ///< Clan's Unique Name + char name[NAME_LENGTH]; ///< Clan's Name + char master[NAME_LENGTH]; ///< Name of the clan's master (used for clan information on client) + char map[MAP_NAME_LENGTH_EXT]; ///< The map of that clan (used for clan information on client) + struct clan_buff buff; ///< The buff for a clan when a member joins it + short max_member; ///< Limit of Members + short member_count; ///< Holds the amount of members in this clan, online and offline + short connect_member; ///< Members that are Online + VECTOR_DECL(struct clan_member) members; ///< Vector of Members + VECTOR_DECL(struct clan_relationship) allies; ///< Vector of Allies + VECTOR_DECL(struct clan_relationship) antagonists; ///< Vector of Antagonists + int kick_time; /// Needed inactive time to be kicked + int check_time; ///< Interval to check for inactive players + int tid; ///< Timer ID for inactivity kick + bool received; ///< Whether or not the requested data was received + int req_state; ///< Flag for knowing what to do after receiving the data from inter server + int req_count_tid; ///< Timer ID for the timer that handles the timeout of requests for interserver to count members + int req_kick_tid; ///< Timer ID for the timer that handles the timeout of requests for interserver to kick inactive members + + struct hplugin_data_store *hdata; ///< HPM Plugin Data Store +}; + struct fame_list { int id; int fame; @@ -786,6 +975,47 @@ enum fame_list_type { RANKTYPE_PK = 3, //Not supported yet }; +struct rodex_message { + int64 id; + int sender_id; + char sender_name[NAME_LENGTH]; + int receiver_id; + int receiver_accountid; + char receiver_name[NAME_LENGTH]; + char title[RODEX_TITLE_LENGTH]; + char body[RODEX_BODY_LENGTH]; + struct { + struct item item; + int idx; + } items[RODEX_MAX_ITEM]; + int64 zeny; + uint8 type; + int8 opentype; + bool is_read; + bool sender_read; + bool is_deleted; + int send_date; + int expire_date; + int weight; + int items_count; +}; + +VECTOR_STRUCT_DECL(rodex_maillist, struct rodex_message); + +enum rodex_opentype { + RODEX_OPENTYPE_MAIL = 0, + RODEX_OPENTYPE_ACCOUNT = 1, + RODEX_OPENTYPE_RETURN = 2, + RODEX_OPENTYPE_UNSET = 3, +}; + +enum MAIL_TYPE { + MAIL_TYPE_TEXT = 0x0, + MAIL_TYPE_ZENY = 0x2, + MAIL_TYPE_ITEM = 0x4, + MAIL_TYPE_NPC = 0x8 +}; + /** * Guild Basic Information * It is used to request changes via intif_guild_change_basicinfo in map-server and to @@ -843,7 +1073,7 @@ enum { }; //These mark the ID of the jobs, as expected by the client. [Skotlex] -enum { +enum e_class { JOB_NOVICE, JOB_SWORDMAN, JOB_MAGE, @@ -1062,6 +1292,7 @@ enum ammo_type { A_KUNAI, //7 A_CANNONBALL, //8 A_THROWWEAPON, //9 + MAX_AMMO_TYPE }; enum e_char_server_type { @@ -1105,6 +1336,21 @@ enum hz_char_ask_name_answer { CHAR_ASK_NAME_ANS_OFFLINE = 3, // login-server offline }; +/** + * Quest Info Types + */ +enum questinfo_type { + QINFO_JOB, + QINFO_SEX, + QINFO_BASE_LEVEL, + QINFO_JOB_LEVEL, + QINFO_ITEM, + QINFO_HOMUN_LEVEL, + QINFO_HOMUN_TYPE, + QINFO_QUEST, + QINFO_MERCENARY_CLASS +}; + /* packet size constant for itemlist */ #if MAX_INVENTORY > MAX_STORAGE && MAX_INVENTORY > MAX_CART #define MAX_ITEMLIST MAX_INVENTORY @@ -1123,4 +1369,8 @@ enum hz_char_ask_name_answer { #error MAX_SLOTS it too small #endif +#ifdef MAX_SKILL +#error MAX_SKILL has been replaced by MAX_SKILL_DB. Please update your custom definitions. +#endif + #endif /* COMMON_MMO_H */ |