Corrected some map property issues (#3435)

* Resolves PvP timers and effects not displaying properly.
* Resolves any GvG effects not displaying properly.
* If PvP or GvG is disabled, stop players from attacking.
* Moved PvP timer and attack functions to appropriate locations.
* Removed redundancy from atcommands.
This commit is contained in:
Aleos
2018-08-27 20:28:18 -04:00
committed by GitHub
parent 0f7f66396c
commit da83e61738
4 changed files with 59 additions and 64 deletions

View File

@@ -2140,6 +2140,26 @@ int unit_set_target(struct unit_data* ud, int target_id)
return 0;
}
/**
* Helper function used in foreach calls to stop auto-attack timers
* @param bl: Block object
* @param ap: func* with va_list values
* Parameter: '0' - everyone, 'id' - only those attacking someone with that id
* @return 1 on success or 0 otherwise
*/
int unit_stopattack(struct block_list *bl, va_list ap)
{
struct unit_data *ud = unit_bl2ud(bl);
int id = va_arg(ap, int);
if (ud && ud->attacktimer != INVALID_TIMER && (!id || id == ud->target)) {
unit_stop_attack(bl);
return 1;
}
return 0;
}
/**
* Stop a unit's attacks
* @param bl: Object to stop