Jump to content

Recommended Posts

  • 2 weeks later...
  • 1 month later...
  • Active Member

Hi, i have found a bug:
when you have the mouse on the button, and you press the I to close the inventory, the tooltip remains open, you have to move the mouse from the button and close the inventory to do so that doesn't happen;
Here is the fix:
look in the file client->root->uiinventory.py, inside class InventoryWindow(ui.ScriptWindow) (it's the third def Close(self) you'll find):
 

	def Close(self):
		self.Hide(

add below:

		if app.ENABLE_SORT_INVEN:
			for i in xrange(len(self.tooltipInfo)):
				self.tooltipInfo[i].Hide()
Edited by 4peppe
  • Love 3
Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-154418
Share on other sites

  • Active Member
23 hours ago, 4peppe said:

Hi, i have found a bug:
when you have the mouse on the button, and you press the I to close the inventory, the tooltip remains open, you have to move the mouse from the button and close the inventory to do so that doesn't happen;
Here is the fix:
look in the file client->root->uiinventory.py, inside class InventoryWindow(ui.ScriptWindow) (it's the third def Close(self) you'll find):
 

	def Close(self):
		self.Hide(

add below:

		if app.ENABLE_SORT_INVEN:
			for i in xrange(len(self.tooltipInfo)):
				self.tooltipInfo[i].Hide()

@ Mali

Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-154447
Share on other sites

  • 1 year later...
On 12/7/2021 at 11:27 AM, Jimmermania said:

Yeah i fixed it. The only problem is that it doesnt show the details of ctrl + right click etc when i hover the mouse into refresh button. I have installed emoji in textline..

How did you fix it? I have the same thing

Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-162793
Share on other sites

  • 2 weeks later...

Hello! 

How we can fix name sort for multilanguage?

I used this function for name sort, but it doesn't work. The system read only default language "English".

 

Return for name sort:

return std::strcmp(i1->GetLocaleName(), i2->GetLocaleName()) < 0;

 

item.cpp function:

const char* CItem::GetLocaleName(BYTE bLocale)
{
    if (bLocale == LOCALE_MAX_NUM)
    {
        if (m_pOwner != NULL)
            bLocale = m_pOwner->GetLanguage();
        else
        {
            if (GetDesc())
                bLocale = GetDesc()->GetLanguage();
            else
                bLocale = LOCALE_DEFAULT;
        }
    }
    return m_pProto ? LC_ITEM_NAME(GetVnum(), bLocale) : NULL;
}

Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-163114
Share on other sites

  • 1 month later...

Hi, im trying to install this part at def OnUpdate(self):

		if app.ENABLE_SORT_INVEN and self.tooltipInfo:
			for i in xrange(len(self.tooltipInfo)):
				if self.yenilebutton.IsIn():
					self.tooltipInfo[i].Show()
				else:
					self.tooltipInfo[i].Hide()

but def OnUpdate(self): missing from my uiinventory. Whats the right code?

Thanks in advance.

  • Metin2 Dev 1

“𝓐𝓵𝓵 𝔀𝓮 𝓱𝓪𝓿𝓮 𝓽𝓸 𝓭𝓮𝓬𝓲𝓭𝓮 𝓲𝓼 𝔀𝓱𝓪𝓽 𝓽𝓸 𝓭𝓸 𝔀𝓲𝓽𝓱 𝓽𝓱𝓮 𝓽𝓲𝓶𝓮 𝓽𝓱𝓪𝓽 𝓲𝓼 𝓰𝓲𝓿𝓮𝓷 𝓾𝓼.” ~ 𝓖𝓪𝓷𝓭𝓪𝓵𝓯 𝓽𝓱𝓮 𝓖𝓻𝓮𝔂

Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-163862
Share on other sites

23 hours ago, Jimmermania said:

Hi, im trying to install this part at def OnUpdate(self):

		if app.ENABLE_SORT_INVEN and self.tooltipInfo:
			for i in xrange(len(self.tooltipInfo)):
				if self.yenilebutton.IsIn():
					self.tooltipInfo[i].Show()
				else:
					self.tooltipInfo[i].Hide()

but def OnUpdate(self): missing from my uiinventory. Whats the right code?

Thanks in advance.

put that code upper.

def RefreshBagSlotWindow(self):

Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-163884
Share on other sites

10 minutes ago, iSkyx said:

put that code upper.

def RefreshBagSlotWindow(self):

At which function?

“𝓐𝓵𝓵 𝔀𝓮 𝓱𝓪𝓿𝓮 𝓽𝓸 𝓭𝓮𝓬𝓲𝓭𝓮 𝓲𝓼 𝔀𝓱𝓪𝓽 𝓽𝓸 𝓭𝓸 𝔀𝓲𝓽𝓱 𝓽𝓱𝓮 𝓽𝓲𝓶𝓮 𝓽𝓱𝓪𝓽 𝓲𝓼 𝓰𝓲𝓿𝓮𝓷 𝓾𝓼.” ~ 𝓖𝓪𝓷𝓭𝓪𝓵𝓯 𝓽𝓱𝓮 𝓖𝓻𝓮𝔂

Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-163885
Share on other sites

  • 2 weeks later...
On 3/13/2024 at 1:29 PM, iSkyx said:

that function you have to add it, 

put it before this

def RefreshBagSlotWindow(self):

Still not working.

“𝓐𝓵𝓵 𝔀𝓮 𝓱𝓪𝓿𝓮 𝓽𝓸 𝓭𝓮𝓬𝓲𝓭𝓮 𝓲𝓼 𝔀𝓱𝓪𝓽 𝓽𝓸 𝓭𝓸 𝔀𝓲𝓽𝓱 𝓽𝓱𝓮 𝓽𝓲𝓶𝓮 𝓽𝓱𝓪𝓽 𝓲𝓼 𝓰𝓲𝓿𝓮𝓷 𝓾𝓼.” ~ 𝓖𝓪𝓷𝓭𝓪𝓵𝓯 𝓽𝓱𝓮 𝓖𝓻𝓮𝔂

Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-164101
Share on other sites

  • 2 months later...

@ MaliSorry for tag you. I have a problem. The poly item lose the mob and can t be used anymore. wild dog polymorh marble is polymorph marble and can t be used correctly. can you help me please?

Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-165377
Share on other sites

  • 10 months later...
On 8/30/2018 at 3:40 PM, Legend said:

What about books? when u sort the inventroy with books on it the book change socket, that happening because the autogiveitem is doesn't support socket check.

Same problem.

Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-170291
Share on other sites

  • 10 months later...
On 8/30/2018 at 3:40 PM, Legend said:

What about books? when u sort the inventroy with books on it the book change socket, that happening because the autogiveitem is doesn't support socket check.

Hy guys!

This is my code for this, and a few more fixes in it.
I only use sorting by type. 
The button is disabled on the client side for a few seconds
(Sorting by name or item level is pointless in my opinion)

Spoiler
#ifdef ENABLE_SORT_INVEN
void CHARACTER::SortInven(BYTE option)
{
    if (IsDead()) return;

    std::map<BYTE, DWORD> quickslot_backup;
    for (BYTE i = 0; i < QUICKSLOT_MAX_NUM; ++i) {
        TQuickslot* pQuickSlot;
        if (GetQuickslot(i, &pQuickSlot) && pQuickSlot->type == QUICKSLOT_TYPE_ITEM) {
            LPITEM item = GetInventoryItem(pQuickSlot->pos);
            if (item) quickslot_backup[i] = item->GetID();
        }
    }

    std::vector<LPITEM> all;
    for (WORD i = 0; i < INVENTORY_MAX_NUM; ++i) {
        LPITEM myitems = GetInventoryItem(i);
        if (myitems) {
            all.emplace_back(myitems);
            myitems->RemoveFromCharacter();
            SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 0xFFFF); 
        }
    }

    if (all.empty()) return;

    std::sort(all.begin(), all.end(), [](const LPITEM i1, const LPITEM i2) {
        if (i1->CustomSort() != i2->CustomSort())
            return i1->CustomSort() < i2->CustomSort();
        
        return i1->GetCount() > i2->GetCount();
    });

    for (const auto& getitem : all) {
        if (!getitem) continue;

        const TItemTable* table = ITEM_MANAGER::instance().GetTable(getitem->GetVnum());
        if (!table) continue;

        bool isSkillBook = (getitem->GetType() == ITEM_SKILLBOOK);
        bool isStackable = (table->dwFlags & ITEM_FLAG_STACKABLE);

      if (isStackable) 
        {
            LPITEM stackTarget = nullptr;
            for (WORD i = 0; i < INVENTORY_MAX_NUM; ++i) {
                LPITEM slotItem = GetInventoryItem(i);
                if (slotItem && slotItem->GetVnum() == getitem->GetVnum()) {
                    
                    if (isSkillBook && slotItem->GetSocket(0) != getitem->GetSocket(0))
                        continue;

                    if (slotItem->GetCount() < 200 && (slotItem->GetCount() + getitem->GetCount() <= 200)) {
                        stackTarget = slotItem;
                        break;
                    }
                }
            }

            if (stackTarget) {
                stackTarget->SetCount(stackTarget->GetCount() + getitem->GetCount());
                M2_DESTROY_ITEM(getitem);
            } else {
                AutoGiveItem(getitem);
            }
        }
        else {
            AutoGiveItem(getitem); 
        }
    }

    for (auto const& [qs_index, item_id] : quickslot_backup) {
        bool found = false;
        for (WORD i = 0; i < INVENTORY_MAX_NUM; ++i) {
            LPITEM item = GetInventoryItem(i);
            if (item && item->GetID() == item_id) {
                SyncQuickslot(QUICKSLOT_TYPE_ITEM, qs_index, i);
                found = true;
                break;
            }
        }
        if (!found) {
            SyncQuickslot(QUICKSLOT_TYPE_ITEM, qs_index, 250);
        }
    }

    SetLastSortTime(get_global_time() + 15);
}
#endif



Client/root->uiinventory.py (Please double Check for the TAB)

	if app.ENABLE_SORT_INVEN:
		def ClickYenileButton(self):
			import app
			import chat
			
			curTime = app.GetTime()
			nextTime = getattr(self, "nextSortTime", 0)

			if curTime < nextTime:
				leftTime = int(nextTime - curTime)
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SORTING_CHAT_TEXT % (leftTime + 1))
				return

			self.nextSortTime = curTime + 5
			net.SortInven(2)

Client/locale->locale_Game.txt: (Please double Check for the TAB)

SORTING_CHAT_TEXT	Várnod kell még %d másodpercet a következő rendezésig.



 

 

Edited by T0gy3R
Link to comment
https://metin2.dev/topic/18493-sort-inventory/page/4/#findComment-174422
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



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.