TKMT2 tarzı pazar stok 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 69

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
şu an eski qf ile çalışan uzaktan market sistemini ve çoklu npc questini inceliyorum ek olarak şu highlight effect ile refresh time'ı tooltipte nasıl gösteririm ona bakıyorum kafa kalmadı ama şimdi ki halini paylaşayım belki bu konunun altından önceki konularda olduğu gibi katkı sağlanırsa gereken ilerleme sağlanır belki de sağlanmaz neyse ben yine de paylaşayım sağlık olsun :)

Kod:
if hasattr(item, "refreshTimeLeft"):         seconds = item.refreshTimeLeft         minutes = seconds         if minutes > 0:             slot.SetDiffuseColor(0.7, 0.7, 0.7, 1.0)             self.AppendTextLine("|cffff9999Yeni Stok: %d dakika|r" % minutes)         else:             self.AppendTextLine("|cffff0000Bu eşya şu anda yenileniyor...|r")

kısaca sen ne yaptın kardeşim böyle yazmış etmişsin iyi güzelde diyenlere

250760_9d0f8909dc0f1b02c6d1fae8dfaab27e.png


stok ile şu kadar zamanda yenilenme şeysi işte. bunu artık gui de tooltipde göstermek lazimdur.

yukarıda incelemeniz gereken şeyleri belirtmiş oldum sayılır çoklu npc ve qf ile dönen uzaktan market sistemi belki yolunu bulur uyarlayıp onu da paylaşırım sonuçta kendimi düşünen birisi olmadım hiç hep tek isteğim vardı o da forum kazansın yani elin gavurunun forumunda gavurun teki sürekli bir şeyler kazanacağına :D

anlatıma geçelim

tables.h aç ve arat

typedef struct SShopItemTable

display_pos altına geçip şunları ekle

DWORD max_stock;
DWORD restock_interval_seconds;

ClientManagerBoot.cpp açıver

arat

"shop_item.count "

değiştir

"shop_item.count, shop_item.max_stock, shop_item.restock_interval_seconds "

bul

TShopItemTable * pItem = &shop_table->items[shop_table->byItemCount];

içerisinde bul

str_to_number(pItem->vnum, data[col++]);
str_to_number(pItem->count, data[col++]);

değiştir

str_to_number(pItem->vnum, data[col++]);
str_to_number(pItem->count, data[col++]);
str_to_number(pItem->max_stock, data[col++]);
str_to_number(pItem->restock_interval_seconds, data[col++]);
++shop_table->byItemCount;

shop.cpp aç arat

void CShop::SetShopItems(TShopItemTable * pTable, BYTE bItemCount)

içinde bul

item.vnum = pTable->vnum;
item.count = pTable->count;

altına ekle

item.stock = pTable->max_stock;
item.max_stock = pTable->max_stock;
item.restock_interval_seconds = pTable->restock_interval_seconds;
item.last_restock_time = get_global_time();

arat

int CShop::Buy(LPCHARACTER ch, BYTE pos)
içerisinde bul
SHOP_ITEM& r_item = m_itemVector[pos];

altına ekle

UpdateItemStock(r_item);
if (r_item.max_stock && r_item.stock == 0)
return SHOP_SUBHEADER_GC_SOLD_OUT;

arat

DBManager::instance().SendMoneyLog(MONEY_LOG_SHOP, item->GetVnum(), -dwPrice);
altına ekle
if (!m_pkPC && r_item.max_stock) {
if (r_item.stock > 0) --r_item.stock;
BroadcastUpdateItem(pos);
}

arat

pack.subheader = SHOP_SUBHEADER_GC_START;

altına ekle

UpdateStock();

arat

