Jump to content

Load Aura Effects at Startup


Recommended Posts

  • Honorable Member

Hello everyone.

In this small guide I'm gonna show you how to load the new Aura effects in automatically from the item_list.txt

Spoiler

1.0.) Open GameLib/ItemData.h
1.1.) Add this anywhere into the class CItemData as public (recommended below of the enums there)


#ifdef ENABLE_AURA_SYSTEM
		enum EAuraMisc
		{
			AURA_GRADE_MAX_NUM = 6,
		};
#endif

1.2.) Add the followings at the bottom of the class CItemData:


#ifdef ENABLE_AURA_SYSTEM
	protected:
		DWORD m_dwAuraEffectID;
	public:
		void SetAuraEffectID(const char* szAuraEffectPath);
		DWORD GetAuraEffectID() const { return m_dwAuraEffectID; }
#endif

2.0.) Open GameLib/ItemData.cpp
2.1.) Add the following code at the top of the file where the includes are:


#ifdef ENABLE_AURA_SYSTEM
	#include "../EffectLib/EffectManager.h"
#endif

2.2.) Paste this new function anywhere you want:


#ifdef ENABLE_AURA_SYSTEM
void CItemData::SetAuraEffectID(const char* szAuraEffectPath)
{
	if (szAuraEffectPath)
		CEffectManager::Instance().RegisterEffect2(szAuraEffectPath, &m_dwAuraEffectID);
}
#endif

2.2.) Last put this code into the CItemData::Clear function:


#ifdef ENABLE_AURA_SYSTEM
	m_dwAuraEffectID = 0;
#endif

3.0.) Open GameLib/ItemManager.cpp
3.1.) Edit your LoadItemScale function like this way: (I do not know how your look like so you must change a bit probably depends how your code looks like)


#ifdef ENABLE_AURA_SYSTEM
		CItemData* pItemData = MakeItemData(dwItemVNum);
		BYTE bGradeMax = CItemData::SASH_GRADE_MAX_NUM;
		if (pItemData->GetType() == CItemData::ITEM_TYPE_COSTUME && pItemData->GetSubType() == CItemData::COSTUME_AURA)
			bGradeMax = CItemData::AURA_GRADE_MAX_NUM;
		
		for (int i = 0; i < bGradeMax; ++i)
#else
		for (int i = 0; i < CItemData::SASH_GRADE_MAX_NUM; ++i)
#endif
		{
			pItemData = MakeItemData(dwItemVNum + i);
			if (pItemData)
				pItemData->SetItemTableScaleData(byJob, bySex, xScale, yScale, zScale, xPosScale, yPosScale, zPosScale);
		}

3.2.) In the LoadItemList function find this:


			if (4 == TokenVector.size())
			{
				const std::string& c_rstrModelFileName = TokenVector[3];
				pItemData->SetDefaultItemData(c_rstrIcon.c_str(), c_rstrModelFileName.c_str());
			}

3.3.) And replace it with this one:


			if (4 == TokenVector.size())
			{
#ifdef ENABLE_AURA_SYSTEM
				if (!strcmp(c_rstrType.c_str(), "AURA"))
				{
					const std::string& c_rstrAuraEffectFileName = TokenVector[3];
					pItemData->SetAuraEffectID(c_rstrAuraEffectFileName.c_str());
					pItemData->SetDefaultItemData(c_rstrIcon.c_str());
				}
				else
				{
					const std::string& c_rstrModelFileName = TokenVector[3];
					pItemData->SetDefaultItemData(c_rstrIcon.c_str(), c_rstrModelFileName.c_str());
				}
#else
				const std::string& c_rstrModelFileName = TokenVector[3];
				pItemData->SetDefaultItemData(c_rstrIcon.c_str(), c_rstrModelFileName.c_str());
#endif
			}

I am not gonna release more of this system, anyway I haven't reversed yet completely, but if you wanna see, how to attach the effect to your character when you equip the item here is an example:


bool CInstanceBase::SetAura(DWORD eAura)
{
	if (!IsPC() || IsPoly() || __IsShapeAnimalWear())
		return false;

	m_GraphicThingInstance.ChangePart(CRaceData::PART_AURA, eAura);
	if (!eAura)
	{
		if (m_auraRefineEffect)
		{
			__DetachEffect(m_auraRefineEffect);
			m_auraRefineEffect = 0;
		}
		m_adwPart[CRaceData::PART_AURA] = 0;
		return true;
	}

	CItemData* pItemData;
	if (!CItemManager::Instance().GetItemDataPointer(eAura, &pItemData))
	{
		if (m_auraRefineEffect)
		{
			__DetachEffect(m_auraRefineEffect);
			m_auraRefineEffect = 0;
		}
		m_adwPart[CRaceData::PART_AURA] = 0;
		return true;
	}

	BYTE byRace = (BYTE)GetRace();
	BYTE byJob = (BYTE)RaceToJob(byRace);
	BYTE bySex = (BYTE)RaceToSex(byRace);

	D3DXVECTOR3 scalePos = pItemData->GetItemScalePosition(byJob, bySex);
	if (IsMountingHorseOnly() && byJob != NRaceData::JOB_WOLFMAN)
		scalePos.z += 15.0f;

	m_auraRefineEffect = m_GraphicThingInstance.AttachEffectByID(NULL, "Bip01 Spine2", pItemData->GetAuraEffectID(), NULL, 0, FALSE, pItemData->GetItemScale(byJob, bySex).z, &scalePos);
	m_adwPart[CRaceData::PART_AURA] = eAura;

	return true;
}

 


Oh, yes. There are some of argument mistmatches because of the scaling and repositioning of the effects, what you can just delete.
Have fun with it ;)

  • Love 20
Link to comment
Share on other sites

Very nice thank you!

All other work fine, but there is something missing on "m_auraRefineEffect = m_GraphicThingInstance.AttachEffectByID(NULL, "Bip01 Spine2", pItemData->GetAuraEffectID(), NULL, 0, FALSE, pItemData->GetItemScale(byJob, bySex).z, &scalePos);"

Could you maybe Paste AttachEffectByID changes there?
Best regards!

  • Love 1
Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.