Jump to content

ReFresh

Active Member
  • Posts

    1797
  • Joined

  • Last visited

  • Days Won

    4
  • Feedback

    0%

Posts posted by ReFresh

  1. GameLib/ActorInstanceBattle.cpp:

    1. #include "../UserInterface/PythonNonPlayer.h" at the top under the other includes.

    2. Look for:

    Spoiler
    extern bool IS_HUGE_RACE(unsigned int vnum);
        if(IS_HUGE_RACE(rkActorDst.GetRace()))
        {
            return false;
        }

    Below add:

    Spoiler
    const CPythonNonPlayer::TMobTable* mobTable = CPythonNonPlayer::instance().GetTable(rkActorDst.GetRace());
        if (mobTable)
        {
            if (mobTable->bRank >= CPythonNonPlayer::MOB_RANK_BOSS)
            {
                return false;
            }
        }

    This will fix the problem with bosses, which are using skills. If you're talking about player sync delay this is the only solution:

    • Love 1
  2. @avertusss

    File: root/uiattachmetin.py

    Spoiler
    Find:
      newToolTip.SetPosition(230 + 20, 38)
      
    Change to:
      newToolTip.SetPosition(300 + 20, 38)
    
    Find:
      newWidth = self.newToolTip.GetWidth() + 230 + 15 + 20
    
    Change to:
      newWidth = self.newToolTip.GetWidth() + 300 + 15 + 20
      
    Find:
      self.SetPosition(x, y)
    
    Change to:
      self.SetCenterPosition()

    File: uiscript/attachstonedialog.py

    Spoiler

    spacer.png

    I believe this will fix your problem with font.

  3. I would be really glad, if someone can help me little bit, because I'm really stucked here and got no idea how to get the invite senderName on the invited player question dialog. I think problem is on server side, where it's not getting the senderName value.

    File: src/game/guild.cpp

    Spoiler
    void CGuild::Invite( LPCHARACTER pchInviter, LPCHARACTER pchInvitee )
    {
    	{ ... }
    
    	DWORD gid = GetID();
    
    	TPacketGCGuild p;
    	p.header	= HEADER_GC_GUILD;
    	p.size	= sizeof(p) + sizeof(DWORD) + GUILD_NAME_MAX_LEN + 1 + CHARACTER_NAME_MAX_LEN + 1; //Added + CHARACTER_NAME_MAX_LEN + 1
    	p.subheader	= GUILD_SUBHEADER_GC_GUILD_INVITE;
    
    	TEMP_BUFFER buf;
    	buf.write( &p, sizeof(p) );
    	buf.write( &gid, sizeof(DWORD) );
    	buf.write( GetName(), GUILD_NAME_MAX_LEN + 1 );
    	buf.write( pchInvitee->GetName(), CHARACTER_NAME_MAX_LEN + 1 ); //Added this line
    
    	pchInvitee->GetDesc()->Packet( buf.read_peek(), buf.size() );
      
      }

     

    File: UserInterface/PythonNetworkStreamPhaseGame.cpp

    Spoiler
    case GUILD_SUBHEADER_GC_GUILD_INVITE:
    		{
    			DWORD dwGuildID;
    			if (!Recv(sizeof(dwGuildID), &dwGuildID))
    				return false;
    
    			char szGuildName[GUILD_NAME_MAX_LEN + 1];
    			if (!Recv(GUILD_NAME_MAX_LEN, &szGuildName))
    				return false;
    
    			//ADDED THIS:
    			char szSenderName[CHARACTER_NAME_MAX_LEN + 1];
    			if (!Recv(CHARACTER_NAME_MAX_LEN, &szSenderName))
    				return false;
    
    			szGuildName[GUILD_NAME_MAX_LEN] = 0;
    			//ADDED THIS:
    			szSenderName[CHARACTER_NAME_MAX_LEN] = 0;
    
    
    			PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "RecvGuildInviteQuestion", Py_BuildValue("(iss)", dwGuildID, szGuildName, szSenderName)); //ADDED 's' and szSenderName
    			Tracef(" <Guild Invite> %d, %s, %s\n", dwGuildID, szGuildName, szSenderName);
    			break;
    		}

     

    File: root/game.py

    Spoiler
    def RecvGuildInviteQuestion(self, guildID, guildName, senderName): #Added senderName
      {...}
      guildInviteQuestionDialog.SetText1(localeInfo.GUILD_DO_YOU_JOIN_1 % (senderName, guildName)) #Added senderName
      {...}

     

    File: locale/locale_game.txt

    Spoiler
    GUILD_DO_YOU_JOIN_1	%s invited you to guild %s. #ADDED %s for senderName
  4. On 6/15/2022 at 2:47 AM, VegaS™ said:

    Video with the  fix: https://metin2.download/video/gV3x7RhoJZsJnMY6C61nEvmBOGrvnNn0/.mp4

    I just implemented right now that function and after some tests, I found that GetPartItemID was always set to 0 when you used an emotion with a weapon equipped, from here.

    The problem itself is the ChangeWeapon function, which is responsible for refreshing the weapon index and the refresh state of the wait motion, but that wasn't called properly because it always got blocked in the following condition:

     

    Hidden Content

     

    void CInstanceBase::ChangeWeapon(DWORD eWeapon)
    {
    	if (eWeapon == m_GraphicThingInstance.GetPartItemID(CRaceData::PART_WEAPON))
    		return;
    
    	if (SetWeapon(eWeapon))
    		RefreshState(CRaceMotionData::NAME_WAIT, true);
    }

     

     

    In order that when you unequip an item from the server, it's called the ChangeWeapon(0), which means eWapon = 0, and the GetPartItemID(CRaceData::PART_WEAPON) = 0 as well, since it was set from the previous use of motion.

    For fixing it, we just have to add into our condition if the eWeapon it's not 0, so it will let the function to work properly.

     

    Hidden Content

     

    	// Search for the following condition:
    	if (eWeapon == m_GraphicThingInstance.GetPartItemID(CRaceData::PART_WEAPON))
      	// Replace it with:
    	if (eWeapon && eWeapon == m_GraphicThingInstance.GetPartItemID(CRaceData::PART_WEAPON))

     

     

    This visual bug happens when you use above solution:

    Spoiler

    So, if someone got some time to investigate that bug and can share with us the solution, it would be really nice! 

  5. @OwsapThanks, for the release. Good job! Would be nice, if you can do something like that for question dialogs too, because when you want to drop for example 1000x pcs of some item, the text will overflow the question dialog (sometimes it happens with lower counts of item, for example books, they have a long names). Do something like when the text can overflow the question dialog width, then add 20px to question dialog width.

    • Metin2 Dev 2
  6. Hey guys,

    I'm trying to center whole quest window with content inside by extending the say_size function, but the text is overflowing quest window (quest window is not resized after changes mentioned below).

    Client/PythonEventManager.cpp:

    Spoiler
    case EVENT_TYPE_WINDOW_SIZE:
    		{
    			int iWidth = atoi(GetArgument("width", ScriptCommand.argList));
    			int iHeight = atoi(GetArgument("height", ScriptCommand.argList));
    			int iXpos = atoi(GetArgument("x", ScriptCommand.argList));
    			int iYpos = atoi(GetArgument("y", ScriptCommand.argList));
    			PyCallClassMemberFunc(pEventSet->poEventHandler, "OnSize", Py_BuildValue("(iiii)", iWidth, iHeight, iXpos, iYpos));
    			break;
    		}

     

    Server/questlib.lua

    Spoiler
    function say_size(width, height, x, y) raw_script("[WINDOW_SIZE width;"..width.."|height;"..height.."|x;"..x.."|y;"..y.."]") end

     

    Quest function use:

    Spoiler
    say_size(463, 300, -50, 0)

     

    I will be really glad if someone can tell me where should be the mistake and why it's happening.

    Thanks for possible answers!

    Sincerely,

    ReFresh

  7. @ msnas

    This is the RecvMainCharacter() function (read comments in code to know what I mean):

    Default code:

    Spoiler

    Client/PythonNetworkStreamPhaseLoading.cpp:

    Spoiler
    bool CPythonNetworkStream::RecvMainCharacter()
    {
    	TPacketGCMainCharacter MainChrPacket;
    	if (!Recv(sizeof(TPacketGCMainCharacter), &MainChrPacket))
    		return false;
    
    	m_dwMainActorVID = MainChrPacket.dwVID;
    	m_dwMainActorRace = MainChrPacket.wRaceNum;
    	m_dwMainActorEmpire = 0; //What about this? Is this line right?
    	m_dwMainActorSkillGroup = MainChrPacket.bySkillGroup;
    
    	m_rokNetActorMgr->SetMainActorVID(m_dwMainActorVID);
    
    	CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
    	rkPlayer.SetName(MainChrPacket.szName);
    	rkPlayer.SetMainCharacterIndex(GetMainActorVID());
    
    	PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_LOAD], "LoadData", Py_BuildValue("(ii)", MainChrPacket.lX, MainChrPacket.lY));
    
    	//Tracef(" >> RecvMainCharacter\n");
    
    	SendClientVersionPacket();
    	return true;
    }

     

    Client/Packet.h:

    Spoiler
    typedef struct packet_main_character
    {
    	BYTE		header;
    	DWORD		dwVID;
    	WORD		wRaceNum;
    	char		szName[CHARACTER_NAME_MAX_LEN + 1];
    	long		lX, lY, lZ;
    	BYTE		bySkillGroup;
      	//Missing BYTE byEmpire or empire?
    } TPacketGCMainCharacter;

     

    Server/Packet.h:

    Spoiler
    typedef struct packet_main_character
    {
    	BYTE header;
    	DWORD dwVID;
    	WORD wRaceNum;
    	char szName[CHARACTER_NAME_MAX_LEN + 1];
    	long lx, ly, lz;
    	BYTE empire; //But here in server source is the BYTE empire. Why it doesn't exist in client source?
    	BYTE skill_group;
    } TPacketGCMainCharacter;

     

     

    So should I change it like this?

    Spoiler

    Client/PythonNetworkStreamPhaseLoading.cpp:

    Spoiler
    bool CPythonNetworkStream::RecvMainCharacter()
    {
    	TPacketGCMainCharacter MainChrPacket;
    	if (!Recv(sizeof(TPacketGCMainCharacter), &MainChrPacket))
    		return false;
    
    	m_dwMainActorVID = MainChrPacket.dwVID;
    	m_dwMainActorRace = MainChrPacket.wRaceNum;
    	m_dwMainActorEmpire = MainChrPacket.empire; //Here is the change
    	m_dwMainActorSkillGroup = MainChrPacket.bySkillGroup;
    
    	m_rokNetActorMgr->SetMainActorVID(m_dwMainActorVID);
    
    	CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
    	rkPlayer.SetName(MainChrPacket.szName);
    	rkPlayer.SetMainCharacterIndex(GetMainActorVID());
    
    	PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_LOAD], "LoadData", Py_BuildValue("(ii)", MainChrPacket.lX, MainChrPacket.lY));
    
    	//Tracef(" >> RecvMainCharacter\n");
    
    	SendClientVersionPacket();
    	return true;
    }

     

    Client/Packet.h:

    Spoiler
    typedef struct packet_main_character
    {
    	BYTE		header;
    	DWORD		dwVID;
    	WORD		wRaceNum;
    	char		szName[CHARACTER_NAME_MAX_LEN + 1];
    	long		lX, lY, lZ;
      	BYTE		empire; //Here is the change
    	BYTE		bySkillGroup;
    } TPacketGCMainCharacter;

     

    Server/Packet.h:

    Spoiler
    typedef struct packet_main_character
    {
    	BYTE header;
    	DWORD dwVID;
    	WORD wRaceNum;
    	char szName[CHARACTER_NAME_MAX_LEN + 1];
    	long lx, ly, lz;
    	BYTE empire; //Here is no change
    	BYTE skill_group;
    } TPacketGCMainCharacter;

     

    Or like this?

    Spoiler

    Client/PythonNetworkStreamPhaseLoading.cpp:

    Spoiler
    bool CPythonNetworkStream::RecvMainCharacter()
    {
    	TPacketGCMainCharacter MainChrPacket;
    	if (!Recv(sizeof(TPacketGCMainCharacter), &MainChrPacket))
    		return false;
    
    	m_dwMainActorVID = MainChrPacket.dwVID;
    	m_dwMainActorRace = MainChrPacket.wRaceNum;
    	m_dwMainActorEmpire = MainChrPacket.byEmpire; //Here is the change
    	m_dwMainActorSkillGroup = MainChrPacket.bySkillGroup;
    
    	m_rokNetActorMgr->SetMainActorVID(m_dwMainActorVID);
    
    	CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
    	rkPlayer.SetName(MainChrPacket.szName);
    	rkPlayer.SetMainCharacterIndex(GetMainActorVID());
    
    	PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_LOAD], "LoadData", Py_BuildValue("(ii)", MainChrPacket.lX, MainChrPacket.lY));
    
    	//Tracef(" >> RecvMainCharacter\n");
    
    	SendClientVersionPacket();
    	return true;
    }

     

    Client/Packet.h:

    Spoiler
    typedef struct packet_main_character
    {
    	BYTE		header;
    	DWORD		dwVID;
    	WORD		wRaceNum;
    	char		szName[CHARACTER_NAME_MAX_LEN + 1];
    	long		lX, lY, lZ;
      	BYTE		byEmpire; //Here is the change
    	BYTE		bySkillGroup;
    } TPacketGCMainCharacter;

     

    Server/Packet.h: 

    Spoiler
    typedef struct packet_main_character
    {
    	BYTE header;
    	DWORD dwVID;
    	WORD wRaceNum;
    	char szName[CHARACTER_NAME_MAX_LEN + 1];
    	long lx, ly, lz;
    	BYTE byEmpire; //Here is the change
    	BYTE skill_group;
    } TPacketGCMainCharacter;

     

     

    Should I change it and which change should I apply and what kind of bug it can cause, if I'll use it as it is? Check all the spoilers and compare them too see what should be probably changed.

    I hope it's more clear now.

    Thanks for your answer!

  8. Hey guys,

    I'm wondering, if this packet function can cause some bug, because there're missing some values:

    Spoiler

    Client/PythonNetworkStreamPhaseLoading.cpp:

    bool CPythonNetworkStream::RecvMainCharacter()
    	m_dwMainActorEmpire = 0; // Possible bug?

    Client/Packet.h:

    typedef struct packet_main_character
    {
    	BYTE		header;
    	DWORD		dwVID;
    	WORD		wRaceNum;
    	char		szName[CHARACTER_NAME_MAX_LEN + 1];
    	long		lX, lY, lZ;
    	BYTE		bySkillGroup;
    	//Missing BYTE empire or byEmpire;???
    } TPacketGCMainCharacter;

    Server/Packet.h:

    typedef struct packet_main_character
    {
    	BYTE header;
    	DWORD dwVID;
    	WORD wRaceNum;
    	char szName[CHARACTER_NAME_MAX_LEN + 1];
    	long lx, ly, lz;
    	BYTE empire; //Exist here. Should be here byEmpire????
    	BYTE skill_group;
    } TPacketGCMainCharacter;

     

    Shouldn't it be like:

    Spoiler

    Client/PythonNetworkStreamPhaseLoading.cpp:

    bool CPythonNetworkStream::RecvMainCharacter()
    	m_dwMainActorEmpire = MainChrPacket.empire; //or byEmpire???

    Client/Packet.h:

    typedef struct packet_main_character
    {
    	BYTE		header;
    	DWORD		dwVID;
    	WORD		wRaceNum;
    	char		szName[CHARACTER_NAME_MAX_LEN + 1];
    	long		lX, lY, lZ;
    	BYTE		empire; // or byEmpire??
    	BYTE		bySkillGroup;
    } TPacketGCMainCharacter;

    Server/Packet.h:

    typedef struct packet_main_character
    {
    	BYTE header;
    	DWORD dwVID;
    	WORD wRaceNum;
    	char szName[CHARACTER_NAME_MAX_LEN + 1];
    	long lx, ly, lz;
    	BYTE empire; //or byEmpire???
    	BYTE skill_group;
    } TPacketGCMainCharacter;

     

    I will be glad, if someone with programming experience can check it and tell me, if I'm right.

    Thanks for possible answers!

    Sincerely,

    ReFresh

  9. @ SyreldarThanks for your answer. I wanted to do something like this:

    Spoiler
    		function party_member_counting()
    		
    			local pids = {party.get_member_pids()}
    			local player_count = 0
    
    			for i, pid in pids do
    				player_count = player_count + 1
    			end
    
    			return player_count
    		end

     

    And then in empire change process:

    Spoiler
    				if party.is_party() then
    					
    					local party_member_count = change_empire.party_member_counting()
    
    					if party_member_count == 2 then
    
    						party.delete_party()
    					end
    
    					if party_member_count >= 3 then
    
    						if party.is_leader() then
    							party.delete_party()
    						
    						elseif not party.is_leader() then
    							party.leave_party()
    						end
    					end
    				end

     

    But after you said, there are more things which can be passed by just a channel change, it will probably require many source changes. So in this case it's better use what you wrote, because I don't have a c++ knowledge to change things like this in source. So thanks anyway. But would be nice, if someone could provide us a c++ part to make this thing working like I wrote.

  10. Hey guys,

    I'm trying to find a way how to change function below to check member pids on every map index, because it's checking party members count only on map where everyone of party is.

    I know, I could use this function: ForEachOnlineMember, but I need to check party members count when they're offline too.

    Why I need to do that? I need to remove party member from party when the party member change the empire.

    File: questlua_party.cpp

    Spoiler
    ALUA(party_get_member_pids)
    	{
    		CQuestManager & q = CQuestManager::instance();
    		LPCHARACTER ch = q.GetCurrentCharacterPtr();
    		LPPARTY pParty = ch->GetParty();
    		if (NULL == pParty)
    		{
    			return 0;
    		}
    		FPartyPIDCollector f;
    		pParty->ForEachOnMapMember(f, ch->GetMapIndex());
    
    		for (std::vector <DWORD>::iterator it = f.vecPIDs.begin(); it != f.vecPIDs.end(); it++)
    		{
    			lua_pushnumber(L, *it);
    		}
    		return f.vecPIDs.size();
    	}

     

    Anyone know the solution? I'll be really really glad for that!

    Thanks for possible answers!

    Sincerely,

    ReFresh

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