New class for drop/buy/sell dialog

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Hi Turkmmo

Illustrative video:




add new class in root/uiCommon.py

Kod:
class ItemQuestionDialog(ui.ScriptWindow):     def __init__(self):         ui.ScriptWindow.__init__(self)         self.__CreateDialog()                 self.tooltipItem = uiToolTip.ItemToolTip()         self.window_type = 0 # "inv" or "shop"         self.count = 0         self.height = 0 # 30 for buy & sell             def __del__(self):         ui.ScriptWindow.__del__(self)     def __CreateDialog(self):         pyScrLoader = ui.PythonScriptLoader()         pyScrLoader.LoadScriptFile(self, "uiscript/questiondialog.py")         self.board = self.GetChild("board")         self.textLine = self.GetChild("message")         self.acceptButton = self.GetChild("accept")         self.cancelButton = self.GetChild("cancel")         self.titleBar = ui.TitleBar()         self.titleBar.SetParent(self.board)         self.titleBar.MakeTitleBar(244, "yellow")         self.titleBar.SetPosition(8, 7)         self.titleBar.Show()         self.titleName = ui.TextLine()         self.titleName.SetParent(self.titleBar)         self.titleName.SetPosition(0, 4)         self.titleName.SetWindowHorizontalAlignCenter()         self.titleName.SetHorizontalAlignCenter()         self.titleName.Show()         self.slotList = []         for i in xrange(3):             slot = ui.ImageBox()             slot.LoadImage("d:/ymir work/ui/public/slot_base.sub")             slot.SetParent(self)             slot.SetWindowHorizontalAlignCenter()             self.slotList.append(slot)     def Open(self, vnum, slot, text=""):         item.SelectItem(vnum)         xSlotCount, ySlotCount = item.GetItemSize()         try:             if self.window_type == "inv":                 metinSlot = [player.GetItemMetinSocket(player.INVENTORY, slot, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]             elif self.window_type == "shop":                 metinSlot = [shop.GetItemMetinSocket(slot, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]         except:             pass         if vnum in (50300, 70037):             self.titleName.SetText("%s %s" % (skill.GetSkillName(metinSlot[0]), item.GetItemName()))         elif vnum == 70104:             self.titleName.SetText("%s %s" % (nonplayer.GetMonsterName(metinSlot[0]), item.GetItemName()))         else:             self.titleName.SetText(item.GetItemName())         if text:             textLine2 = ui.TextLine()             textLine2.SetPosition(0, 80 + 32*ySlotCount)             textLine2.SetWindowHorizontalAlignCenter()             textLine2.SetHorizontalAlignCenter()             textLine2.SetVerticalAlignCenter()             textLine2.SetParent(self.board)             textLine2.SetText(text)             textLine2.Show()             self.textLine2 = textLine2         slotGrid = ui.SlotWindow()         slotGrid.SetParent(self)         slotGrid.SetPosition(-16, 64)         slotGrid.SetWindowHorizontalAlignCenter()         slotGrid.AppendSlot(0, 0, 0, 32*xSlotCount, 32*ySlotCount)         slotGrid.AddFlag("not_pick")         slotGrid.Show()         self.slotGrid = slotGrid         if self.count > 1:             self.slotGrid.SetItemSlot(0, vnum, self.count)         else:             self.slotGrid.SetItemSlot(0, vnum)         if text:             self.height -= 10                         self.SetSize(260, 110 + 32*ySlotCount + self.height)         self.board.SetSize(260, 110 + 32*ySlotCount + self.height)         self.textLine.SetPosition(0, 44)         for i in xrange(min(3, ySlotCount)):             self.slotList[i].SetPosition(0, 32 + ySlotCount*32 - i*32)             self.slotList[i].OnMouseOverIn = lambda arg = slot: self.OverInItem(arg)             self.slotList[i].OnMouseOverOut = lambda arg = self.tooltipItem: self.OverOutItem(arg)             self.slotList[i].Show()         self.GetChild("accept").SetPosition(-40, 74 + 32*ySlotCount + self.height)         self.GetChild("cancel").SetPosition(40, 74 + 32*ySlotCount + self.height)         self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))                 self.SetCenterPosition()         self.SetTop()         self.Show()     def SetCloseEvent(self, event):         self.titleBar.SetCloseEvent(event)             def SetMessage(self, text):         self.textLine.SetText(text)     def OverInItem(self, slot):         if self.window_type == "shop":             self.tooltipItem.SetShopItem(slot)         elif self.window_type == "inv":             self.tooltipItem.SetInventoryItem(slot)             def OverOutItem(self, tooltipItem):         if 0 != tooltipItem:             self.tooltipItem.HideToolTip()             self.tooltipItem.ClearToolTip()         def Close(self):         self.ClearDictionary()         self.slotList = []         self.titleBar = None         self.titleName = None         self.textLine2 = None         self.slotGrid = None                 self.tooltipItem = 0         self.Hide()                 constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)             def SetWidth(self, width):         height = self.GetHeight()         self.SetSize(width, height)         self.board.SetSize(width, height)         self.SetCenterPosition()         self.UpdateRect()     def SAFE_SetAcceptEvent(self, event):         self.acceptButton.SAFE_SetEvent(event)     def SAFE_SetCancelEvent(self, event):         self.cancelButton.SAFE_SetEvent(event)     def SetAcceptEvent(self, event):         self.acceptButton.SetEvent(event)     def SetCancelEvent(self, event):         self.cancelButton.SetEvent(event)     def SetText(self, text):         self.textLine.SetText(text)     def SetAcceptText(self, text):         self.acceptButton.SetText(text)     def SetCancelText(self, text):         self.cancelButton.SetText(text)     def OnPressEscapeKey(self):         self.Close()         return True     # End

