From 73ed64203442f42a21f8f98d25f7c0fade9262dc Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Tue, 14 May 2013 11:29:11 +1200 Subject: Add SHAREXP distinction, create UNKNOWNXP default Previously, KILLXP was being set as the catchall, which caused false positives for XP sharing. Update documentation accordingly. log version incremented to 4. --- src/map/map.cpp | 2 +- src/map/mob.cpp | 3 ++- src/map/party.cpp | 3 ++- src/map/pc.cpp | 5 ++++- src/map/pc.t.hpp | 2 ++ 5 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/src/map/map.cpp b/src/map/map.cpp index 152b3c8..a3f600a 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -1562,7 +1562,7 @@ void map_set_logfile(const char *filename) map_start_logfile(tv.tv_sec); - MAP_LOG("log-start v3"); + MAP_LOG("log-start v4"); } void map_log(const_string line) diff --git a/src/map/mob.cpp b/src/map/mob.cpp index a6070f0..be9e71d 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -2616,7 +2616,8 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, } } if (flag) // 各自所得 - pc_gainexp(tmpsd[i], base_exp, job_exp); + pc_gainexp_reason(tmpsd[i], base_exp, job_exp, + PC_GAINEXP_REASON::KILLING); } // 公平分配 for (int i = 0; i < pnum; i++) diff --git a/src/map/party.cpp b/src/map/party.cpp index 5f04b58..f737601 100644 --- a/src/map/party.cpp +++ b/src/map/party.cpp @@ -717,7 +717,8 @@ int party_exp_share(struct party *p, int mapid, int base_exp, int job_exp) return 0; for (i = 0; i < MAX_PARTY; i++) if ((sd = p->member[i].sd) != NULL && sd->bl.m == mapid) - pc_gainexp(sd, base_exp / c + 1, job_exp / c + 1); + pc_gainexp_reason(sd, base_exp / c + 1, job_exp / c + 1, + PC_GAINEXP_REASON::SHARING); return 0; } diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 255dc90..bcac46f 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -3114,7 +3114,7 @@ int pc_checkjoblevelup(struct map_session_data *sd) int pc_gainexp(struct map_session_data *sd, int base_exp, int job_exp) { return pc_gainexp_reason(sd, base_exp, job_exp, - PC_GAINEXP_REASON::KILLING); + PC_GAINEXP_REASON::UNKNOWN); } int pc_gainexp_reason(struct map_session_data *sd, int base_exp, int job_exp, @@ -3133,6 +3133,9 @@ int pc_gainexp_reason(struct map_session_data *sd, int base_exp, int job_exp, "KILLXP", "HEALXP", "SCRIPTXP", + "SHAREXP", + /* Insert new types here */ + "UNKNOWNXP" }}; MAP_LOG_PC(sd, "GAINXP %d %d %s", base_exp, job_exp, reasons[reason]); diff --git a/src/map/pc.t.hpp b/src/map/pc.t.hpp index 26e4d94..feffd89 100644 --- a/src/map/pc.t.hpp +++ b/src/map/pc.t.hpp @@ -8,7 +8,9 @@ enum class PC_GAINEXP_REASON KILLING = 0, HEALING = 1, SCRIPT = 2, + SHARING = 3, + UNKNOWN, COUNT, }; -- cgit v1.2.3-60-g2f50