[NYS.X] Metin2 Profil Sistemi [C++ / Python]

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Öncelikle merhaba sistem kesinlikle bana ait değildir, fakat arapça bir suudi arabistanlı arkadaş hazırlamış ve bende sistemi türkçeye çevirip daha ingilizce sürümü dahi yokken sizlere sunmak istedim. Maksat yardımlaşmak. Daha fazla konuyu uzatmadan detaylara geçiyorum nasıl yapacağımız konusunda.
game.py dosyası üzerinde yapacağımız değişiklikler bunlardır :

# Dosyanın en başına ekleyin
Kod:
import uiprofile

# Bu kodu bulun ve hemen altına
Kod:
self.__ProcessPreservedServerCommand()

# Bu kodu ekleyin
Kod:
self.uiprofile = uiprofile.ProfileWindoww()

# Bu kodu bulun ve hemen altına
Kod:
def Close(self):

# Bu kodu ekleyin
Kod:
self.uiprofile.Close()

#ا Bu kodu bulun ve hemen altına
Kod:
onPressKeyDict[app.DIK_F4]    = lambda : self.__PressQuickSlot(7)

# Bu kodu ekleyin
Kod:
onPressKeyDict[app.DIK_F6]    = lambda : self.__OpenProfile()

# Bu kodu bulun ve hemen altına
Kod:
def BINARY_NEW_RemoveAffect(self, type, pointIdx):

# Bu kodu ekleyin
Kod:
def OpenProfileDialog(self,Name,Gander,Deeanh,Age,City,Country,Fcbook,Website,Skype,Note):         self.uiprofile.OpenWindow(Name,Gander,Deeanh,Age,City,Country,Fcbook,Website,Skype,Note)

# Dosyanın en sonuna ekleyin.
Kod:
def __OpenProfile(self):         name = player.GetName()         net.SendChatPacket("/view_profile " + str(name))

game.py üzerinde yapacağımız işlemler bitti. Şimdi orada olmayan bir dosya oluşturacağız. "game.py'nin bulunduğu dizine" yeni bir dosya oluşturacağız.

Adını : uiprofile.py olarak koymalısınız.

