Locale_inc :
#def ENABLE_10X_CHEST_OPEN
PythonApplicationModule :
Arat :
Kod:
#ifdef ENABLE_COSTUME_SYSTEM PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM", 1); PyModule_AddIntConstant(poModule, "ENABLE_CHECK_IF_SAFEBOX_OPEN", 1); #else PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM", 0); #endif
Altına ekle:
Kod:
#ifdef ENABLE_10X_CHEST_OPEN PyModule_AddIntConstant(poModule, "ENABLE_10X_CHEST_OPEN", 1); #else PyModule_AddIntConstant(poModule, "ENABLE_10X_CHEST_OPEN", 0); #endif
Python
uiinventory.py:
Arat:
Kod:
def UseItemSlot(self, slotIndex): if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS(): return slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex) self.__UseItem(slotIndex) mouseModule.mouseController.DeattachObject() self.OverOutItem()
Kod:
if app.ENABLE_10X_CHEST_OPEN: def IsTreasureBox(self, slotIndex): itemVnum = player.GetItemIndex(slotIndex) item.SelectItem(itemVnum) if item.GetItemType() == item.ITEM_TYPE_GIFTBOX: return True ## Dacă un item nu are type giftbox adaugi simplu aici vnumul lui. treasures = { 0: 50011, 1: 50024, 2: 50025, 3: 50031, 4: 50032, } if itemVnum in treasures.values(): return True return False def SendMultipleUseItemPacket(self, slotIndex): for i in xrange(player.GetItemCount(slotIndex)): self.__SendUseItemPacket(slotIndex)
Kod:
def __UseItem(self, slotIndex): ItemVNum = player.GetItemIndex(slotIndex) item.SelectItem(ItemVNum)
Kod:
if app.ENABLE_10X_CHEST_OPEN: if app.IsPressed(app.DIK_LCONTROL) and self.IsTreasureBox(slotIndex): self.SendMultipleUseItemPacket(slotIndex) return
Metin2 Sunucu Geliştirme ve C++ ile Ctrl + Sağ Tık Seri Sandık Açma Sistemi
Metin2 özel sunucularında geliştirme yaparken, oyuncuların deneyimini artırmak için birçok farklı sistem entegre edilebilir. Bu sistemlerden birisi de 'Ctrl + Sağ Tık Seri Sandık Açma' özelliğidir. Bu yazıda, C++ tabanlı Metin2 sunucularında bu sistemin nasıl kurulacağını, hangi dosyaların düzenleneceğini ve neler dikkat edilmesi gerektiğini detaylı olarak ele alacağız.
Seri Sandık Nedir?
Seri sandık sistemi, oyuncuların belirli bir sandığı birden fazla kez açarak içinden ödüller kazanmalarını sağlayan bir özelliktir. Bu sistem genellikle PvP sunucularında seviye atlama, eşya geliştirme gibi önemli ödüllerin verildiği aktivitelerde tercih edilir. Oyuncular, Ctrl tuşuna basılı tutarak sandığa sağ tıkladığında otomatik olarak birden fazla kez açabilirler. Bu da hem zaman kazandırır hem de kullanıcı dostu bir deneyim sunar.
C++ Kaynak Kodlarda Gerekli Değişiklikler
Bu sistemin uygulanması için öncelikle Metin2 sunucu tarafında C++ kaynak kodlarında bazı değişiklikler yapılması gerekir. Özellikle 'game' sunucusunda bulunan item_use.cpp, input_main.cpp ve instance_manager.cpp gibi dosyalarda gerekli modifikasyonlar yapılmalıdır.
Öncelikle, oyuncunun Ctrl tuşuna basılı tutup sandığı sağ tıklaması durumunda özel bir fonksiyon çağrılması sağlanmalıdır. Bu işlem için client tarafında da bir kontrol yapılmak zorundadır. Client tarafından gönderilen paket, Ctrl tuşunun basılı olup olmadığını belirtmelidir. Eğer bu bilgi doğru şekilde server'a iletilirse, sandık açma işlemi otomatikleştirilir.
Python Tarafında UI Entegrasyonu
Metin2 client tarafında bu işlem için Python GUI dosyalarında da bazı değişiklikler yapılır. Özellikle 'uiscript', 'py root' ve 'martysama' gibi yapılar üzerinden UI üzerinde sağ tıklama olayları kontrol edilir. Ctrl tuşu basıldığında sağ tıklama eventi farklı bir fonksiyonu tetiklemelidir. Bu fonksiyon ise sandığı doğrudan açmak yerine, server'a bir mesaj göndererek seri açma işlemini başlatır.
Py GUI tarafında bir event handler tanımlanarak, klavyeden alınan input bilgileri değerlendirilir. Eğer Ctrl tuşu aktifse ve sağ tıklama gerçekleşirse, serial open fonksiyonu devreye girer. Bu sayede oyuncu sandığı hızlıca ve kolayca açabilir.
Hata Ayıklama ve Test Süreci
Her sistem entegrasyonunda olduğu gibi bu sistem de test süreci olmadan tam anlamıyla aktif edilmemelidir. Özellikle sandık sistemlerinde hatalar büyük sorunlara yol açabilir. Örneğin, sandık açma limitlerinin ayarlanmaması, sunucuda hile riskini artırabilir. Bu nedenle, hem client hem de server tarafında gerekli kontrollerin sağlanması önemlidir.
Ayrıca loglama işlemleri sayesinde, hangi oyuncunun kaç adet sandık açtığı takip edilebilir. Bu bilgiler DB üzerinde saklanarak istatistiksel analizler için kullanılabilir. Sunucu yöneticileri, bu verileri kullanarak daha dengeli bir PvP sistemi kurabilirler.
Sonuç
Metin2 özel sunucularında C++ ve Python kullanarak geliştirilen 'Ctrl + Sağ Tık Seri Sandık Aç' sistemi, oyuncu deneyimini ciddi anlamda artırır. Doğru uygulandığında hem stabil hem de kullanıcı dostu bir yapı oluşturulabilir. Bu tür sistemlerin temelinde, client-server iletişimi, event handling ve veri güvenliği yatmaktadır. Bu nedenle, sistemi entegre ederken dikkatli hareket etmek ve test süreçlerini ihmal etmemek çok önemlidir.
Metin2 Server Development and Ctrl + Right Click Serial Chest System with C++
In Metin2 private servers, various systems can be integrated to enhance player experience. One of these systems is the 'Ctrl + Right Click Serial Chest Opening' feature. In this article, we will detail how to implement this system in C++ based Metin2 servers, which files need to be modified, and what precautions should be taken.
What is Serial Chest?
The serial chest system allows players to open a specific chest multiple times in succession to win rewards. This system is commonly used in PvP servers for activities that offer important rewards such as level-ups or equipment enhancements. By holding the Ctrl key and right-clicking on the chest, players can automatically open it multiple times, saving time and providing a user-friendly experience.
Required Changes in C++ Source Code
To implement this system, certain modifications must be made in the C++ source code of the Metin2 server, particularly in files like item_use.cpp, input_main.cpp, and instance_manager.cpp located in the 'game' server.
Firstly, when a player holds the Ctrl key and right-clicks on the chest, a special function should be triggered. For this, a check must also be implemented on the client side. The packet sent from the client should indicate whether the Ctrl key is pressed. If this information is correctly transmitted to the server, the chest opening process becomes automated.
UI Integration in Python
On the client side, changes are also required in the Python GUI files. Particularly through structures like 'uiscript', 'py root', and 'martysama', right-click events on the UI are controlled. When the Ctrl key is pressed, the right-click event should trigger a different function. Instead of directly opening the chest, this function sends a message to the server to initiate the serial open process.
An event handler defined in Py GUI evaluates input information received from the keyboard. If the Ctrl key is active and a right-click occurs, the serial open function is activated, allowing the player to quickly and easily open the chest.
Debugging and Testing Process
As with any system integration, this system should not be fully activated without a testing phase. Especially in chest systems, errors can lead to major issues. For example, failure to set limits on chest openings might increase cheating risks on the server. Therefore, necessary checks must be ensured on both client and server sides.
Additionally, logging processes allow tracking how many chests each player opens. These records can be stored in the database and used for statistical analysis. Server administrators can use this data to create a more balanced PvP environment.
Conclusion
The 'Ctrl + Right Click Serial Chest Open' system developed using C++ and Python in Metin2 private servers significantly enhances player experience. When properly implemented, a stable and user-friendly structure can be created. At the core of such systems lie client-server communication, event handling, and data security. Therefore, caution must be exercised during integration, and testing processes should never be neglected.
