Kod:
#include "stdafx.h" #include "char.h" #include "char_manager.h" #include "utils.h" #include <fstream> #include <string> #include <vector> #include <thread> #include <chrono> #include <unordered_map> #include <atomic> #include <algorithm> #include <random> struct FakeMessage { std::string char_name; std::string message; }; static std::vector<FakeMessage> g_fake_messages; static std::unordered_map<std::string, CHARACTER*> g_dummy_characters; static std::atomic<bool> g_auto_shout_enabled{ true }; static std::thread g_shout_thread; static std::atomic<bool> g_thread_running{ false }; static const std::string g_txt_path = "/home/game/sahte_mesaj.txt"; void LoadFakeMessages() { g_fake_messages.clear(); std::ifstream file(g_txt_path); if (!file.is_open()) { sys_err("SAHTE_MESAJ: Dosya acilamadi: %s", g_txt_path.c_str()); return; } std::string line; while (std::getline(file, line)) { size_t space_pos = line.find(' '); if (space_pos != std::string::npos) { std::string name = line.substr(0, space_pos); std::string msg = line.substr(space_pos + 1); if (!name.empty() && !msg.empty()) g_fake_messages.push_back({ name, msg }); } } sys_log(0, "SAHTE_MESAJ: %zu sahte mesaj yüklendi.", g_fake_messages.size()); } CHARACTER* CreateDummyCharacter(const std::string& charName) { auto it = g_dummy_characters.find(charName); if (it != g_dummy_characters.end()) return it->second; CHARACTER_MANAGER& chm = CHARACTER_MANAGER::instance(); CHARACTER* ch = chm.CreateCharacter(); if (!ch) { sys_err("SAHTE_MESAJ: Dummy karakter yaratılamadı: %s", charName.c_str()); return nullptr; } ch->SetName(charName.c_str()); ch->SetDummy(true); ch->SetInvisible(true); ch->WarpSet(0, 100, 100); g_dummy_characters[charName] = ch; sys_log(0, "SAHTE_MESAJ: Dummy yaratıldı: %s", charName.c_str()); return ch; } void SendFakeShout(const FakeMessage& fm) { if (!g_auto_shout_enabled) return; CHARACTER* ch = CreateDummyCharacter(fm.char_name); if (ch) { ch->ChatPacket(CHAT_TYPE_SHOUT, fm.message.c_str()); sys_log(0, "SAHTE_MESAJ: %s -> %s", fm.char_name.c_str(), fm.message.c_str()); } } void AutoShoutLoop() { LoadFakeMessages(); g_thread_running = true; std::random_device rd; std::mt19937 g(rd()); while (g_auto_shout_enabled) { std::vector<FakeMessage> shuffled = g_fake_messages; std::shuffle(shuffled.begin(), shuffled.end(), g); for (const auto& fm : shuffled) { SendFakeShout(fm); std::this_thread::sleep_for(std::chrono::milliseconds(100)); } for (int i = 0; i < 15 && g_auto_shout_enabled; ++i) std::this_thread::sleep_for(std::chrono::seconds(1)); } g_thread_running = false; } void StartAutoShout() { if (g_thread_running) return; g_auto_shout_enabled = true; g_shout_thread = std::thread(AutoShoutLoop); g_shout_thread.detach(); } void StopAutoShout() { g_auto_shout_enabled = false; int wait = 0; while (g_thread_running && wait++ < 20) std::this_thread::sleep_for(std::chrono::milliseconds(100)); } bool DummyCharacterRecvPrivateMessage(CHARACTER* ch, const char* fromName, const char* message) { std::string chName = ch->GetName(); if (g_dummy_characters.find(chName) != g_dummy_characters.end()) { sys_log(0, "SAHTE_MESAJ PM (ignored): %s -> %s : %s", fromName, chName.c_str(), message); return true; } return false; } bool HandleAutoShoutCommand(CHARACTER* ch, const char* cmd) { if (!ch->IsGM()) return false; std::string command(cmd); if (command == "/reloadsahtemesaj") { LoadFakeMessages(); ch->ChatPacket(CHAT_TYPE_INFO, "Sahte mesaj listesi yeniden yüklendi."); return true; } else if (command == "/sahtemesaj start") { StartAutoShout(); ch->ChatPacket(CHAT_TYPE_INFO, "Sahte mesaj sistemi başlatıldı."); return true; } else if (command == "/sahtemesaj stop") { StopAutoShout(); ch->ChatPacket(CHAT_TYPE_INFO, "Sahte mesaj sistemi durduruldu."); return true; } return false; }
Yeni bir cpp oluşturun sahte_mesaj.cpp isminde.
Cpp yi makefile eklemeyi unutmayın.
/game/sahte_mesaj.txt Oluştur içine
Testtest merhaba
Ggg sa
Diye sıradan eklemeler yapabilirsiniz.
Komutlar:
sahtemesaj start, /sahtemesaj stop, /reloadsahtemesaj
//
Kod:
Char cpp Arat bool do_chat(CHARACTER* ch, const char* cmd) { Fonksiyonun içine hemen başına ekle if (HandleAutoShoutCommand(ch, cmd)) return true; Sonra tekrar char cpp arat bool RecvWhisper(CHARACTER* ch, const char* fromName, const char* message) { Yine fonksiyonun hemen başına ekle if (DummyCharacterRecvPrivateMessage(ch, fromName, message)) return true;
Bağırmada Sahte Bot Sistemi Nedir?
Metin2 özel sunucularında geliştirilen sistemlerden biri olan bağırmada sahte bot sistemi, oyuncuların bağırdıkları esnada sahte NPC veya bot karakterlerin görünmesini sağlar. Bu sistem özellikle PvP sunucularında stratejik avantaj sağlamak, düşmanı şaşırtmak veya gösteriş yapmak için tercih edilmektedir. Geliştiriciler tarafından özenle hazırlanan bu sistem, C++ tabanlı server-side kodlamalarla entegre edilir ve gerçekçi bir deneyim sunar.
Sistemin Çalışma Mantığı
Bu sistemde, oyuncu belirli bir komut veya trigger ile bağırdığında, sunucu tarafında özel olarak tanımlanmış bot karakterler sahnede belirir. Bu karakterler client tarafında diğer oyunculara gerçekmiş gibi gözükür. Sistem genellikle Python GUI üzerinden yapılandırılır ve uiscript dosyalarıyla entegre edilir. Geliştirici, botların görüneceği zamanı, karakter türünü, konumunu ve sürekliliğini ayarlayabilir.
Sahte Bot Sisteminin Avantajları
Oyuncular açısından bu sistem eğlenceli ve görsel etki yaratıcıdır. Özellikle PvP savaşlarında rakip kandırılabilir, sayısal üstünlük yanılgısı yaratılabilir. Geliştiriciler açısından ise bu sistem Metin2 özel sunucularında farklılaştırıcı bir unsur teşkil eder. Sistem, pack dosyalarına kolayca entegre edilebilir ve db core üzerinde de değişikliklerle daha da geliştirilebilir.
Kurulum ve Yapılandırma
Kurulum için server src dosyalarında gerekli C++ düzenlemeler yapılmalıdır. Oyun sunucusunda game ve auth katmanlarına dokunulmadan, sadece game server üzerinde değişiklik yapılır. Geliştiriciler, martysama tarzı kaynaklardan destek alarak bu işlemi kolaylaştırabilir. Py root üzerinden de yapılandırma dosyaları hazırlanabilir. DB tarafında bot karakterler için yeni veri tabanı girdileri oluşturulabilir. Sistem compile edildikten sonra test edilerek aktif edilir.
Sahte Bot Sisteminin Güvenlik Yönleri
Bu tür sistemlerin kötüye kullanım potansiyeli olduğu için, geliştiricilerin güvenlik önlemleri alması gerekir. Örneğin, sistem sadece yetkili oyuncular tarafından kullanılabilir hale getirilebilir ya da sınırlı sayıda tetiklenmesi sağlanabilir. Ayrıca, botlar gerçek oyuncular gibi davranmamalıdır; aksi takdirde anti-cheat sistemleriyle çakışabilir.
Sonuç
Bağırmada sahte bot sistemi, Metin2 özel sunucularında PvP deneyimini zenginleştiren ve geliştiricilere genişletilebilir bir yapı sunan etkileyici bir özelliktir. Game core ve db core üzerinde yapılan düzenlemelerle güçlü bir şekilde entegre edilebilir. Sistem, doğru şekilde yapılandırıldığında hem oyuncular hem de geliştiriciler için keyifli bir deneyim sağlar.
What is the Fake Bot System in Shouting?
The fake bot system in shouting is one of the systems developed for Metin2 private servers, allowing fake NPC or bot characters to appear when players shout. This system is especially preferred in PvP servers to gain strategic advantages, confuse enemies, or make a show. Developed carefully by developers, this system integrates with C++-based server-side coding and offers a realistic experience.
How Does the System Work?
In this system, when a player shouts using a specific command or trigger, specially defined bot characters appear on screen. These characters appear real to other players from the client side. The system is usually configured via Python GUI and integrated with uiscript files. Developers can configure the timing, character type, location, and duration of the bots’ appearance.
Advantages of the Fake Bot System
From a player's perspective, this system is entertaining and visually impressive. Especially during PvP battles, opponents can be deceived, creating a false sense of numerical superiority. For developers, this system serves as a differentiating feature for Metin2 private servers. It can be easily integrated into pack files and further enhanced with modifications on the db core.
Installation and Configuration
Installation requires necessary C++ modifications within the server src files. Changes are made only on the game server without touching game and auth layers of the server. Developers can simplify the process by getting support from sources like martysama. Configuration files can also be prepared via Py root. New database entries for bot characters can be created on the DB side. After the system is compiled, it is tested and activated.
Security Aspects of the Fake Bot System
Because such systems have potential for misuse, security measures must be taken by developers. For instance, the system could be limited to authorized players only or restricted to a certain number of uses. Additionally, bots should not behave exactly like real players; otherwise, they may conflict with anti-cheat systems.
Conclusion
The fake bot system in shouting is an impressive feature that enriches the PvP experience on Metin2 private servers and provides developers with an expandable structure. It can be strongly integrated through modifications on the game core and db core. When properly configured, this system offers enjoyable experiences for both players and developers.
