Jump to content

Readable DS Table


Recommended Posts

  • Bronze

M2 Download Center

This is the hidden content, please
( Internal )

Hey,

 

I had some free time and i make the DS Table more readable i saw a lot of people that can't understand how the table works and i decided to share it.

 

There is much more better ways and one is to rewrite the way that is reading the DS Table. At this one i just improved it to be readable.

 

In the Table bellow is including Wolfman Bonus so if you don't use him remove the additional bonus.

 

  • The Bonus is like official.

 

  • If you are using Myth DS Stones you can just add the extra values again and same in the .cpp .h files.

 

  • The extract for all the DS Stones is 100% you can change it from the (Dragon_Soul_Extract_Tables).

 

I saw some P-Servers that they got issues with DS Stones +5 - +6 got the same Bonus, or the Bonus at +6 is all perfect expect one,  in the table bellow all this kind of issues is fixed and tested.

 

Download

  • Metin2 Dev 18
  • Eyes 1
  • Good 5
  • Love 5
Link to comment
Share on other sites

  • Forum Moderator
1 hour ago, HITRON said:

There is much more better ways and one is to rewrite the way that is reading the DS Table. At this one i just improved it to be readable.

Thanks for release, but i don't see what's the scope for change dragon_soul_table.cpp with your file. (if you didn't change anything in the structure why to change it? like: just to put ds_name instead of dragonsoulname to have shorter name?)

I mean, all what you did is to remove some brackets, change variable names, declare them in one line, i don't think the term "improved to be readable" is good for 1000 lines in C++ with no documentation.

If you want to be readable, you should comment all the functions with what they do and how.

Tips for rewrite:

  • //TMapApplyGroup::iterator it
    TMapApplyGroup::const_iterator it
  • //CGroupTextParseTreeLoader* m_pLoader;
    //m_pLoader = new CGroupTextParseTreeLoader;
    //if (m_pLoader)
      //delete m_pLoader;
    
    std::shared_ptr<CGroupTextParseTreeLoader> m_pLoader;
    m_pLoader = std::make_shared<CGroupTextParseTreeLoader>();
  • bool DragonSoulTable::CheckWeightTables()
    {
    	// Group WeightTables Reading.
    	if (!m_pWeightTableNode)
    	{
    		sys_err ("dragon_soul_table.txt need WeightTables.");
    		return false;
    	}
    
    	for (size_t i = 0; i < m_vecDragonSoulTypes.size(); ++i)
    	{
    		for (uint8_t j = 0; j < DRAGON_SOUL_GRADE_MAX; ++j)
    		{
    			for (uint8_t k = 0; k < DRAGON_SOUL_STEP_MAX; ++k)
    			{
    				for (uint8_t l = 0; l < DRAGON_SOUL_STRENGTH_MAX; ++l)
    				{
    					float fWeight;
    					if (!GetWeight(m_vecDragonSoulTypes[i], j, k, l, fWeight))
    					{
    						sys_err("In %s group of WeightTables, value(Grade(%s), Step(%s), Strength(%d) is invalid.", m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str(), g_astStepName[k].c_str(), l);
    						return false;
    					}
    				}
    			}
    		}
    	}
    
    	return true;
    }
  • Use smart pointers also you can make most of them constants
  • Change the iterator with const_iterator
  • Remove some else conditions with no sense
  • Add return false inside of CheckWeightTables loops if the error has found why i should continue with iteration of 4 for loops and return true all times?
  • ...not so much things left

 

 

 

Edited by VegaS™
Link to comment
Share on other sites

  • Forum Moderator
On 2/5/2020 at 2:07 AM, hachiwari said:

I dont agree with "all the functions". Can you show confirmation of your words? article or sth?

I just talked about the terms "improved it to be readable", in my opinion readable and improved means a lot, not this:

This is the hidden content, please

Have no sense to make comments for ymir functions which are over 15 years, i just said about the term itself, don't understand me wrong, let's skip this (maybe my terms are bad). :D

Edited by VegaS™
  • Metin2 Dev 2
  • Love 4
Link to comment
Share on other sites

  • Bronze

@VegaS™ Is not about the C++ part, just wrong flag in the topic, is more about the .txt table to be readable, about the changes in .cpp in different story that i changed it before long time ago i just shared it like that to avoid to do again the .txt with the old names.

 

But now that you mention about the .cpp file improves i could update this too, but doesn't really matter the code is working fine.

Edited by HITRON
Link to comment
Share on other sites

  • Forum Moderator

I know it's not about the C++ part in this topic, that's why i said, if you don't change anything in the structure of file there's no reason to do that (just keep the old string names), also this category is for Programming / Scripts, then should be moved to Guides & HowTo (basically i think that's the right category for posting a .txt with clean settings for dragon_soul)

About code refactoring, we can do it later, if you've any questions you can send me a PM, i would like to contribute when i've time.

Edited by VegaS™
  • Love 3
Link to comment
Share on other sites

  • 9 months later...
  • Management

 Dead Download Link 

 Moved Topic 

 

If someone has the archive of this topic, can you send it to us? Thank you!

 

Puss In Boots Please GIF by swerk

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 2 months 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.