Buy with ITEM on SHOP like Rubinum

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
<blockquote data-attributes="member: 296675" data-quote="Leons1997" data-source="post: 20416921" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch">
Kod:
#define ENABLE_BUY_WITH_ITEM

Kod:
// Ara: typedef struct SShopItemTable // İçine ekle: #ifdef ENABLE_BUY_WITH_ITEM     DWORD        witemVnum; #endif

Kod:
// Ara: SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY // Altına ekle: #ifdef ENABLE_BUY_WITH_ITEM     SHOP_SUBHEADER_GC_NOT_ENOUGH_ITEM, #endif // Ara: struct packet_shop_item // İçine ekle: #ifdef ENABLE_BUY_WITH_ITEM     DWORD        witemVnum; #endif
Kod:
// void CShop::SetShopItems(TShopItemTable * pTable, BYTE bItemCount) Fonksiyonun içinde ara: item.price = pTable-&gt;price;              // yada item.count = pTable-&gt;count;           //  hangisi varsa // Altına ekle: #ifdef ENABLE_BUY_WITH_ITEM             item.witemVnum = pTable-&gt;witemVnum; #endif // int CShop::Buy( fonksiyonunun içinde ara: DWORD dwPrice = r_item.price;            // Altına ekle: #ifdef ENABLE_BUY_WITH_ITEM     DWORD dwWItemVnum = r_item.witemVnum; #endif // Arat:     if (ch-&gt;GetGold() &lt; (int) dwPrice)     {         sys_log(1, "Shop::Buy : Not enough money : %s has %d, price %d", ch-&gt;GetName(), ch-&gt;GetGold(), dwPrice);         return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;     } // Değiştir: #ifdef ENABLE_BUY_WITH_ITEM     if (dwWItemVnum &gt; 0)             if (ch-&gt;CountSpecifyItem(dwWItemVnum) &lt; (int)dwPrice)                 return SHOP_SUBHEADER_GC_NOT_ENOUGH_ITEM;     else if (ch-&gt;GetGold() &lt; (int) dwPrice) #else     if (ch-&gt;GetGold() &lt; (int) dwPrice) #endif // Arat:     ch-&gt;PointChange(POINT_GOLD, -dwPrice, false); // Değiştir: #ifdef ENABLE_BUY_WITH_ITEM         if (dwWItemVnum &gt; 0)             ch-&gt;RemoveSpecifyItem(dwWItemVnum, dwPrice);         else             ch-&gt;PointChange(POINT_GOLD, -dwPrice, false); #else     ch-&gt;PointChange(POINT_GOLD, -dwPrice, false); #endif // Arat:         pack2.items[i].price = item.price; // Altına ekle: #ifdef ENABLE_BUY_WITH_ITEM         pack2.items[i].witemVnum = item.witemVnum; #endif // Arat:         else if (!m_pkPC &amp;&amp; !IsPCShop()) // İçine ekle: #ifdef ENABLE_BUY_WITH_ITEM             pack2.item.witemVnum = m_itemVector[pos].witemVnum; #endif

Kod:
// Arat:             shop_item() // Üstüne ekle: #ifdef ENABLE_BUY_WITH_ITEM             DWORD    witemVnum; #endif // Arat:                 pkItem = NULL; // Üstüne ekle: #ifdef ENABLE_BUY_WITH_ITEM                 witemVnum = 0; #endif
Kod:
// Arat:         "shop_item.count " // Altına ekle: #ifdef ENABLE_BUY_WITH_ITEM         ",shop_item.witemVnum " #endif // Arat:         str_to_number(pItem-&gt;count, data[col++]); // Altına ekle: #ifdef ENABLE_BUY_WITH_ITEM         str_to_number(pItem-&gt;witemVnum, data[col++]); #endif

Client Source:

Kod:
#define ENABLE_BUY_WITH_ITEM

