[C++] İtem Değiş-Tokuş

  • 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
Konu güncellenip sorunsuz hale getirilecektir.


Merhaba Arkadaşlar herkeze selamlar. Bence tüm fileslarda bulunması lazım olan bir sistem. envanterler dolduğu zaman düzeltmek için onu buraya al bunu buraya götür gibi uğraşan oyuncuların halini düşünmek lazım. direk konuya geçiyorum

Char.h aç
Kod:
bool            IsEmptyItemGrid(TItemPos Cell, BYTE size, int iExceptionCell = -1) const;
arat,
Kod:
bool            SwapItemToItem(TItemPos srcCell, TItemPos destCell);
altına ekle

Char_item.cpp aç
Kod:
if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell))        return false;
arat,
Kod:
if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell))      {        if (!SwapItemToItem(Cell, DestCell))          return false;        else          return true;      }
değiştir.

Kod:
bool CHARACTER::CanUnequipNow(const LPITEM item, const TItemPos& srcCell, const TItemPos& destCell) /*const*/
arat,

Kod:
bool CHARACTER::SwapItemToItem(TItemPos srcCell, TItemPos destCell) {     if (!CanHandleItem())         return false;     BYTE bCell = srcCell.cell;     BYTE bDestCell = destCell.cell;     BYTE pages_count = 4;     if (srcCell.IsDragonSoulEquipPosition() || destCell.IsDragonSoulEquipPosition())         return false;     if (bCell == bDestCell)         return false;     if (srcCell.IsEquipPosition() || destCell.IsEquipPosition())         return false;     if (srcCell.window_type != INVENTORY || destCell.window_type != INVENTORY || destCell.cell >= INVENTORY_MAX_NUM)         return false;     LPITEM item1, item2;     item1 = GetInventoryItem(bCell);     item2 = GetInventoryItem(bDestCell);     if (!item1 || !item2)         return false;       if (item1 == item2)     {         sys_log(0, "[WARNING][WARNING][HACK USER!] : %s %d %d", m_stName.c_str(), bCell, bDestCell);         return false;     }     if (item1->GetSize() == item2->GetSize())     {         BYTE bCell1 = item1->GetCell();         BYTE bCell2 = item2->GetCell();            item1->RemoveFromCharacter();         item2->RemoveFromCharacter();         item1->AddToCharacter(this, TItemPos(INVENTORY, bCell2));         item2->AddToCharacter(this, TItemPos(INVENTORY, bCell1));     }       if (item1->GetSize() > item2->GetSize())     {         BYTE bCell1 = item1->GetCell();         ChatPacket(CHAT_TYPE_INFO, "Slot %d", bDestCell);         BYTE pPageDest = bDestCell / (INVENTORY_MAX_NUM / pages_count);         BYTE pPageDest2 = (((item1->GetSize()-1) * 5) + bDestCell) / (INVENTORY_MAX_NUM / pages_count);         if (bDestCell >= INVENTORY_MAX_NUM)             return false;         if (pPageDest != pPageDest2)         {             for (int ii = 1; ii < 4; ++ii)             {                 pPageDest2 = (bDestCell + (5*(item1->GetSize()-1)) - (5 * ii)) / (INVENTORY_MAX_NUM / pages_count);                 if (pPageDest == pPageDest2)                 {                     bDestCell = bDestCell - (5 * ii);                     break;                 }             }         }         if (pPageDest != pPageDest2)             return false;         item1->RemoveFromCharacter();         for (int i = 0; i < item1->GetSize(); ++i)         {             BYTE bBusyCell = bDestCell + (5 * i);             BYTE lpage = bBusyCell / (INVENTORY_MAX_NUM / pages_count);             if (lpage != pPageDest)                 continue;             TItemPos busyCell(INVENTORY, bBusyCell);             LPITEM busy = GetItem(busyCell);             if (busy)             {                 busy->RemoveFromCharacter();                 busy->AddToCharacter(this, TItemPos(INVENTORY, bCell1 + (5 * i)));             }         }         item1->AddToCharacter(this, TItemPos(INVENTORY, bDestCell));     }     return true; }

en sona ekle.


KANIT EKLENMİŞTİR.

Yapamayan veya hata alan olursa konuya çağırsa yeterli.
Metin2 Özel Sunucularında [C++] ile İtem Değiş-Tokuş Sistemi

