mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
add players to aggro table when using actions so script callbacks work
This commit is contained in:
parent
4fcef21481
commit
9fb1f8c2d5
1 changed files with 20 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "Script/ScriptMgr.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
#include "Actor/BNpc.h"
|
||||
|
||||
#include <Network/CommonActorControl.h>
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
|
@ -335,6 +336,25 @@ void Sapphire::Action::Action::damageTarget( uint32_t potency, Entity::Chara& ch
|
|||
else
|
||||
entry.value = static_cast< int16_t >( potency );
|
||||
|
||||
// add to aggro table
|
||||
// todo: probably move this into takeDamage? this is pretty garbage
|
||||
if( chara.isBattleNpc() )
|
||||
{
|
||||
auto bNpc = chara.getAsBNpc();
|
||||
if( bNpc )
|
||||
{
|
||||
if( bNpc->getStance() != Common::Stance::Active )
|
||||
{
|
||||
bNpc->aggro( getSourceChara() );
|
||||
bNpc->hateListUpdate( getSourceChara(), potency );
|
||||
}
|
||||
else
|
||||
{
|
||||
bNpc->hateListUpdate( getSourceChara(), potency );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// todo: aspected damage?
|
||||
chara.takeDamage( potency );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue