Register for your free account! | Forgot your password?

You last visited: Today at 23:00

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[RELEASE][GF] Inventory Sorter

Discussion on [RELEASE][GF] Inventory Sorter within the Metin2 Hacks, Bots, Cheats, Exploits & Macros forum part of the Metin2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2016
Posts: 7
Received Thanks: 1
Smile [RELEASE][GF] Inventory Sorter

Hello guys. This is my first python script and the first 'cheat' for metin2. I got inspired by aicaracol12321 so many credits to him. It may have bugs but it does work for me. I promise to update it and add a GUI so its easier to use. For now all you have to do is to load it with m2bob while you are in game and it is gonna sort the items based on the ID. I will also add more sorting options soon.

Code:
import chat, player, item, math, net, time

SLOTS = player.GetExtendInvenMax() if hasattr(player, 'GetExtendInvenMax') and player.GetExtendInvenMax() > 0 else player.INVENTORY_PAGE_SIZE * player.INVENTORY_PAGE_COUNT
SLOTS_PER_PAGE = player.INVENTORY_PAGE_SIZE

class Item:
    def __init__(self, id, slot, size, name):
        self.id = id
        self.slot = slot
        self.size = size
        self.name = name

    def move(self, slot):
        net.SendItemMovePacket(self.slot, slot, 0)
        self.slot = slot
        
class ItemHandler:
    def __init__(self):
        self.list = []
        self.placed = []
    
    def retrieveItems(self):  
        for slot in range(SLOTS):
            item_id = player.GetItemIndex(slot)

            if item_id != 0:
                item.SelectItem(item_id)
                self.list.append(Item(item_id, slot, int(item.GetItemSize()[1]), item.GetItemName()))
                
    def sortByID(self):
        self.list.sort(key=lambda item: item.id, reverse=False)
        
        
    def getNextSlot(self, size):
        for page in range(int(math.ceil(SLOTS / SLOTS_PER_PAGE))):
            LAST_SLOT_THIS_PAGE = min((page + 1) * SLOTS_PER_PAGE, SLOTS)

            for slot in range(page * SLOTS_PER_PAGE, LAST_SLOT_THIS_PAGE):
                if slot + 5 * (size - 1) < LAST_SLOT_THIS_PAGE:
                    good = True
                    
                    for i in range(size):
                        if (slot + 5 * i) in self.placed:
                            good = False
                    
                    if good:
                        return slot
        return -1
        
    def itemsInSlot(self, slot, size):
        items = []

        for i in range(size):
            cur_slot = slot + i * 5
            it = [x for x in self.list if x.slot == cur_slot or (x.size == 2 and x.slot + 5 == cur_slot or False) or (x.size == 3 and (x.slot + 10 == cur_slot or x.slot + 5 == cur_slot) or False) ]
            
            if len(it) > 0 and it[0] not in items:
                items.append(it[0])
        
        return items
    
    def getNextFreeSlot(self, size, skip = []):
        for page in range(int(math.ceil(SLOTS / SLOTS_PER_PAGE))):
            LAST_SLOT_THIS_PAGE = min((page + 1) * SLOTS_PER_PAGE, SLOTS)

            for slot in range(page * SLOTS_PER_PAGE, LAST_SLOT_THIS_PAGE):
                if slot not in skip and len(self.itemsInSlot(slot, size)) == 0 and slot + 5 * (size - 1) < LAST_SLOT_THIS_PAGE:
                    return slot
                    
        return -1        

    def setItemAsPlaced(self, item):
        for i in range(item.size):
            self.placed.append(item.slot + 5 * i)
        
    def sort(self):
        self.retrieveItems()
        self.sortByID()
        
        for it in self.list:    
            next_slot = self.getNextSlot(it.size)
            
            if next_slot == -1:
                continue;
            
            if it.slot == next_slot:
                self.setItemAsPlaced(it)
                continue
            
            occupied_slots = []
            
            for i in range(it.slot):
                occupied_slots.append(next_slot + 5 * i)
            
            for in_way_item in self.itemsInSlot(next_slot, it.size):
                next_free_slot = self.getNextFreeSlot(in_way_item.size, occupied_slots)
                
                if next_free_slot == -1:
                    continue
                    
                in_way_item.move(next_free_slot)
                
            it.move(next_slot)
            self.setItemAsPlaced(it)
            
handler = ItemHandler()
handler.sort()
If you have any suggestions feel free to tell me. I am also open to new (easy to implement) ideas. Good luck!
Radu97a is offline  
Thanks
1 User
Old 04/26/2020, 16:45   #2
 
doqukanlas's Avatar
 
elite*gold: 0
Join Date: Oct 2014
Posts: 40
Received Thanks: 1
i'm new for these hacks can u tell how can i use this?
doqukanlas is offline  
Old 04/26/2020, 17:19   #3
 
elite*gold: 0
Join Date: Dec 2016
Posts: 7
Received Thanks: 1
You can inject it, for example, with M2 Bob python loader
Radu97a is offline  
Old 04/26/2020, 18:32   #4
 
imvalez's Avatar
 
elite*gold: 0
Join Date: Oct 2018
Posts: 31
Received Thanks: 2
Quote:
Originally Posted by Radu97a View Post
Hello guys. This is my first python script and the first 'cheat' for metin2. I got inspired by aicaracol12321 so many credits to him. It may have bugs but it does work for me. I promise to update it and add a GUI so its easier to use. For now all you have to do is to load it with m2bob while you are in game and it is gonna sort the items based on the ID. I will also add more sorting options soon.

Code:
import chat, player, item, math, net, time