Kod:
// Arat: typedef struct packet_shop_item // İçine ekle: #ifdef ENABLE_BUY_WITH_ITEM     DWORD        witemVnum; #endif

Kod:
#ifdef ENABLE_BUY_WITH_ITEM     PyModule_AddIntConstant(poModule, "ENABLE_BUY_WITH_ITEM", 1); #else     PyModule_AddIntConstant(poModule, "ENABLE_BUY_WITH_ITEM", 0); #endif

Kod:
// Arat:         case SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY:             PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnShopError", Py_BuildValue("(s)", "NOT_ENOUGH_MONEY"));             break; // Altına ekle: #ifdef ENABLE_BUY_WITH_ITEM         case SHOP_SUBHEADER_GC_NOT_ENOUGH_ITEM:             PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnShopError", Py_BuildValue("(s)", "NOT_ENOUGH_ITEM"));             break; #endif

Kod:
// Arat: PyObject * shopGetItemMetinSocket(PyObject * poSelf, PyObject * poArgs) // Altına ekle: #ifdef ENABLE_BUY_WITH_ITEM PyObject * shopGetBuyWithItem(PyObject * poSelf, PyObject * poArgs) {     int nPos;     if (!PyTuple_GetInteger(poArgs, 0, &amp;nPos))         return Py_BuildException();     const TShopItemData * c_pItemData;     if (CPythonShop::Instance().GetItemData(nPos, &amp;c_pItemData))         return Py_BuildValue("i", c_pItemData-&gt;witemVnum);     return Py_BuildValue("i", 0); } #endif // Arat:         { "GetItemMetinSocket",            shopGetItemMetinSocket,            METH_VARARGS }, // Altına ekle: #ifdef ENABLE_BUY_WITH_ITEM         { "GetBuyWithItem",                shopGetBuyWithItem,                METH_VARARGS }, #endif

Kod:
// Arat: typedef struct SShopItemTable // İçine ekle: #ifdef ENABLE_BUY_WITH_ITEM     DWORD        witemVnum; #endif // Arat:     SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY, // Altına ekle: #ifdef ENABLE_BUY_WITH_ITEM     SHOP_SUBHEADER_GC_NOT_ENOUGH_ITEM, #endif

Python:
Kod:
# Arat: SHOP_ERROR_DICT = { # Altına veya üstüne ekle: if app.ENABLE_BUY_WITH_ITEM:     SHOP_ERROR_DICT.update({         "NOT_ENOUGH_ITEM" : SHOP_NOT_ENOUGH_ITEM,         }     ) # Arat: def NumberToMoneyString(n): # Altına ekle:     if app.ENABLE_BUY_WITH_ITEM:         def NumberToWithItemString(n,c) :             if n &lt;= 0 :                 return "0 %s" % (c)             return "%s adet | %s" % ('.'.join([ i-3&lt;0 and str(n)[:i] or str(n)[i-3:i] for i in range(len(str(n))%3, len(str(n))+1, 3) if i ]), c)

Kod:
# def AskBuyItem(self, slotPos): fonksiyonu içinde ara: itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice))) # Değiştir:         if app.ENABLE_BUY_WITH_ITEM:             buyItemVnum = shop.GetBuyWithItem(slotPos)             if buyItemVnum != 0:                 item.SelectItem(buyItemVnum)                 istenenItemAd = item.GetItemName()                 itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToWithItemString(itemPrice, istenenItemAd)))             else:                 itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice)))         else:             itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice)))