İçerisine ekleyeceğiniz içerik budur :
Kod:
import ui import dbg import app import wndMgr import net import player import localeInfo import chr import chat class ProfileWindoww(ui.Window):     class TextToolTip(ui.Window):         def __init__(self):             ui.Window.__init__(self, "TOP_MOST")             textLine = ui.TextLine()             textLine.SetParent(self)             textLine.SetHorizontalAlignCenter()             textLine.SetOutline()             textLine.Show()             self.textLine = textLine         def __del__(self):             ui.Window.__del__(self)         def SetText(self, text):             self.textLine.SetText(text)         def OnRender(self):             (mouseX, mouseY) = wndMgr.GetMousePosition()             self.textLine.SetPosition(mouseX, mouseY - 15)     def __init__(self):         ui.Window.__init__(self)         self.BuildWindow()          def __del__(self):         ui.Window.__del__(self)     def BuildWindow(self):         self.Board = ui.BoardWithTitleBar()         self.Board.SetSize(270, 465)         self.Board.SetPosition(68, wndMgr.GetScreenHeight()-650)         self.Board.AddFlag('movable')         self.Board.SetTitleName("ÇáãáÝ ÇáÔÎÕí")         self.Board.AddFlag('float')         self.Board.Hide()         self.comp = Component()         self.blockval=64         self.txtName = self.comp.TextLine(self.Board, 'ÇáÃÓã ', 255, 28+14, self.comp.RGB(255, 255, 255))         self.txtGander = self.comp.TextLine(self.Board, 'ÇáÌäÓ ', 120, 28+14, self.comp.RGB(255, 255, 255))         self.txtDeeanh = self.comp.TextLine(self.Board, 'ÇáÏíÇäå ', 255, 28+(2*28), self.comp.RGB(255, 255, 255))         self.txtAge = self.comp.TextLine(self.Board, 'ÇáÚãÑ', 110, 28+(2*28), self.comp.RGB(255, 255, 255))         self.txtCity = self.comp.TextLine(self.Board, 'ÇáÈáÏ', 255, 28+(3*28+14), self.comp.RGB(255, 255, 255))         self.txtCountry = self.comp.TextLine(self.Board,  'ÇáãÏíäÉ', 120, 28+(3*28+14), self.comp.RGB(255, 255, 255))         self.txtFcbook = self.comp.TextLine(self.Board,  'ÇáÝíÓ Èæß', 255, 28+(5*28), self.comp.RGB(255, 255, 255))         self.txtWebsite = self.comp.TextLine(self.Board,  'ãæÞÚß', 255, 28+(7*28), self.comp.RGB(255, 255, 255))         self.txtSkype = self.comp.TextLine(self.Board,  'ÓÜßÜÜÇí Èí', 255, 28+(9*28), self.comp.RGB(255, 255, 255))         self.txtNote = self.comp.TextLine(self.Board,  'ãáÇÍÙÇÊ', 255, 28+(11*28), self.comp.RGB(255, 255, 255))                  self.Update_btn = ui.Button()         self.Update_btn.SetParent(self.Board)         self.Update_btn.SetPosition(150,28+(13*28)+18+18)         self.Update_btn.SetUpVisual('d:/ymir work/ui/public/Large_Button_01.sub')         self.Update_btn.SetOverVisual('d:/ymir work/ui/public/Large_Button_02.sub')         self.Update_btn.SetDownVisual('d:/ymir work/ui/public/Large_Button_03.sub')         self.Update_btn.SetText("ÊÜÜÍÜÜÏíÜË")         self.Update_btn.SetEvent(ui.__mem_func__(self.UpdateEvent))         self.Update_btn.Show()                      self.blockBtn = self.comp.ToggleButton(self.Board, 'ãÔÇåÏÉ', '', 20, 28+(13*28)+18+18, (lambda arg = 'off': self.btnblock_func(arg)), (lambda arg = 'on': self.btnblock_func(arg)), 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')              def OpenWindow(self,Name="",Gander="",Deeanh="",Age="",City="",Country="",Fcbook="",Website="",Skype="",Note=""):         name = player.GetName()         if Name != name:             self.editName = self.comp.EditLine(self.Board,str(Name), 147, 28+14+18, 100,20,24,False,False)             self.editGander = self.comp.EditLine(self.Board,str(Gander), 57, 28+14+18, 55,20,6,False,False)             self.editDeeanh = self.comp.EditLine(self.Board, str(Deeanh), 183, 28+(2*28)+18, 65,20,6,False,False)             self.editAge = self.comp.EditLine(self.Board,str(Age), 57, 28+(2*28)+18, 55,20,6,False,False)             self.editCity = self.comp.EditLine(self.Board, str(City), 183, 28+(3*28+14)+18, 65,20,11,False,False)             self.editCountry = self.comp.EditLine(self.Board, str(Country), 27,  28+(3*28+14)+18, 100,20,11,False,False)             self.editFcbook = self.comp.EditLine(self.Board,str(Fcbook), 83, 28+(5*28)+18, 170,20,24,False,False)             self.editWebsite = self.comp.EditLine(self.Board, str(Website), 83, 28+(7*28)+18, 170,20,24,False,False)             self.editSkype = self.comp.EditLine(self.Board, str(Skype), 83, 28+(9*28)+18, 170,20,24,False,False)             self.editNote = self.comp.EditLine(self.Board, str(Note), 53, 28+(11*28)+18, 200,60,80,False,True)             self.Update_btn.Hide()             self.blockBtn.Hide()                 else:             self.editName = self.comp.EditLine(self.Board,str(Name), 147, 28+14+18, 100,20,24,False,False)             self.editGander = self.comp.EditLine(self.Board,str(Gander), 57, 28+14+18, 55,20,6,True,False)             self.editDeeanh = self.comp.EditLine(self.Board, str(Deeanh), 183, 28+(2*28)+18, 65,20,6,True,False)             self.editAge = self.comp.EditLine(self.Board,str(Age), 57, 28+(2*28)+18, 55,20,6,True,False)             self.editCity = self.comp.EditLine(self.Board, str(City), 183, 28+(3*28+14)+18, 65,20,11,True,False)             self.editCountry = self.comp.EditLine(self.Board, str(Country), 27,  28+(3*28+14)+18, 100,20,11,True,False)             self.editFcbook = self.comp.EditLine(self.Board,str(Fcbook), 83, 28+(5*28)+18, 170,20,24,True,False)             self.editWebsite = self.comp.EditLine(self.Board, str(Website), 83, 28+(7*28)+18, 170,20,24,True,False)             self.editSkype = self.comp.EditLine(self.Board, str(Skype), 83, 28+(9*28)+18, 170,20,24,True,False)             self.editNote = self.comp.EditLine(self.Board, str(Note), 53, 28+(11*28)+18, 200,60,80,True,True)             self.Update_btn.Show()             self.blockBtn.Show()                  if self.Board.IsShow():             self.Board.Hide()         else:             self.Board.Show()     def UpdateEvent(self):         self.CheckInfo(str(self.editGander[1].GetText()),str(self.editDeeanh[1].GetText()),str(self.editAge[1].GetText()),str(self.editCity[1].GetText()),str(self.editCountry[1].GetText()),str(self.editFcbook[1].GetText()),str(self.editWebsite[1].GetText()),str(self.editSkype[1].GetText()),str(self.editNote[1].GetText()))         player.UpdateProfile(str(self.editName[1].GetText()),str(self.editGander[1].GetText()),str(self.editDeeanh[1].GetText()),str(self.editAge[1].GetText()),str(self.editCity[1].GetText()),str(self.editCountry[1].GetText()),str(self.editFcbook[1].GetText()),str(self.editWebsite[1].GetText()),str(self.editSkype[1].GetText()),str(self.editNote[1].GetText()))         chat.AppendChat(chat.CHAT_TYPE_INFO,"clickd")     def btnblock_func(self, arg, do=1):         if self.blockval == 64:             net.SendChatPacket("/setblockmode " + str(self.blockval))             self.blockBtn.Down()             self.blockval = 32         else:             net.SendChatPacket("/setblockmode " + str(self.blockval))             self.blockBtn.SetUp()             self.blockval = 64               def CheckInfo(self,Gander,Deeanh,Age,City,Country,Fcbook,Website,Skype,Note):         if len(Gander)==0:             Gander = "..."             self.editGander[1].SetText(str(Gander))         if len(Deeanh)==0:             Deeanh = "..."             self.editDeeanh[1].SetText(str(Deeanh))         if  len(Age)==0:             Age = "1"             self.editAge[1].SetText(str(Age))         if  len(City)==0:             City = "...."             self.editCity[1].SetText(str(City))         if  len(Country)==0:             Country = "...."                 self.editCountry[1].SetText(str(Country))         if  len(Fcbook)==0:             Fcbook = "fb.com/xxx"             self.editFcbook[1].SetText(str(Fcbook))         if  len(Website)==0:             Website = "ww.xxx.com"             self.editWebsite[1].SetText(str(Website))         if  len(Skype)==0:             Skype = "....."             self.editSkype[1].SetText(str(Skype))         if  len(Note)==0:             Note = "................................"             self.editNote[1].SetText(str(Note))     def Close(self):         self.Board.Hide() class Component:     def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual):         button = ui.ToggleButton()         if parent != None:             button.SetParent(parent)         button.SetPosition(x, y)         button.SetUpVisual(UpVisual)         button.SetOverVisual(OverVisual)         button.SetDownVisual(DownVisual)         button.SetText(buttonName)         button.SetToolTipText(tooltipText)         button.Show()         button.SetToggleUpEvent(funcUp)         button.SetToggleDownEvent(funcDown)         return button     def EditLine(self, parent, editlineText, x, y, width, heigh, max,isMe,isMulteLine):         SlotBar = ui.SlotBar()         if parent != None:             SlotBar.SetParent(parent)         SlotBar.SetSize(width, heigh)         SlotBar.SetPosition(x, y)         SlotBar.Show()         if isMe==True:             Value = ui.EditLine()         else:             Value = ui.TextLine()         Value.SetParent(SlotBar)         Value.SetSize(width, heigh)         Value.SetPosition(1, 1)         Value.SetLimitWidth(width)         Value.SetMax(max)         Value.GetText()         Value.SetText(editlineText)         if isMulteLine == True:             Value.SetMultiLine()                  Value.Show()         return SlotBar, Value     def TextLine(self, parent, textlineText, x, y, color):         textline = ui.TextLine()         if parent != None:             textline.SetParent(parent)         textline.SetPosition(x, y)         if color != None:             textline.SetFontColor(color[0], color[1], color[2])         textline.SetText(textlineText)         textline.Show()         return textline     def RGB(self, r, g, b):         return (r*255, g*255, b*255)     def ExpandedImage(self, parent, x, y, img):         image = ui.ExpandedImageBox()         if parent != None:             image.SetParent(parent)         image.SetPosition(x, y)         image.LoadImage(img)         image.Show()         return image          def Gauge(self, parent, width, color, x, y):         gauge = ui.Gauge()         if parent != None:             gauge.SetParent(parent)         gauge.SetPosition(x, y)         gauge.MakeGauge(width, color)         gauge.Show()         return gauge


sonrasında "uitarget.py" dosyasını açalım ve aşağıdaki adımları uygulayalım.

# Bu kodu bulun ve hemen altına
Kod:
localeInfo.TARGET_BUTTON_FRIEND,

# Bu kodu ekleyin
Kod:
"Dosya",

# Bu kodu bulun ve hemen altına
Kod:
self.buttonDict[localeInfo.TARGET_BUTTON_INVITE_GUILD].SAFE_SetEvent(self.__OnGuildAddMember)

# Bu kodu ekleyin
Kod:
self.buttonDict["Profil"].SetEvent(ui.__mem_func__(self.__OnViewProfile))

# Bu kodu bulun ve hemen altına
Kod:
self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_FIGHT])

