Kendi çapında bir şeyler yapmaya çalışan bir gencin fikir ve emeğiyle yapıldı saygıda kusur etmeyeceğinizden eminim.
Hayırlı Kullanımlar
<a role="button" tabindex="0">Genişletmek için tıkla</a> </blockquote>Hayırlı Kullanımlar
Kod:
#ifdef INVENTORY_DISPLAY_PLUS ACMD(do_view_equip_gold) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (*arg1) { DWORD vid = 0; str_to_number(vid, arg1); LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(vid); if (ch->GetGold() < 5000000) { ch->ChatPacket(CHAT_TYPE_INFO,"|cffffff00[Sistem] |cff00ff00Profili görüntüleyebilmek için (5.000.000) yang'a sahip olmalısın!"); return; } if (!tch) return; if (!tch->IsPC()) return; if (tch->IsBlockMode(BLOCK_VIEW_EQUIPMENT)) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ekipman konusmasi")); return; } if (5000000 + tch->GetGold() > GOLD_MAX) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("karsi fazla yang tasiyor")); return; } tch->SendEquipment(ch); ch->PointChange(POINT_GOLD, -5000000, false); tch->PointChange(POINT_GOLD, 5000000, true); } } ACMD(do_view_equip_item) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (*arg1) { DWORD vid = 0; str_to_number(vid, arg1); LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(vid); if (ch->CountSpecifyItem(90005) < 100) { ch->ChatPacket(CHAT_TYPE_INFO,"|cffffff00[Sistem] |cff00ff00Profili görüntüleyebilmek için 100 adet su taşına sahip olmalısın!"); return; } if (!tch) return; if (!tch->IsPC()) return; if (tch->IsBlockMode(BLOCK_VIEW_EQUIPMENT)) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ekipman konusmasi")); return; } LPITEM new_item = ITEM_MANAGER::instance().CreateItem(90005, 100); if (!new_item) return; int iEmptyPos = tch->GetEmptyInventory(new_item->GetSize()); if (iEmptyPos != -1) { tch->SendEquipment(ch); ch->RemoveSpecifyItem(90005,100); new_item->AddToCharacter(tch, TItemPos(INVENTORY, iEmptyPos)); } else { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("karsi tarafin envanterde bos alan yok")); return; } } } #endif
Metin2 Lobby olarak sunucu geliştiricileri için en gelişmiş sistemlerden biri olan Gelişmiş Profil Görüntüleme Sistemi'ni incelemeye devam ediyoruz. Bu sistem, özellikle C++ ve Python tabanlı Metin2 özel sunucular için optimize edilmiş, kullanıcı dostu ve güçlü bir yapıya sahiptir. Bu yazıda hem game side hem de client side üzerinde nasıl entegre edileceği detaylı şekilde açıklanacaktır.
Profil Görüntüleme Sisteminin Amacı
Metin2 özel sunucularında oyuncuların birbirleri hakkında daha fazla bilgiye ulaşabilmesi için Gelişmiş Profil Sistemi geliştirilmiştir. Oyuncu listesi, seviye bilgisi, eşyalar, PvP istatistikleri gibi birçok veri, C++[/COORD] tarafında veritabanı bağlantısıyla alınarak, Python tarafında arayüzle birleştirilir. Bu sayede kullanıcılar bir oyuncuya sağ tıklayıp onun tüm bilgilerini görebilir.
C++ Tarafında Entegrasyon
Oyuncu profili görüntüleme sistemi, game_src klasöründe yer alan char.cpp dosyasına özel bir mesaj (packet) tanımlanarak başlatılır. Oyuncu sağ tıklandığında HEADER_CG_REQUEST_CHARACTER_INFO adlı bir paket gönderilir. Bu paketin karşılığı input_main.cpp içinde tanımlanmalıdır. Paket alındığında CClientManager::instance().SendCharacterInfoToPeer() fonksiyonu çağrılır. Bu fonksiyon, veritabanından gerekli bilgileri çeker ve istemciye gönderir.
Python Tarafında UI Tasarımı
UIScript dosyasında ProfilWindow.py gibi bir dosya oluşturulur. Bu dosya, profiller için bir arayüz sağlar. Arayüzde karakterin ismi, seviyesi, eşyaları, PvP kazan-kayıp oranı gibi bilgiler gösterilir. PyGUI sistemleri ile bu bilgiler dinamik olarak yüklenir. Kullanıcı arayüzü, ProfilWindow.xml dosyasıyla şekillendirilir. XML dosyası, pencere boyutları, butonlar ve bilgi kutucuklarını içerir.
Veritabanı Entegrasyonu
DB Core tarafında, oyuncu profiliyle ilgili verileri tutan özel tablolar bulunur. Bu tablolardan alınan veriler game server tarafından işlenip istemciye aktarılır. Örnek tablo isimleri: player_profile_info, pvp_stats, equipment_data.
Sistem Güvenliği ve Performans
Sistem, SQL injection saldırılarına karşı filtrelenmiş sorgularla korunur. Ayrıca, profillerin saniyede birden fazla kez güncellenmemesi için sınırlamalar konulur. Channel tabanlı sunucularda her kanalda farklı veriler gösterilebilir. Performans için önbellekleme (caching) sistemleri entegre edilir.
Yazılım Kaynak Kodları ve Geliştirme Süreci
Metin2 özel sunucu geliştiricileri için source edit süreçleri oldukça önemlidir. MartySama gibi topluluklar, bu konuda örnek projeler sunar. GameCore ve DBCORE yapıları ile entegre çalışması sağlanmıştır. Geliştiriciler, py_root ve pack dosyalarını düzenleyerek sistemi kendi sunucularına uyarlayabilirler.
Metin2 Lobby continues to examine one of the most advanced systems for server developers, the Advanced Profile Viewing System. This system has a user-friendly and powerful structure optimized especially for Metin2 private servers based on C++ and Python. This article will explain in detail how it integrates both on the game side and client side.
Purpose of the Profile Viewing System
The Advanced Profile System was developed so players can access more information about each other in Metin2 private servers. Player lists, level information, items, PvP statistics, and many other details are retrieved from the database on the C++ side and merged into the interface on the Python side. Thus, users can right-click on a player and view all their information.
Integration on the C++ Side
The player profile viewing system begins by defining a custom message (packet) in the char.cpp file located in the game_src folder. When a player is right-clicked, a packet named HEADER_CG_REQUEST_CHARACTER_INFO is sent. The counterpart of this packet must be defined in input_main.cpp. Upon receiving the packet, the function CClientManager::instance().SendCharacterInfoToPeer() is called. This function retrieves necessary data from the database and sends it to the client.
UI Design on the Python Side
In the UIScript file, a file such as ProfilWindow.py is created. This file provides an interface for profiles. The interface displays the character's name, level, items, PvP win-loss ratio, and more. These details are dynamically loaded via PyGUI systems. The UI is shaped with the ProfilWindow.xml file, which includes window dimensions, buttons, and info boxes.
Database Integration
On the DB Core side, special tables hold data related to player profiles. Data retrieved from these tables is processed by the game server and sent to the client. Example table names: player_profile_info, pvp_stats, equipment_data.
System Security and Performance
The system is protected against SQL injection attacks with filtered queries. Additionally, limits are set to prevent profiles from updating more than once per second. In Channel-based servers, different data can be shown on each channel. For performance, caching systems are integrated.
Source Code and Development Process
Source edit processes are very important for Metin2 private server developers. Communities like MartySama provide sample projects on this topic. It works integrated with GameCore and DBCORE structures. Developers can adapt the system to their own servers by editing py_root and pack files.
