Resolves a potential crash from Howling Mine (#8147)

* Fixes #8146.
* Minor cleanups to ensure the Howling Mine status is active before accessing.
Thanks to @LadyNanuia!
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Aleos 2024-05-06 19:15:37 -04:00 committed by GitHub
parent ffbbb94080
commit 8546f9f089
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 9 deletions

View File

@ -6943,14 +6943,15 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
break;
}
// Triggered by RL_FLICKER
if (sd && sd->flicker && tsc && tsc->getSCE(SC_H_MINE) && tsc->getSCE(SC_H_MINE)->val2 == src->id) {
if (sd && sd->flicker) {
// Splash damage around it!
map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR|BL_SKILL,
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id);
flag |= 1; // Don't consume requirement
tsc->getSCE(SC_H_MINE)->val3 = 1; // Mark the SC end because not expired
status_change_end(bl, SC_H_MINE);
sc_start4(src, bl, SC_BURNING, 10 * skill_lv, skill_lv, 1000, src->id, 0, skill_get_time2(skill_id,skill_lv));
if (tsc &&tsc->getSCE(SC_H_MINE) && tsc->getSCE(SC_H_MINE)->val2 == src->id) {
status_change_end(bl, SC_H_MINE);
sc_start4(src, bl, SC_BURNING, 10 * skill_lv, skill_lv, 1000, src->id, 0, skill_get_time2(skill_id,skill_lv));
}
}
}
else

View File

@ -13682,22 +13682,24 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
}
break;
case SC_H_MINE:
{
// Drop the material from target if expired
struct item it;
// Only drop the material from target if expired naturally
if( tid != INVALID_TIMER ){
map_session_data *caster = nullptr;
if (sce->val3 || status_isdead(bl) || !(caster = map_id2sd(sce->val2)))
if (status_isdead(bl) || !(caster = map_id2sd(sce->val2)))
break;
std::shared_ptr<s_skill_db> skill = skill_db.find(RL_H_MINE);
if (!item_db.exists(skill->require.itemid[0]))
break;
memset(&it, 0, sizeof(it));
struct item it = {};
it.nameid = skill->require.itemid[0];
it.amount = max(skill->require.amount[0],1);
it.identify = 1;
map_addflooritem(&it, it.amount, bl->m,bl->x, bl->y, caster->status.char_id, 0, 0, 4, 0);
}
break;