[C++,PY] AKSESUARLARA GELEN SOKET SINIRINI ARTTIRIN !

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Constants.h açılır ve bulunur.

Kod:
enum {     ITEM_ACCESSORY_SOCKET_MAX_NUM = 3 };

Değiştirilir.

Kod:
enum {     ITEM_ACCESSORY_SOCKET_MAX_NUM = 4 };

Constants.cpp açılır ve bulunur.

Kod:
const int aiAccessorySocketAddPct[ITEM_ACCESSORY_SOCKET_MAX_NUM] = {     50, 50, 50 }; const int aiAccessorySocketEffectivePct[ITEM_ACCESSORY_SOCKET_MAX_NUM + 1] = {     0, 10, 20, 40 }; const int aiAccessorySocketDegradeTime[ITEM_ACCESSORY_SOCKET_MAX_NUM + 1] = {     0, 3600 * 24, 3600 * 12, 3600 * 6 }; const int aiAccessorySocketPutPct[ITEM_ACCESSORY_SOCKET_MAX_NUM + 1] = {     90, 80, 70, 0 };

Değiştirilir.

Kod:
const int aiAccessorySocketAddPct[ITEM_ACCESSORY_SOCKET_MAX_NUM] = {     50, 50, 50, 50 }; const int aiAccessorySocketEffectivePct[ITEM_ACCESSORY_SOCKET_MAX_NUM + 1] = {     0, 10, 20, 40, 80 }; const int aiAccessorySocketDegradeTime[ITEM_ACCESSORY_SOCKET_MAX_NUM + 1] = {     0, 3600 * 24, 3600 * 12, 3600 * 6, 3600 * 3 }; const int aiAccessorySocketPutPct[ITEM_ACCESSORY_SOCKET_MAX_NUM + 1] = {     90, 80, 70, 60, 0 };

uiTooltip.py açılır ve bulunur.

Kod:
def __AppendAccessoryMetinSlotInfo(self, metinSlot, mtrlVnum):

Komple değiştirilir.

Kod:
def __AppendAccessoryMetinSlotInfo(self, metinSlot, mtrlVnum):         ACCESSORY_SOCKET_MAX_SIZE = 4         cur=min(metinSlot[0], ACCESSORY_SOCKET_MAX_SIZE)         end=min(metinSlot[1], ACCESSORY_SOCKET_MAX_SIZE)         affectType1, affectValue1 = item.GetAffect(0)         affectList1=[0, max(1, affectValue1*10/100), max(2, affectValue1*20/100), max(3, affectValue1*40/100), max(4, affectValue1*80/100)]         affectType2, affectValue2 = item.GetAffect(1)         affectList2=[0, max(1, affectValue2*10/100), max(2, affectValue2*20/100), max(3, affectValue2*40/100), max(4, affectValue2*80/100)]         affectType3, affectValue3 = item.GetAffect(2)         affectList3=[0, max(1, affectValue3*10/100), max(2, affectValue3*20/100), max(3, affectValue3*40/100), max(4, affectValue3*80/100)]         mtrlPos=0         mtrlList=[mtrlVnum]*cur+[player.METIN_SOCKET_TYPE_SILVER]*(end-cur)         for mtrl in mtrlList:             affectString1 = self.__GetAffectString(affectType1, affectList1[mtrlPos+1]-affectList1[mtrlPos])             affectString2 = self.__GetAffectString(affectType2, affectList2[mtrlPos+1]-affectList2[mtrlPos])             affectString3 = self.__GetAffectString(affectType3, affectList3[mtrlPos+1]-affectList3[mtrlPos])             leftTime = 0             if cur == mtrlPos+1:                 leftTime=metinSlot[2]             self.__AppendMetinSlotInfo_AppendMetinSocketData(mtrlPos, mtrl, affectString1, affectString2, affectString3, leftTime)             mtrlPos+=1

Bulunur.

Kod:
def __AppendMetinSlotInfo_AppendMetinSocketData(self, index, metinSlotData, custumAffectString="", custumAffectString2="", leftTime=0):

Değiştirilir.

Kod:
def __AppendMetinSlotInfo_AppendMetinSocketData(self, index, metinSlotData, custumAffectString="", custumAffectString2="", custumAffectString3="", leftTime=0):

Bulunur.​

Kod:
if custumAffectString2:                 affectTextLine = ui.TextLine()                 affectTextLine.SetParent(self)                 affectTextLine.SetFontName(self.defFontName)                 affectTextLine.SetPackedFontColor(self.POSITIVE_COLOR)                 affectTextLine.SetPosition(50, self.toolTipHeight + 16 + 2 + 16 + 2)                 affectTextLine.SetOutline()                 affectTextLine.SetFeather()                 affectTextLine.Show()                 affectTextLine.SetText(custumAffectString2)                 self.childrenList.append(affectTextLine)                 self.toolTipHeight += 16 + 2

Altına eklenilir.

Kod:
if custumAffectString3:                 affectTextLine = ui.TextLine()                 affectTextLine.SetParent(self)                 affectTextLine.SetFontName(self.defFontName)                 affectTextLine.SetPackedFontColor(self.POSITIVE_COLOR)                 affectTextLine.SetPosition(50, self.toolTipHeight + 16 + 2 + 16 + 2)                 affectTextLine.SetOutline()                 affectTextLine.SetFeather()                 affectTextLine.Show()                 affectTextLine.SetText(custumAffectString3)                 self.childrenList.append(affectTextLine)                 self.toolTipHeight += 16 + 2

Metin2 Lobby olarak sunucu geliştirme dünyasında aktif olan herkes, özellikle C++ ve Python tabanlı sistemler üzerinde çalışırken, akis ve eklenti sistemlerinde sınırlamalarla karşılaşabiliyor. Bu sınırlardan birisi özellikle aksesuar eşyalarına gelen soket sayısıdır. Standart Metin2 sunucularında, aksesuarlara gelen soket sayısı genellikle 3 ile sınırlıdır. Ancak bazı özel PvP sistemleri, turnuvalar ya da oyun içi özel etkinliklerde daha fazla soket sayısına ihtiyaç duyulabilir. Bu yazıda, C++ ve Python tabanlı sistemlerde aksesuar eşyalarına gelen soket sayısını nasıl artıracağımızı adım adım ele alacağız.

Neden Soket Sınırı Arttırılmalıdır?
Metin2 oyununda soket sistemi, oyuncuların ekipmanlarını geliştirmelerine olanak tanır. Özellikle aksesuar eşyaları gibi yüksek seviye itemlerde daha fazla soket kullanılması, oyuncuların stratejik olarak avantaj elde etmesini sağlar. Bu nedenle, PvP sunucularında soket sınırının artırılması, oyun deneyimini ciddi anlamda zenginleştirir. Soket sınırını arttırmak, hem game core hem de client tarafında değişiklik yapılmasını gerektirir.

C++ Tarafında Yapılacak Değişiklikler
Metin2 sunucu kaynak kodları genellikle C++ ile yazılmıştır. Game server tarafında aksesuar eşyalarına gelen soket sınırını değiştirmek için öncelikle src/server/game/item/ klasöründe bulunan dosyalarda değişiklik yapmamız gerekir. Özellikle item.cpp veya item_manager.cpp gibi dosyalarda socket_count ile ilgili tanımlamaları aramalıyız. Standart sistemde bu değer 3 olarak tanımlanmıştır. Bu değeri 6 ya da daha yüksek bir değere yükselterek, aksesuar eşyalarına daha fazla soket eklenmesini sağlayabiliriz.

Python Tarafında Yapılacak Değişiklikler
Client tarafında, yani oyuncunun bilgisayarında çalışan Python tabanlı GUI sistemlerinde (uiscript) de soket görsel arayüzde doğru şekilde görüntülenebilmesi için değişiklik yapılmalıdır. Py Root klasöründe bulunan itemwnd.py veya benzeri dosyalarda, socket slotlarının sayısı tanımlanır. Bu dosyada MAX_SOCKET_SLOTS gibi bir sabit varsa, bu değeri C++ tarafındakiyle uyumlu hale getirmemiz gerekir. Örneğin 6 olarak ayarlanabilir. Ayrıca itemwnd.py dosyasında soket slotlarının çizildiği kısım güncellenmelidir ki, 6 soketlik alan düzgün şekilde görünür olsun.

Örnek Kod Değişikliği (C++)
Kod:
const int MAX_SOCKET_COUNT = 6; // Eski değer 3tü

