40K Envanter Görüntüleme Sistemi(Kostüm,Kemer Dahil)[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 32

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Game/packet.h Açılır-Aratılır:
Kod:
typedef struct pakcet_view_equip
Kod bloğu değişilir;
Kod:
typedef struct pakcet_view_equip {     BYTE    header;     DWORD    vid;     struct     {         DWORD    vnum;         BYTE    count;         long    alSockets[ITEM_SOCKET_MAX_NUM];         TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];     } equips[19]; } TPacketViewEquip;
Char.cpp aratılır:[/LEFT]
Kod:
void CHARACTER::SendEquipment(LPCHARACTER ch)
Kod bloğu değiştirilir;
Kod:
void CHARACTER::SendEquipment(LPCHARACTER ch){ TPacketViewEquip p;     p.header = HEADER_GC_VIEW_EQUIP;     p.vid    = GetVID();     int pos[19] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 20, 21, 22, 23, 24, 25, 26 };     for (int i = 0; i < 19; i++)     {         LPITEM item = GetWear(pos[i]);         if (item)         {             p.equips[i].vnum = item->GetVnum();             p.equips[i].count = item->GetCount();             thecore_memcpy(p.equips[i].alSockets, item->GetSockets(), sizeof(p.equips[i].alSockets));             thecore_memcpy(p.equips[i].aAttr, item->GetAttributes(), sizeof(p.equips[i].aAttr));         }         else         {             p.equips[i].vnum = 0;         }     }     ch->GetDesc()->Packet(&p, sizeof(p)); }

Gamesrc bitti

Clientsrc/Userınterface/packet.h aratılır:
Kod:
typedef struct pakcet_view_equip
Kod bloğu değiştirilir;
Kod:
typedef struct pakcet_view_equip {     BYTE    header;     DWORD    dwVID;     TEquipmentItemSet equips[19]; } TPacketGCViewEquip;

UserInterfacePythonNetworkStreamPhaseGame.cpp aratın:
Kod:
bool CPythonNetworkStream::RecvViewEquipPacket()
Değiştirin;
Kod:
bool CPythonNetworkStream::RecvViewEquipPacket() {     TPacketGCViewEquip kViewEquipPacket;     if (!Recv(sizeof(kViewEquipPacket), &kViewEquipPacket))         return false;     PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OpenEquipmentDialog", Py_BuildValue("(i)", kViewEquipPacket.dwVID));     for (int i = 0; i < 19; ++i)     {         TEquipmentItemSet & rItemSet = kViewEquipPacket.equips[i];         PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetEquipmentDialogItem", Py_BuildValue("(iiii)", kViewEquipPacket.dwVID, i, rItemSet.vnum, rItemSet.count));         for (int j = 0; j < ITEM_SOCKET_SLOT_MAX_NUM; ++j)             PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetEquipmentDialogSocket", Py_BuildValue("(iiii)", kViewEquipPacket.dwVID, i, j, rItemSet.alSockets[j]));         for (int k = 0; k < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++k)             PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetEquipmentDialogAttr", Py_BuildValue("(iiiii)", kViewEquipPacket.dwVID, i, k, rItemSet.aAttr[k].bType, rItemSet.aAttr[k].sValue));     }     return true; }
Clientsrcde bitti
root/uitarget.py aratın:
Kod:
self.buttonDict[localeInfo.TARGET_BUTTON_EXIT_OBSERVER].SAFE_SetEvent(self.__OnExitObserver)
Altına ekle:
Kod:
self.buttonDict[localeInfo.TARGET_BUTTON_VIEW_EQUIPMENT].SAFE_SetEvent(self.__OnViewEquipment)
uitargetin ilk başındaki:
Kod:
BUTTON_NAME_LIST = (
Aralarına ekleyin;
Kod:
localeInfo.TARGET_BUTTON_VIEW_EQUIPMENT,
Aratın:
Kod:
def __OnExitObserver(self):        net.SendChatPacket("/observer_exit")
Altına ekleyin;
Kod:
def __OnViewEquipment(self):         net.SendChatPacket("/view_equip " + str(self.vid))
Aratın:
Kod:
def ShowDefaultButton(self):
Kod:
def ShowDefaultButton(self):         self.isShowButton = TRUE         self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_WHISPER])         self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_EXCHANGE])         self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_FIGHT])         self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_VIEW_EQUIPMENT])   self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_EMOTION_ALLOW])         for button in self.showingButtonList:             button.Show()
Bir bug var onuda fixliyelim sürekli açabiliyorsunuz;
root/interfacemodule.py aratın:
Kod:
def OpenEquipmentDialog(self, vid):
Değiştirin;
Kod:
def OpenEquipmentDialog(self, vid):             if self.equipmentDialogDict.has_key(vid):                 self.equipmentDialogDict[vid].Destroy()                 self.CloseEquipmentDialog(vid)             dlg = uiEquipmentDialog.EquipmentDialog()             dlg.SetItemToolTip(self.tooltipItem)             dlg.SetCloseEvent(ui.__mem_func__(self.CloseEquipmentDialog))             dlg.Open(vid)             self.equipmentDialogDict[vid] = dlg
Son olarak verdiğim dosyaları gerekli yerlere atın
Kanıt:
x0ME54e.jpg

