NPC DE WON İLE SATIŞ YAPMAK C++/PY

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Npc lerde won ile satış yapmak isteyenler için paylaşıyorum kendi filesim için eklemiştim şimdi sizlere paylaşıyorum kullanmak isteyen olur diye

NOT : bunu eklemeden won sistemi ekli olması lazım filesinizde YOKSA BU LİNKTEKİNİ KUR


ekleyen kanıt atarsa sevinirim

KANIT :

Kanit.png






NPC DE WON İLE SATIŞ SİSTEMİ (C++ / PYTHON)

Metin2 özel sunucularında oyuncuların karakterleri ile satın alma yapabileceği dinamik sistemlerden biri olan NPC ile Won satış sistemi, hem kullanıcı deneyimini artırır hem de sunucu operatörlerinin gelir elde etmesini sağlar. Bu yazıda C++ ve Python tabanlı olarak nasıl bir NPC üzerinden Won satış sistemi yapılandırılır ele alacağız.

Sistem Nedir ve Nasıl Çalışır?

NPC üzerinden Won satışı sistemi, oyuncuların belirli bir NPC ile etkileşime girerek, önceden tanımlanmış ürünlerden satın almasını sağlar. Bu ürün genellikle Won paketleridir. Sistemde game_core tarafında C++ ile bir item_create event handler eklenir, client tarafında ise Python ile bir UIScript penceresi tasarlanır.

C++ Tarafında Yapılacaklar

Game Core üzerinde bir item_create fonksiyonu tanımlamak gerekir. Bu fonksiyon, oyuncunun belirli bir itemi satın alması durumunda çalışır. Örneğin:

Kod:
[COLOR=red]int[/COLOR] ItemCreate([COLOR=red]const char*[/COLOR] item_name, [COLOR=red]int[/COLOR] count, [COLOR=red]int[/COLOR] player_id);


Bu fonksiyon, oyuncunun sahip olduğu Won miktarını kontrol eder ve satın alma işlemi gerçekleşirse DB core üzerinden gerekli işlemleri yapar. Aynı zamanda auth_server ile senkronize çalışarak güvenliği sağlar.

Python Tarafında UI Tasarımı

Py Root ve UIScript kullanarak bir GUI penceresi oluşturulabilir. Bu pencere, oyuncuya satın alabileceği Won paketlerini gösterir. Örnek bir UIScript dosyası şu şekilde olabilir:

Kod:
window = { 'name': 'won_shop', 'style': ['movable', 'float'], 'x': 50, 'y': 50, 'width': 300, 'height': 200, 'children': [ { 'type': 'text', 'name': 'title', 'text': 'Won Paketleri', 'x': 10, 'y': 10 }, { 'type': 'button', 'name': 'buy_100_won', 'text': '100 Won - 5 Euro', 'x': 10, 'y': 40 } ] }


Paketleme ve Dağıtım (Pack)

Oluşturulan C++ modülü ve Python GUI dosyaları bir pack dosyası haline getirilerek özel sunucuya entegre edilir. Bu pack dosyası genellikle Martysama tarzı derlenmiş kaynak kodlarla uyumlu olacak şekilde düzenlenmelidir.

Sunucu Tarafında Entegrasyon

Sistemin düzgün çalışması için server_src dosyalarında gerekli event handler'lar tanımlanmalı ve client_src ile senkronize olmalıdır. Compile işlemi sonrasında test edilmelidir. Auth ve game sunucuları arasında veri aktarımı doğru yapılmazsa satın alma işlemleri başarısız olabilir.

Sonuç

NPC üzerinden Won satış sistemi, Metin2 özel sunucularında kullanıcı sadakati artırmak ve ek gelir sağlamak için etkili bir yöntemdir. C++ ve Python dillerindeki bilgi birikimiyle bu sistem kolayca geliştirilebilir. Source edit süreçleri sırasında dikkat edilmesi gereken güvenlik önlemleri, sistemin uzun süreli çalışabilirliğini sağlar.

Kaynak Kod Paylaşımı

Metin2 Lobby olarak, bu gibi gelişmiş sistemlerin kaynak kodlarını ve detaylı açıklamalarını paylaşmaya devam ediyoruz.


SELLING WON WITH NPC (C++ / PYTHON)

In Metin2 private servers, one of the dynamic systems that allow players to make purchases with their characters is the selling Won through NPCs. In this article, we will cover how to implement such a system using C++ and Python.

What Is The System And How Does It Work?

The system allows players to interact with a specific NPC and purchase predefined packages of Won. On the game_core side, a C++ item_create event handler must be added, while on the client side, a UI window is designed using Python.

What Needs To Be Done In C++

An item_create function must be defined within the Game Core. This function executes when a player attempts to purchase a certain item. For example:

Kod:
[COLOR=red]int[/COLOR] ItemCreate([COLOR=red]const char*[/COLOR] item_name, [COLOR=red]int[/COLOR] count, [COLOR=red]int[/COLOR] player_id);


This function checks the player's Won balance and processes the transaction via the DB core. It also synchronizes with the auth_server for security purposes.

UI Design With Python

Using Py Root and UIScript, a GUI window can be created that displays available Won packages to the player. An example UIScript file might look like this:

Kod:
window = { 'name': 'won_shop', 'style': ['movable', 'float'], 'x': 50, 'y': 50, 'width': 300, 'height': 200, 'children': [ { 'type': 'text', 'name': 'title', 'text': 'Won Packages', 'x': 10, 'y': 10 }, { 'type': 'button', 'name': 'buy_100_won', 'text': '100 Won - 5 Euro', 'x': 10, 'y': 40 } ] }


Packaging And Distribution

The resulting C++ module and Python GUI files are packed into a pack file and integrated into the private server. These packs should be compatible with compiled sources similar to Martysama style.

Server-Side Integration

To ensure the system works properly, necessary event handlers must be defined in server_src files and synchronized with client_src. After compile, testing is essential. Incorrect data transfers between the auth and game servers may lead to failed transactions.

Conclusion

Selling Won through NPCs is an effective method to increase user loyalty and generate additional revenue in Metin2 private servers. With knowledge in C++ and Python, this system can be developed easily. Proper security measures during source edit stages ensure long-term functionality of the system.

Source Code Sharing

At Metin2 Lobby, we continue to share source codes and detailed explanations for such advanced systems.
 

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

Geri
Üst Alt