Depodan K envantere item taşıma fix

  • Konbuyu başlatan Konbuyu başlatan Admin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 27

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Merhaba, depodan K envantere item süreklediğiniz zaman koyabiliyordunuz, bir arkadaş söyleyince fark ettim ufak bir kodla halloluyor



Alternatif için teşekkürler


// BU SORUN ÇÖZÜLMÜŞTÜR ARKADAŞLAR LİNK GÜNCELLENDİ

Depodan Karakter Envanterine Item Taşıma Sistemi Fix
Metin2 özel sunucularında karşılaşılan yaygın sorunlardan birisi, oyuncuların depodan karakter envanterine eşya taşırken sistemsel hatalarla karşılaşmasıdır. Bu durum genellikle envanter dolu olduğunda ya da item transferi sırasında hatalı kodlamalardan dolayı meydana gelir. Bu yazıda, depodan karakter envanterine item taşıma hatasını nasıl düzelteceğinizi adım adım açıklayacağız.

Hatanın Kaynağı Nedir?
Metin2 sistemlerinde depo ve envanter işlemleri, genellikle C++ tabanlı server-side fonksiyonlar tarafından yönetilir. Hatalar, genellikle bu fonksiyonların doğru şekilde kontrol edilmemesinden doğar. Özellikle envanter doluysa bile item transferine izin veren sistemler, sunucuda çökme veya veri kaybına neden olabilir.

Genel Hata Belirtileri:
- Oyuncu envanter dolu olmasına rağmen depodan item alabiliyor.
- Alınan item kayboluyor.
- Sunucuda crash oluşuyor.

Fix Uygulama Adımları
1. Game Core dosyasındaki item_manager.cpp dosyasında bulunan ItemTransferFromSafebox fonksiyonunu kontrol edin. Bu fonksiyon, depodan alınan itemin envantere yerleştirilip yerleştirilemeyeceğini kontrol etmelidir.

2. Aşağıdaki gibi bir kontrol ekleyin:
Kod:
[COLOR=#9365b8]if (!ch->CanHandleItem(item)) {[BR][/BR]    ch->ChatPacket(CHAT_TYPE_INFO, 'Envanter dolu!');[BR][/BR]    return false;[BR][/BR]}[/COLOR]


3. Aynı işlemi client-side tarafında da yapmanız önerilir. uiscript veya py_root klasörlerinde bulunan inventorywindow.py dosyasında, depodan item alındığında envanter boş slot kontrolü yapılmalıdır.

Python GUI Tarafında Kontrol
Eğer sunucu tarafında değil de, istemci tarafında bir hata varsa, Python GUI kısmında da benzer kontroller yapılmalıdır. inventory.py veya uiinventory.py dosyalarında envanter boş slot kontrolü yapan fonksiyonları güncelleyin. Örnek olarak:

Kod:
[COLOR=#9365b8]def CheckEmptySlot(self):[BR][/BR]    for i in range(len(self.inventory)): [BR][/BR]        if self.inventory[i] is None:[BR][/BR]            return True[BR][/BR]    return False[/COLOR]


Ekstra Güvenlik Önlemleri
Sunucu tarafında güvenlik açısından, envanter doluluğu kontrolünü yanı sıra item ID geçerliliği ve oyuncunun bu itemi gerçekten depoda bulundurup bulunmadığı da kontrol edilmelidir. Bu sayede hack ve exploit girişimlerine karşı koruma sağlanabilir.

Sonuç
Depodan envantere item taşıma sisteminin düzgün çalışması için hem server-side hem de client-side kontrollerinin eksiksiz yapılması gerekir. Bu fix, hem oyuncu deneyimini artırır hem de sunucu güvenliğini güçlendirir. Daha fazla Metin2 geliştirme kaynağı için Metin2 Lobby ziyaret edebilirsiniz.


Fix for Moving Items from Safebox to Character Inventory
One of the common issues encountered in Metin2 private servers is errors that occur when players attempt to move items from the safebox to their character inventory. This situation usually arises when the inventory is full or due to incorrect coding during item transfers. In this article, we will explain step-by-step how to fix the error related to moving items from the safebox to the character inventory in Metin2 servers.

What Causes the Error?
In Metin2 systems, safebox and inventory operations are typically managed by C++-based server-side functions. Errors often stem from improper validation within these functions. Particularly, systems that allow item transfers even when the inventory is full can lead to crashes or data loss on the server.

Common Error Symptoms:
- Player can take items from the safebox despite having a full inventory.
- The taken item disappears.
- Server crashes occur.

Steps to Apply the Fix
1. Check the ItemTransferFromSafebox function located in the item_manager.cpp file within the Game Core. This function should verify whether the item taken from the safebox can be placed into the character's inventory.

2. Add a control similar to the following:
Kod:
[COLOR=#9365b8]if (!ch->CanHandleItem(item)) {[BR][/BR]    ch->ChatPacket(CHAT_TYPE_INFO, 'Inventory is full!');[BR][/BR]    return false;[BR][/BR]}[/COLOR]


3. It is also recommended to perform the same check on the client-side. In files such as inventorywindow.py found in the uiscript or py_root folders, ensure there is a check for empty inventory slots when taking items from the safebox.

Client-Side Validation with Python GUI
If the issue is not server-side but client-side, similar checks must be implemented in the Python GUI section. Update the functions responsible for checking empty inventory slots in files like inventory.py or uiinventory.py. Example code:

Kod:
[COLOR=#9365b8]def CheckEmptySlot(self):[BR][/BR]    for i in range(len(self.inventory)): [BR][/BR]        if self.inventory[i] is None:[BR][/BR]            return True[BR][/BR]    return False[/COLOR]


Additional Security Measures
For security purposes on the server-side, along with checking inventory fullness, it is essential to validate the item ID and confirm whether the player actually possesses the item in their safebox. This helps prevent hacking and exploitation attempts.

Conclusion
To ensure the proper functioning of the safebox-to-inventory item transfer system, validations must be thoroughly implemented both on the server-side and client-side. This fix enhances the player experience and strengthens server security. For more Metin2 development resources, visit Metin2 Lobby.
 

Şuan Bu Konuyu Görüntüleyen Kullanıcılar (Toplam : 0, Üye : 0, Misafir : 0)

Benzer konular

Geri
Üst Alt