Çöp Butonu Sistemi

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
234562_cfcf110f8a77decb98e8a2a272bbf13e.png


Ekteki klasörde bulunan trashbutton klasörünü, ETC packi içindeki ymir work/ui/ dizinine atarsanız, buton örnekte olduğu gibi gözükecektir.
Kod:
# BURAYI BUL:     "name" : "InventoryWindow",     ## 600 - (##dth + 오른쪽으로 부터 띄우기 24 px)     "x" : SCREEN_WIDTH - 176,     "y" : SCREEN_HEIGHT - 37 - 565,     "style" : ("movable", "float",),     "width" : 176,     "height" : 565,       # BU ŞEKİLDE DEĞİŞTİR:     "name" : "InventoryWindow",     ## 600 - (width + 오른쪽으로 부터 띄우기 24 px##    "x" : SCREEN_WIDTH - 176,     "y" : SCREEN_HEIGHT - 37 - 565 - 19,     "style" : ("movable", "float",),     "width" : 176,     "height" : 565 + 19,             ## DÜZENLEDİĞİMİZ BÖLÜMÜN HEMEN ALTINDAKİ, CHILDREN'LARI##İÇİNDE EN TEPEDE OLANI, BUNU BUL:     "children" :     (         ## Inventory, Equipment Slots         {             "name" : "board"##            "type" : "board",             "style" : ("attach",),             "x" : 0,             "y" : 0,             "width" : 176,             "height" : 565,           ## BU ŞEKİLDE DEĞİŞTİR:               "children" :     (         ## ##ventory, Equipment Slots         {             "name" : "board",     ##      "type" : "board",             "style" : ("attach",),             "x" : 0,             "y" : 0,             "width" : 176,             "height" : 565 + 19,           ## BU KISMI BUL:                           ## Item Slot                 { ##                  "name" : "ItemSlot",   ##                "type" : "grid_table",                     "x" : 8,                     "y" : 246,                     "start_index" : 0,                     "x_count" : 5,                     "y_count" : 9,                     "x_step" : 32,                     "y_step" : 32,                     "image" : "d:/ymir work/ui/public/Slot_Base.sub"                 }, ## EN SONDAKİ VİRGÜLDEN HEMEN SONRA BİR ALT SATIRA GEÇ VE BUNU YAPIŞTIR:  ##                       ## Trash Button                 {                     "name" : "TrashButton",   ##                "type" : "button",                     "x" : 8,                     "y" : 246 + 289,                     "default_image" : "d:/ymir work/ui/trashbutton/trashbutton_up.tga",                     "over_image" : "d:/ymir work/ui/trashbutton/trashbutton_hover.tga",                     "down_image" : "d:/ymir work/ui/trashbutton/trashbutton_down.tga",                 },

Kod:
//en son define'ın altına ekle: #define TRASHBUTTON

Kod:
// HEADER_CG_...#define bittiği yere, HEADER_GC'lere geçmeden bunu ekle: // örnek olarak, benimki şu satırın hemen altında: //     HEADER_CG_HANDSHAKE                         = 0xff, #ifdef TRASHBUTTON     HEADER_CG_DELETEFROMINV                        = 220, #endif // A#ifdefypedef struct command_on_click {     BYTE        header;     DWORD     [HASH=3]#endif[/HASH]; } TPacketCGOnClick; // ALTINA EKLE: #ifdef TRASHBUTTON typedef struct packet_delfrominv {     BYTE header;     DWORD position;#ifdefcketCGDelFromInv; #endif

Kod:
// ARAT:         bool Se#endiftConfirmPacket(BYTE byAnswer, DWORD dwPID); // ALTINA YAPIŞTIR: #ifdef TRASHBUTTON         // trash button         bool SendDeleteFromInvPacket(DWORD posit#ifdef#endif

Kod:
// BU FONKSİYONU #endifPyObject* netSendSelectItemPacket(PyObject* poSelf, PyObject* poArgs) {     /*...fonksiyon içeriği...*/ } // FONKSİYON BİTTİKTEN SONRA BİR ALT SATIRA GEÇ VE YAPIŞTIR: #ifdef TRASHBUTTON PyObject* netSendDeleteFromInventory(PyObject* poSelf, PyObject* poArgs) {     in#ifdefmPos;     if (!PyTuple_GetInteger(poArgs, 0, &iItemPos))         return Py_BuildException();     CPythonNetworkStream& rns = CPythonNetworkStream::Instance();     rns.SendDeleteFromInvPacket(iItemPos);     return Py_BuildNone(); } #endif // ARAT:         { "RegisterErrorLog",                        netRegisterErrorLog,          #endif        METH_VARARGS }, // ALTINA YAPIŞTIR: #ifdef TRASHBUTTON         { "SendDeleteFromInventory",                        netSendDeleteFromInven#ifdef                       METH_VARARGS }, #endif

