Bu küçük rehberde size yeni Aura efektlerinin item_list.txt dosyasından otomatik olarak nasıl yükleneceğini göstereceğim.
Pengerin Yapmış Oldugu Bir Eklentidir.
1.0.) Open GameLib/ItemData.hPengerin Yapmış Oldugu Bir Eklentidir.
1.1.) Add this anywhere into the class CItemData as public (recommended below of the enums there)
#ifdef ENABLE_AURA_SYSTEM
enum EAuraMisc
{
AURA_GRADE_MAX_NUM = 6,
};
#endif
1.2.) Add the followings at the bottom of the class CItemData:
#ifdef ENABLE_AURA_SYSTEM
protected:
DWORD m_dwAuraEffectID;
public:
void SetAuraEffectID(const char* szAuraEffectPath);
DWORD GetAuraEffectID() const { return m_dwAuraEffectID; }
#endif
2.0.) Open GameLib/ItemData.cpp
2.1.) Add the following code at the top of the file where the includes are:
#ifdef ENABLE_AURA_SYSTEM
#include "../EffectLib/EffectManager.h"
#endif
2.2.) Paste this new function anywhere you want:
#ifdef ENABLE_AURA_SYSTEM
void CItemData::SetAuraEffectID(const char* szAuraEffectPath)
{
if (szAuraEffectPath)
CEffectManager::Instance().RegisterEffect2(szAuraEffectPath, &m_dwAuraEffectID);
}
#endif
2.2.) Last put this code into the CItemData::Clear function:
#ifdef ENABLE_AURA_SYSTEM
m_dwAuraEffectID = 0;
#endif
3.0.) Open GameLib/ItemManager.cpp
3.1.) Edit your LoadItemScale function like this way: (I do not know how your look like so you must change a bit probably depends how your code looks like)
#ifdef ENABLE_AURA_SYSTEM
CItemData* pItemData = MakeItemData(dwItemVNum);
BYTE bGradeMax = CItemData::SASH_GRADE_MAX_NUM;
if (pItemData->GetType() == CItemData::ITEM_TYPE_COSTUME && pItemData->GetSubType() == CItemData::COSTUME_AURA)
bGradeMax = CItemData::AURA_GRADE_MAX_NUM;
for (int i = 0; i < bGradeMax; ++i)
#else
for (int i = 0; i < CItemData::SASH_GRADE_MAX_NUM; ++i)
#endif
{
pItemData = MakeItemData(dwItemVNum + i);
if (pItemData)
pItemData->SetItemTableScaleData(byJob, bySex, xScale, yScale, zScale, xPosScale, yPosScale, zPosScale);
}
3.2.) In the LoadItemList function find this:
if (4 == TokenVector.size())
{
const std::string& c_rstrModelFileName = TokenVector[3];
pItemData->SetDefaultItemData(c_rstrIcon.c_str(), c_rstrModelFileName.c_str());
}
3.3.) And replace it with this one:
if (4 == TokenVector.size())
{
#ifdef ENABLE_AURA_SYSTEM
if (!strcmp(c_rstrType.c_str(), "AURA"))
{
const std::string& c_rstrAuraEffectFileName = TokenVector[3];
pItemData->SetAuraEffectID(c_rstrAuraEffectFileName.c_str());
pItemData->SetDefaultItemData(c_rstrIcon.c_str());
}
else
{
const std::string& c_rstrModelFileName = TokenVector[3];
pItemData->SetDefaultItemData(c_rstrIcon.c_str(), c_rstrModelFileName.c_str());
}
#else
const std::string& c_rstrModelFileName = TokenVector[3];
pItemData->SetDefaultItemData(c_rstrIcon.c_str(), c_rstrModelFileName.c_str());
#endif
}
[C ++] Başlangıçta Aura Etkilerini Yükleme
Metin2 özel sunucu geliştirme sürecinde, oyuncuların giriş anında belli aura efektlerinin yüklenmesi, kullanıcı deneyimini artırmak açısından oldukça önemlidir. Bu makalede, C++ tabanlı game server programming ile nasıl başlangıçta aura etkilerinin yükleneceğini adım adım inceleyeceğiz.
Aura Nedir?
Aura, bir karakterin üzerinde sürekli aktif olan görsel veya mekanik etkilerdir. Örneğin bir karakterin üzerine 'Hayalet Pelerin' gibi bir aura efekti eklendiğinde, o karakterin görünümünde değişiklikler yapılır. Bu efektler genellikle Python GUI arayüzleriyle de yönetilebilir.
C++ Kaynak Kodlarında Aura Etkisi Yükleme
Metin2 özel sunucularda, aura efektlerinin başlatılması için öncelikle client src ve server src dosyalarında gerekli düzenlemelerin yapılması gerekir. Aura efektleri genellikle karakterin login olduğu anda game server üzerinden başlatılır. Bunun için C++ script dosyalarında belirli fonksiyonlar tanımlamak gerekir.
Örnek Kod Yapısı:
void LoadAuraOnLogin(LPCHARACTER ch)
{
if (!ch) return;
// Aura ID'si burada tanımlanır
int auraID = 1001;
// Aura efektini başlat
ch->AttachEffect(EFF_AURA_1, auraID);
}
Client Tarafında Görsel Efekt
Oyuncunun karakterine ait aura efektinin doğru şekilde gösterilebilmesi için client src tarafında da uygun animasyon ve model tanımlamaları yapılmalıdır. Bu işlem genellikle uiscript dosyalarıyla yapılır. Py root klasörlerinde bulunan Python GUI[/COLOR] yapıları ile aura efektlerinin kontrolü sağlanabilir.
Otomatik Yükleme Sistemi
Bazı sunucularda aura efektleri, oyuncunun login olduktan sonra belirli bir süre geçtikten sonra otomatik olarak yüklenir. Bu, C++ tarafında bir zamanlayıcı (timer) ile sağlanabilir. Martysama gibi gelişmiş sistemlerde, aura efektleri karaktere özel veritabanından (DB) okunarak atanabilir.
Veritabanı Entegrasyonu
Aura efektlerinin karakter bazında özelleştirilebilmesi için game DB üzerinde ilgili tablolarda değişiklik yapılması gerekir. Bu tablolar genellikle character, aura ve player adlarını taşır. Oyuncunun aura bilgileri bu tabloya göre dinamik olarak yüklenir.
Paketleme ve Dağıtım
Hazırlanan aura yükleme sistemleri, pack dosyaları haline getirilerek sunucuya entegre edilir. Bu paketler genellikle Metin2Dev veya benzeri geliştirme platformlarında test edilir. Source edit işlemleri sırasında dikkat edilmesi gereken en önemli konu, auth ve game sunucularının senkron çalışmasıdır.
Sonuç
C++ ile geliştirilen Metin2 özel sunucularda aura efektlerinin başlangıçta yüklenmesi, hem görsel açıdan hem de kullanıcı deneyimi açısından büyük bir fark yaratır. Doğru yapılandırılmış bir core sistem ile bu efektler kolayca entegre edilebilir. Bu işlem, channel sunucularında da aynı şekilde uygulanabilir. Hata ayıklama sırasında dikkat edilmelidir ki, efektlerin doğru şekilde yüklendiğinden emin olunmalıdır.
[C ++] Loading Aura Effects at Startup
Metin2 private server development process, loading certain aura effects upon player login is very important in order to enhance user experience. In this article, we will examine step by step how to load aura effects at startup with C++-based game server programming.
What is an Aura?
Auras are visual or mechanical effects that remain active on a character continuously. For example, when an aura effect like 'Ghost Cape' is added to a character, changes occur in the character's appearance. These effects can often be managed through Python GUI interfaces as well.
Loading Aura Effects in C++ Source Code
In Metin2 private servers, to initiate aura effects, necessary modifications must be made in both client src and server src files. Aura effects are typically initiated from the game server the moment a character logs in. For this, specific functions must be defined in C++ script files.
Sample Code Structure:
void LoadAuraOnLogin(LPCHARACTER ch)
{
if (!ch) return;
// Aura ID is defined here
int auraID = 1001;
// Start aura effect
ch->AttachEffect(EFF_AURA_1, auraID);
}
Visual Effect on Client Side
To ensure the aura effect for the player's character is displayed correctly, appropriate animation and model definitions must be made on the client src side. This process is usually done via uiscript files. The control of aura effects can be achieved using Python GUI structures found in py root folders.
Auto Load System
In some servers, aura effects are loaded automatically after a certain period following the player's login. This can be accomplished with a timer on the C++ side. In advanced systems like Martysama, aura effects can be retrieved from the character-specific database (DB) and assigned accordingly.
Database Integration
To customize aura effects per character, changes must be made to relevant tables in the game DB. These tables usually carry names such as character, aura, and player. Player's aura information is dynamically loaded based on these tables.
Packaging and Distribution
The prepared aura loading systems are integrated into the server by converting them into pack files. These packages are often tested on development platforms like Metin2Dev. During source edit operations, care must be taken to ensure synchronization between auth and game servers.
Conclusion
Loading aura effects at startup in Metin2 private servers developed with C++ creates a significant difference both visually and in terms of user experience. With a properly configured core system, these effects can easily be integrated. This process can also be applied similarly on channel servers. During debugging, ensure that effects are loaded correctly.