pack2.items.count = item.count;
değiştir
pack2.items.count = item.stock ? item.count : 0;
arat
pack2.item.count = m_itemVector[pos].count;
değiştir
pack2.item.count = m_itemVector[pos].stock ? m_itemVector[pos].count : 0;
fonksiyonu bul
bool CShop::IsSellingItem(DWORD itemID)
altına şu yeni fonksiyonları ekle
void CShop::UpdateItemStock(SHOP_ITEM& item)
{
if (item.max_stock == 0 || item.restock_interval_seconds == 0)
return;
time_t now = get_global_time();
if (item.stock < item.max_stock && now - item.last_restock_time >= item.restock_interval_seconds)
{
item.stock = item.max_stock;
item.last_restock_time = now;
}
}

void CShop::UpdateStock()
{
for (size_t i = 0; i < m_itemVector.size(); ++i)
UpdateItemStock(m_itemVector);
}

shop.h aç

arat

int itemid;

altına ekle

DWORD stock;
DWORD max_stock;
DWORD restock_interval_seconds;
time_t last_restock_time;

tekrar bul

itemid = 0;
altına ekle
stock = 0;
max_stock = 0;
restock_interval_seconds = 0;
last_restock_time = 0;

arat

DWORD GetNPCVnum() { return m_dwNPCVnum; }
altına ekle
void UpdateItemStock(SHOP_ITEM& item);
void UpdateStock();


250794_f8d39a347a76e9f6c5b2031e52e19594.png

bu sistem tam olarak tamamlanmadı ama çalışır :)

anlatımı sonradan düzenleyip düzgünce kod blokları içerisine alıp paylaşırım şimdiden gözü kanayacak olan kişilere sabır diliyorum


Kod:
ALTER TABLE shop_item ADD COLUMN max_stock INT DEFAULT 0, ADD COLUMN restock_interval_seconds INT DEFAULT 0, ADD COLUMN last_restock_time INT DEFAULT 0;

vt:

Kod:
def SetShopItem(self, slotIndex):         itemVnum = shop.GetItemID(slotIndex)         if 0 == itemVnum:             return         price = shop.GetItemPrice(slotIndex)         self.ClearToolTip()         self.isShopItem = True         metinSlot = []         for i in xrange(player.METIN_SOCKET_MAX_NUM):             metinSlot.append(shop.GetItemMetinSocket(slotIndex, i))         attrSlot = []         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):             attrSlot.append(shop.GetItemAttribute(slotIndex, i))         self.AddItemData(itemVnum, metinSlot, attrSlot)         self.AppendPrice(price)         if app.ENABLE_DYNAMIC_STOCK:             stock = shop.GetItemStock(slotIndex)             remaining = shop.GetItemRestockRemaining(slotIndex)             if stock > 0:                 self.AppendTextLine("Stok: %d" % stock, self.SPECIAL_POSITIVE_COLOR)             else:  # stock == 0                 if remaining > 0:                     readable = shop.SecondsToReadableTime(remaining)                     self.AppendTextLine("|cffff9999Yeni stok: %s sonra|r" % readable)                 else:  # remaining == 0                     self.AppendTextLine("|cffffcc00Yeni stok hazır!|r")

TKMT2 Tarzı Pazar Stok Sistemi Nedir?
Metin2 özel sunucularında oyun içi ekonomiyi düzenlemek ve oyuncuların eşya ticaretini kolaylaştırmak için birçok sistem geliştirilmektedir. Bu sistemlerden biri de TKMT2 tarzı pazar stok sistemidir. Bu sistem, oyuncuların eşyalarını güvenli bir şekilde sergileyip, diğer oyuncularla alım-satım yapmalarını sağlar. Özellikle Metin2 PvP sunucularında bu tarz sistemler, oyun içi ekonomik dengeleri korumada kritik rol oynar.

Pazar Stok Sisteminin Temel Özellikleri
TKMT2 tarzı pazar stok sistemi, oyuncuların sahip oldukları eşyaları bir 'pazar alanı'na koyarak belirledikleri fiyata satabilmelerini sağlar. Sistem genellikle C++ tabanlı bir yapıyla entegre edilir ve oyuncu veritabanında tutulan envanter veya depo eşyaları üzerinden çalışır. Sistemde, eşyanın hangi oyuncuya ait olduğu, ne kadar süreyle listede kalacağı ve satış fiyatı gibi bilgiler saklanır.

