Jump to content

Skill Book Combination System


Recommended Posts

  • Honorable Member

M2 Download Center

This is the hidden content, please
( Internal )

This is the hidden content, please
( 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 64
  • kekw 1
  • Eyes 1
  • Dislove 3
  • Cry 1
  • Think 1
  • Scream 1
  • Good 29
  • Love 2
  • Love 49
Link to comment
Share on other sites

  • 7 months later...

my problem is this:    GIF

 

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 Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 2 months later...

My problem is this:    GIF

 

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.

 

 

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 3
  • Love 1
Link to comment
Share on other sites

  • 2 months later...
6 hours ago, Pisti95 said:

Check out my files.

This is the hidden content, please

 

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: GIF

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 4
  • Good 1
  • Love 2
Link to comment
Share on other sites

  • 4 months later...

    if (!ch)
        return;

Owsap may have forgotten because he loves game.core so much. Please add just in case. 
I deleted the folder. keep it if it's void and false if it's bool.

Edited by EAkar
    if (!c_pData)         return; delete
Link to comment
Share on other sites

1029 22:03:29127 :: Traceback (most recent call last):

1029 22:03:29127 ::   File "ui.py", line 1535, in OnSelectEmptySlot

1029 22:03:29127 ::   File "ui.py", line 87, in __call__

1029 22:03:29127 ::   File "ui.py", line 78, in __call__

1029 22:03:29127 ::   File "uiSkillBookCombination.py", line 116, in SelectEmptySlot

1029 22:03:29128 :: AttributeError
1029 22:03:29128 :: : 
1029 22:03:29128 :: 'module' object has no attribute 'ITEM_SLOT_COUNT'
1029 22:03:29128 :: 

Any ideea? I don t have special invetory.

Link to comment
Share on other sites

On 10/29/2021 at 10:23 PM, narcisxb said:
1029 22:03:29127 :: Traceback (most recent call last):

1029 22:03:29127 ::   File "ui.py", line 1535, in OnSelectEmptySlot

1029 22:03:29127 ::   File "ui.py", line 87, in __call__

1029 22:03:29127 ::   File "ui.py", line 78, in __call__

1029 22:03:29127 ::   File "uiSkillBookCombination.py", line 116, in SelectEmptySlot

1029 22:03:29128 :: AttributeError
1029 22:03:29128 :: : 
1029 22:03:29128 :: 'module' object has no attribute 'ITEM_SLOT_COUNT'
1029 22:03:29128 :: 

Any ideea? I don t have special invetory.

 

in GameType.h, if you have this:

const DWORD c_ItemSlot_Count = c_Inventory_Page_Size * c_Inventory_Page_Count;

 

You should add it to your PythonPlayerModule.cpp:

	PyModule_AddIntConstant(poModule, "ITEM_SLOT_COUNT",		c_ItemSlot_Count);

 

Link to comment
Share on other sites

  • 5 months later...
  • Honorable Member
On 4/30/2022 at 2:25 PM, speze012 said:

@ Owsap Why man why?

d83d747e655fc1e951dffb1c954da1e6.png

 

Quote

"Why man why?"

I'm sorry but this just frustrates me and makes me think that you are selfish and ungrateful, no offense but this question on the other hand offends me because this system was released free for all M2Dev members and despite your ignorance seeing the download button and link to the repository on the top of the topic just makes me think you want to make a problem out of 5 euro coffee money.


It's not like I’m asking or demanding anyone to spend 5€ on a free system, it doesn’t make sense so just to respond your question and curiosity of why I added a 5€ button on my website is just to give the opportunity for people that want to help and donate this free release and personally, I don’t see any problem with this but who cares, most people just want free, free, free and don’t value the work of others and appreciate the shares.

Addionally, the other reason I decided to add a value for downloading the system on my website was because I was constantly getting emails of orders regarding all free systems on my website.

So, I don't get why you waste your time asking for something that looks obvious? “This system is free and on his website it’s 5 euros? Yeah, maybe it’s just for donations if anyone wants to say “thanks”.

I hope you understand now...
Edit: I have added Yes/No donate button just for your satisfaction.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
Share on other sites

Announcements



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