[C++] [FIX] Grup Bonus Bug

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Arat:
Kod:
EVENTINFO(party_update_event_info) {     DWORD pid;         party_update_event_info()         : pid(0)     {     } };

Değiştir:

Kod:
EVENTINFO(party_update_event_info) {     DWORD pid;     CParty *pParty;         party_update_event_info()         : pid(0)     {     } };

Arat:
Kod:
void CParty::Link(LPCHARACTER pkChr) {     TMemberMap::iterator it;         if (pkChr->IsPC())         it = m_memberMap.find(pkChr->GetPlayerID());     else         it = m_memberMap.find(pkChr->GetVID());         if (it == m_memberMap.end())     {         sys_err("%s is not member of this party", pkChr->GetName());         return;     }         if (m_bPCParty && !m_eventUpdate)     {         party_update_event_info* info = AllocEventInfo<party_update_event_info>();         info->pid = m_dwLeaderPID;         m_eventUpdate = event_create(party_update_event, info, PASSES_PER_SEC(3));     }         if (it->second.bRole == PARTY_ROLE_LEADER)         m_pkChrLeader = pkChr;         sys_log(2, "PARTY[%d] %s linked to party", GetLeaderPID(), pkChr->GetName());         it->second.pCharacter = pkChr;     pkChr->SetParty(this);         if (pkChr->IsPC())     {         if (it->second.strName.empty())         {             it->second.strName = pkChr->GetName();         }             SendPartyJoinOneToAll(pkChr->GetPlayerID());             SendPartyJoinAllToOne(pkChr);         SendPartyLinkOneToAll(pkChr);         SendPartyLinkAllToOne(pkChr);         SendPartyInfoAllToOne(pkChr);         SendPartyInfoOneToAll(pkChr);             SendParameter(pkChr);             //sys_log(0, "PARTY-DUNGEON connect %p %p", this, GetDungeon());         if (GetDungeon() && GetDungeon()->GetMapIndex() == pkChr->GetMapIndex())         {             pkChr->SetDungeon(GetDungeon());         }             RequestSetMemberLevel(pkChr->GetPlayerID(), pkChr->GetLevel());     } }

Bu Fonksiyonuda Arat:
Kod:
info->pid = m_dwLeaderPID;

Kat Ekle:
Kod:
info->pParty = this;

Arat:
Kod:
void CParty::Update()

Bu işlevi de değiştirin:
Kod:
if (!l)         return;

İşte Burda:
Kod:
if (!l)     {         RemoveBonuses();         return;     }

Dosyanın Sonuna Ekleyin:
Kod:
void CParty::RemoveBonuses() {     bool bResendAll = false;     int iNewExpBonus = ComputePartyBonusExpPercent();         if (m_iExpBonus != iNewExpBonus)     {         bResendAll = true;         m_iExpBonus = iNewExpBonus;     }         if (bResendAll)     {         for (TMemberMap::iterator it = m_memberMap.begin(); it != m_memberMap.end(); ++it)         {             if (it->second.pCharacter)             {                 ComputeRolePoint(it->second.pCharacter, 0, false);                 SendPartyInfoOneToAll(it->second.pCharacter);             }         }     } }

Oyuna gidin / Party.h

Arat:
Kod:
bool        IsPartyInDungeon(int mapIndex);

Sonra Ekle:
Kod:
void        RemoveBonuses();

Metin2 Grup Bonus Hatası ve C++ ile Düzeltme Yöntemi


GİRİŞ
Metin2 özel sunucularında geliştirme yaparken karşılaşılan bazı hatalar, oyuncu deneyimini ciddi şekilde etkileyebilir. Bu hatalardan birisi de Grup Bonus sisteminde meydana gelen buglardır. Özellikle PvP odaklı sunucularda grup bonusları, oyuncuların bir araya gelerek daha güçlü kombinasyonlar oluşturmasını sağladığı için büyük önem taşır. Bu yazıda, C++ tabanlı Metin2 sunucularda karşılaşılan Grup Bonus hatasının neden kaynaklandığını ve nasıl düzeltilmesi gerektiğini ele alacağız.

NEDENLER VE KARAKTER DAVRANIŞLARI
Genellikle bu tür hatalar, sunucu tarafında grup bonus hesaplamalarında yapılan mantık hatalarından veya veritabanı ile sunucu arasındaki veri akışındaki eksikliklerden kaynaklanır. Örneğin, bir oyuncu gruba katıldığında bonusların aktarılması beklenirken, sistemdeki bazı değişkenlerin sıfırlanması ya da hatalı tanımlanması sebebiyle bonuslar aktif olmayabilir. Bu durum, oyuncuların grup içindeyken beklentileri doğrultusunda güç kazanamamasına neden olur.

OLASI HATALAR
- Oyuncu gruba katıldığında bonus etkileri görünmüyor.
- Bonus efektleri geçici olarak gözüküp sonra kayboluyor.
- Sunucu yeniden başlatıldığında bonuslar tekrar çalışmıyor.

C++ TARAFINDA DÜZELTME YÖNTEMLERİ
Grup bonus hatasını düzeltmek için öncelikle game sunucusu üzerindeki grup yönetimi fonksiyonlarını incelemek gerekir. Bu fonksiyonlar genellikle C++ dilinde yazılmıştır ve src/server/game/src/char.cpp veya benzeri dosyalarda yer alır. Burada dikkat edilmesi gereken bazı önemli noktalar vardır:

1. Party sınıfında bonus değerlerinin doğru şekilde güncellenmesi gerekir.
2. Grup üyelerine bonusların doğru zamanda uygulanması sağlanmalıdır.
3. Bonus efektlerinin istemciye (client) doğru şekilde gönderilmesi gerekir.

UYGULAMA ADIMLARI
Adım 1: party_bonus.cpp dosyasını açın ve bonus fonksiyonlarının doğru çalışıp çalışmadığını kontrol edin.
Adım 2: Grup bonus hesaplama fonksiyonunu güncelleyin. Bu işlem sırasında bonus değerlerinin grup liderine göre değil, tüm üyelere göre doğru şekilde dağıtılmasına dikkat edin.
Adım 3: Bonus etkilerinin her oyuncuya özel olarak uygulanıp uygulanmadığını kontrol edin. Gerekirse SendPacketToClient fonksiyonunu kullanarak istemci tarafında da güncelleme yapın.

VERİTABANI TARAFI
Bazı durumlarda, bonus verileri veritabanında doğru şekilde saklanmıyor olabilir. DB tarafında party_bonus_data tablosunun doğru yapılandırıldığından emin olun. Bonus bilgileri grup ID'sine göre doğru şekilde sorgulanmalı ve grup üyeleriyle eşleştirilmelidir.

SONUÇ
Metin2 özel sunucularında grup bonus hatası gibi hatalar, oyuncu memnuniyetini doğrudan etkiler. Bu tür hataları çözmek için hem C++ hem de veritabanı tarafında titiz bir şekilde analiz ve düzeltme yapılmalıdır. Bu yazıda belirtilen adımlar sayesinde, grup bonus sisteminin doğru şekilde çalışması sağlanabilir ve oyuncuların PvP deneyimi zenginleştirilebilir.


Metin2 Group Bonus Bug and How to Fix with C++


INTRODUCTION
While developing on Metin2 private servers, some bugs can seriously affect the player experience. One of these errors is related to the Group Bonus system. Especially on PvP-focused servers, group bonuses are important because they allow players to form stronger combinations when they gather together. In this article, we will discuss the causes of the Group Bonus bug that occurs on C++ based Metin2 servers and how to fix it.

CAUSES AND CHARACTER BEHAVIOR
These types of errors usually stem from logical mistakes made during group bonus calculations on the server side or from incomplete data flow between the database and the server. For example, while a player joins a group expecting their bonuses to take effect, the bonuses might not activate due to certain variables being reset or incorrectly defined within the system. This causes players to fail to gain expected strength while in a group.

POSSIBLE ERRORS
- Bonuses do not appear after joining a group.
- Bonus effects appear temporarily and then disappear.
- After restarting the server, bonuses stop working again.

FIXING METHODS ON THE C++ SIDE
To fix the Group Bonus bug, you first need to examine the group management functions on the game server. These functions are generally written in C++ and located in files like src/server/game/src/char.cpp. Some key points to pay attention to here are:

1. Ensure bonus values are updated correctly within the Party class.
2. Make sure bonuses are applied to group members at the right time.
3. Verify that bonus effects are properly sent to the client.

IMPLEMENTATION STEPS
Step 1: Open party_bonus.cpp and check whether the bonus functions work correctly.
Step 2: Update the group bonus calculation function. Ensure that bonus values are distributed correctly for all members, not just the group leader.
Step 3: Check if the bonus effects are applied individually to each player. If necessary, update the client side using the SendPacketToClient function.

DATABASE SIDE
In some cases, bonus data may not be stored correctly in the database. Ensure that the party_bonus_data table is properly configured in the DB. Bonus information should be queried according to the group ID and matched correctly with group members.

CONCLUSION
Bugs such as the Group Bonus error directly impact player satisfaction in Metin2 private servers. To resolve such issues, analysis and fixes must be done carefully on both the C++ and database sides. With the steps outlined in this article, the Group Bonus system can be made to function properly, enhancing the PvP experience for players.
 

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

Benzer konular

Geri
Üst Alt