summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorpanikon <panikon@zoho.com>2014-07-11 19:16:47 -0300
committerpanikon <panikon@zoho.com>2014-07-11 19:16:47 -0300
commitda4f06859fd49393ddd82c07a0586a20cb5ad4f6 (patch)
tree90c2b0052c5eaa49e5f1ef41b13ad25d555eaae1 /src/map/pc.c
parent901a8c9cdf891fb65e160094e52346b2aa4e9754 (diff)
downloadhercules-da4f06859fd49393ddd82c07a0586a20cb5ad4f6.tar.gz
hercules-da4f06859fd49393ddd82c07a0586a20cb5ad4f6.tar.bz2
hercules-da4f06859fd49393ddd82c07a0586a20cb5ad4f6.tar.xz
hercules-da4f06859fd49393ddd82c07a0586a20cb5ad4f6.zip
Fixed issue with quest exp and bonuses, issue: 8247 http://hercules.ws/board/index.php?app=tracker&showissue=8247
Corrected *getexp documentation Documented and changed pc_gainexp type
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 1ab9b0e2e..c23e510d6 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5943,9 +5943,9 @@ int pc_checkjoblevelup(struct map_session_data *sd)
return 1;
}
-/*==========================================
- * Alters experienced based on self bonuses that do not get even shared to the party.
- *------------------------------------------*/
+/**
+ * Alters EXP based on self bonuses that do not get shared with the party
+ **/
void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src) {
int bonus = 0;
struct status_data *st = status->get_status_data(src);
@@ -5976,19 +5976,23 @@ void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned in
return;
}
-/*==========================================
- * Give x exp at sd player and calculate remaining exp for next lvl
- *------------------------------------------*/
-int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int base_exp,unsigned int job_exp,bool is_quest) {
+
+/**
+ * Gives a determined EXP amount to sd and calculates remaining EXP for next level
+ * @param src if is NULL no bonuses are taken into account
+ * @param is_quest Used to let client know that the EXP was from a quest (clif->displayexp) PACKETVER >= 20091027
+ * @retval true success
+ **/
+bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int base_exp,unsigned int job_exp,bool is_quest) {
float nextbp=0, nextjp=0;
unsigned int nextb=0, nextj=0;
nullpo_ret(sd);
if(sd->bl.prev == NULL || pc_isdead(sd))
- return 0;
+ return false;
if(!battle_config.pvp_exp && map->list[sd->bl.m].flag.pvp) // [MouseJstr]
- return 0; // no exp on pvp maps
+ return false; // no exp on pvp maps
if(sd->status.guild_id>0)
base_exp-=guild->payexp(sd,base_exp);
@@ -6020,7 +6024,8 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
}
}
- //Cap exp to the level up requirement of the previous level when you are at max level, otherwise cap at UINT_MAX (this is required for some S. Novice bonuses). [Skotlex]
+ // Cap exp to the level up requirement of the previous level when you are at max level,
+ // otherwise cap at UINT_MAX (this is required for some S. Novice bonuses). [Skotlex]
if (base_exp) {
nextb = nextb?UINT_MAX:pc->thisbaseexp(sd);
if(sd->status.base_exp > nextb - base_exp)
@@ -6055,7 +6060,7 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
clif_disp_onlyself(sd,output,strlen(output));
}
- return 1;
+ return true;
}
/*==========================================