summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt6
-rw-r--r--src/map/mob.c24
-rw-r--r--src/map/npc.c4
-rw-r--r--src/map/party.c6
-rw-r--r--src/map/party.h2
-rw-r--r--src/map/pc.c58
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/pet.c1
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/skill.c6
-rw-r--r--src/map/status.c1
11 files changed, 76 insertions, 36 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 11e485815..eef6e65c8 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,12 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/06/07
+ * Added pc_calcexp to calculate individual exp bonuses acquired from exp's
+ source (race bonus cards, SG Exp skills, pk-mode higher level exp) [Skotlex]
+ * pc_gain_exp now also receives the source of the exp, when said source
+ exists, bonuses are applicated as needed. [Skotlex]
+ * Added status_kill when capturing a mob, should take care of the mob not
+ respawning after caputed. [Skotlex]
* Fixed item info not displaying the found item id [Skotlex]
* Fixed item info not displaying the weight value properly. [Skotlex]
* Adjusted status resistances and durations taking as base Viccious's info
diff --git a/src/map/mob.c b/src/map/mob.c
index 7ee56773d..346003618 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1785,22 +1785,6 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if (md->sc.data[SC_RICHMANKIM].timer != -1)
bonus += md->sc.data[SC_RICHMANKIM].val2;
- if (tmpsd[i]->expaddrace[status->race])
- bonus += tmpsd[i]->expaddrace[status->race];
- bonus += tmpsd[i]->expaddrace[status->mode&MD_BOSS?RC_BOSS:RC_NONBOSS];
-
- if (battle_config.pk_mode &&
- (int)(md->db->lv - tmpsd[i]->status.base_level) >= 20) //Needed due to unsigned checks
- bonus += 15; // pk_mode additional exp if monster >20 levels [Valaris]
-
- //SG additional exp from Blessings [Komurka] - probably can be optimalized ^^;;
- if(md->class_ == tmpsd[i]->hate_mob[2] && (battle_config.allow_skill_without_day || is_day_of_star() || tmpsd[i]->sc.data[SC_MIRACLE].timer!=-1))
- bonus += 20*pc_checkskill(tmpsd[i],SG_STAR_BLESS);
- else if(md->class_ == tmpsd[i]->hate_mob[1] && (battle_config.allow_skill_without_day || is_day_of_moon()))
- bonus += 10*pc_checkskill(tmpsd[i],SG_MOON_BLESS);
- else if(md->class_ == tmpsd[i]->hate_mob[0] && (battle_config.allow_skill_without_day || is_day_of_sun()))
- bonus += 10*pc_checkskill(tmpsd[i],SG_SUN_BLESS);
-
if(battle_config.mobs_level_up && md->level > md->db->lv) // [Valaris]
bonus += (md->level-md->db->lv)*battle_config.mobs_level_up_exp_rate;
@@ -1885,14 +1869,14 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
}
if(flag) {
if(base_exp || job_exp)
- pc_gainexp(tmpsd[i],base_exp,job_exp);
+ pc_gainexp(tmpsd[i], &md->bl, base_exp,job_exp);
if(zeny) // zeny from mobs [Valaris]
- pc_getzeny(tmpsd[i],zeny);
+ pc_getzeny(tmpsd[i], zeny);
}
}
for(i=0;i<pnum;i++) //Party share.
- party_exp_share(pt[i].p,md->bl.m,pt[i].base_exp,pt[i].job_exp,pt[i].zeny);
+ party_exp_share(pt[i].p, &md->bl, pt[i].base_exp,pt[i].job_exp,pt[i].zeny);
} //End EXP giving.
if (!(type&1) &&
@@ -2043,7 +2027,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
clif_mvp_effect(mvp_sd);
clif_mvp_exp(mvp_sd,mexp);
- pc_gainexp(mvp_sd,mexp,0);
+ pc_gainexp(mvp_sd, &md->bl, mexp,0);
log_mvp[1] = mexp;
if(!map[md->bl.m].flag.nomvploot)
for(j=0;j<3;j++){
diff --git a/src/map/npc.c b/src/map/npc.c
index 72b71b8f9..6d950399d 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1213,7 +1213,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list)
z = z * (double)skill * (double)battle_config.shop_exp/10000.;
if (z < 1)
z = 1;
- pc_gainexp(sd,0,(int)z);
+ pc_gainexp(sd,NULL,0,(int)z);
}
}
@@ -1288,7 +1288,7 @@ int npc_selllist(struct map_session_data *sd,int n,unsigned short *item_list)
z = z * (double)skill * (double)battle_config.shop_exp/10000.;
if (z < 1)
z = 1;
- pc_gainexp(sd,0,(int)z);
+ pc_gainexp(sd,NULL,0,(int)z);
}
}
diff --git a/src/map/party.c b/src/map/party.c
index 736dd55a2..b7c00db4d 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -659,7 +659,7 @@ int party_send_xy_clear(struct party *p)
}
// exp share and added zeny share [Valaris]
-int party_exp_share(struct party *p,int map,unsigned int base_exp,unsigned int job_exp,int zeny)
+int party_exp_share(struct party *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny)
{
struct map_session_data* sd[MAX_PARTY];
int i;
@@ -668,7 +668,7 @@ int party_exp_share(struct party *p,int map,unsigned int base_exp,unsigned int j
nullpo_retr(0, p);
for (i = c = 0; i < MAX_PARTY; i++)
- if ((sd[c] = p->member[i].sd)!=NULL && sd[c]->bl.m == map && !pc_isdead(sd[c])) {
+ if ((sd[c] = p->member[i].sd)!=NULL && sd[c]->bl.m == src->m && !pc_isdead(sd[c])) {
if (battle_config.idle_no_share && (sd[c]->chatID || sd[c]->vender_id || (sd[c]->idletime < (last_tick - battle_config.idle_no_share))))
continue;
c++;
@@ -694,7 +694,7 @@ int party_exp_share(struct party *p,int map,unsigned int base_exp,unsigned int j
for (i = 0; i < c; i++)
{
- pc_gainexp(sd[i], base_exp, job_exp);
+ pc_gainexp(sd[i], src, base_exp, job_exp);
if (battle_config.zeny_from_mobs) // zeny from mobs [Valaris]
pc_getzeny(sd[i],bonus*zeny/(c*100));
}
diff --git a/src/map/party.h b/src/map/party.h
index 76954a4c5..f813c5020 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -39,7 +39,7 @@ int party_recv_message(int party_id,int account_id,char *mes,int len);
int party_check_conflict(struct map_session_data *sd);
int party_skill_check(struct map_session_data *sd, int party_id, int skillid, int skilllv);
int party_send_xy_clear(struct party *p);
-int party_exp_share(struct party *p,int map,unsigned int base_exp,unsigned int job_exp,int zeny);
+int party_exp_share(struct party *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny);
int party_share_loot(struct party *p, TBL_PC *sd, struct item *item_data);
int party_send_dot_remove(struct map_session_data *sd);
int party_sub_count(struct block_list *bl, va_list ap);
diff --git a/src/map/pc.c b/src/map/pc.c
index 6b270023b..68314ba8e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -36,6 +36,7 @@
#include "vending.h"
#include "atcommand.h"
#include "log.h"
+#include "date.h"
#ifndef TXT_ONLY // mail system [Valaris]
#include "mail.h"
@@ -3928,10 +3929,59 @@ int pc_checkjoblevelup(struct map_session_data *sd)
}
/*==========================================
+ * Alters experienced based on self bonuses that do not get even shared to the party.
+ *------------------------------------------
+ */
+static 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 *status = status_get_status_data(src);
+ unsigned int temp;
+
+ if (sd->expaddrace[status->race])
+ bonus += sd->expaddrace[status->race];
+ bonus += sd->expaddrace[status->mode&MD_BOSS?RC_BOSS:RC_NONBOSS];
+
+ //SG additional exp from Blessings [Komurka] - probably can be optimalized ^^;;
+ temp = status_get_class(src);
+ if(temp == sd->hate_mob[2] &&
+ (battle_config.allow_skill_without_day || is_day_of_star() || sd->sc.data[SC_MIRACLE].timer!=-1))
+ bonus += 20*pc_checkskill(sd,SG_STAR_BLESS);
+ else
+ if(temp == sd->hate_mob[1] &&
+ (battle_config.allow_skill_without_day || is_day_of_moon()))
+ bonus += 10*pc_checkskill(sd,SG_MOON_BLESS);
+ else
+ if(temp == sd->hate_mob[0] &&
+ (battle_config.allow_skill_without_day || is_day_of_sun()))
+ bonus += 10*pc_checkskill(sd,SG_SUN_BLESS);
+
+ if (battle_config.pk_mode &&
+ (int)(status_get_lv(src) - sd->status.base_level) >= 20)
+ bonus += 15; // pk_mode additional exp if monster >20 levels [Valaris]
+
+ if (!bonus)
+ return;
+
+ temp = *base_exp*bonus/100;
+ if (*base_exp > UINT_MAX - temp)
+ *base_exp = UINT_MAX;
+ else
+ *base_exp += temp;
+
+ temp = *job_exp*bonus/100;
+ if (*job_exp > UINT_MAX - temp)
+ *job_exp = UINT_MAX;
+ else
+ *job_exp += temp;
+
+ return;
+}
+/*==========================================
* ??値取得
*------------------------------------------
*/
-int pc_gainexp(struct map_session_data *sd,unsigned int base_exp,unsigned int job_exp)
+int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int base_exp,unsigned int job_exp)
{
char output[256];
float nextbp=0, nextjp=0;
@@ -3944,13 +3994,13 @@ int pc_gainexp(struct map_session_data *sd,unsigned int base_exp,unsigned int jo
if(!battle_config.pvp_exp && map[sd->bl.m].flag.pvp) // [MouseJstr]
return 0; // no exp on pvp maps
- if(sd->status.guild_id>0){ // ギルドに上納
+ if(sd->status.guild_id>0)
base_exp-=guild_payexp(sd,base_exp);
- }
+
+ if(src) pc_calcexp(sd, &base_exp, &job_exp, src);
nextb = pc_nextbaseexp(sd);
nextj = pc_nextjobexp(sd);
-
if(sd->state.showexp || battle_config.max_exp_gain_rate){
if (nextb > 0)
diff --git a/src/map/pc.h b/src/map/pc.h
index 9959bb4ec..47dd0b4aa 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -135,7 +135,7 @@ unsigned int pc_maxbaselv(struct map_session_data *sd);
unsigned int pc_maxjoblv(struct map_session_data *sd);
int pc_checkbaselevelup(struct map_session_data *sd);
int pc_checkjoblevelup(struct map_session_data *sd);
-int pc_gainexp(struct map_session_data*,unsigned int,unsigned int);
+int pc_gainexp(struct map_session_data*,struct block_list*,unsigned int,unsigned int);
unsigned int pc_nextbaseexp(struct map_session_data *);
unsigned int pc_nextjobexp(struct map_session_data *);
int pc_need_status_point(struct map_session_data *,int);
diff --git a/src/map/pet.c b/src/map/pet.c
index 3f88cfb41..091f733da 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -596,6 +596,7 @@ int pet_catch_process2(struct map_session_data *sd,int target_id)
if(rand()%10000 < pet_catch_rate) {
unit_remove_map(&md->bl,0);
+ status_kill(&md->bl);
clif_pet_rulet(sd,1);
// if(battle_config.etc_log)
// printf("rulet success %d\n",target_id);
diff --git a/src/map/script.c b/src/map/script.c
index 181b50084..9e082a61c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5625,7 +5625,7 @@ int buildin_getexp(struct script_state *st)
if(base<0 || job<0)
return 0;
if(sd)
- pc_gainexp(sd,base,job);
+ pc_gainexp(sd,NULL,base,job);
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 45305ba58..3bb3b6375 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -3178,7 +3178,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
heal_get_jobexp = heal_get_jobexp * battle_config.heal_exp / 100;
if (heal_get_jobexp <= 0)
heal_get_jobexp = 1;
- pc_gainexp (sd, 0, heal_get_jobexp);
+ pc_gainexp (sd, bl, 0, heal_get_jobexp);
}
}
break;
@@ -3250,7 +3250,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if (jexp < 1) jexp = 1;
}
if(exp > 0 || jexp > 0)
- pc_gainexp (sd, exp, jexp);
+ pc_gainexp (sd, bl, exp, jexp);
}
}
}
@@ -3368,7 +3368,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case SA_LEVELUP:
clif_skill_nodamage(src,bl,skillid,skilllv,1);
- if (sd && pc_nextbaseexp(sd)) pc_gainexp(sd, pc_nextbaseexp(sd) * 10 / 100, 0);
+ if (sd && pc_nextbaseexp(sd)) pc_gainexp(sd, NULL, pc_nextbaseexp(sd) * 10 / 100, 0);
break;
case SA_INSTANTDEATH:
clif_skill_nodamage(src,bl,skillid,skilllv,1);
diff --git a/src/map/status.c b/src/map/status.c
index afc1f2290..cdc916bdc 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -644,7 +644,6 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
map_delblock(target);
unit_free(target);
}
-
return hp+sp;
}