Kan Hapı ile yapılan bug düzenlemesi.

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

Admin

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

Bugün düzelteceğimiz sorun Kan Hapı
Kan_Hap%C4%B1.png
kullanımı ile alakalı.

Öncelikle Kan Hapı ne işe yarar?

Sağ tıklayarak çalışır. Statü puanlarınızı yeniden dağıtmanızı sağlar.

Kan Hapı kullanılarak nasıl bug yapılıyor?

x94 statınız var iken 4 hap kullanırsanız ve sonunda başka bir stat eklediğinizde 4 statüyü harcarsanız, statünüz 90'dan 160'a yani iki katına çıkar.

Çözüm

Kod:
1) Dosyayı açın : cmd_general.cpp 2) Arayın ve bulun: ACMD(do_stat_minus) 3) Aşağıdaki ile değiştirin: ACMD(do_stat_minus) {     char arg1[256];     one_argument(argument, arg1, sizeof(arg1));     if (!*arg1)         return;     if (ch->IsPolymorphed())     {         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("둔갑 중에는 능력을 올릴 수 없습니다."));         return;     }     if (ch->GetPoint(POINT_STAT_RESET_COUNT) <= 0)         return;     if (!strcmp(arg1, "st"))     {         if (ch->GetRealPoint(POINT_ST) <= JobInitialPoints[ch->GetJob()].st)             return;         BYTE stpoints = 0;         stpoints = POINT_ST;         ch->SetRealPoint(stpoints, ch->GetRealPoint(stpoints) - 1);         ch->SetPoint(stpoints, ch->GetPoint(stpoints) - 1);         ch->ComputePoints();         ch->PointChange(stpoints, 0);     }     else if (!strcmp(arg1, "dx"))     {         if (ch->GetRealPoint(POINT_DX) <= JobInitialPoints[ch->GetJob()].dx)             return;         BYTE dxpoints = 0;         dxpoints = POINT_DX;         ch->SetRealPoint(dxpoints, ch->GetRealPoint(dxpoints) - 1);         ch->SetPoint(dxpoints, ch->GetPoint(dxpoints) - 1);         ch->ComputePoints();         ch->PointChange(dxpoints, 0);     }     else if (!strcmp(arg1, "ht"))     {         if (ch->GetRealPoint(POINT_HT) <= JobInitialPoints[ch->GetJob()].ht)             return;         BYTE htpoints = 0;         htpoints = POINT_HT;         ch->SetRealPoint(htpoints, ch->GetRealPoint(htpoints) - 1);         ch->SetPoint(htpoints, ch->GetPoint(htpoints) - 1);         ch->ComputePoints();         ch->PointChange(htpoints, 0);         ch->PointChange(POINT_MAX_SP, 0);     }     else if (!strcmp(arg1, "iq"))     {         if (ch->GetRealPoint(POINT_IQ) <= JobInitialPoints[ch->GetJob()].iq)             return;         BYTE iqpoints = 0;         iqpoints = POINT_IQ;         ch->SetRealPoint(iqpoints, ch->GetRealPoint(iqpoints) - 1);         ch->SetPoint(iqpoints, ch->GetPoint(iqpoints) - 1);         ch->ComputePoints();         ch->PointChange(iqpoints, 0);         ch->PointChange(POINT_MAX_HP, 0);     }     else         return;     ch->PointChange(POINT_STAT, + 1);     ch->PointChange(POINT_STAT_RESET_COUNT, - 1);     ch->ComputePoints(); }

Alıntıdır.
Metin2 Lobby olarak sunucu geliştiricileri için hazırladığımız bu yazıda, kan hapı sistemi üzerinden yapılan bug düzeltmeleri ve bu düzeltmelerin C++ kaynak kodlar üzerinde nasıl uygulandığına dair detaylara değineceğiz.

Kan Hapı Nedir?
Metin2 özel sunucularında yaygın bir şekilde kullanılan kan hapı, oyuncuların canlarını belirli oranlarda artıran bir konsumable özelliktir. Oyuncular savaş esnasında ya da zorlu görevler sırasında bu hapları kullanarak hayatta kalma şanslarını artırırlar.