SLOTS = player.GetExtendInvenMax() if hasattr(player, 'GetExtendInvenMax') and player.GetExtendInvenMax() > 0 else player.INVENTORY_PAGE_SIZE * player.INVENTORY_PAGE_COUNT
SLOTS_PER_PAGE = player.INVENTORY_PAGE_SIZE

class Item:
    def __init__(self, id, slot, size, name):
        self.id = id
        self.slot = slot
        self.size = size
        self.name = name

    def move(self, slot):
        net.SendItemMovePacket(self.slot, slot, 0)
        self.slot = slot
        
class ItemHandler:
    def __init__(self):
        self.list = []
        self.placed = []
    
    def retrieveItems(self):  
        for slot in range(SLOTS):
            item_id = player.GetItemIndex(slot)

            if item_id != 0:
                item.SelectItem(item_id)
                self.list.append(Item(item_id, slot, int(item.GetItemSize()[1]), item.GetItemName()))
                
    def sortByID(self):
        self.list.sort(key=lambda item: item.id, reverse=False)
        
        
    def getNextSlot(self, size):
        for page in range(int(math.ceil(SLOTS / SLOTS_PER_PAGE))):
            LAST_SLOT_THIS_PAGE = min((page + 1) * SLOTS_PER_PAGE, SLOTS)

            for slot in range(page * SLOTS_PER_PAGE, LAST_SLOT_THIS_PAGE):
                if slot + 5 * (size - 1) < LAST_SLOT_THIS_PAGE:
                    good = True
                    
                    for i in range(size):
                        if (slot + 5 * i) in self.placed:
                            good = False
                    
                    if good:
                        return slot
        return -1
        
    def itemsInSlot(self, slot, size):
        items = []

        for i in range(size):
            cur_slot = slot + i * 5
            it = [x for x in self.list if x.slot == cur_slot or (x.size == 2 and x.slot + 5 == cur_slot or False) or (x.size == 3 and (x.slot + 10 == cur_slot or x.slot + 5 == cur_slot) or False) ]
            
            if len(it) > 0 and it[0] not in items:
                items.append(it[0])
        
        return items
    
    def getNextFreeSlot(self, size, skip = []):
        for page in range(int(math.ceil(SLOTS / SLOTS_PER_PAGE))):
            LAST_SLOT_THIS_PAGE = min((page + 1) * SLOTS_PER_PAGE, SLOTS)

            for slot in range(page * SLOTS_PER_PAGE, LAST_SLOT_THIS_PAGE):
                if slot not in skip and len(self.itemsInSlot(slot, size)) == 0 and slot + 5 * (size - 1) < LAST_SLOT_THIS_PAGE:
                    return slot
                    
        return -1        

    def setItemAsPlaced(self, item):
        for i in range(item.size):
            self.placed.append(item.slot + 5 * i)
        
    def sort(self):
        self.retrieveItems()
        self.sortByID()
        
        for it in self.list:    
            next_slot = self.getNextSlot(it.size)
            
            if next_slot == -1:
                continue;
            
            if it.slot == next_slot:
                self.setItemAsPlaced(it)
                continue
            
            occupied_slots = []
            
            for i in range(it.slot):
                occupied_slots.append(next_slot + 5 * i)
            
            for in_way_item in self.itemsInSlot(next_slot, it.size):
                next_free_slot = self.getNextFreeSlot(in_way_item.size, occupied_slots)
                
                if next_free_slot == -1:
                    continue
                    
                in_way_item.move(next_free_slot)
                
            it.move(next_slot)
            self.setItemAsPlaced(it)
            
handler = ItemHandler()
handler.sort()
If you have any suggestions feel free to tell me. I am also open to new (easy to implement) ideas. Good luck!
hello, meanwhile, congratulations
I have a question
would you be able to create one that filters what you drop?
imvalez is offline  
Old 05/01/2020, 21:52   #5
 
elite*gold: 0
Join Date: Sep 2013
Posts: 8
Received Thanks: 1
how can i inject this on metin2?
please help me!
thx
prominax is offline  
Reply


Similar Threads Similar Threads
[Selling] Sell CS.GO Inventory | Verkaufe mein CS.GO Inventory "CHEAP"
10/10/2015 - Counter-Strike Trading - 3 Replies
Sold Verkauft Best regards Souza
Verkaufe Inventory/Sell Inventory
09/16/2015 - Counter-Strike Trading - 3 Replies
Verkaufen mein Inventar, wenn ihr Interesse an was habt pnīt mich. Steam Community :: Mr.NoAIm :: Item Inventory Akzeptiere Paypal und PSC. ihr gebt First oder MM den wir zusammen aussuchen. LG Erek :)
[Release]Automatic Cps in Inventory
08/29/2012 - CO2 PServer Guides & Releases - 95 Replies
This is for 5165! Go to Mob.cs and search for this. else if (MyMath.ChanceSuccess(DropRates.CPBag)) Under that void put this. if (MyMath.ChanceSuccess(DropRates.CPs)) { if (Char != null) { Char.CPs += CPS AMOUNT YOU WANT;
Idea: item sorter
12/09/2008 - Conquer Online 2 - 3 Replies
So we all know those people that use archerers to plvl the shit out of you, and most of them only care about mets, leaving behind substantial +1/unique gear and so on. Personally, I just dont even team, I just find a pack of archerers plvling around bird island, load up a bag of shit on about 3 minutes, and generally have at least one ref. (today I got 2 elites also) So what about a program that could sort your inventory for you as you rummage? Automatically dropping all normal gear you...



All times are GMT +1. The time now is 23:02.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.