# Bu kodu ekleyin
Kod:
self.showingButtonList.append(self.buttonDict["Profil"])

# Bu kodu bulun ve hemen altına
Kod:
def __OnExitObserver(self):

# Bu kodu ekleyin
Kod:
def __OnViewProfile(self):         name = chr.GetNameByVID(self.vid)         net.SendChatPacket("/view_profile " + str(name))         chat.AppendChat(chat.CHAT_TYPE_INFO,"hedef "+str(name))

şimdi sıra geldi navicata tarafına yani mysql ekleyeceğimize.

Kod:
SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS `profile_system`; CREATE TABLE `profile_system` (   `player_name` varchar(32) CHARACTER SET latin1 NOT NULL DEFAULT 'NONAME',   `Gander` varchar(32) CHARACTER SET latin1 DEFAULT '',   `Deeanh` varchar(32) CHARACTER SET latin1 DEFAULT '',   `Age` varchar(32) CHARACTER SET latin1 DEFAULT '',   `City` varchar(32) CHARACTER SET latin1 DEFAULT '',   `Country` varchar(32) CHARACTER SET latin1 DEFAULT '',   `Fcbook` varchar(32) CHARACTER SET latin1 DEFAULT '',   `Website` varchar(32) CHARACTER SET latin1 DEFAULT '',   `Skype` varchar(32) CHARACTER SET latin1 DEFAULT '',   `Note` varchar(85) CHARACTER SET latin1 DEFAULT '',   PRIMARY KEY (`player_name`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1256;

C++ Source taraflı eklenecekleri konu daha fazla uzun olmasın diye upload edip paylaşmak istedim. Bunları yaptıktan sonra source tarafınada eklediğinizde sistem sorunsuz olarak çalışacaktır. Ek olarak burada yaptığınız işlemlerin anlatımı dosya içerisindede mevcuttur.



Metin2 Profil Sistemi [C++ / Python] Nedir?

Metin2 özel sunucularında gelişmiş bir kullanıcı deneyimi sunmak isteyen geliştiriciler için Profil Sistemi, oyuncuların karakterlerini, skorlarını, ilerlemelerini ve diğer istatistiksel verileri kolayca takip edebilmelerini sağlayan güçlü bir özelliktir. Bu sistem, C++ ve Python dilleriyle entegre çalışarak hem sunucu tarafında hem de istemci tarafında sorunsuz bir yapıyla yer alır. Metin2Lobby olarak bu yazıda, NYS.X Metin2 Profil Sistemi'ni detaylı olarak ele alacağız.

Sistem Özellikleri

Profil sistemi sayesinde oyuncular, karakterlerinin PvP kazanımları, seviye ilerlemesi, envanter içerikleri gibi verileri internet üzerinden görebilir. Bu özellik, oyuncuların kendi gelişimini analiz etmesine ve rekabet ortamını daha keyifli hale getirmesine yardımcı olur. Ayrıca, geliştiriciler açısından da sistem; oyuncu sadakati artırmak, sunucu içi etkileşimleri artırmak ve veri tabanı üzerinde detaylı raporlar çıkarmak açısından oldukça değerlidir.

C++ ve Python Entegrasyonu

Sistem, C++ dilinde yazılmış olan oyun sunucusu kodları ile Python dilinde geliştirilen istemci arayüzünü birleştirerek, verilerin güvenli ve hızlı bir şekilde aktarılmasını sağlar. Bu entegrasyon sayesinde, sunucu tarafında depolanan karakter verileri, istemcide bir profil sayfası şeklinde gösterilir. Bu yapı, hem Martysama temalarında hem de özgün uiscript dosyalarıyla sorunsuz çalışabilir.

Veri Tabanı Yapısı

Sistem, MySQL veya MariaDB gibi ilişkisel veri tabanlarında çalışacak şekilde tasarlanmıştır. Karakter adı, seviyesi, PvP skoru, eşya listesi gibi veriler, ayrı tablolarda tutulur. Bu sayede veri bütünlüğü korunur ve performans artırılır. Game Core ve DB Core yapıları, bu verilerin güvenli ve optimize şekilde işlenmesini sağlar.

Python GUI ile Profil Arayüzü

Profil sayfaları, Python GUI teknolojisi kullanılarak geliştirilmiştir. Oyuncular, karakterlerine özel arayüzler üzerinden istatistikleri, envanteri ve PvP geçmişi gibi bilgilere ulaşabilirler. Bu arayüzler, py root dosyaları ile entegre edilerek, Metin2 istemcisi içerisine kolayca dahil edilebilir.

Kurulum ve Yapılandırma

Sistemin kurulumu oldukça basittir. Öncelikle, game server tarafında gerekli SQL tabloları oluşturulur. Ardından, C++ kodlarına özel fonksiyonlar eklenerek verilerin istemciye gönderilmesi sağlanır. Son olarak, Python tarafında geliştirilen GUI dosyaları, client src içine yerleştirilir. Bu işlemler tamamlandıktan sonra, oyuncular profillerine erişebilir hale gelir.

Avantajlar

  • Oyuncuların karakter verilerine internet üzerinden erişebilmesi
  • PvP istatistiklerinin kolayca takip edilebilmesi
  • Sunucu yöneticileri için detaylı analiz araçları
  • Kullanıcı sadakatinin artırılması
  • Kodların özelleştirilebilir yapısı

Sonuç

NYS.X Metin2 Profil Sistemi, Metin2 özel sunucularında kaliteli bir deneyim sunmak isteyen geliştiriciler için güçlü ve esnek bir çözümdür. C++ ve Python tabanlı yapısı ile kolay entegrasyon ve genişletilebilirlik sunar. Metin2Lobby olarak, bu tür gelişmiş sistemlerin sunucularınız için ne kadar değerli olduğunu biliyoruz ve bu konuda destek sunmaya devam ediyoruz.


What is the Metin2 Profile System [C++ / Python]?

For developers who want to provide an advanced user experience on Metin2 private servers, the Profile System is a powerful feature that allows players to easily track their characters, scores, progress, and other statistical data. This system operates seamlessly with both C++ and Python, ensuring smooth functionality on both the server and client sides. At Metin2Lobby, we will discuss the NYS.X Metin2 Profile System in detail in this article.

System Features

Thanks to the profile system, players can view their character's PvP achievements, level progression, inventory contents, and more online. This feature helps players analyze their own development and makes the competitive environment more enjoyable. From the developer's perspective, the system significantly increases player loyalty, enhances interactions within the server, and enables detailed reporting on the database.

C++ and Python Integration

The system integrates the game server code written in C++ with the client interface developed in Python, ensuring secure and fast data transfer. As a result, character data stored on the server side is displayed in the client as a profile page. This structure works seamlessly with both Martysama themes and custom uiscript files.

Database Structure

The system is designed to work with relational databases like MySQL or MariaDB. Character names, levels, PvP scores, item lists, etc., are stored in separate tables. This ensures data integrity and improves performance. The Game Core and DB Core structures ensure these data are processed securely and efficiently.

Profile Interface with Python GUI

The profile pages are developed using Python GUI technology. Players can access statistics, inventory, PvP history, and more through character-specific interfaces. These interfaces can be easily integrated into the Metin2 client by embedding them into py root files.

Installation and Configuration

Installing the system is quite simple. First, the required SQL tables are created on the game server side. Then, special functions are added to the C++ code to send data to the client. Finally, the GUI files developed in Python are placed into the client src. After completing these steps, players can access their profiles.

Advantages

  • Players can access character data online
  • Easy tracking of PvP statistics
  • Detailed analysis tools for server administrators
  • Increased player loyalty
  • Customizable code structure

Conclusion

NYS.X Metin2 Profile System is a robust and flexible solution for developers wanting to deliver a high-quality experience on Metin2 private servers. With its C++ and Python-based architecture, it offers easy integration and scalability. At Metin2Lobby, we understand how valuable such advanced systems are for your servers, and we continue to offer support in this area.​
 

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

Benzer konular

Geri
Üst Alt