summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-08-14 09:45:56 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-08-14 09:45:56 +0000
commite1c7f1b188ed441801a0ad9932c08fc7e17517ca (patch)
tree9fb3f791513861b7ad66898e9ccaa8c8ddd65f71
parent46e3a8ecf6c3582876e195a62add9a5ccf3dd62c (diff)
downloadhercules-e1c7f1b188ed441801a0ad9932c08fc7e17517ca.tar.gz
hercules-e1c7f1b188ed441801a0ad9932c08fc7e17517ca.tar.bz2
hercules-e1c7f1b188ed441801a0ad9932c08fc7e17517ca.tar.xz
hercules-e1c7f1b188ed441801a0ad9932c08fc7e17517ca.zip
Follow up r16632, added check on level up so that the equip is automatically unequipped when you leave the elvmax range, special thanks to mistah_j for pointing out.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16633 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/atcommand.c1
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/pc.c25
-rw-r--r--src/map/pc.h2
4 files changed, 23 insertions, 9 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 4f4c7854a..cfa87c79a 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1584,6 +1584,7 @@ ACMD_FUNC(baselevelup)
clif_updatestatus(sd, SP_BASEEXP);
clif_updatestatus(sd, SP_NEXTBASEEXP);
status_calc_pc(sd, 0);
+ pc_baselevelchanged(sd);
if(sd->status.party_id)
party_send_levelup(sd);
return 0;
diff --git a/src/map/clif.c b/src/map/clif.c
index 6b18dc917..d97959b49 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2080,8 +2080,8 @@ void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, in
/// 4 = middle of screen, movable with a close button, chrome-less
void clif_cutin(struct map_session_data* sd, const char* image, int type)
{
- int fd;
-
+ int fd;
+
nullpo_retv(sd);
fd=sd->fd;
diff --git a/src/map/pc.c b/src/map/pc.c
index d1b4e752f..bea5b5c0a 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5421,12 +5421,12 @@ int pc_follow(struct map_session_data *sd,int target_id)
return 0;
}
-int pc_checkbaselevelup(struct map_session_data *sd)
-{
+int pc_checkbaselevelup(struct map_session_data *sd) {
unsigned int next = pc_nextbaseexp(sd);
if (!next || sd->status.base_exp < next)
return 0;
+
do {
sd->status.base_exp -= next;
//Kyoki pointed out that the max overcarry exp is the exp needed for the previous level -1. [Skotlex]
@@ -5449,8 +5449,7 @@ int pc_checkbaselevelup(struct map_session_data *sd)
status_calc_pc(sd,0);
status_percent_heal(&sd->bl,100,100);
- if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE)
- {
+ if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) {
sc_start(&sd->bl,status_skill2sc(PR_KYRIE),100,1,skill_get_time(PR_KYRIE,1));
sc_start(&sd->bl,status_skill2sc(PR_IMPOSITIO),100,1,skill_get_time(PR_IMPOSITIO,1));
sc_start(&sd->bl,status_skill2sc(PR_MAGNIFICAT),100,1,skill_get_time(PR_MAGNIFICAT,1));
@@ -5458,9 +5457,7 @@ int pc_checkbaselevelup(struct map_session_data *sd)
sc_start(&sd->bl,status_skill2sc(PR_SUFFRAGIUM),100,1,skill_get_time(PR_SUFFRAGIUM,1));
if (sd->state.snovice_dead_flag)
sd->state.snovice_dead_flag = 0; //Reenable steelbody resurrection on dead.
- } else
- if( (sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON )
- {
+ } else if( (sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON ) {
sc_start(&sd->bl,status_skill2sc(AL_INCAGI),100,10,600000);
sc_start(&sd->bl,status_skill2sc(AL_BLESSING),100,10,600000);
}
@@ -5469,9 +5466,23 @@ int pc_checkbaselevelup(struct map_session_data *sd)
if(sd->status.party_id)
party_send_levelup(sd);
+
+ pc_baselevelchanged(sd);
return 1;
}
+void pc_baselevelchanged(struct map_session_data *sd) {
+#ifdef RENEWAL
+ int i;
+ for( i = 0; i < EQI_MAX; i++ ) {
+ if( sd->equip_index[i] >= 0 ) {
+ if( sd->inventory_data[ sd->equip_index[i] ]->elvmax && sd->status.base_level > (unsigned int)sd->inventory_data[ sd->equip_index[i] ]->elvmax )
+ pc_unequipitem(sd, sd->equip_index[i], 3);
+ }
+ }
+#endif
+
+}
int pc_checkjoblevelup(struct map_session_data *sd)
{
unsigned int next = pc_nextjobexp(sd);
diff --git a/src/map/pc.h b/src/map/pc.h
index 0669edf3e..a62ea2b3b 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -924,4 +924,6 @@ int pc_load_combo(struct map_session_data *sd);
int pc_add_talisman(struct map_session_data *sd,int interval,int max,int type);
int pc_del_talisman(struct map_session_data *sd,int count,int type);
+void pc_baselevelchanged(struct map_session_data *sd);
+
#endif /* _PC_H_ */