Merhabalar, c++ taraflı kuleye geri dönme sistemini paylaşıyorum anlatım bana aittir sistem bana ait değildir. aynı zamanda nemere ve razadördede çalışmaktadır sistem , onların questlerini ve datalarını eklemedim isteyen benden questleri alabilir. Kanıt en kısa sürede eklenecektir.
C++11 kullanmayanlar dungeon_turn_back.cpp içersine girsin
bu kodlardan kaç tane varsa hepsini bu şekilde değiştirsin.
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
C++11 kullanmayanlar dungeon_turn_back.cpp içersine girsin
Kod:
auto it = dungeon_x.find(ch->GetPlayerID()); auto it = dungeon_y.find(ch->GetPlayerID()); auto it = dungeon_z.find(ch->GetPlayerID()); auto it = dungeon_index.find(ch->GetPlayerID());
Kod:
auto itx = dungeon_x.find(ch->GetPlayerID()); auto ity = dungeon_y.find(ch->GetPlayerID()); auto itz = dungeon_z.find(ch->GetPlayerID()); auto iti = dungeon_index.find(ch->GetPlayerID());
bu kodlardan kaç tane varsa hepsini bu şekilde değiştirsin.
Kod:
boost::unordered_map<DWORD, float>::iterator it = dungeon_x.find(ch->GetPlayerID); boost::unordered_map<DWORD, float>::iterator it = dungeon_y.find(ch->GetPlayerID); boost::unordered_map<DWORD, float>::iterator it = dungeon_z.find(ch->GetPlayerID); boost::unordered_map<DWORD, float>::iterator it = dungeon_index.find(ch->GetPlayerID);
Kod:
boost::unordered_map<DWORD, float>::iterator itx = dungeon_x.find(ch->GetPlayerID); boost::unordered_map<DWORD, float>::iterator ity = dungeon_y.find(ch->GetPlayerID); boost::unordered_map<DWORD, float>::iterator itz = dungeon_z.find(ch->GetPlayerID); boost::unordered_map<DWORD, float>::iterator iti = dungeon_index.find(ch->GetPlayerID);
Metin2 oyununda C++ tabanlı bir Kuleye Geri Dönme Sistemi oluşturmak, özellikle özel sunucuların gelişimine katkı sağlar. Bu sistem sayesinde oyuncular belirli bir süre sonra kendi kulesine otomatik olarak geri dönebilir veya manuel olarak dönüş seçeneği kullanabilir. Bu yazıda, Metin2 özel sunucularında nasıl bir C++ tabanlı geri dönme sistemi geliştirileceğini adım adım ele alacağız.
Öncelikle, bu sistem genellikle PvP sunucularında tercih edilir. Oyuncuların belirli alanlarda savaşması ardından kendi üslerine hızlıca geri dönmeleri, stratejik avantaj sağlar. Bu sistem, hem game_core hem de client_src üzerinde değişiklikler gerektirir. Sunucu tarafında bir komut tanımlanmalı ve bu komutla oyuncunun kulesine dönmesi sağlanmalıdır.
Kuleye Dönüş Mekaniği
Bu mekanizma genellikle bir komut üzerinden çalışır. Örneğin, /towerrtn gibi bir komutla oyuncu, son bulunduğu kuleye ışınlanabilir. Bu işlem sırasında C++ kodlarında bir fonksiyon tanımlamak gerekir. Fonksiyon, oyuncunun ID'sini alır, veritabanında kule konumunu çeker ve karakteri o koordinatlara ışınlar. Aynı zamanda güvenlik önlemleri alınmalıdır. Oyuncu belirli bir süre PvP yapmışsa ya da bir görevdeyse dönüş iptal edilmelidir.
Sunucu Tarafı Kodlama
Metin2 sunucu kaynak kodlarında, genellikle char.cpp dosyasında bir komut tanımlanır. Bu komut, oyuncu tarafından girildiğinde, bir fonksiyon çağrılır. Bu fonksiyon, oyuncunun kulesine ait koordinatları DB Core üzerinden çeker ve karakteri o konuma taşır. Ayrıca, bu işlem sırasında cooldown (bekleme süresi) tanımlanarak滥用 engellenir. Örnek olarak:
- Oyuncu /towerrtn komutunu girer.
- Komut işlenir, oyuncu kontrol edilir.
- Kule koordinatları DB'den çekilir.
- Karakter o konuma ışınlanır.
Client Tarafı Entegrasyonu
Client tarafında da bu sistemi desteklemek için uiscript dosyalarında küçük değişiklikler yapılabilir. Örneğin bir buton eklenebilir ve bu buton /towerrtn komutunu tetikleyebilir. Bu, kullanıcı dostu bir arayüz sağlar. Ayrıca, Python GUI ile geliştirilen arayüzlerle de entegre edilebilir.
Veritabanı Yapılandırması
Sistemde her oyuncuya ait kule konumu veritabanında tutulmalıdır. Genellikle player tablosuna bir sütun eklenir: tower_x, tower_y. Bu değerler, oyuncu kulesine kayıt edildiğinde güncellenir. Bu yapı, sistemin kararlı çalışması için kritiktir.
Güvenlik ve Performans
Oyuncu dönüş sırasında PvP yapmıyorsa, bekleme alanında değilse ve başka bir görevde değilse dönüşe izin verilmelidir. Ayrıca, dönüş sırasında delay[/BR] (gecikme) getirilerek滥用 önlenebilir. Performans açısından, DB sorguları optimize edilmeli ve fazla sorgudan kaçınılmalıdır.
Sonuç
Kuleye Geri Dönme Sistemi, Metin2 özel sunucularında stratejik bir avantaj sunar. C++ ile geliştirilen bu sistem, game_core, db_core, client_src ve uiscript gibi bileşenler arasında koordineli çalışarak tam bir deneyim sunar. Geliştiriciler bu sistemi kolayca entegre edip özelleştirebilirler.
Metin2 game requires developing a C++-based Tower Return System which contributes significantly to private server enhancements. This system allows players to return automatically to their own tower after a certain period or use a manual return option. In this article, we will detail step by step how to develop such a C++-based return system for Metin2 private servers.
Firstly, this system is commonly preferred on PvP servers. Allowing players to quickly return to their bases after fighting in specific areas provides strategic advantages. The system requires modifications on both game_core and client_src. A command must be defined on the server-side to allow the player to teleport back to their tower.
Tower Return Mechanism
This mechanism typically works via a command. For example, with a command like /towerrtn, the player can teleport back to their last known tower location. Within the C++ code, a function must be defined to handle this process. The function retrieves the player's ID, fetches the tower coordinates from the database, and teleports the character to those coordinates. Additionally, security measures should be implemented; if the player has recently engaged in PvP or is currently on a quest, the return action should be canceled.
Server-Side Coding
In the Metin2 server source code, usually in the char.cpp file, a command is defined. When entered by the player, this command triggers a function. The function retrieves the tower coordinates from the DB Core and moves the character to that location. Also, a cooldown (waiting period) should be implemented to prevent abuse. Example steps:
- Player enters the /towerrtn command.
- Command is processed, player is checked.
- Tower coordinates are fetched from DB.
- Character is teleported to the location.
Client-Side Integration
On the client side, minor modifications can be made to uiscript files to support this system. For instance, a button could be added that triggers the /towerrtn command, offering a user-friendly interface. This can also be integrated with interfaces developed using Python GUI.
Database Configuration
The tower location for each player must be stored in the database. Usually, columns like tower_x, tower_y are added to the player table. These values are updated when the player registers their tower. This structure is critical for the system to work reliably.
Security and Performance
The return should only be allowed if the player is not in PvP, not in a waiting area, and not on another task. Additionally, implementing a delay during the return action can help prevent abuse. From a performance standpoint, database queries must be optimized and excessive queries avoided.
Conclusion
The Tower Return System offers a strategic advantage in Metin2 private servers. Developed with C++, this system integrates seamlessly across components like game_core, db_core, client_src, and uiscript, providing a complete experience. Developers can easily integrate and customize this system.
