Özellikler:
GM /sanskutusu komutu yazar → sistem online oyuncular arasından rastgele birini seçer.
Seçilen oyuncuya ödül verilir (yang, item, buff vs.).
Tüm oyunculara kazanan duyurulur.
cmd.cpp Komut tanımı:
Kod:
ACMD YAPISINA // ACMD(do_luckybox); KOMUT TARAFINA // { "sanskutusu", do_luckybox, GM_HIGH_WIZARD, POS_DEAD, GM_HIGH_WIZARD },
cmd_general.cpp Fonksiyon:
Kod:
ACMD(do_luckybox) { if (CHARACTER_MANAGER::instance().GetCount() < 2) { ch->ChatPacket(CHAT_TYPE_INFO, "Yeterli oyuncu yok."); return; } std::vector<LPCHARACTER> players; CHARACTER_MANAGER::instance().for_each_pc([&players](LPCHARACTER tch){ if (tch->GetGMLevel() < GM_LOW_WIZARD) // GM'leri hariç tut players.push_back(tch); }); if (players.empty()) { ch->ChatPacket(CHAT_TYPE_INFO, "Oyuncu bulunamadı."); return; } int idx = number(0, players.size() - 1); LPCHARACTER winner = players[idx]; // Ödül: 1.000.000 yang winner->PointChange(POINT_GOLD, 1000000); BroadcastNotice(" Şans Kutusu Kazananı: %s! 1.000.000 yang kazandı!", winner->GetName()); }
Metin2 Özel Sunucularında Şans Kutusu Sistemi [C++] Uygulaması
Giriş
Metin2 özel sunucu geliştirme sürecinde oyuncuların dikkatini çekmek ve sunucu içi ekonomiyi canlandırmak amacıyla geliştirilen sistemlerden biri de Şans Kutusu Sistemi'dir. Bu sistem sayesinde oyuncular belirli görevleri tamamlayarak veya sunucu içi aktivitelerle kazandıkları özel para birimiyle kutular açabilir, rastgele ödüller elde edebilirler. Bu yazıda, C++ tabanlı Metin2 sunucu tarafında nasıl bir Şans Kutusu Sistemi geliştirilebileceğini detaylı olarak inceleyeceğiz.
Şans Kutusu Sisteminin Temel Yapısı
C++ dilinde geliştirilen bir şans kutusu sistemi, genellikle sunucu tarafında (game server) çalışan bir modül şeklinde tasarlanır. Sistem, belirli komutlarla aktive edilir ve kutudan çıkacak ödüller, önceden tanımlanmış bir tabloya göre rastgele seçilir. Ödül listesi, item ID, miktar ve çıkma ihtimali gibi parametreleri içerir.
Özellikler:
- Oyuncu seviyesine göre farklı kutular.
- Rastgele ödüller.
- Sunucu tarafında güvenli işlem.
- Kullanıcı dostu GUI entegrasyonu (Python tabanlı).
C++ Kodlama Adımları
1. Event Handler: Oyuncu bir komutla kutuyu açtığında bu işlemi başlatan event handler fonksiyonu yazılır.
2. Item Listesi: Her kutuya özel item listesi tanımlanır. Bu liste DB'ye kayıtlı olabilir veya kod içinde sabit olarak tanımlanabilir.
3. Rastgele Seçim Algoritması: Belirli bir olasılık sistemine göre item seçimi yapılır. Örneğin, 100 üzerinden 1 şansla legendary item verilebilir.
Python GUI Entegrasyonu
Oyuncu arayüzüne entegre edilen Python GUI sayesinde kullanıcılar kutu içeriğini görebilir, açma işlemini başlatır. Py Root klasöründe bu GUI dosyaları yer alır ve uiscript ile çalışır. Böylece hem estetik hem de fonksiyonel bir arayüz sağlanır.
Veritabanı ve Paketleme
Sistemde kullanılan itemlerin doğruluğunu sağlamak adına DB Core üzerinde gerekli tablolar oluşturulmalıdır. Ayrıca tüm kodlar Pack dosyası olarak derlenip sunucuya entegre edilir. Bu sayede sistem güvenli ve optimize bir şekilde çalışır.
Sonuç
Metin2 özel sunucularında Şans Kutusu Sistemi, oyuncu sadakati ve sunucu etkileşimini artırmak için etkili bir yöntemdir. C++ ve Python tabanlı geliştirme ile hem güçlü backend hem de kullanıcı dostu frontend sunulabilir. Martysama gibi deneyimli geliştiricilerin katkılarıyla bu sistemler daha da gelişmekte ve Metin2Dev toplulukları tarafından aktif olarak kullanılmaktadır.
Implementing Lucky Box System [C++] in Metin2 Private Servers
Introduction
One of the systems developed during Metin2 private server development to attract players and revitalize in-game economy is the Lucky Box System. With this system, players can open boxes with special currency earned by completing certain tasks or participating in server activities, receiving random rewards. In this article, we will examine in detail how to develop a Lucky Box System on the C++ based Metin2 game server side.
Structure of the Lucky Box System
A lucky box system developed in C++ is typically designed as a module running on the game server side. The system is activated via specific commands, and the rewards from the box are randomly selected according to a predefined table. The reward list includes parameters such as item ID, quantity, and drop chance.
Features:
- Different boxes based on player level.
- Random rewards.
- Secure processing on server-side.
- User-friendly GUI integration (Python-based).
C++ Coding Steps
1. Event Handler: A function that starts the process when a player opens the box with a command.
2. Item List: Item lists specific to each box are defined. These can be stored in the database or hardcoded into the code.
3. Random Selection Algorithm: Items are chosen based on a probability system. For example, a legendary item could have a 1 in 100 chance of being awarded.
Python GUI Integration
Through the Python GUI integrated into the player interface, users can view box contents and initiate the opening process. These GUI files are located in the Py Root folder and work with uiscript, providing both aesthetic and functional interfaces.
Database and Packaging
To ensure the accuracy of items used in the system, relevant tables must be created in the DB Core. Additionally, all codes are compiled into a Pack file and integrated into the server, ensuring secure and optimized operation.
Conclusion
The Lucky Box System in Metin2 private servers is an effective method for increasing player loyalty and server engagement. With C++ and Python-based development, both a strong backend and a user-friendly frontend can be provided. With contributions from experienced developers like Martysama, these systems continue to evolve and are actively used by Metin2Dev communities.