Örnek Kod Değişikliği (Python)
Kod:
MAX_SOCKET_SLOTS = 6


Not: Her iki tarafın da senkronize edilmesi şarttır. Aksi takdirde client crash veya item bilgilerinin eksik gelmesi gibi sorunlar yaşanabilir. Bu nedenle, hem game server hem de client tarafında aynı değeri kullanmaya dikkat edin.

Derleme ve Test Süreci
Değişiklikler yapıldıktan sonra, game server ve client tekrar derlenmelidir. Metin2 Compile işlemi sırasında herhangi bir hata alınmaması gerekir. Derleme tamamlandıktan sonra, test sunucusunda farklı aksesuar eşyaları kullanılarak soket sayısının doğru şekilde 6'ya çıktığı kontrol edilmelidir. Martysama gibi bilinen geliştirici topluluklarında yapılan testler, sistemin kararlılığını artırır.

Sonuç
Metin2 özel sunucularında aksesuar eşyalarına gelen soket sayısını artırmak, PvP deneyimini ciddi anlamda geliştirir. Hem C++ hem de Python tabanlı sistemlerde yapılması gereken küçük değişikliklerle, bu sınır kolayca kaldırılabilir. Metin2 Lobby olarak bu tür gelişmiş source edit işlemleri, topluluk tarafından takip edilmekte ve paylaşım yapılmaktadır. Eğer siz de kendi core sistemlerinizi geliştirmek istiyorsanız, db core ve game core üzerinde çalışmalar yaparken bu tarz küçük ama büyük etki yaratan düzenlemeleri mutlaka yapmalısınız.


Metin2 Lobby as everyone active in the server development world knows, especially when working with C++ and Python-based systems, may encounter limitations in accessory and socket systems. One of these limitations is specifically the socket count that comes to accessories. In standard Metin2 servers, the number of sockets coming to accessories is generally limited to 3. However, in certain special PvP systems, tournaments, or in-game events, more socket slots might be needed. In this article, we will explain step by step how to increase the number of sockets on accessory items in C++ and Python-based systems.

Why Should Socket Limits Be Increased?
In Metin2, the socket system allows players to enhance their equipment. Especially on high-level items like accessories, having more sockets provides strategic advantages for players. Therefore, increasing the socket limit on accessories significantly enriches the gaming experience in PvP servers. Increasing the socket limit requires modifications both in game core and client sides.

Changes Required in C++
The Metin2 server source codes are mostly written in C++. To modify the socket limit for accessory items on the game server side, first we need to make changes in files located under src/server/game/item/. Specifically, look for definitions related to socket_count in files such as item.cpp or item_manager.cpp. This value is usually defined as 3 in standard systems. By increasing this value to 6 or higher, we can allow more sockets on accessory items.

Changes Required in Python
On the client side, which runs the Python-based GUI (uiscript), changes must also be made so that the socket UI displays correctly. In the Py Root folder, in files like itemwnd.py, the number of socket slots is defined. If there is a constant like MAX_SOCKET_SLOTS, it should be adjusted to match the C++ side, for example set to 6. Additionally, the part where socket slots are drawn in itemwnd.py should be updated so that a 6-socket layout appears properly.

Example Code Change (C++)
Kod:
const int MAX_SOCKET_COUNT = 6; // Previous value was 3

Example Code Change (Python)
Kod:
MAX_SOCKET_SLOTS = 6


Note: It's crucial that both sides remain synchronized. Otherwise, issues such as client crash or missing item information may occur. Therefore, ensure both game server and client use the same values.

Build and Testing Process
After making the changes, both the game server and client must be recompiled. No errors should occur during the Metin2 Compile process. After compilation is complete, different accessory items should be tested on the test server to confirm the socket count has indeed increased to 6. Tests done in known developer communities like Martysama increase system stability.

Conclusion
Increasing the number of sockets on accessory items in private Metin2 servers significantly improves the PvP experience. With small changes made in both C++ and Python-based systems, this limit can easily be removed. At Metin2 Lobby, such advanced source edit operations are followed and shared within the community. If you want to develop your own core systems, while working on db core and game core, you should definitely implement these small but impactful edits.​
 

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

Benzer konular

Geri
Üst Alt