Jump to content

VegaS™

Forum Moderator
  • Posts

    656
  • Joined

  • Last visited

  • Days Won

    187
  • Feedback

    100%

Posts posted by VegaS™

  1. Default code for SecondToXXX:

    Spoiler

     

    
    def SecondToDHM(time):
    	if time < 60:
    		if IsARABIC():
    			return '%.2f %s' % (time, SECOND)
    		else:
    			return '0' + MINUTE
    
    	minute = int((time / 60) % 60)
    	hour = int((time / 60) / 60) % 24
    	day = int(int((time / 60) / 60) / 24)
    
    	text = ''
    	if day > 0:
    		text += str(day) + DAY
    		text += ' '
    
    	if hour > 0:
    		text += str(hour) + HOUR
    		text += ' '
    
    	if minute > 0:
    		text += str(minute) + MINUTE
    	return text
    
    def SecondToHM(time):
    	if time < 60:
    		if IsARABIC():
    			return '%.2f %s' % (time, SECOND)
    		else:
    			return '0' + MINUTE
    
    	minute = int((time / 60) % 60)
    	hour = int((time / 60) / 60)
    
    	text = ''
    	if hour > 0:
    		text += str(hour) + HOUR
    		if hour > 0:
    			text += ' '
    
    	if minute > 0:
    		text += str(minute) + MINUTE
    	return text

     

    My extendable version: (I wrote that fast, so, if there's a problem with it, write me a pm, let's don't spam the topic.)

    This is the hidden content, please

    Results:

    print sec2time(100000, "DHMS")
    >>> 1Days 3Hours 46Minutes 40Seconds
    
    print sec2time(10000, "HMS")
    >>> 2Hours 46Minutes 40Seconds
    
    print sec2time(1000, "MS")
    >>> 16Minutes 40Seconds
    
    print sec2time(1000, "M")
    >>> 16Minutes
    
    print sec2time(100, "S")
    >>> 40Seconds
    
    print sec2time(3600, "DHMS", True)
    >>> 0Days 1Hours 0Minutes 0Seconds
    
    print sec2time(3600, "DHMS")
    >>> 1Hours

    I still don't have the right time to update the module but i'll do it asap.

    • Metin2 Dev 2
    • Love 13
  2. 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.

    • Love 3
  3. 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

    • Metin2 Dev 2
    • Love 4
  4. 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

     

     

     

  5. I don't know why people waste time for coding these things non-logical and call them "algorithm vs names fake" but it's fine, we're in 2020, everything is strange.

    You could do something better, stop doing anti-cheat things, you've no idea how they're working behind and even if you know something the checks are so bad and old things, maybe they was good back in 2010 in metin2, but for these times are 0.

    Don't take it bad, is just an advice.

    tnM0fab.jpg

    • Love 10
  6. 4 hours ago, Undead2014 said:

    i receive this

    cube.cpp: In function 'void Cube_open(CHARACTER*)':
    cube.cpp:289: error: ISO C++ forbids declaration of 'reload' with no type

    Edit: now it's working i change auto in char and it's working fine for the moment

     

    auto for variables specifies that the type of the variable that is being declared will be automatically deduced from its initializer, in your case, the variable type is a boolean, not char.

    static bool s_isInitializedCubeMaterialInformation = false;

    So, you should change it with bool instead of char or enable the c++11 mode when building (we're in 2020, everyone must have that).

    You can do that by adding -std=gnu++11 (to also get GCC extensions, which are on by default), or -std=c++11 (for only ISO C++) to your compiler flags, already there're some tutorials what other changes you've to do for achieve it.

    • Love 2
  7. 8 minutes ago, HITRON said:

    If you mean that the Poisoning is not updating in all characters that have clicked on the Target after or before then you are wrong

    I didn't mentioned anything about this. ?

    I said just you're wrong because you told me, "use this instead of adding new code in c++", and i told you that this function from module doesn't exist in source, but you edited the topic when i replied and you added a new function, it's fine.

    Let's chill, you take it too seriously.

    • Love 3
  8. 12 minutes ago, HITRON said:

    Or you can simply use chrmgr.HasAffectByVID(self.GetTargetVID(), chr.AFFECT_POISON) in Python instead to add new code in c++ to check if the vid is poisoned and you can change it also to AFFECT_BLEEDING, AFFECT_FIRE etc less code.

     

    You're wrong, i don't know from where you copy-paste this function, this isn't by default in metin2 source.

    Could be done this very easily too, but here we talked about the poisoning, why i should do something general for affects, this is another subject.

    @xP3NG3Rx Already shared this but is implemented via CPythonPlayer, which means is just for your client instance, you've to implement it in CInstanceBase for each of player instance and will work fine or try to use IsAffect as well.

     

    • Love 1
  9. You don't need server source for this, you can do it directly via source client.

    For being in real time you'll need to do a boolean variable inside of CInstanceBase class which is updated from RecvAffectAddPacketRecvAffectRemovePacket for each instance.

    So with that you could do a function like chrmgr.IsPoisoned(self.GetTargetVID()) which will result the status of poison for specific vid and check it in OnUpdate.

    Btw, the implementation is very bad, if i would want to do this, i don't touch the hpGauge, just add a new gauge bar over the hpGauge and hide/show it, that's all, could be done just with few lines, without ☠️ the python. 

    This is the hidden content, please

     

    • Metin2 Dev 92
    • Sad 1
    • Think 2
    • Confused 2
    • Scream 1
    • Good 19
    • Love 2
    • Love 37
  10. 16 minutes ago, teatone said:
    Spoiler

    I'm not the one who shut the game down. I don't understand your reaction to me? I reported this game for closure, and as a result it was closed. What I'm doing here is respecting German law and ending the game. You criticize where you thank. One day all Pvp servers will be shut down, whether you accept them or not. I will never stop being a pioneer and close follower of the legal process. Only because you know Vegas so well. If you're doing what she says just to benefit her, you've already lost control. A person who cannot afford a single piece of my project. How important can it be to me? I was following this forum, because the justice and judicial process is fair. But I see that there is no difference from other forums. 

    As I said, I didn't do anything that violated M2DEV laws. But unfortunately the fact that there is no justice will be revealed if I am banned.
     

    Now listen carefully; VegaS;
     

    You can try to mess with me and think it's wise, but there's a proverb;

    The issue becomes important when everyone fails;)

    Best Regards M2DEV Community

    I don't work with gameforge.

    If you have a problem with understanding, you should just say you can't understand. Game reporting about 1 week ago, and as a result was closed. Aeldra did not know until 1 week ago that she would have such a problem. If you don't understand it, it's not HITRON, but it's you.

    https://metin2.download/picture/tY0AphUOo5QYsNEx619N3on1xT0kVkat/.png
     

    Let me give a simpler example;

    Why did aeldra's owner stop me after the game was closed? 

    Instead of answering for answers, you have to learn to understand first.

    Now does your brain understand that?

     

     

    Can you f..... go away and stop spamming forum with your shits please? Nobody cares about your messages with no logic, you just searching for attention.

    • Love 6
  11. On 1/6/2020 at 12:55 PM, glosteng4141 said:

    59c87d0a57793173251ce89190cf9113.png

     

    On 1/7/2020 at 12:42 PM, Moț said:
    
    		if(!skill)
    			continue;

     

    I don't know how this 'petsystem' works, but i think the condition what he had is to check if the skill slot value isn't -1 or like.

    You replace the condition for no reason, i think you didn't understand the boolean conditions.

    • -1 to -2147483647 - True
    • 1 to 2147483647 - True
    • 0 - False
    • 1 - True

    So, with your condition the loop will count the -1 skill slot value too.

    • Love 3
  12. On 1/8/2020 at 10:34 PM, Owsap said:
    
    if USE_MONEY_K_FORMAT:
    	def FormatMoneyToK(string):
    		moneyString = str(string)
    		money = 0
    
    		if len(moneyString) > 1:
    			if 'k' in moneyString:
    				money = int(moneyString.replace('k', '000'))
    			elif 'K' in moneyString:
    				money = int(moneyString.replace('K', '000'))
    
    		return money

     

     

    The idea is good, but the code is bugged and unreadable, here're the bugs:

     

    text = '1kks'

    • ValueError: invalid literal for int() with base 10: '1000000s'

    text = '1kk500'

    • 1000000500

    text = '1abcd'

    • '1abcd'

     

    If I'm the one who do this, i would do it more extendable and using a proficient way.

     

    8f9d06c2fcb7f4525c2fe219a878a09d.png 4807153bd1bb3f4e9e4b00f492054864.png

     

    9197a657a56afcab56b8b17ce77806e1.png 2be07686886205e82d437108f547bbbd.png

    This is the hidden content, please

    At least, keep the copyright.

    • Metin2 Dev 67
    • Eyes 1
    • Sad 1
    • Smile Tear 1
    • Confused 1
    • Scream 1
    • Good 16
    • Love 2
    • Love 57
  13. Kimetsu no Yaiba ( Demon Slayer)

    sUWxfab.jpg

     

    Trailer:

    Spoiler

     

     

    Ever since the death of his father, the burden of supporting the family has fallen upon Tanjirou Kamado's shoulders. Though living impoverished on a remote mountain, the Kamado family are able to enjoy a relatively peaceful and happy life. One day, Tanjirou decides to go down to the local village to make a little money selling charcoal. On his way back, night falls, forcing Tanjirou to take shelter in the house of a strange man, who warns him of the existence of flesh-eating demons that lurk in the woods at night.

    When he finally arrives back home the next day, he is met with a horrifying sight—his whole family has been slaughtered. Worse still, the sole survivor is his sister Nezuko, who has been turned into a bloodthirsty demon. Consumed by rage and hatred, Tanjirou swears to avenge his family and stay by his only remaining sibling. Alongside the mysterious group calling themselves the Demon Slayer Corps, Tanjirou will do whatever it takes to slay the demons and protect the remnants of his beloved sister's humanity.

     

    • Love 4
  14. On 12/29/2019 at 10:52 PM, Mafuyu said:

    it doesnt works when your quest have defines before the state start :D

    xxxxxx/Flammenrun.quest:1:must start with 'quest'

     

    You've to use pre_qc.py or make some changes on your qc core for enable defines in quests.

     

    On 12/29/2019 at 10:52 PM, Mafuyu said:

    and yours doesnt tells you where it failed, u have to scroll the whole console up to the error, because it doesnt stop there or even tell you where it fails. you have to find it in the console by yourself :D

     

    Updated, check my previous reply again.

    • Love 2
  15. Spoiler
    
    
    void CPetActor::SetName()
    {
    	std::string petName = m_pkOwner->GetName();
    
    	if (true == IsSummoned() && m_dwVnum == 34025)
    	{
    		petName += " - |cFFFF0049|H|hPhoenix de Foc";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34010)
    	{
    		petName += " - |cFFc9ff00|H|hBambi";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34003)
    	{
    		petName += " - |cFF009DFF|H|hPhoenix de Gheata";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34004)
    	{
    		petName += " - |cFF732222|H|hMicul Azrael";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34005)
    	{
    		petName += " - |cFF528508|H|hPorcusor";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34006)
    	{
    		petName += " - |cFF528508|H|hRufus";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34007)
    	{
    		petName += " - |cFF528508|H|hKhan";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34008)
    	{
    		petName += " - |cFF528508|H|hLeonidas";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34009)
    	{
    		petName += " - |cFFDCE627|H|hMicul Azrael (Aur)";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34011)
    	{
    		petName += " - |cFF009DFF|H|hKnuud";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34012)
    	{
    		petName += " - |cFF009DFF|H|hBao Bao";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34013)
    	{
    		petName += " - |cFF732222|H|hMini Executor";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34014)
    	{
    		petName += " - |cFFDCE627|H|hMini Executor (Aur)";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34015)
    	{
    		petName += " - |cFFc9ff00|H|hBoney";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34016)
    	{
    		petName += " - |cFFA1C718|H|hPhoenix de Jad";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34017)
    	{
    		petName += " - |cFF109EC7|H|hPorkie Polar";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34019)
    	{
    		petName += " - |cFF109EC7|H|hArctis Khan";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34020)
    	{
    		petName += " - |cFF109EC7|H|hLeonidas Alb";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34021)
    	{
    		petName += " - |cFFc9ff00|H|hSheldon";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34022)
    	{
    		petName += " - |cFFc9ff00|H|hChooper";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34023)
    	{
    		petName += " - |cFFC97D87|H|hPui de Pantera";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34028)
    	{
    		petName += " - |cFF109EC7|H|hFulg de Nea";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34029)
    	{
    		petName += " - |cFF109EC7|H|hClopotel de Nea";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34030)
    	{
    		petName += " - |cFFF42B07|H|hElf Rosu";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34031)
    	{
    		petName += " - |cFF34962B|H|hElf Verde";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34032)
    	{
    		petName += " - |cFF6B6B6B|H|hJiangshi Junior";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34033)
    	{
    		petName += " - |cFF237A00|H|hMr Jiangshi";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34034)
    	{
    		petName += " - |cFF16ACB8|H|hShiver";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34035)
    	{
    		petName += " - |cFF16ACB8|H|hSnivel";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34036)
    	{
    		petName += " - |cFFA210AB|H|hLiliacul Bruce";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34037)
    	{
    		petName += " - |cFFA210AB|H|hLiliacul Wayne";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34038)
    	{
    		petName += " - |cFF77B8EA|H|hRamblue";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34039)
    	{
    		petName += " - |cFFD58DEE|H|hEweriel";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34040)
    	{
    		petName += " - |cFF732222|H|hMicul Huashin";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34100)
    	{
    		petName += " - |cFFE13066|H|hSemiluna Rosie";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34101)
    	{
    		petName += " - |cFF6271E3|H|hSemiluna Albastra";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34102)
    	{
    		petName += " - |cFFE13066|H|hLanterna Rosie";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34103)
    	{
    		petName += " - |cFF6271E3|H|hLanterna Albastra";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34104)
    	{
    		petName += " - |cFFF91ECE|H|hValentinia";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34105)
    	{
    		petName += " - |cFF6271E3|H|hValentino";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34106)
    	{
    		petName += " - |cFFE13066|H|hAmoras";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34107)
    	{
    		petName += " - |cFFE13066|H|hInima Iute";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34108)
    	{
    		petName += " - |cFF13A575|H|hBonsai";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34109)
    	{
    		petName += " - |cFF13A575|H|hDonnie";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned() && m_dwVnum == 34110)
    	{
    		petName += " - |cFF13A575|H|hBonnie";
    		
    		m_pkChar->SetName(petName);
    	}
    	else if (true == IsSummoned())
    	{
    		petName += " Companiot";
    		
    		m_pkChar->SetName(petName);
    	}
    
    	m_name = petName;
    }

     

    You could do it with a map.

    This is the hidden content, please

    Also you could use my

    This is the hidden content, please
    (there exists
    This is the hidden content, please
    ) for coloring a string, much easier.

    #include "cff.h"
    std::string text = CFF::format("Metin2", "green");
    std::string text = CFF::format(std::to_string(8000), "banana");
    std::string text = CFF::format(std::to_string(412.55), "red");
    std::string text = CFF::format("Pending", "#113355");
    std::string text = CFF::format("Item name:", "springgreen", CFF::FLAG_NEW_TAB) + CFF::format(pItemData->GetName(), "chocolate");
    
    std::vector<string> text = CFF::multi_format({"a", "b", "c"}, "red"); // text[0], text[1], text[2]

     

    • Metin2 Dev 50
    • Angry 2
    • Confused 1
    • Lmao 1
    • Good 13
    • Love 4
    • Love 25
  16. On 12/10/2019 at 11:58 PM, Morpheus™ said:

    Could somebody write on quest_list?

    Not tested, i'm not at home.

    What's new:

    • You can use comment sections in locale_list, helps you to identify much faster the quests.
    • Two methods of reading, if you enable QC_READ_FILE_FROM_LIST, all of the quests from locale_list will be compiled, if you enable QC_READ_ALL, all of the quests file from specific directory (folders/sub-folders) will be compiled.

    How-To-Use:

    • python make.py

    This is the hidden content, please

    • Metin2 Dev 17
    • Think 1
    • Good 2
    • Love 2
    • Love 16
×
×
  • 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.