162 lines
4 KiB
C++
162 lines
4 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "DnRemoveStateBlow.h"
|
|||
|
|
#if defined( _GAMESERVER )
|
|||
|
|
#include "DnPlayerActor.h"
|
|||
|
|
#endif // #if defined( _GAMESERVER )
|
|||
|
|
|
|||
|
|
#if !defined( USE_BOOST_MEMPOOL )
|
|||
|
|
#ifdef _DEBUG
|
|||
|
|
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
|
|||
|
|
#endif
|
|||
|
|
#endif // #if !defined( USE_BOOST_MEMPOOL )
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
CDnRemoveStateBlow::CDnRemoveStateBlow( DnActorHandle hActor, const char* szValue ) : CDnBlow( hActor )
|
|||
|
|
{
|
|||
|
|
m_StateBlow.emBlowIndex = STATE_BLOW::BLOW_211;
|
|||
|
|
SetValue( szValue );
|
|||
|
|
m_fValue = 0.0f;
|
|||
|
|
|
|||
|
|
SetInfo(szValue);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CDnRemoveStateBlow::~CDnRemoveStateBlow(void)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnRemoveStateBlow::SetInfo(const char* szValue)
|
|||
|
|
{
|
|||
|
|
std::string str = szValue;//"ID1;ID2;.....;";//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ų ID<49><44><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>..
|
|||
|
|
std::vector<std::string> tokens;
|
|||
|
|
std::string delimiters = ";";
|
|||
|
|
|
|||
|
|
//
|
|||
|
|
TokenizeA(str, tokens, delimiters);
|
|||
|
|
|
|||
|
|
int nCount = (int)tokens.size();
|
|||
|
|
|
|||
|
|
for (int i = 0; i < nCount; ++i)
|
|||
|
|
{
|
|||
|
|
int nSkillID = atoi(tokens[i].c_str());
|
|||
|
|
if (nSkillID != 0)
|
|||
|
|
m_SkillIDList.insert(std::make_pair(nSkillID, nSkillID));
|
|||
|
|
else
|
|||
|
|
OutputDebug("%s SkillID[%d]=%s is invalid!!!\n", __FUNCTION__, i, tokens[i].c_str());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnRemoveStateBlow::OnBegin(LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
__super::OnBegin(LocalTime, fDelta);
|
|||
|
|
|
|||
|
|
#if defined(_GAMESERVER)
|
|||
|
|
RemoveStateBlowBySkillID();
|
|||
|
|
#endif // _GAMESERVER
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnRemoveStateBlow::Process( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
__super::Process( LocalTime, fDelta );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void CDnRemoveStateBlow::OnEnd( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
__super::OnEnd(LocalTime, fDelta);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#if defined(_GAMESERVER)
|
|||
|
|
void CDnRemoveStateBlow::RemoveStateBlowBySkillID()
|
|||
|
|
{
|
|||
|
|
DNVector(DnBlowHandle) vlBlowList;
|
|||
|
|
|
|||
|
|
FindSkillBlowList(m_hActor, vlBlowList);
|
|||
|
|
|
|||
|
|
int nBlowCount = (int)vlBlowList.size();
|
|||
|
|
for (int n = 0; n < nBlowCount; ++n)
|
|||
|
|
{
|
|||
|
|
DnBlowHandle hBlow = vlBlowList[n];
|
|||
|
|
if (!hBlow)
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
// <20><>ų <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Ȯ<><C8AE><EFBFBD><EFBFBD> <20><> <20>ϴ°ɷ<C2B0>..(<28><><EFBFBD><EFBFBD>?<3F><> <20><><EFBFBD>ؼ<EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD> <20><>ų <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD>.)
|
|||
|
|
CDnSkill::SkillInfo* pSkillInfo = const_cast<CDnSkill::SkillInfo*>(hBlow->GetParentSkillInfo());
|
|||
|
|
if (!pSkillInfo /*|| !pSkillInfo->hSkillUser*/)
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
//<2F>ڽſ<DABD><C5BF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>..
|
|||
|
|
m_hActor->CmdRemoveStateEffectFromID(hBlow->GetBlowID());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CDnRemoveStateBlow::FindSkillID(int nSkillID)
|
|||
|
|
{
|
|||
|
|
std::map<int, int>::iterator iter = m_SkillIDList.find(nSkillID);
|
|||
|
|
|
|||
|
|
return (iter != m_SkillIDList.end());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnRemoveStateBlow::FindSkillBlowList(DnActorHandle hActor, DNVector(DnBlowHandle)& vlBlowList)
|
|||
|
|
{
|
|||
|
|
if (!hActor)
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
int nStateBlowCount = hActor->GetNumAppliedStateBlow();
|
|||
|
|
|
|||
|
|
for (int i = 0; i < nStateBlowCount; ++i)
|
|||
|
|
{
|
|||
|
|
DnBlowHandle hBlow = hActor->GetAppliedStateBlow(i);
|
|||
|
|
if (!hBlow)
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
CDnSkill::SkillInfo* pSkillInfo = const_cast<CDnSkill::SkillInfo*>(hBlow->GetParentSkillInfo());
|
|||
|
|
//<2F><>ų <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>dzʶ<C7B3>. (<28><>ų <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>..(<28><><EFBFBD><EFBFBD>?<3F><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF>)
|
|||
|
|
if (!pSkillInfo /*|| !pSkillInfo->hSkillUser*/)
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
if (FindSkillID(pSkillInfo->iSkillID))
|
|||
|
|
vlBlowList.push_back(hBlow);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endif // _GAMESERVER
|
|||
|
|
|
|||
|
|
#if defined(PRE_ADD_PREFIX_SYSTE_RENEW)
|
|||
|
|
void CDnRemoveStateBlow::AddStateEffectValue(const char* szOrigValue, const char* szAddValue, std::string& szNewValue)
|
|||
|
|
{
|
|||
|
|
char szBuff[128] = {0, };
|
|||
|
|
|
|||
|
|
szNewValue = szOrigValue;
|
|||
|
|
//szOrigValue <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ";"<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20>ؼ<EFBFBD> szAddValue<75><65> <20>߰<EFBFBD> <20>Ѵ<EFBFBD>.
|
|||
|
|
int nLength = (int)strlen(szOrigValue);
|
|||
|
|
|
|||
|
|
if (nLength == 0 || szOrigValue[nLength - 1] == ';')
|
|||
|
|
szNewValue += szAddValue;
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
szNewValue += ";";
|
|||
|
|
szNewValue += szAddValue;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnRemoveStateBlow::RemoveStateEffectValue(const char* szOrigValue, const char* szAddValue, std::string& szNewValue)
|
|||
|
|
{
|
|||
|
|
char szBuff[128] = {0, };
|
|||
|
|
|
|||
|
|
//"###;###;###;###;....;##;##;##"
|
|||
|
|
//|<--<2D><><EFBFBD><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD>----->|<-AddValue->|
|
|||
|
|
|
|||
|
|
//szOrigValue<75><65><EFBFBD><EFBFBD> szAddValue <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><EFBFBD> <20><>ŭ <20>ڿ<EFBFBD><DABF><EFBFBD> <20>ڸ<EFBFBD><DAB8><EFBFBD>.
|
|||
|
|
int nOrigLength = (int)strlen(szOrigValue);
|
|||
|
|
int nAddLength = (int)strlen(szAddValue);
|
|||
|
|
int nCount = nOrigLength - nAddLength;
|
|||
|
|
|
|||
|
|
sprintf_s(szBuff, "%s", szOrigValue);
|
|||
|
|
szBuff[nCount] = 0;
|
|||
|
|
|
|||
|
|
szNewValue = szBuff;
|
|||
|
|
}
|
|||
|
|
#endif // PRE_ADD_PREFIX_SYSTE_RENEW
|