Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
- <li data-xf-list-type="ul">Server\src\game\src\DragonSoul.h
Kod:
//1.1) Search for: bool DragonSoulItemInitialize(LPITEM pItem); //1.2) Add after: bool AreActivedAllSlotsDragonSoulByPage(const LPCHARACTER ch, const BYTE bPageIndex = DRAGON_SOUL_DECK_0) const;
Kod:
//1.1) Search for: BYTE GetStrengthIdx(DWORD dwVnum) { return (dwVnum / 10) % 10; } //1.2) Add after: bool DSManager::HasActivedAllSlotsByPage(const LPCHARACTER ch, const uint8_t bPageIndex) const { if (!ch || bPageIndex >= DRAGON_SOUL_DECK_MAX_NUM) return false; const uint16_t iDragonSoulDeckAffectType = AFFECT_DRAGON_SOUL_DECK_0 + bPageIndex; // 540 + [0 or 1] if (!ch->FindAffect(iDragonSoulDeckAffectType)) return false; // start : 32 + ([0 or 1] * 6) = [32 or 38] // end : start + 6 const uint8_t iStartIndex = WEAR_MAX_NUM + (bPageIndex * DS_SLOT_MAX); const uint8_t iEndIndex = iStartIndex + DS_SLOT_MAX; BYTE bSlotActive = 0; for (uint8_t bCell = iStartIndex; bCell < iEndIndex; ++bCell) // {0: 32-38, 1: 38-44} { const LPITEM pkItem = ch->GetWear(bCell); if (pkItem && pkItem->IsDragonSoul()) { if (IsTimeLeftDragonSoul(pkItem) && IsActiveDragonSoul(pkItem)) ++bSlotActive; } } return (bSlotActive == DS_SLOT_MAX); }
How-To-Use-Ex:
Kod:
#include "DragonSoul.h" const DSManager & rkDSManager = DSManager::instance(); if (rkDSManager.HasActivedAllSlotsByPage(ch, DRAGON_SOUL_DECK_0)) { ch->ChatPacket(CHAT_TYPE_INFO, "DragonSoul: You've all of the dragon souls active in page 1."); // do something } if (rkDSManager.HasActivedAllSlotsByPage(ch, DRAGON_SOUL_DECK_1)) { ch->ChatPacket(CHAT_TYPE_INFO, "DragonSoul: You've all of the dragon souls active in page 2."); // do something
Metin2'de Dragon Soul Sistemi İçin Tüm Slotların Aktif Olup Olmadığını Kontrol Eden C++ Kodu
Metin2 özel sunucularında geliştirme yaparken, oyuncuların etkileşimde bulunduğu birçok sistem vardır. Bunlardan birisi de Dragon Soul sistemidir. Bu sistem, oyuncuların farklı bonuslar kazanmalarını sağlayan bir güçlendirme mekaniğidir. Her bir sayfada birden fazla slot bulunabilir ve bu slotların herbiri belirli bir miktarda bonus sağlar. Bu yazıda, C++ kullanarak Dragon Soul[/CODE]'da bir sayfadaki tüm slotların aktif olup olmadığını kontrol eden kodu nasıl yazacağımızı detaylıca inceleyeceğiz.
Dragon Soul Sistemi Nedir?
Dragon Soul, Metin2 oyununda karakterlerin güçlerini artırmak amacıyla kullanılan bir sistemdir. Her oyuncunun birden fazla sayfası olabilir ve her sayfada 6 adet slot bulunur. Bu slotlara uygun itemler takılarak bonuslar sağlanır. Ancak bazı durumlarda, belirli bir sayfanın tamamen dolu olup olmadığını kontrol etmek isteyebiliriz. Örneğin, bir görev veya ödüllü aktivite için tüm slotların dolu olması gerekebilir.
Tüm Slotlar Aktif mi?
C++ tarafında, Dragon Soul sayfasındaki slotların her biri için bir kontrol yapılması gerekir. Eğer tüm slotlar doluysa, bir işlem başlatılabilir. Aşağıda bu kontrolü yapan örnek bir fonksiyon örneği verilmiştir:
Kod:
bool AreAllSlotsActiveInPage(LPCHARACTER ch, int page) {[BR][/BR] if (!ch) return false;[BR][/BR][BR][/BR] for (int i = 0; i < DS_SLOT_COUNT_PER_PAGE; ++i) {[BR][/BR] if (!ch->GetDSBySlot(page, i)) { // Eğer slot boşsa[BR][/BR] return false;[BR][/BR] }[BR][/BR] }[BR][/BR] return true; // Tüm slotlar dolu[BR][/BR]}
Kod Açıklaması
Fonksiyon, bir karakter nesnesi (LPCHARACTER) ve bir sayfa numarası alır. Her bir slot incelenir ve eğer bir slot boşsa fonksiyon false döner. Eğer tüm slotlar doluysa true döner. Bu fonksiyon, bir quest, bir event veya özel bir bonus sistemini tetiklemek için kullanılabilir.
Metin2 Sunucu Geliştirme İçin Faydalı Bilgiler
Metin2 özel sunucularında C++ sistemleri geliştirmek, hem oyuncular için daha keyifli bir deneyim sunar hem de sunucunuzun diğerlerinden ayrılmasını sağlar. Dragon Soul gibi sistemlerin geliştirilmesi, oyuncuların uzun süre kalmasını teşvik eder. Ayrıca, doğru kodlama ile performans kaybını da minimize edebilirsiniz.
Kaynak Kod Paylaşımı
Metin2 lobby olarak bizler, sunucu geliştiricileri için sürekli yeni sistemler hazırlamaktayız. C++ kaynak kodlarımız, kolay entegrasyon ve okunabilirlik açısından optimize edilmiştir. Bu gibi küçük ama etkili kontroller, büyük sistemlerin temelini oluşturur.
Metin2 Lobby - Metin2 Sunucu Geliştirme Rehberleri
Checking if All Slots are Activated in Dragon Soul Page with C++ in Metin2
While developing private Metin2 servers, there are many systems players interact with. One of these is the Dragon Soul system. This system provides various bonuses to players through a power-up mechanism. Each page contains multiple slots, and each of these slots grants specific bonuses. In this article, we will examine in detail how to write C++ code that checks whether all slots on a Dragon Soul page are active.
What is the Dragon Soul System?
Dragon Soul is a power-up system in Metin2 that allows players to enhance their character stats. Each player has multiple pages, and every page holds up to 6 slots. Equipping items into these slots grants stat bonuses. However, in certain cases, you might want to check whether all slots on a specific page are filled. For instance, a quest or reward might require all slots to be occupied.
Are All Slots Active?
Within the C++ environment, each slot on a Dragon Soul page must be checked individually. If all slots are filled, a specific action can be triggered. Below is an example function that performs such a check:
Kod:
bool AreAllSlotsActiveInPage(LPCHARACTER ch, int page) {[BR][/BR] if (!ch) return false;[BR][/BR][BR][/BR] for (int i = 0; i < DS_SLOT_COUNT_PER_PAGE; ++i) {[BR][/BR] if (!ch->GetDSBySlot(page, i)) { // If slot is empty[BR][/BR] return false;[BR][/BR] }[BR][/BR] }[BR][/BR] return true; // All slots are filled[BR][/BR]}
Code Explanation
The function takes a character object (LPCHARACTER) and a page number. It iterates through each slot in the given page, and returns false if any slot is empty. If all slots are filled, it returns true. This function can be used to trigger events, quests, or special bonuses based on full slot activation.
Helpful Info for Metin2 Server Development
Developing C++ systems for Metin2 private servers enhances player experience and helps distinguish your server from others. Developing systems like Dragon Soul encourages longer player retention. Moreover, proper coding practices help minimize performance losses.
Source Code Sharing
As Metin2 Lobby, we continuously develop new systems for server developers. Our C++ source codes are optimized for easy integration and readability. Such small but effective checks form the foundation of larger systems.
Metin2 Lobby - Guides for Metin2 Server Development