Kod:
// BU FONKSİYONU BUL: bo#endifthonNetworkStream::SendQuestConfirmPacket(BYTE byAnswer, DWORD dwPID) {     /*..fonksiyon içeriği..*/ } // FONKSİYON BİTTİKTEN SONRA BİR ALT SATIRA GEÇ VE YAPIŞTIR: #ifdef TRASHBUTTON bool CPythonNetworkStream::SendDeleteFromInvPacket(DWORD position) {     TPacketCGDelFromIn#ifdefket;     kPacket.header = HEADER_CG_DELETEFROMINV;     kPacket.position = position;     if (!Send(sizeof(kPacket), &kPacket))     {         Tracen("SendDeleteFromInvPacket Error");         return false;     }     Tracef("SendDeleteFromInvPacket");     return SendSequence(); }#endif

Kod:
// en son define'ın altına ekle: #define TRASHBUTTON
Kod:
// CInputMain::Analyze(LPDESC d, BYTE bHeader,#definechar * c_pData) fonksiyonu // içinde, şunu bul:         case HEADER_CG_PONG:             Pong(d);             break; // ÜSTÜNE YAPIŞTIR: #ifdef TRASHBUTTON         case HEADER_CG_DELETEFROMINV:             if (ch)             {                 const TPac#ifdefelFromInv* p = reinterpret_cast<const TPacketCGDelFromInv*>(c_pData);                 TItemPos Cell(INVENTORY, p->position);                 LPITEM itemToDelete = ch->GetItem(Cell);                 if (itemToDelete != NULL)                 {                     if (Cell.IsEquipPosition())                     {                         ch->ChatPacket(CHAT_TYPE_INFO, "Hayir.");                         /*"Giyilen itemi silemezsin" uyarisi bu.*/                     }                     else                     {                         itemToDelete->RemoveFromCharacter();                     }                 }             }             break; #endif
Kod:
// yine HEADER_CG...'ların en sonuna, GC'lere geçmeden bir satır ekley[HASH=3]#endif[/HASH], // örnek olarak benimki şu satırın altında: //     HEADER_CG_CLIENT_VERSION2            = 0xf1, #ifdef TRASHBUTTON     HEADER_CG_DELETEFROMINV = 220, #endif // ARAT: typedef struct command_on_click {     BYTE    header;  [HASH=2]#ifdef[/HASH]RD    vid; } TPacketCGOnClick; // ALTINA YAPIŞT#endiffdef TRASHBUTTON typedef struct packet_delfrominv {     BYTE header;     DWORD position; } TPacketCGDelFromInv; #endif
title="game/src/packet_info.cpp:"]// ARAT:
Set(HEADER_CG_ON_CLICK, sizeof(TPacketCGOnClick), "OnClick",#endif;
// ALTINA YAPIŞTIR#ifdef TRASHBUTTON
Set(HEADER_CG_DELETEFROMINV, sizeof(TPacketCGDelFromInv), "DelFromInv", true);#endif
[/CODE]






Not:Sistemi test etmedim, alıntıdır paylaşıldıysa lütfen gereksiz yorumlardan kaçınarak raporlayınız.

Metin2 Lobby - Çöp Butonu Sistemi


Giriş
Metin2 özel sunucularında oyuncuların deneyimini zenginleştirmek ve daha akıcı bir oyun içi yaşam sağlamak adına birçok geliştirici, farklı sistemler geliştirmeye devam etmektedir. Bu sistemlerden birisi de Çöp Butonu Sistemi'dir. Bu sistem, oyuncuların sahip oldukları gereksiz eşyaları hızlıca atabilmeleri için tasarlanmıştır. Özellikle PVP odaklı sunucularda, çöp eşyalarla envanterin dolması büyük bir sorun teşkil edebilir. Bu durumda Çöp Butonu, kullanıcı dostu bir çözüm sunar.

Çöp Butonu Nedir?
Çöp butonu, oyuncunun elindeki gereksiz eşyaları belirli bir filtreleme işlemiyle otomatik olarak silen veya envanterden çıkaran bir sistemdir. Genellikle bir GUI üzerinden çalışır ve oyuncuların manuel olarak eşya silmesine gerek kalmaz. Bu sistem, Python GUI teknolojileri kullanılarak kolayca entegre edilebilir. PyRoot, UIScript gibi yapılar sayesinde butonlar ve menüler kolayca tasarlanabilir.

Sistem Nasıl Çalışır?
Bu sistem, genellikle bir arayüz üzerinden çalışır. Oyuncu bir butona bastığında, sistem belirlenen kurallara göre envanterdeki eşyaları tarar. Tararken eşyanın ismi, slot numarası, kalitesi gibi bilgiler kontrol edilir. Eğer eşya belirlenen kriterlere uyuyorsa, sistem bu eşyayı siler veya envanterden kaldırır. Bu işlem sırasında oyuncuya bir onay penceresi de gösterilebilir.

Çöp Butonu Sistemi İçin Gerekli Kod Yapısı
Bu sistem genellikle PyRoot üzerinden bir GUI ile entegre edilir. Oyuncu butona bastığında, bir Python scripti çalışır. Bu script, oyuncunun envanterini okur ve belirtilen kurallara göre eşyaları siler. Örneğin, sil_icerik = ['parça', 'taş', 'çöp'] gibi bir liste tanımlanabilir. Eğer envanterdeki eşya bu listede yer alıyorsa, sistem otomatik olarak silinir.

Avantajları Nelerdir?
- Oyuncuların envanterini temiz tutar.
- Zaman kazandırır.
- Oyun performansını artırır.
- Oyuncu memnuniyetini artırır.

Sistem Geliştirme ve Entegrasyonu
Bu sistem, Metin2 sunucularında C++ ve Python tabanlı geliştirme gerektirir. Oyun sunucusu tarafında C++ ile yazılmış olan oyun çekirdeği (core), eşya silme mekanizmasını desteklemelidir. Oyuncu tarafında ise PyGUI kullanılarak bir buton oluşturulur. Bu buton, PyRoot üzerinde tanımlanarak sunucuyla haberleşir.

Sonuç
Çöp butonu sistemi, Metin2 özel sunucularında kullanıcı deneyimini artırmak için oldukça etkili bir özelliktir. Oyuncuların envanterini temiz tutmalarına yardımcı olur ve oyun içinde daha verimli hareket etmelerini sağlar. Bu tür sistemlerin geliştirilmesi, Metin2 Development sürecinde büyük önem taşır. Metin2 Lobby olarak, bu tür sistemlerin detaylarını ve nasıl uygulanacağını paylaşmaya devam edeceğiz.


Metin2 Lobby - Trash Button System


Introduction
In order to enhance player experience and provide a more fluid in-game life, many developers continue to develop various systems for Metin2 private servers. One such system is the Trash Button System. This system allows players to quickly discard unnecessary items they have. Especially in PVP-focused servers, having inventory filled with junk items can become a major issue. In such cases, the Trash Button offers a user-friendly solution.

What is the Trash Button?
The trash button is a system that automatically deletes or removes unwanted items from the player's inventory based on a specific filtering process. It typically works through a GUI and eliminates the need for players to manually delete items. This system can easily be integrated using Python GUI technologies. Buttons and menus can be designed effortlessly with structures like PyRoot and UIScript.

How Does the System Work?
This system usually operates via an interface. When a player clicks a button, the system scans the inventory based on predefined rules. During scanning, information such as the item's name, slot number, and quality is checked. If the item meets the specified criteria, the system deletes or removes it from the inventory. An approval window may also be shown to the player during this process.

Required Code Structure for Trash Button System
This system is generally integrated via a GUI through PyRoot. When the player presses the button, a Python script runs. This script reads the player's inventory and deletes items according to specified rules. For example, a list like delete_content = ['piece', 'stone', 'trash'] can be defined. If an item in the inventory matches this list, the system automatically deletes it.

Advantages
- Keeps the player's inventory clean.
- Saves time.
- Improves game performance.
- Increases player satisfaction.

System Development and Integration
This system requires development based on both C++ and Python for Metin2 servers. The game core written in C++ on the server side must support the item deletion mechanism. On the player side, a button is created using PyGUI. This button is defined on PyRoot and communicates with the server.

Conclusion
The Trash Button System is an effective feature for enhancing user experience in Metin2 private servers. It helps players keep their inventories clean and enables more efficient gameplay. Developing such systems holds significant importance in the Metin2 Development process. At Metin2 Lobby, we will continue to share details about how such systems work and how to implement them.
 

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

Geri
Üst Alt