Fixed a cant.attack bypass (#7753)

Fixed a pointer being always null

Fixes #7743

Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Singe Horizontal 2023-05-16 16:17:28 +02:00 committed by GitHub
parent af28882a6f
commit 8fd3e2d5e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1922,13 +1922,18 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per
*/ */
bool status_check_skilluse(struct block_list *src, struct block_list *target, uint16 skill_id, int flag) { bool status_check_skilluse(struct block_list *src, struct block_list *target, uint16 skill_id, int flag) {
struct status_data *status; struct status_data *status;
status_change *sc = NULL, *tsc;
int hide_flag; int hide_flag;
status = src ? status_get_status_data(src) : &dummy_status; if (src) {
if (src->type != BL_PC && status_isdead(src))
return false;
status = status_get_status_data(src);
}else{
status = &dummy_status;
}
if (src && src->type != BL_PC && status_isdead(src)) status_change *sc = status_get_sc(src);
return false; status_change *tsc = status_get_sc(target);
if (!skill_id) { // Normal attack checks. if (!skill_id) { // Normal attack checks.
if (sc && sc->cant.attack) if (sc && sc->cant.attack)
@ -1945,12 +1950,8 @@ bool status_check_skilluse(struct block_list *src, struct block_list *target, ui
switch( skill_id ) { switch( skill_id ) {
#ifndef RENEWAL #ifndef RENEWAL
case PA_PRESSURE: case PA_PRESSURE:
if( flag && target ) { if( flag && tsc && tsc->option&OPTION_HIDE)
// Gloria Avoids pretty much everything.... return false; // Gloria Avoids pretty much everything....
tsc = status_get_sc(target);
if(tsc && tsc->option&OPTION_HIDE)
return false;
}
break; break;
#endif #endif
case GN_WALLOFTHORN: case GN_WALLOFTHORN:
@ -1973,9 +1974,6 @@ bool status_check_skilluse(struct block_list *src, struct block_list *target, ui
break; break;
} }
if ( src )
sc = status_get_sc(src);
if( sc && sc->count ) { if( sc && sc->count ) {
if (sc->getSCE(SC_ALL_RIDING)) if (sc->getSCE(SC_ALL_RIDING))
return false; //You can't use skills while in the new mounts (The client doesn't let you, this is to make cheat-safe) return false; //You can't use skills while in the new mounts (The client doesn't let you, this is to make cheat-safe)
@ -2094,11 +2092,9 @@ bool status_check_skilluse(struct block_list *src, struct block_list *target, ui
} }
} }
if (target == NULL || target == src) // No further checking needed. if (target == nullptr || target == src) // No further checking needed.
return true; return true;
tsc = status_get_sc(target);
if (tsc && tsc->count) { if (tsc && tsc->count) {
/** /**
* Attacks in invincible are capped to 1 damage and handled in battle.cpp. * Attacks in invincible are capped to 1 damage and handled in battle.cpp.