C++ ve Python Kullanımı
Bu tip sistemler genellikle Metin2 server side (game/auth) üzerinde C++ ile geliştirilir. Client tarafında ise Python GUI (py root) ile kullanıcı dostu arayüzler tasarlanabilir. Örneğin, bir oyuncu pazar ekranını açtığında, Python tabanlı bir UI scripti devreye girer. Bu UI, eşyaları listeler, filtreler ve satın alma işlemi başlatır. Backend tarafında ise C++ ile yazılmış olan core, bu işlemlerin veritabanı ile güvenli bir şekilde haberleşmesini sağlar.

Sistemin Avantajları
Bu tarz pazar sistemleri sayesinde oyuncular arasında doğrudan eşya transferi sağlanır. Oyun içi ekonomi daha dengeli hale gelir çünkü fiyatlar piyasa talebine göre şekillenir. Ayrıca, hack ya da dolandırıcılık riski azalır çünkü tüm işlemler sistem tarafından kontrol edilir. Bu sayede sunucu yöneticileri için de denetim kolaylaşır.

Güvenlik ve Performans
TKMT2 tarzı pazar stok sistemi, Metin2 server core’unun veritabanı (DB) ile entegrasyonu sayesinde güçlü güvenlik önlemleri sunar. Eşya transferleri sırasında çifte kontrol mekanizmaları çalışır. Sistem ayrıca yüksek trafik altında bile stabil kalacak şekilde optimize edilmiştir. Bu, büyük PvP sunucularında önemli bir avantaj sağlar.

Sonuç[/BR]TKMT2 tarzı pazar stok sistemi, Metin2 özel sunucularında gelişmiş bir ekonomik altyapı sunar. C++ ile yazılmış server-side sistemler, Python GUI ile desteklenen istemci taraflı arayüzlerle birleşerek kullanıcı dostu ve güvenli bir ticaret ortamı yaratır. Bu sistem, hem geliştiriciler hem de oyuncular için Metin2 oyun deneyimini ciddi anlamda zenginleştirir.


What is TKMT2 Style Market Stock System?
In Metin2 private servers, various systems are developed to regulate in-game economy and facilitate item trading among players. One such system is the TKMT2 style market stock system. This system allows players to securely display their items and trade them with other players. Particularly on Metin2 PvP servers, such systems play a critical role in maintaining in-game economic balance.

Key Features of the Market Stock System
The TKMT2 style market stock system enables players to place their items in a 'marketplace' and sell them at their desired price. The system typically integrates with a C++ based structure and operates through inventory or storage items stored in the player database. The system stores information such as which player owns the item, how long it will remain listed, and its selling price.

Usage of C++ and Python
These types of systems are generally developed in C++ on the Metin2 server side (game/auth). On the client side, user-friendly interfaces can be designed using Python GUI (py root). For instance, when a player opens the market screen, a Python-based UI script becomes active. This UI lists items, applies filters, and initiates purchase processes. Meanwhile, the backend, powered by C++ code within the core, ensures secure communication with the database.

Advantages of the System
Thanks to such market systems, direct item transfers occur between players. In-game economy becomes more balanced since prices are shaped according to market demand. Additionally, risks of hacking or fraud decrease because all transactions are controlled by the system. This also simplifies monitoring for server administrators.

Security and Performance
The TKMT2 style market stock system provides strong security measures through its integration with the Metin2 server core's database (DB). Double-check mechanisms operate during item transfers. Moreover, the system is optimized to remain stable even under high traffic, offering significant advantages for large PvP servers.

Conclusion[/BR]The TKMT2 style market stock system offers an advanced economic infrastructure in Metin2 private servers. Server-side systems written in C++ combined with client-side interfaces supported by Python GUI create a user-friendly and secure trading environment. This system significantly enriches the Metin2 gameplay experience for both developers and players.
 

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

Benzer konular

Geri
Üst Alt