Kod:
# def SetShopItem veya shopEx kullananlar için SetShopExItem fonksiyonu içinde ara:         else:             self.AppendPrice(price) # Değiştir:         elif app.ENABLE_BUY_WITH_ITEM:             buyItemVnum = shop.GetBuyWithItem(slotIndex)             if buyItemVnum != 0:                 item.SelectItem(buyItemVnum)                 istenenItemAd = item.GetItemName()                 istenenItemVnum = item.GetVnum()                 self.AppendPrice_WithItem(price, istenenItemVnum, istenenItemAd)             else:                 self.AppendPrice(price)         else:             self.AppendPrice(price) # Müsait bir yere ekle:     if app.ENABLE_BUY_WITH_ITEM:         def AppendTextLine_WithItem(self, text, image, color = FONT_COLOR):             ayraC = text.split("|")             resimdenOnce, resimdenSonra = (ayraC[0], ayraC[1])             textLine = ui.TextLine()             textLine.SetParent(self)             textLine.SetFontName(self.defFontName)             textLine.SetPackedFontColor(color)             textLine.SetText(resimdenOnce)             textLine.SetOutline()             textLine.SetFeather(FALSE)             itemIcon = ui.ImageBox()             itemIcon.SetParent(self)             itemIcon.LoadImage(image)             textLine2 = ui.TextLine()             textLine2.SetParent(self)             textLine2.SetFontName(self.defFontName)             textLine2.SetPackedFontColor(color)             textLine2.SetText(resimdenSonra)             textLine2.SetOutline()             textLine2.SetFeather(FALSE)             textLine.Show()             itemIcon.Show()             textLine2.Show()             baslangicX_a = self.GetWidth() / 2 - 75             baslangicX_b = textLine.GetTextSize()[0]             baslangicX_c = itemIcon.GetWidth()             textLine.SetPosition(baslangicX_a, self.toolTipHeight+6)             itemIcon.SetPosition(baslangicX_a + baslangicX_b, self.toolTipHeight)             textLine2.SetPosition(baslangicX_a + baslangicX_b + baslangicX_c, self.toolTipHeight+6)             self.childrenList.append(textLine)             self.childrenList.append(itemIcon)             self.childrenList.append(textLine2)             self.toolTipHeight += itemIcon.GetHeight()             self.ResizeToolTip()             return textLine             return itemIcon             return textLine2 if app.ENABLE_BUY_WITH_ITEM:         def AppendPrice_WithItem(self, price, itemVnum, itemName):             self.AppendSpace(5)             self.AppendTextLine("[Nesne ile satın alınabilir]" , self.SHOP_ITEM_COLOR)             item.SelectItem(itemVnum)             eklenecekIcon = item.GetIconImageFileName()             self.AppendTextLine_WithItem((localeInfo.NumberToWithItemString(price, itemName)), eklenecekIcon, self.GetPriceColor(price))
Kod:
SHOP_NOT_ENOUGH_ITEM Yeterli Nesne'ye sahip değilsin.

Metin2 Lobby platformu olarak, Metin2 özel sunucu geliştiricileri için en kaliteli araçları ve sistemleri sunmaya devam ediyoruz. Bu yazıda, Rubinum gibi öne çıkan bir sistem olan 'Buy with ITEM on SHOP' yapısını inceleyeceğiz. Bu sistem, sunucularınızda ödül altyapısı oluşturmak isteyen geliştiriciler için kritik öneme sahiptir.

Bu yapı sayesinde oyuncular, belirli bir eşyayı veya itemi kullanarak sanal mağazadan başka eşyalar satın alabilirler. Bu işlem genellikle C++ tabanlı sunucu tarafında tanımlanır ve Python GUI ile entegre edilerek kullanıcı dostu bir arayüz sunulur. Metin2 lobby kullanıcıları olarak, bu tür gelişmiş sistemleri daha kolay ve güvenilir bir şekilde kurabilmeniz için gerekli tüm kaynak kodlarını sağlıyoruz.

Sistem Nasıl Çalışır?
Buy with ITEM sistemi, oyuncuların sahip oldukları belirli bir eşya ile, önceden tanımlanmış bir mağaza menüsünden ürün satın almasına olanak tanır. Bu sistem genellikle game core tarafında tanımlanır ve DB Core üzerinden veritabanına yazılır. Oyuncu, belirtilen eşyayı sahip olduğu anda, mağaza menüsüne erişebilir ve eşya satın alabilir. Bu esneklik, hem PvP sistemlerde hem de Metin2 server src geliştirme süreçlerinde büyük avantaj sağlar.

