diff options
Diffstat (limited to 'src/common/mmo.hpp')
-rw-r--r-- | src/common/mmo.hpp | 336 |
1 files changed, 144 insertions, 192 deletions
diff --git a/src/common/mmo.hpp b/src/common/mmo.hpp index 151fa03..32d4285 100644 --- a/src/common/mmo.hpp +++ b/src/common/mmo.hpp @@ -2,39 +2,31 @@ #ifndef MMO_HPP #define MMO_HPP -# include <time.h> -# include "utils.hpp" // LCCWIN32 - -# define FIFOSIZE_SERVERLINK 256*1024 - -// set to 0 to not check IP of player between each server. -// set to another value if you want to check (1) -# define CMP_AUTHFIFO_IP 1 - -# define CMP_AUTHFIFO_LOGIN2 1 - -# define MAX_MAP_PER_SERVER 512 -# define MAX_INVENTORY 100 -# define MAX_AMOUNT 30000 -# define MAX_ZENY 1000000000 // 1G zeny -# define MAX_CART 100 -# define MAX_SKILL 450 -# define GLOBAL_REG_NUM 96 -# define ACCOUNT_REG_NUM 16 -# define ACCOUNT_REG2_NUM 16 -# define DEFAULT_WALK_SPEED 150 -# define MIN_WALK_SPEED 0 -# define MAX_WALK_SPEED 1000 -# define MAX_STORAGE 300 -# define MAX_GUILD_STORAGE 1000 -# define MAX_PARTY 12 -# define MAX_GUILD 120 // increased max guild members to accomodate for +2 increase for extension levels [Valaris] (removed) [PoW] -# define MAX_GUILDPOSITION 20 // increased max guild positions to accomodate for all members [Valaris] (removed) [PoW] -# define MAX_GUILDEXPLUSION 32 -# define MAX_GUILDALLIANCE 16 -# define MAX_GUILDSKILL 8 -# define MAX_GUILDCASTLE 24 // increased to include novice castles [Valaris] -# define MAX_GUILDLEVEL 50 +# include "sanity.hpp" +# include "timer.t.hpp" +# include "utils.hpp" + +constexpr int FIFOSIZE_SERVERLINK = 256 * 1024; + +constexpr int MAX_MAP_PER_SERVER = 512; +constexpr int MAX_INVENTORY = 100; +constexpr int MAX_AMOUNT = 30000; +constexpr int MAX_ZENY = 1000000000; // 1G zeny +constexpr int MAX_CART = 100; + +enum class SkillID : uint16_t; +constexpr SkillID MAX_SKILL = SkillID(474); // not 450 +constexpr SkillID get_enum_min_value(SkillID) { return SkillID(); } +constexpr SkillID get_enum_max_value(SkillID) { return MAX_SKILL; } + +constexpr int GLOBAL_REG_NUM = 96; +constexpr int ACCOUNT_REG_NUM = 16; +constexpr int ACCOUNT_REG2_NUM = 16; +constexpr interval_t DEFAULT_WALK_SPEED = std::chrono::milliseconds(150); +constexpr interval_t MIN_WALK_SPEED = interval_t::zero(); +constexpr interval_t MAX_WALK_SPEED = std::chrono::seconds(1); +constexpr int MAX_STORAGE = 300; +constexpr int MAX_PARTY = 12; # define MIN_HAIR_STYLE battle_config.min_hair_style # define MAX_HAIR_STYLE battle_config.max_hair_style @@ -43,29 +35,43 @@ # define MIN_CLOTH_COLOR battle_config.min_cloth_color # define MAX_CLOTH_COLOR battle_config.max_cloth_color -// for produce -# define MIN_ATTRIBUTE 0 -# define MAX_ATTRIBUTE 4 -# define ATTRIBUTE_NORMAL 0 -# define MIN_STAR 0 -# define MAX_STAR 3 +# define CHAR_CONF_NAME "conf/char_athena.conf" -# define MIN_PORTAL_MEMO 0 -# define MAX_PORTAL_MEMO 2 +namespace e +{ +enum class EPOS : uint16_t +{ + ZERO = 0x0000, -# define MAX_STATUS_TYPE 5 + LEGS = 0x0001, + WEAPON = 0x0002, + GLOVES = 0x0004, + CAPE = 0x0008, + MISC1 = 0x0010, + SHIELD = 0x0020, + SHOES = 0x0040, + MISC2 = 0x0080, + HAT = 0x0100, + TORSO = 0x0200, -# define CHAR_CONF_NAME "conf/char_athena.conf" + ARROW = 0x8000, +}; +ENUM_BITWISE_OPERATORS(EPOS) + +constexpr EPOS get_enum_min_value(EPOS) { return EPOS(0x0000); } +constexpr EPOS get_enum_max_value(EPOS) { return EPOS(0xffff); } +} +using e::EPOS; struct item { - int id; + int id; short nameid; short amount; - unsigned short equip; - char identify; - char refine; - char attribute; + EPOS equip; + uint8_t identify; + uint8_t refine; + uint8_t attribute; short card[4]; short broken; }; @@ -76,38 +82,100 @@ struct point short x, y; }; -struct skill +namespace e +{ +enum class SkillFlags : uint16_t; +} +using e::SkillFlags; + +struct skill_value { - unsigned short id, lv, flags; + unsigned short lv; + SkillFlags flags; }; struct global_reg { char str[32]; - int value; + int value; +}; + +// Option and Opt1..3 in map.hpp +namespace e +{ +enum class Option : uint16_t; +constexpr Option get_enum_min_value(Option) { return Option(0x0000); } +constexpr Option get_enum_max_value(Option) { return Option(0xffff); } +} +using e::Option; + +enum class ATTR +{ + STR = 0, + AGI = 1, + VIT = 2, + INT = 3, + DEX = 4, + LUK = 5, + + COUNT = 6, +}; + +constexpr ATTR ATTRs[6] = +{ + ATTR::STR, + ATTR::AGI, + ATTR::VIT, + ATTR::INT, + ATTR::DEX, + ATTR::LUK, +}; + +enum class ItemLook : uint16_t +{ + NONE = 0, + BLADE = 1, // or some other common weapons + _2, + SETZER_AND_SCYTHE = 3, + _6, + STAFF = 10, + BOW = 11, + _13 = 13, + _14 = 14, + _16 = 16, + SINGLE_HANDED_COUNT = 17, + + DUAL_BLADE = 0x11, + DUAL_2 = 0x12, + DUAL_6 = 0x13, + DUAL_12 = 0x14, + DUAL_16 = 0x15, + DUAL_26 = 0x16, }; struct mmo_charstatus { - int char_id; - int account_id; - int partner_id; + int char_id; + int account_id; + int partner_id; - int base_exp, job_exp, zeny; + int base_exp, job_exp, zeny; - short pc_class; + short species; short status_point, skill_point; - int hp, max_hp, sp, max_sp; - short option, karma, manner; + int hp, max_hp, sp, max_sp; + Option option; + short karma, manner; short hair, hair_color, clothes_color; - int party_id, guild_id; + int party_id; - short weapon, shield; + ItemLook weapon; + short shield; short head_top, head_mid, head_bottom; char name[24]; unsigned char base_level, job_level; - short str, agi, vit, int_, dex, luk; + earray<short, ATTR, ATTR::COUNT> attrs; unsigned char char_num, sex; unsigned long mapip; @@ -115,169 +183,53 @@ struct mmo_charstatus struct point last_point, save_point, memo_point[10]; struct item inventory[MAX_INVENTORY], cart[MAX_CART]; - struct skill skill[MAX_SKILL]; - int global_reg_num; + earray<skill_value, SkillID, MAX_SKILL> skill; + int global_reg_num; struct global_reg global_reg[GLOBAL_REG_NUM]; - int account_reg_num; + int account_reg_num; struct global_reg account_reg[ACCOUNT_REG_NUM]; - int account_reg2_num; + int account_reg2_num; struct global_reg account_reg2[ACCOUNT_REG2_NUM]; }; struct storage { - int dirty; - int account_id; + int dirty; + int account_id; short storage_status; short storage_amount; struct item storage_[MAX_STORAGE]; }; -struct guild_storage -{ - int dirty; - int guild_id; - short storage_status; - short storage_amount; - struct item storage_[MAX_GUILD_STORAGE]; -}; - struct map_session_data; struct gm_account { - int account_id; - int level; + int account_id; + int level; }; struct party_member { - int account_id; + int account_id; char name[24], map[24]; - int leader, online, lv; + int leader, online, lv; struct map_session_data *sd; }; struct party { - int party_id; + int party_id; char name[24]; - int exp; - int item; + int exp; + int item; struct party_member member[MAX_PARTY]; }; -struct guild_member -{ - int account_id, char_id; - short hair, hair_color, gender, pc_class, lv; - int exp, exp_payper; - short online, position; - int rsv1, rsv2; - char name[24]; - struct map_session_data *sd; -}; - -struct guild_position -{ - char name[24]; - int mode; - int exp_mode; -}; - -struct GuildAlliance -{ - int opposition; - int guild_id; - char name[24]; -}; - -struct GuildExpulsion -{ - char name[24]; - char mes[40]; - char acc[40]; - int account_id; - int rsv1, rsv2, rsv3; -}; - -struct guild_skill -{ - int id, lv; -}; - -struct guild -{ - int guild_id; - short guild_lv, connect_member, max_member, average_lv; - int exp, next_exp, skill_point, castle_id; - char name[24], master[24]; - struct guild_member member[MAX_GUILD]; - struct guild_position position[MAX_GUILDPOSITION]; - char mes1[60], mes2[120]; - int emblem_len, emblem_id; - char emblem_data[2048]; - GuildAlliance alliance[MAX_GUILDALLIANCE]; - GuildExpulsion explusion[MAX_GUILDEXPLUSION]; - struct guild_skill skill[MAX_GUILDSKILL]; -}; - -struct guild_castle -{ - int castle_id; - char map_name[24]; - char castle_name[24]; - char castle_event[24]; - int guild_id; - int economy; - int defense; - int triggerE; - int triggerD; - int nextTime; - int payTime; - int createTime; - int visibleC; - int visibleG0; - int visibleG1; - int visibleG2; - int visibleG3; - int visibleG4; - int visibleG5; - int visibleG6; - int visibleG7; - int Ghp0; // added Guardian HP [Valaris] - int Ghp1; - int Ghp2; - int Ghp3; - int Ghp4; - int Ghp5; - int Ghp6; - int Ghp7; - int GID0; - int GID1; - int GID2; - int GID3; - int GID4; - int GID5; - int GID6; - int GID7; // end addition [Valaris] -}; struct square { - int val1[5]; - int val2[5]; -}; - -enum -{ - GBI_EXP = 1, // ギルドのEXP - GBI_GUILDLV = 2, // ギルドのLv - GBI_SKILLPOINT = 3, // ギルドのスキルポイント - GBI_SKILLLV = 4, // ギルドスキルLv - - GMI_POSITION = 0, // メンバーの役職変更 - GMI_EXP = 1, // メンバーのEXP - + int val1[5]; + int val2[5]; }; #endif // MMO_HPP |