Jump to content

6 7 Attr always at max values


Go to solution Solved by ARiver,

Recommended Posts

  • Premium

Hello,

I have implemented official 6&7 attributes from Mali,

and i notice something while changing 6/7 bonuses.

The bonus are always set on their max value (value 5 from item_attr_rare table).

you can't encounter a lower value.

i have tried to load a clean TMP4 SF to check and i have ecountered the same issue

Can someone explain me why i have this bug or where to look for  ?

 

Best regards.

Link to comment
https://metin2.dev/topic/33172-6-7-attr-always-at-max-values/
Share on other sites

  • Premium

Up:

Here is what i have managed to found so far :

in item_attribute.cpp there is this function:

Spoiler
bool CItem::AddRareAttribute()
{
	int count = GetRareAttrCount();

	if (count >= 2)
		return false;

	int pos = count + 5;
	TPlayerItemAttribute & attr = m_aAttr[pos];

	int nAttrSet = GetAttributeSetIndex();
	std::vector<int> avail;

	for (int i = 0; i < MAX_APPLY_NUM; ++i)
	{
		const TItemAttrTable & r = g_map_itemRare[i];

		if (r.dwApplyIndex != 0 && r.bMaxLevelBySet[nAttrSet] > 0 && HasRareAttr(i) != true)
		{
			avail.push_back(i);
		}
	}

	const TItemAttrTable& r = g_map_itemRare[avail[number(0, avail.size() - 1)]];
	int nAttrLevel = 5;

	if (nAttrLevel > r.bMaxLevelBySet[nAttrSet])
		nAttrLevel = r.bMaxLevelBySet[nAttrSet];

	attr.bType = r.dwApplyIndex;
	attr.sValue = r.lValues[nAttrLevel - 1];

	UpdatePacket();

	Save();

	const char * pszIP = NULL;

	if (GetOwner() && GetOwner()->GetDesc())
		pszIP = GetOwner()->GetDesc()->GetHostName();

	LogManager::instance().ItemLog(pos, attr.bType, attr.sValue, GetID(), "SET_RARE", "", pszIP ? pszIP : "", GetOriginalVnum());
	return true;
}

If i modify the line :

int nAttrLevel = 5;

to something like :

int nAttrLevel = number (1,5);

(i have no experience so i try stuff...)

 

I can finally encounter a lower value than value 5 of item_rare_attr.

But something strange happens sometimes (kind of randomly it seems) : i can get a value that is not in the range of my item_rare_attr levels at all.

Like "resist half human +20%" but my max value is 12% (that's an example).

  • 2 weeks later...
  • Premium
On 11/24/2024 at 7:44 PM, jking said:

Try to debug what is inside in the

r.lValues

for example:

for (int i = 0; i < 5; ++i)
{
	sys_log(0, "i: %d, val: %d", i, r.lValues[i]);
}

and check what is inside

Thank you very much for you're help,

im currently facing another issue that i really wanna focus on and made me unable to use change bonus for now,

i'll try when i can and keep updated !

  • Premium

So thanks to you @ jking i manage to notice something.

As you can see in my ugly picture:

my ENCHANT_ELECT_PCT bonus have from value 1 to 5 : 5/7/10/12/15

but values are read as the line above in my table (ATTBONUS_MONSTER_PCT bonus with values : 1/2/3/4/5).

It's happening for every bonus the line above is read everytime i checked.

Thank you again !

  • Premium

Up: can someone help me identify the problem ?

when changing 6/7 bonus the values of some bonuses are read from the line above in db table.

 

I extended the check 

On 11/24/2024 at 7:44 PM, jking said:

Try to debug what is inside in the

r.lValues

for example:

for (int i = 0; i < 5; ++i)
{
	sys_log(0, "i: %d, val: %d", i, r.lValues[i]);
}

and check what is inside

to :

Spoiler
for (int i = 0; i < 5; ++i)
    {
        sys_log(0, "i: %d, val: %d, lvl: %d, type: %d", i, r.lValues[i], nAttrLevel, r.dwApplyIndex);

    }

in order to check that the apply number (or "r.dwApplyIndex" in the function) is reading the good bonus..

I Have erase my modifications on the function bool CItem::AddRareAttribute() and retry for a moment now before posting thisn problem still occure 

Can someone help find where the issue is coming from ? 

  • Premium
  • Solution

table item_rare_attr was the problem i redo it from TMP4 base.

I think now if i want bonus not always set on highest level, i can redo my modification 

int nAttrLevel = number (1,5);

 

On 12/12/2024 at 10:25 PM, ariver1514 said:

table item_rare_attr was the problem i redo it from TMP4 base.

I think now if i want bonus not always set on highest level, i can redo my modification 

int nAttrLevel = number (1,5);

 

Did you found how to prevent the problem about the index of bonus? (Chose the upper one to select the right one) 

I have same issue 

spacer.png

  • Premium
1 hour ago, yomidseven said:

Did you found how to prevent the problem about the index of bonus? (Chose the upper one to select the right one) 

I have same issue 

For me it was the index of enum in dB item_rare_attr table who wasn't in the right order of apply's enums in source.

And i had a unused bonus i added in protoreader.cpp (dB source) and dump_proto source itemcsvreader.cpp so the string in those two files did not match the order of apply's in sources client and server.

Best regards 

  • Love 1
Just now, ariver1514 said:

For me it was the index of enum in dB item_rare_attr table who wasn't in the right order of apply's enums in source.

And i had a unused bonus i added in protoreader.cpp (dB source) and dump_proto source itemcsvreader.cpp so the string in those two files did not match the order of apply's in sources client and server.

Best regards 

Yeah thanks, now I check again bc I still have issue

spacer.png

  • Premium
1 hour ago, yomidseven said:

Yeah thanks, now I check again bc I still have issue

Be careful as i find it's easy to miss something.

You Can check Root py part too or an error in locale_game.txt 

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.