Metin2 özel sunucu geliştirme sürecinde, oyuncuların deneyimini artırmak ve oyun içi ekonomiyi düzenlemek adına çeşitli sistemler entegre edilir. Bunlardan biri de [C++] tabanlı İtem Değiş-Tokuş sistemidir. Bu yazıda, Metin2 özel sunucularda nasıl bir değiş-tokuş sistemi geliştirilebileceği ve bu sistemin avantajları ele alınacaktır.

Değiş-Tokuş Sistemi Nedir?

Oyunlarda değiş-tokuş sistemi, oyuncuların sahip oldukları belirli itemleri başka itemlerle değiştirme veya takas etme imkanı sunar. Bu sistem, genellikle özel sunucularda premium veya rare itemlerin oyunculara dağıtılması için kullanılır. C++ dili kullanılarak geliştirilen sistemlerde bu işlem doğrudan sunucu tarafında kontrol edilir, dolayısıyla daha güvenlidir.

C++ ile Nasıl Uygulanır?

Metin2 özel sunucularında game core kısmında geliştirilen bu sistem, genellikle Python GUI ile entegre edilen arayüzlerle birlikte çalışır. C++ dilinde yazılmış olan ana sistem, oyuncudan gelen talepleri doğrular, itemleri kontrol eder ve takas işlemi gerçekleştirilir. Örneğin bir oyuncu 5 adet Gümüş Madeni itemini 1 adet Premium Zırh ile değiştirmek isteyebilir. Bu durumda sistem önce envanterde yeterli itemin olup olmadığını kontrol eder, ardından takas işlemini gerçekleştirir.

Sistem Kod Yapısı[/CENTER]

Sistem genellikle client src ve server src arasında haberleşerek çalışır. Client tarafında bir buton ile başlatılan işlem, auth ve game sunucusu arasında koordineli olarak işlenir. C++ source code içerisinde tanımlanan fonksiyonlar sayesinde, her takas işlemi loglanır ve güvenlik açısından kontrol edilir.

Avantajları Nelerdir?

• Oyuncu sadakati artırılır.
• Oyun içi ekonomi daha dengeli hale gelir.
• Sunucuya özel içeriklerle oyuncular motive edilir.
• Takas kuralları dinamik olarak değiştirilebilir.

Sonuç

Metin2 lobby gibi platformlarda paylaşılan sistemler sayesinde geliştiriciler, kendi özel sunucularında benzer yapılar kurabilir. MartySama ve diğer geliştiricilerin katkılarıyla ortaya çıkan C++ tabanlı sistemler, hem performans hem de güvenlik açısından idealdir. DB Core ile entegre çalışan bu yapılar, sunucu yöneticilerine büyük esneklik sunar.


Item Exchange System with [C++] on Metin2 Private Servers

Metin2 private server development involves implementing various systems to enhance player experience and regulate in-game economy. One such system is the Item Exchange system based on [C++]. This article will explore how to develop an exchange system for Metin2 private servers and its benefits.

What is an Exchange System?

An exchange system in games allows players to trade specific items for others. It's commonly used on private servers to distribute premium or rare items to players. Systems developed with C++ are processed directly on the server side, making them more secure.

How is it Implemented with C++?

On Metin2 private servers, this system usually works together with interfaces created with Python GUI and runs within the game core. The C++ code verifies requests from players, checks inventory, and executes exchanges. For example, a player may wish to trade 5 Silver Coins for 1 Premium Armor. In that case, the system first checks whether sufficient items exist in the inventory, then processes the exchange.

System Code Structure

The system typically operates through communication between client src and server src. The process initiated by a button on the client side is handled coordinately between the auth and game servers. Functions defined in C++ source code allow every exchange action to be logged and verified for security purposes.

What Are Its Advantages?

• Increases player loyalty.
• Balances in-game economy.
• Motivates players with server-specific content.
• Exchange rules can be modified dynamically.

Conclusion

Thanks to systems shared on platforms like Metin2 lobby, developers can implement similar structures on their own private servers. C++-based systems created with contributions from MartySama and other developers offer ideal performance and security. These structures integrated with DB Core provide great flexibility to server administrators.
 

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

Benzer konular

Geri
Üst Alt