Bug Nedir?
Ancak bazı özel sunucuların game src dosyalarında, kan hapı kullanımı sırasında ortaya çıkabilen küçük kodlama hataları veya eksik kontroller nedeniyle sistemsel hatalar meydana gelebilir. Bu hatalar, core dosyalarında çökmelere, veritabanı (db) bağlantı sorunlarına ya da kullanıcı istatistiklerinde bozulmalara yol açabilir.

Ortaya Çıkan Sorunlar
Örneğin, bazı sunucularda kan hapı kullanıldığında can miktarı doğru şekilde güncellenmeyebilir, ya da çoklu kullanım durumunda overflow hatası oluşabilir. Bu durum hem oyun deneyimini düşürür hem de pvp savaşlarında adil olmayan avantajlar yaratır.

C++ Kaynak Kodlarda Yapılan Düzeltme
Bu gibi hatalar genellikle game server tarafında, kan hapı fonksiyonunun çağrıldığı yerde düzeltilir. Öncelikle heal_amount değişkeni kontrol edilir. Bu değer sınırlar dışına çıktığında if kontrolü ile engellenmelidir. Ayrıca, char_update_points() fonksiyonu ile karakterin can durumu doğru şekilde istemciye gönderilmelidir.

Python GUI Kullanımı ile Test
Bazı geliştiriciler, py root ve uiscript üzerinden bir GUI arayüzü oluşturarak, kan hapı sistemini test edebilirler. Böylece gerçek zamanlı olarak veriler kontrol edilebilir.

Hata Ayıklama ve Derleme
Yapılan değişiklikten sonra, source edit işlemi tamamlandıktan sonra projeyi yeniden derlemek gerekir. Bu işlem genellikle compile aşamasında yapılır. Derleme sonrası test sunucusunda çalıştırılarak sistem tekrar kontrol edilmelidir.

Martysama ve Topluluk Katkıları
Topluluk üyelerinden martysama gibi deneyimli geliştiricilerin sağladığı örnekler ve kod parçaları sayesinde bu tür sistemsel hatalar daha hızlı çözülebiliyor. Metin2Dev forumları da bu süreçte önemli bir rol oynuyor.

Sonuç
Kan hapı sisteminde yapılan bu küçük ama kritik düzeltmeler, Metin2 özel sunucularının stabilitesini ve performansını doğrudan etkiler. Geliştiricilerin dikkatli olması gereken bu tür küçük detaylar, game core seviyesinde büyük farklar yaratır.


Metin2 Lobby presents this article for server developers where we discuss bug fixes related to the HP pill system and how these fixes are applied in C++ source codes.

What is HP Pill?
The HP pill, widely used on Metin2 private servers, is a consumable item that increases players' health points. During battles or challenging quests, players use these pills to enhance their survival chances.

What is the Bug?
However, in some private server game src files, small coding errors or missing checks during HP pill usage may lead to system errors. These bugs can cause crashes in core files, database (db) connection issues, or corruption in user statistics.

Issues Arising
For example, on certain servers, HP values may not update correctly after using the HP pill, or overflow errors might occur with multiple uses. This situation reduces the gameplay experience and creates unfair advantages in PvP battles.

Fix in C++ Source Codes
These kinds of bugs are typically fixed on the game server side at the point where the HP pill function is called. First, the heal_amount variable is checked. If this value exceeds limits, it should be blocked via an if statement. Additionally, the character's HP status must be correctly sent to the client via the char_update_points() function.

Testing with Python GUI
Some developers create a GUI interface using py root and uiscript to test the HP pill system. This allows real-time checking of data.

Debugging and Compilation
After the changes, the project must be recompiled following the source edit. This step is usually done during the compile phase. After compilation, the system should be tested again on a test server.

Contributions from Martysama and Community
Thanks to experienced developers like Martysama from the community, who provide examples and code snippets, such systemic errors can be resolved more quickly. Metin2Dev forums also play a significant role in this process.

Conclusion
These small but critical fixes in the HP pill system directly affect the stability and performance of Metin2 private servers. Careful attention to such minor details by developers makes a huge difference at the game core level.
 

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

Geri
Üst Alt