Jump to content

semoka10

Member
  • Posts

    46
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by semoka10

  1. On 1/25/2023 at 12:22 AM, Sidelekbrytro said:

     

    spacer.png

     

    Dude please help, ui.py line 3025 is *elif Type == "thinboard_circle":

    Tried so many ways didnt found a solution, and i am stuck on this...

    Indentation (spaces and tabs) have meaning in Python. The error tells you the indentation at line 3025 is not correct. Maybe you have missing/extra spaces or mixed tabs with spaces (as that also caused issues, I think)

  2. With the goal of creating metin2 systems, what key concepts should i understand? Any course on that would be appreciated. I have basic knowledge of C++ (arrays, loops, basics of classes) and less of Python, and I'm struggling to understand (big) parts of the source code. For example. the way packets are used, or how you use python and c++ together, or literally anything about the models in game

  3. M2 Download Center

    This is the hidden content, please
    ( Internal )

    With this change, slow effect will also reduce attack speed, and will reduce movement speed more than before, making it a good bonus (and slow immunity relevant).

    Video: 

    1. Client Source/UserInterface/InstanceBase.h
    
    Search:
    
    AFFECT_NUM = 64,
    
    Add above:
    
    			AFFECT_SLOW_AS = 45,
    
    Search:
    
    NEW_AFFECT_BOW_DISTANCE,
    
    Add below:			
    			
    			NEW_AFFECT_SLOW_AS = 227,
    
    PythonCharacterModule.cpp:
    Search:
    
    PyModule_AddIntConstant(poModule, "AFFECT_SLOW",						CInstanceBase::AFFECT_SLOW);
    
    Add below:
    
    	PyModule_AddIntConstant(poModule, "AFFECT_SLOW_AS",						CInstanceBase::AFFECT_SLOW_AS);
    
    2. 
    game/src/affect.h
    
    Cauta:
    
    AFFECT_DEF_GRADE,		
    
    Add below:
    
    	AFFECT_SLOW_AS = 227,
    	
    Cauta:
    
    AFF_BITS_MAX
    
    Add above:
    
    	AFF_SLOW_AS=45,
    	
    battle.cpp:
    Search:
    
    	AttackAffect(pkAttacker, pkVictim, POINT_SLOW_PCT, IMMUNE_SLOW,  AFFECT_SLOW, POINT_MOV_SPEED, -30, AFF_SLOW, 20,		"SLOW");
    	
    Replace with:
    
    	if (pkAttacker->GetPoint(POINT_SLOW_PCT) && !pkVictim->IsAffectFlag(AFF_SLOW))
    	{
    		if (number(1, 100) <= pkAttacker->GetPoint(POINT_SLOW_PCT) && !pkVictim->IsImmune(IMMUNE_SLOW))
    		{
    			pkVictim->AddAffect(AFFECT_SLOW, POINT_MOV_SPEED, -50, AFF_SLOW, 10, 0, true);
    			pkVictim->AddAffect(AFFECT_SLOW_AS, POINT_ATT_SPEED, -40, AFF_SLOW_AS, 10, 0, true);
    		}
    	}
    
    char_affect.cpp:
    Search:
    
    RemoveAffect(AFFECT_SLOW);
    
    Add below:
    
    RemoveAffect(AFFECT_SLOW_AS);
    
    char_skill.cpp:
    Search:
    
    else if (IS_SET(m_pkSk->dwFlag, SKILL_FLAG_SLOW))
    
    Replace the content with:
    
    				{
    					if (iPct && !pkChrVictim->IsAffectFlag(AFF_SLOW))
    					{
    						if (number(1, 1000) <= iPct && !pkChrVictim->IsImmune(IMMUNE_SLOW))
    						{
    							pkChrVictim->AddAffect(AFFECT_SLOW, POINT_MOV_SPEED, -50, AFF_SLOW, 10, 0, true);
    							pkChrVictim->AddAffect(AFFECT_SLOW_AS, POINT_ATT_SPEED, -40, AFF_SLOW_AS, 10, 0, true);
    						}
    					}
    				}

    Note: to modify the values, change the values inside the AddAffect function call. Example:

     

    pkChrVictim->AddAffect(AFFECT_SLOW_AS, POINT_ATT_SPEED, -40, AFF_SLOW_AS, 10, 0, true);

     

    -40 is the value reduced, 10 is the duration of the debuff.

     

     

     

    Spoiler

    • Metin2 Dev 11
    • Good 4
    • Love 2
    • Love 6
  4. Image: 

     

     

    1. Client Source/UserInterface/PythonNonPlayer.cpp

    search:

    DWORD CPythonNonPlayer::GetMonsterMaxHP(DWORD dwVnum)

    below this function, add:

    DWORD CPythonNonPlayer::GetMonsterRegenPercent(DWORD dwVnum)
    {
    	const CPythonNonPlayer::TMobTable* c_pTable = GetTable(dwVnum);
    	if (!c_pTable)
    	{
    		DWORD bRegenPercent = 0;
    		return bRegenPercent;
    	}
    
    	return c_pTable->bRegenPercent;
    }
    
    DWORD CPythonNonPlayer::GetMonsterRegenRate(DWORD dwVnum)
    {
    	const CPythonNonPlayer::TMobTable* c_pTable = GetTable(dwVnum);
    	if (!c_pTable)
    	{
    		DWORD bRegenCycle = 0;
    		return bRegenCycle;
    	}
    
    	return c_pTable->bRegenCycle;
    }

    PythonNonPlayer.h:

    search:

    		DWORD				GetMonsterMaxHP(DWORD dwVnum);

    below, add:

    		DWORD               GetMonsterRegenRate(DWORD dwVnum);
    		DWORD               GetMonsterRegenPercent(DWORD dwVnum);

    PythonNonPlayerModule.cpp:

    search:

    PyObject * nonplayerGetMonsterMaxHP(PyObject * poSelf, PyObject * poArgs)

    add below:

    PyObject * nonplayerGetMonsterRegenRate(PyObject * poSelf, PyObject * poArgs)
    {
    	int race;
    	if (!PyTuple_GetInteger(poArgs, 0, &race))
    		return Py_BuildException();
    
    	CPythonNonPlayer& rkNonPlayer=CPythonNonPlayer::Instance();
    
    	return Py_BuildValue("i", rkNonPlayer.GetMonsterRegenRate(race));
    }
    PyObject * nonplayerGetMonsterRegenPercent(PyObject * poSelf, PyObject * poArgs)
    {
    	int race;
    	if (!PyTuple_GetInteger(poArgs, 0, &race))
    		return Py_BuildException();
    
    	CPythonNonPlayer& rkNonPlayer=CPythonNonPlayer::Instance();
    
    	return Py_BuildValue("i", rkNonPlayer.GetMonsterRegenPercent(race));
    }

    search:

    { "GetMonsterMaxHP",			nonplayerGetMonsterMaxHP,			METH_VARARGS },

    below, add:

    		{ "GetMonsterRegenRate",		nonplayerGetMonsterRegenRate,		METH_VARARGS },
    		{ "GetMonsterRegenPercent",		nonplayerGetMonsterRegenPercent,	METH_VARARGS },

    2. client/pack/root/uitarget.py:

    search:

    				self.AppendTextLine(localeInfo.TARGET_INFO_EXP % str(iExp))

    add below:

    				self.AppendTextLine(localeInfo.TARGET_INFO_REGEN % (str(nonplayer.GetMonsterRegenPercent(race)), str(nonplayer.GetMonsterRegenRate(race))))

    3. client/pack/locale/locale_game.txt

    search:

    TARGET_INFO_MAX_HP	Max. HP : %s

    add:

    TARGET_INFO_REGEN	HP Regen: %s%% every %s seconds

    Done!

     

     

    Bonus: If you don't want Target Info to show "Damage: 1-5" for Metin stones, in uitarget.py, replace:

    self.AppendTextLine(localeInfo.TARGET_INFO_DAMAGE % (str(iDamMin), str(iDamMax)))

    with

    				if not(nonplayer.IsMonsterStone(race)):
    					self.AppendTextLine(localeInfo.TARGET_INFO_DAMAGE % (str(iDamMin), str(iDamMax)))

     

    Spoiler

    • Metin2 Dev 3
    • Think 1
    • Good 2
    • Love 2
    • Love 7
  5.  

    I implemented penger's system for red name on item drop etc 

     but i have 1 problem, when I pick up skill books, the skill name is in korean. Anyone know where I can translate it?

    I found this line in item.cpp but I don;t know where to go next 

    Quote
                case ITEM_SKILLFORGET:
                {
                    const DWORD dwSkillVnum = (GetVnum() == ITEM_SKILLBOOK_VNUM || GetVnum() == ITEM_SKILLFORGET_VNUM) ? GetSocket(0) : 0;
                    const CSkillProtopSkill = (dwSkillVnum != 0) ? CSkillManager::instance().Get(dwSkillVnum) : NULL;
                    if (pSkill)
                        len = snprintf(szItemNamesizeof(szItemName), "%s"pSkill->szName);
     
                    break;
                }

    image of problem: 

    Figured it out, it reads from database skill_proto

    Spoiler

  6. I can't figure out how to change the text color of a specific line in the client, to be specific the "Succes rate" of upgrading an item. 

    In uirefine.py i have

    Spoiler

        def Open(self, scrollItemPos, targetItemPos):
            self.scrollItemPos = scrollItemPos
            self.targetItemPos = targetItemPos

            percentage = self.GetRefineSuccessPercentage(scrollItemPos, targetItemPos)
            if 0 == percentage:
                return
            self.successPercentage.SetText(localeInfo.REFINE_SUCCESS_PROBALITY % (percentage))

            itemIndex = player.GetItemIndex(targetItemPos)
            self.toolTip.ClearToolTip()
            metinSlot = []
            for i in xrange(player.METIN_SOCKET_MAX_NUM):
                metinSlot.append(player.GetItemMetinSocket(targetItemPos, i))
            self.toolTip.AddItemData(itemIndex, metinSlot)

            self.UpdateDialog()
            self.SetTop()
            self.Show()

    I think i have to change the color before  self.successPercentage.SetText(localeInfo.REFINE_SUCCESS_PROBALITY % (percentage))   but I couldn't find any function to do so. i'm really bad at Python, thanks for your help.

    • Metin2 Dev 1
  7.  

    1. Description of the problem / Question :

    When I teleport/logout/change character the client crashes. The 3 systems I added to a clean serverfile are great's offline shop, target info and decimal hp, it might be because one of them

     

    2. SysErr ( Client / Server ) / SysLog ( Server )

    empty, both client and server

    4. Screenshots ?

    if i debug the client with vs, it stops here: 

     

    Thanks, Sincerly,
    [[ Username ]]

     

    Spoiler

    • Good 1
  8. 3 hours ago, Asentrix said:

    You can find that ChatPacket in char_item.cpp in 

    
    bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)

    specifically

    
    if (pkItemToDrop->AddToGround(GetMapIndex(), pxPos))

    you'll find:

    
    ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Here's the text"));

    you can see if it isn't in locale_string.txt and solve it.

    Thanks, that was the correct way.

  9.  

    When I throw an item, I get korean text instead of the normal one. 

    In server syserr I get locale_find: LOCALE_ERROR: "떨어진 아이템은 1분 후 사라집니다.";

    I tried to add it to locale_string, but if I do that, all the other text in game is korean as well. (Note: If I add it first in locale_string, only that line I added works, if I add it last, none work at all)

    So any solution for this? Or otherwise, where can I remove the text entirely? Thanks

    • Metin2 Dev 1
  10. I need to import ctypes in uitarget.py (trying to do a small change to the target info system) so i can calculate string length in pixels, but i get this error and a client crash (when getting to character select)

    Quote

    networkModule.SetSelectCharacterPhase - <type 'exceptions.ImportError'>:No module named _ctypes

    I see it can't find the file, but I don't know how to solve this. I have a directory named ctypes in the client ( in the lib directory ), am i supposed to put it somewhere else?

  11. 7 minutes ago, Jxxkub said:

    most of them are linked from files that can be found inside the same folder - others are modules importerd from python itself

     

    all python files are located in root or root/uiscript

    Do you know where I can find wndMgr and item for example? Cause they aren't in root, but I don't think they are default modules of python either

  12. I'm trying to get a better understanding of the source code, what the functions do etc, but I can't find many of the included files. For example uitarget.py has

    Spoiler

    import app
    import uiToolTip
    import item
    import ui
    import player
    import net
    import wndMgr
    import messenger
    import guild
    import chr
    import nonplayer
    import localeInfo
    import constInfo

    but where exactly can i find these files? 

  13. 10 hours ago, TMP4 said:

    I don't think anyone will give you a c++ code, it's not 1-2 line.

     

    Alternative solution:

    You can make some shops for the same npc and at quest you open a random one. You can make a timer for it, or eventflag, or even you can use the date time or what meets your needs.

     

    example:

     

    when npcid.click begin

    local x = math.random(1,3)

    if x == 1 then npc.open_shop(1) end

    if x == 2 then npc.open_shop(2) end

    if x == 2 then npc.open_shop(3) end

    end

     

    -------------------------------------------------------------------

     

    Or grab gaya system and change point_gem to point_gold.

    You'll face some problem because it only support 1 slot items for example and the released one at turkmmo is quite bad made.

    The quest idea with a timer is exactly what I need, considering I don't want it 100% random so that it may get annoying. Thanks for the idea, hope I will be able to implement it

×
×
  • 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.