Jump to content

VegaS™

Forum Moderator
  • Posts

    656
  • Joined

  • Last visited

  • Days Won

    187
  • Feedback

    100%

Posts posted by VegaS™

  1. Go in /share/locale/germany/questlib.lua and add at the end of file:

    -- common/length.h
    -- enum EWearPositions
    local wearPositionsTable = 
    {
    	'WEAR_BODY',
    	'WEAR_HEAD',
    	'WEAR_FOOTS',
    	'WEAR_WRIST',
    	'WEAR_WEAPON',
    	'WEAR_NECK',
    	'WEAR_EAR',
    	'WEAR_UNIQUE1',
    	'WEAR_UNIQUE2',
    	'WEAR_ARROW',
    	'WEAR_SHIELD',
    	'WEAR_ABILITY1',
    	'WEAR_ABILITY2',
    	'WEAR_ABILITY3',
    	'WEAR_ABILITY4',
    	'WEAR_ABILITY5',
    	'WEAR_ABILITY6',
    	'WEAR_ABILITY7',
    	'WEAR_ABILITY8',
    	'WEAR_COSTUME_BODY',
    	'WEAR_COSTUME_HAIR',
    	'WEAR_COSTUME_MOUNT',
    	'WEAR_COSTUME_SASH',
    	'WEAR_COSTUME_WEAPON',
    	'WEAR_RING1',
    	'WEAR_RING2',
    	'WEAR_BELT',
    	'WEAR_PENDANT',
    }
    
    for wearPos, wearName in ipairs(wearPositionsTable) do
         if type(wearName) == 'string' and string.find(wearName, "^WEAR_") then
            _G[wearName] = wearPos - 1
        end
    end

    So, now you can use in all quests:

    This is the hidden content, please

    • Metin2 Dev 13
    • Dislove 1
    • Good 5
    • Love 4
  2. On 3/29/2020 at 9:31 AM, HITRON said:

    I think the whole thing is wrong, cause there is not check for Ninja's when they are using Bow / Arrow and increase the Distance between the targets that they can reach with Tab so there is just a "Default" distance.

     

    • PythonCharacterManager.cpp

    Search for:

    			if (fRadiusDistance < 1500.0f)
    				m_vecTargetInstance.push_back(pkInstTarget);

    Replace it with:

    This is the hidden content, please

    • Metin2 Dev 18
    • Good 9
    • Love 18
  3. class okno(ui.BoardWithTitleBar):
        def __init__(self):

    You forgot to initialize the BoardWithTitleBar class:

    	ui.BoardWithTitleBar.__init__(self)

    For adding a button you can use:

    ui.MakeButton(parent, x, y, tooltipText, path, up, over, down)

     

    On 4/2/2020 at 11:19 PM, NoisyNoise said:
    
    
    try:
        import playerm2g2 as player
        chr.GetPixelPosition = player.GetMainCharacterPosition
    except:
        import player
    try:
        import chatm2g as chat
    except:
        import chat
    try:
        import m2netm2g as net
    except:
        import net
    try:
    	import chrmgrm2g as chrmgr
    except:
    	import chrmgr

     

    Also for importing excepting modules you could do something better:

    for (moduleName, shortModuleName) in (('playerm2g2', 'player'), ('chatm2g', 'chat'), ('chrmgrm2g', 'chrmgr')):
    	try:
    		module = __import__(moduleName)
    	except:
    		module = __import__(shortModuleName)
    
    	globals()[shortModuleName] = module

    So, this is the whole script:

    This is the hidden content, please

     

    • Metin2 Dev 3
    • Good 6
    • Love 7
  4. For those who need FN_compare_item_socket function and also with fixed 'memory leak' which already is public.

    • Srcs/game/src/char_item.cpp

    1.0) Add at the beginning of file:

    static bool FN_compare_item_socket(const LPITEM pkItemSrc, const LPITEM pkItemDest)
    {
    	if (!pkItemSrc || !pkItemDest)
    		return false;
    
    	return memcmp(pkItemSrc->GetSockets(), pkItemDest->GetSockets(), sizeof(long) * ITEM_SOCKET_MAX_NUM) == 0;
    }

    2.0) Search for:

    Spoiler
    
    
    			if (inv_item->GetType() == ITEM_BLEND)
    			{
    				if (inv_item->GetVnum() == item->GetVnum())
    				{
    					if (inv_item->GetSocket(0) == item->GetSocket(0) &&
    							inv_item->GetSocket(1) == item->GetSocket(1) &&
    							inv_item->GetSocket(2) == item->GetSocket(2) &&
    							inv_item->GetCount() < ITEM_MAX_COUNT)
    					{
    						inv_item->SetCount(inv_item->GetCount() + item->GetCount());
    						return inv_item;
    					}
    				}
    			}

     

     

    2.1) Replace it with:

    This is the hidden content, please

     

    • Metin2 Dev 41
    • Eyes 1
    • Confused 1
    • Scream 1
    • Lmao 1
    • Good 11
    • Love 2
    • Love 33
  5. You can do it directly with python, without doing a new function in binary.

    item.SelectItem(changelookvnum)
    print(item.GetItemName())

     

    On 3/19/2020 at 4:46 PM, Nirray said:
    
    
    PyObject * itemGetItemNameByVnum(PyObject * poSelf, PyObject * poArgs)
    {
    	int iIndex;
    	if (!PyTuple_GetInteger(poArgs, 0, &iIndex))
    		return Py_BadArgument();
    
    	if (!CItemManager::Instance().SelectItemData(iIndex))
    	{
    		TraceError("Cannot find item by %d", iIndex);
    		return Py_BuildNone(); // or
    		// CItemManager::Instance().SelectItemData(60001);
    	}
    
    	CItemData * pItemData = CItemManager::Instance().GetSelectedItemDataPointer();
    	if (!pItemData)
    		return Py_BuildException("no selected item data");
    
    	return Py_BuildValue("s", pItemData->GetName());
    }

    And if you really need it, you can do it as:

    This is the hidden content, please

     

     

    • Metin2 Dev 15
    • Good 7
    • Love 9
  6. @PACI That's right, i just wrote it fast without thinking about current pc and selected one.

    So basically after i checked again, seems that the're two ways to get this:

    • You don't have a party at all.
    • You've a party but your leader is offline and his character pointer is marked as null pointer since he got disconnected.

    I think that's why @Gurgarath said it's very rarely this crash, because of offline>null leader and trying to access the function GetVID() of it.

    So, if you want to show a message in game while doing the action, you could put this check before accessing the vid and do something with it, players will know that they doesn't satisfy one of these conditions.

    if (npc.get_leader_vid() == 0) then
    	syschat("You don't have a party or the leader is offline.")
    	return
    end

    And you need to modify the function like this for being able to do this check.

    This is the hidden content, please

     

    • Metin2 Dev 10
    • Good 1
    • Love 9
  7. Thanks for the fix, ymir left a lot of shits like these, this is an official quest example where you could get this crash core.

     

    8913eb22fec1c901232c39fdc0479d40.png

     

    Normally, if you want to get the party leader vid in some functions, of course we need to check if there's a party before accessing the function and don't even call it.

    You just have to use party.is_party before calling the function and everything will be fine, also you could put a message in your quests that player will know there's a problem (not just an error in server side that you will don't know where it comes from). So with that everybody will know that they're missing a condition and will stop the event/dungeon or something else.

    if not party.is_party() then
    	syschat("You need a party for doing this.")
    	return
    end

    This is an example of how should be the quest: (based on official example < spiderKingEgg)

    when 8002.kill with party.is_party() begin
    	local npc_leader_vid = npc.get_leader_vid()
    	syschat(string.format("%d", npc_leader_vid))
    end

    So, by doing that you can leave the function without the syserr which is irrelevant since is a condition from game and if something happens the result will be 0 all time.

    This is the hidden content, please

     

    • Metin2 Dev 7
    • Good 4
    • Love 9
  8. If you want to translate the fields from datetime module which they're translated depending of locale, you need to change the locale name, from:

    locale.setlocale(locale.LC_ALL, 'turkish')

    To: (you don't need to use also LC_ALL, since you use the module just for time)

    locale.setlocale(locale.LC_TIME, 'english')

    If you want to translate automatically based on player OS default language with a correct way and safe, i tried to do something like this for test, works fine. ?

    This is the hidden content, please

     

    • Metin2 Dev 3
    • Love 3
  9. On 2/29/2020 at 12:56 PM, iFreakTime~.~ said:

    And if i change my name directly from navicat? I think is better using pid instead of name

    There's no reason to use pids instead of names, for doing that you've to re-code the whole structure of the system.

    Ymir did when you change your name to delete all fields from table that match with the old name (account or companion).

    So in this case, instead of deleting the whole list you can simply update it.

    • Srcs/Server/game/src/questlua_pc.cpp

     

    This is the hidden content, please

    Or:

    		std::auto_ptr<SQLMsg> pUpdate(DBManager::instance().DirectQuery(
    			"UPDATE messenger_list SET "
    			"account = CASE WHEN account = '%s' THEN '%s' ELSE account END, "
    			"companion = CASE WHEN companion = '%s' THEN '%s' ELSE companion END", 
    				ch->GetName(), szName, ch->GetName(), szName);

     

    • Metin2 Dev 8
    • Love 8
  10. On 2/23/2020 at 3:57 PM, avertuss said:
    
    
    elif player.SKILL_INDEX_RIDING == skillIndex:
    	slotIndex = player.GetSkillSlotIndex(skillIndex)
    	skillLevel = player.GetSkillLevel(slotIndex)
    
    	self.AppendDefaultData(skillIndex)
    	if skillLevel == 1:
    		self.AppendSpace(5)
    		self.AppendTextLine("Test1", self.NORMAL_COLOR)
    	elif skillLevel == 20:
    		self.AppendSpace(5)
    		self.AppendTextLine("Test20", self.NORMAL_COLOR)

    Skill levels depends of skill grade also you've to clean the tooltip each time.

    This is the hidden content, please

    • Metin2 Dev 5
    • Good 2
    • Love 4
  11. On 2/22/2020 at 2:28 PM, ToXiC4000 said:
    
    
       char buf[512]; // bigger the texture bigger the buffer

     

    Why you modify the buffer size to 512? Your file name has more than 225 characters? I'm sure not, it's enough 256.

    Also you should do a check if your water texture file exists in your path for sure, otherwise everything will be fucked up with the array when trying to get texture pointer and function D3D texture. (possible crash because of nullptr)

    So, you should change:

    		m_WaterInstances[i].SetImagePointer((CGraphicImage *)CResourceManager::Instance().GetResourcePointer(buf));

    With:

    		if (CResourceManager::Instance().IsFileExist(buf))
    			m_WaterInstances[i].SetImagePointer(dynamic_cast<CGraphicImage *>(CResourceManager::Instance().GetResourcePointer(buf)));

     

    Also, instead of change everywhere 30 with 99 or what value you want, you should do a constant variable and use it everywhere.

    This is the hidden content, please

    Also this is the good method for accessing the array with a safe method.

    	STATEMANAGER.SetTexture(0, m_WaterInstances[((ELTimer_GetMSec() / 70) % 30)].GetTexturePointer()->GetD3DTexture());
    [...]
    	auto pImageInstance = m_WaterInstances[(ELTimer_GetMSec() / 70) % _countof(m_WaterInstances)];
    	if (pImageInstance.GetTexturePointer())
    		STATEMANAGER.SetTexture(0, pImageInstance.GetTexturePointer()->GetD3DTexture());

     

    • Metin2 Dev 8
    • Smile Tear 1
    • Think 1
    • Good 3
    • Love 2
    • Love 18
  12. On 2/15/2020 at 1:23 PM, Anix said:

    Sorry if i couldn't do the job, im a beginner. I thought it's easier but it seems not.

    On 2/15/2020 at 5:56 PM, ergod said:

    @VegaS™ maybe can you help us? :D

     

     

    im here GIF by Leroy Patterson

     

    The basic changes are:

    From:

    	def __SelectSkillGroup(self, index):
    		for btn in self.skillGroupButton:
    			btn.SetUp()
    		self.skillGroupButton[index].Down()
    
    		if self.__CanUseHorseSkill():
    			if 0 == index:
    				index = net.GetMainActorSkillGroup()-1
    			elif 1 == index:
    				index = self.PAGE_HORSE
    
    		self.curSelectedSkillGroup = index
    		self.__SetSkillSlotData(net.GetMainActorRace(), index+1, net.GetMainActorEmpire())

    To:

    This is the hidden content, please

     

    After some minutes of debugging I rewrote this shit, there're more changes, when i'll have some free time (at Monday), i'll post the code.

    Without skill group +/- horse riding:

    With skill group +/- horse riding:

    • Metin2 Dev 21
    • Angry 1
    • Good 8
    • Love 1
    • Love 12
  13. The function PolymorphCharacter from CPolymorphUtils class is called just if you use 50322 item vnum and it's used just the type POMYMORPH_SPD_BONUS, rest of them are unused.

    If you want to do this change for polymorph itself with the item 70104, try to do this:

    Open file char_item.cpp and search for:

    				AddAffect(AFFECT_POLYMORPH, POINT_ATT_BONUS, dwBonus, AFF_POLYMORPH, iDuration, 0, false);

    Replace with: (have careful when you do copy-paste of a code from code tag, if you get the error "expected a ;") - the code tag is shitty, for solve this copy the code into notepad and set the encoding to ANSI then copy to visual studio.

    This is the hidden content, please

    Also you can take a look into int CHARACTER::GetPolymorphPoint(BYTE type) const, there're some calculations too, if you want to change them or remove.

    • Metin2 Dev 6
    • Good 2
    • Love 2
  14. You've to do something like this:

    static const uint16_t POLYMORPH_BONUS_MONSTER[SKILL_MAX_LEVEL + 1] =
    {
    	0, // reserved
    	10, 20, 30, 40, 50, 60, 70, 80, 90, 100, // 1-10
    	110, 120, 130, 140, 150, 160, 170, 180, 190, 200, // 11-20
    	210, 220, 230, 240, 250, 260, 270, 280, 290, 300, // 21-30
    	310, 320, 330, 340, 350, 360, 370, 380, 390, 400 // 31-40
    };
    
    pChar->AddAffect(AFFECT_POLYMORPH, POINT_ATTBONUS_MONSTER, POLYMORPH_BONUS_MONSTER[bySkillLevel], AFF_POLYMORPH, dwDuration - 1, 0, false);

     

    • Love 2
  15. 3 hours ago, Miruko said:

    I have no reason to publish the solution. Fortunately there are a lot of dev here, I suppose that they can find a solution too(or not?) 

     

    And you should be banned too (or not?), because of people like you these forums are going down.

    Do you think a 'developer' is your slave?

     

    I want to mention here for all the kids like you which have nothing related with metin2 development and don't know what this 'developer' thing means.

    Nobody from here is a real developer for metin2, this word means more than a tag on a forum.

    Developers for metin2 are just the guys which did this game and know the whole game, you can stay another 5-10 years to develop this source and you'll still don't know everything, the source is too big, hundreds of thousands of files, many languages and technologies ared used, some things are hard written and hard to read their 20 years ago structure.

    'Metin2 developers', all what they've is just some knowledge in some parts of source and basic or good knowledge in specific languages (99% of them can't write an application from 0, outside of metin2, but it's fine), that's all.

    If they were good enough, they would at least get a job in programming (as many people have already done that), but most of them are just doing this for win some money and don't take programming as the first priority in their life, so.. i don't think they're 'developers' if they do that.

     

    Btw, for your information:

    Quote

    (2.5) Questions & Answers specific rules

    • Don't modify your thread (or reply to it) to mark it solved, and not explain the solution to the issue.
    • Love 6
×
×
  • 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.