diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/mmo.h | 24 | ||||
-rw-r--r-- | src/common/utils.c | 22 | ||||
-rw-r--r-- | src/common/utils.h | 1 |
3 files changed, 40 insertions, 7 deletions
diff --git a/src/common/mmo.h b/src/common/mmo.h index 9bb9837ab..52f68b719 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -276,7 +276,11 @@ STATIC_ASSERT(MAX_ITEM_OPTIONS <= 5, "This value is limited by the client and da #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] @@ -418,7 +422,7 @@ enum e_item_bound_type { #endif }; -enum { +enum e_option { OPTION_NOTHING = 0x00000000, OPTION_SIGHT = 0x00000001, OPTION_HIDE = 0x00000002, @@ -593,7 +597,7 @@ struct mmo_charstatus { int mother; int child; - unsigned int base_exp,job_exp; + uint64 base_exp, job_exp; int zeny; int bank_vault; @@ -612,10 +616,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 { + short weapon; ///< Weapon view sprite id. + short shield; ///< Shield view sprite id. + short head_top; ///< Top headgear view sprite id. + short head_mid; ///< Middle headgear view sprite id. + short head_bottom; ///< Bottom headgear view sprite id. + short robe; ///< Robe view sprite id. + } look; char name[NAME_LENGTH]; int base_level, job_level; @@ -847,6 +855,7 @@ enum rodex_opentype { RODEX_OPENTYPE_MAIL = 0, RODEX_OPENTYPE_ACCOUNT = 1, RODEX_OPENTYPE_RETURN = 2, + RODEX_OPENTYPE_UNSET = 3, }; enum MAIL_TYPE { @@ -913,7 +922,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, @@ -1132,6 +1141,7 @@ enum ammo_type { A_KUNAI, //7 A_CANNONBALL, //8 A_THROWWEAPON, //9 + MAX_AMMO_TYPE }; enum e_char_server_type { diff --git a/src/common/utils.c b/src/common/utils.c index bcfc153e3..0d76a885e 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -359,6 +359,28 @@ unsigned int get_percentage(const unsigned int A, const unsigned int B) return (unsigned int)floor(result); } +/// calculates the value of A / B, in percent (rounded down) +uint64 get_percentage64(const uint64 A, const uint64 B) +{ + double result; + + if( B == 0 ) + { + ShowError("get_percentage(): division by zero! (A=%"PRIu64",B=%"PRIu64")\n", A, B); + return ~0U; + } + + result = 100 * ((double)A / (double)B); + + if( result > UINT_MAX ) + { + ShowError("get_percentage(): result percentage too high! (A=%"PRIu64",B=%"PRIu64",result=%g)\n", A, B, result); + return UINT_MAX; + } + + return (uint64)floor(result); +} + /** * Applies a percentual rate modifier. * diff --git a/src/common/utils.h b/src/common/utils.h index 9d3c323ef..e77c63cf2 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -44,6 +44,7 @@ bool exists(const char* filename); /// calculates the value of A / B, in percent (rounded down) unsigned int get_percentage(const unsigned int A, const unsigned int B); +uint64 get_percentage64(const uint64 A, const uint64 B); int64 apply_percentrate64(int64 value, int rate, int maxrate); int apply_percentrate(int value, int rate, int maxrate); |