[C+]Offical Pet Kilitli İtem İle Besleme Fixi

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Bugun yapılışı ;

Kilitli İtemi Nesne Exp Yerine Koyunca İtemi Yer Official Kilit İçin Olanı Gündüz Veya Yarın Gece Konuya İlave Edicem

new_pet.cpp

ARAT

Kod:
if (m_dwpetslotitem[i] != -1) {

Kod:
if(type == 1)

YUKARDAKI YERE KADAR DEGIS

Kod:
if (m_dwpetslotitem[i] != -1) {             LPITEM itemxp = m_pkOwner->GetInventoryItem(m_dwpetslotitem[i]);             if (!itemxp)                 return;             if (itemxp->GetID() == ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID())->GetID() || m_pkOwner->GetExchange() || m_pkOwner->GetMyShop() || m_pkOwner->GetShopOwner() || m_pkOwner->IsOpenSafebox() || m_pkOwner->IsCubeOpen())                 return;             if (itemxp->GetType() == ITEM_WEAPON || itemxp->GetType() == ITEM_ARMOR || itemxp->GetType() == ITEM_BELT)                 {                     char szEventFlag[30];                     snprintf(szEventFlag, sizeof(szEventFlag), "%d.Engel", itemxp->GetID());                     if (*szEventFlag)                     {                         if (quest::CQuestManager::instance().GetEventFlag(szEventFlag))                         {                             m_pkOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("item_engel"));                             return;                         }                     }                 }             if(type == 1)

Son Hali :
Metin2 C+ Offical Pet Kilitli İtem İle Besleme Sistemi Fixi

Metin2 özel sunucularında pet sistemleri, oyuncuların karakterlerini güçlendirme ve eğlence açısından büyük rol oynar. Ancak bazı sistemlerde, özellikle resmi sunuculardan alınan sistemlerde, kilitli itemler ile pet besleme işlemi sırasında hatalar oluşabilir. Bu durum, petin doğru şekilde gelişememesine veya itemlerin harcanmasına rağmen besleme işleminin gerçekleşmemesine neden olur. Bu yazıda, C+ Offical Pet sisteminde kilitli itemler ile besleme fixi nasıl uygulanır detaylıca ele alacağız.

Pet Sisteminin Temelleri
Metin2'de petler, oyuncuların seviye atlamasına yardımcı olurken, aynı zamanda combat gücüne de katkı sağlar. Pet besleme işlemi, petin seviyesini artırmak ve onun özelliklerini geliştirmek için yapılır. Ancak bazı özel sunucularda, resmi sunuculardan alınan sistemler doğrudan aktarıldığında eksiklikler veya hatalar olabilir. Özellikle kilitli itemlerin (örneğin: sandıklar, kutular vs.) doğrudan pet'e verilmesi engellenmelidir.

Fix Uygulama Adımları
Öncelikle, pet besleme fonksiyonunun bulunduğu dosyayı kontrol etmeniz gerekir. Genellikle bu işlem game_core veya pet_system.cpp gibi dosyalarda yer alır. Pet besleme sırasında itemin kilitli olup olmadığını kontrol eden bir fonksiyon tanımlamak önemlidir. Örneğin:

int CheckItemLocked(int itemID)
{
if (item.IsLocked()) return 0; // Kilitli ise iptal et
else return 1; // Kilitli değilse devam et
}

Bu kontrolü pet besleme işlemi öncesinde yaparak, kilitli itemlerin pet'e verilmesini engelleyebilirsiniz. Ayrıca, uiscript üzerinden de kullanıcıya geri bildirim mesajları gösterilebilir. Örneğin: 'Bu item kilitli olduğu için pet'e verilemez.'

Olası Hatalar ve Çözümler
Bazı geliştiriciler, pet besleme sırasında item silme işlemlerinde eksik kontroller yapar. Bu da oyuncuların kilitli itemlerini yanlışlıkla harcamasına neden olabilir. Bu durumda, item silmeden önce CheckItemLocked() fonksiyonu çağrılmalı ve kilit kontrolü yapılmalıdır. Ayrıca, loglama sistemine bu tür işlemleri kaydetmek de güvenlik açısından önemlidir.

Python Tarafında GUI Entegrasyonu
Eğer arayüz tarafında py GUI kullanıyorsanız, pet besleme ekranında bir buton veya kontrol alanı ile kilitli itemlerin seçimini engelleyebilirsiniz. Örneğin, bir item seçildiğinde IsLocked() fonksiyonu ile kontrol edilip, eğer kilitliyse kullanıcıya uyarı verilebilir. Bu işlem, hem kullanıcı deneyimini artırır hem de sunucu tarafındaki güvenlik risklerini azaltır.

Sonuç
Metin2 özel sunucularında pet besleme sisteminin doğru çalışması için küçük ama önemli kontroller oldukça etkilidir. Kilitli itemlerin pet'e verilmesini engellemek, hem sunucu güvenliğini artırır hem de kullanıcıların yanlışlıkla item kaybetmesini önler. Bu fix sayesinde, pet sistemleriniz daha stabil ve güvenli bir yapıya kavuşur. Daha fazla sistem ve script için Metin2Lobby sitesini takip edin.


Metin2 C+ Official Pet Locked Item Feeding Fix

In Metin2 private servers, pet systems play an important role in both character enhancement and entertainment. However, in certain systems, especially those taken from official servers, errors may occur during pet feeding with locked items. This can result in the pet not leveling up properly or items being consumed without the feeding process completing. In this article, we will detail how to apply the fix for feeding pets with locked items in the C+ Official Pet system.

Basics of the Pet System
In Metin2, pets assist players in leveling up while also contributing to combat strength. Pet feeding is performed to increase the pet's level and enhance its attributes. However, on some private servers, direct transfers of systems from official servers may lead to missing components or errors. Specifically, giving locked items (e.g., chests, boxes, etc.) directly to pets should be prevented.

Implementation Steps for the Fix
Firstly, you need to check the file where the pet feeding function resides. Usually, this occurs within files like game_core or pet_system.cpp. It’s crucial to define a function that checks whether the item is locked before feeding. For example:

int CheckItemLocked(int itemID)
{
if (item.IsLocked()) return 0; // Cancel if locked
else return 1; // Proceed if unlocked
}

By applying this check before the pet feeding process, you can prevent locked items from being fed to pets. Additionally, feedback messages such as 'This item is locked and cannot be given to the pet.' can be shown to the user through uiscript.

Potential Errors and Solutions
Some developers may perform incomplete checks when deleting items during pet feeding, causing players to mistakenly consume locked items. To avoid this, the CheckItemLocked() function should be called before item deletion to verify if the item is locked. Furthermore, logging these operations enhances security.

GUI Integration with Python
If you are using py GUI for your interface, you can prevent the selection of locked items in the pet feeding screen by adding a control or button. For example, when an item is selected, the IsLocked() function can be used to check if it is locked, and if so, an alert can be displayed to the user. This not only improves user experience but also reduces security risks on the server side.

Conclusion
Correct functioning of the pet feeding system in Metin2 private servers depends on small but critical checks. Preventing locked items from being fed to pets increases both server security and prevents users from accidentally losing items. With this fix, your pet systems will become more stable and secure. For more systems and scripts, visit Metin2Lobby.
 

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

Geri
Üst Alt