Jump to content

Recommended Posts

  • Forum Moderator

CLICK FOR VIDEO

 

 

  • Server\src\game\src\DragonSoul.h
Spoiler

//1.1) Search for:
	bool	DragonSoulItemInitialize(LPITEM pItem);
//1.2) Add after:
	bool	HasActivedAllSlotsByPage(const LPCHARACTER ch, const BYTE bPageIndex = DRAGON_SOUL_DECK_0) const;

 

  • Server\src\game\src\DragonSoul.cpp
Spoiler

//1.1) Search for:
BYTE GetStrengthIdx(DWORD dwVnum)
{
	return (dwVnum / 10) % 10;
}
//1.2) Add after:
bool DSManager::HasActivedAllSlotsByPage(const LPCHARACTER ch, const uint8_t bPageIndex) const
{
	if (!ch || bPageIndex >= DRAGON_SOUL_DECK_MAX_NUM)
		return false;

	const uint16_t iDragonSoulDeckAffectType = AFFECT_DRAGON_SOUL_DECK_0 + bPageIndex; // 540 + [0 or 1]
	if (!ch->FindAffect(iDragonSoulDeckAffectType))
		return false;

	// start : 32 + ([0 or 1] * 6) = [32 or 38]
	// end : start + 6
	const uint8_t iStartIndex = WEAR_MAX_NUM + (bPageIndex * DS_SLOT_MAX);
	const uint8_t iEndIndex = iStartIndex + DS_SLOT_MAX;
	
	uint8_t bSlotActive = 0;
	for (uint8_t bCell = iStartIndex; bCell < iEndIndex; ++bCell) // {0: 32-38, 1: 38-44}
	{
		const LPITEM pkItem = ch->GetWear(bCell);
		if (pkItem && pkItem->IsDragonSoul())
		{
			if (IsTimeLeftDragonSoul(pkItem) && IsActiveDragonSoul(pkItem))
				++bSlotActive;
		}
	}

	return (bSlotActive == DS_SLOT_MAX);
}

 

  • How-To-How-To-How-To-Use-Ex:

This is the hidden content, please

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 31
  • Good 8
  • Love 28
  • Forum Moderator
5 minutes ago, xP3NG3Rx said:

Why do you needed this?

b23195d607dc94368197b6020bf1dd1d.png

I posted the code some months ago and i thought is fine to be here too, not just in category of q&a.

DUVQfab.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 3

He means, on official server if you active a page with full mitic alchemy you will get a bonus from it, like the photo (screenshot from official).

 

W1xqq5FjKj.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 2
22 hours ago, VegaS™ said:

CLICK FOR VIDEO

  • Server\src\game\src\DragonSoul.h
  Reveal hidden contents


//1.1) Search for:
	bool	DragonSoulItemInitialize(LPITEM pItem);
//1.2) Add after:
	bool	AreActivedAllSlotsDragonSoulByPage(const LPCHARACTER ch, const BYTE bPageIndex = DRAGON_SOUL_DECK_0) const;
  • Server\src\game\src\DragonSoul.cpp
  Reveal hidden contents


//1.1) Search for:
BYTE GetStrengthIdx(DWORD dwVnum)
{
	return (dwVnum / 10) % 10;
}
//1.2) Add after:
bool DSManager::HasActivedAllSlotsByPage(const LPCHARACTER ch, const uint8_t bPageIndex) const
{
	if (!ch || bPageIndex >= DRAGON_SOUL_DECK_MAX_NUM)
		return false;

	const uint16_t iDragonSoulDeckAffectType = AFFECT_DRAGON_SOUL_DECK_0 + bPageIndex; // 540 + [0 or 1]
	if (!ch->FindAffect(iDragonSoulDeckAffectType))
		return false;

	// start : 32 + ([0 or 1] * 6) = [32 or 38]
	// end : start + 6
	const uint8_t iStartIndex = WEAR_MAX_NUM + (bPageIndex * DS_SLOT_MAX);
	const uint8_t iEndIndex = iStartIndex + DS_SLOT_MAX;
	
	uint8_t bSlotActive = 0;
	for (uint8_t bCell = iStartIndex; bCell < iEndIndex; ++bCell) // {0: 32-38, 1: 38-44}
	{
		const LPITEM pkItem = ch->GetWear(bCell);
		if (pkItem && pkItem->IsDragonSoul())
		{
			if (IsTimeLeftDragonSoul(pkItem) && IsActiveDragonSoul(pkItem))
				++bSlotActive;
		}
	}

	return (bSlotActive == DS_SLOT_MAX);
}

 

  • How-To-Use-Ex:
  Reveal hidden contents


#include "DragonSoul.h"

const DSManager & rkDSManager = DSManager::instance();
if (rkDSManager.HasActivedAllSlotsByPage(ch, DRAGON_SOUL_DECK_0))
{
	ch->ChatPacket(CHAT_TYPE_INFO, "DragonSoul: You've all of the dragon souls active in page 1.");
	// do something
}

