DragonNest/GameCommon/ReputationSystem.cpp
2024-12-20 16:56:44 +08:00

32 lines
2.1 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.


#include "Stdafx.h"
#include "ReputationSystem.h"
#include "ReputationSystemEventHandler.h"
#if defined( PRE_ADD_NPC_REPUTATION_SYSTEM )
void IReputationSystem::Add( const eType Type, const REPUTATION_TYPE value, bool bIsReachMax )
{
bool bIsBeforeComplete = IsComplete( Type );
_Add( Type, value, bIsReachMax );
if( m_pEventHandler )
m_pEventHandler->OnChange( Type ); // Change Event
bool bIsAfterComplete = IsComplete( Type );
if( m_pEventHandler && bIsAfterComplete && !bIsBeforeComplete )
m_pEventHandler->OnComplete( this, Type ); // Complete Event
}
void IReputationSystem::Set( const eType Type, const REPUTATION_TYPE value )
{
bool bIsBeforeComplete = IsComplete( Type );
_Set( Type, value );
if( m_pEventHandler )
m_pEventHandler->OnChange( Type ); // Change Event
bool bIsAfterComplete = IsComplete( Type );
if( m_pEventHandler && bIsAfterComplete && !bIsBeforeComplete )
m_pEventHandler->OnComplete( this, Type ); // Complete Event
}
#endif // #if defined( PRE_ADD_NPC_REPUTATION_SYSTEM )