The topic is moved and I think one of the members will benefit from this class

I ask the brothers who have a problem and solve it by bringing the solution to everyone and I love the people what you love for yourself

Thank you,

Yeni Drop/Satın Alma/Satış Penceresi Sınıfı

Metin2 özel sunucu geliştirme süreçlerinde kullanıcı deneyimini artırmak adına birçok görsel ve işlevsel yenilik yapılabilir. Bu yazıda, drop, satın alma ve satış işlemleri için geliştirilen yeni bir sınıf yapısından bahsedeceğiz. Bu sınıf, hem C++ hem de Python tabanlı uiscript yapılarıyla entegre çalışarak daha stabil ve kullanıcı dostu bir arayüz sağlar.

Sınıfın Temel Özellikleri

Yeni sınıflandırılmış drop/buy/sell dialog penceresi, mevcut py root dosyalarında tanımlanan UI elemanlarını genişleterek kullanıcıya daha fazla kontrol sunar. Bu sınıf, Martysama ve benzeri Metin2 development kaynaklarına dayalı olarak tasarlanmıştır. Kullanıcılar artık itemleri daha kolay şekilde yönetebilir, drop edebilir ya da doğrudan alım-satım yapabilirler.

Python GUI Entegrasyonu

Bu sistem, Py GUI ile entegre çalışarak game server tarafında dinamik işlemler yapılmasını sağlar. Özellikle client src üzerinde yapılan düzenlemelerle, kullanıcı arayüzüne entegre edilen bu sınıf, hem auth hem de game sunucusu arasında güvenli veri alışverişini sağlar. Bu sayede pack ve db süreçleri daha verimli yönetilir.

C++ Kaynak Kod Entegrasyonu

C++ tabanlı server src dosyalarında yapılan değişikliklerle, bu sınıf doğrudan game core yapısıyla haberleşir. Böylece, kullanıcıların ekrana gelen dialog üzerinden gerçekleştirdiği her işlem, sunucu tarafında anlık olarak işlenir. Bu sayede hem güvenlik artırılır hem de Metin2 compile süreçleri optimize edilir.

Oyun içi PVP Sistemlerle Uyumlu Çalışma

Bu sınıf yapısı, Metin2 PvP sistemleriyle de tam uyumlu çalışacak şekilde tasarlanmıştır. Oyuncular, PvP sırasında elde ettikleri itemleri doğrudan bu dialog üzerinden yönetebilirler. Bu da oyun içi source edit ve core gelişmeleri için büyük bir esneklik sunar.

Sonuç

Yeni geliştirilen drop/buy/sell dialog sınıfı, Metin2 development sürecinde önemli bir adım teşkil eder. Hem Python hem de C++ tarafında yapılan entegrasyonlar sayesinde, kullanıcılar daha hızlı ve güvenli bir şekilde item yönetimini sağlayabilirler. Bu sınıf, channel tabanlı sunucularda da sorunsuz çalışmaktadır.


New Class for Drop/Buy/Sell Dialog

In the process of Metin2 private server development, many visual and functional improvements can be made to enhance user experience. In this article, we will discuss a newly developed class structure for drop, buy, and sell operations. This class works seamlessly with both C++ and Python-based uiscript structures to provide a more stable and user-friendly interface.

Key Features of the Class

The newly classified drop/buy/sell dialog window expands UI elements defined in existing py root files, offering users greater control. Designed based on sources like Martysama and other Metin2 development resources, this class allows users to manage, drop, or directly trade items more easily.

Python GUI Integration

This system integrates with Py GUI to allow dynamic operations on the game server. Modifications on client src enable integration into the UI, ensuring secure data exchange between the auth and game servers. This makes pack and db processes more efficient.

C++ Source Code Integration

Modifications in C++-based server src files allow this class to communicate directly with the game core structure. As a result, every action performed by the user through the dialog is processed instantly on the server side, increasing security and optimizing Metin2 compile processes.

Compatibility with In-Game PvP Systems

This class structure is designed to work fully compatible with Metin2 PvP systems. Players can manage items obtained during PvP directly from this dialog, providing great flexibility for in-game source edit and core developments.

Conclusion

The newly developed drop/buy/sell dialog class represents an important step in Metin2 development. Thanks to integrations on both Python and C++ sides, users can manage item transactions faster and more securely. This class also operates smoothly on channel-based servers.
 

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

Benzer konular

Geri
Üst Alt