if (rkDSManager.HasActivedAllSlotsByPage(ch, DRAGON_SOUL_DECK_1))
{
	ch->ChatPacket(CHAT_TYPE_INFO, "DragonSoul: You've all of the dragon souls active in page 2.");
	// do something
}

 

You are a genius! can i ask you for help? I don't know the c ++ language. can you write a function for this to work?

item.GetDSSetWeight(dsType, grade)
item.GetDSBasicApplyCount(dsType, grade)

item.GetDSBasicApplyValue(dsType, type)

item.GetDSAdditionalApplyValue(dsType, type)

 

	if app.ENABLE_DS_SET:
		def __AppendDragonSoulAttributeInformation(self, attrSlot, dsType = 0, grade = 0):

			if 0 != attrSlot:
				if grade != 0:
					setWeightValue = item.GetDSSetWeight(dsType, grade)
					basicApplyCount = item.GetDSBasicApplyCount(dsType, grade)
			
					for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
						type = attrSlot[i][0]
						value = attrSlot[i][1]

						if 0 == value:
							continue

						affectString = self.__GetAffectString(type, value)
						if affectString:
							affectColor = self.__GetAttributeColor(i, value)

							setValue = 0
							if i < basicApplyCount:
								setValue = item.GetDSBasicApplyValue(dsType, type)
							else:
								setValue = item.GetDSAdditionalApplyValue(dsType, type)

							if setValue != 0:
								setValue = (setValue * setWeightValue - 1)/100 + 1
								if affectString.find('%') == -1:
									self.AppendTwoColorTextLine(affectString, affectColor, " (+%d)" % (setValue))
								else:
									self.AppendTwoColorTextLine(affectString, affectColor, " (+%d%%)" % (setValue))
							else:
								self.AppendTextLine(affectString, affectColor)
				else:
					for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
						type = attrSlot[i][0]
						value = attrSlot[i][1]

						if 0 == value:
							continue

						affectString = self.__GetAffectString(type, value)
						if affectString:
							affectColor = self.__GetAttributeColor(i, value)
							self.AppendTextLine(affectString, affectColor)

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Honorable Member

Thanks!

For py usage:

PythonPlayer.cpp:

Spoiler

bool CPythonPlayer::_IsDSPageFull(BYTE page)
{
	if (page < 0 || page >= DS_DECK_MAX_NUM)
		return false;
	DWORD count = 0;
	DWORD startsize = c_DragonSoul_Equip_Start + c_DragonSoul_Equip_Slot_Max * page;
	const DWORD endsize = c_DragonSoul_Equip_Start + c_DragonSoul_Equip_Slot_Max * (page + 1);
	for (; startsize < endsize; ++startsize)
		if (GetItemIndex(TItemPos(INVENTORY, startsize)))
			count++;
	return count == c_DragonSoul_Equip_Slot_Max;
}

 

PythonPlayer.h:

Spoiler

//Find
		bool	IsCantFightInstance(DWORD dwVID);
///Add	
		bool 	_IsDSPageFull(BYTE page);

 

PythonPlayerModule.cpp:

Spoiler

PyObject * playerIsDSPageFull(PyObject* poSelf, PyObject* poArgs)
{
	int page;
	if (!PyTuple_GetInteger(poArgs, 0, &page))
		return Py_BuildException();
	return Py_BuildValue("i", CPythonPlayer::Instance()._IsDSPageFull(page));
}
//Find
		{ "GetName",					playerGetName,						METH_VARARGS },
///Add
		{ "IsDSPageFull",				playerIsDSPageFull,					METH_VARARGS },

 

Example:

	def TestDSFull(self):
		for i in xrange(player.DRAGON_SOUL_EQUIPMENT_PAGE_COUNT):
			if player.IsDSPageFull(i):
				chat.AppendChat(chat.CHAT_TYPE_INFO, "Page Full: %d" % i)
			else:
				chat.AppendChat(chat.CHAT_TYPE_INFO, "Page Not Full: %d" % i)	

 

  • Love 3

 

  • 2 weeks later...
  • Forum Moderator
On 10/15/2019 at 1:30 PM, Mali61 said:

PythonPlayer.cpp:


bool CPythonPlayer::_IsDSPageFull(BYTE page)
{
	if (page < 0 || page >= DS_DECK_MAX_NUM)
		return false;
	DWORD count = 0;
	DWORD startsize = c_DragonSoul_Equip_Start + c_DragonSoul_Equip_Slot_Max * page;
	const DWORD endsize = c_DragonSoul_Equip_Start + c_DragonSoul_Equip_Slot_Max * (page + 1);
	for (; startsize < endsize; ++startsize)
		if (GetItemIndex(TItemPos(INVENTORY, startsize)))
			count++;
	return count == c_DragonSoul_Equip_Slot_Max;
}

@Mali61 Good idea, but what i did doesn't work like this.

You've to check each dragon soul from all pages if they aren't expired and the specific page is activated too.

This is the hidden content, please

  • Metin2 Dev 21
  • Good 6
  • Love 13

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
  • 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.