2151372f52.jpg



Indexe ekleyin
Kod:
*ekipman*

Metin2 Özel Sunucu Geliştirme Serisi: 40K Envanter Görüntüleme Sistemi
Metin2 özel sunucularında geliştirme yaparken, oyuncuların karakterlerinin kostüm ve kemer gibi ekipmanlarını görüntülemesi büyük önem taşır. Özellikle yüksek seviye sunucularda, bu sistemler hem estetik hem de fonksiyonel olarak büyük rol oynar. Bu yazıda, 40K Envanter Görüntüleme Sistemini C++ ve Python dilleri kullanarak nasıl entegre edebileceğimizi detaylıca ele alacağız.

Sistem Nedir ve Ne İşe Yarar?
40K Envanter Görüntüleme Sistemi, oyuncuların envanterinde bulunan eşyaların sadece adını değil, aynı zamanda kostüm ve kuşanılmış kemeri de diğer oyuncular tarafından görülebilir hale getirir. Bu sayede PvP savaşları daha estetik ve görsel olarak zenginleşir. Sistem, hem game server tarafında C++ ile hem de client tarafında Python ile geliştirilerek tam entegrasyon sağlanır.

Geliştirme Ortamı ve Gereksinimler
Bu sistem için aşağıdaki bileşenlere ihtiyacınız olacaktır:
- Metin2 Game Server SRC (C++)
- Metin2 Client SRC (Python / UIScript)
- Python GUI (Py Root)
- Database (DB Core)
- Martysama veya benzeri bir geliştirici ortamı
Sistem, genellikle özel sunucularda (private server) tercih edilir çünkü bu tür sunucularda sınırsız özelleştirme imkanı vardır.

C++ Tarafında Geliştirme[/CONDITION]
C++ tarafında geliştirme yaparken, öncelikle envanter verilerinin aktarılması için bir paket yapısı tanımlamalısınız. Bu yapı, kostüm ve kemer verilerini içermelidir. Paketin gönderilmesi için packet.h dosyasında gerekli tanımlamalar yapılmalıdır. Ayrıca, oyuncu giriş yaptığında ve envanter değiştiğinde bu verilerin güncellenmesi için gerekli fonksiyonlar yazılmalıdır. Örnek olarak:
Kod:
struct packet_item_data{[BR][/BR]DWORD vnum;[BR][/BR]BYTE count;[BR][/BR]long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];[BR][/BR]bool is_costume;[BR][/BR]bool is_belt;[BR][/BR]};

Python Tarafında Entegrasyon
Python tarafında ise uiscript kullanarak GUI üzerinde kostüm ve kemer verilerini göstermek için bir arayüz tasarlanır. py root üzerinden bu veriler alınır ve kullanıcıya uygun şekilde gösterilir. Burada dikkat edilmesi gereken en önemli konu, verilerin doğru şekilde parse edilmesidir. Costume ve belt item slotları, normal envanterden farklı olarak özel olarak işlenmelidir. Ayrıca, bu verilerin PvP anında da güncellenmesi sağlanmalıdır.