Kurulum ve Entegrasyon
Rubinum tarzı sistemlerde, bu altyapının kurulumu oldukça basittir. Ancak doğru entegrasyon için Martysama veya benzeri bir py root yapısının bilinmesi gerekir. Py GUI ile hazırlanan arayüzler, bu sistemi daha kullanıcı dostu hale getirir. UIScript dosyaları ile birlikte, mağaza arayüzü tamamen özelleştirilebilir. Metin2Dev topluluğu olarak, bu tür modüllerin kurulumuna dair eksiksiz dokümantasyonları da sizlere sunuyoruz.

Neden Bu Sistemi Kullanmalısınız?
Metin2 özel sunucularında para akışı ve eşya döngüsü yönetimi çok önemlidir. Buy with ITEM yapısı, bu döngüyü kontrol etmenizi ve oyuncuların sunucuya olan bağlılığını artırmak için kullanabileceğiniz güçlü bir özelliktir. Özellikle PvP sistemleri üzerinde çalışan sunucularda, oyuncuların kazandıkları eşyaları farklı ürünlerle takas etmeleri, oyun içi ekonomiyi dengeler. Bu sayede Metin2 compile ve source edit süreçlerinde daha verimli ve kararlı sistemler inşa edebilirsiniz.

Sonuç
Metin2 Lobby olarak, Metin2 private server geliştirme sürecinde ihtiyaç duyduğunuz tüm sistemleri eksiksiz ve detaylı şekilde sağlıyoruz. Buy with ITEM on SHOP sistemi, bu altyapılardan yalnızca biridir. Game, auth ve client src gibi diğer tüm yapılarla uyumlu çalışarak, geliştiricilere kolayca özelleştirilebilir ve güçlü çözümler sunar. Bu sistemleri doğru kullanmak, Metin2 development sürecinde büyük fark yaratır.


Metin2 Lobby as a platform, we continue to provide the highest quality tools and systems for Metin2 private server developers. In this article, we will examine the structure known as 'Buy with ITEM on SHOP', which stands out like Rubinum. This system is critical for developers looking to create reward infrastructure on their servers.

With this structure, players can use certain items to purchase other items from a virtual shop. This process is typically defined on the C++-based server side and integrated with Python GUI to provide a user-friendly interface. As Metin2 lobby users, we provide all necessary source codes to allow you to install such advanced systems more easily and reliably.

How Does the System Work?
The Buy with ITEM system allows players to access a predefined store menu and purchase items if they possess a specific item. This system is generally defined within the game core and written into the database via DB Core. When the player possesses the specified item, they can access the store menu and buy products. This flexibility provides significant advantages both in PvP systems and during Metin2 server src development processes.

Installation and Integration
In systems similar to Rubinum, installing this infrastructure is quite simple. However, proper integration requires knowledge of structures like Martysama or similar py root. Interfaces prepared with Py GUI make this system more user-friendly. Together with UIScript files, the store interface can be fully customized. As the Metin2Dev community, we also provide complete documentation regarding the installation of such modules.

Why Should You Use This System?
Managing currency flow and item circulation is very important in Metin2 private servers. The Buy with ITEM structure helps you control this cycle and serves as a powerful feature to increase player retention on your server. Especially in servers operating PvP systems, allowing players to trade earned items for different products balances the in-game economy. This way, you can build more efficient and robust systems during Metin2 compile and source edit processes.

Conclusion
As Metin2 Lobby, we provide all systems required during Metin2 private server development completely and in detail. The Buy with ITEM on SHOP system is just one of these infrastructures. Working seamlessly with all other structures like game, auth, and client src, it offers easily customizable and powerful solutions to developers. Properly utilizing these systems makes a big difference in Metin2 development processes.​
 

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

Geri
Üst Alt