diff options
-rw-r--r-- | Changelog-Trunk.txt | 4 | ||||
-rw-r--r-- | src/map/guild.c | 2 | ||||
-rw-r--r-- | src/map/skill.c | 4 | ||||
-rw-r--r-- | src/map/status.c | 117 | ||||
-rw-r--r-- | src/map/status.h | 3 |
5 files changed, 73 insertions, 57 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 78fee0577..50a291539 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,10 @@ 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/04/07
+ * Added missing creation/destruction of the expcache_ers in guild.c
+ [Skotlex]
+ * Unified status_remove_buffs/status_remove_debuffs into a single function.
+ [Skotlex]
* Fixed pc_setpos ignoring the clrtype sent to it. [Skotlex]
* unit_free will now use clear type 3 for players (warping out effect)
[Skotlex]
diff --git a/src/map/guild.c b/src/map/guild.c index 5a4162730..cc5065c51 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -206,6 +206,7 @@ void do_init_guild(void) castle_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int));
guild_expcache_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int));
guild_infoevent_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int));
+ expcache_ers = ers_new((uint32)sizeof(struct guild_expcache));
guild_castleinfoevent_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int));
guild_read_castledb();
@@ -2002,4 +2003,5 @@ void do_final_guild(void) guild_expcache_db->destroy(guild_expcache_db,guild_expcache_db_final);
guild_infoevent_db->destroy(guild_infoevent_db,guild_infoevent_db_final);
guild_castleinfoevent_db->destroy(guild_castleinfoevent_db,guild_infoevent_db_final);
+ ers_destroy(expcache_ers);
}
diff --git a/src/map/skill.c b/src/map/skill.c index b440fbae1..67ca9f2f1 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -5277,7 +5277,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in sc_start(bl,SC_INCMATKRATE,100,-50,skill_get_time2(skillid,skilllv));
break;
case 2: // all buffs removed
- status_change_clear_buffs(bl);
+ status_change_clear_buffs(bl,1);
break;
case 3: // 1000 damage, random armor destroyed
{
@@ -6970,7 +6970,7 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign }
break;
case 1: // End all negative status
- status_change_clear_debuffs (bl);
+ status_change_clear_buffs(bl,2);
break;
case 2: // Level 10 Blessing
sc_start(bl,SC_BLESSING,100,10,skill_get_time2(sg->skill_id, sg->skill_lv));
diff --git a/src/map/status.c b/src/map/status.c index 7e31acb8f..86fc8fb29 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4281,8 +4281,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val break;
val2 = tick;
tick = 1000;
- status_change_clear_buffs(bl);
- status_change_clear_debuffs(bl); //Gospel clears both types.
+ status_change_clear_buffs(bl,3); //Remove buffs/debuffs
} else
calc_flag = 1;
break;
@@ -4318,7 +4317,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val break;
case SC_HERMODE:
- status_change_clear_buffs(bl);
+ status_change_clear_buffs(bl,1);
break;
case SC_REGENERATION:
@@ -5772,65 +5771,77 @@ int status_change_timer_sub(struct block_list *bl, va_list ap ) return 0;
}
-int status_change_clear_buffs (struct block_list *bl)
+/*==========================================
+ * Clears buffs/debuffs of a character.
+ * type&1 -> buffs, type&2 -> debuffs
+ *------------------------------------------
+ */
+int status_change_clear_buffs (struct block_list *bl, int type)
{
int i;
struct status_change *sc= status_get_sc(bl);
- if (!sc || !sc->count)
- return 0;
- for (i = 20; i < SC_MAX; i++) {
- if(i==SC_HALLUCINATION || i==SC_WEIGHT50 || i==SC_WEIGHT90
- || i == SC_QUAGMIRE || i == SC_SIGNUMCRUCIS || i == SC_DECREASEAGI
- || i == SC_SLOWDOWN || i == SC_ANKLE|| i == SC_BLADESTOP
- || i == SC_MINDBREAKER || i == SC_WINKCHARM
- || i == SC_STOP || i == SC_NOCHAT || i == SC_ORCISH
- || i == SC_STRIPWEAPON || i == SC_STRIPSHIELD || i == SC_STRIPARMOR || i == SC_STRIPHELM
- || i == SC_COMBO || i == SC_DANCING || i == SC_GUILDAURA
- )
- continue;
- if(i==SC_BERSERK) sc->data[i].val4 = 1;
- if(sc->data[i].timer != -1)
- status_change_end(bl,i,-1);
- }
- return 0;
-}
-int status_change_clear_debuffs (struct block_list *bl)
-{
- int i;
- struct status_change *sc = status_get_sc(bl);
+
if (!sc || !sc->count)
return 0;
+
+ if (type&2) //Debuffs
for (i = SC_COMMON_MIN; i <= SC_COMMON_MAX; i++) {
if(sc->data[i].timer != -1)
status_change_end(bl,i,-1);
}
- //Other ailments not in the common range.
- if(sc->data[SC_HALLUCINATION].timer != -1)
- status_change_end(bl,SC_HALLUCINATION,-1);
- if(sc->data[SC_QUAGMIRE].timer != -1)
- status_change_end(bl,SC_QUAGMIRE,-1);
- if(sc->data[SC_SIGNUMCRUCIS].timer != -1)
- status_change_end(bl,SC_SIGNUMCRUCIS,-1);
- if(sc->data[SC_DECREASEAGI].timer != -1)
- status_change_end(bl,SC_DECREASEAGI,-1);
- if(sc->data[SC_SLOWDOWN].timer != -1)
- status_change_end(bl,SC_SLOWDOWN,-1);
- if(sc->data[SC_MINDBREAKER].timer != -1)
- status_change_end(bl,SC_MINDBREAKER,-1);
- if(sc->data[SC_WINKCHARM].timer != -1)
- status_change_end(bl,SC_WINKCHARM,-1);
- if(sc->data[SC_STOP].timer != -1)
- status_change_end(bl,SC_STOP,-1);
- if(sc->data[SC_ORCISH].timer != -1)
- status_change_end(bl,SC_ORCISH,-1);
- if(sc->data[SC_STRIPWEAPON].timer != -1)
- status_change_end(bl,SC_STRIPWEAPON,-1);
- if(sc->data[SC_STRIPSHIELD].timer != -1)
- status_change_end(bl,SC_STRIPSHIELD,-1);
- if(sc->data[SC_STRIPARMOR].timer != -1)
- status_change_end(bl,SC_STRIPARMOR,-1);
- if(sc->data[SC_STRIPHELM].timer != -1)
- status_change_end(bl,SC_STRIPHELM,-1);
+
+ for (i = SC_COMMON_MAX+1; i < SC_MAX; i++) {
+
+ if(sc->data[i].timer == -1)
+ continue;
+
+ switch (i) {
+ //Stuff that cannot be removed
+ case SC_WEIGHT50:
+ case SC_WEIGHT90:
+ case SC_COMBO:
+ case SC_DANCING:
+ case SC_GUILDAURA:
+ case SC_SAFETYWALL:
+ case SC_NOCHAT:
+ case SC_ANKLE:
+ case SC_BLADESTOP:
+ case SC_CP_WEAPON:
+ case SC_CP_SHIELD:
+ case SC_CP_ARMOR:
+ case SC_CP_HELM:
+ continue;
+
+ //Debuffs that can be removed.
+ case SC_HALLUCINATION:
+ case SC_QUAGMIRE:
+ case SC_SIGNUMCRUCIS:
+ case SC_DECREASEAGI:
+ case SC_SLOWDOWN:
+ case SC_MINDBREAKER:
+ case SC_WINKCHARM:
+ case SC_STOP:
+ case SC_ORCISH:
+ case SC_STRIPWEAPON:
+ case SC_STRIPSHIELD:
+ case SC_STRIPARMOR:
+ case SC_STRIPHELM:
+ if (!(type&2))
+ continue;
+ break;
+ //The rest are buffs that can be removed.
+ case SC_BERSERK:
+ if (!(type&1))
+ continue;
+ sc->data[i].val4 = 1;
+ break;
+ default:
+ if (!(type&1))
+ continue;
+ break;
+ }
+ status_change_end(bl,i,-1);
+ }
return 0;
}
diff --git a/src/map/status.h b/src/map/status.h index 321724f53..df6cde41f 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -510,8 +510,7 @@ int status_change_end( struct block_list* bl , int type,int tid ); int status_change_timer(int tid, unsigned int tick, int id, int data);
int status_change_timer_sub(struct block_list *bl, va_list ap );
int status_change_clear(struct block_list *bl,int type);
-int status_change_clear_buffs(struct block_list *bl);
-int status_change_clear_debuffs(struct block_list *bl);
+int status_change_clear_buffs(struct block_list *bl, int type);
int status_calc_pet(struct map_session_data* sd, int first); // [Skotlex]
int status_calc_pc(struct map_session_data* sd,int first);
|