Fixed a map-server crash

Fixes #4614

Thanks to @reunite-ro
This commit is contained in:
Lemongrass3110 2020-02-08 16:35:02 +01:00
parent 735c76e3d3
commit ee96438607
3 changed files with 14 additions and 11 deletions

View File

@ -1063,7 +1063,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if( battle_config.ksprotection && mob_ksprotected(src, bl) )
return 0;
if( map_getcell(bl->m, bl->x, bl->y, CELL_CHKMAELSTROM) && skill_get_type(skill_id) != BF_MISC
if( map_getcell(bl->m, bl->x, bl->y, CELL_CHKMAELSTROM) && skill_id && skill_get_type(skill_id) != BF_MISC
&& skill_get_casttype(skill_id) == CAST_GROUND )
return 0;

View File

@ -344,16 +344,19 @@ int skill_unit_onleft(uint16 skill_id, struct block_list *bl,t_tick tick);
static int skill_unit_effect(struct block_list *bl,va_list ap);
static int skill_bind_trap(struct block_list *bl, va_list ap);
int skill_get_casttype (uint16 skill_id) {
int inf = skill_get_inf(skill_id);
if (inf&(INF_GROUND_SKILL))
return CAST_GROUND;
if (inf&INF_SUPPORT_SKILL)
return CAST_NODAMAGE;
e_cast_type skill_get_casttype (uint16 skill_id) {
std::shared_ptr<s_skill_db> skill = skill_db.find(skill_id);
if (inf&INF_SELF_SKILL) {
if( skill == nullptr ){
return CAST_DAMAGE;
}
if (skill->inf&(INF_GROUND_SKILL))
return CAST_GROUND;
if (skill->inf&INF_SUPPORT_SKILL)
return CAST_NODAMAGE;
if (skill->inf&INF_SELF_SKILL) {
if(skill->inf2[INF2_NOTARGETSELF])
return CAST_DAMAGE; //Combo skill.
return CAST_NODAMAGE;

View File

@ -452,9 +452,9 @@ void do_init_skill(void);
void do_final_skill(void);
/// Cast type
enum { CAST_GROUND, CAST_DAMAGE, CAST_NODAMAGE };
enum e_cast_type { CAST_GROUND, CAST_DAMAGE, CAST_NODAMAGE };
/// Returns the cast type of the skill: ground cast, castend damage, castend no damage
int skill_get_casttype(uint16 skill_id); //[Skotlex]
e_cast_type skill_get_casttype(uint16 skill_id); //[Skotlex]
const char* skill_get_name( uint16 skill_id ); // [Skotlex]
const char* skill_get_desc( uint16 skill_id ); // [Skotlex]
int skill_tree_get_max( uint16 skill_id, int b_class ); // Celest