Sistem Nasıl Çalışır?
Oyuncu bir kostüm ya da kemer kuşandığında, sistem bu eşyayı otomatik olarak diğer oyunculara gösterir. Bu işlem sırasında hem veri tabanı (db) hem de auth server ile senkronizasyon sağlanır. Bu sayede sunucu çapında tutarlı bir veri paylaşımı oluşur. Oyuncu PvP yaparken, rakibin kuşandığı kostüm ve kemer gibi ekipmanlar gerçek zamanlı olarak gözlemlenebilir.

Avantajları Nelerdir?
- Oyuncuların karakterlerini özelleştirmesi için estetik bir yol sağlar.
- PvP deneyimini artırır.
- Sunucu kalitesini ve oynanış derinliğini yükseltir.

Sonuç
40K Envanter Görüntüleme Sistemi, Metin2 özel sunucularında hem teknik hem de estetik açıdan ciddi bir fark yaratır. C++ ve Python tabanlı bu sistem, doğru kurulduğunda sunucunuzun kalitesini ve oyuncu memnuniyetini artırmaktadır. Geliştiriciler için önemli bir araçtır ve Metin2 Lobby olarak bu tarz sistemleri destekleyerek topluluğa katkı sağlamaya devam ediyoruz.


Metin2 Private Server Development Series: 40K Inventory Viewing System (Including Costume and Belt)
When developing Metin2 private servers, allowing players to display their equipped costumes and belts to others is of great importance. Especially on high-level servers, these systems play both aesthetic and functional roles. In this article, we will examine in detail how to integrate the 40K Inventory Viewing System using C++ and Python languages.

What Is This System and What Does It Do?
The 40K Inventory Viewing System allows other players to see not only the names of items in a player’s inventory but also their equipped costume and belt. This enhances the visual appeal and richness of PvP battles. The system is developed with C++ on the game server side and Python on the client side, ensuring full integration.

Development Environment and Requirements
You will need the following components for this system:
- Metin2 Game Server SRC (C++)
- Metin2 Client SRC (Python / UIScript)
- Python GUI (Py Root)
- Database (DB Core)
- A developer environment such as Martysama
This system is typically used in private servers (private server), where unlimited customization is possible.

Development on the C++ Side
In C++, you must first define a packet structure to transfer inventory data, including costume and belt information. These packets must be defined in the packet.h file. Additionally, functions should be written to update this data when a player logs in or changes their inventory. For example:
Kod:
struct packet_item_data{[BR][/BR]DWORD vnum;[BR][/BR]BYTE count;[BR][/BR]long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];[BR][/BR]bool is_costume;[BR][/BR]bool is_belt;[BR][/BR]};

Integration on the Python Side
On the Python side, a UI is designed using uiscript to display costume and belt data. Via py root, this data is retrieved and displayed appropriately. The most important thing here is to correctly parse the data. Costume and belt slots must be handled separately from the regular inventory. Moreover, this data must be updated in real-time during PvP matches.

How Does the System Work?
When a player equips a costume or belt, the system automatically shows that item to other players. During this process, synchronization occurs between the database (db) and the auth server. This ensures consistent data sharing across the entire server. While engaging in PvP, a player can observe the costumes and belts worn by opponents in real-time.

What Are Its Advantages?
- Provides an aesthetic way for players to customize their characters.
- Enhances the PvP experience.
- Improves server quality and gameplay depth.

Conclusion
The 40K Inventory Viewing System creates a significant difference both technically and aesthetically in Metin2 private servers. When properly implemented, this C++ and Python-based system increases your server's quality and player satisfaction. It serves as an essential tool for developers, and at Metin2 Lobby, we continue to support such systems to contribute to the community.
 

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

Benzer konular

Geri
Üst Alt