Jump to content

Skill Book Combination System


Recommended Posts

  • VIP

M2 Download Center

Hidden Content

    Give reaction to this post to see the hidden content.
( Internal )

Hidden Content

    Give reaction to this post to see the hidden content.
( GitHub )

Spoiler

270404687474703a2f2f69332e7974696d672e63

Hi, I made this system not so long ago, benefited the script from the official server and worked on the C++, just decided to share this system with everyone because I no longer care much about it. It’s not really a big of a system and most likely it could be leaked from some traitor so honestly, I rather share it myself.
Instead of adding the tutorial here I will link a repository to the guidelines.

 

Demonstration

 

 

The inventory slot marking works best with @xP3NG3Rx's release.
I do not support the implementation of the system neither does do author of the inventory slot marking, I believe.

 

  • Metin2 Dev 1
  • Love 17
  • Love 1
  • Good 1
Link to comment
  • 7 months later...

my problem is this:    

Hidden Content

    Give reaction to this post to see the hidden content.

 

Don't remove books from special inventory, and don't add to new book.

 

Does anybody have idea?

 

This part (original):

 

Spoiler

#if defined(__SKILLBOOK_COMB_SYSTEM__)
bool CInputMain::SkillBookCombination(LPCHARACTER ch, TItemPos(&CombItemGrid)[SKILLBOOK_COMB_SLOT_MAX], BYTE bAction)
{
	if (!ch->GetDesc())
		return false;

	// if (CombItemGrid.empty())
		// return false;

	if (ch->GetExchange() || ch->GetShop() || ch->GetMyShop() || ch->IsOpenSafebox() || ch->IsCubeOpen())
		return false;

	if (bAction != 2 /* COMBI_START */)
		return false;

	std::set <LPITEM> set_items;
	for (int i = 0; i < SKILLBOOK_COMB_SLOT_MAX; i++)
	{
		LPITEM pItem = ch->GetItem(CombItemGrid[i]);
		if (pItem)
		{	
			if (pItem->GetType() != ITEM_SKILLBOOK)
				return false;

			set_items.insert(pItem);
		}
	}

	if (set_items.empty())
		return false;

	if (ch->GetGold() < SKILLBOOK_COMB_COST)
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You don't have enough Yang to trade books with me."));
		return false;
	}

	for (std::set <LPITEM>::iterator it = set_items.begin(); it != set_items.end(); ++it)
	{
		LPITEM pItem = *it;
		if (pItem)
		{
			pItem->SetCount(pItem->GetCount() - 1);
			// pItem->RemoveFromCharacter();
			// M2_DESTROY_ITEM(pItem);
		}
	}

	DWORD dwBooks[JOB_MAX_NUM][2 /* SKILL_GROUPS */][2] = {
		{ // 0 - Warrior
			{50401, 50406}, // Skill Group 1
			{50416, 50421}, // Skill Group 2
		},
		{ // 1 - Ninja
			{50431, 50436}, // Skill Group 1
			{50446, 50451}, // Skill Group 2
		},
		{ // 2 - Sura
			{50461, 50466}, // Skill Group 1
			{50476, 50481}, // Skill Group 2
		},
		{ // 3 - Shaman
			{50491, 50496}, // Skill Group 1
			{50506, 50511}, // Skill Group 2
		},
	#ifdef ENABLE_WOLFMAN_CHARACTER
		{ // 4 - Wolfman
			{50530, 50535}, // Skill Group 1
			{0, 0}, // Skill Group 2
		},
	#endif
	};

	ch->PointChange(POINT_GOLD, -SKILLBOOK_COMB_COST);

	if (ch->GetSkillGroup() != 0)
	{
		DWORD dwMinRandomBook = dwBooks[ch->GetJob()][ch->GetSkillGroup() - 1][0];
		DWORD dwMaxRandomBook = dwBooks[ch->GetJob()][ch->GetSkillGroup() - 1][1];

		std::random_device rd;
		std::mt19937 gen(rd());
		std::uniform_real_distribution<> dis(dwMinRandomBook, dwMaxRandomBook);
		DWORD dwRandomBook = dis(gen);

		ch->AutoGiveItem(dwRandomBook, 1);
	}
	else
		ch->AutoGiveItem(50300, 1);

	return true;
}
#endif

 

 

Edited by Pisti95
  • Metin2 Dev 1
Link to comment
  • 2 months later...

My problem is this:    

Hidden Content

    Give reaction to this post to see the hidden content.

 

Solution my problem:

char.h

Everywhere in the file

Search for:

BYTE bCell

Change for:

UINT bCell


After

Search for: (everywhere too)

BYTE bDestCell

Change for:

UINT bDestCell

 

 

             You should do In char_item.cpp too.

 

 

 

Link to comment
  • 2 months later...

After edit a bit uiskillbook...py

            #    if self.inven or self.invenSpecial:
                if self.invenSpecial:

 

Got exactly the same problem als Pisti95, and BYTE bCell > UINT bCell doesnt work for me 😞

Edited by danhakhavro
Link to comment
1 hour ago, Pisti95 said:

Use uiskillbook.py from GF root, if you can’t do the python part.

Python part working well. I have exactly the same problem: 

Hidden Content

    Give reaction to this post to see the hidden content.

Link to comment
6 hours ago, Pisti95 said:

Check out my files.

Hidden Content

    Give reaction to this post to see the hidden content.

 

Thanks for your reply. Now i got this error:

 

0614 14:14:46801 :: Traceback (most recent call last):

0614 14:14:46801 ::   File "uiSkillBookCombination.py", line 224, in OnPressEscapeKey

0614 14:14:46801 ::   File "uiSkillBookCombination.py", line 40, in Close

0614 14:14:46801 ::   File "uiSkillBookCombination.py", line 174, in SetCanMouseEventSlot

0614 14:14:46801 :: AttributeError
0614 14:14:46801 :: : 
0614 14:14:46801 :: 'NoneType' object has no attribute 'GetInventoryPageIndex'
0614 14:14:46801 :: 

 

Line 174:

	def SetCanMouseEventSlot(self, idx):
		if not isinstance(idx, types.NoneType):
			if app.WJ_SPLIT_INVENTORY_SYSTEM:
				if self.inven or self.invenSpecial:
					page = self.inven.GetInventoryPageIndex() # range 0 ~ 1
					special_page = self.invenSpecial.GetInventoryPageIndex()
					
					if (page * INVENTORY_PAGE_SIZE) <= idx < ((page + 1) * INVENTORY_PAGE_SIZE): # range 0 ~ 44, 45 ~ 89
						idx = idx - (page * INVENTORY_PAGE_SIZE)
						self.inven.wndItem.SetCanMouseEventSlot(idx)

					elif self.invenSpecial.GetInventoryType() == 0:
						if (item.SKILL_BOOK_INVENTORY_SLOT_START + (special_page * SPECIAL_INVENTORY_PAGE_SIZE)) <= idx < (item.SKILL_BOOK_INVENTORY_SLOT_START + (((special_page + 1) * SPECIAL_INVENTORY_PAGE_SIZE))):
							idx = idx - (item.SKILL_BOOK_INVENTORY_SLOT_START + (special_page * SPECIAL_INVENTORY_PAGE_SIZE))
							self.invenSpecial.wndItem.SetCanMouseEventSlot(idx)

 

If i make:

            #    if self.inven or self.invenSpecial:
                if self.invenSpecial:

 

Than happen the previous bug: 

Hidden Content

    Give reaction to this post to see the hidden content.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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