arat değiştir serisi chibi codes #1

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
arat

Kod:
void emergency_sig(int sig) {     if (sig == SIGSEGV)         sys_log(0, "SIGNAL: SIGSEGV");     else if (sig == SIGUSR1)         sys_log(0, "SIGNAL: SIGUSR1");     if (sig == SIGSEGV)         abort(); }

değiştir

Kod:
void emergency_sig(int sig) {     switch (sig)     {         case SIGSEGV:             fprintf(stderr, "FATAL ERROR: Segmentation Fault (SIGSEGV)\n");             fflush(stderr);             abort();             break;         case SIGBUS:             fprintf(stderr, "FATAL ERROR: Bus Error (SIGBUS)\n");             fflush(stderr);             abort();             break;         case SIGILL:             fprintf(stderr, "FATAL ERROR: Illegal Instruction (SIGILL)\n");             fflush(stderr);             abort();             break;         case SIGFPE:             fprintf(stderr, "FATAL ERROR: Floating Point Exception (SIGFPE)\n");             fflush(stderr);             abort();             break;         case SIGUSR1:             fprintf(stderr, "Received signal: SIGUSR1 (User-defined signal)\n");             fflush(stderr);             break;         default:             fprintf(stderr, "Received unknown signal: %d\n", sig);             fflush(stderr);             break;     } }

Arat Değiştir Serisi: Chibi Codes #1


Metin2 Lobby olarak Metin2 özel sunucu geliştirme dünyasında sürekli yeniliklere imza atıyoruz. Bu serimiz olan Arat Değiştir Serisi, C++ tabanlı sistem geliştirmelerinde kaynak koddan örneklerle pratik yapmayı amaçlıyor. Bu ilk bölümde, Metin2 özel sunucularında sıklıkla karşılaşılan bazı küçük ama etkili değişikliklerden bahsedeceğiz.

Chibi Codes, adından da anlaşılacağı gibi küçük, modüler ve kolay entegre edilebilir kod parçalarıdır. Genellikle küçük ama önemli işlevleri yerine getiren bu kodlar, hem yeni başlayan geliştiriciler hem de deneyimli sistemciler için büyük kolaylıklar sağlar.

Neden Arat Değiştir?
Metin2 geliştirme sürecinde, özellikle game_src, client_src, auth_src gibi temel yapılar üzerinde çalışırken, çok sayıda satır kodu gözden geçirmek gerekir. Burada devreye arat değiştir işlemleri girer. Bu işlemler sayesinde belirli bir fonksiyonu veya değişkeni hızlıca bulup, istenilen şekilde düzenlemek mümkündür.

Örnek 1: Canavarın HP'sini Sabitleme
Oyun içinde canavarların maksimum HP değerlerini sabitlemek isterseniz, char_battle.cpp dosyasındaki PointChange fonksiyonuna aşağıdaki gibi bir kontrol eklenebilir:

Kod:
if (IsMonster() && GetHP() > 1000000) {[BR][/BR]    POINT_MAX_HP = 1000000;[BR][/BR]}


Bu küçük kod, canavarların HP'sinin belirtilen değeri aşmasını engeller.

Örnek 2: PvP Sistemine Özel Yetenek Engelleme
PvP savaşlarında belirli yeteneklerin kullanılmasını engellemek için, char_skill.cpp dosyasında yetenek kullanımını kontrol eden fonksiyona bir kontrol satırı eklenebilir:

Kod:
if (pkMode == PK_MODE_PVP && skill_vnum == 67) {[BR][/BR]    ChatPacket(CHAT_TYPE_INFO, 'Bu yetenek PvP modunda kullanılamaz!');[BR][/BR]    return false;[BR][/BR]}


Bu sayede 67 numaralı yetenek PvP modunda devre dışı bırakılır.

Py Root ve UIscript Kullanımı
Python tabanlı sistemlerde, py_root[/CODE] ve uiscript[/CODE] dosyalarında da benzer arat-değiştir işlemleri yapılabilir. Örneğin, bir GUI elemanının görünümünü değiştirmek için, ilgili uiscript[/CODE] dosyasında gerekli değerler değiştirilir.

Sonuç
Arat Değiştir Serisi ile Metin2 geliştiricilerine yardımcı olmayı hedefliyoruz. Her bölümde farklı sistemlere odaklanarak, kolayca uygulanabilir çözümler sunacağız. Chibi Codes ile küçük ama güçlü değişiklikler yapabilir, sunucunuzu daha stabil ve eğlenceli hale getirebilirsiniz.

Devamını Takip Etmeyi Unutmayın!


Find and Replace Series: Chibi Codes #1


Metin2 Lobby continues to bring innovations in the world of Metin2 private server development. In this series called Find and Replace, we aim to practice with examples from source code in C++ based system development. In this first part, we will discuss some small but effective modifications frequently encountered in Metin2 private servers.

Chibi Codes, as the name implies, are small, modular, and easily integrable code snippets. These codes that perform small but important functions provide great convenience for both beginner developers and experienced system engineers.

Why Find and Replace?
In the process of developing Metin2, especially while working on core structures like game_src, client_src, auth_src, it is often necessary to review numerous lines of code. This is where find and replace operations come into play. With these operations, you can quickly locate and modify specific functions or variables as needed.

Example 1: Fixing Monster HP Values
If you want to cap monster maximum HP values in-game, you can add a control to the PointChange function in the char_battle.cpp file like so:

Kod:
if (IsMonster() && GetHP() > 1000000) {[BR][/BR]    POINT_MAX_HP = 1000000;[BR][/BR]}


This small code prevents monster HP from exceeding the specified value.

Example 2: Blocking Specific Skills in PvP
To prevent certain skills from being used during PvP battles, you can add a check line to the skill usage control function in the char_skill.cpp file:

Kod:
if (pkMode == PK_MODE_PVP && skill_vnum == 67) {[BR][/BR]    ChatPacket(CHAT_TYPE_INFO, 'This skill cannot be used in PvP mode!');[BR][/BR]    return false;[BR][/BR]}


This way, skill number 67 is disabled in PvP mode.

Using Py Root and UIscript
In Python-based systems, similar find-and-replace operations can also be performed in py_root[/CODE] and uiscript[/CODE] files. For instance, to change the appearance of a GUI element, you can modify the required values in the corresponding uiscript[/CODE] file.

Conclusion
Find and Replace Series aims to assist Metin2 developers. In each episode, we will focus on different systems and offer easy-to-implement solutions. With Chibi Codes, you can make small but powerful changes to make your server more stable and enjoyable.

Don't Forget to Follow the Next Episodes!
 

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

Geri
Üst Alt